@frontegg/js 6.65.0-alpha.1 → 6.66.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return yT},AdminPortalRenderer:function(){return pT},AppHolder:function(){return P},CheckoutDialog:function(){return fT},FronteggApp:function(){return uT},HostedLogin:function(){return dT},LoginBoxRenderer:function(){return hT},defaultTheme:function(){return ST},getThemeAdminByName:function(){return gT},getThemeByName:function(){return vT},initialize:function(){return wT}});var e={};n.r(e),n.d(e,{Delete:function(){return Xo},Get:function(){return Ho},Patch:function(){return Yo},Post:function(){return Jo},PostDownload:function(){return Zo},Put:function(){return Qo},getBaseUrl:function(){return zo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Ua},getSubTenantsAsTree:function(){return Ma},getTenants:function(){return _a},switchTenant:function(){return Ra}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return rr},OAuthLogout:function(){return Cr},SocialLoginProviders:function(){return ar},acceptInvitation:function(){return Lr},activateAccount:function(){return kr},bulkCreateIPRestriction:function(){return er},changePhoneNumber:function(){return ys},changePhoneNumberWithVerification:function(){return us},checkIfAllowToRememberMfaDevice:function(){return xl},createDomainRestriction:function(){return Ha},createIPRestriction:function(){return Za},createOrUpdateSessionConfigrations:function(){return El},createSSOConfiguration:function(){return Gl},createSSOConfigurationByMetadata:function(){return ql},createSSODomain:function(){return Jl},createSSOGroup:function(){return es},createSamlGroup:function(){return pl},deleteAllSessionsForUser:function(){return Dl},deleteDomainRestriction:function(){return Ya},deleteIPRestriction:function(){return nr},deleteSSOConfiguration:function(){return zl},deleteSSODomain:function(){return Yl},deleteSSOGroup:function(){return ns},deleteSamlGroup:function(){return vl},deleteSessionForUser:function(){return Cl},deleteTenantApiToken:function(){return Nl},deleteUserApiToken:function(){return $l},disableMFAAuthenticatorApp:function(){return Gr},disableMFASMS:function(){return zr},disableMFAWebAuthn:function(){return Hr},disableMfa:function(){return Kr},enrollMFAAuthenticatorApp:function(){return $r},enrollMFAAuthenticatorAppForLogin:function(){return Qr},enrollMFASMS:function(){return xr},enrollMFASMSForLogin:function(){return el},enrollMFAWebAuthn:function(){return jr},enrollMFAWebAuthnForLogin:function(){return ol},enrollMfa:function(){return Mr},exchangeOAuthTokens:function(){return rs},forgotPassword:function(){return Dr},generateLoginResponse:function(){return fr},generateLoginResponseFromOAuthResponse:function(){return pr},generateLoginResponseV2:function(){return gr},getActivateAccountStrategy:function(){return Tr},getCaptchaPolicy:function(){return Wa},getCurrentUserSession:function(){return Ll},getCurrentUserSessions:function(){return Il},getDomainRestrictions:function(){return za},getDomainRestrictionsConfig:function(){return qa},getGlobalSecurityPolicy:function(){return Na},getIPRestrictions:function(){return Qa},getIPRestrictionsConfig:function(){return Xa},getLockoutPolicy:function(){return Va},getMFADevices:function(){return Jr},getMFAStrategiesConfig:function(){return hs},getMfaPolicy:function(){return $a},getOidcConfiguration:function(){return hl},getPasswordConfigPolicy:function(){return Ba},getPasswordHistoryPolicy:function(){return Ka},getSSOConfigurations:function(){return Kl},getSSODefaultRoles:function(){return Xl},getSSOGroups:function(){return is},getSSOPublicConfiguration:function(){return ml},getSamlConfiguration:function(){return ll},getSamlRoles:function(){return yl},getSamlRolesGroups:function(){return fl},getSamlVendorConfiguration:function(){return cl},getSessionConfigurations:function(){return wl},getSocialLoginProviders:function(){return bl},getSocialLoginProvidersV2:function(){return Al},getTenantApiTokensData:function(){return _l},getUserApiTokensData:function(){return Rl},getUserById:function(){return Fl},getVendorConfig:function(){return Tl},getVendorMfaPolicy:function(){return Fa},getVendorPublicAuthStrategiesConfig:function(){return vs},loadPasswordConfig:function(){return _r},login:function(){return br},loginViaSocialLogin:function(){return kl},loginWithMfa:function(){return Ar},logout:function(){return Er},oidcPostLogin:function(){return mr},oidcPostLoginV2:function(){return as},passwordlessPostLogin:function(){return jl},passwordlessPreLogin:function(){return Vl},postLogin:function(){return hr},preDisableMFASMS:function(){return Br},preDisableMFAWebAuthn:function(){return qr},preEnrollMFAAuthenticatorApp:function(){return Nr},preEnrollMFAAuthenticatorAppForLogin:function(){return Yr},preEnrollMFASMS:function(){return Fr},preEnrollMFASMSForLogin:function(){return Zr},preEnrollMFAWebAuthn:function(){return Vr},preEnrollMFAWebAuthnForLogin:function(){return il},preLogin:function(){return Sr},preLoginV2:function(){return os},preLoginWithIdpType:function(){return vr},preVerifyMFASMSForLogin:function(){return tl},preVerifyMFAWebAuthnForLogin:function(){return al},recoverMfaToken:function(){return Ur},refreshToken:function(){return Or},refreshTokenV2:function(){return wr},resendActivationEmail:function(){return Pr},resendInvitationEmail:function(){return Ir},resetPassword:function(){return Rr},resetPhoneNumber:function(){return ss},revokeSessionsForUser:function(){return Ol},saveLockoutPolicy:function(){return ja},saveMfaPolicy:function(){return xa},savePasswordHistoryPolicy:function(){return Ga},setSSODefaultRoles:function(){return Zl},signUpUser:function(){return Pl},silentOAuthRefreshToken:function(){return ls},testCurrentIp:function(){return ir},testCurrentIpInAllowList:function(){return or},updateDomainRestrictionConfig:function(){return Ja},updateIPRestrictionConfig:function(){return tr},updateSSOConfiguration:function(){return Bl},updateSSOConfigurationByMetadata:function(){return Hl},updateSSOGroup:function(){return ts},updateSamlConfiguration:function(){return sl},updateSamlGroup:function(){return Sl},updateSamlRoles:function(){return gl},updateSamlVendorMetadata:function(){return ul},updateTenantApiTokensData:function(){return Ml},updateUserApiTokensData:function(){return Ul},validateSSODomain:function(){return Ql},validateSamlDomain:function(){return dl},verifyChangePhoneNumber:function(){return ds},verifyInviteToken:function(){return Wl},verifyMFAAuthenticatorAppForLogin:function(){return Xr},verifyMFASMSForLogin:function(){return nl},verifyMFAWebAuthnForLogin:function(){return rl},verifyMfa:function(){return Wr},verifyNewDeviceSession:function(){return Ss},verifyResetPhoneNumber:function(){return cs},webAuthnCreateNewDeviceSession:function(){return ps},webAuthnPostLogin:function(){return gs},webAuthnPreLogin:function(){return fs}});var a={};n.r(a),n.d(a,{addUser:function(){return Ps},changePassword:function(){return ks},createInviteUserLink:function(){return Os},deleteInviteUserLink:function(){return Es},deleteUser:function(){return Is},getInviteLinkConfiguration:function(){return Ds},getInviteUserLink:function(){return Cs},getProfile:function(){return ms},loadAvailablePermissions:function(){return _s},loadAvailableRoles:function(){return Rs},loadStats:function(){return Us},loadUsers:function(){return Ts},resendActivationLink:function(){return Ms},resendInvitationLink:function(){return Ns},resendInvitationLinkToAllTenants:function(){return $s},updateInviteUserLink:function(){return ws},updateProfile:function(){return bs},updateProfileImage:function(){return As},updateUser:function(){return Ls}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Ws},getCurrentUserIpMetadata:function(){return xs},getIpAdressMetadata:function(){return Ks},getNotificationsMetadata:function(){return Vs},getSamlMetadata:function(){return js}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Qs},getReport:function(){return Hs},getReports:function(){return qs},renderReport:function(){return Js},scheduleReport:function(){return Ys},sendReport:function(){return Xs}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Zs},markAllAsRead:function(){return nc},updateNotificationIsPinned:function(){return tc},updateNotificationStatus:function(){return ec}});var c={};n.r(c),n.d(c,{exportAudits:function(){return rc},getAudits:function(){return oc},getAuditsStats:function(){return ac}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return bc},deleteEmailSubscriptions:function(){return hc},deleteSMSConfiguration:function(){return Lc},deleteSMSSubscriptions:function(){return Pc},deleteSlackConfiguration:function(){return fc},deleteWebhooksConfiguration:function(){return Ec},getCategories:function(){return _c},getChannelMaps:function(){return Uc},getEmailConfiguration:function(){return pc},getSMSConfiguration:function(){return Ac},getSlackChannels:function(){return dc},getSlackConfiguration:function(){return cc},getSlackScope:function(){return uc},getWebhookLog:function(){return Cc},getWebhooksConfigurations:function(){return Oc},patchEmailConfiguration:function(){return vc},patchSMSConfiguration:function(){return Tc},postEmailConfiguration:function(){return Sc},postSMSConfiguration:function(){return kc},postSlackCode:function(){return gc},postSlackConfiguration:function(){return yc},postWebhookRetry:function(){return Rc},postWebhookTest:function(){return Dc},postWebhooksConfiguration:function(){return wc},putEmailSubscriptions:function(){return mc},putSMSSubscriptions:function(){return Ic}});var d={};n.r(d),n.d(d,{getSettings:function(){return Nc},updateSettings:function(){return Mc}});var y={};n.r(y),n.d(y,{addRole:function(){return jc},attachPermissionToRoles:function(){return zc},attachPermissionsToRole:function(){return Gc},deleteRole:function(){return Wc},getPermissionCategories:function(){return qc},getPermissions:function(){return Bc},getRoles:function(){return Vc},updateRole:function(){return Kc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},TenantCreatedAction:function(){return wu},TrialEndAction:function(){return Ou},cancelManagedSubscription:function(){return tu},cancelSubscription:function(){return Yc},createStripeCustomer:function(){return pu},createStripePaymentMethodSetupIntentSecret:function(){return vu},createSubscription:function(){return fu},createTenantConfiguration:function(){return bu},getManagedSubscription:function(){return Zc},getManagedSubscriptions:function(){return eu},getPaymentMethod:function(){return du},getPaymentMethods:function(){return uu},getPaymentProviders:function(){return Au},getStripeCustomer:function(){return gu},getStripePaymentProviderConfiguration:function(){return Su},getSubscription:function(){return Jc},getSubscriptionInvoice:function(){return lu},getSubscriptionInvoicePdf:function(){return su},getSubscriptionInvoices:function(){return ru},getSubscriptionPlan:function(){return au},getSubscriptionPlans:function(){return ou},getSubscriptionSummaries:function(){return hu},getSubscriptions:function(){return Hc},getTenantConfiguration:function(){return mu},getVendorPublicConfigurations:function(){return ku},renewManagedSubscription:function(){return nu},renewSubscription:function(){return Qc},updateManagedSubscription:function(){return iu},updatePaymentMethodBillingDetails:function(){return yu},updateSubscription:function(){return Xc}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Uu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Fu},addUserToTenantAndSubTenants:function(){return Nu},loadAllUsers:function(){return Mu},removeUserFromTenantAndSubTenants:function(){return $u},removeUserRolesFromSubTenants:function(){return xu},setUserRolesForSubTenants:function(){return Vu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return ju}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},deleteConfiguration:function(){return Bu},getConfigs:function(){return Wu},updateConfiguration:function(){return Ku}});var h={};n.r(h),n.d(h,{impersonate:function(){return qu}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return rr},ContextHolder:function(){return Ko},FronteggApiError:function(){return Bo},FronteggContext:function(){return Go},ISubscriptionCancellationPolicy:function(){return Iu},ISubscriptionStatus:function(){return Tu},MFAStrategyEnum:function(){return Du},PaymentMethodType:function(){return Pu},ProviderType:function(){return Lu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return Zu},SecondaryAuthStrategy:function(){return Eu},SocialLoginProviders:function(){return ar},TenantType:function(){return _u},UserManagedByEnum:function(){return Ru},WebAuthnDeviceType:function(){return Cu},api:function(){return ed},countConfigurationUsers:function(){return zu},createConfiguration:function(){return Gu},default:function(){return td},deleteConfiguration:function(){return Bu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Hu},fronteggRefreshTokenUrl:function(){return Ju},fronteggSilentRefreshTokenUrl:function(){return Yu},fronteggTenantsUrl:function(){return Xu},fronteggUsersUrl:function(){return Qu},getConfigs:function(){return Wu},loadFeatureFlags:function(){return ju},updateConfiguration:function(){return Ku}});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 Zk},DomainRestrictionsTabFields:function(){return aT},GeneralSettingsTabFields:function(){return iT},InviteUserModalFields:function(){return Xk},IpRestrictionsTabFields:function(){return oT},Metadata:function(){return Bk},PrivacyPageFields:function(){return Qk},ProfilePageFields:function(){return Yk},SecurityPageTabs:function(){return tT},SessionManagementTabFields:function(){return nT},SsoPageTabs:function(){return rT},SubscriptionsPageFields:function(){return eT},fieldAppearance:function(){return lT},tabAppearance:function(){return sT}});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 O(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 w=n(841),E=n.n(w);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,Oe=(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 we(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){we(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)?Oe(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 Oe(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:[]},Ot={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},wt={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},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{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"),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"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),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})))},On={loading:!1,sessions:[]},wn={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:On})},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:On,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Vn),{reducer:Wn,actions:Kn}=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}))},Ot,rn,Dt,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,wn,Dn,Mn,Fn)});const Gn=I({},Kn,wt,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,En,Rn,Nn,xn);var Bn=function(e){return"@@redux-saga/"+e},zn=Bn("CANCEL_PROMISE"),qn=Bn("CHANNEL_END"),Hn=Bn("IO"),Jn=Bn("MATCH"),Yn=Bn("MULTICAST"),Qn=Bn("SAGA_ACTION"),Xn=Bn("SELF_CANCELLATION"),Zn=Bn("TASK"),ei=Bn("TASK_CANCEL"),ti=Bn("TERMINATE"),ni=Bn("LOCATION");function ii(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 oi=function(e){return null==e},ai=function(e){return null!=e},ri=function(e){return"function"==typeof e},li=function(e){return"string"==typeof e},si=Array.isArray,ci=function(e){return e&&ri(e.then)},ui=function(e){return e&&ri(e.next)&&ri(e.throw)},di=function e(t){return t&&(li(t)||gi(t)||ri(t)||si(t)&&t.every(e))},yi=function(e){return e&&ri(e.take)&&ri(e.close)},fi=function(e){return ri(e)&&e.hasOwnProperty("toString")},gi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},pi=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[zn]=function(){clearTimeout(n)},i},Si=function(e){return function(){return e}},vi=Si(!0),hi=function(){},mi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var bi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ai(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ki=function(e){throw e},Ti=function(e){return{value:e,done:!0}};function Pi(e,t,n){void 0===t&&(t=ki),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ti,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ii(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Li=function(e){return Array.apply(null,new Array(e))},Oi=function(e){return function(t){return e(Object.defineProperty(t,Qn,{value:!0}))}},wi=function(e){return e===ti},Ei=function(e){return e===ei},Ci=function(e){return wi(e)||Ei(e)};function Di(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=si(e)?Li(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ci(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=hi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ri(e){return{name:e.name||"anonymous",location:_i(e)}}function _i(e){return e[ni]}var Ui=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)},Mi="TAKE",Ni="CALL",$i="FORK",Fi="SELECT",xi=function(e,t){var n;return(n={})[Hn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Vi(e,t){return void 0===e&&(e="*"),di(e)?(ai(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),xi(Mi,{pattern:e})):yi(n=e)&&n[Yn]&&ai(t)&&di(t)?xi(Mi,{channel:e,pattern:t}):yi(e)?(ai(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),xi(Mi,{channel:e})):void 0;var n}function ji(e,t){return oi(t)&&(t=e,e=void 0),xi("PUT",{channel:e,action:t})}function Wi(e){var t=xi("ALL",e);return t.combinator=!0,t}function Ki(e,t){var n,i=null;return ri(e)?n=e:(si(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&li(n)&&ri(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Gi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Ni,Ki(e,n))}function Bi(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 xi($i,Ki(e,n))}function zi(e){return void 0===e&&(e=Xn),xi("CANCEL",e)}function qi(e){void 0===e&&(e=mi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xi(Fi,{selector:e,args:n})}var Hi=Gi.bind(null,pi);var Ji=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Yi=[],Qi=0;function Xi(e){try{to(),e()}finally{no()}}function Zi(e){Yi.push(e),Qi||(to(),io())}function eo(e){try{return to(),e()}finally{io()}}function to(){Qi++}function no(){Qi--}function io(){var e;for(no();!Qi&&void 0!==(e=Yi.shift());)Xi(e)}var oo=function(e){return function(t){return e.some((function(e){return co(e)(t)}))}},ao=function(e){return function(t){return e(t)}},ro=function(e){return function(t){return t.type===String(e)}},lo=function(e){return function(t){return t.type===e}},so=function(){return vi};function co(e){var t="*"===e?so:li(e)?ro:si(e)?oo:fi(e)?ro:ri(e)?ao:gi(e)?lo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var uo={type:qn},yo=function(e){return e&&e.type===qn};function fo(){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(uo)}))},(e={})[Yn]=!0,e.put=function(e){if(!t)if(yo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Jn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=so),t?e(uo):(e[Jn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ai(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Qn]?l(e):Zi((function(){l(e)}))},r}function go(e,t){var n=e[zn];ri(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var po,So=0,vo=function(){return++So};function ho(e){e.isRunning()&&e.cancel()}var mo=((po={}).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):!yo(e)||r?n(e):n(ti)};try{o.take(l,ai(a)?co(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},po.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Zi((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&ci(t)?go(t,n):n(t)}))},po.ALL=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t);if(0!==r.length){var l=Di(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(si(t)?[]:{})},po.RACE=function(e,t,n,i){var o=i.digestEffect,a=So,r=Object.keys(t),l=si(t)?Li(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ci(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=hi,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)}))},po.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(ci(s))return void go(s,n);if(ui(s))return void Eo(e,s,l.context,So,Ri(a),!1,n);n(s)}catch(e){n(e,!0)}},po.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){oi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},po.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(ui(o))return o;var a=!1;return Pi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!ci(o)})}))}catch(e){return Pi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ri(t)}(c,a);eo((function(){var t=Eo(e,c,s.context,So,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},po.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()&&Ai(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(si(t)){if(0===t.length)return void n([]);var r=Di(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},po.CANCEL=function(e,t,n,i){var o=i.task;t===Xn?ho(o):si(t)?t.forEach(ho):ho(t),n()},po.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)}},po.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ui());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(uo):e.isEmpty()?(n.push(i),i.cancel=function(){Ai(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(uo):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])(uo)}}}}(t.buffer),a=co(i),r=function t(n){yo(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)},po.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},po.FLUSH=function(e,t,n){t.flush(n)},po.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},po.SET_CONTEXT=function(e,t,n,i){var o=i.task;bi(o.context,t),n()},po);function bo(e,t){return e+"?"+t}function Ao(e){var t=e.name,n=e.location;return n?t+" "+bo(n.fileName,n.lineNumber):t}function ko(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 To=null,Po=[],Io=function(e){e.crashedEffect=To,Po.push(e)},Lo=function(){To=null,Po.length=0},Oo=function(){var e,t,n=Po[0],i=Po.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=_i(e))?t.code+" "+bo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Ao(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Ao(e.meta)})),[ko(Po)]).join("\n")};function wo(e,t,n,i,o,a,r){var l;void 0===r&&(r=hi);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||(Ai(o,t),t.cont=hi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=hi,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,Io({meta:o,cancelledTasks:y}),S.isRoot){var i=Oo();Lo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ei?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={})[Zn]=!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(ei,!1))},l.cont=r,l.end=p,l.setContext=function(e){bi(f,e)},l.toPromise=function(){return d||(d=Ji(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function Eo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){ci(t)?go(t,i):ui(t)?Eo(e,t,c.context,n,o,!1,i):t&&t[Hn]?(0,mo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=hi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(ei))},status:0},c=wo(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),Lo()):Ei(e)?(s.status=1,d.cancel(),o=ri(t.return)?t.return(ei):{done:!0,value:ei}):o=wi(e)?ri(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=vo();function s(n,o){a||(a=!0,i.cancel=hi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){To=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=hi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=hi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Co(e,t){for(var n=e.channel,i=void 0===n?fo():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?Ii: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=vo();if(s&&(s.rootSagaStarted=s.rootSagaStarted||hi,s.effectTriggered=s.effectTriggered||hi,s.effectResolved=s.effectResolved||hi,s.effectRejected=s.effectRejected||hi,s.effectCancelled=s.effectCancelled||hi,s.actionDispatched=s.actionDispatched||hi,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=mi;var m={channel:i,dispatch:Oi(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return eo((function(){var e=Eo(m,S,l,v,Ri(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Do=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?fo():a,l=n.sagaMonitor,s=ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Co.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){bi(o,e)},c},Ro=function(e){return{done:!0,value:e}},_o={};function Uo(e){return yi(e)?"channel":fi(e)?String(e):ri(e)?e.name:String(e)}function Mo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===_o)return Ro(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?Ro(t):a}return Pi(l,(function(e){return l(null,e)}),n)}function No(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Uo(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:Bi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Mo({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("+Uo(e)+", "+t.name+")")}function Fo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Gi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Uo(e)+", "+t.name+")")}function xo(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:Gi.apply(void 0,[n].concat(a))},s={done:!1,value:Hi(t)};return Mo({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 Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[No,e,t].concat(i))}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Bi.apply(void 0,[$o,e,t].concat(i))}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];return Bi.apply(void 0,[Fo,e,t].concat(i))}class Ko{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 Ko.instance||(Ko.instance=new Ko),Ko.instance}static setContext(e){Ko.getInstance().context=e}static setAccessToken(e){Ko.getInstance().accessToken=e}static setUser(e){Ko.getInstance().user=e}static setOnRedirectTo(e){Ko.getInstance().onRedirectTo=e}static setLogout(e,t){Ko.getInstance().logout=n=>{n?e(n):Ko.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Ko.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ko.getInstance().accessToken}static getUser(){return Ko.getInstance().user}static onRedirectTo(e,t){return Ko.getInstance().onRedirectTo(e,t)}static logout(e){return Ko.getInstance().logout(e)}}Ko.instance=void 0;const Go={getContext:()=>Ko.getContext(),getAccessToken:()=>Ko.getAccessToken(),getUser:()=>Ko.getUser(),onRedirectTo:(e,t)=>Ko.onRedirectTo(e,t),logout:e=>Ko.logout(e)};class Bo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function zo(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=Ko.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ko.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=zo(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 Bo("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 Bo(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{}}},Ho=async(e,t,n)=>qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Jo=async(e,t,n)=>qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),Yo=async(e,t,n)=>qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Qo=async(e,t,n)=>qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),Xo=async(e,t,n)=>qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Zo=async(e,t,n,i)=>qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ea={v1:"/identity/resources/users/webauthn/v1/devices"},ta={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},na={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ia={v1:"/identity/resources/configurations/v1"},oa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},aa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ra={v1:"/identity/resources/permissions/v1"},la={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}}},sa={v1:"/identity/resources/roles/v1"},ca={v1:"/identity/resources/sub-tenants/users/v1"},ua={v1:"/resources/impersonation/v1/impersonate"},da={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ya={v1:"/team/resources/members/v1"},fa={v1:"/team/resources/roles/v1"},ga={v1:"/team/resources/stats/v1"},pa={v1:"/team/resources/profile"},Sa={v1:"/tenants/resources/account-settings/v1"},va={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ha={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},ma={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"}}}},ba={v1:"/subscriptions/resources/payment-providers/v1"},Aa={v1:"/subscriptions/resources/subscriptions/v1"},ka={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ta={v1:"/reports/engine/resources/triggers/v1"},Pa="/notification",Ia="/audits",La={v1:"/event/resources/configurations/v1"},Oa="/webhook",wa="/oauth",Ea="/flags",Ca="/directory/resources/v1/configurations/scim2",Da="/directory/resources/scim/temp";async function Ra(e){return Qo(`${na.v1}/tenant`,e)}async function _a(){return Ho(`${na.v2}/me/tenants`)}async function Ua(){return Ho(va.v1)}async function Ma(){return Ho(va.tree.v1)}async function Na(){return Ho(ia.v1)}async function $a(){return Ho(`${ia.v1}/mfa-policy`)}async function Fa(){return Ho(`${ia.v1}/mfa-policy/vendor`)}async function xa(e){return e.id?Yo(`${ia.v1}/mfa-policy`,e):Jo(`${ia.v1}/mfa-policy`,e)}async function Va(){return Ho(`${ia.v1}/lockout-policy`)}async function ja(e){return e.id?Yo(`${ia.v1}/lockout-policy`,e):Jo(`${ia.v1}/lockout-policy`,e)}async function Wa(){try{return await Ho(`${ia.v1}/captcha-policy/public`)}catch{return null}}async function Ka(){return Ho(`${ia.v1}/password-history-policy`)}async function Ga(e){return e.id?Yo(`${ia.v1}/password-history-policy`,e):Jo(`${ia.v1}/password-history-policy`,e)}async function Ba(){return Ho(`${ia.v1}/password`)}async function za(){return Ho(`${oa.emailDomain.v1}`)}async function qa(){return Ho(`${oa.emailDomain.v1}/config`)}async function Ha(e){return Jo(`${oa.emailDomain.v1}`,e)}async function Ja(e){return Jo(`${oa.emailDomain.v1}/config`,e)}async function Ya(e){return Xo(`${oa.emailDomain.v1}/${e}`)}async function Qa(e){return Ho(`${oa.ip.v1}`,e)}async function Xa(){return Ho(`${oa.ip.v1}/config`)}async function Za(e){return Jo(`${oa.ip.v1}`,e)}async function er(e){return Jo(`${oa.ip.v1}/bulk`,e)}async function tr(e){return Jo(`${oa.ip.v1}/config`,e)}async function nr(e){return Xo(`${oa.ip.v1}/${e}`)}async function ir(){return Jo(`${oa.ip.v1}/verify`)}async function or(){return Jo(`${oa.ip.v1}/verify/allow`)}let ar,rr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ar||(ar={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(rr||(rr={}));class lr extends Error{constructor(e){super(e)}}const sr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new lr("'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 cr extends Error{constructor(e){super(e)}}const ur=(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(sr(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 sr(t)}})(e.split(".")[n]))}catch(e){throw new cr("Invalid token specified: "+e.message)}},dr=["type"],yr=["type"];async function fr(e){if(!e.accessToken)return e;Ko.setAccessToken(e.accessToken);const t=await Ho(`${na.v2}/me`),n=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(n),n}async function gr(e){if(!e.accessToken)return{user:e};Ko.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Ho(`${na.v2}/me`),_a()]),i=I({},e,e.accessToken?ur(e.accessToken):{},t);return Ko.setUser(i),{user:i,tenants:n}}async function pr(e){Ko.setAccessToken(e.id_token);const t=await Ho(`${na.v2}/me`),n=e.id_token?ur(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 Ko.setUser(i),i}async function Sr(e){try{const{address:t}=await Jo(`${ta.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function vr(e){return Jo(`${ta.v1}/user/saml/prelogin`,e)}async function hr(e){return fr(await Jo(`${ta.v1}/user/saml/postlogin`,e))}async function mr(e){return fr(await Jo(`${ta.v1}/user/oidc/postlogin`,e))}async function br(e){return fr(await Jo(`${ta.v1}/user`,e))}async function Ar(e){return fr(await Jo(`${ta.v1}/user/mfa/verify`,e))}async function kr(e){return Jo(`${na.v1}/activate`,e)}async function Tr(e){return Ho(`${na.v1}/activate/strategy`,e)}async function Pr(e){return Jo(`${na.v1}/activate/reset`,e)}async function Ir(e){return Jo(`${na.v1}/invitation/reset`,e)}async function Lr(e){return Jo(`${na.v1}/invitation/accept`,e)}async function Or(){return fr(await Jo(`${ta.v1}/user/token/refresh`))}async function wr(){return gr(await Jo(`${ta.v1}/user/token/refresh`))}async function Er(){return Jo(`${ta.v1}/logout`)}async function Cr(e){return Ho(`${wa}/logout`,e)}async function Dr(e){return Jo(`${na.v1}/passwords/reset`,e)}async function Rr(e){return Jo(`${na.v1}/passwords/reset/verify`,e)}async function _r(e){return Ho(`${na.v1}/passwords/config`,e)}async function Ur(e){return Jo(`${ta.v1}/user/mfa/recover`,e)}async function Mr(){return Jo(`${na.v1}/mfa/enroll`)}async function Nr(){return Jo(`${na.v1}/mfa/authenticator/enroll`)}async function $r(e){return Jo(`${na.v1}/mfa/authenticator/enroll/verify`,e)}async function Fr(e){return Jo(`${na.v1}/mfa/sms/enroll`,e)}async function xr(e){return Jo(`${na.v1}/mfa/sms/enroll/verify`,e)}async function Vr(){return Jo(`${na.v1}/mfa/webauthn/enroll`)}async function jr(e){return Jo(`${na.v1}/mfa/webauthn/enroll/verify`,e)}async function Wr(e){return Jo(`${na.v1}/mfa/enroll/verify`,e)}async function Kr(e){return Jo(`${na.v1}/mfa/disable`,e)}async function Gr(e,t){return Jo(`${na.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Br(e){return Jo(`${na.v1}/mfa/sms/${e}/disable`)}async function zr(e,t){return Jo(`${na.v1}/mfa/sms/${e}/disable/verify`,t)}async function qr(e){return Jo(`${na.v1}/mfa/webauthn/${e}/disable`)}async function Hr(e,t){return Jo(`${na.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Jr(){return Ho(`${na.v1}/mfa/devices`)}async function Yr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll`,e)}async function Qr(e){return Jo(`${ta.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Xr(e,t){return Jo(`${ta.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Zr(e){return Jo(`${ta.v1}/user/mfa/sms/enroll`,e)}async function el(e){return Jo(`${ta.v1}/user/mfa/sms/enroll/verify`,e)}async function tl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}`,t)}async function nl(e,t){return Jo(`${ta.v1}/user/mfa/sms/${e}/verify`,t)}async function il(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll`,e)}async function ol(e){return Jo(`${ta.v1}/user/mfa/webauthn/enroll/verify`,e)}async function al(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}`,t)}async function rl(e,t){return Jo(`${ta.v1}/user/mfa/webauthn/${e}/verify`,t)}async function ll(){return Ho(`${da.v1}/saml/configurations`)}async function sl(e){return Jo(`${da.v1}/saml/configurations`,e)}async function cl(){return Ho(`${da.v1}/saml/configurations/vendor-config`)}async function ul(e){return Qo(`${da.v1}/saml/configurations/metadata`,e)}async function dl(){return Qo(`${da.v1}/saml/validations/domain`)}async function yl(){return Ho(`${da.v1}/saml/configurations/roles/default`)}async function fl(){return Ho(`${da.v2}/saml/configurations/groups`)}async function gl({roleIds:e}){return Jo(`${da.v1}/saml/configurations/roles/default`,{roleIds:e})}async function pl({roleIds:e,group:t}){return Jo(`${da.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Sl({roleIds:e,group:t,id:n}){return Yo(`${da.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function vl({id:e}){return Xo(`${da.v2}/saml/configurations/groups/${e}`)}async function hl(){return Ho(`${da.v1}/oidc/configurations`)}async function ml(){return Ho(`${da.v2}/configurations/public`)}async function bl(){return Ho(aa.v1)}async function Al(){return Ho(aa.v2)}async function kl({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),Jo(`${ta.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Tl(){return Ho(`${ia.v1}/public`)}async function Pl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Jo(`${na.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await fr(n):void 0,userId:i,tenantId:o}}async function Il(){return Ho(na.sessions.currentUser.v1)}async function Ll(){return Ho(`${na.sessions.currentUser.v1}/current`)}async function Ol(e){return Jo(`${na.sessions.v1}/revoke`,{userId:e})}async function wl(){return Ho(na.sessions.configurations.v1)}async function El(e){await Jo(na.sessions.configurations.v1,e)}async function Cl(e){await Xo(`${na.sessions.currentUser.v1}/${e}`)}async function Dl(){await Xo(`${na.sessions.currentUser.v1}/all`)}async function Rl(){return Ho(na.apiTokens.v1)}async function _l(){return Ho(la.apiTokens.v1)}async function Ul(e){return Jo(na.apiTokens.v1,e)}async function Ml(e){return Jo(la.apiTokens.v2,e)}async function Nl({tokenId:e}){return Xo(`${la.apiTokens.v1}/${e}`)}async function $l({tokenId:e}){return Xo(`${na.apiTokens.v1}/${e}`)}async function Fl({userId:e}){return Ho(`${na.v1}/${e}`)}async function xl(e){return Ho(`${ia.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Vl(e){let{type:t}=e,n=ii(e,dr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function jl(e){let{type:t}=e,n=ii(e,yr);return Jo(`${ta.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Wl({token:e}){return Jo(la.invites.verify.v1,{token:e})}async function Kl(){return Ho(`${da.v1}/configurations`)}async function Gl(e){return Jo(`${da.v1}/configurations`,e)}async function Bl(e,t){return Yo(`${da.v1}/configurations/${e}`,t)}async function zl(e){return Xo(`${da.v1}/configurations/${e}`)}async function ql(e){return Jo(`${da.v1}/configurations/metadata`,e)}async function Hl(e,t){return Qo(`${da.v1}/configurations/${e}/metadata`,t)}async function Jl(e,t){return Jo(`${da.v1}/configurations/${e}/domains`,t)}async function Yl(e,t){return Xo(`${da.v1}/configurations/${e}/domains/${t}`)}async function Ql(e,t){return Qo(`${da.v1}/configurations/${e}/domains/${t}/validate`)}async function Xl(e){return Ho(`${da.v1}/configurations/${e}/roles`)}async function Zl(e,t){return Qo(`${da.v1}/configurations/${e}/roles`,t)}async function es(e,t){return Jo(`${da.v1}/configurations/${e}/groups`,t)}async function ts(e,{roleIds:t,group:n,id:i}){return Yo(`${da.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function ns(e,t){return Xo(`${da.v1}/configurations/${e}/groups/${t}`)}async function is(e){return Ho(`${da.v1}/configurations/${e}/groups`)}async function os(e){return Jo(`${ta.v2}/user/sso/prelogin`,e)}async function as(e){return fr(await Jo(`${ta.v2}/user/oidc/postlogin`,e))}async function rs(e){return pr(await Jo(`${wa}/token`,e))}async function ls(){return pr(await Jo(`${wa}/authorize/silent`))}async function ss(e){return Jo(`${na.v1}/phone/reset`,e)}async function cs(e){return Jo(`${na.v1}/phone/reset/verify`,e)}async function us(e){return Jo(`${na.v1}/phone`,e)}async function ds(e){return Jo(`${na.v1}/phone/verify`,e)}async function ys(e){return Qo(`${na.v1}/phone/change`,e)}async function fs(e){return Jo(`${ta.v1}/webauthn/prelogin`,e)}async function gs(e){return Jo(`${ta.v1}/webauthn/postlogin`,e)}async function ps(){return Jo(ea.v1)}async function Ss(e){return Jo(`${ea.v1}/verify`,e)}async function vs(){return Ho(`${ia.v1}/auth/strategies/public`)}async function hs(){return Ho(`${ia.v1}/mfa/strategies`)}async function ms(e){return Ho(`${na.v2}/me`,null!=e?e:{addRoles:!0})}async function bs(e){return Qo(`${na.v2}/me`,e)}async function As(e){return Qo(`${pa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ks(e){return Jo(`${na.v1}/passwords/change`,e)}async function Ts(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 Ho(ya.v1,I({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Ps(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function Is(e){return Xo(`${ya.v1}/${e.userId}`)}async function Ls(e){return Qo(ya.v1,e)}async function Os(e){return Jo(la.invites.user.v1,I({},e))}async function ws(e){return Yo(la.invites.user.v1,I({},e))}async function Es(){return Xo(la.invites.user.v1)}async function Cs(){return Ho(la.invites.user.v1)}async function Ds(){return Ho(la.invites.configuration.v1)}async function Rs(){return Ho(fa.v1)}async function _s(){return Ho(ra.v1)}async function Us(){return Ho(`${ga.v1}/members`)}async function Ms(e){return Jo(`${ya.v1}/${e.userId}/resendActivationEmail`,{})}async function Ns(e){return Jo(na.v2,I({},e,{provider:"local"}))}async function $s(e){return Jo(na.invitation.resendAll.v1,I({},e))}async function Fs(e){var t,n;const i=await Ho("/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 xs(){const e=await Ho("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Vs=async()=>Fs({entityName:"notifications"}),js=async()=>Fs({entityName:"saml"}),Ws=async()=>Fs({entityName:"audits"}),Ks=async e=>async function(e){const t=await Ho(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Gs=["dataFilters"],Bs=["templateId","dataFilters"],zs=["dataFilters"];async function qs(e){return Ho(`${ka.v2}/tenant-reports`,e)}async function Hs(e){return Ho(`${ka.v2}/${e.id}/tenant-reports`)}async function Js(e){let{dataFilters:t}=e,n=ii(e,Gs);return{html:await Ho(`${Ta.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ys(e){let{templateId:t,dataFilters:n}=e,i=ii(e,Bs);return Jo(`${ka.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Qs(e){let{dataFilters:t}=e,n=ii(e,zs);const i=await Ho(`${Ta.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 Xs(e){return Jo(`${Ta.v1}/tenant-reports`,e)}async function Zs(e){return Ho(Pa,{params:e})}async function ec(e){return Qo(`${Pa}/status`,{params:e})}async function tc(e){const{notificationId:t,pinStatus:n}=e;return Qo(`${Pa}/${n}`,{notificationId:t})}async function nc(){return Jo(`${Pa}/status/mark-all-read`)}const ic=["endpoint","headerProps"];async function oc(e){return Ho(Ia,e)}async function ac(e){return Ho(`${Ia}/stats`,e)}async function rc(e){const{endpoint:t,headerProps:n}=e,i=ii(e,ic);return Zo(`${Ia}/export/${t}`,{properties:n},i)}const lc=["eventKey"],sc=["eventKey"],cc=()=>Ho(`${ha.v1}/slack`),uc=()=>Ho(`${ha.v1}/slack/applications`),dc=()=>Ho(`${ha.v1}/slack/channels`),yc=e=>e.id?Yo(`${ha.v1}/slack/subscription/${e.id}`,e):Jo(`${ha.v1}/slack/subscriptions`,e),fc=e=>Xo(`${ha.v1}/slack/subscriptions/${e.id}`),gc=e=>Jo(`${ha.v1}/slack/applications/registrations`,{code:e}),pc=()=>Ho(`${ha.v1}/emails`),Sc=e=>{let{eventKey:t}=e,n=ii(e,lc);return Jo(`${ha.v1}/emails/${t}`,n)},vc=({eventKey:e,enabled:t})=>Yo(`${ha.v1}/emails/${e}`,{enabled:t}),hc=(e,t)=>Xo(`${ha.v1}/emails/${e}/subscriptions/${t}`),mc=(e,t,n)=>Qo(`${ha.v1}/emails/${t}/subscriptions/${e}`,n),bc=e=>Xo(`${ha.v1}/emails/${e}`),Ac=()=>Ho(`${ha.v2}/sms`),kc=e=>{let{eventKey:t}=e,n=ii(e,sc);return Jo(`${ha.v2}/sms/${t}`,n)},Tc=({eventKey:e,enabled:t})=>Yo(`${ha.v2}/sms/${e}`,{enabled:t}),Pc=(e,t)=>Xo(`${ha.v2}/sms/${e}/subscriptions/${t}`),Ic=(e,t,n)=>Qo(`${ha.v2}/sms/${t}/subscriptions/${e}`,n),Lc=e=>Xo(`${ha.v2}/sms/${e}`),Oc=()=>Ho(Oa),wc=e=>e._id?Yo(`${Oa}/${e._id}`,e):Jo(`${Oa}/custom`,e),Ec=e=>Xo(`${Oa}/${e}`),Cc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ho(`${Oa}/logs/?${i.toString()}`)},Dc=e=>Jo(`${Oa}/test`,e),Rc=e=>Jo(`${Oa}/logs/${e}/retries`),_c=()=>Ho(`${La.v1}/categories`),Uc=e=>Ho(La.v1,{channels:e});async function Mc(e){return Qo(Sa.v1,e)}async function Nc(){return Ho(Sa.v1)}const $c=["roleId"],Fc=["roleId"],xc=["permissionId"];async function Vc(){return Ho(sa.v1)}async function jc(e){return Jo(sa.v1,e)}async function Wc({roleId:e}){return Xo(`${sa.v1}/${e}`)}async function Kc(e){let{roleId:t}=e,n=ii(e,$c);return Yo(`${sa.v1}/${t}`,n)}async function Gc(e){let{roleId:t}=e,n=ii(e,Fc);return Qo(`${sa.v1}/${t}/permissions`,n)}async function Bc(){return Ho(ra.v1)}async function zc(e){let{permissionId:t}=e,n=ii(e,xc);return Qo(`${ra.v1}/${t}/roles`,n)}async function qc(){return Ho(`${ra.v1}/categories`)}async function Hc(){return Ho(ma.subscriptions.v1)}async function Jc(e){return Ho(`${ma.subscriptions.v1}/${e}`)}async function Yc(e){return Qo(`${ma.subscriptions.v1}/${e}/cancellations/`,{})}async function Qc(e){return Qo(`${ma.subscriptions.v1}/${e}/renewals/`,{})}async function Xc(e,{paymentMethodId:t,planId:n}){return Qo(`${ma.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zc(e){return Ho(`${Aa.v1}/${e}`)}async function eu(){return Ho(`${Aa.v1}`)}async function tu(e){return Qo(`${Aa.v1}/${e}/cancellations/`,{})}async function nu(e){return Qo(`${Aa.v1}/${e}/renewals/`,{})}async function iu(e,{paymentMethodId:t,planId:n}){return Qo(`${Aa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ou(){return Ho(ma.plans.v1)}async function au(e){return Ho(`${ma.plans.v1}/${e}`)}async function ru(){return Ho(ma.invoices.v1)}async function lu(e){return Ho(`${ma.invoices.v1}/${e}`)}async function su(e,t){return Ho(`${ma.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const cu=["email"];async function uu(){return Ho(ma.paymentMethods.v1)}async function du(e){return Ho(`${ma.paymentMethods.v1}/${e}`)}async function yu(e,t){let{email:n}=t,i=ii(t,cu);return Yo(`${ma.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function fu(e){return Jo(ma.paymentProviders.stripe.subscriptions.v1,e)}async function gu(e){return Ho(`${ma.paymentProviders.stripe.customers.v1}/${e}`)}async function pu(e){return Jo(`${ma.paymentProviders.stripe.customers.v1}`,e)}async function Su(){return Ho(`${ma.paymentProviders.stripe.publicConfigurations.v1}`)}async function vu(e){return Jo(`${ma.paymentProviders.stripe.setupIntents.v1}`,e)}async function hu(e){return Ho(`${ma.summaries.v1}/${e}`)}async function mu(e){return Ho(`${ma.tenantConfiguration.v1}/${e}`)}async function bu(e){return Jo(`${ma.tenantConfiguration.v1}`,e)}async function Au(){return Ho(ba.v1)}async function ku(){return Ho(`${ma.configurations.vendorPublicConfigurations.v1}`)}let Tu,Pu,Iu,Lu,Ou,wu,Eu,Cu,Du,Ru,_u;async function Uu(){return Ho("/vendors/public")}async function Mu(e){return Ho(ca.v1,e)}async function Nu(e){return Jo(ca.v1,e)}async function $u(e){return Xo(ca.v1,e)}async function Fu(e,t){return Jo(`${ca.v1}/${e}/roles`,t)}async function xu(e,t){return Xo(`${ca.v1}/${e}/roles`,t)}async function Vu(e,t){return Yo(`${ca.v1}/${e}/roles`,t)}async function ju(){return Ho(Ea)}async function Wu(){return Ho(`${Ca}`)}async function Ku(e,t){return Yo(`${Ca}/${e}`,t)}async function Gu(e){return Jo(`${Ca}`,e)}async function Bu(e){return Xo(`${Ca}/${e}`)}async function zu(e){return Ho(`${Da}/${e}/Users/count`)}async function qu(e){return Jo(`${ua.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Tu||(Tu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Pu||(Pu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Iu||(Iu={})),(Lu||(Lu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ou||(Ou={})),function(e){e.CREATE="create_customer"}(wu||(wu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(Eu||(Eu={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Cu||(Cu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Du||(Du={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ru||(Ru={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(_u||(_u={}));const Hu=[`${ta.v1}/logout`,`${ta.v1}/user/saml/postlogin`,`${ta.v2}/user/oidc/postlogin`,`${ta.v1}/user`,`${ta.v1}/user/mfa/verify`,`${ta.v1}/user/token/refresh`,`${na.v1}`,`${na.v1}/signUp`,`${ta.v1}/passwordless/magiclink/postlogin`,`${ta.v1}/passwordless/code/postlogin`,`${ta.v1}/passwordless/smscode/postlogin`,`${na.v1}/activate`,`${na.v1}/invitation/accept`,`${wa}/logout`,`${wa}/token`,`${wa}/authorize/silent`],Ju=`${ta.v1}/user/token/refresh`,Yu=`${wa}/authorize/silent`,Qu=`${na.v2}/me`,Xu=`${na.v2}/me/tenants`;let Zu;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Zu||(Zu={}));const ed={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 td={fetch:e,ContextHolder:Ko,FronteggContext:Go,api:ed,FronteggApiError:Bo,AuthStrategyEnum:rr,SocialLoginProviders:ar,ISubscriptionCancellationPolicy:Iu,ISubscriptionStatus:Tu,PaymentMethodType:Pu,ProviderType:Lu};let nd,id;function od(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function ad(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 rd(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"}(nd||(nd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(id||(id={}));const ld=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),sd={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},cd=I({},sd,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ud=[{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"}],dd={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},yd=I({},dd,{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}),fd={loading:!1,error:void 0,saving:!0,profile:dd},gd={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"},pd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:rr.EmailAndPassword},Sd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},vd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},hd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},md={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},bd={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Ad=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],kd={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:md,roles:Ad,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Td=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Pd={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:[ud[0]]},Id={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:[ud[1]]},Ld={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Od=[Id,Pd],wd=[Ld],Ed=[{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}],Cd=[{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"}],Dd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Rd={isActive:!0,strategy:_n.ALLOW},_d=[{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 Ud,Md,Nd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ud||(Ud={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Md||(Md={})),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"}(Nd||(Nd={})),Nd.profile,Nd.privacy,Nd.personalApiTokens,Nd.account,Nd.users,Nd.security,Nd.sso,Nd.audits,Nd.webhooks,Nd.apiTokens,Nd.roles,Nd.subscriptions;const $d=["events","url"];function*Fd(){yield ji(Gn.setSignUpState({loading:!0}));try{const e=yield Gi(ed.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield ji(Gn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*xd(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,$d);yield ji(Gn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield qi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Gi(ed.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:Md.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Ko.setAccessToken(null==l?void 0:l.accessToken),Ko.setUser(l),!r&&l&&qy(l)){const t=yield Yy(l);yield ji(Gn.setState(t)),a(e.loginUrl)}else yield ji(Gn.setSignUpState({loading:!1,shouldActivate:r,stage:sn.SignUpSuccess})),yield ji(Gn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ji(Gn.loadTenants()))}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setSignUpState({loading:!1,error:e.message}))}yield ji(Gn.setSignUpState({loading:!1}))}function*Vd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield qi((e=>e.auth.signUpState));yield ji(Gn.resetSignUpState()),yield ji(Gn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*jd(){yield Wo(Gn.signUpUser,xd),yield Wo(Gn.resetSignUpStateSoft,Vd)}const Wd={setVendorState:(e,{payload:t})=>I({},e,t)},Kd={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},Gd={loading:!1},{reducer:Bd,actions:zd}=at({name:It,initialState:Gd,reducers:I({},Wd)}),qd=I({},zd,Kd);function*Hd(){yield ji(qd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield ed.vendor.getVendorPublicInfo();yield ji(qd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ji(qd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Jd=["callback"],Yd=["callback"],Qd=["callback"],Xd=["callback"],Zd=["callback"],ey=["callback"];function*ty(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getGlobalSecurityPolicy);yield ji(Gn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha()),yield ji(Gn.loadPublicAuthStrategiesPolicy())}function*ny(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorConfig);yield ji(Gn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*iy(){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorPublicAuthStrategiesConfig);yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*oy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getMfaPolicy);yield ji(Gn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*ay(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getVendorMfaPolicy);yield ji(Gn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*ry(e){let{payload:{callback:t}}=e,n=ii(e.payload,Jd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveMfaPolicy,n);yield ji(Gn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ly(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getLockoutPolicy);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*sy(e){let{payload:{callback:t}}=e,n=ii(e.payload,Yd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.saveLockoutPolicy,n);yield ji(Gn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*cy(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCaptchaPolicy);yield ji(Gn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*uy(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordHistoryPolicy);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*dy(e){let{payload:{callback:t}}=e,n=ii(e.payload,Qd);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.savePasswordHistoryPolicy,n);yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*yy(){yield ji(Gn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getPasswordConfigPolicy);yield ji(Gn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*fy(){yield Wo(Gn.loadSecurityPolicy,ty),yield Vo(Gn.saveSecurityPolicyMfa,ry),yield Vo(Gn.loadSecurityPolicyMfa,oy),yield Vo(Gn.loadSecurityPolicyVendorMfa,ay),yield Vo(Gn.saveSecurityPolicyLockout,sy),yield Vo(Gn.loadSecurityPolicyLockout,ly),yield Vo(Gn.loadSecurityPolicyCaptcha,cy),yield Vo(Gn.saveSecurityPolicyPasswordHistory,dy),yield Vo(Gn.loadSecurityPolicyPasswordHistory,uy),yield Vo(Gn.loadVendorPasswordConfig,yy),yield Vo(Gn.loadPublicSecurityPolicy,ny),yield Vo(Gn.loadPublicAuthStrategiesPolicy,iy)}function*gy(){yield ji(Gn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ji(Gn.setSecurityPolicyPublicState({policy:pd,loading:!1}))}catch(e){yield ji(Gn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*py(){yield ji(Gn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyGlobalState({policy:gd,loading:!1})),yield ji(Gn.loadSecurityPolicyMfa()),yield ji(Gn.loadSecurityPolicyVendorMfa()),yield ji(Gn.loadSecurityPolicyLockout()),yield ji(Gn.loadSecurityPolicyCaptcha())}function*Sy(){yield ji(Gn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:Sd,loading:!1}))}function*vy(){yield ji(Gn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyVendorMfaState({policy:Sd,loading:!1}))}function*hy(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,Xd);yield ji(Gn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},vd,{id:null!=(t=i.id)?t:vd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield ji(Gn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*my(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:vd,loading:!1}))}function*by(e){let{payload:{callback:t}}=e,n=ii(e.payload,Zd);yield ji(Gn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},n,vd,{id:n.id?n.id:vd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Ay(){yield ji(Gn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyLockoutState({policy:vd,loading:!1}))}function*ky(){yield ji(Gn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:hd,loading:!1}))}function*Ty(e){let{payload:{callback:t}}=e,n=ii(e.payload,ey);yield ji(Gn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},n,hd,{id:n.id?n.id:hd.id});null==t||t(i),yield ji(Gn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Py(){yield Wo(Gn.loadSecurityPolicy,py),yield Vo(Gn.loadPublicSecurityPolicy,gy),yield Vo(Gn.saveSecurityPolicyMfa,hy),yield Vo(Gn.loadSecurityPolicyMfa,Sy),yield Vo(Gn.loadSecurityPolicyVendorMfa,vy),yield Vo(Gn.saveSecurityPolicyLockout,by),yield Vo(Gn.loadSecurityPolicyLockout,my),yield Vo(Gn.loadSecurityPolicyCaptcha,Ay),yield Vo(Gn.saveSecurityPolicyPasswordHistory,Ty),yield Vo(Gn.loadSecurityPolicyPasswordHistory,ky)}const Iy=["callback"],Ly=["callback"],Oy=["callback"],wy=["callback"],Ey=["callback","events"],Cy=["callback"],Dy=["callback"],Ry=["callback"],_y=["callback"],Uy=["callback"],My=["callback"],Ny=["callback"],$y=["callback"],Fy=["callback"],xy=["callback","deviceId"],Vy=["callback","deviceId"],jy=["callback","deviceId"],Wy=["callback","deviceId"],Ky={[rr.Code]:vt.loginWithOtc,[rr.EmailAndPassword]:vt.loginWithPassword,[rr.MagicLink]:vt.magicLinkPreLoginSuccess,[rr.SmsCode]:vt.loginWithSmsOtc};function*Gy(){var e;const t=Ko.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 Hi(200),ji(Gn.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*By(){let e;try{var t;const n=yield Gi(ed.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ji(Gn.setState({ssoACS:e}))}function*zy(){try{const{isActive:e}=yield Gi(ed.auth.getSSOPublicConfiguration);yield ji(Gn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const qy=e=>e.mfaRequired&&e.mfaToken?(Ko.setAccessToken(null),Ko.setUser(null),!0):(Ko.setAccessToken(e.accessToken),Ko.setUser(e),!1),Hy=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},Jy=e=>{if(1===e.length){const[t]=e;if(t===Du.AuthenticatorApp)return Qt.authenticatorApp;if(t===Du.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*Yy(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Gi(ed.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Hy(e.mfaDevices)}:(n={step:Jy(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*Qy(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield Gi(Xy):yield Gi(Zy)}function*Xy(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Ko.setAccessToken(null),Ko.setUser(null),void(yield ji(Gn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Gi(ed.auth.exchangeOAuthTokens,t);yield ji(Gn.setState({user:n,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:null,isAuthenticated:!1}))}}function*Zy(){try{const n=Ko.onRedirectTo,{routes:i,loginState:o}=yield qi((e=>e.auth)),{user:a,tenants:r}=yield Gi(ed.auth.refreshTokenV2);if(qy(a)){const e=yield Yy(a);yield ji(Gn.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 ji(Gn.setTenantsState({tenants:r,loading:!1})),yield ji(Gn.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 Gy())}}catch(e){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}}function*ef({payload:{callback:e}}){try{const{ip:t}=yield Gi(ed.metadata.getCurrentUserIpMetadata);yield ji(Gn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*tf({payload:e}){const t=[];e&&(yield ji(Gn.setState({isLoading:!0})),yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi(Fd)),t.push(Gi(iy)),t.push(Gi(zy)),t.push(Gi(Hd)),t.push(Gi(By))),t.push(Gi(Qy)),yield Wi(t),yield ji(Gn.setState({isLoading:!1}))}function*nf({accessToken:e,user:t}){if(!e)return void(yield ji(Gn.setState({user:void 0,isAuthenticated:!1})));const n=Ko.onRedirectTo,{routes:i}=yield qi((e=>e.auth));if(qy(t)){const e=yield Yy(t);yield ji(Gn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*of({payload:e}){const t=[];yield ji(Gn.loadSocialLoginsConfigurationV2()),t.push(Gi(Fd)),t.push(Gi(zy)),t.push(Gi(Hd)),t.push(Gi(By)),t.push(Gi(nf,e)),yield Wi(t)}function*af({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 Gi(ed.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants()),yield ji(Gn.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 ji(Gn.setState({isLoading:!0}));const a=rd(),r=rd(),l=yield Gi(ad,r);localStorage.setItem(At,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${zo(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*rf({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 Gi(ed.auth.exchangeOAuthTokens,a);yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Gy()}}function*lf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Iy);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.changePhoneNumberWithVerification,n);yield ji(Gn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:vt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ly);try{yield ji(Gn.setLoginState({loading:!0})),yield Gi(ed.auth.verifyChangePhoneNumber,n),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Oy);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPreLogin,I({},n,{type:rr.SmsCode}));yield ji(Gn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*uf(e){let{payload:{callback:t}}=e,n=ii(e.payload,wy);try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));const o=yield Gi(ed.auth.passwordlessPreLogin,n),a=Ky[n.type];if(a===vt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield ji(Gn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield ji(Gn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*df(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,Ey);try{yield ji(Gn.setLoginState({loading:!0}));const e=yield Gi(ed.auth.passwordlessPostLogin,i),a=Ko.onRedirectTo,{routes:r}=yield qi((e=>e.auth));if(qy(e)){const t=yield Yy(e);yield ji(Gn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield qi((e=>e.auth)),l=yield Gi(ed.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:Ud.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ji(Gn.setState({user:l,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield ji(Gn.loadTenants()),i.flow===ht.Login?yield Gy():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ji(Gn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*yf({payload:e}){try{yield ji(Gn.setLoginState({loading:!0}));const{name:t}=yield Gi(ed.auth.verifyInviteToken,e);yield ji(Gn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ji(Gn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*ff({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield qi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Gi(ed.auth.preLoginV2,{email:e});if(a){if(r===id.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield qi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield ji(Gn.setLoginState({step:vt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield gf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield gf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*gf(e){let{callback:t}=e,n=ii(e,Cy);const i=yield qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===rr.EmailAndPassword?(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[rr.MagicLink,rr.Code,rr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield ji(Gn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield ji(Gn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*pf({payload:{callback:e}}){try{yield ji(Gn.setLoginState({loading:!0}));const{options:t}=yield Gi(ed.auth.webAuthnCreateNewDeviceSession);t.user.id=pt(t.user.id),t.challenge=pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ji(Gn.setLoginState({error:t.message})),null==e||e(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*Sf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Dy);try{yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Gi(ed.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*vf(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ry);try{var i;yield ji(Gn.setLoginState({loading:!0}));const{options:e}=yield Gi(ed.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 ji(Gn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*hf(e){let{payload:{callback:t}}=e,n=ii(e.payload,_y);try{var i;yield ji(Gn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Gi(ed.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(qy(o)){const e=Ko.onRedirectTo,{routes:t}=yield qi((e=>e.auth)),n=yield Yy(o);yield ji(Gn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Gi(ed.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield ji(Gn.setLoginState({error:void 0})),yield Gy(),null==t||t(!0)}}catch(e){yield ji(Gn.setLoginState({error:e.message})),null==t||t(null)}finally{yield ji(Gn.setLoginState({loading:!1}))}}function*mf({payload:e}){const{onRedirectTo:t,routes:n}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(Gn.setLoginState({loading:!0}));try{const t=yield Gi(ed.auth.postLogin,e);Ko.setAccessToken(t.accessToken),Ko.setUser(t),yield ji(Gn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Gy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ji(Gn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*bf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield ji(Gn.setLoginState({loading:!0}));try{const a=yield Gi(ed.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Ko.setAccessToken(a.accessToken),Ko.setUser(a);const r=Ko.onRedirectTo,{routes:l}=yield qi((e=>e.auth));if(qy(a)){const e=yield Yy(a);yield ji(Gn.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 ji(Gn.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 ji(Gn.loadTenants()),n&&t.flow===ht.Login&&(yield Gy())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Ko.setAccessToken(null),Ko.setUser(null),yield ji(Gn.setLoginState({email:e,error:t.message,loading:!1}))}}function*Af({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield ji(Gn.setLoginState({loading:!0}));try{const o=yield Gi(ed.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 ji(Gn.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 ji(Gn.loadTenants()),yield ji(Gn.setLoginState({error:void 0,loading:!1})),a.flow===ht.Login&&(yield Gy()),null==i||i(!0)}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*kf({payload:e}){yield ji(Gn.setLoginState({loading:!0}));try{yield Gi(ed.auth.recoverMfaToken,e),yield ji(Gn.setLoginState({loading:!1,error:void 0,step:vt.preLogin})),yield ji(Gn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield ji(Gn.setLoginState({error:e.message,loading:!1}))}}function*Tf({payload:e}){const{hostedLoginBox:t}=yield qi((e=>e.auth));yield ji(Gn.setState({isLoading:!0}));try{t?yield Gi(ed.auth.OAuthLogout):yield Gi(ed.auth.logout)}catch{}yield ji(Gn.resetState()),yield ji(Gn.requestAuthorize(!0)),null==e||e()}function*Pf({payload:e}){var t;try{yield Gi(ed.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*If({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 ji(Gn.setMfaState(n)),yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Lf({user:e,tenants:t}){const{loginState:n}=yield qi((e=>e.auth));yield ji(Gn.setUser(e)),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===ht.Login&&(yield Gy()),yield ji(Gn.setState({isAuthenticated:!0}))}function*Of(e){let{payload:{callback:t}}=e,n=ii(e.payload,Uy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preEnrollMFASMSForLogin,n);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wf(e){let{payload:{callback:t}}=e,n=ii(e.payload,My);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFASMSForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield If(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ef(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ny);yield ji(Gn.setLoginState({loading:!0}));try{var i;const e=yield Gi(ed.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 ji(Gn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cf(e){let{payload:{callback:t}}=e,n=ii(e.payload,$y);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Gi(ed.auth.generateLoginResponseV2,i);yield If(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Df(e){let{payload:{callback:t}}=e,n=ii(e.payload,Fy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Gi(ed.auth.generateLoginResponseV2,e);yield If(i),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,xy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.preVerifyMFASMSForLogin,n,i);yield ji(Gn.setMfaState({otcToken:e.otcToken,step:Qt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_f(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Vy);yield ji(Gn.setLoginState({loading:!0}));try{const e=yield Gi(ed.auth.verifyMFASMSForLogin,n,i),o=yield Gi(ed.auth.generateLoginResponseV2,e);yield Lf(o),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Uf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,jy);yield ji(Gn.setLoginState({loading:!0}));try{var o;const e=yield Gi(ed.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 ji(Gn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mf(e){let{payload:{callback:t,deviceId:n}}=e,i=ii(e.payload,Wy);yield ji(Gn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Gi(ed.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Gi(ed.auth.generateLoginResponseV2,o);yield Lf(a),yield ji(Gn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Nf(){yield Wo(Gn.requestAuthorize,tf),yield Wo(Gn.requestAuthorizeSSR,of),yield Wo(Gn.requestHostedLoginAuthorize,af),yield Wo(Gn.handleHostedLoginCallback,rf),yield Wo(Gn.preLogin,ff),yield Wo(Gn.postLogin,mf),yield Wo(Gn.login,bf),yield Wo(Gn.logout,Tf),yield Wo(Gn.silentLogout,Pf),yield Wo(Gn.loginWithMfa,Af),yield Wo(Gn.recoverMfa,kf),yield Wo(Gn.quickSmsPasswordlessPreLogin,cf),yield Wo(Gn.changePhoneNumberWithVerification,lf),yield Wo(Gn.verifyChangePhoneNumber,sf),yield Wo(Gn.passwordlessPreLogin,uf),yield Wo(Gn.passwordlessPostLogin,df),yield Wo(Gn.verifyInviteToken,yf),yield Wo(Gn.webAuthnPrelogin,vf),yield Wo(Gn.webAuthnPostLogin,hf),yield Wo(Gn.webAuthnCreateNewDeviceSession,pf),yield Wo(Gn.webAuthnVerifyNewDeviceSession,Sf),yield Wo(Gn.afterAuthNavigation,Gy),yield Wo(Gn.getUserIP,ef),yield Wo(Gn.preEnrollMFASMSForLogin,Of),yield Wo(Gn.enrollMFASMSForLogin,wf),yield Wo(Gn.preEnrollMFAWebAuthnForLogin,Ef),yield Wo(Gn.enrollMFAWebAuthnForLogin,Cf),yield Wo(Gn.enrollMFAAuthenticatorAppForLogin,Df),yield Wo(Gn.preVerifyMFASMSForLogin,Rf),yield Wo(Gn.verifyMFASMSForLogin,_f),yield Wo(Gn.preVerifyMFAWebAuthnForLogin,Uf),yield Wo(Gn.verifyMFAWebAuthnForLogin,Mf)}function*$f({payload:e}){e&&(yield ji(Gn.setState({isLoading:!0})));const t=yd;yield ji(Gn.loadTenants()),yield ji(Gn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Ff({payload:{callback:e}}){try{const{ip:t}=_d[0];yield ji(Gn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*xf(){yield Wo(Gn.requestAuthorize,$f),yield Wo(Gn.afterAuthNavigation,Gy),yield Wo(Gn.getUserIP,Ff)}const Vf=["callback","samlVendor"],jf=["callback","samlVendor"];function*Wf(){try{var e,t;yield ji(Gn.setSSOState({loading:!0}));const n=yield Gi(ed.auth.getSamlConfiguration),i=yield Gi(ed.auth.getOidcConfiguration),o=yield Gi(ed.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 ji(Gn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSSOState({error:e.message,loading:!1}))}}function*Kf({payload:e}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ji(Gn.setSSOState({error:void 0,[n]:!0}));try{const i=yield ld(e[0]),o=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield ji(Gn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Gf({payload:e}){const{configFile:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield ji(Gn.setSSOState({error:void 0,[o]:!0}));try{const e=yield ld(t),a=yield Gi(ed.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Bf({payload:e}){const{callback:t,samlVendor:n}=e,i=ii(e,Vf),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 ji(Gn.setSSOState({samlConfiguration:I({},o,a)})));if(yield ji(Gn.setSSOState({error:void 0,[r]:!0})),e.type===id.Saml){var l,s;const e=yield Gi(ed.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=od(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 Gi(ed.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*zf({payload:{callback:e}={}}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration));try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.validateSamlDomain),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*qf(){try{const e=yield Gi(ed.auth.getSamlRoles),t=yield Gi(ed.auth.getSamlRolesGroups);yield ji(Gn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}function*Hf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Wi(e.map((e=>Gi(ed.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ji(Gn.setSSOState({error:e.message}))}}(n)),yield qf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Jf({payload:{callback:e,id:t}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.deleteSamlGroup,{id:t}),yield qf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Yf({payload:{group:e,roleIds:t,callback:n}}){try{yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield Gi(ed.auth.createSamlGroup,{group:e,roleIds:t}),yield qf(),yield ji(Gn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Qf({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ji(Gn.setSSOState({loading:!0})),yield Gi(ed.auth.oidcPostLoginV2,t),yield Gi(Qy),yield ji(Gn.setSSOState({loading:!1}))}catch(e){var n;yield ji(Gn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Xf(){yield Vo(Gn.loadSSOConfigurations,Wf),yield Vo(Gn.saveSSOConfigurations,Bf),yield Vo(Gn.saveSSOConfigurationsFile,Kf),yield Vo(Gn.saveSSOConfigurationsFileWithCallback,Gf),yield Vo(Gn.validateSSODomain,zf),yield Vo(Gn.loadSSOAuthorizationRoles,qf),yield Vo(Gn.updateSSOAuthorizationRoles,Hf),yield Vo(Gn.deleteSamlGroup,Jf),yield Vo(Gn.createSamlGroup,Yf),yield Vo(Gn.oidcPostlogin,Qf)}function*Zf(){yield ji(Gn.setSSOState({loading:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:md,loading:!1,firstLoad:!1}))}function*eg({payload:e}){const t="saving";yield ji(Gn.setSSOState({error:void 0,[t]:!0}));const n=I({},yield qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ji(Gn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*tg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=ii(e,jf),r=kd.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 ji(Gn.setSSOState({samlConfiguration:I({},r,l)})));yield ji(Gn.setSSOState({error:void 0,[s]:!0})),yield yt(),l.acsUrl=null==bd||null==(t=bd.configuration)?void 0:t.acsUrl,l.spEntityId=null==bd||null==(n=bd.configuration)?void 0:n.spEntityId;const c=od(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 ji(Gn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*ng({payload:{callback:e}={}}){const t=kd.samlConfiguration;yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({samlConfiguration:I({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*ig(){yield yt(),yield ji(Gn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*og({payload:{callback:e,authorizationRoles:t}}){yield ji(Gn.setSSOState({error:void 0,saving:!0})),yield yt(),yield ji(Gn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*ag(){yield Vo(Gn.loadSSOConfigurations,Zf),yield Vo(Gn.saveSSOConfigurations,tg),yield Vo(Gn.saveSSOConfigurationsFile,eg),yield Vo(Gn.validateSSODomain,ng),yield Vo(Gn.loadSSOAuthorizationRoles,ig),yield Vo(Gn.updateSSOAuthorizationRoles,og)}const rg=["callback"],lg=["callback","ssoConfigId"],sg=["callback","ssoConfigId"];function*cg(){try{return yield Gi(ed.auth.getOidcConfiguration)}catch(e){return null}}function*ug(){try{return yield Gi(ed.metadata.getSamlMetadata)}catch(e){return null}}function*dg(){try{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Wi([Gi(cg),Gi(ug)]),n=yield Gi(ed.auth.getSSOConfigurations);yield ji(Gn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ji(Gn.setSSOError({key:nd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ji(Gn.setSSOLoader({key:nd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*yg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ii(e,rg),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Gi(ed.auth.createSSOConfiguration,I({},n,{enabled:null!=(o=n.enabled)&&o}));yield ji(Gn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*fg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.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 ld(t),o=yield Gi(ed.auth.createSSOConfigurationByMetadata,{metadata:e});yield ji(Gn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*gg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ii(e,lg),o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*pg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.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 ld(i),a=yield Gi(ed.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Sg({payload:e}){yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSOConfiguration,t),yield ji(Gn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*vg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ii(e,sg);yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gi(ed.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?I({},t,{domains:[...t.domains,e]}):t));yield ji(Gn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_DOMAIN,value:!1}))}}function*hg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?I({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ji(Gn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.DELETE_SSO_DOMAIN,value:!1}))}}function*mg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.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 ji(Gn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*bg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Gi(ed.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?I({},e,{roleIds:n}):e));yield ji(Gn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield ji(Gn.setSSOError({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ji(Gn.setSSOLoader({key:nd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ag({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!0}));const o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Wi(t.map((e=>Gi(ed.auth.deleteSSOGroup,n,e)))),yield Wi(e.map((e=>Gi(ed.auth.createSSOGroup,n,e))));const a=yield Gi(ed.auth.getSSOGroups,n),r=o.map((e=>e.id===n?I({},e,{groups:a}):e));yield ji(Gn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*kg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Wi(t.map((t=>Gi(ed.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ji(Gn.setSSOError({key:nd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ji(Gn.setSSOLoader({key:nd.SAVE_SSO_GROUPS,value:!1}))}}function*Tg(){yield Vo(Gn.loadSSOConfigurationsV2,dg),yield Vo(Gn.saveSSOConfigurationV2,yg),yield Vo(Gn.saveSSODomain,vg),yield Vo(Gn.deleteSSODomain,hg),yield Vo(Gn.validateSSODomainV2,mg),yield Vo(Gn.updateSSOConfiguration,gg),yield Vo(Gn.deleteSSOConfiguration,Sg),yield Vo(Gn.setSSOGroups,Ag),yield Vo(Gn.updateSSOGroups,kg),yield Vo(Gn.setSSODefaultRoles,bg),yield Vo(Gn.saveSSOConfigurationByMetadata,fg),yield Vo(Gn.updateSSOConfigurationByMetadata,pg)}const Pg=["callback","profilePictureUrl"],Ig=["callback","profilePictureUrl"];function*Lg(){yield ji(Gn.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 Gi.apply(void 0,[xo,e,t,n].concat(o))}(3,2e3,ed.teams.getProfile),t=yield qi((e=>e.auth.user));Gn.setUser(I({},t,e)),yield ji(Gn.setProfileState({profile:e,loading:!1}))}catch(e){yield ji(Gn.setProfileState({loading:!1,error:e.message}))}}function*Og(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Pg);yield ji(Gn.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 Gi(ed.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 Gi(ed.teams.updateProfile,a),l=yield qi((e=>e.auth.user));yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield ji(Gn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wg({payload:e}){yield ji(Gn.setProfileState({loading:!0}));try{var t;yield Gi(ed.teams.changePassword,e),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Eg(){yield Wo(Gn.loadProfile,Lg),yield Vo(Gn.saveProfile,Og),yield Vo(Gn.changePassword,wg)}function*Cg(){yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setUser(I({},yd,dd))),yield ji(Gn.setProfileState({loading:!1,profile:dd}))}function*Dg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ii(e.payload,Ig);yield ji(Gn.setProfileState({saving:!0,error:null}));const o=fd;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=yd;yield yt(),yield ji(Gn.setUser(I({},l,r))),yield ji(Gn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Rg({payload:e}){var t;yield ji(Gn.setProfileState({loading:!0})),yield yt(),yield ji(Gn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*_g(){yield Wo(Gn.loadProfile,Cg),yield Vo(Gn.saveProfile,Dg),yield Vo(Gn.changePassword,Rg)}const Ug=["callback"],Mg=["callback"],Ng=["callback"],$g=["deviceId","callback"],Fg=["deviceId","callback"],xg=["callback"],Vg=["deviceId"],jg=["deviceId"],Wg=["callback"],Kg=["deviceId"],Gg=["callback"];function*Bg(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*zg(){yield ji(Gn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Gi(ed.auth.enrollMfa);yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message}))}}function*qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ug);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield qi((e=>e.auth.user)),i=yield Gi(ed.auth.verifyMfa,n),o=yield Gi(ed.auth.getMFADevices),a=yield Bg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),yield ji(Gn.setUser(I({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Mg);yield ji(Gn.setMfaState({loading:!0}));try{const e=yield Gi(ed.auth.loginWithMfa,n),i={step:Qt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield ji(Gn.setMfaState(i)),yield ji(Gn.setState({user:e})),yield ji(Gn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Jg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;yield Gi(ed.auth.disableMfa,e);const n=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Yg({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t,n;const i=yield Gi(ed.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 ji(Gn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield ji(Gn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*Qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ng);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Gi(ed.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Gi(ed.auth.getMFADevices),a=yield Bg(i);yield ji(Gn.setMfaState(I({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Xg(e){let{payload:{deviceId:t,callback:n}}=e;ii(e.payload,$g),yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.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 ji(Gn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Zg(e){let{payload:{deviceId:t,callback:n}}=e,i=ii(e.payload,Fg);yield ji(Gn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Gi(ed.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*ep({payload:e}){yield ji(Gn.setMfaState({saving:!0}));try{var t;const n=yield Gi(ed.auth.preEnrollMFASMS,e);yield ji(Gn.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 ji(Gn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*tp(e){let{payload:{callback:t}}=e,n=ii(e.payload,xg);yield ji(Gn.setMfaState({saving:!0}));try{const e=yield Gi(ed.auth.enrollMFASMS,n),i=yield Gi(ed.auth.getMFADevices),o=yield Bg(e);yield ji(Gn.setMfaState(I({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*np(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,Vg);yield ji(Gn.setMfaState({saving:!0}));try{var i;const e=yield Gi(ed.auth.preDisableMFASMS,t);yield ji(Gn.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 ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*ip(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,jg);yield ji(Gn.setMfaState({saving:!0}));try{var i;yield Gi(ed.auth.disableMFASMS,t,n);const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*op(){yield ji(Gn.setMfaState({loading:!0}));try{yield qi((e=>e.auth.user));const e=yield Gi(ed.auth.getMFADevices);yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*ap(){yield ji(Gn.setMfaState({loading:!0}));try{const e=(yield Gi(ed.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ji(Gn.setMfaState({loading:!1,error:e.message}))}}function*rp(){yield Vo(Gn.enrollMfa,zg),yield Vo(Gn.getMFADevices,op),yield Vo(Gn.getMFAStrategies,ap),yield Vo(Gn.verifyMfa,qg),yield Vo(Gn.disableMfa,Jg),yield Vo(Gn.verifyMfaAfterForce,Hg),yield Vo(Gn.preDisableMfaSms,np),yield Vo(Gn.disableMfaSms,ip),yield Vo(Gn.preEnrollMfaSms,ep),yield Vo(Gn.enrollMfaSms,tp),yield Vo(Gn.preEnrollMfaWebAuthn,Yg),yield Vo(Gn.enrollMfaWebAuthn,Qg),yield Vo(Gn.preDisableMfaWebAuthn,Xg),yield Vo(Gn.disableMfaWebAuthn,Zg)}function*lp(){yield ji(Gn.setMfaState({saving:!0})),yield ji(Gn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*sp({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.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 ji(Gn.setMfaState(i)),yield ji(Gn.setUser(I({},yd,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*cp(e){let{payload:{callback:t}}=e,n=ii(e.payload,Wg);yield ji(Gn.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 ji(Gn.setMfaState(o)),yield yt(),yield ji(Gn.setUser(I({},yd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*up({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,mfaDevices:I({},n,{authenticators:[]})})),yield ji(Gn.setUser(I({},yd))),null==(t=e.callback)||t.call(e,!0)}function*dp(e){let{}=e,t=ii(e.payload,Kg);yield ji(Gn.setMfaState({saving:!0}));try{var n;yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield ji(Gn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*yp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({loading:!1,error:void 0,mfaDevices:I({},n,{phones:[]})})),yield ji(Gn.setUser(I({},yd))),null==(t=e.callback)||t.call(e,!0)}function*fp({payload:e}){var t;yield ji(Gn.setMfaState({saving:!0})),yield yt(),yield ji(Gn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*gp(e){let{payload:{callback:t}}=e;ii(e.payload,Gg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield qi((e=>e.auth.mfaState));yield ji(Gn.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 ji(Gn.setMfaState(o)),yield ji(Gn.setUser(I({},yd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*pp(){yield Vo(Gn.enrollMfa,lp),yield Vo(Gn.verifyMfa,sp),yield Vo(Gn.disableMfa,up),yield Vo(Gn.verifyMfaAfterForce,cp),yield Vo(Gn.preDisableMfaSms,dp),yield Vo(Gn.disableMfaSms,yp),yield Vo(Gn.preEnrollMfaSms,fp),yield Vo(Gn.enrollMfaSms,gp)}const Sp=["callback"];function*vp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.forgotPassword,e),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*hp(e){let{payload:{callback:t}}=e,n=ii(e.payload,Sp);yield ji(Gn.setForgotPasswordState({loading:!0}));try{yield Gi(ed.auth.resetPassword,n),yield ji(Gn.setForgotPasswordState({loading:!1,error:void 0,step:$t.success})),null==t||t(!0)}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*mp({payload:e}){yield ji(Gn.setForgotPasswordState({loading:!0}));try{const t=yield Gi(ed.auth.loadPasswordConfig,e);yield ji(Gn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ji(Gn.setForgotPasswordState({loading:!1,error:e.message}))}}function*bp(){yield Wo(Gn.forgotPassword,vp),yield Wo(Gn.resetPassword,hp),yield Wo(Gn.loadPasswordConfig,mp)}let Ap;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(Ap||(Ap={}));const kp=["callback","events"],Tp=["callback"],Pp=["callback"];function*Ip({payload:{userId:e,token:t}}){yield ji(Gn.setActivateState({loading:!0,step:Et.activating}));try{const{isAuthenticated:n}=yield qi((e=>e.auth));n&&(yield ji(Gn.silentLogout()));const i=yield Gi(ed.auth.getActivateAccountStrategy,{userId:e,token:t});yield ji(Gn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield ji(Gn.setActivateState({loading:!1,step:Et.activatingForm})))}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Lp(e){let{payload:{callback:t,events:n}}=e,i=ii(e.payload,kp);yield ji(Gn.setActivateState({loading:!0}));try{const e=Ko.onRedirectTo,{routes:a}=yield qi((e=>e.auth)),r=yield Gi(ed.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(qy(r)){yield ji(Gn.setActivateState({step:Et.success}));const t=yield Yy(r);yield ji(Gn.setState(t)),yield Hi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield ji(Gn.setActivateState({step:Et.success}));const{user:e,tenants:t}=yield Gi(ed.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:Ud.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ji(Gn.setTenantsState({tenants:t,loading:!1})),yield ji(Gn.setState({user:e,isAuthenticated:!0})),yield Hi(1e3),yield Gy(),yield ji(Gn.resetActivateState())}null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message}))}}function*Op({payload:e}){const{callback:t}=e,n=ii(e,Tp);yield ji(Gn.setActivateStrategyState({loading:!0}));try{const e=yield Gi(ed.auth.getActivateAccountStrategy,n);yield ji(Gn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ji(Gn.setActivateStrategyState({loading:!1,error:e.message}))}}function*wp({payload:e}){const{callback:t}=e,n=ii(e,Pp);yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:n.email})),yield ji(Gn.setActivateState({loading:!0}));try{yield Gi(ed.auth.resendActivationEmail,n),yield ji(Gn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ji(Gn.setActivateState({loading:!1,error:e.message})),yield ji(Gn.setTeamError({key:Ap.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:!1}))}function*Ep(){yield Wo(Gn.activateAccount,Lp),yield Wo(Gn.preActivateAccount,Ip),yield Wo(Gn.getActivateAccountStrategy,Op),yield Wo(Gn.resendActivationEmail,wp)}function*Cp({payload:e}){if(e.token&&e.userId)try{yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Gi(ed.auth.acceptInvitation,e),yield ji(Gn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:_t.success}}))}catch(e){yield ji(Gn.setAcceptInvitationState({step:_t.failed,error:e.message}))}else yield ji(Gn.setAcceptInvitationState({error:void 0,step:_t.invalid}))}function*Dp(){yield Wo(Gn.acceptInvitation,Cp)}var Rp,_p=new Uint8Array(16);function Up(){if(!Rp&&!(Rp="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 Rp(_p)}for(var Mp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Np=function(e){return"string"==typeof e&&Mp.test(e)},$p=[],Fp=0;Fp<256;++Fp)$p.push((Fp+256).toString(16).substr(1));var xp=function(e,t,n){var i=(e=e||{}).random||(e.rng||Up)();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=($p[e[t+0]]+$p[e[t+1]]+$p[e[t+2]]+$p[e[t+3]]+"-"+$p[e[t+4]]+$p[e[t+5]]+"-"+$p[e[t+6]]+$p[e[t+7]]+"-"+$p[e[t+8]]+$p[e[t+9]]+"-"+$p[e[t+10]]+$p[e[t+11]]+$p[e[t+12]]+$p[e[t+13]]+$p[e[t+14]]+$p[e[t+15]]).toLowerCase();if(!Np(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Vp=["callback"],jp=["roles"],Wp=["callback"],Kp=["callback","profileImage"],Gp=["callback"],Bp=["callback","userId"],zp=["callback"],qp=["callback"],Hp=["callback"],Jp=["callback"],Yp=["callback"],Qp=["callback"],Xp=["callback"],Zp=["callback","profileImage"],eS=["callback"],tS=["callback"],nS=["callback"],iS=["callback"],oS=["callback"],aS=["callback"],rS=()=>qi((e=>e.auth.teamState));function*lS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield rS(),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 ji(Gn.setTeamLoader({key:Ap.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Wi([Gi(ed.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield ji(Gn.setTeamError({key:Ap.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ji(Gn.setTeamLoader({key:Ap.USERS,value:!1}))}function*sS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield rS(),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 ji(Gn.setTeamLoader({key:Ap.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Wi([Gi(ed.subTenants.loadAllUsers,I({},c)),Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield ji(Gn.setTeamError({key:Ap.USERS,value:e.message})),yield ji(Gn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ji(Gn.setTeamLoader({key:Ap.USERS,value:!1}))}function*cS({payload:e}){yield ji(Gn.setTeamLoader({key:Ap.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Wi([Gi(ed.teams.loadAvailableRoles),Gi(ed.teams.loadAvailablePermissions)]);yield ji(Gn.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 ji(Gn.setTeamError({key:Ap.ROLES_AND_PERMISSIONS,value:t.message}))}yield ji(Gn.setTeamLoader({key:Ap.ROLES_AND_PERMISSIONS,value:!0}))}function*uS({payload:e}){const{callback:t}=e,n=ii(e,Vp),i=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Gi(ed.teams.addUser,n),{roles:o}=e,a=I({},ii(e,jp),{roleIds:o.map((e=>e.id))});null==t||t(a),yield ji(Gn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*dS({payload:e}){const{callback:t}=e,n=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ji(Gn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Gi(ed.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 ji(Gn.loadUsers(r)),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*yS({payload:e}){const{callback:t}=e,n=ii(e,Wp),i=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Gi(ed.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ji(Gn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*fS({payload:e}){const{callback:t}=e,n=ii(e,Kp),{id:i}=n,o=yield rS(),a=o.users.find((e=>e.id===n.id));yield ji(Gn.setTeamLoader({key:Ap.UPDATE_USER,value:i||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})})),yield ji(Gn.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 Gi(ed.teams.updateUser,n);null==t||t(e),yield ji(Gn.setTeamState({users:o.users.map((t=>t.id===e.id?I({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ji(Gn.setTeamLoader({key:Ap.UPDATE_USER,value:!1}))}catch(e){yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?I({},e,a):e))})),yield ji(Gn.setTeamLoader({key:Ap.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*gS({payload:e}){const{callback:t}=e,n=ii(e,Gp),i=yield rS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.teams.deleteUser,n),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*pS({payload:e}){const{callback:t,userId:n}=e,i=ii(e,Bp),o=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Gi(ed.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 ji(Gn.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 ji(Gn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*SS({payload:e}){const{callback:t}=e,n=ii(e,zp),i=yield rS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Gi(ed.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vS({payload:e}){const{callback:t}=e,n=ii(e,qp);yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Gi(ed.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:Ap.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:!1}))}function*hS({payload:e}){const{callback:t}=e,n=ii(e,Hp);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:Ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*mS({payload:e}){const{callback:t}=e,n=ii(e,Jp);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:Ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*bS({payload:e}){const{callback:t}=e,n=ii(e,Yp);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email}));try{yield Gi(ed.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:Ap.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*AS(){yield ji(Gn.setTeamError({key:Ap.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Gi(ed.teams.getInviteLinkConfiguration);yield ji(Gn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield ji(Gn.setTeamError({key:Ap.CONFIG_TOKEN_LINK,value:e.message}))}}function*kS(){yield ji(Gn.setTeamError({key:Ap.GET_TOKEN_LINK,value:!1}));try{yield Gi(AS);const e=yield Gi(ed.teams.getInviteUserLink),{inviteTokenState:t}=yield rS();yield ji(Gn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield ji(Gn.setTeamError({key:Ap.GET_TOKEN_LINK,value:e.message}))}}function*TS({payload:{callback:e}}){yield ji(Gn.setTeamError({key:Ap.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield rS();try{const n=yield Gi(ed.teams.createInviteUserLink,{expiresInMinutes:43200});yield ji(Gn.setTeamState({inviteTokenState:I({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:Ap.CREATE_TOKEN_LINK,value:t.message}))}}function*PS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield rS();yield ji(Gn.setTeamError({key:Ap.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Gi(ed.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ji(Gn.setTeamState({inviteTokenState:I({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ji(Gn.setTeamError({key:Ap.UPDATE_TOKEN_LINK,value:t.message}))}}function*IS({payload:e}){const{callback:t}=null!=e?e:{};yield ji(Gn.setTeamError({key:Ap.DELETE_TOKEN_LINK,value:!1}));try{yield Gi(ed.teams.deleteInviteUserLink),yield ji(Gn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ji(Gn.setTeamError({key:Ap.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*LS({payload:e}){yield ji(Gn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*OS({payload:e}){const t=yield rS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wS({payload:e}){yield ji(Gn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*ES({payload:e}){const t=yield rS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(Gn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*CS(){yield jo(Gn.loadUsers,lS),yield jo(Gn.loadAllSubTenantsUsers,sS),yield jo(Gn.loadRoles,cS),yield Vo(Gn.addUser,uS),yield Vo(Gn.addUsersBulk,dS),yield Vo(Gn.addUserToSubTenants,yS),yield Vo(Gn.updateUser,fS),yield Vo(Gn.setUserRolesForSubTenants,pS),yield Vo(Gn.deleteUser,gS),yield Vo(Gn.deleteUserFromSubTenants,SS),yield Vo(Gn.resendActivationLink,vS),yield Vo(Gn.resendInvitationLink,hS),yield Vo(Gn.resendInvitationEmail,mS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,bS),yield Vo(Gn.getInvitationLink,kS),yield Vo(Gn.createInvitationLink,TS),yield Vo(Gn.updateInvitationLink,PS),yield Vo(Gn.deleteInvitationLink,IS),yield Vo(Gn.openAddUserDialog,LS),yield Vo(Gn.closeAddUserDialog,OS),yield Vo(Gn.openDeleteUserDialog,wS),yield Vo(Gn.closeDeleteUserDialog,ES)}function*DS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield rS(),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 ji(Gn.setTeamLoader({key:Ap.USERS,value:!a})),yield ji(Gn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield ji(Gn.setTeamState({users:Od,totalPages:2,totalItems:10,roles:Ad,permissions:Td})),yield ji(Gn.setTeamLoader({key:Ap.USERS,value:!1})),null==r||r(Od)}function*RS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield rS(),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 ji(Gn.setTeamLoader({key:Ap.USERS,value:!r})),yield ji(Gn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield yt(),yield ji(Gn.setTeamState({allUsers:wd,totalPages:2,totalItems:10,roles:Ad,permissions:Td})),yield ji(Gn.setTeamLoader({key:Ap.USERS,value:!1})),null==l||l(wd)}function*_S({payload:e}){var t;yield ji(Gn.setTeamLoader({key:Ap.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield ji(Gn.setTeamState({roles:Ad,permissions:Td})),yield ji(Gn.setTeamLoader({key:Ap.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Ad,permissions:Td})}function*US({payload:e}){const{callback:t}=e,n=ii(e,Qp),i=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Id,n,{id:`${xp()}`});null==t||t(o),yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*MS({payload:e}){const{callback:t}=e,n=ii(e,Xp),i=yield rS();yield ji(Gn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Id,n,{id:`${xp()}`});yield ji(Gn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*NS({payload:e}){var t;const{callback:n}=e,i=ii(e,Zp),{id:o}=i,a=yield rS(),r=a.users.find((e=>e.id===i.id));yield ji(Gn.setTeamLoader({key:Ap.UPDATE_USER,value:o||""})),yield ji(Gn.setTeamState({addUserDialogState:I({},a.addUserDialogState,{loading:!0})})),yield ji(Gn.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 ji(Gn.setTeamState({users:a.users.map((e=>e.id===l.id?I({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ji(Gn.setTeamLoader({key:Ap.UPDATE_USER,value:!1}))}function*$S({payload:e}){const{callback:t}=e,n=ii(e,eS),i=yield rS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*FS({payload:e}){const{callback:t}=e,n=ii(e,tS),i=yield rS();yield ji(Gn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*xS({payload:e}){const{callback:t}=e,n=ii(e,nS);yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:Ap.RESEND_ACTIVATE_LINK,value:!1}))}function*VS({payload:e}){const{callback:t}=e,n=ii(e,iS);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*jS({payload:e}){const{callback:t}=e,n=ii(e,oS);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*WS({payload:e}){const{callback:t}=e,n=ii(e,aS);yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield ji(Gn.setTeamLoader({key:Ap.RESEND_INVITATION_LINK,value:!1}))}function*KS(){yield jo(Gn.loadUsers,DS),yield jo(Gn.loadAllSubTenantsUsers,RS),yield jo(Gn.loadRoles,_S),yield Vo(Gn.addUser,US),yield Vo(Gn.addUserToSubTenants,MS),yield Vo(Gn.updateUser,NS),yield Vo(Gn.deleteUser,$S),yield Vo(Gn.deleteUserFromSubTenants,FS),yield Vo(Gn.resendActivationLink,xS),yield Vo(Gn.resendInvitationLink,VS),yield Vo(Gn.resendInvitationEmail,jS),yield Vo(Gn.resendInvitationLinkToAllSubTenants,WS),yield Vo(Gn.openAddUserDialog,LS),yield Vo(Gn.closeAddUserDialog,OS),yield Vo(Gn.openDeleteUserDialog,wS),yield Vo(Gn.closeDeleteUserDialog,ES)}const GS=["authorizationUrl"],BS=["events","url"];function*zS(){try{yield ji(Gn.setSocialLoginsState({loading:!0}));const e=yield Gi(ed.auth.getSocialLoginProviders);yield ji(Gn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*qS(){try{const e=yield qi((e=>e.root.context));yield ji(Gn.setSocialLoginsState({loading:!0}));const t=(yield Gi(ed.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=ii(t,GS);const o=zo(e,null!=n?n:"");return I({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield ji(Gn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield ji(Gn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*HS(e){let{payload:{events:t,url:n}}=e,i=ii(e.payload,BS);try{yield ji(Gn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Gi(ed.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Md.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Ud.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ji(Gn.setLoginState({email:e,isNewUser:r})),yield Qy(),localStorage.removeItem("register-quick-login"),yield ji(Gn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ji(Gn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*JS({payload:e}){yield ji(Gn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*YS(){yield Wo(Gn.loadSocialLoginsConfiguration,zS),yield Wo(Gn.loadSocialLoginsConfigurationV2,qS),yield Wo(Gn.loginViaSocialLogin,HS),yield jo(Gn.setSocialLoginError,JS)}let QS;function*XS({payload:e}){yield ji(Gn.setApiTokensState({apiTokenType:e}));try{if(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Gi(ed.auth.getTenantApiTokensData),{items:t}=yield Gi(ed.teams.loadAvailableRoles),{items:n}=yield Gi(ed.teams.loadAvailablePermissions);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:QS.LOAD_API_TOKENS,value:e.message})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1}))}}function*ZS({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateUserApiTokensData,{description:t});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield ji(Gn.setApiTokensError({key:QS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*ev({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!0}));const e=yield Gi(ed.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ji(Gn.setApiTokensError({key:QS.ADD_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*tv({payload:e}){const{apiTokensDataUser:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteUserApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:QS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!1}))}}function*nv({payload:e}){const{apiTokensDataTenant:t}=yield qi((e=>e.auth.apiTokensState));try{yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!0})),yield Gi(ed.auth.deleteTenantApiToken,{tokenId:e}),yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(Gn.setApiTokensError({key:QS.DELETE_API_TOKEN,value:e.message})),yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!1}))}}function*iv({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Wi([Gi(ed.auth.getUserApiTokensData),Gi(ed.auth.getTenantApiTokensData)]);yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:QS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*ov({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getUserApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:QS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*av({payload:e}){null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Gi(ed.auth.getTenantApiTokensData);yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setApiTokensError({key:QS.LOAD_API_TOKENS,value:t.message})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*rv(){yield Wo(Gn.loadApiTokens,iv),yield Wo(Gn.loadUserApiTokens,ov),yield Wo(Gn.loadTenantApiTokens,av),yield Wo(Gn.initApiTokensData,XS),yield Vo(Gn.addUserApiToken,ZS),yield Vo(Gn.addTenantApiToken,ev),yield jo(Gn.deleteTenantApiToken,nv),yield jo(Gn.deleteUserApiToken,tv)}function*lv({payload:e}){if(yield ji(Gn.setApiTokensState({apiTokenType:e})),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})),"user"===e){yield Hi(200);const e=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:null!=(t=[cd])?t:[],roles:null!=Ad?Ad:[],permissions:null!=Td?Td:[]}))}yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1}))}function*sv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState)),a=I({},cd,{description:t,roleIds:n,clientId:`CLIENT_ID_${xp()}`});yield ji(Gn.setApiTokensState({showAddTokenDialog:!1})),yield Hi(200),yield ji(Gn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:QS.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*cv({payload:e}){yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!0})),yield Hi(200);const t=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(Gn.setApiTokensLoader({key:QS.DELETE_API_TOKEN,value:!1}))}function*uv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));const n=[sd],i=[cd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));const n=[sd];yield ji(Gn.setApiTokensState({apiTokensDataUser:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yv({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!0})));const n=[cd];yield ji(Gn.setApiTokensState({apiTokensDataTenant:n})),yield Hi(200),yield ji(Gn.setApiTokensLoader({key:QS.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fv(){yield Wo(Gn.loadApiTokens,uv),yield Wo(Gn.loadUserApiTokens,dv),yield Wo(Gn.loadTenantApiTokens,yv),yield Wo(Gn.initApiTokensData,lv),yield Vo(Gn.addTenantApiToken,sv),yield jo(Gn.deleteTenantApiToken,cv)}function*gv({payload:e}){try{var t;yield ji(Gn.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 Gi(ed.accountSettings.updateSettings,I({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ji(Gn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*pv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Gi(ed.accountSettings.getSettings);yield ji(Gn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield ji(Gn.setAccountSettingsState({loading:!1,error:e.message}))}}function*Sv(){yield Wo(Gn.saveAccountSettings,gv),yield Wo(Gn.loadAccountSettings,pv)}function*vv({payload:e}){var t;yield ji(Gn.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 ji(Gn.setAccountSettingsState(I({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*hv({payload:e}){yield ji(Gn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield yt(),yield ji(Gn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*mv(){yield Wo(Gn.saveAccountSettings,vv),yield Wo(Gn.loadAccountSettings,hv)}function*bv({payload:{tenantId:e,callback:t}}){yield ji(Gn.setState({isLoading:!0}));try{yield Gi(ed.tenants.switchTenant,{tenantId:e}),yield Gi(Qy),(null==t?void 0:t(!0))||(yield ji(Gn.setState({isLoading:!1})))}catch(e){yield ji(Gn.setState({isLoading:!1})),null==t||t(!1,e)}}function*Av({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getTenants);yield ji(Gn.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 ji(Gn.setTenantsState({loading:!1}))}}function*kv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenants);yield ji(Gn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tv({payload:e}){yield ji(Gn.setTenantsState({loading:!0}));try{var t;const n=yield Gi(ed.tenants.getSubTenantsAsTree);yield ji(Gn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(Gn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Pv(){yield Vo(Gn.loadTenants,Av),yield Vo(Gn.loadSubTenants,kv),yield Vo(Gn.switchTenant,bv),yield Vo(Gn.loadSubTenantsTree,Tv)}function*Iv(){yield ji(Gn.setTenantsState({loading:!0})),yield yt(),yield ji(Gn.setTenantsState({tenants:Ed,loading:!1}))}function*Lv(){yield Vo(Gn.loadTenants,Iv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(QS||(QS={}));const Ov=["callback"],wv=["callback"],Ev=["callback"],Cv=["callback"],Dv=["callback"];function*Rv({payload:e}){var t;yield ji(Gn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Wi([Gi(ed.roles.getRoles),Gi(ed.roles.getPermissions),Gi(ed.roles.getPermissionCategories)]),[t,n,i]=e;yield ji(Gn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield ji(Gn.setRolesState({error:e.message,loading:!1}))}}function*_v(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ov);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.addRole,n),i=yield Gi(ed.roles.getRoles);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Uv(e){let{payload:{callback:t}}=e,n=ii(e.payload,wv);yield ji(Gn.setRolesState({saving:!0}));try{yield Gi(ed.roles.deleteRole,n),yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Mv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Ev);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.updateRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Cv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionsToRole,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$v(e){let{payload:{callback:t}}=e,n=ii(e.payload,Dv);yield ji(Gn.setRolesState({saving:!0}));try{const e=yield Gi(ed.roles.attachPermissionToRoles,n);yield ji(Gn.loadRolesAndPermissions({silentLoading:!0})),yield ji(Gn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ji(Gn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Fv(){yield Wo(Gn.loadRolesAndPermissions,Rv),yield Vo(Gn.addRole,_v),yield Vo(Gn.deleteRole,Uv),yield Vo(Gn.updateRole,Mv),yield Vo(Gn.attachPermissionsToRole,Nv),yield Vo(Gn.attachPermissionToRoles,$v)}function*xv({payload:e}){var t;yield ji(Gn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ji(Gn.setRolesState({roles:ud,loading:!1}))}catch(e){yield ji(Gn.setRolesState({error:e.message,loading:!1}))}}function*Vv(){yield Wo(Gn.loadRolesAndPermissions,xv)}const jv=["callback"],Wv=["callback"],Kv=["callback"];function*Gv(e){let{payload:{callback:t}}=e,n=ii(e.payload,jv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.resetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield ji(Gn.setLoginState({email:n.email}))}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Bv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Wv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const e=yield Gi(ed.auth.verifyResetPhoneNumber,n);yield ji(Gn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*zv(e){let{payload:{callback:t}}=e,n=ii(e.payload,Kv);yield ji(Gn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Gi(ed.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ji(Gn.setLoginState({step:vt.loginWithSmsOtc})),yield ji(Gn.passwordlessPreLogin({type:rr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield ji(Gn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qv(){yield Wo(Gn.resetPhoneNumber,Gv),yield Wo(Gn.verifyResetPhoneNumber,Bv),yield Wo(Gn.changePhoneNumber,zv)}function*Hv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSessions);yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Jv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getCurrentUserSession);yield ji(Gn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Yv({payload:{id:e}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteSessionForUser,e),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Qv({payload:{callback:e,userId:t}}){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ji(Gn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Xv(){yield ji(Gn.setSessionsState({loading:!0,error:null}));try{yield Gi(ed.auth.deleteAllSessionsForUser),yield ji(Gn.loadUserSessions())}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*Zv(){yield jo(Gn.loadUserSessions,Hv),yield jo(Gn.deleteUserSession,Yv),yield jo(Gn.deleteAllUserSessions,Xv),yield jo(Gn.loadCurrentUserSession,Jv),yield Vo(Gn.revokeUserSessions,Qv)}function*eh(){yield ji(Gn.setSessionsState({loading:!0,error:null})),yield ji(Gn.setSessionsState({sessions:Cd,loading:!1}))}function*th({payload:{id:e}}){yield ji(Gn.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 ji(Gn.setSessionsState({sessions:t,loading:!1}))}function*nh(){yield ji(Gn.setSessionsState({loading:!0,error:null}));const e=Cd.filter((e=>e.current));yield ji(Gn.setSessionsState({sessions:e,loading:!1}))}function*ih(){yield jo(Gn.loadUserSessions,eh),yield jo(Gn.deleteUserSession,th),yield jo(Gn.deleteAllUserSessions,nh)}const oh=["callback"],ah=["callback"];function*rh(){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getSessionConfigurations);yield ji(Gn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ji(Gn.setSessionsState({error:e,loading:!1}))}}function*lh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ii(e,oh);yield Gi(ed.auth.createOrUpdateSessionConfigrations,n),yield ji(Gn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ji(Gn.setSessionsPolicyState({error:e,loading:!1}))}}function*sh(){yield Wo(Gn.loadSessionsPolicy,rh),yield jo(Gn.createOrUpdateSessionsPolicy,lh)}function*ch(){yield ji(Gn.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:Dd}));yield ji(Gn.setSessionsPolicyState(I({},e,{loading:!1})))}function*uh({payload:e}){yield ji(Gn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ii(e,ah);null==t||t(!0),yield ji(Gn.setSessionsPolicyState({configurations:n,loading:!1}))}function*dh(){yield Wo(Gn.loadSessionsPolicy,ch),yield jo(Gn.createOrUpdateSessionsPolicy,uh)}const yh=["callback"],fh=["callback"],gh=["callback"],ph=["callback"],Sh=["callback"],vh=["callback"],hh=["callback"],mh=["callback"],bh=()=>qi((e=>e.auth.restrictionsState.ipRestrictions)),Ah=()=>qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*kh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Gi(ed.auth.getDomainRestrictionsConfig),t=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Th(e){let{payload:{callback:t}}=e,n=ii(e.payload,yh);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Ah();try{var o;yield Gi(ed.auth.createDomainRestriction,n);const e=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield ji(Gn.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 ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ph(e){let{payload:{callback:t}}=e,n=ii(e.payload,fh);yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Gi(ed.auth.updateDomainRestrictionConfig,n),i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(Gn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ih({payload:{id:e}}){yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Ah();try{var n;yield Gi(ed.auth.deleteDomainRestriction,e);const i=(yield Gi(ed.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ji(Gn.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 ji(Gn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Lh=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*Oh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bh(),t=yield Gi(ed.auth.getIPRestrictionsConfig),n=Lh({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Gi(ed.auth.getIPRestrictions,n);yield ji(Gn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*wh(){try{const{valid:e}=yield Gi(ed.auth.testCurrentIpInAllowList);yield ji(Gn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message}))}}function*Eh({payload:{callback:e}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield qi((e=>e.auth.userIp));yield Wi([Gi(ed.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Gi(ed.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield bh(),i=Lh(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Gi(ed.auth.getIPRestrictions,i);yield ji(Gn.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 ji(Gn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Ch(e){let{payload:{callback:t}}=e,n=ii(e.payload,gh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield bh();try{var o,a;yield Gi(ed.auth.createIPRestriction,n);const e=yield bh(),r=Lh(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Gi(ed.auth.getIPRestrictions,r);yield wh(),yield ji(Gn.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 ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Dh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ph);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));try{yield Gi(ed.auth.updateIPRestrictionConfig,n);const e=yield bh(),i=yield Gi(ed.auth.getIPRestrictionsConfig),o=Lh(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Gi(ed.auth.getIPRestrictions,o);yield wh(),yield ji(Gn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rh({payload:{id:e,callback:t}}){yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const n=yield bh();try{var i;yield Gi(ed.auth.deleteIPRestriction,e);const o=yield bh(),a=Lh(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Gi(ed.auth.getIPRestrictions,a);yield wh(),yield ji(Gn.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 ji(Gn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_h(){yield Wo(Gn.loadIpRestrictions,Oh),yield Wo(Gn.loadEmailDomainRestrictions,kh),yield Vo(Gn.saveIpRestriction,Ch),yield Vo(Gn.saveIpRestrictionsConfig,Dh),yield Vo(Gn.deleteIpRestriction,Rh),yield Vo(Gn.checkIfUserIpValid,wh),yield Vo(Gn.addCurrentUserIpAndActivate,Eh),yield Vo(Gn.saveEmailDomainRestriction,Th),yield Vo(Gn.saveEmailDomainRestrictionsConfig,Ph),yield Vo(Gn.deleteEmailDomainRestriction,Ih)}function*Uh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null})),yield ji(Gn.setIpRestrictionsState({data:{restrictions:_d.filter((e=>e.strategy===Rd.strategy)),config:Rd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Mh(){yield ji(Gn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bh(),t=_d[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ji(Gn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ji(Gn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Nh(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,Sh);yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const r=yield bh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ji(Gn.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:xp(),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*$h(e){var t,n,i;let{payload:{callback:o}}=e,a=ii(e.payload,vh);const r=yield bh();yield ji(Gn.setIpRestrictionsState({saving:!0,error:null})),yield ji(Gn.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 ji(Gn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Fh({payload:{id:e,callback:t}}){var n;yield ji(Gn.setIpRestrictionsState({saving:!0,error:null}));const i=yield bh();yield ji(Gn.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*xh(){yield ji(Gn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ji(Gn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:_n.ALLOW}],config:{active:!0,listType:_n.ALLOW,blockPublicDomains:!1}}}))}function*Vh(e){var t,n;let{payload:{callback:i}}=e,o=ii(e.payload,hh);const a=yield Ah();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==i||i(!0),yield ji(Gn.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*jh(e){var t;let{payload:{callback:n}}=e,i=ii(e.payload,mh);const o=yield Ah();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),null==n||n(!0),yield ji(Gn.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*Wh({payload:{id:e}}){var t,n;const i=yield Ah();yield ji(Gn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield yt(),yield ji(Gn.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*Kh(){yield Wo(Gn.loadIpRestrictions,Uh),yield Wo(Gn.loadEmailDomainRestrictions,xh),yield Vo(Gn.saveIpRestriction,Nh),yield Vo(Gn.saveIpRestrictionsConfig,$h),yield Vo(Gn.deleteIpRestriction,Fh),yield Vo(Gn.checkIfUserIpValid,Mh),yield Vo(Gn.saveEmailDomainRestriction,Vh),yield Vo(Gn.saveEmailDomainRestrictionsConfig,jh),yield Vo(Gn.deleteEmailDomainRestriction,Wh)}const Gh=["callback"],Bh=["id"];function*zh(e){const{count:t}=yield Gi(ed.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*qh(){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.getConfigs),t=yield Wi(e.map((e=>zh(e))));yield ji(Gn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*Hh(e){let{payload:{callback:t}}=e,n=ii(e.payload,Gh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{const e=yield Gi(ed.directory.createConfiguration,n),i=yield Gi(ed.directory.getConfigs),o=yield Wi(i.map((e=>zh(e))));yield ji(Gn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*Jh(e){let{payload:{id:t}}=e,n=ii(e.payload,Bh);yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.updateConfiguration,t,n);const e=yield Gi(ed.directory.getConfigs),i=yield Wi(e.map((e=>zh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1}))}}function*Yh({payload:{id:e,callback:t}}){yield ji(Gn.setProvisioningState({loading:!0,error:null}));try{yield Gi(ed.directory.deleteConfiguration,e);const n=yield Gi(ed.directory.getConfigs),i=yield Wi(n.map((e=>zh(e))));yield ji(Gn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield ji(Gn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Qh(){yield Wo(Gn.loadProvisionConnections,qh),yield Vo(Gn.createProvisionConnection,Hh),yield Vo(Gn.deleteProvisionConnection,Yh),yield Vo(Gn.updateProvisionConnection,Jh)}var Xh={sagas:function*(){yield Wi([Gi(Nf),Gi(Ep),Gi(Dp),Gi(bp),Gi(qv),Gi(Xf),Gi(Tg),Gi(Eg),Gi(rp),Gi(CS),Gi(YS),Gi(jd),Gi(rv),Gi(fy),Gi(Sv),Gi(Pv),Gi(Fv),Gi(Zv),Gi(sh),Gi(_h),Gi(Qh)])},mockSagas:function*(){yield Wi([Gi(xf),Gi(ag),Gi(_g),Gi(pp),Gi(KS),Gi(fv),Gi(Py),Gi(ih),Gi(mv),Gi(Lv),Gi(dh),Gi(Kh),Gi(Vv)])},storeName:kt,initialState:jn,reducer:Wn,actions:Gn};const Zh=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),em={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},tm={setAuditLogsState:Zh("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:em})},nm={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},im={loading:!0},om={setAuditsMetadataState:Zh("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:im})},am={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},rm={auditLogsState:em,auditsMetadataState:im},{reducer:lm,actions:sm}=at({name:Pt,initialState:rm,reducers:I({resetState:e=>I({},e,rm),setState:(e,{payload:t})=>I({},e,t)},tm,om)}),cm=I({},sm,nm,am),um=e=>"createdAt"!==e.id,dm={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`})))},ym={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}]},fm=()=>qi((e=>e.auditLogs.auditLogsState)),gm=()=>qi((e=>e.auditLogs.auditsMetadataState));function*pm(){const e=yield fm(),{columns:t}=yield gm();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 ji(cm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield ed.audits.exportAudits(I({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield ji(cm.setAuditLogsState({isDownloadingCsv:!1}))}function*Sm({payload:e}){yield ji(cm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield fm(),{columns:n}=yield gm();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 ji(cm.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 ji(cm.loadAuditsMetadata()));const{data:g,total:p}=yield Gi(ed.audits.getAudits,I({offset:c,count:s},y,f));yield ji(cm.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 ji(cm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*vm(){yield Vo(cm.exportAuditsCsv,pm),yield Vo(cm.loadAuditLogs,Sm)}function*hm({payload:e}){yield ji(cm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield fm(),{columns:n}=yield gm();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 ji(cm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ji(cm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=dm;let i=n.filter((e=>t=>e.filter(um).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 ji(cm.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 ji(cm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*mm(){yield Vo(cm.loadAuditLogs,hm)}function*bm(){yield ji(cm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Gi(ed.metadata.getAuditsMetadata);yield ji(cm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(cm.setAuditsMetadataState({error:e,loading:!1}))}}function*Am(){yield Vo(cm.loadAuditsMetadata,bm)}function*km(){yield ji(cm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=ym;yield ji(cm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(cm.setAuditsMetadataState({error:e,loading:!1}))}}function*Tm(){yield Vo(cm.loadAuditsMetadata,km)}var Pm={sagas:function*(){yield Wi([Gi(vm),Gi(Am)])},mockSagas:function*(){yield Wi([Gi(mm),Gi(Tm)])},storeName:Pt,initialState:rm,reducer:lm,actions:cm};const Im={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:Lm,actions:Om,reducer:wm}=at({name:"audits",initialState:Im,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]})))}}}),Em=I({},Om,{initData:it(`${Lm}/initData`),loadAudits:it(`${Lm}/loadAudits`),removeFilter:it(`${Lm}/removeFilter`),filterData:it(`${Lm}/filterData`),exportCSV:it(`${Lm}/exportCSV`),deleteAudits:it(`${Lm}/deleteAudits`)}),Cm=()=>qi((e=>e[Lm]));function*Dm(){const{sortBy:e,sortDirection:t}=yield Cm();try{const n=yield Gi(ed.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ji(Em.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ji(Em.loadItemFailedAction(t))}}function*Rm(){try{const e=yield Gi(ed.metadata.getAuditsMetadata);yield ji(Em.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ji(Em.loadItemFailedAction(t))}}const _m=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Um({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Cm(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Cm():{rowsData:[]};try{const e=_m(t),{data:l,total:d}=yield Gi(ed.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 ji(Em.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ji(Em.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ji(Em.loadItemFailedAction(t))}}function*Mm(){yield ji(Em.startLoading()),yield Wi([Dm(),Rm(),Um({payload:{onlyOneLoad:!1},type:""})]),yield ji(Em.finishLoading())}function*Nm({payload:e}){const{filters:t}=yield Cm(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield ji(Em.setFilterData(i))}function*$m({payload:e}){const{filters:t}=yield Cm();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 ji(Em.setFilterData(i))}function*Fm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Cm(),a=_m(e);yield ji(Em.startDownloadingCsv());try{yield ed.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 ji(Em.stopDownloadingCsv())}}function*xm(){yield jo(Em.initData,Mm),yield jo(Em.removeFilter,Nm),yield jo(Em.filterData,$m),yield jo([Em.loadAudits,Em.textSearch,Em.onPageChange],Um),yield jo([Em.setFilterData,Em.setDataSorting,Em.startRefresh],(()=>Um({payload:{appendMode:!1},type:""}))),yield jo(Em.exportCSV,Fm)}const Vm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},jm={initData:()=>I({},Vm),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)})}},Wm={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}})))},Km={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Gm,actions:Bm}=at({name:Tt,initialState:Km,reducers:I({},jm)}),zm=I({},Bm,Wm),qm={slack:ed.connectivity.getSlackConfiguration,email:ed.connectivity.getEmailConfiguration,sms:ed.connectivity.getSMSConfiguration,webhook:ed.connectivity.getWebhooksConfigurations,categories:ed.connectivity.getCategories,channelMap:ed.connectivity.getChannelMaps},Hm={slack:ed.connectivity.postSlackConfiguration,email:ed.connectivity.postEmailConfiguration,sms:ed.connectivity.postSMSConfiguration,webhook:ed.connectivity.postWebhooksConfiguration},Jm=["email","slack","sms","webhook"],Ym={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"}},Qm=["id"],Xm=["id","enabled"],Zm=["categories","channelMap"];function*eb(e){return yield Gi(nb,{payload:{api:e},type:""})}function*tb({payload:e=Jm}){yield ji(zm.setConnectivityState({isLoading:!0}));try{const t=yield Wi([...e.map(eb),yield nb({payload:{api:"categories"},type:""}),yield function*(){return(yield Wi(e.map((function*(e){return yield nb({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield nb({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:Ym[e[o]].events(i),active:Ym[e[o]].isActive(i),platform:Ym[e[o]].title,image:Ym[e[o]].image}]}):n:I({},n,{[`${Zm[o-e.length]}`]:i})),{list:[],webhook:n});yield ji(zm.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ji(zm.setConnectivityState({isLoading:!1}))}}function*nb({payload:{api:e,params:t}}){try{return yield Gi(qm[e],t)}catch(e){return}}function*ib(){try{yield ji(zm.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Gi(ed.connectivity.getSlackChannels);yield ji(zm.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ji(zm.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*ob(e,t){const{connectivity:{list:n}}=yield qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Ym[e].isActive(t);o!==i.active&&(yield ji(zm.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*ab({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield qi((e=>e.connectivity));try{if(yield ji(zm.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 Wi([...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=ii(e,Qm);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 Gi(Hm.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Gi(ed.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 Wi([...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 Gi("email"===t?ed.connectivity.postEmailConfiguration:ed.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=ii(o,Xm);return yield Wi([yield Gi("email"===t?ed.connectivity.patchEmailConfiguration:ed.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Gi("email"===t?ed.connectivity.putEmailSubscriptions:ed.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 Gi("email"===t?ed.connectivity.deleteEmailSubscriptions:ed.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield nb({payload:{api:t},type:""});yield ji(zm.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield ob(t,e)}else yield ji(zm.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Gi(Hm[e],t),!["sms","email"].includes(e)){const o=yield nb({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield ji(zm.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield ob(e,o),null==n||n(!0)}}catch(e){var o;yield ji(zm.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*rb({payload:e}){try{yield ed.connectivity.postSlackCode(e)}catch{}yield ji(zm.setConnectivityState({error:void 0,isSaving:!1}))}function*lb(){const{slackChannels:e}=yield qi((e=>e.connectivity));try{yield ji(zm.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Gi(ed.connectivity.getSlackScope);yield ji(zm.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ji(zm.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*sb({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield qi((e=>e.connectivity));try{yield ji(zm.setConnectivityState({isSaving:!0})),yield Gi(ed.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield nb({payload:{api:"webhook"},type:""});o&&(yield ji(zm.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*cb({payload:e}){try{yield ji(zm.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Gi(ed.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ji(zm.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ji(zm.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ji(zm.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*ub({payload:e}){try{const{statusCode:t}=yield Gi(ed.connectivity.postWebhookRetry,e);yield ji(zm.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ji(zm.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*db({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield qi((e=>e.connectivity));try{yield ji(zm.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Gi(ed.connectivity.getWebhookLog,e,n,t);yield ji(zm.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield ji(zm.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var yb={sagas:function*(){yield Vo(zm.loadDataAction,tb),yield jo(zm.loadSlackActions,ib),yield Vo(zm.postDataAction,ab),yield Vo(zm.postCodeAction,rb),yield Vo(zm.loadScope,lb),yield Vo(zm.deleteWebhookConfigAction,sb),yield Vo(zm.postWebhookTestAction,cb),yield Vo(zm.postWebhookRetryAction,ub),yield jo(zm.loadWebhookLogsAction,db)},storeName:Tt,initialState:Km,reducer:Gm,actions:zm};function fb(){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 gb(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function pb(e){return gb(e,((e,t)=>I({},e,{loading:t.payload})))}function Sb(e){return gb(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const vb={loading:!1,error:null,fetching:!0,plans:[]},{actions:hb,reducer:mb,name:bb}=at({name:"subscriptions/plans",initialState:vb,reducers:I({},fb())}),Ab=I({loadPlans:it(`${bb}/loadPlans`)},hb),kb={loading:!1,error:null,fetching:!0,config:null},Tb=I({},fb()),{actions:Pb,reducer:Ib,name:Lb}=at({name:"subscriptions/config",initialState:kb,reducers:Tb}),Ob=I({loadPaymentConfiguration:it(`${Lb}/loadPaymentConfiguration`)},Pb),wb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Eb=I({},fb(),{setCancellationLoading:pb("cancellation"),setCancellationError:Sb("cancellation"),setRenewalLoading:pb("renewal"),setRenewalError:Sb("renewal")}),{reducer:Cb,actions:Db,name:Rb}=at({name:"subscriptions/billing/subscription",initialState:wb,reducers:Eb}),_b=I({load:it(`${Rb}/loadSubscription`),cancelSubscription:it(`${Rb}/cancelSubscription`),renewSubscription:it(`${Rb}/renewSubscription`)},Db),Ub={loading:!1,error:null,fetching:!0},Mb=I({},fb()),{reducer:Nb,actions:$b,name:Fb}=at({name:"subscriptions/billing/information",initialState:Ub,reducers:Mb}),xb=I({loadBillingInformation:it(`${Fb}/loadBillingInformation`),cancelSubscription:_b.cancelSubscription,renewSubscription:_b.renewSubscription},$b),Vb={loading:!1,error:null,fetching:!0},jb=I({},fb(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:Wb,actions:Kb,name:Gb}=at({name:"subscriptions/billing/payment",initialState:Vb,reducers:jb}),Bb=I({loadPaymentMethod:it(`${Gb}/loadPaymentMethod`),submitPaymentMethod:it(`${Gb}/submitPaymentMethod`),submitPaymentMethodError:it(`${Gb}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${Gb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${Gb}/updateBillingDetails`,(e=>({payload:e})))},Kb),zb={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},qb=I({},fb(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:Hb,actions:Jb,name:Yb}=at({name:"subscriptions/billing/invoices",initialState:zb,reducers:qb}),Qb=I({loadInvoices:it(`${Yb}/loadInvoices`),downloadInvoice:it(`${Yb}/downloadInvoice`,(e=>({payload:e})))},Jb),Xb={information:Ub,invoices:zb,paymentMethod:Vb,subscription:wb},Zb={invoices:Qb,information:xb,paymentMethod:Bb,subscription:_b},eA=$e({invoices:Hb,information:Nb,paymentMethod:Wb,subscription:Cb}),tA={fetching:!0,loading:!1,error:null,confirmed:!1},nA=I({},fb()),{actions:iA,reducer:oA,name:aA}=at({name:"subscriptions/checkout",initialState:tA,reducers:nA}),rA=I({loadCheckout:it(`${aA}/loadCheckout`),resetCheckout:it(`${aA}/resetCheckout`),submitCheckout:it(`${aA}/submitCheckout`),confirmCheckout:it(`${aA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${aA}/errorCheckout`,(e=>({payload:e})))},iA),lA={loading:!1,error:null,cardSetupIntentSecret:null},sA=I({},fb()),{reducer:cA,actions:uA,name:dA}=at({name:"subscriptions/stripe",initialState:lA,reducers:sA}),yA=I({loadCustomer:it(`${dA}/loadCustomer`),createCardSetupIntentSecret:it(`${dA}/createCardSetupIntentSecret`)},uA),fA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:gA,reducer:pA,name:SA}=at({name:"subscriptions/vendorPublicConfig",initialState:fA,reducers:I({},fb())}),vA=I({loadVendorPublicConfiguration:it(`${SA}/loadVendorPublicConfiguration`)},gA),hA={config:kb,plans:vb,checkout:tA,billing:Xb,stripe:lA,vendorPublicConfig:fA},mA={config:Ob,billing:Zb,plans:Ab,checkout:rA,stripe:yA,vendorPublicConfig:vA},bA=$e({config:Ib,billing:eA,plans:mb,checkout:oA,stripe:cA,vendorPublicConfig:pA});let AA,kA,TA;function PA({policy:e}){return{policy:TA.AT_PERIOD_END}}function IA(e){switch(e){case Tu.ACTIVE:return kA.ACTIVE;case Tu.INCOMPLETE:return kA.INCOMPLETE;case Tu.CANCELED:return kA.CANCELED;case Tu.EXPIRED:return kA.EXPIRED;case Tu.TRIALING:return kA.TRIALING;default:return kA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(AA||(AA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(kA||(kA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(TA||(TA={}));const LA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Tu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},OA=[{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"}],wA=[{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:""}],EA=[{id:"id",externalId:"externalId",type:Pu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],CA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*DA(){yield Vo(_b.load,RA),yield Vo(_b.cancelSubscription,UA),yield Vo(_b.renewSubscription,MA)}function*RA(){const e=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield VA(e)}function*_A(){yield ji(_b.setLoading(!0));try{const[e]=yield Gi(ed.subscriptions.getManagedSubscriptions);yield ji(_b.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ji(_b.setError(e))}}function*UA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(_b.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(_b.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Tu.ACTIVE)try{yield ji(_b.setCancellationLoading(!0)),yield Gi(ed.subscriptions.cancelManagedSubscription,t),yield _A(),yield ji(_b.setCancellationLoading(!1))}catch(e){yield ji(_b.setCancellationError(e.message))}}function*MA(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(_b.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(_b.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Iu.AT_PERIOD_END)try{yield ji(_b.setRenewalLoading(!0)),yield Gi(ed.subscriptions.renewManagedSubscription,t),yield _A(),yield ji(_b.setRenewalLoading(!1))}catch(e){yield ji(_b.setCancellationError(e.message))}}function*NA(){yield ji(_b.setLoading(!0)),yield Hi(500),yield ji(_b.setState({subscription:LA,fetching:!1,loading:!1,error:null}))}function*$A(){yield Vo(_b.load,NA)}function*FA(){yield Vo(xb.loadBillingInformation,xA)}function*xA(){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 VA(n,!1):yield ji(xb.setError(t?"Not authorized":"Internal feature failure"))}()}function*VA(e,t){yield ji(xb.setLoading(!0));try{var n,i;const o=yield Gi(ed.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Gi(ed.subscriptions.getSubscriptionPlan,a):([,l]=yield Wi([Gi(_A),Gi(ed.subscriptions.getSubscriptionPlan,a)]),s=yield qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ji(xb.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?kA.ACTIVE:IA(s.status),cancellation:s.cancellation&&PA(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 ji(xb.setError(e.message))}}function*jA(){yield function*(){var e,t;yield ji(xb.setLoading(!0)),yield Hi(500),yield ji(xb.setState({loading:!1,fetching:!1,summary:{subscriptionId:LA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Lu.Stripe,externallyManaged:!1,currentPlanId:OA[0].id,defaultPlanId:OA[0].id},plan:I({},OA[0],{price:null==(e=OA[0].price)?void 0:e.amount,currency:null==(t=OA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*WA(){yield Vo(xb.loadBillingInformation,jA)}function*KA(){yield Vo(Bb.loadPaymentMethod,GA),yield Vo(Bb.submitPaymentMethod,zA),yield Vo(Bb.submitPaymentMethodError,qA),yield Vo(Bb.submitPaymentMethodSuccess,HA),yield Vo(Bb.updatePaymentMethodBillingDetails,BA)}function*GA(){yield ji(Bb.setLoading(!0));try{const e=(yield Gi(ed.subscriptions.getPaymentMethods))[0];yield ji(Bb.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ji(Bb.setError(e.message))}}function*BA({payload:e}){yield ji(Bb.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Gi(ed.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Gi(GA),null==o||o(!0)}catch(e){yield ji(Bb.setError(e.message)),null==o||o(!1)}yield ji(Bb.setLoading(!1))}function*zA(){yield ji(Bb.setLoading(!0))}function*qA({payload:e}){yield ji(Bb.setError(e))}function*HA(){yield ji(Bb.loadPaymentMethod())}function*JA(){yield ji(Bb.setLoading(!0)),yield Hi(500);const e=EA[0];yield ji(Bb.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*YA(){yield Vo(Bb.loadPaymentMethod,JA)}function*QA(){yield Vo(Qb.loadInvoices,XA),yield Vo(Qb.downloadInvoice,ZA)}function*XA(){yield ji(Qb.setLoading(!0));try{const e=(yield Gi(ed.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 ji(Qb.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ji(Qb.setError(e.message))}}function*ZA({payload:e}){yield ji(Qb.setInvoiceDownloadState({loading:!0,error:null}));try{yield Gi(ed.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ji(Qb.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ji(Qb.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*ek(){yield ji(Qb.setLoading(!0)),yield Hi(500),yield ji(Qb.setState({loading:!1,fetching:!1,invoices:wA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ji(Qb.setLoading(!1))}function*tk(){yield Vo(Qb.loadInvoices,ek)}function*nk(){yield Wi([Gi(FA),Gi(KA),Gi(QA),Gi(DA)])}function*ik(){yield Wi([Gi(WA),Gi(YA),Gi(tk),Gi($A)])}function*ok(){yield Vo(rA.loadCheckout,ak),yield Vo(rA.resetCheckout,rk),yield Vo(rA.submitCheckout,lk),yield Vo(rA.confirmCheckout,sk),yield Vo(rA.errorCheckout,uk)}function*ak(){yield ji(rA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*rk(){yield ji(rA.setState({loading:!1,error:null,confirmed:!1}))}function*lk(){yield ji(rA.setState({loading:!0,error:null}))}function*sk({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)===Tu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield ji(rA.setState({loading:!0,error:null})),o&&a)return yield ck(),void(yield ji(_b.setState({subscription:I({},n,{status:Tu.ACTIVE})})));try{yield Gi(ed.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Wi([xA(),GA(),XA()]),yield ck()}catch(e){yield ji(rA.setState({loading:!1,error:e.message}))}}else yield ji(rA.setState({loading:!1,error:"Subscription not found"}))}function*ck(){yield ji(rA.setState({loading:!1,error:null,confirmed:!0}))}function*uk({payload:e}){yield ji(rA.setState({loading:!1,error:e}))}function*dk(){yield Vo(rA.resetCheckout,rk)}function*yk(){yield Vo(Ab.loadPlans,fk)}function*fk(){yield ji(Ab.setLoading(!0));try{const e=(yield Gi(ed.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 ji(Ab.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ji(Ab.setError(e.message))}}function*gk(){yield ji(Ab.setLoading(!0)),yield Hi(500),yield ji(Ab.setState({fetching:!1,loading:!1,plans:OA.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*pk(){yield Vo(Ab.loadPlans,gk)}function*Sk(){yield Vo(Ob.loadPaymentConfiguration,vk)}function*vk(){yield ji(Ob.setLoading(!0));try{(yield Gi(ed.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Lu.Stripe))?yield function*(){yield ji(Ob.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getStripePaymentProviderConfiguration);yield ji(Ob.setState({loading:!1,fetching:!1,config:{paymentProvider:AA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ji(Ob.setError(e.message))}}():yield ji(Ob.setError("Payment provider not configured"))}catch(e){yield ji(Ob.setError(e.message))}}function*hk(){yield ji(Ob.setLoading(!0)),yield Hi(500),yield ji(Ob.setState({loading:!1,fetching:!1,config:{paymentProvider:AA.STRIPE,apiKey:""}}))}function*mk(){yield Vo(Ob.loadPaymentConfiguration,hk)}function*bk(){yield Vo(yA.createCardSetupIntentSecret,Ak)}function*Ak({payload:e}){yield ji(yA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Gi(ed.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ji(yA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ji(yA.setError(e.message))}}function*kk(){yield Vo(vA.loadVendorPublicConfiguration,Tk)}function*Tk(){yield ji(vA.setLoading(!0));try{const e=yield Gi(ed.subscriptions.getVendorPublicConfigurations);yield ji(vA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ji(vA.setError(e.message))}}function*Pk(){yield ji(vA.setLoading(!0)),yield Hi(500),yield ji(vA.setState({fetching:!1,loading:!1,vendorPublicConfig:CA}))}function*Ik(){yield Vo(vA.loadVendorPublicConfiguration,Pk)}var Lk={sagas:function*(){yield Wi([Gi(nk),Gi(ok),Gi(yk),Gi(Sk),Gi(bk),Gi(kk)])},mockSagas:function*(){yield Wi([Gi(ik),Gi(dk),Gi(pk),Gi(mk),Gi(Ik)])},reducer:bA,actions:mA,initialState:hA,storeName:"subscriptions"},Ok={sagas:function*(){yield Vo(qd.loadVendorPublicInfo,Hd)},storeName:It,initialState:Gd,reducer:Bd,actions:qd};const{reducer:wk}=at({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ko.setContext(t),I({},e,{context:t}))}}}),Ek=(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||Ko.setContext(e.context);const t=Do(),h=[...tt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=nt({middleware:h,preloadedState:{root:I({},e,{previewMode:n,urlStrategy:r}),[Xh.storeName]:I({},Xh.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},Xh.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Pm.storeName]:I({},Pm.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Pm.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Pm.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Lm]:I({},Im,null!=(v=null==o?void 0:o.audits)?v:{}),[yb.storeName]:yb.initialState,[Lk.storeName]:Lk.initialState,[Ok.storeName]:Ok.initialState},reducer:$e({root:wk,[Xh.storeName]:Xh.reducer,[Pm.storeName]:Pm.reducer,[Lm]:wm,[yb.storeName]:yb.reducer,[Lk.storeName]:Lk.reducer,[Ok.storeName]:Ok.reducer})});const m=function*(){yield Wi([Gi(Xh.sagas),Gi(Pm.sagas),Gi(xm),Gi(yb.sagas),Gi(Lk.sagas),Gi(Ok.sagas)])},b=function*(){yield Wi([Gi(Xh.mockSagas),Gi(Pm.mockSagas),Gi(Lk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Gn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var Ck=n(714),Dk=n.n(Ck);function Rk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function _k(e){if(e.type)return e;if("#"===e.charAt(0))return _k(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 Uk(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 Mk(e){if(0===e.indexOf("#"))return e;const{values:t}=_k(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 Nk(e,t){if(e=_k(e),t=Rk(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 Uk(e)}function $k(e,t){if(e=_k(e),t=Rk(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 Uk(e)}const Fk=e=>{if(e)return{main:e,light:Mk($k(e,.4)),dark:Mk(Nk(e,.15)),hover:Mk(Nk(e,.15)),active:Mk(Nk(e,.2))}},xk=e=>{if(e)return{main:e,light:$k(e,.7),dark:Nk(e,.2)}},Vk=(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({},Fk(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:I({},Fk(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:I({},Fk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},xk(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},xk(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},xk(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},xk(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},jk={},Wk={},Kk={},Gk={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class Bk{constructor(){this._theme=jk,this._themeV2=Wk,this._navigation=Gk,this._localizations=Kk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Bk;return n.set(e),Bk._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,l;this._navigation=Dk().all([null!=(t=Gk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Dk().all([null!=(i=jk)?i:{},Vk(null==e?void 0:e.theme,jk)]),this._themeV2=Dk().all([null!=(o=Wk)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Dk().all([null!=(r=Kk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=Gk,this._theme=jk,this._themeV2=Wk,this._localizations=Kk}}}Bk._instances={};var zk={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},qk=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},Hk=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},Jk=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 Yk,Qk,Xk,Zk,eT,tT,nT,iT,oT,aT,rT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(Yk||(Yk={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Qk||(Qk={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(Xk||(Xk={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Zk||(Zk={})),function(e){e.Invoices="invoices"}(eT||(eT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(tT||(tT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(nT||(nT={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(iT||(iT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(oT||(oT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(aT||(aT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(rT||(rT={}));const lT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},sT={hidden:"hidden",edit:"edit"};var cT="6.65.0-alpha.1",uT=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(cT),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=O(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=Ho,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:Bk.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=O(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=O(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=zk,e.next=13;break;case 4:return e.prev=4,e.next=7,ju();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=qk(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:Ek({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=O(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;Bk.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi: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=O(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=O(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=O(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}(),dT=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?(Ko.setAccessToken(t),Ko.setUser(I({},n,{accessToken:t})),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Gn.loadTenants())):(Ko.setAccessToken(null),Ko.setUser(null),o.store.dispatch(Gn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),yT=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}(),fT=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}(),gT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},pT=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:Ek({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 uT(this.options,t,!0),Bk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(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,Jk(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}(),ST="modern",vT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[ST]},hT=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:Ek({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 uT(this.options,t,!0),Bk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(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,Jk(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 mT(e,t){return mT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},mT(e,t)}function bT(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&&mT(e,t)}function AT(e){return AT="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},AT(e)}function kT(e,t){if(t&&("object"===AT(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 TT(e){return TT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},TT(e)}function PT(){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 IT(e,t,n){return IT=PT()?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&&mT(o,n.prototype),o},IT.apply(null,arguments)}function LT(e){var t="function"==typeof Map?new Map:void 0;return LT=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 IT(e,arguments,TT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),mT(n,e)},LT(e)}function OT(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=TT(e);if(t){var o=TT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return kT(this,n)}}var wT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new uT(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){bT(n,e);var t=OT(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=Hk(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=Hk(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=Hk(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=Hk(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=Hk(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=Hk(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}(LT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(O([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return mT},AdminPortalRenderer:function(){return kT},AppHolder:function(){return P},CheckoutDialog:function(){return bT},FronteggApp:function(){return vT},HostedLogin:function(){return hT},LoginBoxRenderer:function(){return IT},defaultTheme:function(){return TT},getThemeAdminByName:function(){return AT},getThemeByName:function(){return PT},initialize:function(){return MT}});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 ur},OAuthLogout:function(){return Ur},SocialLoginProviders:function(){return cr},acceptInvitation:function(){return Cr},activateAccount:function(){return Lr},bulkCreateIPRestriction:function(){return or},changePhoneNumber:function(){return Ss},changePhoneNumberWithVerification:function(){return gs},checkIfAllowToRememberMfaDevice:function(){return Kl},createDomainRestriction:function(){return Xa},createIPRestriction:function(){return ir},createOrUpdateSessionConfigrations:function(){return _l},createSSOConfiguration:function(){return Hl},createSSOConfigurationByMetadata:function(){return Ql},createSSODomain:function(){return Zl},createSSOGroup:function(){return os},createSamlGroup:function(){return ml},deleteAllSessionsForUser:function(){return Ml},deleteDomainRestriction:function(){return er},deleteIPRestriction:function(){return rr},deleteSSOConfiguration:function(){return Yl},deleteSSODomain:function(){return es},deleteSSOGroup:function(){return rs},deleteSamlGroup:function(){return Al},deleteSessionForUser:function(){return Ul},deleteTenantApiToken:function(){return Vl},deleteUserApiToken:function(){return jl},disableMFAAuthenticatorApp:function(){return Hr},disableMFASMS:function(){return Yr},disableMFAWebAuthn:function(){return Xr},disableMfa:function(){return qr},enrollMFAAuthenticatorApp:function(){return jr},enrollMFAAuthenticatorAppForLogin:function(){return tl},enrollMFASMS:function(){return Kr},enrollMFASMSForLogin:function(){return ol},enrollMFAWebAuthn:function(){return Br},enrollMFAWebAuthnForLogin:function(){return sl},enrollMfa:function(){return xr},exchangeOAuthTokens:function(){return us},forgotPassword:function(){return Mr},generateLoginResponse:function(){return vr},generateLoginResponseFromOAuthResponse:function(){return mr},generateLoginResponseV2:function(){return hr},getActivateAccountStrategy:function(){return Or},getCaptchaPolicy:function(){return za},getCurrentUserSession:function(){return Cl},getCurrentUserSessions:function(){return El},getDomainRestrictions:function(){return Ya},getDomainRestrictionsConfig:function(){return Qa},getGlobalSecurityPolicy:function(){return Va},getIPRestrictions:function(){return tr},getIPRestrictionsConfig:function(){return nr},getLockoutPolicy:function(){return Ga},getMFADevices:function(){return Zr},getMFAStrategiesConfig:function(){return ks},getMfaPolicy:function(){return ja},getOidcConfiguration:function(){return kl},getPasswordConfigPolicy:function(){return Ja},getPasswordHistoryPolicy:function(){return qa},getSSOConfigurations:function(){return ql},getSSODefaultRoles:function(){return ns},getSSOGroups:function(){return ls},getSSOPublicConfiguration:function(){return Tl},getSamlConfiguration:function(){return dl},getSamlRoles:function(){return Sl},getSamlRolesGroups:function(){return vl},getSamlVendorConfiguration:function(){return fl},getSessionConfigurations:function(){return Rl},getSocialLoginProviders:function(){return Pl},getSocialLoginProvidersV2:function(){return Il},getTenantApiTokensData:function(){return $l},getUserApiTokensData:function(){return Nl},getUserById:function(){return Wl},getVendorConfig:function(){return Ol},getVendorMfaPolicy:function(){return Wa},getVendorPublicAuthStrategiesConfig:function(){return As},loadPasswordConfig:function(){return $r},login:function(){return Pr},loginViaSocialLogin:function(){return Ll},loginWithMfa:function(){return Ir},logout:function(){return _r},oidcPostLogin:function(){return Tr},oidcPostLoginV2:function(){return cs},passwordlessPostLogin:function(){return Bl},passwordlessPreLogin:function(){return Gl},postLogin:function(){return kr},preDisableMFASMS:function(){return Jr},preDisableMFAWebAuthn:function(){return Qr},preEnrollMFAAuthenticatorApp:function(){return Vr},preEnrollMFAAuthenticatorAppForLogin:function(){return el},preEnrollMFASMS:function(){return Wr},preEnrollMFASMSForLogin:function(){return il},preEnrollMFAWebAuthn:function(){return Gr},preEnrollMFAWebAuthnForLogin:function(){return ll},preLogin:function(){return br},preLoginV2:function(){return ss},preLoginWithIdpType:function(){return Ar},preVerifyMFASMSForLogin:function(){return al},preVerifyMFAWebAuthnForLogin:function(){return cl},recoverMfaToken:function(){return Fr},refreshToken:function(){return Dr},refreshTokenV2:function(){return Rr},resendActivationEmail:function(){return wr},resendInvitationEmail:function(){return Er},resetPassword:function(){return Nr},resetPhoneNumber:function(){return ys},revokeSessionsForUser:function(){return Dl},saveLockoutPolicy:function(){return Ba},saveMfaPolicy:function(){return Ka},savePasswordHistoryPolicy:function(){return Ha},setSSODefaultRoles:function(){return is},signUpUser:function(){return wl},silentOAuthRefreshToken:function(){return ds},testCurrentIp:function(){return lr},testCurrentIpInAllowList:function(){return sr},updateDomainRestrictionConfig:function(){return Za},updateIPRestrictionConfig:function(){return ar},updateSSOConfiguration:function(){return Jl},updateSSOConfigurationByMetadata:function(){return Xl},updateSSOGroup:function(){return as},updateSamlConfiguration:function(){return yl},updateSamlGroup:function(){return bl},updateSamlRoles:function(){return hl},updateSamlVendorMetadata:function(){return gl},updateTenantApiTokensData:function(){return xl},updateUserApiTokensData:function(){return Fl},validateSSODomain:function(){return ts},validateSamlDomain:function(){return pl},verifyChangePhoneNumber:function(){return ps},verifyInviteToken:function(){return zl},verifyMFAAuthenticatorAppForLogin:function(){return nl},verifyMFASMSForLogin:function(){return rl},verifyMFAWebAuthnForLogin:function(){return ul},verifyMfa:function(){return zr},verifyNewDeviceSession:function(){return bs},verifyResetPhoneNumber:function(){return fs},webAuthnCreateNewDeviceSession:function(){return ms},webAuthnPostLogin:function(){return hs},webAuthnPreLogin:function(){return vs}});var a={};n.r(a),n.d(a,{addUser:function(){return ws},changePassword:function(){return Ls},createInviteUserLink:function(){return Ds},deleteInviteUserLink:function(){return _s},deleteUser:function(){return Es},getInviteLinkConfiguration:function(){return Ms},getInviteUserLink:function(){return Us},getProfile:function(){return Ts},loadAvailablePermissions:function(){return $s},loadAvailableRoles:function(){return Ns},loadStats:function(){return Fs},loadUsers:function(){return Os},resendActivationLink:function(){return xs},resendInvitationLink:function(){return Vs},resendInvitationLinkToAllTenants:function(){return js},updateInviteUserLink:function(){return Rs},updateProfile:function(){return Ps},updateProfileImage:function(){return Is},updateUser:function(){return Cs}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return zs},getCurrentUserIpMetadata:function(){return Ks},getIpAdressMetadata:function(){return qs},getNotificationsMetadata:function(){return Gs},getSamlMetadata:function(){return Bs}});var l={};n.r(l),n.d(l,{downloadReport:function(){return tc},getReport:function(){return Xs},getReports:function(){return Qs},renderReport:function(){return Zs},scheduleReport:function(){return ec},sendReport:function(){return nc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return ic},markAllAsRead:function(){return rc},updateNotificationIsPinned:function(){return ac},updateNotificationStatus:function(){return oc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return uc},getAudits:function(){return sc},getAuditsStats:function(){return cc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Pc},deleteEmailSubscriptions:function(){return kc},deleteSMSConfiguration:function(){return Cc},deleteSMSSubscriptions:function(){return wc},deleteSlackConfiguration:function(){return vc},deleteWebhooksConfiguration:function(){return _c},getCategories:function(){return $c},getChannelMaps:function(){return Fc},getEmailConfiguration:function(){return mc},getSMSConfiguration:function(){return Ic},getSlackChannels:function(){return pc},getSlackConfiguration:function(){return fc},getSlackScope:function(){return gc},getWebhookLog:function(){return Uc},getWebhooksConfigurations:function(){return Dc},patchEmailConfiguration:function(){return Ac},patchSMSConfiguration:function(){return Oc},postEmailConfiguration:function(){return bc},postSMSConfiguration:function(){return Lc},postSlackCode:function(){return hc},postSlackConfiguration:function(){return Sc},postWebhookRetry:function(){return Nc},postWebhookTest:function(){return Mc},postWebhooksConfiguration:function(){return Rc},putEmailSubscriptions:function(){return Tc},putSMSSubscriptions:function(){return Ec}});var d={};n.r(d),n.d(d,{getSettings:function(){return Vc},updateSettings:function(){return xc}});var y={};n.r(y),n.d(y,{addRole:function(){return Bc},attachPermissionToRoles:function(){return Yc},attachPermissionsToRole:function(){return Hc},deleteRole:function(){return zc},getPermissionCategories:function(){return Qc},getPermissions:function(){return Jc},getRoles:function(){return Gc},updateRole:function(){return qc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Eu},ISubscriptionStatus:function(){return Ou},PaymentMethodType:function(){return wu},ProviderType:function(){return Cu},TenantCreatedAction:function(){return Ru},TrialEndAction:function(){return Du},cancelManagedSubscription:function(){return au},cancelSubscription:function(){return eu},createStripeCustomer:function(){return mu},createStripePaymentMethodSetupIntentSecret:function(){return Au},createSubscription:function(){return vu},createTenantConfiguration:function(){return Pu},getManagedSubscription:function(){return iu},getManagedSubscriptions:function(){return ou},getPaymentMethod:function(){return pu},getPaymentMethods:function(){return gu},getPaymentProviders:function(){return Iu},getStripeCustomer:function(){return hu},getStripePaymentProviderConfiguration:function(){return bu},getSubscription:function(){return Zc},getSubscriptionInvoice:function(){return du},getSubscriptionInvoicePdf:function(){return yu},getSubscriptionInvoices:function(){return uu},getSubscriptionPlan:function(){return cu},getSubscriptionPlans:function(){return su},getSubscriptionSummaries:function(){return ku},getSubscriptions:function(){return Xc},getTenantConfiguration:function(){return Tu},getVendorPublicConfigurations:function(){return Lu},renewManagedSubscription:function(){return ru},renewSubscription:function(){return tu},updateManagedSubscription:function(){return lu},updatePaymentMethodBillingDetails:function(){return Su},updateSubscription:function(){return nu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Fu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Wu},addUserToTenantAndSubTenants:function(){return Vu},loadAllUsers:function(){return xu},removeUserFromTenantAndSubTenants:function(){return ju},removeUserRolesFromSubTenants:function(){return Ku},setUserRolesForSubTenants:function(){return Gu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return Bu}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Yu},createConfiguration:function(){return Hu},deleteConfiguration:function(){return Ju},getConfigs:function(){return zu},updateConfiguration:function(){return qu}});var h={};n.r(h),n.d(h,{impersonate:function(){return Qu}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return ur},ContextHolder:function(){return qo},FronteggApiError:function(){return Jo},FronteggContext:function(){return Ho},ISubscriptionCancellationPolicy:function(){return Eu},ISubscriptionStatus:function(){return Ou},MFAStrategyEnum:function(){return Mu},PaymentMethodType:function(){return wu},ProviderType:function(){return Cu},RestrictionType:function(){return _n},ScimConnectionSource:function(){return id},SecondaryAuthStrategy:function(){return _u},SocialLoginProviders:function(){return cr},TenantType:function(){return $u},UserManagedByEnum:function(){return Nu},WebAuthnDeviceType:function(){return Uu},api:function(){return od},countConfigurationUsers:function(){return Yu},createConfiguration:function(){return Hu},default:function(){return ad},deleteConfiguration:function(){return Ju},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Xu},fronteggRefreshTokenUrl:function(){return Zu},fronteggSilentRefreshTokenUrl:function(){return ed},fronteggTenantsUrl:function(){return nd},fronteggUsersUrl:function(){return td},getConfigs:function(){return zu},loadFeatureFlags:function(){return Bu},updateConfiguration:function(){return qu}});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 rT},DomainRestrictionsTabFields:function(){return yT},GeneralSettingsTabFields:function(){return uT},InviteUserModalFields:function(){return aT},IpRestrictionsTabFields:function(){return dT},Metadata:function(){return Xk},PrivacyPageFields:function(){return oT},ProfilePageFields:function(){return iT},SecurityPageTabs:function(){return sT},SessionManagementTabFields:function(){return cT},SsoPageTabs:function(){return fT},SubscriptionsPageFields:function(){return lT},fieldAppearance:function(){return gT},tabAppearance:function(){return pT}});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 O(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 w=n(841),E=n.n(w);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,Oe=(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 we(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){we(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)?Oe(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 Oe(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:[]},Ot={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},wt={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},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{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"),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"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),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})))},On={loading:!1,sessions:[]},wn={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:On})},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:On,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}))},Ot,rn,Dt,Gn,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,wn,Dn,Mn,Fn)});const Hn=I({},qn,wt,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},Oi=function(e){return{value:e,done:!0}};function wi(e,t,n){void 0===t&&(t=Li),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Oi,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 wi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!fi(o)})}))}catch(e){return wi((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 Oo=null,wo=[],Eo=function(e){e.crashedEffect=Oo,wo.push(e)},Co=function(){Oo=null,wo.length=0},Do=function(){var e,t,n=wo[0],i=wo.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(wo)]).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){Oo=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 wi(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"},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"},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:"/resources/impersonation/v1/impersonate"},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"},Oa={v1:"/reports/engine/resources/triggers/v1"},wa="/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(e){return e.id?ea(`${la.v1}/lockout-policy`,e):Zo(`${la.v1}/lockout-policy`,e)}async function za(){try{return await Xo(`${la.v1}/captcha-policy/public`)}catch{return null}}async function qa(){return Xo(`${la.v1}/password-history-policy`)}async function Ha(e){return e.id?ea(`${la.v1}/password-history-policy`,e):Zo(`${la.v1}/password-history-policy`,e)}async function Ja(){return Xo(`${la.v1}/password`)}async function Ya(){return Xo(`${sa.emailDomain.v1}`)}async function Qa(){return Xo(`${sa.emailDomain.v1}/config`)}async function Xa(e){return Zo(`${sa.emailDomain.v1}`,e)}async function Za(e){return Zo(`${sa.emailDomain.v1}/config`,e)}async function er(e){return na(`${sa.emailDomain.v1}/${e}`)}async function tr(e){return Xo(`${sa.ip.v1}`,e)}async function nr(){return Xo(`${sa.ip.v1}/config`)}async function ir(e){return Zo(`${sa.ip.v1}`,e)}async function or(e){return Zo(`${sa.ip.v1}/bulk`,e)}async function ar(e){return Zo(`${sa.ip.v1}/config`,e)}async function rr(e){return na(`${sa.ip.v1}/${e}`)}async function lr(){return Zo(`${sa.ip.v1}/verify`)}async function sr(){return Zo(`${sa.ip.v1}/verify/allow`)}let cr,ur;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(cr||(cr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ur||(ur={}));class dr extends Error{constructor(e){super(e)}}const yr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new dr("'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 fr extends Error{constructor(e){super(e)}}const gr=(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(yr(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 yr(t)}})(e.split(".")[n]))}catch(e){throw new fr("Invalid token specified: "+e.message)}},pr=["type"],Sr=["type"];async function vr(e){if(!e.accessToken)return e;qo.setAccessToken(e.accessToken);const t=await Xo(`${ra.v2}/me`),n=I({},e,e.accessToken?gr(e.accessToken):{},t);return qo.setUser(n),n}async function hr(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?gr(e.accessToken):{},t);return qo.setUser(i),{user:i,tenants:n}}async function mr(e){qo.setAccessToken(e.id_token);const t=await Xo(`${ra.v2}/me`),n=e.id_token?gr(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 br(e){try{const{address:t}=await Zo(`${aa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Ar(e){return Zo(`${aa.v1}/user/saml/prelogin`,e)}async function kr(e){return vr(await Zo(`${aa.v1}/user/saml/postlogin`,e))}async function Tr(e){return vr(await Zo(`${aa.v1}/user/oidc/postlogin`,e))}async function Pr(e){return vr(await Zo(`${aa.v1}/user`,e))}async function Ir(e){return vr(await Zo(`${aa.v1}/user/mfa/verify`,e))}async function Lr(e){return Zo(`${ra.v1}/activate`,e)}async function Or(e){return Xo(`${ra.v1}/activate/strategy`,e)}async function wr(e){return Zo(`${ra.v1}/activate/reset`,e)}async function Er(e){return Zo(`${ra.v1}/invitation/reset`,e)}async function Cr(e){return Zo(`${ra.v1}/invitation/accept`,e)}async function Dr(){return vr(await Zo(`${aa.v1}/user/token/refresh`))}async function Rr(){return hr(await Zo(`${aa.v1}/user/token/refresh`))}async function _r(){return Zo(`${aa.v1}/logout`)}async function Ur(e){return Xo(`${Ra}/logout`,e)}async function Mr(e){return Zo(`${ra.v1}/passwords/reset`,e)}async function Nr(e){return Zo(`${ra.v1}/passwords/reset/verify`,e)}async function $r(e){return Xo(`${ra.v1}/passwords/config`,e)}async function Fr(e){return Zo(`${aa.v1}/user/mfa/recover`,e)}async function xr(){return Zo(`${ra.v1}/mfa/enroll`)}async function Vr(){return Zo(`${ra.v1}/mfa/authenticator/enroll`)}async function jr(e){return Zo(`${ra.v1}/mfa/authenticator/enroll/verify`,e)}async function Wr(e){return Zo(`${ra.v1}/mfa/sms/enroll`,e)}async function Kr(e){return Zo(`${ra.v1}/mfa/sms/enroll/verify`,e)}async function Gr(){return Zo(`${ra.v1}/mfa/webauthn/enroll`)}async function Br(e){return Zo(`${ra.v1}/mfa/webauthn/enroll/verify`,e)}async function zr(e){return Zo(`${ra.v1}/mfa/enroll/verify`,e)}async function qr(e){return Zo(`${ra.v1}/mfa/disable`,e)}async function Hr(e,t){return Zo(`${ra.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Jr(e){return Zo(`${ra.v1}/mfa/sms/${e}/disable`)}async function Yr(e,t){return Zo(`${ra.v1}/mfa/sms/${e}/disable/verify`,t)}async function Qr(e){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable`)}async function Xr(e,t){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Zr(){return Xo(`${ra.v1}/mfa/devices`)}async function el(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll`,e)}async function tl(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function nl(e,t){return Zo(`${aa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function il(e){return Zo(`${aa.v1}/user/mfa/sms/enroll`,e)}async function ol(e){return Zo(`${aa.v1}/user/mfa/sms/enroll/verify`,e)}async function al(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}`,t)}async function rl(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}/verify`,t)}async function ll(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll`,e)}async function sl(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function cl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}`,t)}async function ul(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function dl(){return Xo(`${pa.v1}/saml/configurations`)}async function yl(e){return Zo(`${pa.v1}/saml/configurations`,e)}async function fl(){return Xo(`${pa.v1}/saml/configurations/vendor-config`)}async function gl(e){return ta(`${pa.v1}/saml/configurations/metadata`,e)}async function pl(){return ta(`${pa.v1}/saml/validations/domain`)}async function Sl(){return Xo(`${pa.v1}/saml/configurations/roles/default`)}async function vl(){return Xo(`${pa.v2}/saml/configurations/groups`)}async function hl({roleIds:e}){return Zo(`${pa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function ml({roleIds:e,group:t}){return Zo(`${pa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function bl({roleIds:e,group:t,id:n}){return ea(`${pa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Al({id:e}){return na(`${pa.v2}/saml/configurations/groups/${e}`)}async function kl(){return Xo(`${pa.v1}/oidc/configurations`)}async function Tl(){return Xo(`${pa.v2}/configurations/public`)}async function Pl(){return Xo(ca.v1)}async function Il(){return Xo(ca.v2)}async function Ll({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 Ol(){return Xo(`${la.v1}/public`)}async function wl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Zo(`${ra.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await vr(n):void 0,userId:i,tenantId:o}}async function El(){return Xo(ra.sessions.currentUser.v1)}async function Cl(){return Xo(`${ra.sessions.currentUser.v1}/current`)}async function Dl(e){return Zo(`${ra.sessions.v1}/revoke`,{userId:e})}async function Rl(){return Xo(ra.sessions.configurations.v1)}async function _l(e){await Zo(ra.sessions.configurations.v1,e)}async function Ul(e){await na(`${ra.sessions.currentUser.v1}/${e}`)}async function Ml(){await na(`${ra.sessions.currentUser.v1}/all`)}async function Nl(){return Xo(ra.apiTokens.v1)}async function $l(){return Xo(da.apiTokens.v1)}async function Fl(e){return Zo(ra.apiTokens.v1,e)}async function xl(e){return Zo(da.apiTokens.v2,e)}async function Vl({tokenId:e}){return na(`${da.apiTokens.v1}/${e}`)}async function jl({tokenId:e}){return na(`${ra.apiTokens.v1}/${e}`)}async function Wl({userId:e}){return Xo(`${ra.v1}/${e}`)}async function Kl(e){return Xo(`${la.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Gl(e){let{type:t}=e,n=li(e,pr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Bl(e){let{type:t}=e,n=li(e,Sr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function zl({token:e}){return Zo(da.invites.verify.v1,{token:e})}async function ql(){return Xo(`${pa.v1}/configurations`)}async function Hl(e){return Zo(`${pa.v1}/configurations`,e)}async function Jl(e,t){return ea(`${pa.v1}/configurations/${e}`,t)}async function Yl(e){return na(`${pa.v1}/configurations/${e}`)}async function Ql(e){return Zo(`${pa.v1}/configurations/metadata`,e)}async function Xl(e,t){return ta(`${pa.v1}/configurations/${e}/metadata`,t)}async function Zl(e,t){return Zo(`${pa.v1}/configurations/${e}/domains`,t)}async function es(e,t){return na(`${pa.v1}/configurations/${e}/domains/${t}`)}async function ts(e,t){return ta(`${pa.v1}/configurations/${e}/domains/${t}/validate`)}async function ns(e){return Xo(`${pa.v1}/configurations/${e}/roles`)}async function is(e,t){return ta(`${pa.v1}/configurations/${e}/roles`,t)}async function os(e,t){return Zo(`${pa.v1}/configurations/${e}/groups`,t)}async function as(e,{roleIds:t,group:n,id:i}){return ea(`${pa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function rs(e,t){return na(`${pa.v1}/configurations/${e}/groups/${t}`)}async function ls(e){return Xo(`${pa.v1}/configurations/${e}/groups`)}async function ss(e){return Zo(`${aa.v2}/user/sso/prelogin`,e)}async function cs(e){return vr(await Zo(`${aa.v2}/user/oidc/postlogin`,e))}async function us(e){return mr(await Zo(`${Ra}/token`,e))}async function ds(){return mr(await Zo(`${Ra}/authorize/silent`))}async function ys(e){return Zo(`${ra.v1}/phone/reset`,e)}async function fs(e){return Zo(`${ra.v1}/phone/reset/verify`,e)}async function gs(e){return Zo(`${ra.v1}/phone`,e)}async function ps(e){return Zo(`${ra.v1}/phone/verify`,e)}async function Ss(e){return ta(`${ra.v1}/phone/change`,e)}async function vs(e){return Zo(`${aa.v1}/webauthn/prelogin`,e)}async function hs(e){return Zo(`${aa.v1}/webauthn/postlogin`,e)}async function ms(){return Zo(oa.v1)}async function bs(e){return Zo(`${oa.v1}/verify`,e)}async function As(){return Xo(`${la.v1}/auth/strategies/public`)}async function ks(){return Xo(`${la.v1}/mfa/strategies`)}async function Ts(e){return Xo(`${ra.v2}/me`,null!=e?e:{addRoles:!0})}async function Ps(e){return ta(`${ra.v2}/me`,e)}async function Is(e){return ta(`${ma.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Ls(e){return Zo(`${ra.v1}/passwords/change`,e)}async function Os(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 ws(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function Es(e){return na(`${Sa.v1}/${e.userId}`)}async function Cs(e){return ta(Sa.v1,e)}async function Ds(e){return Zo(da.invites.user.v1,I({},e))}async function Rs(e){return ea(da.invites.user.v1,I({},e))}async function _s(){return na(da.invites.user.v1)}async function Us(){return Xo(da.invites.user.v1)}async function Ms(){return Xo(da.invites.configuration.v1)}async function Ns(){return Xo(va.v1)}async function $s(){return Xo(ua.v1)}async function Fs(){return Xo(`${ha.v1}/members`)}async function xs(e){return Zo(`${Sa.v1}/${e.userId}/resendActivationEmail`,{})}async function Vs(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function js(e){return Zo(ra.invitation.resendAll.v1,I({},e))}async function Ws(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 Ks(){const e=await Xo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Gs=async()=>Ws({entityName:"notifications"}),Bs=async()=>Ws({entityName:"saml"}),zs=async()=>Ws({entityName:"audits"}),qs=async e=>async function(e){const t=await Xo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Hs=["dataFilters"],Js=["templateId","dataFilters"],Ys=["dataFilters"];async function Qs(e){return Xo(`${La.v2}/tenant-reports`,e)}async function Xs(e){return Xo(`${La.v2}/${e.id}/tenant-reports`)}async function Zs(e){let{dataFilters:t}=e,n=li(e,Hs);return{html:await Xo(`${Oa.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function ec(e){let{templateId:t,dataFilters:n}=e,i=li(e,Js);return Zo(`${La.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function tc(e){let{dataFilters:t}=e,n=li(e,Ys);const i=await Xo(`${Oa.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 nc(e){return Zo(`${Oa.v1}/tenant-reports`,e)}async function ic(e){return Xo(wa,{params:e})}async function oc(e){return ta(`${wa}/status`,{params:e})}async function ac(e){const{notificationId:t,pinStatus:n}=e;return ta(`${wa}/${n}`,{notificationId:t})}async function rc(){return Zo(`${wa}/status/mark-all-read`)}const lc=["endpoint","headerProps"];async function sc(e){return Xo(Ea,e)}async function cc(e){return Xo(`${Ea}/stats`,e)}async function uc(e){const{endpoint:t,headerProps:n}=e,i=li(e,lc);return ia(`${Ea}/export/${t}`,{properties:n},i)}const dc=["eventKey"],yc=["eventKey"],fc=()=>Xo(`${ka.v1}/slack`),gc=()=>Xo(`${ka.v1}/slack/applications`),pc=()=>Xo(`${ka.v1}/slack/channels`),Sc=e=>e.id?ea(`${ka.v1}/slack/subscription/${e.id}`,e):Zo(`${ka.v1}/slack/subscriptions`,e),vc=e=>na(`${ka.v1}/slack/subscriptions/${e.id}`),hc=e=>Zo(`${ka.v1}/slack/applications/registrations`,{code:e}),mc=()=>Xo(`${ka.v1}/emails`),bc=e=>{let{eventKey:t}=e,n=li(e,dc);return Zo(`${ka.v1}/emails/${t}`,n)},Ac=({eventKey:e,enabled:t})=>ea(`${ka.v1}/emails/${e}`,{enabled:t}),kc=(e,t)=>na(`${ka.v1}/emails/${e}/subscriptions/${t}`),Tc=(e,t,n)=>ta(`${ka.v1}/emails/${t}/subscriptions/${e}`,n),Pc=e=>na(`${ka.v1}/emails/${e}`),Ic=()=>Xo(`${ka.v2}/sms`),Lc=e=>{let{eventKey:t}=e,n=li(e,yc);return Zo(`${ka.v2}/sms/${t}`,n)},Oc=({eventKey:e,enabled:t})=>ea(`${ka.v2}/sms/${e}`,{enabled:t}),wc=(e,t)=>na(`${ka.v2}/sms/${e}/subscriptions/${t}`),Ec=(e,t,n)=>ta(`${ka.v2}/sms/${t}/subscriptions/${e}`,n),Cc=e=>na(`${ka.v2}/sms/${e}`),Dc=()=>Xo(Da),Rc=e=>e._id?ea(`${Da}/${e._id}`,e):Zo(`${Da}/custom`,e),_c=e=>na(`${Da}/${e}`),Uc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Xo(`${Da}/logs/?${i.toString()}`)},Mc=e=>Zo(`${Da}/test`,e),Nc=e=>Zo(`${Da}/logs/${e}/retries`),$c=()=>Xo(`${Ca.v1}/categories`),Fc=e=>Xo(Ca.v1,{channels:e});async function xc(e){return ta(ba.v1,e)}async function Vc(){return Xo(ba.v1)}const jc=["roleId"],Wc=["roleId"],Kc=["permissionId"];async function Gc(){return Xo(ya.v1)}async function Bc(e){return Zo(ya.v1,e)}async function zc({roleId:e}){return na(`${ya.v1}/${e}`)}async function qc(e){let{roleId:t}=e,n=li(e,jc);return ea(`${ya.v1}/${t}`,n)}async function Hc(e){let{roleId:t}=e,n=li(e,Wc);return ta(`${ya.v1}/${t}/permissions`,n)}async function Jc(){return Xo(ua.v1)}async function Yc(e){let{permissionId:t}=e,n=li(e,Kc);return ta(`${ua.v1}/${t}/roles`,n)}async function Qc(){return Xo(`${ua.v1}/categories`)}async function Xc(){return Xo(Ta.subscriptions.v1)}async function Zc(e){return Xo(`${Ta.subscriptions.v1}/${e}`)}async function eu(e){return ta(`${Ta.subscriptions.v1}/${e}/cancellations/`,{})}async function tu(e){return ta(`${Ta.subscriptions.v1}/${e}/renewals/`,{})}async function nu(e,{paymentMethodId:t,planId:n}){return ta(`${Ta.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function iu(e){return Xo(`${Ia.v1}/${e}`)}async function ou(){return Xo(`${Ia.v1}`)}async function au(e){return ta(`${Ia.v1}/${e}/cancellations/`,{})}async function ru(e){return ta(`${Ia.v1}/${e}/renewals/`,{})}async function lu(e,{paymentMethodId:t,planId:n}){return ta(`${Ia.v1}/${e}`,{paymentMethodId:t,planId:n})}async function su(){return Xo(Ta.plans.v1)}async function cu(e){return Xo(`${Ta.plans.v1}/${e}`)}async function uu(){return Xo(Ta.invoices.v1)}async function du(e){return Xo(`${Ta.invoices.v1}/${e}`)}async function yu(e,t){return Xo(`${Ta.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const fu=["email"];async function gu(){return Xo(Ta.paymentMethods.v1)}async function pu(e){return Xo(`${Ta.paymentMethods.v1}/${e}`)}async function Su(e,t){let{email:n}=t,i=li(t,fu);return ea(`${Ta.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function vu(e){return Zo(Ta.paymentProviders.stripe.subscriptions.v1,e)}async function hu(e){return Xo(`${Ta.paymentProviders.stripe.customers.v1}/${e}`)}async function mu(e){return Zo(`${Ta.paymentProviders.stripe.customers.v1}`,e)}async function bu(){return Xo(`${Ta.paymentProviders.stripe.publicConfigurations.v1}`)}async function Au(e){return Zo(`${Ta.paymentProviders.stripe.setupIntents.v1}`,e)}async function ku(e){return Xo(`${Ta.summaries.v1}/${e}`)}async function Tu(e){return Xo(`${Ta.tenantConfiguration.v1}/${e}`)}async function Pu(e){return Zo(`${Ta.tenantConfiguration.v1}`,e)}async function Iu(){return Xo(Pa.v1)}async function Lu(){return Xo(`${Ta.configurations.vendorPublicConfigurations.v1}`)}let Ou,wu,Eu,Cu,Du,Ru,_u,Uu,Mu,Nu,$u;async function Fu(){return Xo("/vendors/public")}async function xu(e){return Xo(fa.v1,e)}async function Vu(e){return Zo(fa.v1,e)}async function ju(e){return na(fa.v1,e)}async function Wu(e,t){return Zo(`${fa.v1}/${e}/roles`,t)}async function Ku(e,t){return na(`${fa.v1}/${e}/roles`,t)}async function Gu(e,t){return ea(`${fa.v1}/${e}/roles`,t)}async function Bu(){return Xo(_a)}async function zu(){return Xo(`${Ua}`)}async function qu(e,t){return ea(`${Ua}/${e}`,t)}async function Hu(e){return Zo(`${Ua}`,e)}async function Ju(e){return na(`${Ua}/${e}`)}async function Yu(e){return Xo(`${Ma}/${e}/Users/count`)}async function Qu(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"}(Ou||(Ou={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(wu||(wu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Eu||(Eu={})),(Cu||(Cu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Du||(Du={})),function(e){e.CREATE="create_customer"}(Ru||(Ru={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(_u||(_u={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Uu||(Uu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Mu||(Mu={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Nu||(Nu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}($u||($u={}));const Xu=[`${aa.v1}/logout`,`${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}/logout`,`${Ra}/token`,`${Ra}/authorize/silent`],Zu=`${aa.v1}/user/token/refresh`,ed=`${Ra}/authorize/silent`,td=`${ra.v2}/me`,nd=`${ra.v2}/me/tenants`;let id;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(id||(id={}));const od={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 ad={fetch:e,ContextHolder:qo,FronteggContext:Ho,api:od,FronteggApiError:Jo,AuthStrategyEnum:ur,SocialLoginProviders:cr,ISubscriptionCancellationPolicy:Eu,ISubscriptionStatus:Ou,PaymentMethodType:wu,ProviderType:Cu};let rd,ld;function sd(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function cd(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 ud(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"}(rd||(rd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ld||(ld={}));const dd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),yd={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},fd=I({},yd,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),gd=[{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},Sd=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}),vd={loading:!1,error:void 0,saving:!0,profile:pd},hd={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"},md={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ur.EmailAndPassword},bd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Ad={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},kd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Td={enabled:!0,domain:"domain",validated:!0,generatedVerification:"generatedVerification",ssoEndpoint:"ssoEndpoint",publicCertificate:"publicCertificate",signRequest:!0,createdAt:new Date,updatedAt:new Date,acsUrl:void 0,spEntityId:void 0,oidcClientId:void 0,oidcSecret:void 0,type:void 0},Pd={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Id=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ld={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Td,roles:Id,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Od=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],wd={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:[gd[0]]},Ed={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:[gd[1]]},Cd={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Dd=[Ed,wd],Rd=[Cd],_d=[{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}],Ud=[{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"}],Md={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Nd={isActive:!0,strategy:_n.ALLOW},$d=[{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 Fd,xd,Vd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Fd||(Fd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(xd||(xd={})),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"}(Vd||(Vd={})),Vd.profile,Vd.privacy,Vd.personalApiTokens,Vd.account,Vd.users,Vd.security,Vd.sso,Vd.audits,Vd.webhooks,Vd.apiTokens,Vd.roles,Vd.subscriptions;const jd=["events","url"];function*Wd(){yield Bi(Hn.setSignUpState({loading:!0}));try{const e=yield Hi(od.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*Kd(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,jd);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(od.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:xd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(qo.setAccessToken(null==l?void 0:l.accessToken),qo.setUser(l),!r&&l&&Qy(l)){const t=yield ef(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*Gd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Qi((e=>e.auth.signUpState));yield Bi(Hn.resetSignUpState()),yield Bi(Hn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Bd(){yield zo(Hn.signUpUser,Kd),yield zo(Hn.resetSignUpStateSoft,Gd)}const zd={setVendorState:(e,{payload:t})=>I({},e,t)},qd={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},Hd={loading:!1},{reducer:Jd,actions:Yd}=at({name:It,initialState:Hd,reducers:I({},zd)}),Qd=I({},Yd,qd);function*Xd(){yield Bi(Qd.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield od.vendor.getVendorPublicInfo();yield Bi(Qd.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Bi(Qd.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Zd=["callback"],ey=["callback"],ty=["callback"],ny=["callback"],iy=["callback"],oy=["callback"];function*ay(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Hi(od.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.loadSecurityPolicyCaptcha()),yield Bi(Hn.loadPublicAuthStrategiesPolicy())}function*ry(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getVendorConfig);yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ly(){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getVendorPublicAuthStrategiesConfig);yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*sy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getMfaPolicy);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*cy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getVendorMfaPolicy);yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*uy(e){let{payload:{callback:t}}=e,n=li(e.payload,Zd);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Hi(od.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*dy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getLockoutPolicy);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*yy(e){let{payload:{callback:t}}=e,n=li(e.payload,ey);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Hi(od.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*fy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getCaptchaPolicy);yield Bi(Hn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*gy(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*py(e){let{payload:{callback:t}}=e,n=li(e.payload,ty);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Hi(od.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*Sy(){yield Bi(Hn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getPasswordConfigPolicy);yield Bi(Hn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*vy(){yield zo(Hn.loadSecurityPolicy,ay),yield Go(Hn.saveSecurityPolicyMfa,uy),yield Go(Hn.loadSecurityPolicyMfa,sy),yield Go(Hn.loadSecurityPolicyVendorMfa,cy),yield Go(Hn.saveSecurityPolicyLockout,yy),yield Go(Hn.loadSecurityPolicyLockout,dy),yield Go(Hn.loadSecurityPolicyCaptcha,fy),yield Go(Hn.saveSecurityPolicyPasswordHistory,py),yield Go(Hn.loadSecurityPolicyPasswordHistory,gy),yield Go(Hn.loadVendorPasswordConfig,Sy),yield Go(Hn.loadPublicSecurityPolicy,ry),yield Go(Hn.loadPublicAuthStrategiesPolicy,ly)}function*hy(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Bi(Hn.setSecurityPolicyPublicState({policy:md,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*my(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyGlobalState({policy:hd,loading:!1})),yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyCaptcha())}function*by(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:bd,loading:!1}))}function*Ay(){yield Bi(Hn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:bd,loading:!1}))}function*ky(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,ny);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Ad,{id:null!=(t=i.id)?t:Ad.id,enforceMFAType:i.enforceMFAType});yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Ty(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Ad,loading:!1}))}function*Py(e){let{payload:{callback:t}}=e,n=li(e.payload,iy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},n,Ad,{id:n.id?n.id:Ad.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Iy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Ad,loading:!1}))}function*Ly(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:kd,loading:!1}))}function*Oy(e){let{payload:{callback:t}}=e,n=li(e.payload,oy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},n,kd,{id:n.id?n.id:kd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*wy(){yield zo(Hn.loadSecurityPolicy,my),yield Go(Hn.loadPublicSecurityPolicy,hy),yield Go(Hn.saveSecurityPolicyMfa,ky),yield Go(Hn.loadSecurityPolicyMfa,by),yield Go(Hn.loadSecurityPolicyVendorMfa,Ay),yield Go(Hn.saveSecurityPolicyLockout,Py),yield Go(Hn.loadSecurityPolicyLockout,Ty),yield Go(Hn.loadSecurityPolicyCaptcha,Iy),yield Go(Hn.saveSecurityPolicyPasswordHistory,Oy),yield Go(Hn.loadSecurityPolicyPasswordHistory,Ly)}const Ey=["callback"],Cy=["callback"],Dy=["callback"],Ry=["callback"],_y=["callback","events"],Uy=["callback"],My=["callback"],Ny=["callback"],$y=["callback"],Fy=["callback"],xy=["callback"],Vy=["callback"],jy=["callback"],Wy=["callback"],Ky=["callback","deviceId"],Gy=["callback","deviceId"],By=["callback","deviceId"],zy=["callback","deviceId"],qy={[ur.Code]:vt.loginWithOtc,[ur.EmailAndPassword]:vt.loginWithPassword,[ur.MagicLink]:vt.magicLinkPreLoginSuccess,[ur.SmsCode]:vt.loginWithSmsOtc};function*Hy(){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*Jy(){let e;try{var t;const n=yield Hi(od.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*Yy(){try{const{isActive:e}=yield Hi(od.auth.getSSOPublicConfiguration);yield Bi(Hn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Qy=e=>e.mfaRequired&&e.mfaToken?(qo.setAccessToken(null),qo.setUser(null),!0):(qo.setAccessToken(e.accessToken),qo.setUser(e),!1),Xy=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},Zy=e=>{if(1===e.length){const[t]=e;if(t===Mu.AuthenticatorApp)return Qt.authenticatorApp;if(t===Mu.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*ef(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield Qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Hi(od.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Xy(e.mfaDevices)}:(n={step:Zy(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*tf(){const{hostedLoginBox:e}=yield Qi((e=>e.auth));e?yield Hi(nf):yield Hi(of)}function*nf(){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(od.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*of(){try{const n=qo.onRedirectTo,{routes:i,loginState:o}=yield Qi((e=>e.auth)),{user:a,tenants:r}=yield Hi(od.auth.refreshTokenV2);if(Qy(a)){const e=yield ef(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 Hy())}}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}}function*af({payload:{callback:e}}){try{const{ip:t}=yield Hi(od.metadata.getCurrentUserIpMetadata);yield Bi(Hn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*rf({payload:e}){const t=[];e&&(yield Bi(Hn.setState({isLoading:!0})),yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Wd)),t.push(Hi(ly)),t.push(Hi(Yy)),t.push(Hi(Xd)),t.push(Hi(Jy))),t.push(Hi(tf)),yield zi(t),yield Bi(Hn.setState({isLoading:!1}))}function*lf({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(Qy(t)){const e=yield ef(t);yield Bi(Hn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*sf({payload:e}){const t=[];yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Wd)),t.push(Hi(Yy)),t.push(Hi(Xd)),t.push(Hi(Jy)),t.push(Hi(lf,e)),yield zi(t)}function*cf({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(od.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=ud(),r=ud(),l=yield Hi(cd,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*uf({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(od.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 Hy()}}function*df(e){let{payload:{callback:t}}=e,n=li(e.payload,Ey);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(od.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*yf(e){let{payload:{callback:t}}=e,n=li(e.payload,Cy);try{yield Bi(Hn.setLoginState({loading:!0})),yield Hi(od.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*ff(e){let{payload:{callback:t}}=e,n=li(e.payload,Dy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(od.auth.passwordlessPreLogin,I({},n,{type:ur.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*gf(e){let{payload:{callback:t}}=e,n=li(e.payload,Ry);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(od.auth.passwordlessPreLogin,n),a=qy[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*pf(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,_y);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(od.auth.passwordlessPostLogin,i),a=qo.onRedirectTo,{routes:r}=yield Qi((e=>e.auth));if(Qy(e)){const t=yield ef(e);yield Bi(Hn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Qi((e=>e.auth)),l=yield Hi(od.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:Fd.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 Hy():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*Sf({payload:e}){try{yield Bi(Hn.setLoginState({loading:!0}));const{name:t}=yield Hi(od.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*vf({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(od.auth.preLoginV2,{email:e});if(a){if(r===ld.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 hf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield hf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*hf(e){let{callback:t}=e,n=li(e,Uy);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)===ur.EmailAndPassword?(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[ur.MagicLink,ur.Code,ur.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*mf({payload:{callback:e}}){try{yield Bi(Hn.setLoginState({loading:!0}));const{options:t}=yield Hi(od.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*bf(e){let{payload:{callback:t}}=e,n=li(e.payload,My);try{yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Hi(od.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*Af(e){let{payload:{callback:t}}=e,n=li(e.payload,Ny);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const{options:e}=yield Hi(od.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*kf(e){let{payload:{callback:t}}=e,n=li(e.payload,$y);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Hi(od.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Qy(o)){const e=qo.onRedirectTo,{routes:t}=yield Qi((e=>e.auth)),n=yield ef(o);yield Bi(Hn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Hi(od.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 Hy(),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*Tf({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(od.auth.postLogin,e);qo.setAccessToken(t.accessToken),qo.setUser(t),yield Bi(Hn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Hy()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Bi(Hn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*Pf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Bi(Hn.setLoginState({loading:!0}));try{const a=yield Hi(od.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(Qy(a)){const e=yield ef(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 Hy())}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*If({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Hi(od.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 Hy()),null==i||i(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Lf({payload:e}){yield Bi(Hn.setLoginState({loading:!0}));try{yield Hi(od.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*Of({payload:e}){const{hostedLoginBox:t}=yield Qi((e=>e.auth));yield Bi(Hn.setState({isLoading:!0}));try{t?yield Hi(od.auth.OAuthLogout):yield Hi(od.auth.logout)}catch{}yield Bi(Hn.resetState()),yield Bi(Hn.requestAuthorize(!0)),null==e||e()}function*wf({payload:e}){var t;try{yield Hi(od.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*Ef({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*Cf({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 Hy()),yield Bi(Hn.setState({isAuthenticated:!0}))}function*Df(e){let{payload:{callback:t}}=e,n=li(e.payload,Fy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(od.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*Rf(e){let{payload:{callback:t}}=e,n=li(e.payload,xy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(od.auth.enrollMFASMSForLogin,n),i=yield Hi(od.auth.generateLoginResponseV2,e);yield Ef(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*_f(e){let{payload:{callback:t}}=e,n=li(e.payload,Vy);yield Bi(Hn.setLoginState({loading:!0}));try{var i;const e=yield Hi(od.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*Uf(e){let{payload:{callback:t}}=e,n=li(e.payload,jy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Hi(od.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Hi(od.auth.generateLoginResponseV2,i);yield Ef(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*Mf(e){let{payload:{callback:t}}=e,n=li(e.payload,Wy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(od.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Hi(od.auth.generateLoginResponseV2,e);yield Ef(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*Nf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,Ky);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(od.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*$f(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,Gy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(od.auth.verifyMFASMSForLogin,n,i),o=yield Hi(od.auth.generateLoginResponseV2,e);yield Cf(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*Ff(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,By);yield Bi(Hn.setLoginState({loading:!0}));try{var o;const e=yield Hi(od.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,zy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(i.publicKey),o=yield Hi(od.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Hi(od.auth.generateLoginResponseV2,o);yield Cf(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*Vf(){yield zo(Hn.requestAuthorize,rf),yield zo(Hn.requestAuthorizeSSR,sf),yield zo(Hn.requestHostedLoginAuthorize,cf),yield zo(Hn.handleHostedLoginCallback,uf),yield zo(Hn.preLogin,vf),yield zo(Hn.postLogin,Tf),yield zo(Hn.login,Pf),yield zo(Hn.logout,Of),yield zo(Hn.silentLogout,wf),yield zo(Hn.loginWithMfa,If),yield zo(Hn.recoverMfa,Lf),yield zo(Hn.quickSmsPasswordlessPreLogin,ff),yield zo(Hn.changePhoneNumberWithVerification,df),yield zo(Hn.verifyChangePhoneNumber,yf),yield zo(Hn.passwordlessPreLogin,gf),yield zo(Hn.passwordlessPostLogin,pf),yield zo(Hn.verifyInviteToken,Sf),yield zo(Hn.webAuthnPrelogin,Af),yield zo(Hn.webAuthnPostLogin,kf),yield zo(Hn.webAuthnCreateNewDeviceSession,mf),yield zo(Hn.webAuthnVerifyNewDeviceSession,bf),yield zo(Hn.afterAuthNavigation,Hy),yield zo(Hn.getUserIP,af),yield zo(Hn.preEnrollMFASMSForLogin,Df),yield zo(Hn.enrollMFASMSForLogin,Rf),yield zo(Hn.preEnrollMFAWebAuthnForLogin,_f),yield zo(Hn.enrollMFAWebAuthnForLogin,Uf),yield zo(Hn.enrollMFAAuthenticatorAppForLogin,Mf),yield zo(Hn.preVerifyMFASMSForLogin,Nf),yield zo(Hn.verifyMFASMSForLogin,$f),yield zo(Hn.preVerifyMFAWebAuthnForLogin,Ff),yield zo(Hn.verifyMFAWebAuthnForLogin,xf)}function*jf({payload:e}){e&&(yield Bi(Hn.setState({isLoading:!0})));const t=Sd;yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Wf({payload:{callback:e}}){try{const{ip:t}=$d[0];yield Bi(Hn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Kf(){yield zo(Hn.requestAuthorize,jf),yield zo(Hn.afterAuthNavigation,Hy),yield zo(Hn.getUserIP,Wf)}const Gf=["callback","samlVendor"],Bf=["callback","samlVendor"];function*zf(){try{var e,t;yield Bi(Hn.setSSOState({loading:!0}));const n=yield Hi(od.auth.getSamlConfiguration),i=yield Hi(od.auth.getOidcConfiguration),o=yield Hi(od.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*qf({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 dd(e[0]),o=yield Hi(od.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*Hf({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 dd(t),a=yield Hi(od.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*Jf({payload:e}){const{callback:t,samlVendor:n}=e,i=li(e,Gf),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===ld.Saml){var l,s;const e=yield Hi(od.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=sd(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(od.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*Yf({payload:{callback:e}={}}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration));try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(od.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*Qf(){try{const e=yield Hi(od.auth.getSamlRoles),t=yield Hi(od.auth.getSamlRolesGroups);yield Bi(Hn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}function*Xf({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(od.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield zi(e.map((e=>Hi(od.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}(n)),yield Qf(),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*Zf({payload:{callback:e,id:t}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(od.auth.deleteSamlGroup,{id:t}),yield Qf(),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*eg({payload:{group:e,roleIds:t,callback:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(od.auth.createSamlGroup,{group:e,roleIds:t}),yield Qf(),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*tg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Bi(Hn.setSSOState({loading:!0})),yield Hi(od.auth.oidcPostLoginV2,t),yield Hi(tf),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*ng(){yield Go(Hn.loadSSOConfigurations,zf),yield Go(Hn.saveSSOConfigurations,Jf),yield Go(Hn.saveSSOConfigurationsFile,qf),yield Go(Hn.saveSSOConfigurationsFileWithCallback,Hf),yield Go(Hn.validateSSODomain,Yf),yield Go(Hn.loadSSOAuthorizationRoles,Qf),yield Go(Hn.updateSSOAuthorizationRoles,Xf),yield Go(Hn.deleteSamlGroup,Zf),yield Go(Hn.createSamlGroup,eg),yield Go(Hn.oidcPostlogin,tg)}function*ig(){yield Bi(Hn.setSSOState({loading:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:Td,loading:!1,firstLoad:!1}))}function*og({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*ag({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=li(e,Bf),r=Ld.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==Pd||null==(t=Pd.configuration)?void 0:t.acsUrl,l.spEntityId=null==Pd||null==(n=Pd.configuration)?void 0:n.spEntityId;const c=sd(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*rg({payload:{callback:e}={}}){const t=Ld.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*lg(){yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*sg({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*cg(){yield Go(Hn.loadSSOConfigurations,ig),yield Go(Hn.saveSSOConfigurations,ag),yield Go(Hn.saveSSOConfigurationsFile,og),yield Go(Hn.validateSSODomain,rg),yield Go(Hn.loadSSOAuthorizationRoles,lg),yield Go(Hn.updateSSOAuthorizationRoles,sg)}const ug=["callback"],dg=["callback","ssoConfigId"],yg=["callback","ssoConfigId"];function*fg(){try{return yield Hi(od.auth.getOidcConfiguration)}catch(e){return null}}function*gg(){try{return yield Hi(od.metadata.getSamlMetadata)}catch(e){return null}}function*pg(){try{yield Bi(Hn.setSSOLoader({key:rd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield zi([Hi(fg),Hi(gg)]),n=yield Hi(od.auth.getSSOConfigurations);yield Bi(Hn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Bi(Hn.setSSOError({key:rd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Bi(Hn.setSSOLoader({key:rd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Sg({payload:e}){yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=li(e,ug),i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Hi(od.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:rd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*vg({payload:e}){yield Bi(Hn.setSSOLoader({key:rd.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 dd(t),o=yield Hi(od.auth.createSSOConfigurationByMetadata,{metadata:e});yield Bi(Hn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Bi(Hn.setSSOError({key:rd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*hg({payload:e}){yield Bi(Hn.setSSOLoader({key:rd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=li(e,dg),o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(od.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:rd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield Bi(Hn.setSSOLoader({key:rd.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 dd(i),a=yield Hi(od.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:rd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bg({payload:e}){yield Bi(Hn.setSSOLoader({key:rd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(od.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:rd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){const{callback:t,ssoConfigId:n}=e,i=li(e,yg);yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(od.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:rd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_DOMAIN,value:!1}))}}function*kg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Bi(Hn.setSSOLoader({key:rd.DELETE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(od.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:rd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.DELETE_SSO_DOMAIN,value:!1}))}}function*Tg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Bi(Hn.setSSOLoader({key:rd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(od.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:rd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Bi(Hn.setSSOLoader({key:rd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(od.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:rd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Bi(Hn.setSSOLoader({key:rd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ig({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_GROUPS,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(t.map((e=>Hi(od.auth.deleteSSOGroup,n,e)))),yield zi(e.map((e=>Hi(od.auth.createSSOGroup,n,e))));const a=yield Hi(od.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:rd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_GROUPS,value:!1}))}}function*Lg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield zi(t.map((t=>Hi(od.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:rd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:rd.SAVE_SSO_GROUPS,value:!1}))}}function*Og(){yield Go(Hn.loadSSOConfigurationsV2,pg),yield Go(Hn.saveSSOConfigurationV2,Sg),yield Go(Hn.saveSSODomain,Ag),yield Go(Hn.deleteSSODomain,kg),yield Go(Hn.validateSSODomainV2,Tg),yield Go(Hn.updateSSOConfiguration,hg),yield Go(Hn.deleteSSOConfiguration,bg),yield Go(Hn.setSSOGroups,Ig),yield Go(Hn.updateSSOGroups,Lg),yield Go(Hn.setSSODefaultRoles,Pg),yield Go(Hn.saveSSOConfigurationByMetadata,vg),yield Go(Hn.updateSSOConfigurationByMetadata,mg)}const wg=["callback","profilePictureUrl"],Eg=["callback","profilePictureUrl"];function*Cg(){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,od.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*Dg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,wg);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(od.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(od.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*Rg({payload:e}){yield Bi(Hn.setProfileState({loading:!0}));try{var t;yield Hi(od.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*_g(){yield zo(Hn.loadProfile,Cg),yield Go(Hn.saveProfile,Dg),yield Go(Hn.changePassword,Rg)}function*Ug(){yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setUser(I({},Sd,pd))),yield Bi(Hn.setProfileState({loading:!1,profile:pd}))}function*Mg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,Eg);yield Bi(Hn.setProfileState({saving:!0,error:null}));const o=vd;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=Sd;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*Ng({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*$g(){yield zo(Hn.loadProfile,Ug),yield Go(Hn.saveProfile,Mg),yield Go(Hn.changePassword,Ng)}const Fg=["callback"],xg=["callback"],Vg=["callback"],jg=["deviceId","callback"],Wg=["deviceId","callback"],Kg=["callback"],Gg=["deviceId"],Bg=["deviceId"],zg=["callback"],qg=["deviceId"],Hg=["callback"];function*Jg(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*Yg(){yield Bi(Hn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Hi(od.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*Qg(e){let{payload:{callback:t}}=e,n=li(e.payload,Fg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Qi((e=>e.auth.user)),i=yield Hi(od.auth.verifyMfa,n),o=yield Hi(od.auth.getMFADevices),a=yield Jg(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*Xg(e){let{payload:{callback:t}}=e,n=li(e.payload,xg);yield Bi(Hn.setMfaState({loading:!0}));try{const e=yield Hi(od.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*Zg({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;yield Hi(od.auth.disableMfa,e);const n=yield Hi(od.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*ep({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t,n;const i=yield Hi(od.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*tp(e){let{payload:{callback:t}}=e,n=li(e.payload,Vg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Hi(od.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Hi(od.auth.getMFADevices),a=yield Jg(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*np(e){let{payload:{deviceId:t,callback:n}}=e;li(e.payload,jg),yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(od.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*ip(e){let{payload:{deviceId:t,callback:n}}=e,i=li(e.payload,Wg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Hi(od.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Hi(od.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*op({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;const n=yield Hi(od.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*ap(e){let{payload:{callback:t}}=e,n=li(e.payload,Kg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Hi(od.auth.enrollMFASMS,n),i=yield Hi(od.auth.getMFADevices),o=yield Jg(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*rp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,Gg);yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(od.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*lp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,Bg);yield Bi(Hn.setMfaState({saving:!0}));try{var i;yield Hi(od.auth.disableMFASMS,t,n);const e=yield Hi(od.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*sp(){yield Bi(Hn.setMfaState({loading:!0}));try{yield Qi((e=>e.auth.user));const e=yield Hi(od.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*cp(){yield Bi(Hn.setMfaState({loading:!0}));try{const e=(yield Hi(od.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*up(){yield Go(Hn.enrollMfa,Yg),yield Go(Hn.getMFADevices,sp),yield Go(Hn.getMFAStrategies,cp),yield Go(Hn.verifyMfa,Qg),yield Go(Hn.disableMfa,Zg),yield Go(Hn.verifyMfaAfterForce,Xg),yield Go(Hn.preDisableMfaSms,rp),yield Go(Hn.disableMfaSms,lp),yield Go(Hn.preEnrollMfaSms,op),yield Go(Hn.enrollMfaSms,ap),yield Go(Hn.preEnrollMfaWebAuthn,ep),yield Go(Hn.enrollMfaWebAuthn,tp),yield Go(Hn.preDisableMfaWebAuthn,np),yield Go(Hn.disableMfaWebAuthn,ip)}function*dp(){yield Bi(Hn.setMfaState({saving:!0})),yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*yp({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({},Sd,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*fp(e){let{payload:{callback:t}}=e,n=li(e.payload,zg);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({},Sd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*gp({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({},Sd))),null==(t=e.callback)||t.call(e,!0)}function*pp(e){let{}=e,t=li(e.payload,qg);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*Sp({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({},Sd))),null==(t=e.callback)||t.call(e,!0)}function*vp({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*hp(e){let{payload:{callback:t}}=e;li(e.payload,Hg);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({},Sd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*mp(){yield Go(Hn.enrollMfa,dp),yield Go(Hn.verifyMfa,yp),yield Go(Hn.disableMfa,gp),yield Go(Hn.verifyMfaAfterForce,fp),yield Go(Hn.preDisableMfaSms,pp),yield Go(Hn.disableMfaSms,Sp),yield Go(Hn.preEnrollMfaSms,vp),yield Go(Hn.enrollMfaSms,hp)}const bp=["callback"];function*Ap({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(od.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*kp(e){let{payload:{callback:t}}=e,n=li(e.payload,bp);yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(od.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*Tp({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{const t=yield Hi(od.auth.loadPasswordConfig,e);yield Bi(Hn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message}))}}function*Pp(){yield zo(Hn.forgotPassword,Ap),yield zo(Hn.resetPassword,kp),yield zo(Hn.loadPasswordConfig,Tp)}let Ip;!function(e){e.USERS="USERS",e.STATS="STATS",e.UPDATE_USER="UPDATE_USER",e.DELETE_USER="DELETE_USER",e.RESEND_ACTIVATE_LINK="RESEND_ACTIVATE_LINK",e.RESEND_INVITATION_LINK="RESEND_INVITATION_LINK",e.ROLES_AND_PERMISSIONS="ROLES_AND_PERMISSIONS",e.CREATE_TOKEN_LINK="CREATE_TOKEN_LINK",e.GET_TOKEN_LINK="GET_TOKEN_LINK",e.UPDATE_TOKEN_LINK="UPDATE_TOKEN_LINK",e.DELETE_TOKEN_LINK="DELETE_TOKEN_LINK",e.CONFIG_TOKEN_LINK="CONFIG_TOKEN_LINK"}(Ip||(Ip={}));const Lp=["callback","events"],Op=["callback"],wp=["callback"];function*Ep({payload:{userId:e,token:t}}){yield 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(od.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*Cp(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,Lp);yield Bi(Hn.setActivateState({loading:!0}));try{const e=qo.onRedirectTo,{routes:a}=yield Qi((e=>e.auth)),r=yield Hi(od.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Qy(r)){yield Bi(Hn.setActivateState({step:Et.success}));const t=yield ef(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(od.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:Fd.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 Hy(),yield Bi(Hn.resetActivateState())}null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Dp({payload:e}){const{callback:t}=e,n=li(e,Op);yield Bi(Hn.setActivateStrategyState({loading:!0}));try{const e=yield Hi(od.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*Rp({payload:e}){const{callback:t}=e,n=li(e,wp);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.email})),yield Bi(Hn.setActivateState({loading:!0}));try{yield Hi(od.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:Ip.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*_p(){yield zo(Hn.activateAccount,Cp),yield zo(Hn.preActivateAccount,Ep),yield zo(Hn.getActivateAccountStrategy,Dp),yield zo(Hn.resendActivationEmail,Rp)}function*Up({payload:e}){if(e.token&&e.userId)try{yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Hi(od.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*Mp(){yield zo(Hn.acceptInvitation,Up)}var Np,$p=new Uint8Array(16);function Fp(){if(!Np&&!(Np="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 Np($p)}for(var xp=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vp=function(e){return"string"==typeof e&&xp.test(e)},jp=[],Wp=0;Wp<256;++Wp)jp.push((Wp+256).toString(16).substr(1));var Kp=function(e,t,n){var i=(e=e||{}).random||(e.rng||Fp)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(jp[e[t+0]]+jp[e[t+1]]+jp[e[t+2]]+jp[e[t+3]]+"-"+jp[e[t+4]]+jp[e[t+5]]+"-"+jp[e[t+6]]+jp[e[t+7]]+"-"+jp[e[t+8]]+jp[e[t+9]]+"-"+jp[e[t+10]]+jp[e[t+11]]+jp[e[t+12]]+jp[e[t+13]]+jp[e[t+14]]+jp[e[t+15]]).toLowerCase();if(!Vp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Gp=["callback"],Bp=["roles"],zp=["callback"],qp=["callback","profileImage"],Hp=["callback"],Jp=["callback","userId"],Yp=["callback"],Qp=["callback"],Xp=["callback"],Zp=["callback"],eS=["callback"],tS=["callback"],nS=["callback"],iS=["callback","profileImage"],oS=["callback"],aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback"],cS=["callback"],uS=()=>Qi((e=>e.auth.teamState));function*dS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield uS(),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:Ip.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(od.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Hi(od.teams.loadAvailableRoles),Hi(od.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:Ip.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Bi(Hn.setTeamLoader({key:Ip.USERS,value:!1}))}function*yS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield uS(),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:Ip.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(od.subTenants.loadAllUsers,I({},c)),Hi(od.teams.loadAvailableRoles),Hi(od.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:Ip.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Bi(Hn.setTeamLoader({key:Ip.USERS,value:!1}))}function*fS({payload:e}){yield Bi(Hn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield zi([Hi(od.teams.loadAvailableRoles),Hi(od.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:Ip.ROLES_AND_PERMISSIONS,value:t.message}))}yield Bi(Hn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0}))}function*gS({payload:e}){const{callback:t}=e,n=li(e,Gp),i=yield uS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Hi(od.teams.addUser,n),{roles:o}=e,a=I({},li(e,Bp),{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*pS({payload:e}){const{callback:t}=e,n=yield uS();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(od.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*SS({payload:e}){const{callback:t}=e,n=li(e,zp),i=yield uS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Hi(od.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Hi(od.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*vS({payload:e}){const{callback:t}=e,n=li(e,qp),{id:i}=n,o=yield uS(),a=o.users.find((e=>e.id===n.id));yield Bi(Hn.setTeamLoader({key:Ip.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(od.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:Ip.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:Ip.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*hS({payload:e}){const{callback:t}=e,n=li(e,Hp),i=yield uS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(od.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*mS({payload:e}){const{callback:t,userId:n}=e,i=li(e,Jp),o=yield uS();yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Hi(od.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*bS({payload:e}){const{callback:t}=e,n=li(e,Yp),i=yield uS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(od.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*AS({payload:e}){const{callback:t}=e,n=li(e,Qp);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Hi(od.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Ip.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*kS({payload:e}){const{callback:t}=e,n=li(e,Xp);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(od.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*TS({payload:e}){const{callback:t}=e,n=li(e,Zp);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(od.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*PS({payload:e}){const{callback:t}=e,n=li(e,eS);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(od.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Ip.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*IS(){yield Bi(Hn.setTeamError({key:Ip.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Hi(od.teams.getInviteLinkConfiguration);yield Bi(Hn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield Bi(Hn.setTeamError({key:Ip.CONFIG_TOKEN_LINK,value:e.message}))}}function*LS(){yield Bi(Hn.setTeamError({key:Ip.GET_TOKEN_LINK,value:!1}));try{yield Hi(IS);const e=yield Hi(od.teams.getInviteUserLink),{inviteTokenState:t}=yield uS();yield Bi(Hn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield Bi(Hn.setTeamError({key:Ip.GET_TOKEN_LINK,value:e.message}))}}function*OS({payload:{callback:e}}){yield Bi(Hn.setTeamError({key:Ip.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield uS();try{const n=yield Hi(od.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:Ip.CREATE_TOKEN_LINK,value:t.message}))}}function*wS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield uS();yield Bi(Hn.setTeamError({key:Ip.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Hi(od.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:Ip.UPDATE_TOKEN_LINK,value:t.message}))}}function*ES({payload:e}){const{callback:t}=null!=e?e:{};yield Bi(Hn.setTeamError({key:Ip.DELETE_TOKEN_LINK,value:!1}));try{yield Hi(od.teams.deleteInviteUserLink),yield Bi(Hn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Ip.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*CS({payload:e}){yield Bi(Hn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*DS({payload:e}){const t=yield uS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*RS({payload:e}){yield Bi(Hn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*_S({payload:e}){const t=yield uS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*US(){yield Bo(Hn.loadUsers,dS),yield Bo(Hn.loadAllSubTenantsUsers,yS),yield Bo(Hn.loadRoles,fS),yield Go(Hn.addUser,gS),yield Go(Hn.addUsersBulk,pS),yield Go(Hn.addUserToSubTenants,SS),yield Go(Hn.updateUser,vS),yield Go(Hn.setUserRolesForSubTenants,mS),yield Go(Hn.deleteUser,hS),yield Go(Hn.deleteUserFromSubTenants,bS),yield Go(Hn.resendActivationLink,AS),yield Go(Hn.resendInvitationLink,kS),yield Go(Hn.resendInvitationEmail,TS),yield Go(Hn.resendInvitationLinkToAllSubTenants,PS),yield Go(Hn.getInvitationLink,LS),yield Go(Hn.createInvitationLink,OS),yield Go(Hn.updateInvitationLink,wS),yield Go(Hn.deleteInvitationLink,ES),yield Go(Hn.openAddUserDialog,CS),yield Go(Hn.closeAddUserDialog,DS),yield Go(Hn.openDeleteUserDialog,RS),yield Go(Hn.closeDeleteUserDialog,_S)}function*MS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield uS(),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:Ip.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield Bi(Hn.setTeamState({users:Dd,totalPages:2,totalItems:10,roles:Id,permissions:Od})),yield Bi(Hn.setTeamLoader({key:Ip.USERS,value:!1})),null==r||r(Dd)}function*NS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield uS(),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:Ip.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:Rd,totalPages:2,totalItems:10,roles:Id,permissions:Od})),yield Bi(Hn.setTeamLoader({key:Ip.USERS,value:!1})),null==l||l(Rd)}function*$S({payload:e}){var t;yield Bi(Hn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield Bi(Hn.setTeamState({roles:Id,permissions:Od})),yield Bi(Hn.setTeamLoader({key:Ip.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Id,permissions:Od})}function*FS({payload:e}){const{callback:t}=e,n=li(e,tS),i=yield uS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Ed,n,{id:`${Kp()}`});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,nS),i=yield uS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Ed,n,{id:`${Kp()}`});yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*VS({payload:e}){var t;const{callback:n}=e,i=li(e,iS),{id:o}=i,a=yield uS(),r=a.users.find((e=>e.id===i.id));yield Bi(Hn.setTeamLoader({key:Ip.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:Ip.UPDATE_USER,value:!1}))}function*jS({payload:e}){const{callback:t}=e,n=li(e,oS),i=yield uS();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*WS({payload:e}){const{callback:t}=e,n=li(e,aS),i=yield uS();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*KS({payload:e}){const{callback:t}=e,n=li(e,rS);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Ip.RESEND_ACTIVATE_LINK,value:!1}))}function*GS({payload:e}){const{callback:t}=e,n=li(e,lS);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*BS({payload:e}){const{callback:t}=e,n=li(e,sS);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*zS({payload:e}){const{callback:t}=e,n=li(e,cS);yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Ip.RESEND_INVITATION_LINK,value:!1}))}function*qS(){yield Bo(Hn.loadUsers,MS),yield Bo(Hn.loadAllSubTenantsUsers,NS),yield Bo(Hn.loadRoles,$S),yield Go(Hn.addUser,FS),yield Go(Hn.addUserToSubTenants,xS),yield Go(Hn.updateUser,VS),yield Go(Hn.deleteUser,jS),yield Go(Hn.deleteUserFromSubTenants,WS),yield Go(Hn.resendActivationLink,KS),yield Go(Hn.resendInvitationLink,GS),yield Go(Hn.resendInvitationEmail,BS),yield Go(Hn.resendInvitationLinkToAllSubTenants,zS),yield Go(Hn.openAddUserDialog,CS),yield Go(Hn.closeAddUserDialog,DS),yield Go(Hn.openDeleteUserDialog,RS),yield Go(Hn.closeDeleteUserDialog,_S)}const HS=["authorizationUrl"],JS=["events","url"];function*YS(){try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const e=yield Hi(od.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*QS(){try{const e=yield Qi((e=>e.root.context));yield Bi(Hn.setSocialLoginsState({loading:!0}));const t=(yield Hi(od.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=li(t,HS);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*XS(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,JS);try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Hi(od.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:xd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Fd.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 tf(),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*ZS({payload:e}){yield Bi(Hn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*ev(){yield zo(Hn.loadSocialLoginsConfiguration,YS),yield zo(Hn.loadSocialLoginsConfigurationV2,QS),yield zo(Hn.loginViaSocialLogin,XS),yield Bo(Hn.setSocialLoginError,ZS)}let tv;function*nv({payload:e}){yield Bi(Hn.setApiTokensState({apiTokenType:e}));try{if(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Hi(od.auth.getUserApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Hi(od.auth.getTenantApiTokensData),{items:t}=yield Hi(od.teams.loadAvailableRoles),{items:n}=yield Hi(od.teams.loadAvailablePermissions);yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:tv.LOAD_API_TOKENS,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1}))}}function*iv({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!0}));const e=yield Hi(od.auth.updateUserApiTokensData,{description:t});yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield Bi(Hn.setApiTokensError({key:tv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*ov({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!0}));const e=yield Hi(od.auth.updateTenantApiTokensData,{description:t,roleIds:n});yield Bi(Hn.setApiTokensState({showAddTokenDialog:!1})),yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:e.clientId}})),yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Bi(Hn.setApiTokensError({key:tv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*av({payload:e}){const{apiTokensDataUser:t}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!0})),yield Hi(od.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:tv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:tv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!1}))}}function*rv({payload:e}){const{apiTokensDataTenant:t}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!0})),yield Hi(od.auth.deleteTenantApiToken,{tokenId:e}),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:tv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!1}))}}function*lv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield zi([Hi(od.auth.getUserApiTokensData),Hi(od.auth.getTenantApiTokensData)]);yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:tv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Hi(od.auth.getUserApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:tv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Hi(od.auth.getTenantApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:tv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*uv(){yield zo(Hn.loadApiTokens,lv),yield zo(Hn.loadUserApiTokens,sv),yield zo(Hn.loadTenantApiTokens,cv),yield zo(Hn.initApiTokensData,nv),yield Go(Hn.addUserApiToken,iv),yield Go(Hn.addTenantApiToken,ov),yield Bo(Hn.deleteTenantApiToken,rv),yield Bo(Hn.deleteUserApiToken,av)}function*dv({payload:e}){if(yield Bi(Hn.setApiTokensState({apiTokenType:e})),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})),"user"===e){yield Xi(200);const e=[yd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=(t=[fd])?t:[],roles:null!=Id?Id:[],permissions:null!=Od?Od:[]}))}yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1}))}function*yv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Bi(Hn.setApiTokensLoader({key:tv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState)),a=I({},fd,{description:t,roleIds:n,clientId:`CLIENT_ID_${Kp()}`});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:tv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*fv({payload:e}){yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!0})),yield Xi(200);const t=[fd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Bi(Hn.setApiTokensLoader({key:tv.DELETE_API_TOKEN,value:!1}))}function*gv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));const n=[yd],i=[fd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*pv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));const n=[yd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Sv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!0})));const n=[fd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:tv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*vv(){yield zo(Hn.loadApiTokens,gv),yield zo(Hn.loadUserApiTokens,pv),yield zo(Hn.loadTenantApiTokens,Sv),yield zo(Hn.initApiTokensData,dv),yield Go(Hn.addTenantApiToken,yv),yield Bo(Hn.deleteTenantApiToken,fv)}function*hv({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(od.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*mv({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Hi(od.accountSettings.getSettings);yield Bi(Hn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield Bi(Hn.setAccountSettingsState({loading:!1,error:e.message}))}}function*bv(){yield zo(Hn.saveAccountSettings,hv),yield zo(Hn.loadAccountSettings,mv)}function*Av({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*kv({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*Tv(){yield zo(Hn.saveAccountSettings,Av),yield zo(Hn.loadAccountSettings,kv)}function*Pv({payload:{tenantId:e,callback:t}}){yield Bi(Hn.setState({isLoading:!0}));try{yield Hi(od.tenants.switchTenant,{tenantId:e}),yield Hi(tf),(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*Iv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(od.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*Lv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(od.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*Ov({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(od.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*wv(){yield Go(Hn.loadTenants,Iv),yield Go(Hn.loadSubTenants,Lv),yield Go(Hn.switchTenant,Pv),yield Go(Hn.loadSubTenantsTree,Ov)}function*Ev(){yield Bi(Hn.setTenantsState({loading:!0})),yield yt(),yield Bi(Hn.setTenantsState({tenants:_d,loading:!1}))}function*Cv(){yield Go(Hn.loadTenants,Ev)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(tv||(tv={}));const Dv=["callback"],Rv=["callback"],_v=["callback"],Uv=["callback"],Mv=["callback"];function*Nv({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(od.roles.getRoles),Hi(od.roles.getPermissions),Hi(od.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*$v(e){let{payload:{callback:t}}=e,n=li(e.payload,Dv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(od.roles.addRole,n),i=yield Hi(od.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*Fv(e){let{payload:{callback:t}}=e,n=li(e.payload,Rv);yield Bi(Hn.setRolesState({saving:!0}));try{yield Hi(od.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*xv(e){let{payload:{callback:t}}=e,n=li(e.payload,_v);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(od.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*Vv(e){let{payload:{callback:t}}=e,n=li(e.payload,Uv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(od.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*jv(e){let{payload:{callback:t}}=e,n=li(e.payload,Mv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(od.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*Wv(){yield zo(Hn.loadRolesAndPermissions,Nv),yield Go(Hn.addRole,$v),yield Go(Hn.deleteRole,Fv),yield Go(Hn.updateRole,xv),yield Go(Hn.attachPermissionsToRole,Vv),yield Go(Hn.attachPermissionToRoles,jv)}function*Kv({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:gd,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*Gv(){yield zo(Hn.loadRolesAndPermissions,Kv)}const Bv=["callback"],zv=["callback"],qv=["callback"];function*Hv(e){let{payload:{callback:t}}=e,n=li(e.payload,Bv);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(od.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*Jv(e){let{payload:{callback:t}}=e,n=li(e.payload,zv);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(od.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*Yv(e){let{payload:{callback:t}}=e,n=li(e.payload,qv);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(od.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Bi(Hn.setLoginState({step:vt.loginWithSmsOtc})),yield Bi(Hn.passwordlessPreLogin({type:ur.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*Qv(){yield zo(Hn.resetPhoneNumber,Hv),yield zo(Hn.verifyResetPhoneNumber,Jv),yield zo(Hn.changePhoneNumber,Yv)}function*Xv(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getCurrentUserSessions);yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*Zv(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getCurrentUserSession);yield Bi(Hn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*eh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(od.auth.deleteSessionForUser,e),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*th({payload:{callback:e,userId:t}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(od.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Bi(Hn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*nh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(od.auth.deleteAllSessionsForUser),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*ih(){yield Bo(Hn.loadUserSessions,Xv),yield Bo(Hn.deleteUserSession,eh),yield Bo(Hn.deleteAllUserSessions,nh),yield Bo(Hn.loadCurrentUserSession,Zv),yield Go(Hn.revokeUserSessions,th)}function*oh(){yield Bi(Hn.setSessionsState({loading:!0,error:null})),yield Bi(Hn.setSessionsState({sessions:Ud,loading:!1}))}function*ah({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*rh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const e=Ud.filter((e=>e.current));yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}function*lh(){yield Bo(Hn.loadUserSessions,oh),yield Bo(Hn.deleteUserSession,ah),yield Bo(Hn.deleteAllUserSessions,rh)}const sh=["callback"],ch=["callback"];function*uh(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getSessionConfigurations);yield Bi(Hn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*dh({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=li(e,sh);yield Hi(od.auth.createOrUpdateSessionConfigrations,n),yield Bi(Hn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Bi(Hn.setSessionsPolicyState({error:e,loading:!1}))}}function*yh(){yield zo(Hn.loadSessionsPolicy,uh),yield Bo(Hn.createOrUpdateSessionsPolicy,dh)}function*fh(){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:Md}));yield Bi(Hn.setSessionsPolicyState(I({},e,{loading:!1})))}function*gh({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=li(e,ch);null==t||t(!0),yield Bi(Hn.setSessionsPolicyState({configurations:n,loading:!1}))}function*ph(){yield zo(Hn.loadSessionsPolicy,fh),yield Bo(Hn.createOrUpdateSessionsPolicy,gh)}const Sh=["callback"],vh=["callback"],hh=["callback"],mh=["callback"],bh=["callback"],Ah=["callback"],kh=["callback"],Th=["callback"],Ph=()=>Qi((e=>e.auth.restrictionsState.ipRestrictions)),Ih=()=>Qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Lh(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Hi(od.auth.getDomainRestrictionsConfig),t=(yield Hi(od.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*Oh(e){let{payload:{callback:t}}=e,n=li(e.payload,Sh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Ih();try{var o;yield Hi(od.auth.createDomainRestriction,n);const e=(yield Hi(od.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*wh(e){let{payload:{callback:t}}=e,n=li(e.payload,vh);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Hi(od.auth.updateDomainRestrictionConfig,n),i=(yield Hi(od.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*Eh({payload:{id:e}}){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Ih();try{var n;yield Hi(od.auth.deleteDomainRestriction,e);const i=(yield Hi(od.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 Ch=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*Dh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Ph(),t=yield Hi(od.auth.getIPRestrictionsConfig),n=Ch({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Hi(od.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*Rh(){try{const{valid:e}=yield Hi(od.auth.testCurrentIpInAllowList);yield Bi(Hn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message}))}}function*_h({payload:{callback:e}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Qi((e=>e.auth.userIp));yield zi([Hi(od.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Hi(od.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Ph(),i=Ch(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Hi(od.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*Uh(e){let{payload:{callback:t}}=e,n=li(e.payload,hh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Ph();try{var o,a;yield Hi(od.auth.createIPRestriction,n);const e=yield Ph(),r=Ch(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Hi(od.auth.getIPRestrictions,r);yield Rh(),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*Mh(e){let{payload:{callback:t}}=e,n=li(e.payload,mh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{yield Hi(od.auth.updateIPRestrictionConfig,n);const e=yield Ph(),i=yield Hi(od.auth.getIPRestrictionsConfig),o=Ch(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Hi(od.auth.getIPRestrictions,o);yield Rh(),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*Nh({payload:{id:e,callback:t}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Ph();try{var i;yield Hi(od.auth.deleteIPRestriction,e);const o=yield Ph(),a=Ch(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Hi(od.auth.getIPRestrictions,a);yield Rh(),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*$h(){yield zo(Hn.loadIpRestrictions,Dh),yield zo(Hn.loadEmailDomainRestrictions,Lh),yield Go(Hn.saveIpRestriction,Uh),yield Go(Hn.saveIpRestrictionsConfig,Mh),yield Go(Hn.deleteIpRestriction,Nh),yield Go(Hn.checkIfUserIpValid,Rh),yield Go(Hn.addCurrentUserIpAndActivate,_h),yield Go(Hn.saveEmailDomainRestriction,Oh),yield Go(Hn.saveEmailDomainRestrictionsConfig,wh),yield Go(Hn.deleteEmailDomainRestriction,Eh)}function*Fh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{restrictions:$d.filter((e=>e.strategy===Nd.strategy)),config:Nd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*xh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Ph(),t=$d[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*Vh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,bh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const r=yield Ph(),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:Kp(),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*jh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Ah);const r=yield Ph();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*Wh({payload:{id:e,callback:t}}){var n;yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Ph();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*Kh(){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*Gh(e){var t,n;let{payload:{callback:i}}=e,o=li(e.payload,kh);const a=yield Ih();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*Bh(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,Th);const o=yield Ih();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*zh({payload:{id:e}}){var t,n;const i=yield Ih();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*qh(){yield zo(Hn.loadIpRestrictions,Fh),yield zo(Hn.loadEmailDomainRestrictions,Kh),yield Go(Hn.saveIpRestriction,Vh),yield Go(Hn.saveIpRestrictionsConfig,jh),yield Go(Hn.deleteIpRestriction,Wh),yield Go(Hn.checkIfUserIpValid,xh),yield Go(Hn.saveEmailDomainRestriction,Gh),yield Go(Hn.saveEmailDomainRestrictionsConfig,Bh),yield Go(Hn.deleteEmailDomainRestriction,zh)}const Hh=["callback"],Jh=["id"];function*Yh(e){const{count:t}=yield Hi(od.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*Qh(){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(od.directory.getConfigs),t=yield zi(e.map((e=>Yh(e))));yield Bi(Hn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*Xh(e){let{payload:{callback:t}}=e,n=li(e.payload,Hh);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(od.directory.createConfiguration,n),i=yield Hi(od.directory.getConfigs),o=yield zi(i.map((e=>Yh(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*Zh(e){let{payload:{id:t}}=e,n=li(e.payload,Jh);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(od.directory.updateConfiguration,t,n);const e=yield Hi(od.directory.getConfigs),i=yield zi(e.map((e=>Yh(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*em({payload:{id:e,callback:t}}){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(od.directory.deleteConfiguration,e);const n=yield Hi(od.directory.getConfigs),i=yield zi(n.map((e=>Yh(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*tm(){yield zo(Hn.loadProvisionConnections,Qh),yield Go(Hn.createProvisionConnection,Xh),yield Go(Hn.deleteProvisionConnection,em),yield Go(Hn.updateProvisionConnection,Zh)}const nm=["callback","events"];function*im(e){let{payload:{callback:t}}=e,n=li(e.payload,nm);yield Bi(Hn.setImpersonateState({loading:!0}));try{yield Hi(od.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*om(){yield zo(Hn.impersonate,im)}var am={sagas:function*(){yield zi([Hi(Vf),Hi(_p),Hi(Mp),Hi(Pp),Hi(Qv),Hi(ng),Hi(Og),Hi(_g),Hi(up),Hi(US),Hi(ev),Hi(Bd),Hi(uv),Hi(vy),Hi(bv),Hi(wv),Hi(Wv),Hi(ih),Hi(yh),Hi($h),Hi(tm),Hi(om)])},mockSagas:function*(){yield zi([Hi(Kf),Hi(cg),Hi($g),Hi(mp),Hi(qS),Hi(vv),Hi(wy),Hi(lh),Hi(Tv),Hi(Cv),Hi(ph),Hi(qh),Hi(Gv)])},storeName:kt,initialState:jn,reducer:zn,actions:Hn};const rm=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),lm={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},sm={setAuditLogsState:rm("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:lm})},cm={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},um={loading:!0},dm={setAuditsMetadataState:rm("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:um})},ym={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},fm={auditLogsState:lm,auditsMetadataState:um},{reducer:gm,actions:pm}=at({name:Pt,initialState:fm,reducers:I({resetState:e=>I({},e,fm),setState:(e,{payload:t})=>I({},e,t)},sm,dm)}),Sm=I({},pm,cm,ym),vm=e=>"createdAt"!==e.id,hm={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`})))},mm={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}]},bm=()=>Qi((e=>e.auditLogs.auditLogsState)),Am=()=>Qi((e=>e.auditLogs.auditsMetadataState));function*km(){const e=yield bm(),{columns:t}=yield Am();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(Sm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield od.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(Sm.setAuditLogsState({isDownloadingCsv:!1}))}function*Tm({payload:e}){yield Bi(Sm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield bm(),{columns:n}=yield Am();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(Sm.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(Sm.loadAuditsMetadata()));const{data:g,total:p}=yield Hi(od.audits.getAudits,I({offset:c,count:s},y,f));yield Bi(Sm.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(Sm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Pm(){yield Go(Sm.exportAuditsCsv,km),yield Go(Sm.loadAuditLogs,Tm)}function*Im({payload:e}){yield Bi(Sm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield bm(),{columns:n}=yield Am();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(Sm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Bi(Sm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=hm;let i=n.filter((e=>t=>e.filter(vm).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(Sm.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(Sm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Lm(){yield Go(Sm.loadAuditLogs,Im)}function*Om(){yield Bi(Sm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Hi(od.metadata.getAuditsMetadata);yield Bi(Sm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(Sm.setAuditsMetadataState({error:e,loading:!1}))}}function*wm(){yield Go(Sm.loadAuditsMetadata,Om)}function*Em(){yield Bi(Sm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=mm;yield Bi(Sm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(Sm.setAuditsMetadataState({error:e,loading:!1}))}}function*Cm(){yield Go(Sm.loadAuditsMetadata,Em)}var Dm={sagas:function*(){yield zi([Hi(Pm),Hi(wm)])},mockSagas:function*(){yield zi([Hi(Lm),Hi(Cm)])},storeName:Pt,initialState:fm,reducer:gm,actions:Sm};const Rm={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:_m,actions:Um,reducer:Mm}=at({name:"audits",initialState:Rm,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]})))}}}),Nm=I({},Um,{initData:it(`${_m}/initData`),loadAudits:it(`${_m}/loadAudits`),removeFilter:it(`${_m}/removeFilter`),filterData:it(`${_m}/filterData`),exportCSV:it(`${_m}/exportCSV`),deleteAudits:it(`${_m}/deleteAudits`)}),$m=()=>Qi((e=>e[_m]));function*Fm(){const{sortBy:e,sortDirection:t}=yield $m();try{const n=yield Hi(od.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Bi(Nm.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Bi(Nm.loadItemFailedAction(t))}}function*xm(){try{const e=yield Hi(od.metadata.getAuditsMetadata);yield Bi(Nm.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Bi(Nm.loadItemFailedAction(t))}}const Vm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*jm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield $m(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield $m():{rowsData:[]};try{const e=Vm(t),{data:l,total:d}=yield Hi(od.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(Nm.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Bi(Nm.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Bi(Nm.loadItemFailedAction(t))}}function*Wm(){yield Bi(Nm.startLoading()),yield zi([Fm(),xm(),jm({payload:{onlyOneLoad:!1},type:""})]),yield Bi(Nm.finishLoading())}function*Km({payload:e}){const{filters:t}=yield $m(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Bi(Nm.setFilterData(i))}function*Gm({payload:e}){const{filters:t}=yield $m();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(Nm.setFilterData(i))}function*Bm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield $m(),a=Vm(e);yield Bi(Nm.startDownloadingCsv());try{yield od.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(Nm.stopDownloadingCsv())}}function*zm(){yield Bo(Nm.initData,Wm),yield Bo(Nm.removeFilter,Km),yield Bo(Nm.filterData,Gm),yield Bo([Nm.loadAudits,Nm.textSearch,Nm.onPageChange],jm),yield Bo([Nm.setFilterData,Nm.setDataSorting,Nm.startRefresh],(()=>jm({payload:{appendMode:!1},type:""}))),yield Bo(Nm.exportCSV,Bm)}const qm={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Hm={initData:()=>I({},qm),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)})}},Jm={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}})))},Ym={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Qm,actions:Xm}=at({name:Tt,initialState:Ym,reducers:I({},Hm)}),Zm=I({},Xm,Jm),eb={slack:od.connectivity.getSlackConfiguration,email:od.connectivity.getEmailConfiguration,sms:od.connectivity.getSMSConfiguration,webhook:od.connectivity.getWebhooksConfigurations,categories:od.connectivity.getCategories,channelMap:od.connectivity.getChannelMaps},tb={slack:od.connectivity.postSlackConfiguration,email:od.connectivity.postEmailConfiguration,sms:od.connectivity.postSMSConfiguration,webhook:od.connectivity.postWebhooksConfiguration},nb=["email","slack","sms","webhook"],ib={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"}},ob=["id"],ab=["id","enabled"],rb=["categories","channelMap"];function*lb(e){return yield Hi(cb,{payload:{api:e},type:""})}function*sb({payload:e=nb}){yield Bi(Zm.setConnectivityState({isLoading:!0}));try{const t=yield zi([...e.map(lb),yield cb({payload:{api:"categories"},type:""}),yield function*(){return(yield zi(e.map((function*(e){return yield cb({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield cb({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:ib[e[o]].events(i),active:ib[e[o]].isActive(i),platform:ib[e[o]].title,image:ib[e[o]].image}]}):n:I({},n,{[`${rb[o-e.length]}`]:i})),{list:[],webhook:n});yield Bi(Zm.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Bi(Zm.setConnectivityState({isLoading:!1}))}}function*cb({payload:{api:e,params:t}}){try{return yield Hi(eb[e],t)}catch(e){return}}function*ub(){try{yield Bi(Zm.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Hi(od.connectivity.getSlackChannels);yield Bi(Zm.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Bi(Zm.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*db(e,t){const{connectivity:{list:n}}=yield Qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=ib[e].isActive(t);o!==i.active&&(yield Bi(Zm.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*yb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Qi((e=>e.connectivity));try{if(yield Bi(Zm.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,ob);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(tb.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Hi(od.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?od.connectivity.postEmailConfiguration:od.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,ab);return yield zi([yield Hi("email"===t?od.connectivity.patchEmailConfiguration:od.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Hi("email"===t?od.connectivity.putEmailSubscriptions:od.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?od.connectivity.deleteEmailSubscriptions:od.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield cb({payload:{api:t},type:""});yield Bi(Zm.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield db(t,e)}else yield Bi(Zm.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Hi(tb[e],t),!["sms","email"].includes(e)){const o=yield cb({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Bi(Zm.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield db(e,o),null==n||n(!0)}}catch(e){var o;yield Bi(Zm.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*fb({payload:e}){try{yield od.connectivity.postSlackCode(e)}catch{}yield Bi(Zm.setConnectivityState({error:void 0,isSaving:!1}))}function*gb(){const{slackChannels:e}=yield Qi((e=>e.connectivity));try{yield Bi(Zm.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Hi(od.connectivity.getSlackScope);yield Bi(Zm.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Bi(Zm.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*pb({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Qi((e=>e.connectivity));try{yield Bi(Zm.setConnectivityState({isSaving:!0})),yield Hi(od.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield cb({payload:{api:"webhook"},type:""});o&&(yield Bi(Zm.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Sb({payload:e}){try{yield Bi(Zm.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Hi(od.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Bi(Zm.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Bi(Zm.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Bi(Zm.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*vb({payload:e}){try{const{statusCode:t}=yield Hi(od.connectivity.postWebhookRetry,e);yield Bi(Zm.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Bi(Zm.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*hb({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Qi((e=>e.connectivity));try{yield Bi(Zm.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Hi(od.connectivity.getWebhookLog,e,n,t);yield Bi(Zm.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield Bi(Zm.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var mb={sagas:function*(){yield Go(Zm.loadDataAction,sb),yield Bo(Zm.loadSlackActions,ub),yield Go(Zm.postDataAction,yb),yield Go(Zm.postCodeAction,fb),yield Go(Zm.loadScope,gb),yield Go(Zm.deleteWebhookConfigAction,pb),yield Go(Zm.postWebhookTestAction,Sb),yield Go(Zm.postWebhookRetryAction,vb),yield Bo(Zm.loadWebhookLogsAction,hb)},storeName:Tt,initialState:Ym,reducer:Qm,actions:Zm};function bb(){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 Ab(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function kb(e){return Ab(e,((e,t)=>I({},e,{loading:t.payload})))}function Tb(e){return Ab(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const Pb={loading:!1,error:null,fetching:!0,plans:[]},{actions:Ib,reducer:Lb,name:Ob}=at({name:"subscriptions/plans",initialState:Pb,reducers:I({},bb())}),wb=I({loadPlans:it(`${Ob}/loadPlans`)},Ib),Eb={loading:!1,error:null,fetching:!0,config:null},Cb=I({},bb()),{actions:Db,reducer:Rb,name:_b}=at({name:"subscriptions/config",initialState:Eb,reducers:Cb}),Ub=I({loadPaymentConfiguration:it(`${_b}/loadPaymentConfiguration`)},Db),Mb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Nb=I({},bb(),{setCancellationLoading:kb("cancellation"),setCancellationError:Tb("cancellation"),setRenewalLoading:kb("renewal"),setRenewalError:Tb("renewal")}),{reducer:$b,actions:Fb,name:xb}=at({name:"subscriptions/billing/subscription",initialState:Mb,reducers:Nb}),Vb=I({load:it(`${xb}/loadSubscription`),cancelSubscription:it(`${xb}/cancelSubscription`),renewSubscription:it(`${xb}/renewSubscription`)},Fb),jb={loading:!1,error:null,fetching:!0},Wb=I({},bb()),{reducer:Kb,actions:Gb,name:Bb}=at({name:"subscriptions/billing/information",initialState:jb,reducers:Wb}),zb=I({loadBillingInformation:it(`${Bb}/loadBillingInformation`),cancelSubscription:Vb.cancelSubscription,renewSubscription:Vb.renewSubscription},Gb),qb={loading:!1,error:null,fetching:!0},Hb=I({},bb(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:Jb,actions:Yb,name:Qb}=at({name:"subscriptions/billing/payment",initialState:qb,reducers:Hb}),Xb=I({loadPaymentMethod:it(`${Qb}/loadPaymentMethod`),submitPaymentMethod:it(`${Qb}/submitPaymentMethod`),submitPaymentMethodError:it(`${Qb}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${Qb}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${Qb}/updateBillingDetails`,(e=>({payload:e})))},Yb),Zb={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},eA=I({},bb(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:tA,actions:nA,name:iA}=at({name:"subscriptions/billing/invoices",initialState:Zb,reducers:eA}),oA=I({loadInvoices:it(`${iA}/loadInvoices`),downloadInvoice:it(`${iA}/downloadInvoice`,(e=>({payload:e})))},nA),aA={information:jb,invoices:Zb,paymentMethod:qb,subscription:Mb},rA={invoices:oA,information:zb,paymentMethod:Xb,subscription:Vb},lA=$e({invoices:tA,information:Kb,paymentMethod:Jb,subscription:$b}),sA={fetching:!0,loading:!1,error:null,confirmed:!1},cA=I({},bb()),{actions:uA,reducer:dA,name:yA}=at({name:"subscriptions/checkout",initialState:sA,reducers:cA}),fA=I({loadCheckout:it(`${yA}/loadCheckout`),resetCheckout:it(`${yA}/resetCheckout`),submitCheckout:it(`${yA}/submitCheckout`),confirmCheckout:it(`${yA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${yA}/errorCheckout`,(e=>({payload:e})))},uA),gA={loading:!1,error:null,cardSetupIntentSecret:null},pA=I({},bb()),{reducer:SA,actions:vA,name:hA}=at({name:"subscriptions/stripe",initialState:gA,reducers:pA}),mA=I({loadCustomer:it(`${hA}/loadCustomer`),createCardSetupIntentSecret:it(`${hA}/createCardSetupIntentSecret`)},vA),bA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:AA,reducer:kA,name:TA}=at({name:"subscriptions/vendorPublicConfig",initialState:bA,reducers:I({},bb())}),PA=I({loadVendorPublicConfiguration:it(`${TA}/loadVendorPublicConfiguration`)},AA),IA={config:Eb,plans:Pb,checkout:sA,billing:aA,stripe:gA,vendorPublicConfig:bA},LA={config:Ub,billing:rA,plans:wb,checkout:fA,stripe:mA,vendorPublicConfig:PA},OA=$e({config:Rb,billing:lA,plans:Lb,checkout:dA,stripe:SA,vendorPublicConfig:kA});let wA,EA,CA;function DA({policy:e}){return{policy:CA.AT_PERIOD_END}}function RA(e){switch(e){case Ou.ACTIVE:return EA.ACTIVE;case Ou.INCOMPLETE:return EA.INCOMPLETE;case Ou.CANCELED:return EA.CANCELED;case Ou.EXPIRED:return EA.EXPIRED;case Ou.TRIALING:return EA.TRIALING;default:return EA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(wA||(wA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(EA||(EA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(CA||(CA={}));const _A={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Ou.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},UA=[{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"}],MA=[{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:""}],NA=[{id:"id",externalId:"externalId",type:wu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],$A={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*FA(){yield Go(Vb.load,xA),yield Go(Vb.cancelSubscription,jA),yield Go(Vb.renewSubscription,WA)}function*xA(){const e=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield qA(e)}function*VA(){yield Bi(Vb.setLoading(!0));try{const[e]=yield Hi(od.subscriptions.getManagedSubscriptions);yield Bi(Vb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Bi(Vb.setError(e))}}function*jA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Vb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Vb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Ou.ACTIVE)try{yield Bi(Vb.setCancellationLoading(!0)),yield Hi(od.subscriptions.cancelManagedSubscription,t),yield VA(),yield Bi(Vb.setCancellationLoading(!1))}catch(e){yield Bi(Vb.setCancellationError(e.message))}}function*WA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(Vb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(Vb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Eu.AT_PERIOD_END)try{yield Bi(Vb.setRenewalLoading(!0)),yield Hi(od.subscriptions.renewManagedSubscription,t),yield VA(),yield Bi(Vb.setRenewalLoading(!1))}catch(e){yield Bi(Vb.setCancellationError(e.message))}}function*KA(){yield Bi(Vb.setLoading(!0)),yield Xi(500),yield Bi(Vb.setState({subscription:_A,fetching:!1,loading:!1,error:null}))}function*GA(){yield Go(Vb.load,KA)}function*BA(){yield Go(zb.loadBillingInformation,zA)}function*zA(){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 qA(n,!1):yield Bi(zb.setError(t?"Not authorized":"Internal feature failure"))}()}function*qA(e,t){yield Bi(zb.setLoading(!0));try{var n,i;const o=yield Hi(od.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Hi(od.subscriptions.getSubscriptionPlan,a):([,l]=yield zi([Hi(VA),Hi(od.subscriptions.getSubscriptionPlan,a)]),s=yield Qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Bi(zb.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?EA.ACTIVE:RA(s.status),cancellation:s.cancellation&&DA(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(zb.setError(e.message))}}function*HA(){yield function*(){var e,t;yield Bi(zb.setLoading(!0)),yield Xi(500),yield Bi(zb.setState({loading:!1,fetching:!1,summary:{subscriptionId:_A.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Cu.Stripe,externallyManaged:!1,currentPlanId:UA[0].id,defaultPlanId:UA[0].id},plan:I({},UA[0],{price:null==(e=UA[0].price)?void 0:e.amount,currency:null==(t=UA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*JA(){yield Go(zb.loadBillingInformation,HA)}function*YA(){yield Go(Xb.loadPaymentMethod,QA),yield Go(Xb.submitPaymentMethod,ZA),yield Go(Xb.submitPaymentMethodError,ek),yield Go(Xb.submitPaymentMethodSuccess,tk),yield Go(Xb.updatePaymentMethodBillingDetails,XA)}function*QA(){yield Bi(Xb.setLoading(!0));try{const e=(yield Hi(od.subscriptions.getPaymentMethods))[0];yield Bi(Xb.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Bi(Xb.setError(e.message))}}function*XA({payload:e}){yield Bi(Xb.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Hi(od.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Hi(QA),null==o||o(!0)}catch(e){yield Bi(Xb.setError(e.message)),null==o||o(!1)}yield Bi(Xb.setLoading(!1))}function*ZA(){yield Bi(Xb.setLoading(!0))}function*ek({payload:e}){yield Bi(Xb.setError(e))}function*tk(){yield Bi(Xb.loadPaymentMethod())}function*nk(){yield Bi(Xb.setLoading(!0)),yield Xi(500);const e=NA[0];yield Bi(Xb.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*ik(){yield Go(Xb.loadPaymentMethod,nk)}function*ok(){yield Go(oA.loadInvoices,ak),yield Go(oA.downloadInvoice,rk)}function*ak(){yield Bi(oA.setLoading(!0));try{const e=(yield Hi(od.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(oA.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Bi(oA.setError(e.message))}}function*rk({payload:e}){yield Bi(oA.setInvoiceDownloadState({loading:!0,error:null}));try{yield Hi(od.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Bi(oA.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Bi(oA.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*lk(){yield Bi(oA.setLoading(!0)),yield Xi(500),yield Bi(oA.setState({loading:!1,fetching:!1,invoices:MA.map((e=>I({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Bi(oA.setLoading(!1))}function*sk(){yield Go(oA.loadInvoices,lk)}function*ck(){yield zi([Hi(BA),Hi(YA),Hi(ok),Hi(FA)])}function*uk(){yield zi([Hi(JA),Hi(ik),Hi(sk),Hi(GA)])}function*dk(){yield Go(fA.loadCheckout,yk),yield Go(fA.resetCheckout,fk),yield Go(fA.submitCheckout,gk),yield Go(fA.confirmCheckout,pk),yield Go(fA.errorCheckout,vk)}function*yk(){yield Bi(fA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*fk(){yield Bi(fA.setState({loading:!1,error:null,confirmed:!1}))}function*gk(){yield Bi(fA.setState({loading:!0,error:null}))}function*pk({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)===Ou.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Bi(fA.setState({loading:!0,error:null})),o&&a)return yield Sk(),void(yield Bi(Vb.setState({subscription:I({},n,{status:Ou.ACTIVE})})));try{yield Hi(od.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield zi([zA(),QA(),ak()]),yield Sk()}catch(e){yield Bi(fA.setState({loading:!1,error:e.message}))}}else yield Bi(fA.setState({loading:!1,error:"Subscription not found"}))}function*Sk(){yield Bi(fA.setState({loading:!1,error:null,confirmed:!0}))}function*vk({payload:e}){yield Bi(fA.setState({loading:!1,error:e}))}function*hk(){yield Go(fA.resetCheckout,fk)}function*mk(){yield Go(wb.loadPlans,bk)}function*bk(){yield Bi(wb.setLoading(!0));try{const e=(yield Hi(od.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(wb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Bi(wb.setError(e.message))}}function*Ak(){yield Bi(wb.setLoading(!0)),yield Xi(500),yield Bi(wb.setState({fetching:!1,loading:!1,plans:UA.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*kk(){yield Go(wb.loadPlans,Ak)}function*Tk(){yield Go(Ub.loadPaymentConfiguration,Pk)}function*Pk(){yield Bi(Ub.setLoading(!0));try{(yield Hi(od.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Cu.Stripe))?yield function*(){yield Bi(Ub.setLoading(!0));try{const e=yield Hi(od.subscriptions.getStripePaymentProviderConfiguration);yield Bi(Ub.setState({loading:!1,fetching:!1,config:{paymentProvider:wA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Bi(Ub.setError(e.message))}}():yield Bi(Ub.setError("Payment provider not configured"))}catch(e){yield Bi(Ub.setError(e.message))}}function*Ik(){yield Bi(Ub.setLoading(!0)),yield Xi(500),yield Bi(Ub.setState({loading:!1,fetching:!1,config:{paymentProvider:wA.STRIPE,apiKey:""}}))}function*Lk(){yield Go(Ub.loadPaymentConfiguration,Ik)}function*Ok(){yield Go(mA.createCardSetupIntentSecret,wk)}function*wk({payload:e}){yield Bi(mA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Hi(od.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Bi(mA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Bi(mA.setError(e.message))}}function*Ek(){yield Go(PA.loadVendorPublicConfiguration,Ck)}function*Ck(){yield Bi(PA.setLoading(!0));try{const e=yield Hi(od.subscriptions.getVendorPublicConfigurations);yield Bi(PA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Bi(PA.setError(e.message))}}function*Dk(){yield Bi(PA.setLoading(!0)),yield Xi(500),yield Bi(PA.setState({fetching:!1,loading:!1,vendorPublicConfig:$A}))}function*Rk(){yield Go(PA.loadVendorPublicConfiguration,Dk)}var _k={sagas:function*(){yield zi([Hi(ck),Hi(dk),Hi(mk),Hi(Tk),Hi(Ok),Hi(Ek)])},mockSagas:function*(){yield zi([Hi(uk),Hi(hk),Hi(kk),Hi(Lk),Hi(Rk)])},reducer:OA,actions:LA,initialState:IA,storeName:"subscriptions"},Uk={sagas:function*(){yield Go(Qd.loadVendorPublicInfo,Xd)},storeName:It,initialState:Hd,reducer:Jd,actions:Qd};const{reducer:Mk}=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}))}}}),Nk=(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}),[am.storeName]:I({},am.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},am.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Dm.storeName]:I({},Dm.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Dm.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Dm.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[_m]:I({},Rm,null!=(v=null==o?void 0:o.audits)?v:{}),[mb.storeName]:mb.initialState,[_k.storeName]:_k.initialState,[Uk.storeName]:Uk.initialState},reducer:$e({root:Mk,[am.storeName]:am.reducer,[Dm.storeName]:Dm.reducer,[_m]:Mm,[mb.storeName]:mb.reducer,[_k.storeName]:_k.reducer,[Uk.storeName]:Uk.reducer})});const m=function*(){yield zi([Hi(am.sagas),Hi(Dm.sagas),Hi(zm),Hi(mb.sagas),Hi(_k.sagas),Hi(Uk.sagas)])},b=function*(){yield zi([Hi(am.mockSagas),Hi(Dm.mockSagas),Hi(_k.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 $k=n(714),Fk=n.n($k);function xk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function Vk(e){if(e.type)return e;if("#"===e.charAt(0))return Vk(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 jk(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 Wk(e){if(0===e.indexOf("#"))return e;const{values:t}=Vk(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 Kk(e,t){if(e=Vk(e),t=xk(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 jk(e)}function Gk(e,t){if(e=Vk(e),t=xk(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 jk(e)}const Bk=e=>{if(e)return{main:e,light:Wk(Gk(e,.4)),dark:Wk(Kk(e,.15)),hover:Wk(Kk(e,.15)),active:Wk(Kk(e,.2))}},zk=e=>{if(e)return{main:e,light:Gk(e,.7),dark:Kk(e,.2)}},qk=(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({},Bk(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({},Bk(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({},Bk(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:I({},zk(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:I({},zk(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:I({},zk(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:I({},zk(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Hk={},Jk={},Yk={},Qk={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 Xk{constructor(){this._theme=Hk,this._themeV2=Jk,this._navigation=Qk,this._localizations=Yk}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Xk;return n.set(e),Xk._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=Fk().all([null!=(t=Qk)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Fk().all([null!=(i=Hk)?i:{},qk(null==e?void 0:e.theme,Hk)]),this._themeV2=Fk().all([null!=(o=Jk)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Fk().all([null!=(r=Yk)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=Qk,this._theme=Hk,this._themeV2=Jk,this._localizations=Yk}}}Xk._instances={};var Zk={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},eT=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},tT=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},nT=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 iT,oT,aT,rT,lT,sT,cT,uT,dT,yT,fT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(iT||(iT={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(oT||(oT={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(aT||(aT={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(rT||(rT={})),function(e){e.Invoices="invoices"}(lT||(lT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(sT||(sT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(cT||(cT={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(uT||(uT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(dT||(dT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(yT||(yT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(fT||(fT={}));const gT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},pT={hidden:"hidden",edit:"edit"};var ST="6.66.0-alpha.0",vT=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(ST),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=O(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:Xk.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=O(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=O(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=Zk,e.next=13;break;case 4:return e.prev=4,e.next=7,Bu();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=eT(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:Nk({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=O(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;Xk.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=O(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=O(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=O(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}(),hT=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}(),mT=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}(),bT=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}(),AT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},kT=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:Nk({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 vT(this.options,t,!0),Xk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(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,nT(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}(),TT="modern",PT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[TT]},IT=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:Nk({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 vT(this.options,t,!0),Xk.set({},t)}var t;return T(e,[{key:"render",value:(t=O(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,nT(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 LT(e,t){return LT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},LT(e,t)}function OT(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&&LT(e,t)}function wT(e){return wT="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},wT(e)}function ET(e,t){if(t&&("object"===wT(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 CT(e){return CT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},CT(e)}function DT(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function RT(e,t,n){return RT=DT()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&LT(o,n.prototype),o},RT.apply(null,arguments)}function _T(e){var t="function"==typeof Map?new Map:void 0;return _T=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 RT(e,arguments,CT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),LT(n,e)},_T(e)}function UT(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=CT(e);if(t){var o=CT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return ET(this,n)}}var MT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new vT(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){OT(n,e);var t=UT(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=tT(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=tT(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=tT(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=tT(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=tT(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=tT(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}(_T(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}()}));