@frontegg/js 6.66.0-alpha.0 → 6.66.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +103 -7
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof 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&<(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&<(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}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},l=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",c=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function d(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),r=new L(i||[]);return a._invoke=function(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var l=T(r,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=y(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}(e,n,r),a}function y(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=d;var f={};function g(){}function p(){}function S(){}var v={};u(v,l,(function(){return this}));var h=Object.getPrototypeOf,m=h&&h(h(w([])));m&&m!==n&&a.call(m,l)&&(v=m);var b=S.prototype=g.prototype=Object.create(v);function A(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(o,r,l,s){var c=y(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var o;this._invoke=function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}}function T(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,T(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=y(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,f;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=S,u(b,"constructor",S),u(S,"constructor",p),p.displayName=u(S,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},A(k.prototype),u(k.prototype,s,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new k(d(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},A(b),u(b,c,"Generator"),u(b,l,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var i=t.pop();if(i in e)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=w,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),I(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return LT},AdminPortalRenderer:function(){return ET},AppHolder:function(){return P},CheckoutDialog:function(){return wT},FronteggApp:function(){return PT},HostedLogin:function(){return IT},LoginBoxRenderer:function(){return RT},defaultTheme:function(){return CT},getThemeAdminByName:function(){return OT},getThemeByName:function(){return DT},initialize:function(){return WT}});var e={};n.r(e),n.d(e,{Delete:function(){return na},Get:function(){return Xo},Patch:function(){return ea},Post:function(){return Zo},PostDownload:function(){return ia},Put:function(){return ta},getBaseUrl:function(){return Yo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Fa},getSubTenantsAsTree:function(){return xa},getTenants:function(){return $a},switchTenant:function(){return Na}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return yr},OAuthLogout:function(){return Nr},SocialLoginProviders:function(){return dr},acceptInvitation:function(){return Rr},activateAccount:function(){return Or},bulkCreateIPRestriction:function(){return rr},changePhoneNumber:function(){return hs},changePhoneNumberWithVerification:function(){return Ss},checkIfAllowToRememberMfaDevice:function(){return Bl},createDomainRestriction:function(){return er},createIPRestriction:function(){return ar},createOrUpdateSessionConfigrations:function(){return Ml},createSSOConfiguration:function(){return Yl},createSSOConfigurationByMetadata:function(){return Zl},createSSODomain:function(){return ts},createSSOGroup:function(){return rs},createSamlGroup:function(){return Al},deleteAllSessionsForUser:function(){return $l},deleteDomainRestriction:function(){return nr},deleteIPRestriction:function(){return sr},deleteSSOConfiguration:function(){return Xl},deleteSSODomain:function(){return ns},deleteSSOGroup:function(){return ss},deleteSamlGroup:function(){return Tl},deleteSessionForUser:function(){return Nl},deleteTenantApiToken:function(){return Wl},deleteUserApiToken:function(){return Kl},disableMFAAuthenticatorApp:function(){return Yr},disableMFASMS:function(){return Xr},disableMFAWebAuthn:function(){return el},disableMfa:function(){return Jr},enrollMFAAuthenticatorApp:function(){return Kr},enrollMFAAuthenticatorAppForLogin:function(){return il},enrollMFASMS:function(){return Br},enrollMFASMSForLogin:function(){return rl},enrollMFAWebAuthn:function(){return qr},enrollMFAWebAuthnForLogin:function(){return ul},enrollMfa:function(){return jr},exchangeOAuthTokens:function(){return ys},forgotPassword:function(){return $r},generateLoginResponse:function(){return mr},generateLoginResponseFromOAuthResponse:function(){return Ar},generateLoginResponseV2:function(){return br},getActivateAccountStrategy:function(){return Er},getCaptchaPolicy:function(){return qa},getCurrentUserSession:function(){return Rl},getCurrentUserSessions:function(){return Dl},getDomainRestrictions:function(){return Xa},getDomainRestrictionsConfig:function(){return Za},getGlobalSecurityPolicy:function(){return Va},getIPRestrictions:function(){return ir},getIPRestrictionsConfig:function(){return or},getLockoutPolicy:function(){return Ga},getMFADevices:function(){return tl},getMFAStrategiesConfig:function(){return Ps},getMfaPolicy:function(){return ja},getOidcConfiguration:function(){return Pl},getPasswordConfigPolicy:function(){return Qa},getPasswordHistoryPolicy:function(){return Ha},getSSOConfigurations:function(){return Jl},getSSODefaultRoles:function(){return os},getSSOGroups:function(){return cs},getSSOPublicConfiguration:function(){return Il},getSamlConfiguration:function(){return fl},getSamlRoles:function(){return hl},getSamlRolesGroups:function(){return ml},getSamlVendorConfiguration:function(){return pl},getSessionConfigurations:function(){return Ul},getSocialLoginProviders:function(){return Ll},getSocialLoginProvidersV2:function(){return wl},getTenantApiTokensData:function(){return xl},getUserApiTokensData:function(){return Fl},getUserById:function(){return Gl},getVendorConfig:function(){return El},getVendorLockoutPolicy:function(){return Ba},getVendorMfaPolicy:function(){return Wa},getVendorPasswordHistoryPolicy:function(){return Ja},getVendorPublicAuthStrategiesConfig:function(){return Ts},loadPasswordConfig:function(){return xr},login:function(){return Lr},loginViaSocialLogin:function(){return Ol},loginWithMfa:function(){return wr},logout:function(){return Mr},oidcPostLogin:function(){return Ir},oidcPostLoginV2:function(){return ds},passwordlessPostLogin:function(){return ql},passwordlessPreLogin:function(){return zl},postLogin:function(){return Pr},preDisableMFASMS:function(){return Qr},preDisableMFAWebAuthn:function(){return Zr},preEnrollMFAAuthenticatorApp:function(){return Wr},preEnrollMFAAuthenticatorAppForLogin:function(){return nl},preEnrollMFASMS:function(){return Gr},preEnrollMFASMSForLogin:function(){return al},preEnrollMFAWebAuthn:function(){return zr},preEnrollMFAWebAuthnForLogin:function(){return cl},preLogin:function(){return kr},preLoginV2:function(){return us},preLoginWithIdpType:function(){return Tr},preVerifyMFASMSForLogin:function(){return ll},preVerifyMFAWebAuthnForLogin:function(){return dl},recoverMfaToken:function(){return Vr},refreshToken:function(){return _r},refreshTokenV2:function(){return Ur},resendActivationEmail:function(){return Cr},resendInvitationEmail:function(){return Dr},resetPassword:function(){return Fr},resetPhoneNumber:function(){return gs},revokeSessionsForUser:function(){return _l},saveLockoutPolicy:function(){return za},saveMfaPolicy:function(){return Ka},savePasswordHistoryPolicy:function(){return Ya},setSSODefaultRoles:function(){return as},signUpUser:function(){return Cl},silentOAuthRefreshToken:function(){return fs},testCurrentIp:function(){return cr},testCurrentIpInAllowList:function(){return ur},updateDomainRestrictionConfig:function(){return tr},updateIPRestrictionConfig:function(){return lr},updateSSOConfiguration:function(){return Ql},updateSSOConfigurationByMetadata:function(){return es},updateSSOGroup:function(){return ls},updateSamlConfiguration:function(){return gl},updateSamlGroup:function(){return kl},updateSamlRoles:function(){return bl},updateSamlVendorMetadata:function(){return Sl},updateTenantApiTokensData:function(){return jl},updateUserApiTokensData:function(){return Vl},validateSSODomain:function(){return is},validateSamlDomain:function(){return vl},verifyChangePhoneNumber:function(){return vs},verifyInviteToken:function(){return Hl},verifyMFAAuthenticatorAppForLogin:function(){return ol},verifyMFASMSForLogin:function(){return sl},verifyMFAWebAuthnForLogin:function(){return yl},verifyMfa:function(){return Hr},verifyNewDeviceSession:function(){return ks},verifyResetPhoneNumber:function(){return ps},webAuthnCreateNewDeviceSession:function(){return As},webAuthnPostLogin:function(){return bs},webAuthnPreLogin:function(){return ms}});var a={};n.r(a),n.d(a,{addUser:function(){return Cs},changePassword:function(){return Os},createInviteUserLink:function(){return _s},deleteInviteUserLink:function(){return Ms},deleteUser:function(){return Ds},getInviteLinkConfiguration:function(){return $s},getInviteUserLink:function(){return Ns},getProfile:function(){return Is},loadAvailablePermissions:function(){return xs},loadAvailableRoles:function(){return Fs},loadStats:function(){return Vs},loadUsers:function(){return Es},resendActivationLink:function(){return js},resendInvitationLink:function(){return Ws},resendInvitationLinkToAllTenants:function(){return Ks},updateInviteUserLink:function(){return Us},updateProfile:function(){return Ls},updateProfileImage:function(){return ws},updateUser:function(){return Rs}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return Hs},getCurrentUserIpMetadata:function(){return Bs},getIpAdressMetadata:function(){return Js},getNotificationsMetadata:function(){return zs},getSamlMetadata:function(){return qs}});var l={};n.r(l),n.d(l,{downloadReport:function(){return ic},getReport:function(){return ec},getReports:function(){return Zs},renderReport:function(){return tc},scheduleReport:function(){return nc},sendReport:function(){return oc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return ac},markAllAsRead:function(){return sc},updateNotificationIsPinned:function(){return lc},updateNotificationStatus:function(){return rc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return yc},getAudits:function(){return uc},getAuditsStats:function(){return dc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Lc},deleteEmailSubscriptions:function(){return Pc},deleteSMSConfiguration:function(){return Rc},deleteSMSSubscriptions:function(){return Cc},deleteSlackConfiguration:function(){return mc},deleteWebhooksConfiguration:function(){return Mc},getCategories:function(){return xc},getChannelMaps:function(){return Vc},getEmailConfiguration:function(){return Ac},getSMSConfiguration:function(){return wc},getSlackChannels:function(){return vc},getSlackConfiguration:function(){return pc},getSlackScope:function(){return Sc},getWebhookLog:function(){return Nc},getWebhooksConfigurations:function(){return _c},patchEmailConfiguration:function(){return Tc},patchSMSConfiguration:function(){return Ec},postEmailConfiguration:function(){return kc},postSMSConfiguration:function(){return Oc},postSlackCode:function(){return bc},postSlackConfiguration:function(){return hc},postWebhookRetry:function(){return Fc},postWebhookTest:function(){return $c},postWebhooksConfiguration:function(){return Uc},putEmailSubscriptions:function(){return Ic},putSMSSubscriptions:function(){return Dc}});var d={};n.r(d),n.d(d,{getSettings:function(){return Wc},updateSettings:function(){return jc}});var y={};n.r(y),n.d(y,{addRole:function(){return qc},attachPermissionToRoles:function(){return Xc},attachPermissionsToRole:function(){return Yc},deleteRole:function(){return Hc},getPermissionCategories:function(){return Zc},getPermissions:function(){return Qc},getRoles:function(){return zc},updateRole:function(){return Jc}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Du},ISubscriptionStatus:function(){return Eu},PaymentMethodType:function(){return Cu},ProviderType:function(){return Ru},TenantCreatedAction:function(){return Uu},TrialEndAction:function(){return _u},cancelManagedSubscription:function(){return lu},cancelSubscription:function(){return nu},createStripeCustomer:function(){return Au},createStripePaymentMethodSetupIntentSecret:function(){return Tu},createSubscription:function(){return mu},createTenantConfiguration:function(){return Lu},getManagedSubscription:function(){return au},getManagedSubscriptions:function(){return ru},getPaymentMethod:function(){return vu},getPaymentMethods:function(){return Su},getPaymentProviders:function(){return wu},getStripeCustomer:function(){return bu},getStripePaymentProviderConfiguration:function(){return ku},getSubscription:function(){return tu},getSubscriptionInvoice:function(){return fu},getSubscriptionInvoicePdf:function(){return gu},getSubscriptionInvoices:function(){return yu},getSubscriptionPlan:function(){return du},getSubscriptionPlans:function(){return uu},getSubscriptionSummaries:function(){return Pu},getSubscriptions:function(){return eu},getTenantConfiguration:function(){return Iu},getVendorPublicConfigurations:function(){return Ou},renewManagedSubscription:function(){return su},renewSubscription:function(){return iu},updateManagedSubscription:function(){return cu},updatePaymentMethodBillingDetails:function(){return hu},updateSubscription:function(){return ou}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Vu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Gu},addUserToTenantAndSubTenants:function(){return Wu},loadAllUsers:function(){return ju},removeUserFromTenantAndSubTenants:function(){return Ku},removeUserRolesFromSubTenants:function(){return Bu},setUserRolesForSubTenants:function(){return zu}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return qu}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Xu},createConfiguration:function(){return Yu},deleteConfiguration:function(){return Qu},getConfigs:function(){return Hu},updateConfiguration:function(){return Ju}});var h={};n.r(h),n.d(h,{impersonate:function(){return Zu}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return yr},ContextHolder:function(){return qo},FronteggApiError:function(){return Jo},FronteggContext:function(){return Ho},ISubscriptionCancellationPolicy:function(){return Du},ISubscriptionStatus:function(){return Eu},MFAStrategyEnum:function(){return $u},PaymentMethodType:function(){return Cu},ProviderType:function(){return Ru},RestrictionType:function(){return _n},ScimConnectionSource:function(){return rd},SecondaryAuthStrategy:function(){return Mu},SocialLoginProviders:function(){return dr},TenantType:function(){return xu},UserManagedByEnum:function(){return Fu},WebAuthnDeviceType:function(){return Nu},api:function(){return ld},countConfigurationUsers:function(){return Xu},createConfiguration:function(){return Yu},default:function(){return sd},deleteConfiguration:function(){return Qu},fetch:function(){return e},fronteggAuthApiRoutes:function(){return td},fronteggLogoutApiRoutes:function(){return ed},fronteggRefreshTokenUrl:function(){return nd},fronteggSilentRefreshTokenUrl:function(){return id},fronteggTenantsUrl:function(){return ad},fronteggUsersUrl:function(){return od},getConfigs:function(){return Hu},loadFeatureFlags:function(){return qu},updateConfiguration:function(){return Ju}});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 fT},DomainRestrictionsTabFields:function(){return mT},GeneralSettingsTabFields:function(){return vT},InviteUserModalFields:function(){return yT},IpRestrictionsTabFields:function(){return hT},Metadata:function(){return aT},PrivacyPageFields:function(){return dT},ProfilePageFields:function(){return uT},SecurityPageTabs:function(){return pT},SessionManagementTabFields:function(){return ST},SsoPageTabs:function(){return bT},SubscriptionsPageFields:function(){return gT},fieldAppearance:function(){return AT},tabAppearance:function(){return kT}});var P=function(){function e(){A(this,e)}return T(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},I.apply(this,arguments)}function L(e,t,n,i,o,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(i,o)}function w(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){L(a,i,o,r,l,"next",e)}function l(e){L(a,i,o,r,l,"throw",e)}r(void 0)}))}}P._apps={};var O=n(841),E=n.n(O);function C(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function D(e){return!!e&&!!e[ve]}function R(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===he}(e)||Array.isArray(e)||!!e[Se]||!!e.constructor[Se]||F(e)||x(e))}function _(e,t,n){void 0===n&&(n=!1),0===U(e)?(n?Object.keys:me)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function U(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:F(e)?2:x(e)?3:0}function M(e,t){return 2===U(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function N(e,t,n){var i=U(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function F(e){return ye&&e instanceof Map}function x(e){return fe&&e instanceof Set}function V(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=be(e);delete t[ve];for(var n=me(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function W(e,t){return void 0===t&&(t=!1),G(e)||D(e)||!R(e)||(U(e)>1&&(e.set=e.add=e.clear=e.delete=K),Object.freeze(e),t&&_(e,(function(e,t){return W(t,!0)}),!0)),e}function K(){C(2)}function G(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function B(e){var t=Ae[e];return t||C(18,e),t}function z(){return ue}function q(e,t){t&&(B("Patches"),e.u=[],e.s=[],e.v=t)}function H(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===ue&&(ue=e.l)}function Y(e){return ue={p:[],l:ue,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function X(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||B("ES5").S(t,e,i),i?(n[ve].P&&(H(t),C(4)),R(e)&&(e=Z(t,e),t.l||te(t,e)),t.u&&B("Patches").M(n[ve].t,e,t.u,t.s)):e=Z(t,n,[]),H(t),t.u&&t.v(t.u,t.s),e!==pe?e:void 0}function Z(e,t,n){if(G(t))return t;var i=t[ve];if(!i)return _(t,(function(o,a){return ee(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return te(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;_(3===i.i?new Set(o):o,(function(t,a){return ee(e,i,o,t,a,n)})),te(e,o,!1),n&&e.u&&B("Patches").R(i,n,e.u,e.s)}return i.o}function ee(e,t,n,i,o,a){if(D(o)){var r=Z(e,o,a&&t&&3!==t.i&&!M(t.D,i)?a.concat(i):void 0);if(N(n,i,r),!D(r))return;e.m=!1}if(R(o)&&!G(o)){if(!e.h.F&&e._<1)return;Z(e,o),t&&t.A.l||te(e,o)}}function te(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ne(e,t){var n=e[ve];return(n?V(n):e)[t]}function ie(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function oe(e){e.P||(e.P=!0,e.l&&oe(e.l))}function ae(e){e.o||(e.o=j(e.t))}function re(e,t,n){var i=F(t)?B("MapSet").N(t,n):x(t)?B("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=ke;n&&(o=[i],a=Te);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):B("ES5").J(t,n);return(n?n.A:z()).p.push(i),i}function le(e){return D(e)||C(22,e),function e(t){if(!R(t))return t;var n,i=t[ve],o=U(t);if(i){if(!i.P&&(i.i<4||!B("ES5").K(i)))return i.t;i.I=!0,n=se(t,o),i.I=!1}else n=se(t,o);return _(n,(function(t,o){i&&function(e,t){return 2===U(e)?e.get(t):e[t]}(i.t,t)===o||N(n,t,e(o))})),3===o?new Set(n):n}(e)}function se(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var ce,ue,de="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ye="undefined"!=typeof Map,fe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,pe=de?Symbol.for("immer-nothing"):((ce={})["immer-nothing"]=!0,ce),Se=de?Symbol.for("immer-draftable"):"__$immer_draftable",ve=de?Symbol.for("immer-state"):"__$immer_state",he=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),me="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,be=Object.getOwnPropertyDescriptors||function(e){var t={};return me(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ae={},ke={get:function(e,t){if(t===ve)return e;var n=V(e);if(!M(n,t))return function(e,t,n){var i,o=ie(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!R(i)?i:i===ne(e.t,t)?(ae(e),e.o[t]=re(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=ie(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ne(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||M(e.t,t)))return!0;ae(e),oe(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==ne(e.t,t)||t in e.t?(e.D[t]=!1,ae(e),oe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){C(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){C(12)}},Te={};_(ke,(function(e,t){Te[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Te.deleteProperty=function(e,t){return Te.set.call(this,e,t,void 0)},Te.set=function(e,t,n){return ke.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&C(6),void 0!==i&&"function"!=typeof i&&C(7),R(e)){var l=Y(t),s=re(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?H(l):J(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return q(l,i),X(e,l)}),(function(e){throw H(l),e})):(q(l,i),X(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===pe&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];B("Patches").M(e,r,u,d),i(u,d)}return r}C(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){R(e)||C(8),D(e)&&(e=le(e));var t=Y(this),n=re(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return q(n,t),X(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&C(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=B("Patches").$;return D(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ie=new Pe,Le=Ie.produce,we=(Ie.produceWithPatches.bind(Ie),Ie.setAutoFreeze.bind(Ie),Ie.setUseProxies.bind(Ie),Ie.applyPatches.bind(Ie),Ie.createDraft.bind(Ie),Ie.finishDraft.bind(Ie),Le);function Oe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ee(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function De(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Re="function"==typeof Symbol&&Symbol.observable||"@@observable",_e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ue={INIT:"@@redux/INIT"+_e(),REPLACE:"@@redux/REPLACE"+_e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+_e()}};function Me(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ne(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(De(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(De(1));return n(Ne)(e,t)}if("function"!=typeof e)throw new Error(De(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(De(3));return a}function d(e){if("function"!=typeof e)throw new Error(De(4));if(s)throw new Error(De(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(De(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Me(e))throw new Error(De(7));if(void 0===e.type)throw new Error(De(8));if(s)throw new Error(De(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(De(10));o=e,y({type:Ue.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(De(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Re]=function(){return this},e}return y({type:Ue.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Re]=g,i}function $e(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ue.INIT}))throw new Error(De(12));if(void 0===n(void 0,{type:Ue.PROBE_UNKNOWN_ACTION()}))throw new Error(De(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(De(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Fe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(De(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Fe.apply(void 0,a)(n.dispatch),Ce(Ce({},n),{},{dispatch:i})}}}function Ve(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var je=Ve();je.withExtraArgument=Ve;var We,Ke=je,Ge=(We=function(e,t){return We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},We(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Be=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},ze=Object.defineProperty,qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),He=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))He.call(t,n)&&Ye(e,n,t[n]);if(qe)for(var i=0,o=qe(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Xe="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Fe:Fe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var Ze=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ge(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Be([void 0],e[0].concat(this)))):new(t.bind.apply(t,Be([void 0],e.concat(this))))},t}(Array);function et(e){return R(e)?we(e,(function(){})):e}function tt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new Ze);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Ke):i.push(Ke.withExtraArgument(n.extraArgument))),i}function nt(e){var t,n=function(e){return tt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=$e(a)}var g=l;"function"==typeof g&&(g=g(n));var p=xe.apply(void 0,g),S=Fe;c&&(S=Xe(Qe({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Be([p],f):"function"==typeof f&&(v=f(v)),Ne(t,d,S.apply(void 0,v))}function it(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Qe(Qe({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ot(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function at(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:et(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ot(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Qe(Qe({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ot(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return et(e())};else{var c=et(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Be([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var i;if(D(e))return void 0===(i=n(e,t))?e:i;if(R(e))return we(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=i?it(c,i):it(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var rt="listenerMiddleware";it(rt+"/add"),it(rt+"/removeAll"),it(rt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ve];return ke.get(t,e)},set:function(t){var n=this[ve];ke.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&oe(o);break;case 4:n(o)&&oe(o)}}}function n(e){for(var t=e.t,n=e.k,i=me(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!M(t,a))return!0;var l=n[a],s=l&&l[ve];if(s?s.t!==r:!$(l,r))return!0}}var c=!!t[ve];return i.length!==me(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Ae[e]||(Ae[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=be(n);delete a[ve];for(var r=me(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:z(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?D(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)_(a,(function(t){t!==ve&&(void 0!==o[t]||M(o,t)?r[t]||e(a[t]):(r[t]=!0,oe(n)))})),_(o,(function(e){void 0!==a[e]||M(a,e)||(r[e]=!1,oe(n))}));else if(5===l){if(i(n)&&(oe(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const lt=(e,t)=>n=>I({},n,{[e]:t[e]}),st=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),ct=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return I({},n,{[e]:I({},n[e],{[t]:I({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{loaders:I({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return I({},t,{[e]:I({},t[e],{errors:I({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),yt=(e=500)=>new Promise((t=>setTimeout(t,e))),ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",gt=new Uint8Array(256);for(let e=0;e<ft.length;e++)gt[ft.charCodeAt(e)]=e;const pt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=gt[e.charCodeAt(i)],a=gt[e.charCodeAt(i+1)],r=gt[e.charCodeAt(i+2)],l=gt[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},St=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(St(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=ft[t[i]>>2],o+=ft[(3&t[i])<<4|t[i+1]>>4],o+=ft[(15&t[i+1])<<2|t[i+2]>>6],o+=ft[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=St(e[n]);return t}return e};let vt,ht,mt;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor"}(vt||(vt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(ht||(ht={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(mt||(mt={}));const bt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",At="HOSTED_LOGIN_VERIFIER_KEY",kt="auth",Tt="connectivity",Pt="auditLogs",It="vendor",Lt={flow:ht.Login,step:vt.preLogin,loading:!1,email:"",tenants:[]},wt={setLoginState:st("loginState"),resetLoginState:lt("loginState",{loginState:Lt})},Ot={requestAuthorize:it("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:it("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:it("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:it("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:it("auth/afterAuthNavigation"),preLogin:it("auth/preLogin",(e=>({payload:e}))),postLogin:it("auth/postLogin",(e=>({payload:e}))),login:it("auth/login",(e=>({payload:e}))),loginWithMfa:it("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:it("auth/recoverMfa",(e=>({payload:e}))),logout:it("auth/logout",(e=>({payload:e}))),silentLogout:it("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:it("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:it("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:it("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:it("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:it("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:it("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:it("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:it("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:it("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:it("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:it("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:it("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:it("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:it("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:it("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:it("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:it("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:it("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:it("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:it("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:it("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Et;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Et||(Et={}));const Ct={step:Et.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Dt={setActivateState:st("activateState"),resetActivateState:lt("activateState",{activateState:Ct}),setActivateStrategyState:ct("activateState","activationStrategy")},Rt={activateAccount:it("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:it("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:it("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:it("auth/resendActivationEmail",(e=>({payload:e})))};let _t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(_t||(_t={}));const Ut={step:_t.validate},Mt={setAcceptInvitationState:st("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ut})},Nt={acceptInvitation:it("auth/acceptInvitation",(e=>({payload:e})))};let $t;!function(e){e.forgotPassword="forgotPassword",e.success="success"}($t||($t={}));const Ft={step:$t.forgotPassword,loading:!1,email:"",passwordConfig:null},xt={setForgotPasswordState:st("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Ft})},Vt={forgotPassword:it("auth/forgotPassword",(e=>({payload:e}))),resetPassword:it("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:it("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Wt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:st("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Wt})},Gt={resetPhoneNumber:it("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:it("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:it("auth/changePhoneNumber",(e=>({payload:e})))},Bt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},zt={setSSOLoader:ut("ssoState"),setSSOError:dt("ssoState"),setSSOState:st("ssoState"),resetSSOState:lt("ssoState",{ssoState:Bt})},qt={loadSSOConfigurationsV2:it("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:it("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:it("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:it("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:it("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:it("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:it("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:it("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:it("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:it("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:it("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:it("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:it("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:it("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:it("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:it("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:it("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:it("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:it("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:it("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:it("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:it("auth/oidcPostlogin",(e=>({payload:e})))},Ht={loading:!1,error:null},Jt={setProfileState:st("profileState"),resetProfileState:lt("profileState",{profileState:Ht})},Yt={loadProfile:it("auth/loadProfile"),saveProfile:it("auth/saveProfile",(e=>({payload:e}))),changePassword:it("auth/changePassword",(e=>({payload:e})))};let Qt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Qt||(Qt={}));const Xt={step:Qt.verify,loading:!1,saving:!1},Zt={setMfaState:st("mfaState"),resetMfaState:lt("mfaState",{mfaState:Xt})},en={enrollMfa:it("auth/enrollMfa"),getMFADevices:it("auth/getMFADevices"),getMFAStrategies:it("auth/getMFAStrategies"),verifyMfa:it("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:it("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:it("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:it("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:it("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:it("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:it("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:it("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:it("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:it("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:it("auth/disableMfaWebAuthn",(e=>({payload:e})))},tn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},nn={setTeamLoader:ut("teamState"),setTeamError:dt("teamState"),setTeamState:st("teamState"),resetTeamState:lt("teamState",{teamState:tn})},on={loadUsers:it("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:it("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:it("auth/loadRoles",(e=>({payload:e}))),addUser:it("auth/addUser",(e=>({payload:e}))),addUsersBulk:it("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:it("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:it("auth/updateUser",(e=>({payload:e}))),deleteUser:it("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:it("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:it("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:it("auth/lockUser",(e=>({payload:e}))),resendActivationLink:it("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:it("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:it("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:it("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:it("auth/getInvitationLink"),createInvitationLink:it("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:it("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:it("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:it("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:it("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:it("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:it("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:it("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:it("auth/closeLockUserDialog",(e=>({payload:e})))},an={firstLoad:!0,loading:!1,error:""},rn={setSocialLoginsState:st("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:an})},ln={loadSocialLoginsConfiguration:it("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:it("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:it("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:it("auth/setSocialLoginError",(e=>({payload:e})))};let sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(sn||(sn={}));const cn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:sn.SignUp},un={setSignUpState:st("signUpState"),resetSignUpState:lt("signUpState",{signUpState:cn})},dn={signUpUser:it("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:it("auth/resetSignUpStateSoft")},yn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},fn={setApiTokensLoader:ut("apiTokensState"),setApiTokensError:dt("apiTokensState"),setApiTokensState:st("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:yn})},gn={loadApiTokens:it("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:it("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:it("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:it("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:it("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:it("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:it("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:it("auth/deleteTenantApiToken",(e=>({payload:e})))},pn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Sn={setSecurityPolicyState:st("securityPolicyState"),setSecurityPolicyGlobalState:ct("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ct("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ct("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ct("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ct("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ct("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ct("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ct("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ct("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ct("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ct("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:pn})},vn={loadSecurityPolicy:it("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:it("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:it("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:it("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:it("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:it("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:it("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:it("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:it("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:it("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:it("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:it("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:it("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:it("auth/loadPublicAuthStrategiesPolicy")},hn={loading:!1},mn={setAccountSettingsState:st("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:hn})},bn={loadAccountSettings:it("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:it("auth/saveAccountSettings",(e=>({payload:e})))},An={tenants:[],subTenants:[],loading:!0,tenantTree:null},kn={setTenantsState:st("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:An})},Tn={switchTenant:it("auth/switchTenant",(e=>({payload:e}))),loadTenants:it("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:it("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:it("auth/loadSubTenantsTree",(e=>({payload:e})))},Pn={loading:!1,roles:[],permissions:[],permissionCategories:[]},In={setRolesState:st("rolesState"),resetRolesState:lt("rolesState",{rolesState:Pn})},Ln={loadRolesAndPermissions:it("auth/loadRoles",(e=>({payload:e}))),addRole:it("auth/addRole",(e=>({payload:e}))),updateRole:it("auth/updateRole",(e=>({payload:e}))),deleteRole:it("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:it("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:it("auth/attachPermissionToRoles",(e=>({payload:e})))},wn={loading:!1,sessions:[]},On={setSessionsState:st("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:wn})},En={loadUserSessions:it("auth/loadUserSessions"),loadCurrentUserSession:it("auth/loadCurrentUserSession"),deleteUserSession:it("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:it("auth/deleteAllUserSessions"),revokeUserSessions:it("auth/revokeUserSessions",(e=>({payload:e})))},Cn={loading:!1,configurations:{}},Dn={setSessionsPolicyState:st("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Cn})},Rn={loadSessionsPolicy:it("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:it("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let _n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(_n||(_n={}));const Un={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:_n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Mn={setRestrictionsState:st("restrictionsState"),setIpRestrictionsState:ct("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ct("restrictionsState","emailDomainRestrictions")},Nn={checkIfUserIpValid:it("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:it("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:it("auth/loadIpRestrictions"),saveIpRestriction:it("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:it("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:it("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:it("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:it("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:it("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:it("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},$n={loading:!1},Fn={setProvisioningState:st("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:$n})},xn={loadProvisionConnections:it("auth/loadProvisionConnections"),createProvisionConnection:it("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:it("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:it("auth/updateProvisionConnection",(e=>({payload:e})))},Vn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:cn,loginState:Lt,activateState:Ct,acceptInvitationState:Ut,forgotPasswordState:Ft,ssoState:Bt,profileState:Ht,mfaState:Xt,teamState:tn,socialLoginState:an,apiTokensState:yn,securityPolicyState:pn,accountSettingsState:hn,tenantsState:An,rolesState:Pn,resetPhoneNumberState:Wt,sessionsState:wn,sessionsPolicyState:Cn,restrictionsState:Un,provisioningState:$n},jn=I({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Vn);let Wn;!function(e){e.impersonating="impersonating",e.success="success"}(Wn||(Wn={}));const Kn={step:Wn.impersonating,loading:!1},Gn={setImpersonateState:st("impersonateState"),resetImpersonateState:lt("impersonateState",{impersonateState:Kn})},Bn={impersonate:it("impersonation/impersonate",(e=>({payload:e})))},{reducer:zn,actions:qn}=at({name:kt,initialState:jn,reducers:I({resetState:e=>I({},e,Vn),setState:(e,{payload:t})=>I({},e,t),setUser:("user",(e,{payload:t})=>I({},e,{user:t}))},wt,rn,Dt,Gn,Mt,xt,Kt,un,Jt,zt,Zt,nn,fn,Sn,mn,kn,In,On,Dn,Mn,Fn)});const Hn=I({},qn,Ot,ln,Rt,Nt,Vt,Gt,dn,Yt,qt,en,on,gn,vn,bn,Tn,Ln,En,Rn,Nn,xn,Bn);var Jn=function(e){return"@@redux-saga/"+e},Yn=Jn("CANCEL_PROMISE"),Qn=Jn("CHANNEL_END"),Xn=Jn("IO"),Zn=Jn("MATCH"),ei=Jn("MULTICAST"),ti=Jn("SAGA_ACTION"),ni=Jn("SELF_CANCELLATION"),ii=Jn("TASK"),oi=Jn("TASK_CANCEL"),ai=Jn("TERMINATE"),ri=Jn("LOCATION");function li(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var si=function(e){return null==e},ci=function(e){return null!=e},ui=function(e){return"function"==typeof e},di=function(e){return"string"==typeof e},yi=Array.isArray,fi=function(e){return e&&ui(e.then)},gi=function(e){return e&&ui(e.next)&&ui(e.throw)},pi=function e(t){return t&&(di(t)||hi(t)||ui(t)||yi(t)&&t.every(e))},Si=function(e){return e&&ui(e.take)&&ui(e.close)},vi=function(e){return ui(e)&&e.hasOwnProperty("toString")},hi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},mi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Yn]=function(){clearTimeout(n)},i},bi=function(e){return function(){return e}},Ai=bi(!0),ki=function(){},Ti=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Pi=function(e,t){I(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ii(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Li=function(e){throw e},wi=function(e){return{value:e,done:!0}};function Oi(e,t,n){void 0===t&&(t=Li),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:wi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ei(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ci=function(e){return Array.apply(null,new Array(e))},Di=function(e){return function(t){return e(Object.defineProperty(t,ti,{value:!0}))}},Ri=function(e){return e===ai},_i=function(e){return e===oi},Ui=function(e){return Ri(e)||_i(e)};function Mi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=yi(e)?Ci(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ui(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=ki,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Ni(e){return{name:e.name||"anonymous",location:$i(e)}}function $i(e){return e[ri]}var Fi=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},xi="TAKE",Vi="CALL",ji="FORK",Wi="SELECT",Ki=function(e,t){var n;return(n={})[Xn]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Gi(e,t){return void 0===e&&(e="*"),pi(e)?(ci(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Ki(xi,{pattern:e})):Si(n=e)&&n[ei]&&ci(t)&&pi(t)?Ki(xi,{channel:e,pattern:t}):Si(e)?(ci(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Ki(xi,{channel:e})):void 0;var n}function Bi(e,t){return si(t)&&(t=e,e=void 0),Ki("PUT",{channel:e,action:t})}function zi(e){var t=Ki("ALL",e);return t.combinator=!0,t}function qi(e,t){var n,i=null;return ui(e)?n=e:(yi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&di(n)&&ui(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Hi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(Vi,qi(e,n))}function Ji(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(ji,qi(e,n))}function Yi(e){return void 0===e&&(e=ni),Ki("CANCEL",e)}function Qi(e){void 0===e&&(e=Ti);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Ki(Wi,{selector:e,args:n})}var Xi=Hi.bind(null,mi);var Zi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},eo=[],to=0;function no(e){try{ao(),e()}finally{ro()}}function io(e){eo.push(e),to||(ao(),lo())}function oo(e){try{return ao(),e()}finally{lo()}}function ao(){to++}function ro(){to--}function lo(){var e;for(ro();!to&&void 0!==(e=eo.shift());)no(e)}var so=function(e){return function(t){return e.some((function(e){return go(e)(t)}))}},co=function(e){return function(t){return e(t)}},uo=function(e){return function(t){return t.type===String(e)}},yo=function(e){return function(t){return t.type===e}},fo=function(){return Ai};function go(e){var t="*"===e?fo:di(e)?uo:yi(e)?so:vi(e)?uo:ui(e)?co:hi(e)?yo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var po={type:Qn},So=function(e){return e&&e.type===Qn};function vo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(po)}))},(e={})[ei]=!0,e.put=function(e){if(!t)if(So(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[Zn](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=fo),t?e(po):(e[Zn]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ii(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[ti]?l(e):io((function(){l(e)}))},r}function ho(e,t){var n=e[Yn];ui(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var mo,bo=0,Ao=function(){return++bo};function ko(e){e.isRunning()&&e.cancel()}var To=((mo={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!So(e)||r?n(e):n(ai)};try{o.take(l,ci(a)?go(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},mo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;io((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&fi(t)?ho(t,n):n(t)}))},mo.ALL=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t);if(0!==r.length){var l=Mi(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(yi(t)?[]:{})},mo.RACE=function(e,t,n,i){var o=i.digestEffect,a=bo,r=Object.keys(t),l=yi(t)?Ci(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ui(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=ki,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},mo.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(fi(s))return void ho(s,n);if(gi(s))return void _o(e,s,l.context,bo,Ni(a),!1,n);n(s)}catch(e){n(e,!0)}},mo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){si(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},mo.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(gi(o))return o;var a=!1;return Oi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!fi(o)})}))}catch(e){return Oi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ni(t)}(c,a);oo((function(){var t=_o(e,c,s.context,bo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},mo.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ii(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(yi(t)){if(0===t.length)return void n([]);var r=Mi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},mo.CANCEL=function(e,t,n,i){var o=i.task;t===ni?ko(o):yi(t)?t.forEach(ko):ko(t),n()},mo.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},mo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Fi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(po):e.isEmpty()?(n.push(i),i.cancel=function(){Ii(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(po):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(po)}}}}(t.buffer),a=go(i),r=function t(n){So(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},mo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},mo.FLUSH=function(e,t,n){t.flush(n)},mo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},mo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Pi(o.context,t),n()},mo);function Po(e,t){return e+"?"+t}function Io(e){var t=e.name,n=e.location;return n?t+" "+Po(n.fileName,n.lineNumber):t}function Lo(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var wo=null,Oo=[],Eo=function(e){e.crashedEffect=wo,Oo.push(e)},Co=function(){wo=null,Oo.length=0},Do=function(){var e,t,n=Oo[0],i=Oo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=$i(e))?t.code+" "+Po(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Io(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Io(e.meta)})),[Lo(Oo)]).join("\n")};function Ro(e,t,n,i,o,a,r){var l;void 0===r&&(r=ki);var s,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Ii(o,t),t.cont=ki,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=ki,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Eo({meta:o,cancelledTasks:y}),S.isRoot){var i=Do();Co(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===oi?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[ii]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(oi,!1))},l.cont=r,l.end=p,l.setContext=function(e){Pi(f,e)},l.toPromise=function(){return d||(d=Zi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function _o(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){fi(t)?ho(t,i):gi(t)?_o(e,t,c.context,n,o,!1,i):t&&t[Xn]?(0,To[t.type])(e,t.payload,i,u):i(t)}));d.cancel=ki;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(oi))},status:0},c=Ro(e,s,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Co()):_i(e)?(s.status=1,d.cancel(),o=ui(t.return)?t.return(oi):{done:!0,value:oi}):o=Ri(e)?ui(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=Ao();function s(n,o){a||(a=!0,i.cancel=ki,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){wo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=ki,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=ki,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function Uo(e,t){for(var n=e.channel,i=void 0===n?vo():n,o=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Ei:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Ao();if(s&&(s.rootSagaStarted=s.rootSagaStarted||ki,s.effectTriggered=s.effectTriggered||ki,s.effectResolved=s.effectResolved||ki,s.effectRejected=s.effectRejected||ki,s.effectCancelled=s.effectCancelled||ki,s.actionDispatched=s.actionDispatched||ki,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Fe.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Ti;var m={channel:i,dispatch:Di(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return oo((function(){var e=_o(m,S,l,v,Ni(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Mo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?vo():a,l=n.sagaMonitor,s=li(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Uo.bind(null,I({},s,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Pi(o,e)},c},No=function(e){return{done:!0,value:e}},$o={};function Fo(e){return Si(e)?"channel":vi(e)?String(e):ui(e)?e.name:String(e)}function xo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===$o)return No(t);if(n&&!o)throw r=$o,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===$o?No(t):a}return Oi(l,(function(e){return l(null,e)}),n)}function Vo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Gi(e)},l=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Fo(e)+", "+t.name+")")}function jo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:Gi(e)},s=function(e){return{done:!1,value:Ji.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Yi(e)}},u=function(e){return a=e},d=function(e){return r=e};return xo({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Fo(e)+", "+t.name+")")}function Wo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:Gi(e)},l=function(e){return{done:!1,value:Hi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Fo(e)+", "+t.name+")")}function Ko(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var l={done:!1,value:Hi.apply(void 0,[n].concat(a))},s={done:!1,value:Xi(t)};return xo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:$o}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Go(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Vo,e,t].concat(i))}function Bo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[jo,e,t].concat(i))}function zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Ji.apply(void 0,[Wo,e,t].concat(i))}class qo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return qo.instance||(qo.instance=new qo),qo.instance}static setContext(e){qo.getInstance().context=e}static setAccessToken(e){qo.getInstance().accessToken=e}static setUser(e){qo.getInstance().user=e}static setOnRedirectTo(e){qo.getInstance().onRedirectTo=e}static setLogout(e,t){qo.getInstance().logout=n=>{n?e(n):qo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=qo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return qo.getInstance().accessToken}static getUser(){return qo.getInstance().user}static onRedirectTo(e,t){return qo.getInstance().onRedirectTo(e,t)}static logout(e){return qo.getInstance().logout(e)}}qo.instance=void 0;const Ho={getContext:()=>qo.getContext(),getAccessToken:()=>qo.getAccessToken(),getUser:()=>qo.getUser(),onRedirectTo:(e,t)=>qo.onRedirectTo(e,t),logout:e=>qo.logout(e)};class Jo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Yo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const Qo=async e=>{var t,n,i;const o=qo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:qo.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=Yo(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:I({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new Jo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Jo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},Xo=async(e,t,n)=>Qo(I({url:e,method:"GET",contentType:"application/json",params:t},n)),Zo=async(e,t,n)=>Qo(I({url:e,method:"POST",contentType:"application/json",body:t},n)),ea=async(e,t,n)=>Qo(I({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ta=async(e,t,n)=>Qo(I({url:e,method:"PUT",contentType:"application/json",body:t},n)),na=async(e,t,n)=>Qo(I({url:e,method:"DELETE",contentType:"application/json",body:t},n)),ia=async(e,t,n,i)=>Qo(I({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),oa={v1:"/identity/resources/users/webauthn/v1/devices"},aa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ra={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},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"},pa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Sa={v1:"/team/resources/members/v1"},va={v1:"/team/resources/roles/v1"},ha={v1:"/team/resources/stats/v1"},ma={v1:"/team/resources/profile"},ba={v1:"/tenants/resources/account-settings/v1"},Aa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},ka={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ta={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},Pa={v1:"/subscriptions/resources/payment-providers/v1"},Ia={v1:"/subscriptions/resources/subscriptions/v1"},La={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},wa={v1:"/reports/engine/resources/triggers/v1"},Oa="/notification",Ea="/audits",Ca={v1:"/event/resources/configurations/v1"},Da="/webhook",Ra="/oauth",_a="/flags",Ua="/directory/resources/v1/configurations/scim2",Ma="/directory/resources/scim/temp";async function Na(e){return ta(`${ra.v1}/tenant`,e)}async function $a(){return Xo(`${ra.v2}/me/tenants`)}async function Fa(){return Xo(Aa.v1)}async function xa(){return Xo(Aa.tree.v1)}async function Va(){return Xo(la.v1)}async function ja(){return Xo(`${la.v1}/mfa-policy`)}async function Wa(){return Xo(`${la.v1}/mfa-policy/vendor`)}async function Ka(e){return e.id?ea(`${la.v1}/mfa-policy`,e):Zo(`${la.v1}/mfa-policy`,e)}async function Ga(){return Xo(`${la.v1}/lockout-policy`)}async function Ba(){return Xo(`${la.v1}/lockout-policy/vendor`)}async function za(e){return e.id?ea(`${la.v1}/lockout-policy`,e):Zo(`${la.v1}/lockout-policy`,e)}async function qa(){try{return await Xo(`${la.v1}/captcha-policy/public`)}catch{return null}}async function Ha(){return Xo(`${la.v1}/password-history-policy`)}async function Ja(){return Xo(`${la.v1}/password-history-policy/vendor`)}async function Ya(e){return e.id?ea(`${la.v1}/password-history-policy`,e):Zo(`${la.v1}/password-history-policy`,e)}async function Qa(){return Xo(`${la.v1}/password`)}async function Xa(){return Xo(`${sa.emailDomain.v1}`)}async function Za(){return Xo(`${sa.emailDomain.v1}/config`)}async function er(e){return Zo(`${sa.emailDomain.v1}`,e)}async function tr(e){return Zo(`${sa.emailDomain.v1}/config`,e)}async function nr(e){return na(`${sa.emailDomain.v1}/${e}`)}async function ir(e){return Xo(`${sa.ip.v1}`,e)}async function or(){return Xo(`${sa.ip.v1}/config`)}async function ar(e){return Zo(`${sa.ip.v1}`,e)}async function rr(e){return Zo(`${sa.ip.v1}/bulk`,e)}async function lr(e){return Zo(`${sa.ip.v1}/config`,e)}async function sr(e){return na(`${sa.ip.v1}/${e}`)}async function cr(){return Zo(`${sa.ip.v1}/verify`)}async function ur(){return Zo(`${sa.ip.v1}/verify/allow`)}let dr,yr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(dr||(dr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(yr||(yr={}));class fr extends Error{constructor(e){super(e)}}const gr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new fr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class pr extends Error{constructor(e){super(e)}}const Sr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(gr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return gr(t)}})(e.split(".")[n]))}catch(e){throw new pr("Invalid token specified: "+e.message)}},vr=["type"],hr=["type"];async function mr(e){if(!e.accessToken)return e;qo.setAccessToken(e.accessToken);const t=await Xo(`${ra.v2}/me`),n=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(n),n}async function br(e){if(!e.accessToken)return{user:e};qo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Xo(`${ra.v2}/me`),$a()]),i=I({},e,e.accessToken?Sr(e.accessToken):{},t);return qo.setUser(i),{user:i,tenants:n}}async function Ar(e){qo.setAccessToken(e.id_token);const t=await Xo(`${ra.v2}/me`),n=e.id_token?Sr(e.id_token):{},i=I({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return qo.setUser(i),i}async function kr(e){try{const{address:t}=await Zo(`${aa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Tr(e){return Zo(`${aa.v1}/user/saml/prelogin`,e)}async function Pr(e){return mr(await Zo(`${aa.v1}/user/saml/postlogin`,e))}async function Ir(e){return mr(await Zo(`${aa.v1}/user/oidc/postlogin`,e))}async function Lr(e){return mr(await Zo(`${aa.v1}/user`,e))}async function wr(e){return mr(await Zo(`${aa.v1}/user/mfa/verify`,e))}async function Or(e){return Zo(`${ra.v1}/activate`,e)}async function Er(e){return Xo(`${ra.v1}/activate/strategy`,e)}async function Cr(e){return Zo(`${ra.v1}/activate/reset`,e)}async function Dr(e){return Zo(`${ra.v1}/invitation/reset`,e)}async function Rr(e){return Zo(`${ra.v1}/invitation/accept`,e)}async function _r(){return mr(await Zo(`${aa.v1}/user/token/refresh`))}async function Ur(){return br(await Zo(`${aa.v1}/user/token/refresh`))}async function Mr(){return Zo(`${aa.v1}/logout`)}async function Nr(e){return Xo(`${Ra}/logout`,e)}async function $r(e){return Zo(`${ra.v1}/passwords/reset`,e)}async function Fr(e){return Zo(`${ra.v1}/passwords/reset/verify`,e)}async function xr(e){return Xo(`${ra.v1}/passwords/config`,e)}async function Vr(e){return Zo(`${aa.v1}/user/mfa/recover`,e)}async function jr(){return Zo(`${ra.v1}/mfa/enroll`)}async function Wr(){return Zo(`${ra.v1}/mfa/authenticator/enroll`)}async function Kr(e){return Zo(`${ra.v1}/mfa/authenticator/enroll/verify`,e)}async function Gr(e){return Zo(`${ra.v1}/mfa/sms/enroll`,e)}async function Br(e){return Zo(`${ra.v1}/mfa/sms/enroll/verify`,e)}async function zr(){return Zo(`${ra.v1}/mfa/webauthn/enroll`)}async function qr(e){return Zo(`${ra.v1}/mfa/webauthn/enroll/verify`,e)}async function Hr(e){return Zo(`${ra.v1}/mfa/enroll/verify`,e)}async function Jr(e){return Zo(`${ra.v1}/mfa/disable`,e)}async function Yr(e,t){return Zo(`${ra.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Qr(e){return Zo(`${ra.v1}/mfa/sms/${e}/disable`)}async function Xr(e,t){return Zo(`${ra.v1}/mfa/sms/${e}/disable/verify`,t)}async function Zr(e){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable`)}async function el(e,t){return Zo(`${ra.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function tl(){return Xo(`${ra.v1}/mfa/devices`)}async function nl(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll`,e)}async function il(e){return Zo(`${aa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ol(e,t){return Zo(`${aa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function al(e){return Zo(`${aa.v1}/user/mfa/sms/enroll`,e)}async function rl(e){return Zo(`${aa.v1}/user/mfa/sms/enroll/verify`,e)}async function ll(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}`,t)}async function sl(e,t){return Zo(`${aa.v1}/user/mfa/sms/${e}/verify`,t)}async function cl(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll`,e)}async function ul(e){return Zo(`${aa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function dl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}`,t)}async function yl(e,t){return Zo(`${aa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function fl(){return Xo(`${pa.v1}/saml/configurations`)}async function gl(e){return Zo(`${pa.v1}/saml/configurations`,e)}async function pl(){return Xo(`${pa.v1}/saml/configurations/vendor-config`)}async function Sl(e){return ta(`${pa.v1}/saml/configurations/metadata`,e)}async function vl(){return ta(`${pa.v1}/saml/validations/domain`)}async function hl(){return Xo(`${pa.v1}/saml/configurations/roles/default`)}async function ml(){return Xo(`${pa.v2}/saml/configurations/groups`)}async function bl({roleIds:e}){return Zo(`${pa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Al({roleIds:e,group:t}){return Zo(`${pa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function kl({roleIds:e,group:t,id:n}){return ea(`${pa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Tl({id:e}){return na(`${pa.v2}/saml/configurations/groups/${e}`)}async function Pl(){return Xo(`${pa.v1}/oidc/configurations`)}async function Il(){return Xo(`${pa.v2}/configurations/public`)}async function Ll(){return Xo(ca.v1)}async function wl(){return Xo(ca.v2)}async function Ol({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),Zo(`${aa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function El(){return Xo(`${la.v1}/public`)}async function Cl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Zo(`${ra.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await mr(n):void 0,userId:i,tenantId:o}}async function Dl(){return Xo(ra.sessions.currentUser.v1)}async function Rl(){return Xo(`${ra.sessions.currentUser.v1}/current`)}async function _l(e){return Zo(`${ra.sessions.v1}/revoke`,{userId:e})}async function Ul(){return Xo(ra.sessions.configurations.v1)}async function Ml(e){await Zo(ra.sessions.configurations.v1,e)}async function Nl(e){await na(`${ra.sessions.currentUser.v1}/${e}`)}async function $l(){await na(`${ra.sessions.currentUser.v1}/all`)}async function Fl(){return Xo(ra.apiTokens.v1)}async function xl(){return Xo(da.apiTokens.v1)}async function Vl(e){return Zo(ra.apiTokens.v1,e)}async function jl(e){return Zo(da.apiTokens.v2,e)}async function Wl({tokenId:e}){return na(`${da.apiTokens.v1}/${e}`)}async function Kl({tokenId:e}){return na(`${ra.apiTokens.v1}/${e}`)}async function Gl({userId:e}){return Xo(`${ra.v1}/${e}`)}async function Bl(e){return Xo(`${la.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function zl(e){let{type:t}=e,n=li(e,vr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function ql(e){let{type:t}=e,n=li(e,hr);return Zo(`${aa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Hl({token:e}){return Zo(da.invites.verify.v1,{token:e})}async function Jl(){return Xo(`${pa.v1}/configurations`)}async function Yl(e){return Zo(`${pa.v1}/configurations`,e)}async function Ql(e,t){return ea(`${pa.v1}/configurations/${e}`,t)}async function Xl(e){return na(`${pa.v1}/configurations/${e}`)}async function Zl(e){return Zo(`${pa.v1}/configurations/metadata`,e)}async function es(e,t){return ta(`${pa.v1}/configurations/${e}/metadata`,t)}async function ts(e,t){return Zo(`${pa.v1}/configurations/${e}/domains`,t)}async function ns(e,t){return na(`${pa.v1}/configurations/${e}/domains/${t}`)}async function is(e,t){return ta(`${pa.v1}/configurations/${e}/domains/${t}/validate`)}async function os(e){return Xo(`${pa.v1}/configurations/${e}/roles`)}async function as(e,t){return ta(`${pa.v1}/configurations/${e}/roles`,t)}async function rs(e,t){return Zo(`${pa.v1}/configurations/${e}/groups`,t)}async function ls(e,{roleIds:t,group:n,id:i}){return ea(`${pa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function ss(e,t){return na(`${pa.v1}/configurations/${e}/groups/${t}`)}async function cs(e){return Xo(`${pa.v1}/configurations/${e}/groups`)}async function us(e){return Zo(`${aa.v2}/user/sso/prelogin`,e)}async function ds(e){return mr(await Zo(`${aa.v2}/user/oidc/postlogin`,e))}async function ys(e){return Ar(await Zo(`${Ra}/token`,e))}async function fs(){return Ar(await Zo(`${Ra}/authorize/silent`))}async function gs(e){return Zo(`${ra.v1}/phone/reset`,e)}async function ps(e){return Zo(`${ra.v1}/phone/reset/verify`,e)}async function Ss(e){return Zo(`${ra.v1}/phone`,e)}async function vs(e){return Zo(`${ra.v1}/phone/verify`,e)}async function hs(e){return ta(`${ra.v1}/phone/change`,e)}async function ms(e){return Zo(`${aa.v1}/webauthn/prelogin`,e)}async function bs(e){return Zo(`${aa.v1}/webauthn/postlogin`,e)}async function As(){return Zo(oa.v1)}async function ks(e){return Zo(`${oa.v1}/verify`,e)}async function Ts(){return Xo(`${la.v1}/auth/strategies/public`)}async function Ps(){return Xo(`${la.v1}/mfa/strategies`)}async function Is(e){return Xo(`${ra.v2}/me`,null!=e?e:{addRoles:!0})}async function Ls(e){return ta(`${ra.v2}/me`,e)}async function ws(e){return ta(`${ma.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Os(e){return Zo(`${ra.v1}/passwords/change`,e)}async function Es(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 Cs(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function Ds(e){return na(`${Sa.v1}/${e.userId}`)}async function Rs(e){return ta(Sa.v1,e)}async function _s(e){return Zo(da.invites.user.v1,I({},e))}async function Us(e){return ea(da.invites.user.v1,I({},e))}async function Ms(){return na(da.invites.user.v1)}async function Ns(){return Xo(da.invites.user.v1)}async function $s(){return Xo(da.invites.configuration.v1)}async function Fs(){return Xo(va.v1)}async function xs(){return Xo(ua.v1)}async function Vs(){return Xo(`${ha.v1}/members`)}async function js(e){return Zo(`${Sa.v1}/${e.userId}/resendActivationEmail`,{})}async function Ws(e){return Zo(ra.v2,I({},e,{provider:"local"}))}async function Ks(e){return Zo(ra.invitation.resendAll.v1,I({},e))}async function Gs(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 Bs(){const e=await Xo("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const zs=async()=>Gs({entityName:"notifications"}),qs=async()=>Gs({entityName:"saml"}),Hs=async()=>Gs({entityName:"audits"}),Js=async e=>async function(e){const t=await Xo(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Ys=["dataFilters"],Qs=["templateId","dataFilters"],Xs=["dataFilters"];async function Zs(e){return Xo(`${La.v2}/tenant-reports`,e)}async function ec(e){return Xo(`${La.v2}/${e.id}/tenant-reports`)}async function tc(e){let{dataFilters:t}=e,n=li(e,Ys);return{html:await Xo(`${wa.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function nc(e){let{templateId:t,dataFilters:n}=e,i=li(e,Qs);return Zo(`${La.v2}/${t}/tenant-reports`,I({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ic(e){let{dataFilters:t}=e,n=li(e,Xs);const i=await Xo(`${wa.v1}/preview-report`,I({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function oc(e){return Zo(`${wa.v1}/tenant-reports`,e)}async function ac(e){return Xo(Oa,{params:e})}async function rc(e){return ta(`${Oa}/status`,{params:e})}async function lc(e){const{notificationId:t,pinStatus:n}=e;return ta(`${Oa}/${n}`,{notificationId:t})}async function sc(){return Zo(`${Oa}/status/mark-all-read`)}const cc=["endpoint","headerProps"];async function uc(e){return Xo(Ea,e)}async function dc(e){return Xo(`${Ea}/stats`,e)}async function yc(e){const{endpoint:t,headerProps:n}=e,i=li(e,cc);return ia(`${Ea}/export/${t}`,{properties:n},i)}const fc=["eventKey"],gc=["eventKey"],pc=()=>Xo(`${ka.v1}/slack`),Sc=()=>Xo(`${ka.v1}/slack/applications`),vc=()=>Xo(`${ka.v1}/slack/channels`),hc=e=>e.id?ea(`${ka.v1}/slack/subscription/${e.id}`,e):Zo(`${ka.v1}/slack/subscriptions`,e),mc=e=>na(`${ka.v1}/slack/subscriptions/${e.id}`),bc=e=>Zo(`${ka.v1}/slack/applications/registrations`,{code:e}),Ac=()=>Xo(`${ka.v1}/emails`),kc=e=>{let{eventKey:t}=e,n=li(e,fc);return Zo(`${ka.v1}/emails/${t}`,n)},Tc=({eventKey:e,enabled:t})=>ea(`${ka.v1}/emails/${e}`,{enabled:t}),Pc=(e,t)=>na(`${ka.v1}/emails/${e}/subscriptions/${t}`),Ic=(e,t,n)=>ta(`${ka.v1}/emails/${t}/subscriptions/${e}`,n),Lc=e=>na(`${ka.v1}/emails/${e}`),wc=()=>Xo(`${ka.v2}/sms`),Oc=e=>{let{eventKey:t}=e,n=li(e,gc);return Zo(`${ka.v2}/sms/${t}`,n)},Ec=({eventKey:e,enabled:t})=>ea(`${ka.v2}/sms/${e}`,{enabled:t}),Cc=(e,t)=>na(`${ka.v2}/sms/${e}/subscriptions/${t}`),Dc=(e,t,n)=>ta(`${ka.v2}/sms/${t}/subscriptions/${e}`,n),Rc=e=>na(`${ka.v2}/sms/${e}`),_c=()=>Xo(Da),Uc=e=>e._id?ea(`${Da}/${e._id}`,e):Zo(`${Da}/custom`,e),Mc=e=>na(`${Da}/${e}`),Nc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Xo(`${Da}/logs/?${i.toString()}`)},$c=e=>Zo(`${Da}/test`,e),Fc=e=>Zo(`${Da}/logs/${e}/retries`),xc=()=>Xo(`${Ca.v1}/categories`),Vc=e=>Xo(Ca.v1,{channels:e});async function jc(e){return ta(ba.v1,e)}async function Wc(){return Xo(ba.v1)}const Kc=["roleId"],Gc=["roleId"],Bc=["permissionId"];async function zc(){return Xo(ya.v1)}async function qc(e){return Zo(ya.v1,e)}async function Hc({roleId:e}){return na(`${ya.v1}/${e}`)}async function Jc(e){let{roleId:t}=e,n=li(e,Kc);return ea(`${ya.v1}/${t}`,n)}async function Yc(e){let{roleId:t}=e,n=li(e,Gc);return ta(`${ya.v1}/${t}/permissions`,n)}async function Qc(){return Xo(ua.v1)}async function Xc(e){let{permissionId:t}=e,n=li(e,Bc);return ta(`${ua.v1}/${t}/roles`,n)}async function Zc(){return Xo(`${ua.v1}/categories`)}async function eu(){return Xo(Ta.subscriptions.v1)}async function tu(e){return Xo(`${Ta.subscriptions.v1}/${e}`)}async function nu(e){return ta(`${Ta.subscriptions.v1}/${e}/cancellations/`,{})}async function iu(e){return ta(`${Ta.subscriptions.v1}/${e}/renewals/`,{})}async function ou(e,{paymentMethodId:t,planId:n}){return ta(`${Ta.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function au(e){return Xo(`${Ia.v1}/${e}`)}async function ru(){return Xo(`${Ia.v1}`)}async function lu(e){return ta(`${Ia.v1}/${e}/cancellations/`,{})}async function su(e){return ta(`${Ia.v1}/${e}/renewals/`,{})}async function cu(e,{paymentMethodId:t,planId:n}){return ta(`${Ia.v1}/${e}`,{paymentMethodId:t,planId:n})}async function uu(){return Xo(Ta.plans.v1)}async function du(e){return Xo(`${Ta.plans.v1}/${e}`)}async function yu(){return Xo(Ta.invoices.v1)}async function fu(e){return Xo(`${Ta.invoices.v1}/${e}`)}async function gu(e,t){return Xo(`${Ta.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const pu=["email"];async function Su(){return Xo(Ta.paymentMethods.v1)}async function vu(e){return Xo(`${Ta.paymentMethods.v1}/${e}`)}async function hu(e,t){let{email:n}=t,i=li(t,pu);return ea(`${Ta.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function mu(e){return Zo(Ta.paymentProviders.stripe.subscriptions.v1,e)}async function bu(e){return Xo(`${Ta.paymentProviders.stripe.customers.v1}/${e}`)}async function Au(e){return Zo(`${Ta.paymentProviders.stripe.customers.v1}`,e)}async function ku(){return Xo(`${Ta.paymentProviders.stripe.publicConfigurations.v1}`)}async function Tu(e){return Zo(`${Ta.paymentProviders.stripe.setupIntents.v1}`,e)}async function Pu(e){return Xo(`${Ta.summaries.v1}/${e}`)}async function Iu(e){return Xo(`${Ta.tenantConfiguration.v1}/${e}`)}async function Lu(e){return Zo(`${Ta.tenantConfiguration.v1}`,e)}async function wu(){return Xo(Pa.v1)}async function Ou(){return Xo(`${Ta.configurations.vendorPublicConfigurations.v1}`)}let Eu,Cu,Du,Ru,_u,Uu,Mu,Nu,$u,Fu,xu;async function Vu(){return Xo("/vendors/public")}async function ju(e){return Xo(fa.v1,e)}async function Wu(e){return Zo(fa.v1,e)}async function Ku(e){return na(fa.v1,e)}async function Gu(e,t){return Zo(`${fa.v1}/${e}/roles`,t)}async function Bu(e,t){return na(`${fa.v1}/${e}/roles`,t)}async function zu(e,t){return ea(`${fa.v1}/${e}/roles`,t)}async function qu(){return Xo(_a)}async function Hu(){return Xo(`${Ua}`)}async function Ju(e,t){return ea(`${Ua}/${e}`,t)}async function Yu(e){return Zo(`${Ua}`,e)}async function Qu(e){return na(`${Ua}/${e}`)}async function Xu(e){return Xo(`${Ma}/${e}/Users/count`)}async function Zu(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"}(Eu||(Eu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Cu||(Cu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Du||(Du={})),(Ru||(Ru={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(_u||(_u={})),function(e){e.CREATE="create_customer"}(Uu||(Uu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode"}(Mu||(Mu={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Nu||(Nu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}($u||($u={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Fu||(Fu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(xu||(xu={}));const ed=[`${aa.v1}/logout`,`${Ra}/logout`],td=[...ed,`${aa.v1}/user/saml/postlogin`,`${aa.v2}/user/oidc/postlogin`,`${aa.v1}/user`,`${aa.v1}/user/mfa/verify`,`${aa.v1}/user/token/refresh`,`${ra.v1}`,`${ra.v1}/signUp`,`${aa.v1}/passwordless/magiclink/postlogin`,`${aa.v1}/passwordless/code/postlogin`,`${aa.v1}/passwordless/smscode/postlogin`,`${ra.v1}/activate`,`${ra.v1}/invitation/accept`,`${Ra}/token`,`${Ra}/authorize/silent`],nd=`${aa.v1}/user/token/refresh`,id=`${Ra}/authorize/silent`,od=`${ra.v2}/me`,ad=`${ra.v2}/me/tenants`;let rd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(rd||(rd={}));const ld={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 sd={fetch:e,ContextHolder:qo,FronteggContext:Ho,api:ld,FronteggApiError:Jo,AuthStrategyEnum:yr,SocialLoginProviders:dr,ISubscriptionCancellationPolicy:Du,ISubscriptionStatus:Eu,PaymentMethodType:Cu,ProviderType:Ru};let cd,ud;function dd(e,t){const n=I({},e);return t.forEach((e=>{delete n[e]})),n}async function yd(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 fd(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"}(cd||(cd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ud||(ud={}));const gd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),pd={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Sd=I({},pd,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),vd=[{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"}],hd={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},md=I({},hd,{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}),bd={loading:!1,error:void 0,saving:!0,profile:hd},Ad={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"},kd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:yr.EmailAndPassword},Td={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Pd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Id={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Ld={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},wd={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Od=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ed={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Ld,roles:Od,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Cd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Dd={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:[vd[0]]},Rd={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:[vd[1]]},_d={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ud=[Rd,Dd],Md=[_d],Nd=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],$d=[{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"}],Fd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},xd={isActive:!0,strategy:_n.ALLOW},Vd=[{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 jd,Wd,Kd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(jd||(jd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Wd||(Wd={})),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"}(Kd||(Kd={})),Kd.profile,Kd.privacy,Kd.personalApiTokens,Kd.account,Kd.users,Kd.security,Kd.sso,Kd.audits,Kd.webhooks,Kd.apiTokens,Kd.roles,Kd.subscriptions;const Gd=["events","url"];function*Bd(){yield Bi(Hn.setSignUpState({loading:!0}));try{const e=yield Hi(ld.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*zd(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,Gd);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(ld.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:Wd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(qo.setAccessToken(null==l?void 0:l.accessToken),qo.setUser(l),!r&&l&&af(l)){const t=yield sf(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*qd(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Qi((e=>e.auth.signUpState));yield Bi(Hn.resetSignUpState()),yield Bi(Hn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Hd(){yield zo(Hn.signUpUser,zd),yield zo(Hn.resetSignUpStateSoft,qd)}const Jd={setVendorState:(e,{payload:t})=>I({},e,t)},Yd={loadVendorPublicInfo:it("vendor/loadVendorPublicInfo")},Qd={loading:!1},{reducer:Xd,actions:Zd}=at({name:It,initialState:Qd,reducers:I({},Jd)}),ey=I({},Zd,Yd);function*ty(){yield Bi(ey.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield ld.vendor.getVendorPublicInfo();yield Bi(ey.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Bi(ey.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const ny=["callback"],iy=["callback"],oy=["callback"],ay=["callback"],ry=["callback"],ly=["callback"];function*sy(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getGlobalSecurityPolicy);yield Bi(Hn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha()),yield Bi(Hn.loadPublicAuthStrategiesPolicy())}function*cy(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getVendorConfig);yield Bi(Hn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*uy(){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getVendorPublicAuthStrategiesConfig);yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*dy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getMfaPolicy);yield Bi(Hn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*yy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getVendorMfaPolicy);yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*fy(e){let{payload:{callback:t}}=e,n=li(e.payload,ny);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Hi(ld.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*gy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getLockoutPolicy);yield Bi(Hn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*py(e){let{payload:{callback:t}}=e,n=li(e.payload,iy);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Hi(ld.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*Sy(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getVendorLockoutPolicy);yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*vy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getCaptchaPolicy);yield Bi(Hn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*hy(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*my(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getVendorPasswordHistoryPolicy);yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*by(e){let{payload:{callback:t}}=e,n=li(e.payload,oy);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Hi(ld.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*Ay(){yield Bi(Hn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getPasswordConfigPolicy);yield Bi(Hn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*ky(){yield zo(Hn.loadSecurityPolicy,sy),yield Go(Hn.saveSecurityPolicyMfa,fy),yield Go(Hn.loadSecurityPolicyMfa,dy),yield Go(Hn.loadSecurityPolicyVendorMfa,yy),yield Go(Hn.saveSecurityPolicyLockout,py),yield Go(Hn.loadSecurityPolicyLockout,gy),yield Go(Hn.loadSecurityPolicyVendorLockout,Sy),yield Go(Hn.loadSecurityPolicyCaptcha,vy),yield Go(Hn.saveSecurityPolicyPasswordHistory,by),yield Go(Hn.loadSecurityPolicyPasswordHistory,hy),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,my),yield Go(Hn.loadVendorPasswordConfig,Ay),yield Go(Hn.loadPublicSecurityPolicy,cy),yield Go(Hn.loadPublicAuthStrategiesPolicy,uy)}function*Ty(){yield Bi(Hn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Bi(Hn.setSecurityPolicyPublicState({policy:kd,loading:!1}))}catch(e){yield Bi(Hn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Py(){yield Bi(Hn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyGlobalState({policy:Ad,loading:!1})),yield Bi(Hn.loadSecurityPolicyMfa()),yield Bi(Hn.loadSecurityPolicyVendorMfa()),yield Bi(Hn.loadSecurityPolicyLockout()),yield Bi(Hn.loadSecurityPolicyVendorLockout()),yield Bi(Hn.loadSecurityPolicyPasswordHistory()),yield Bi(Hn.loadSecurityPolicyVendorPasswordHistory()),yield Bi(Hn.loadSecurityPolicyCaptcha())}function*Iy(){yield Bi(Hn.setSecurityPolicyMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:Td,loading:!1}))}function*Ly(){yield Bi(Hn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorMfaState({policy:Td,loading:!1}))}function*wy(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,ay);yield Bi(Hn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=I({},Pd,{id:null!=(t=i.id)?t:Pd.id,enforceMFAType:i.enforceMFAType});yield yt(),yield Bi(Hn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Oy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Pd,loading:!1}))}function*Ey(){yield Bi(Hn.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorLockoutState({policy:Pd,loading:!1}))}function*Cy(e){let{payload:{callback:t}}=e,n=li(e.payload,ry);yield Bi(Hn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield yt();const i=I({},Pd,n,{id:n.id?n.id:Pd.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Dy(){yield Bi(Hn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyLockoutState({policy:Pd,loading:!1}))}function*Ry(){yield Bi(Hn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:Id,loading:!1}))}function*_y(){yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield yt(),yield Bi(Hn.setSecurityPolicyVendorPasswordHistoryState({policy:Id,loading:!1}))}function*Uy(e){let{payload:{callback:t}}=e,n=li(e.payload,ly);yield Bi(Hn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield yt();const i=I({},Id,n,{id:n.id?n.id:Id.id});null==t||t(i),yield Bi(Hn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*My(){yield zo(Hn.loadSecurityPolicy,Py),yield Go(Hn.loadPublicSecurityPolicy,Ty),yield Go(Hn.saveSecurityPolicyMfa,wy),yield Go(Hn.loadSecurityPolicyMfa,Iy),yield Go(Hn.loadSecurityPolicyVendorMfa,Ly),yield Go(Hn.saveSecurityPolicyLockout,Cy),yield Go(Hn.loadSecurityPolicyLockout,Oy),yield Go(Hn.loadSecurityPolicyVendorLockout,Ey),yield Go(Hn.loadSecurityPolicyCaptcha,Dy),yield Go(Hn.saveSecurityPolicyPasswordHistory,Uy),yield Go(Hn.loadSecurityPolicyPasswordHistory,Ry),yield Go(Hn.loadSecurityPolicyVendorPasswordHistory,_y)}const Ny=["callback"],$y=["callback"],Fy=["callback"],xy=["callback"],Vy=["callback","events"],jy=["callback"],Wy=["callback"],Ky=["callback"],Gy=["callback"],By=["callback"],zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback","deviceId"],Qy=["callback","deviceId"],Xy=["callback","deviceId"],Zy=["callback","deviceId"],ef={[yr.Code]:vt.loginWithOtc,[yr.EmailAndPassword]:vt.loginWithPassword,[yr.MagicLink]:vt.magicLinkPreLoginSuccess,[yr.SmsCode]:vt.loginWithSmsOtc};function*tf(){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*nf(){let e;try{var t;const n=yield Hi(ld.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*of(){try{const{isActive:e}=yield Hi(ld.auth.getSSOPublicConfiguration);yield Bi(Hn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const af=e=>e.mfaRequired&&e.mfaToken?(qo.setAccessToken(null),qo.setUser(null),!0):(qo.setAccessToken(e.accessToken),qo.setUser(e),!1),rf=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},lf=e=>{if(1===e.length){const[t]=e;if(t===$u.AuthenticatorApp)return Qt.authenticatorApp;if(t===$u.SMS)return Qt.smsSetPhoneNumber}return Qt.verify};function*sf(e){let t=vt.loginWithTwoFactor,n={};const{loginState:i}=yield Qi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Hi(ld.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:rf(e.mfaDevices)}:(n={step:lf(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*cf(){const{hostedLoginBox:e}=yield Qi((e=>e.auth));e?yield Hi(uf):yield Hi(df)}function*uf(){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(ld.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*df(){try{const n=qo.onRedirectTo,{routes:i,loginState:o}=yield Qi((e=>e.auth)),{user:a,tenants:r}=yield Hi(ld.auth.refreshTokenV2);if(af(a)){const e=yield sf(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 tf())}}catch(e){qo.setAccessToken(null),qo.setUser(null),yield Bi(Hn.setState({user:void 0,isAuthenticated:!1}))}}function*yf({payload:{callback:e}}){try{const{ip:t}=yield Hi(ld.metadata.getCurrentUserIpMetadata);yield Bi(Hn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ff({payload:e}){const t=[];e&&(yield Bi(Hn.setState({isLoading:!0})),yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Bd)),t.push(Hi(uy)),t.push(Hi(of)),t.push(Hi(ty)),t.push(Hi(nf))),t.push(Hi(cf)),yield zi(t),yield Bi(Hn.setState({isLoading:!1}))}function*gf({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(af(t)){const e=yield sf(t);yield Bi(Hn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*pf({payload:e}){const t=[];yield Bi(Hn.loadSocialLoginsConfigurationV2()),t.push(Hi(Bd)),t.push(Hi(of)),t.push(Hi(ty)),t.push(Hi(nf)),t.push(Hi(gf,e)),yield zi(t)}function*Sf({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(ld.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=fd(),r=fd(),l=yield Hi(yd,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*vf({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(ld.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 tf()}}function*hf(e){let{payload:{callback:t}}=e,n=li(e.payload,Ny);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(ld.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*mf(e){let{payload:{callback:t}}=e,n=li(e.payload,$y);try{yield Bi(Hn.setLoginState({loading:!0})),yield Hi(ld.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*bf(e){let{payload:{callback:t}}=e,n=li(e.payload,Fy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(ld.auth.passwordlessPreLogin,I({},n,{type:yr.SmsCode}));yield Bi(Hn.setLoginState({step:vt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Af(e){let{payload:{callback:t}}=e,n=li(e.payload,xy);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(ld.auth.passwordlessPreLogin,n),a=ef[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*kf(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,Vy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=yield Hi(ld.auth.passwordlessPostLogin,i),a=qo.onRedirectTo,{routes:r}=yield Qi((e=>e.auth));if(af(e)){const t=yield sf(e);yield Bi(Hn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Qi((e=>e.auth)),l=yield Hi(ld.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:jd.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 tf():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*Tf({payload:e}){try{yield Bi(Hn.setLoginState({loading:!0}));const{name:t}=yield Hi(ld.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*Pf({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(ld.auth.preLoginV2,{email:e});if(a){if(r===ud.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 If({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield If({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*If(e){let{callback:t}=e,n=li(e,jy);const i=yield Qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===yr.EmailAndPassword?(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t()):[yr.MagicLink,yr.Code,yr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Bi(Hn.passwordlessPreLogin(I({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Bi(Hn.setLoginState({step:vt.loginWithPassword,loading:!1})),null==t||t())}function*Lf({payload:{callback:e}}){try{yield Bi(Hn.setLoginState({loading:!0}));const{options:t}=yield Hi(ld.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*wf(e){let{payload:{callback:t}}=e,n=li(e.payload,Wy);try{yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey);yield Hi(ld.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*Of(e){let{payload:{callback:t}}=e,n=li(e.payload,Ky);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const{options:e}=yield Hi(ld.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*Ef(e){let{payload:{callback:t}}=e,n=li(e.payload,Gy);try{var i;yield Bi(Hn.setLoginState({loading:!0}));const e=St(n.publicKey),o=yield Hi(ld.auth.webAuthnPostLogin,I({},e,{response:I({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(af(o)){const e=qo.onRedirectTo,{routes:t}=yield Qi((e=>e.auth)),n=yield sf(o);yield Bi(Hn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Hi(ld.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 tf(),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*Cf({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(ld.auth.postLogin,e);qo.setAccessToken(t.accessToken),qo.setUser(t),yield Bi(Hn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield tf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Bi(Hn.setLoginState({step:vt.loginWithSSOFailed,loading:!1}))}}function*Df({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Bi(Hn.setLoginState({loading:!0}));try{const a=yield Hi(ld.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(af(a)){const e=yield sf(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 tf())}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*Rf({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield Bi(Hn.setLoginState({loading:!0}));try{const o=yield Hi(ld.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 tf()),null==i||i(!0)}catch(e){yield Bi(Hn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*_f({payload:e}){yield Bi(Hn.setLoginState({loading:!0}));try{yield Hi(ld.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*Uf({payload:e}){const{hostedLoginBox:t}=yield Qi((e=>e.auth));yield Bi(Hn.setState({isLoading:!0}));try{t?yield Hi(ld.auth.OAuthLogout):yield Hi(ld.auth.logout)}catch{}yield Bi(Hn.resetState()),yield Bi(Hn.requestAuthorize(!0)),null==e||e()}function*Mf({payload:e}){var t;try{yield Hi(ld.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*Nf({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*$f({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 tf()),yield Bi(Hn.setState({isAuthenticated:!0}))}function*Ff(e){let{payload:{callback:t}}=e,n=li(e.payload,By);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(ld.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*xf(e){let{payload:{callback:t}}=e,n=li(e.payload,zy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(ld.auth.enrollMFASMSForLogin,n),i=yield Hi(ld.auth.generateLoginResponseV2,e);yield Nf(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*Vf(e){let{payload:{callback:t}}=e,n=li(e.payload,qy);yield Bi(Hn.setLoginState({loading:!0}));try{var i;const e=yield Hi(ld.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*jf(e){let{payload:{callback:t}}=e,n=li(e.payload,Hy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=St(n.publicKey),i=yield Hi(ld.auth.enrollMFAWebAuthnForLogin,I({},n,{options:e})),o=yield Hi(ld.auth.generateLoginResponseV2,i);yield Nf(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*Wf(e){let{payload:{callback:t}}=e,n=li(e.payload,Jy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(ld.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Hi(ld.auth.generateLoginResponseV2,e);yield Nf(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*Kf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,Yy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(ld.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*Gf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,Qy);yield Bi(Hn.setLoginState({loading:!0}));try{const e=yield Hi(ld.auth.verifyMFASMSForLogin,n,i),o=yield Hi(ld.auth.generateLoginResponseV2,e);yield $f(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*Bf(e){let{payload:{callback:t,deviceId:n}}=e,i=li(e.payload,Xy);yield Bi(Hn.setLoginState({loading:!0}));try{var o;const e=yield Hi(ld.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*zf(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(ld.auth.verifyMFAWebAuthnForLogin,n,I({},i,{options:e})),a=yield Hi(ld.auth.generateLoginResponseV2,o);yield $f(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*qf(){yield zo(Hn.requestAuthorize,ff),yield zo(Hn.requestAuthorizeSSR,pf),yield zo(Hn.requestHostedLoginAuthorize,Sf),yield zo(Hn.handleHostedLoginCallback,vf),yield zo(Hn.preLogin,Pf),yield zo(Hn.postLogin,Cf),yield zo(Hn.login,Df),yield zo(Hn.logout,Uf),yield zo(Hn.silentLogout,Mf),yield zo(Hn.loginWithMfa,Rf),yield zo(Hn.recoverMfa,_f),yield zo(Hn.quickSmsPasswordlessPreLogin,bf),yield zo(Hn.changePhoneNumberWithVerification,hf),yield zo(Hn.verifyChangePhoneNumber,mf),yield zo(Hn.passwordlessPreLogin,Af),yield zo(Hn.passwordlessPostLogin,kf),yield zo(Hn.verifyInviteToken,Tf),yield zo(Hn.webAuthnPrelogin,Of),yield zo(Hn.webAuthnPostLogin,Ef),yield zo(Hn.webAuthnCreateNewDeviceSession,Lf),yield zo(Hn.webAuthnVerifyNewDeviceSession,wf),yield zo(Hn.afterAuthNavigation,tf),yield zo(Hn.getUserIP,yf),yield zo(Hn.preEnrollMFASMSForLogin,Ff),yield zo(Hn.enrollMFASMSForLogin,xf),yield zo(Hn.preEnrollMFAWebAuthnForLogin,Vf),yield zo(Hn.enrollMFAWebAuthnForLogin,jf),yield zo(Hn.enrollMFAAuthenticatorAppForLogin,Wf),yield zo(Hn.preVerifyMFASMSForLogin,Kf),yield zo(Hn.verifyMFASMSForLogin,Gf),yield zo(Hn.preVerifyMFAWebAuthnForLogin,Bf),yield zo(Hn.verifyMFAWebAuthnForLogin,zf)}function*Hf({payload:e}){e&&(yield Bi(Hn.setState({isLoading:!0})));const t=md;yield Bi(Hn.loadTenants()),yield Bi(Hn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Jf({payload:{callback:e}}){try{const{ip:t}=Vd[0];yield Bi(Hn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Yf(){yield zo(Hn.requestAuthorize,Hf),yield zo(Hn.afterAuthNavigation,tf),yield zo(Hn.getUserIP,Jf)}const Qf=["callback","samlVendor"],Xf=["callback","samlVendor"];function*Zf(){try{var e,t;yield Bi(Hn.setSSOState({loading:!0}));const n=yield Hi(ld.auth.getSamlConfiguration),i=yield Hi(ld.auth.getOidcConfiguration),o=yield Hi(ld.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*eg({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 gd(e[0]),o=yield Hi(ld.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*tg({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 gd(t),a=yield Hi(ld.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*ng({payload:e}){const{callback:t,samlVendor:n}=e,i=li(e,Qf),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===ud.Saml){var l,s;const e=yield Hi(ld.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=dd(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(ld.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*ig({payload:{callback:e}={}}){const t=yield Qi((e=>e.auth.ssoState.samlConfiguration));try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(ld.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*og(){try{const e=yield Hi(ld.auth.getSamlRoles),t=yield Hi(ld.auth.getSamlRolesGroups);yield Bi(Hn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}function*ag({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(ld.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield zi(e.map((e=>Hi(ld.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Bi(Hn.setSSOState({error:e.message}))}}(n)),yield og(),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*rg({payload:{callback:e,id:t}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(ld.auth.deleteSamlGroup,{id:t}),yield og(),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*lg({payload:{group:e,roleIds:t,callback:n}}){try{yield Bi(Hn.setSSOState({error:void 0,saving:!0})),yield Hi(ld.auth.createSamlGroup,{group:e,roleIds:t}),yield og(),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*sg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Bi(Hn.setSSOState({loading:!0})),yield Hi(ld.auth.oidcPostLoginV2,t),yield Hi(cf),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*cg(){yield Go(Hn.loadSSOConfigurations,Zf),yield Go(Hn.saveSSOConfigurations,ng),yield Go(Hn.saveSSOConfigurationsFile,eg),yield Go(Hn.saveSSOConfigurationsFileWithCallback,tg),yield Go(Hn.validateSSODomain,ig),yield Go(Hn.loadSSOAuthorizationRoles,og),yield Go(Hn.updateSSOAuthorizationRoles,ag),yield Go(Hn.deleteSamlGroup,rg),yield Go(Hn.createSamlGroup,lg),yield Go(Hn.oidcPostlogin,sg)}function*ug(){yield Bi(Hn.setSSOState({loading:!0})),yield yt(),yield Bi(Hn.setSSOState({samlConfiguration:Ld,loading:!1,firstLoad:!1}))}function*dg({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*yg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=li(e,Xf),r=Ed.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==wd||null==(t=wd.configuration)?void 0:t.acsUrl,l.spEntityId=null==wd||null==(n=wd.configuration)?void 0:n.spEntityId;const c=dd(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*fg({payload:{callback:e}={}}){const t=Ed.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*gg(){yield yt(),yield Bi(Hn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*pg({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*Sg(){yield Go(Hn.loadSSOConfigurations,ug),yield Go(Hn.saveSSOConfigurations,yg),yield Go(Hn.saveSSOConfigurationsFile,dg),yield Go(Hn.validateSSODomain,fg),yield Go(Hn.loadSSOAuthorizationRoles,gg),yield Go(Hn.updateSSOAuthorizationRoles,pg)}const vg=["callback"],hg=["callback","ssoConfigId"],mg=["callback","ssoConfigId"];function*bg(){try{return yield Hi(ld.auth.getOidcConfiguration)}catch(e){return null}}function*Ag(){try{return yield Hi(ld.metadata.getSamlMetadata)}catch(e){return null}}function*kg(){try{yield Bi(Hn.setSSOLoader({key:cd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield zi([Hi(bg),Hi(Ag)]),n=yield Hi(ld.auth.getSSOConfigurations);yield Bi(Hn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Bi(Hn.setSSOError({key:cd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield Bi(Hn.setSSOLoader({key:cd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Tg({payload:e}){yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=li(e,vg),i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Hi(ld.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:cd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Pg({payload:e}){yield Bi(Hn.setSSOLoader({key:cd.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 gd(t),o=yield Hi(ld.auth.createSSOConfigurationByMetadata,{metadata:e});yield Bi(Hn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Bi(Hn.setSSOError({key:cd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Ig({payload:e}){yield Bi(Hn.setSSOLoader({key:cd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=li(e,hg),o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(ld.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:cd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Lg({payload:e}){yield Bi(Hn.setSSOLoader({key:cd.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 gd(i),a=yield Hi(ld.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:cd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*wg({payload:e}){yield Bi(Hn.setSSOLoader({key:cd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(ld.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:cd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Og({payload:e}){const{callback:t,ssoConfigId:n}=e,i=li(e,mg);yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Hi(ld.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:cd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_DOMAIN,value:!1}))}}function*Eg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Bi(Hn.setSSOLoader({key:cd.DELETE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(ld.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:cd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.DELETE_SSO_DOMAIN,value:!1}))}}function*Cg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Bi(Hn.setSSOLoader({key:cd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(ld.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:cd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Dg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Bi(Hn.setSSOLoader({key:cd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(ld.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:cd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield Bi(Hn.setSSOLoader({key:cd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Rg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_GROUPS,value:!0}));const o=yield Qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(t.map((e=>Hi(ld.auth.deleteSSOGroup,n,e)))),yield zi(e.map((e=>Hi(ld.auth.createSSOGroup,n,e))));const a=yield Hi(ld.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:cd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_GROUPS,value:!1}))}}function*_g({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield zi(t.map((t=>Hi(ld.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Bi(Hn.setSSOError({key:cd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield Bi(Hn.setSSOLoader({key:cd.SAVE_SSO_GROUPS,value:!1}))}}function*Ug(){yield Go(Hn.loadSSOConfigurationsV2,kg),yield Go(Hn.saveSSOConfigurationV2,Tg),yield Go(Hn.saveSSODomain,Og),yield Go(Hn.deleteSSODomain,Eg),yield Go(Hn.validateSSODomainV2,Cg),yield Go(Hn.updateSSOConfiguration,Ig),yield Go(Hn.deleteSSOConfiguration,wg),yield Go(Hn.setSSOGroups,Rg),yield Go(Hn.updateSSOGroups,_g),yield Go(Hn.setSSODefaultRoles,Dg),yield Go(Hn.saveSSOConfigurationByMetadata,Pg),yield Go(Hn.updateSSOConfigurationByMetadata,Lg)}const Mg=["callback","profilePictureUrl"],Ng=["callback","profilePictureUrl"];function*$g(){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,ld.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*Fg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,Mg);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(ld.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(ld.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*xg({payload:e}){yield Bi(Hn.setProfileState({loading:!0}));try{var t;yield Hi(ld.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*Vg(){yield zo(Hn.loadProfile,$g),yield Go(Hn.saveProfile,Fg),yield Go(Hn.changePassword,xg)}function*jg(){yield Bi(Hn.setProfileState({loading:!0})),yield yt(),yield Bi(Hn.setUser(I({},md,hd))),yield Bi(Hn.setProfileState({loading:!1,profile:hd}))}function*Wg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=li(e.payload,Ng);yield Bi(Hn.setProfileState({saving:!0,error:null}));const o=bd;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=md;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*Kg({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*Gg(){yield zo(Hn.loadProfile,jg),yield Go(Hn.saveProfile,Wg),yield Go(Hn.changePassword,Kg)}const Bg=["callback"],zg=["callback"],qg=["callback"],Hg=["deviceId","callback"],Jg=["deviceId","callback"],Yg=["callback"],Qg=["deviceId"],Xg=["deviceId"],Zg=["callback"],ep=["deviceId"],tp=["callback"];function*np(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*ip(){yield Bi(Hn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Hi(ld.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*op(e){let{payload:{callback:t}}=e,n=li(e.payload,Bg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Qi((e=>e.auth.user)),i=yield Hi(ld.auth.verifyMfa,n),o=yield Hi(ld.auth.getMFADevices),a=yield np(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*ap(e){let{payload:{callback:t}}=e,n=li(e.payload,zg);yield Bi(Hn.setMfaState({loading:!0}));try{const e=yield Hi(ld.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*rp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;yield Hi(ld.auth.disableMfa,e);const n=yield Hi(ld.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*lp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t,n;const i=yield Hi(ld.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*sp(e){let{payload:{callback:t}}=e,n=li(e.payload,qg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(n.publicKey),i=yield Hi(ld.auth.enrollMFAWebAuthn,I({},n,{options:e})),o=yield Hi(ld.auth.getMFADevices),a=yield np(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*cp(e){let{payload:{deviceId:t,callback:n}}=e;li(e.payload,Hg),yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(ld.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*up(e){let{payload:{deviceId:t,callback:n}}=e,i=li(e.payload,Jg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=St(i.publicKey);yield Hi(ld.auth.disableMFAWebAuthn,t,I({},i,{options:e}));const o=yield Hi(ld.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*dp({payload:e}){yield Bi(Hn.setMfaState({saving:!0}));try{var t;const n=yield Hi(ld.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*yp(e){let{payload:{callback:t}}=e,n=li(e.payload,Yg);yield Bi(Hn.setMfaState({saving:!0}));try{const e=yield Hi(ld.auth.enrollMFASMS,n),i=yield Hi(ld.auth.getMFADevices),o=yield np(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*fp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,Qg);yield Bi(Hn.setMfaState({saving:!0}));try{var i;const e=yield Hi(ld.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*gp(e){let{payload:{deviceId:t}}=e,n=li(e.payload,Xg);yield Bi(Hn.setMfaState({saving:!0}));try{var i;yield Hi(ld.auth.disableMFASMS,t,n);const e=yield Hi(ld.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*pp(){yield Bi(Hn.setMfaState({loading:!0}));try{yield Qi((e=>e.auth.user));const e=yield Hi(ld.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*Sp(){yield Bi(Hn.setMfaState({loading:!0}));try{const e=(yield Hi(ld.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*vp(){yield Go(Hn.enrollMfa,ip),yield Go(Hn.getMFADevices,pp),yield Go(Hn.getMFAStrategies,Sp),yield Go(Hn.verifyMfa,op),yield Go(Hn.disableMfa,rp),yield Go(Hn.verifyMfaAfterForce,ap),yield Go(Hn.preDisableMfaSms,fp),yield Go(Hn.disableMfaSms,gp),yield Go(Hn.preEnrollMfaSms,dp),yield Go(Hn.enrollMfaSms,yp),yield Go(Hn.preEnrollMfaWebAuthn,lp),yield Go(Hn.enrollMfaWebAuthn,sp),yield Go(Hn.preDisableMfaWebAuthn,cp),yield Go(Hn.disableMfaWebAuthn,up)}function*hp(){yield Bi(Hn.setMfaState({saving:!0})),yield Bi(Hn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*mp({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({},md,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*bp(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({},md,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Ap({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({},md))),null==(t=e.callback)||t.call(e,!0)}function*kp(e){let{}=e,t=li(e.payload,ep);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*Tp({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({},md))),null==(t=e.callback)||t.call(e,!0)}function*Pp({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*Ip(e){let{payload:{callback:t}}=e;li(e.payload,tp);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({},md,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Lp(){yield Go(Hn.enrollMfa,hp),yield Go(Hn.verifyMfa,mp),yield Go(Hn.disableMfa,Ap),yield Go(Hn.verifyMfaAfterForce,bp),yield Go(Hn.preDisableMfaSms,kp),yield Go(Hn.disableMfaSms,Tp),yield Go(Hn.preEnrollMfaSms,Pp),yield Go(Hn.enrollMfaSms,Ip)}const wp=["callback"];function*Op({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(ld.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*Ep(e){let{payload:{callback:t}}=e,n=li(e.payload,wp);yield Bi(Hn.setForgotPasswordState({loading:!0}));try{yield Hi(ld.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*Cp({payload:e}){yield Bi(Hn.setForgotPasswordState({loading:!0}));try{const t=yield Hi(ld.auth.loadPasswordConfig,e);yield Bi(Hn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Bi(Hn.setForgotPasswordState({loading:!1,error:e.message}))}}function*Dp(){yield zo(Hn.forgotPassword,Op),yield zo(Hn.resetPassword,Ep),yield zo(Hn.loadPasswordConfig,Cp)}let Rp;!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"}(Rp||(Rp={}));const _p=["callback","events"],Up=["callback"],Mp=["callback"];function*Np({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(ld.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*$p(e){let{payload:{callback:t,events:n}}=e,i=li(e.payload,_p);yield Bi(Hn.setActivateState({loading:!0}));try{const e=qo.onRedirectTo,{routes:a}=yield Qi((e=>e.auth)),r=yield Hi(ld.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(af(r)){yield Bi(Hn.setActivateState({step:Et.success}));const t=yield sf(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(ld.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:jd.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 tf(),yield Bi(Hn.resetActivateState())}null==t||t(!0)}catch(e){yield Bi(Hn.setActivateState({loading:!1,error:e.message}))}}function*Fp({payload:e}){const{callback:t}=e,n=li(e,Up);yield Bi(Hn.setActivateStrategyState({loading:!0}));try{const e=yield Hi(ld.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*xp({payload:e}){const{callback:t}=e,n=li(e,Mp);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:n.email})),yield Bi(Hn.setActivateState({loading:!0}));try{yield Hi(ld.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:Rp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:!1}))}function*Vp(){yield zo(Hn.activateAccount,$p),yield zo(Hn.preActivateAccount,Np),yield zo(Hn.getActivateAccountStrategy,Fp),yield zo(Hn.resendActivationEmail,xp)}function*jp({payload:e}){if(e.token&&e.userId)try{yield Bi(Hn.setAcceptInvitationState({error:void 0,step:_t.pending})),yield Hi(ld.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*Wp(){yield zo(Hn.acceptInvitation,jp)}var Kp,Gp=new Uint8Array(16);function Bp(){if(!Kp&&!(Kp="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 Kp(Gp)}for(var zp=/^(?:[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,qp=function(e){return"string"==typeof e&&zp.test(e)},Hp=[],Jp=0;Jp<256;++Jp)Hp.push((Jp+256).toString(16).substr(1));var Yp=function(e,t,n){var i=(e=e||{}).random||(e.rng||Bp)();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=(Hp[e[t+0]]+Hp[e[t+1]]+Hp[e[t+2]]+Hp[e[t+3]]+"-"+Hp[e[t+4]]+Hp[e[t+5]]+"-"+Hp[e[t+6]]+Hp[e[t+7]]+"-"+Hp[e[t+8]]+Hp[e[t+9]]+"-"+Hp[e[t+10]]+Hp[e[t+11]]+Hp[e[t+12]]+Hp[e[t+13]]+Hp[e[t+14]]+Hp[e[t+15]]).toLowerCase();if(!qp(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const Qp=["callback"],Xp=["roles"],Zp=["callback"],eS=["callback","profileImage"],tS=["callback"],nS=["callback","userId"],iS=["callback"],oS=["callback"],aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback"],cS=["callback"],uS=["callback","profileImage"],dS=["callback"],yS=["callback"],fS=["callback"],gS=["callback"],pS=["callback"],SS=["callback"],vS=()=>Qi((e=>e.auth.teamState));function*hS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield vS(),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:Rp.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(ld.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Hi(ld.teams.loadAvailableRoles),Hi(ld.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:Rp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Bi(Hn.setTeamLoader({key:Rp.USERS,value:!1}))}function*mS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield vS(),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:Rp.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(ld.subTenants.loadAllUsers,I({},c)),Hi(ld.teams.loadAvailableRoles),Hi(ld.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:Rp.USERS,value:e.message})),yield Bi(Hn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Bi(Hn.setTeamLoader({key:Rp.USERS,value:!1}))}function*bS({payload:e}){yield Bi(Hn.setTeamLoader({key:Rp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield zi([Hi(ld.teams.loadAvailableRoles),Hi(ld.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:Rp.ROLES_AND_PERMISSIONS,value:t.message}))}yield Bi(Hn.setTeamLoader({key:Rp.ROLES_AND_PERMISSIONS,value:!0}))}function*AS({payload:e}){const{callback:t}=e,n=li(e,Qp),i=yield vS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{const e=yield Hi(ld.teams.addUser,n),{roles:o}=e,a=I({},li(e,Xp),{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*kS({payload:e}){const{callback:t}=e,n=yield vS();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(ld.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*TS({payload:e}){const{callback:t}=e,n=li(e,Zp),i=yield vS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})}));try{yield Hi(ld.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Hi(ld.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*PS({payload:e}){const{callback:t}=e,n=li(e,eS),{id:i}=n,o=yield vS(),a=o.users.find((e=>e.id===n.id));yield Bi(Hn.setTeamLoader({key:Rp.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(ld.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:Rp.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:Rp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*IS({payload:e}){const{callback:t}=e,n=li(e,tS),i=yield vS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(ld.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*LS({payload:e}){const{callback:t,userId:n}=e,i=li(e,nS),o=yield vS();yield Bi(Hn.setTeamState({addUserDialogState:I({},o.addUserDialogState,{loading:!0})}));try{yield Hi(ld.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*wS({payload:e}){const{callback:t}=e,n=li(e,iS),i=yield vS();yield Bi(Hn.setTeamState({deleteUserDialogState:I({},i.deleteUserDialogState,{loading:!0})}));try{yield Hi(ld.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*OS({payload:e}){const{callback:t}=e,n=li(e,oS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Hi(ld.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Rp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:!1}))}function*ES({payload:e}){const{callback:t}=e,n=li(e,aS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(ld.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Rp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*CS({payload:e}){const{callback:t}=e,n=li(e,rS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(ld.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Rp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*DS({payload:e}){const{callback:t}=e,n=li(e,lS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email}));try{yield Hi(ld.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Rp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*RS(){yield Bi(Hn.setTeamError({key:Rp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Hi(ld.teams.getInviteLinkConfiguration);yield Bi(Hn.setTeamState({inviteTokenState:I({},e)}))}catch(e){yield Bi(Hn.setTeamError({key:Rp.CONFIG_TOKEN_LINK,value:e.message}))}}function*_S(){yield Bi(Hn.setTeamError({key:Rp.GET_TOKEN_LINK,value:!1}));try{yield Hi(RS);const e=yield Hi(ld.teams.getInviteUserLink),{inviteTokenState:t}=yield vS();yield Bi(Hn.setTeamState({inviteTokenState:I({},t,e)}))}catch(e){yield Bi(Hn.setTeamError({key:Rp.GET_TOKEN_LINK,value:e.message}))}}function*US({payload:{callback:e}}){yield Bi(Hn.setTeamError({key:Rp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield vS();try{const n=yield Hi(ld.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:Rp.CREATE_TOKEN_LINK,value:t.message}))}}function*MS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield vS();yield Bi(Hn.setTeamError({key:Rp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Hi(ld.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:Rp.UPDATE_TOKEN_LINK,value:t.message}))}}function*NS({payload:e}){const{callback:t}=null!=e?e:{};yield Bi(Hn.setTeamError({key:Rp.DELETE_TOKEN_LINK,value:!1}));try{yield Hi(ld.teams.deleteInviteUserLink),yield Bi(Hn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Bi(Hn.setTeamError({key:Rp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*$S({payload:e}){yield Bi(Hn.setTeamState({addUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*FS({payload:e}){const t=yield vS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*xS({payload:e}){yield Bi(Hn.setTeamState({deleteUserDialogState:I({open:!0,loading:!1,error:!1},e)}))}function*VS({payload:e}){const t=yield vS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Bi(Hn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*jS(){yield Bo(Hn.loadUsers,hS),yield Bo(Hn.loadAllSubTenantsUsers,mS),yield Bo(Hn.loadRoles,bS),yield Go(Hn.addUser,AS),yield Go(Hn.addUsersBulk,kS),yield Go(Hn.addUserToSubTenants,TS),yield Go(Hn.updateUser,PS),yield Go(Hn.setUserRolesForSubTenants,LS),yield Go(Hn.deleteUser,IS),yield Go(Hn.deleteUserFromSubTenants,wS),yield Go(Hn.resendActivationLink,OS),yield Go(Hn.resendInvitationLink,ES),yield Go(Hn.resendInvitationEmail,CS),yield Go(Hn.resendInvitationLinkToAllSubTenants,DS),yield Go(Hn.getInvitationLink,_S),yield Go(Hn.createInvitationLink,US),yield Go(Hn.updateInvitationLink,MS),yield Go(Hn.deleteInvitationLink,NS),yield Go(Hn.openAddUserDialog,$S),yield Go(Hn.closeAddUserDialog,FS),yield Go(Hn.openDeleteUserDialog,xS),yield Go(Hn.closeDeleteUserDialog,VS)}function*WS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield vS(),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:Rp.USERS,value:!a})),yield Bi(Hn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield yt(),yield Bi(Hn.setTeamState({users:Ud,totalPages:2,totalItems:10,roles:Od,permissions:Cd})),yield Bi(Hn.setTeamLoader({key:Rp.USERS,value:!1})),null==r||r(Ud)}function*KS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield vS(),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:Rp.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:Md,totalPages:2,totalItems:10,roles:Od,permissions:Cd})),yield Bi(Hn.setTeamLoader({key:Rp.USERS,value:!1})),null==l||l(Md)}function*GS({payload:e}){var t;yield Bi(Hn.setTeamLoader({key:Rp.ROLES_AND_PERMISSIONS,value:!0})),yield yt(),yield Bi(Hn.setTeamState({roles:Od,permissions:Cd})),yield Bi(Hn.setTeamLoader({key:Rp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Od,permissions:Cd})}function*BS({payload:e}){const{callback:t}=e,n=li(e,sS),i=yield vS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Rd,n,{id:`${Yp()}`});null==t||t(o),yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*zS({payload:e}){const{callback:t}=e,n=li(e,cS),i=yield vS();yield Bi(Hn.setTeamState({addUserDialogState:I({},i.addUserDialogState,{loading:!0})})),yield yt();const o=I({},Rd,n,{id:`${Yp()}`});yield Bi(Hn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*qS({payload:e}){var t;const{callback:n}=e,i=li(e,uS),{id:o}=i,a=yield vS(),r=a.users.find((e=>e.id===i.id));yield Bi(Hn.setTeamLoader({key:Rp.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:Rp.UPDATE_USER,value:!1}))}function*HS({payload:e}){const{callback:t}=e,n=li(e,dS),i=yield vS();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*JS({payload:e}){const{callback:t}=e,n=li(e,yS),i=yield vS();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*YS({payload:e}){const{callback:t}=e,n=li(e,fS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:n.userId})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Rp.RESEND_ACTIVATE_LINK,value:!1}))}function*QS({payload:e}){const{callback:t}=e,n=li(e,gS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*XS({payload:e}){const{callback:t}=e,n=li(e,pS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*ZS({payload:e}){const{callback:t}=e,n=li(e,SS);yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:n.email})),yield yt(),null==t||t(!0),yield Bi(Hn.setTeamLoader({key:Rp.RESEND_INVITATION_LINK,value:!1}))}function*ev(){yield Bo(Hn.loadUsers,WS),yield Bo(Hn.loadAllSubTenantsUsers,KS),yield Bo(Hn.loadRoles,GS),yield Go(Hn.addUser,BS),yield Go(Hn.addUserToSubTenants,zS),yield Go(Hn.updateUser,qS),yield Go(Hn.deleteUser,HS),yield Go(Hn.deleteUserFromSubTenants,JS),yield Go(Hn.resendActivationLink,YS),yield Go(Hn.resendInvitationLink,QS),yield Go(Hn.resendInvitationEmail,XS),yield Go(Hn.resendInvitationLinkToAllSubTenants,ZS),yield Go(Hn.openAddUserDialog,$S),yield Go(Hn.closeAddUserDialog,FS),yield Go(Hn.openDeleteUserDialog,xS),yield Go(Hn.closeDeleteUserDialog,VS)}const tv=["authorizationUrl"],nv=["events","url"];function*iv(){try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const e=yield Hi(ld.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*ov(){try{const e=yield Qi((e=>e.root.context));yield Bi(Hn.setSocialLoginsState({loading:!0}));const t=(yield Hi(ld.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=li(t,tv);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*av(e){let{payload:{events:t,url:n}}=e,i=li(e.payload,nv);try{yield Bi(Hn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Hi(ld.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Wd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:jd.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 cf(),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*rv({payload:e}){yield Bi(Hn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*lv(){yield zo(Hn.loadSocialLoginsConfiguration,iv),yield zo(Hn.loadSocialLoginsConfigurationV2,ov),yield zo(Hn.loginViaSocialLogin,av),yield Bo(Hn.setSocialLoginError,rv)}let sv;function*cv({payload:e}){yield Bi(Hn.setApiTokensState({apiTokenType:e}));try{if(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})),"user"===e){const e=yield Hi(ld.auth.getUserApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{const e=yield Hi(ld.auth.getTenantApiTokensData),{items:t}=yield Hi(ld.teams.loadAvailableRoles),{items:n}=yield Hi(ld.teams.loadAvailablePermissions);yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=e?e:[],roles:null!=t?t:[],permissions:null!=n?n:[]}))}yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:sv.LOAD_API_TOKENS,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1}))}}function*uv({payload:e}){const{description:t,callback:n}=e,{apiTokensDataUser:i}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:sv.ADD_API_TOKEN,value:!0}));const e=yield Hi(ld.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:sv.ADD_API_TOKEN,value:!1})),null==n||n(null)}catch(e){yield Bi(Hn.setApiTokensError({key:sv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:sv.ADD_API_TOKEN,value:!1})),null==n||n(null,e.message)}}function*dv({payload:e}){const{description:t,roleIds:n,callback:i}=e,{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:sv.ADD_API_TOKEN,value:!0}));const e=yield Hi(ld.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:sv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Bi(Hn.setApiTokensError({key:sv.ADD_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:sv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*yv({payload:e}){const{apiTokensDataUser:t}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!0})),yield Hi(ld.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:sv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:sv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!1}))}}function*fv({payload:e}){const{apiTokensDataTenant:t}=yield Qi((e=>e.auth.apiTokensState));try{yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!0})),yield Hi(ld.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:sv.DELETE_API_TOKEN,value:!1}))}catch(e){yield Bi(Hn.setApiTokensError({key:sv.DELETE_API_TOKEN,value:e.message})),yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!1}))}}function*gv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield zi([Hi(ld.auth.getUserApiTokensData),Hi(ld.auth.getTenantApiTokensData)]);yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:sv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*pv({payload:e}){null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Hi(ld.auth.getUserApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=n?n:[]})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:sv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:sv.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:sv.LOAD_API_TOKENS,value:!0})));try{var t;const n=yield Hi(ld.auth.getTenantApiTokensData);yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=n?n:[]})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Bi(Hn.setApiTokensError({key:sv.LOAD_API_TOKENS,value:t.message})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*vv(){yield zo(Hn.loadApiTokens,gv),yield zo(Hn.loadUserApiTokens,pv),yield zo(Hn.loadTenantApiTokens,Sv),yield zo(Hn.initApiTokensData,cv),yield Go(Hn.addUserApiToken,uv),yield Go(Hn.addTenantApiToken,dv),yield Bo(Hn.deleteTenantApiToken,fv),yield Bo(Hn.deleteUserApiToken,yv)}function*hv({payload:e}){if(yield Bi(Hn.setApiTokensState({apiTokenType:e})),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})),"user"===e){yield Xi(200);const e=[pd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:null!=e?e:[]}))}else{var t;yield Xi(200),yield Bi(Hn.setApiTokensState({apiTokensDataTenant:null!=(t=[Sd])?t:[],roles:null!=Od?Od:[],permissions:null!=Cd?Cd:[]}))}yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1}))}function*mv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Bi(Hn.setApiTokensLoader({key:sv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Qi((e=>e.auth.apiTokensState)),a=I({},Sd,{description:t,roleIds:n,clientId:`CLIENT_ID_${Yp()}`});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:sv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*bv({payload:e}){yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!0})),yield Xi(200);const t=[Sd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Bi(Hn.setApiTokensLoader({key:sv.DELETE_API_TOKEN,value:!1}))}function*Av({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})));const n=[pd],i=[Sd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*kv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})));const n=[pd];yield Bi(Hn.setApiTokensState({apiTokensDataUser:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Tv({payload:e}){var t;null!=e&&e.silentLoading||(yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!0})));const n=[Sd];yield Bi(Hn.setApiTokensState({apiTokensDataTenant:n})),yield Xi(200),yield Bi(Hn.setApiTokensLoader({key:sv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Pv(){yield zo(Hn.loadApiTokens,Av),yield zo(Hn.loadUserApiTokens,kv),yield zo(Hn.loadTenantApiTokens,Tv),yield zo(Hn.initApiTokensData,hv),yield Go(Hn.addTenantApiToken,mv),yield Bo(Hn.deleteTenantApiToken,bv)}function*Iv({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(ld.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*Lv({payload:e}){yield Bi(Hn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Hi(ld.accountSettings.getSettings);yield Bi(Hn.setAccountSettingsState(I({},e,{loading:!1})))}catch(e){yield Bi(Hn.setAccountSettingsState({loading:!1,error:e.message}))}}function*wv(){yield zo(Hn.saveAccountSettings,Iv),yield zo(Hn.loadAccountSettings,Lv)}function*Ov({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*Ev({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*Cv(){yield zo(Hn.saveAccountSettings,Ov),yield zo(Hn.loadAccountSettings,Ev)}function*Dv({payload:{tenantId:e,callback:t}}){yield Bi(Hn.setState({isLoading:!0}));try{yield Hi(ld.tenants.switchTenant,{tenantId:e}),yield Hi(cf),(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*Rv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(ld.tenants.getTenants);yield Bi(Hn.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield Bi(Hn.setTenantsState({loading:!1}))}}function*_v({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(ld.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*Uv({payload:e}){yield Bi(Hn.setTenantsState({loading:!0}));try{var t;const n=yield Hi(ld.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*Mv(){yield Go(Hn.loadTenants,Rv),yield Go(Hn.loadSubTenants,_v),yield Go(Hn.switchTenant,Dv),yield Go(Hn.loadSubTenantsTree,Uv)}function*Nv(){yield Bi(Hn.setTenantsState({loading:!0})),yield yt(),yield Bi(Hn.setTenantsState({tenants:Nd,loading:!1}))}function*$v(){yield Go(Hn.loadTenants,Nv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(sv||(sv={}));const Fv=["callback"],xv=["callback"],Vv=["callback"],jv=["callback"],Wv=["callback"];function*Kv({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(ld.roles.getRoles),Hi(ld.roles.getPermissions),Hi(ld.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*Gv(e){let{payload:{callback:t}}=e,n=li(e.payload,Fv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(ld.roles.addRole,n),i=yield Hi(ld.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*Bv(e){let{payload:{callback:t}}=e,n=li(e.payload,xv);yield Bi(Hn.setRolesState({saving:!0}));try{yield Hi(ld.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*zv(e){let{payload:{callback:t}}=e,n=li(e.payload,Vv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(ld.roles.updateRole,n);yield Bi(Hn.loadRolesAndPermissions({silentLoading:!0})),yield Bi(Hn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Bi(Hn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*qv(e){let{payload:{callback:t}}=e,n=li(e.payload,jv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(ld.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*Hv(e){let{payload:{callback:t}}=e,n=li(e.payload,Wv);yield Bi(Hn.setRolesState({saving:!0}));try{const e=yield Hi(ld.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*Jv(){yield zo(Hn.loadRolesAndPermissions,Kv),yield Go(Hn.addRole,Gv),yield Go(Hn.deleteRole,Bv),yield Go(Hn.updateRole,zv),yield Go(Hn.attachPermissionsToRole,qv),yield Go(Hn.attachPermissionToRoles,Hv)}function*Yv({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:vd,loading:!1}))}catch(e){yield Bi(Hn.setRolesState({error:e.message,loading:!1}))}}function*Qv(){yield zo(Hn.loadRolesAndPermissions,Yv)}const Xv=["callback"],Zv=["callback"],eh=["callback"];function*th(e){let{payload:{callback:t}}=e,n=li(e.payload,Xv);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(ld.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*nh(e){let{payload:{callback:t}}=e,n=li(e.payload,Zv);yield Bi(Hn.setResetPhoneNumberState({loading:!0}));try{const e=yield Hi(ld.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*ih(e){let{payload:{callback:t}}=e,n=li(e.payload,eh);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(ld.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Bi(Hn.setLoginState({step:vt.loginWithSmsOtc})),yield Bi(Hn.passwordlessPreLogin({type:yr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Bi(Hn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Bi(Hn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*oh(){yield zo(Hn.resetPhoneNumber,th),yield zo(Hn.verifyResetPhoneNumber,nh),yield zo(Hn.changePhoneNumber,ih)}function*ah(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getCurrentUserSessions);yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*rh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getCurrentUserSession);yield Bi(Hn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*lh({payload:{id:e}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(ld.auth.deleteSessionForUser,e),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*sh({payload:{callback:e,userId:t}}){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(ld.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Bi(Hn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*ch(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));try{yield Hi(ld.auth.deleteAllSessionsForUser),yield Bi(Hn.loadUserSessions())}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*uh(){yield Bo(Hn.loadUserSessions,ah),yield Bo(Hn.deleteUserSession,lh),yield Bo(Hn.deleteAllUserSessions,ch),yield Bo(Hn.loadCurrentUserSession,rh),yield Go(Hn.revokeUserSessions,sh)}function*dh(){yield Bi(Hn.setSessionsState({loading:!0,error:null})),yield Bi(Hn.setSessionsState({sessions:$d,loading:!1}))}function*yh({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*fh(){yield Bi(Hn.setSessionsState({loading:!0,error:null}));const e=$d.filter((e=>e.current));yield Bi(Hn.setSessionsState({sessions:e,loading:!1}))}function*gh(){yield Bo(Hn.loadUserSessions,dh),yield Bo(Hn.deleteUserSession,yh),yield Bo(Hn.deleteAllUserSessions,fh)}const ph=["callback"],Sh=["callback"];function*vh(){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getSessionConfigurations);yield Bi(Hn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Bi(Hn.setSessionsState({error:e,loading:!1}))}}function*hh({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=li(e,ph);yield Hi(ld.auth.createOrUpdateSessionConfigrations,n),yield Bi(Hn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Bi(Hn.setSessionsPolicyState({error:e,loading:!1}))}}function*mh(){yield zo(Hn.loadSessionsPolicy,vh),yield Bo(Hn.createOrUpdateSessionsPolicy,hh)}function*bh(){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:Fd}));yield Bi(Hn.setSessionsPolicyState(I({},e,{loading:!1})))}function*Ah({payload:e}){yield Bi(Hn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=li(e,Sh);null==t||t(!0),yield Bi(Hn.setSessionsPolicyState({configurations:n,loading:!1}))}function*kh(){yield zo(Hn.loadSessionsPolicy,bh),yield Bo(Hn.createOrUpdateSessionsPolicy,Ah)}const Th=["callback"],Ph=["callback"],Ih=["callback"],Lh=["callback"],wh=["callback"],Oh=["callback"],Eh=["callback"],Ch=["callback"],Dh=()=>Qi((e=>e.auth.restrictionsState.ipRestrictions)),Rh=()=>Qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*_h(){yield Bi(Hn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Hi(ld.auth.getDomainRestrictionsConfig),t=(yield Hi(ld.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*Uh(e){let{payload:{callback:t}}=e,n=li(e.payload,Th);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Rh();try{var o;yield Hi(ld.auth.createDomainRestriction,n);const e=(yield Hi(ld.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*Mh(e){let{payload:{callback:t}}=e,n=li(e.payload,Ph);yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Hi(ld.auth.updateDomainRestrictionConfig,n),i=(yield Hi(ld.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*Nh({payload:{id:e}}){yield Bi(Hn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Rh();try{var n;yield Hi(ld.auth.deleteDomainRestriction,e);const i=(yield Hi(ld.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 $h=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*Fh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Dh(),t=yield Hi(ld.auth.getIPRestrictionsConfig),n=$h({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Hi(ld.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*xh(){try{const{valid:e}=yield Hi(ld.auth.testCurrentIpInAllowList);yield Bi(Hn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message}))}}function*Vh({payload:{callback:e}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Qi((e=>e.auth.userIp));yield zi([Hi(ld.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:_n.ALLOW}),Hi(ld.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Dh(),i=$h(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Hi(ld.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*jh(e){let{payload:{callback:t}}=e,n=li(e.payload,Ih);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Dh();try{var o,a;yield Hi(ld.auth.createIPRestriction,n);const e=yield Dh(),r=$h(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Hi(ld.auth.getIPRestrictions,r);yield xh(),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*Wh(e){let{payload:{callback:t}}=e,n=li(e.payload,Lh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));try{yield Hi(ld.auth.updateIPRestrictionConfig,n);const e=yield Dh(),i=yield Hi(ld.auth.getIPRestrictionsConfig),o=$h(I({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Hi(ld.auth.getIPRestrictions,o);yield xh(),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*Kh({payload:{id:e,callback:t}}){yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Dh();try{var i;yield Hi(ld.auth.deleteIPRestriction,e);const o=yield Dh(),a=$h(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Hi(ld.auth.getIPRestrictions,a);yield xh(),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*Gh(){yield zo(Hn.loadIpRestrictions,Fh),yield zo(Hn.loadEmailDomainRestrictions,_h),yield Go(Hn.saveIpRestriction,jh),yield Go(Hn.saveIpRestrictionsConfig,Wh),yield Go(Hn.deleteIpRestriction,Kh),yield Go(Hn.checkIfUserIpValid,xh),yield Go(Hn.addCurrentUserIpAndActivate,Vh),yield Go(Hn.saveEmailDomainRestriction,Uh),yield Go(Hn.saveEmailDomainRestrictionsConfig,Mh),yield Go(Hn.deleteEmailDomainRestriction,Nh)}function*Bh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null})),yield Bi(Hn.setIpRestrictionsState({data:{restrictions:Vd.filter((e=>e.strategy===xd.strategy)),config:xd},totalPages:1,pagination:{_filter:_n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*zh(){yield Bi(Hn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Dh(),t=Vd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Bi(Hn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Bi(Hn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*qh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,wh);yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const r=yield Dh(),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:Yp(),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*Hh(e){var t,n,i;let{payload:{callback:o}}=e,a=li(e.payload,Oh);const r=yield Dh();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*Jh({payload:{id:e,callback:t}}){var n;yield Bi(Hn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Dh();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*Yh(){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*Qh(e){var t,n;let{payload:{callback:i}}=e,o=li(e.payload,Eh);const a=yield Rh();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*Xh(e){var t;let{payload:{callback:n}}=e,i=li(e.payload,Ch);const o=yield Rh();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 Rh();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*em(){yield zo(Hn.loadIpRestrictions,Bh),yield zo(Hn.loadEmailDomainRestrictions,Yh),yield Go(Hn.saveIpRestriction,qh),yield Go(Hn.saveIpRestrictionsConfig,Hh),yield Go(Hn.deleteIpRestriction,Jh),yield Go(Hn.checkIfUserIpValid,zh),yield Go(Hn.saveEmailDomainRestriction,Qh),yield Go(Hn.saveEmailDomainRestrictionsConfig,Xh),yield Go(Hn.deleteEmailDomainRestriction,Zh)}const tm=["callback"],nm=["id"];function*im(e){const{count:t}=yield Hi(ld.directory.countConfigurationUsers,e.id);return I({},e,{count:t})}function*om(){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(ld.directory.getConfigs),t=yield zi(e.map((e=>im(e))));yield Bi(Hn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*am(e){let{payload:{callback:t}}=e,n=li(e.payload,tm);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{const e=yield Hi(ld.directory.createConfiguration,n),i=yield Hi(ld.directory.getConfigs),o=yield zi(i.map((e=>im(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*rm(e){let{payload:{id:t}}=e,n=li(e.payload,nm);yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(ld.directory.updateConfiguration,t,n);const e=yield Hi(ld.directory.getConfigs),i=yield zi(e.map((e=>im(e))));yield Bi(Hn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Bi(Hn.setProvisioningState({error:e.message,loading:!1}))}}function*lm({payload:{id:e,callback:t}}){yield Bi(Hn.setProvisioningState({loading:!0,error:null}));try{yield Hi(ld.directory.deleteConfiguration,e);const n=yield Hi(ld.directory.getConfigs),i=yield zi(n.map((e=>im(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*sm(){yield zo(Hn.loadProvisionConnections,om),yield Go(Hn.createProvisionConnection,am),yield Go(Hn.deleteProvisionConnection,lm),yield Go(Hn.updateProvisionConnection,rm)}const cm=["callback","events"];function*um(e){let{payload:{callback:t}}=e,n=li(e.payload,cm);yield Bi(Hn.setImpersonateState({loading:!0}));try{yield Hi(ld.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*dm(){yield zo(Hn.impersonate,um)}var ym={sagas:function*(){yield zi([Hi(qf),Hi(Vp),Hi(Wp),Hi(Dp),Hi(oh),Hi(cg),Hi(Ug),Hi(Vg),Hi(vp),Hi(jS),Hi(lv),Hi(Hd),Hi(vv),Hi(ky),Hi(wv),Hi(Mv),Hi(Jv),Hi(uh),Hi(mh),Hi(Gh),Hi(sm),Hi(dm)])},mockSagas:function*(){yield zi([Hi(Yf),Hi(Sg),Hi(Gg),Hi(Lp),Hi(ev),Hi(Pv),Hi(My),Hi(gh),Hi(Cv),Hi($v),Hi(kh),Hi(em),Hi(Qv)])},storeName:kt,initialState:jn,reducer:zn,actions:Hn};const fm=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>I({},t,{[e]:I({},t[e],n)})}),gm={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},pm={setAuditLogsState:fm("auditLogsState"),resetAuditLogsState:e=>I({},e,{auditLogsState:gm})},Sm={exportAuditsCsv:it("auditLogs/exportAuditsCsv"),loadAuditLogs:it("auditLogs/loadAuditLogs",(e=>({payload:e})))},vm={loading:!0},hm={setAuditsMetadataState:fm("auditsMetadataState"),resetAuditsMetadataState:e=>I({},e,{auditsMetadataState:vm})},mm={loadAuditsMetadata:it("auditLogs/loadAuditsMetadata")},bm={auditLogsState:gm,auditsMetadataState:vm},{reducer:Am,actions:km}=at({name:Pt,initialState:bm,reducers:I({resetState:e=>I({},e,bm),setState:(e,{payload:t})=>I({},e,t)},pm,hm)}),Tm=I({},km,Sm,mm),Pm=e=>"createdAt"!==e.id,Im={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`})))},Lm={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}]},wm=()=>Qi((e=>e.auditLogs.auditLogsState)),Om=()=>Qi((e=>e.auditLogs.auditsMetadataState));function*Em(){const e=yield wm(),{columns:t}=yield Om();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(Tm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield ld.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(Tm.setAuditLogsState({isDownloadingCsv:!1}))}function*Cm({payload:e}){yield Bi(Tm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield wm(),{columns:n}=yield Om();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(Tm.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(Tm.loadAuditsMetadata()));const{data:g,total:p}=yield Hi(ld.audits.getAudits,I({offset:c,count:s},y,f));yield Bi(Tm.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(Tm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Dm(){yield Go(Tm.exportAuditsCsv,Em),yield Go(Tm.loadAuditLogs,Cm)}function*Rm({payload:e}){yield Bi(Tm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield wm(),{columns:n}=yield Om();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(Tm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Bi(Tm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Im;let i=n.filter((e=>t=>e.filter(Pm).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(Tm.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(Tm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*_m(){yield Go(Tm.loadAuditLogs,Rm)}function*Um(){yield Bi(Tm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Hi(ld.metadata.getAuditsMetadata);yield Bi(Tm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(Tm.setAuditsMetadataState({error:e,loading:!1}))}}function*Mm(){yield Go(Tm.loadAuditsMetadata,Um)}function*Nm(){yield Bi(Tm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Lm;yield Bi(Tm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Bi(Tm.setAuditsMetadataState({error:e,loading:!1}))}}function*$m(){yield Go(Tm.loadAuditsMetadata,Nm)}var Fm={sagas:function*(){yield zi([Hi(Dm),Hi(Mm)])},mockSagas:function*(){yield zi([Hi(_m),Hi($m)])},storeName:Pt,initialState:bm,reducer:Am,actions:Tm};const xm={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:Vm,actions:jm,reducer:Wm}=at({name:"audits",initialState:xm,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]})))}}}),Km=I({},jm,{initData:it(`${Vm}/initData`),loadAudits:it(`${Vm}/loadAudits`),removeFilter:it(`${Vm}/removeFilter`),filterData:it(`${Vm}/filterData`),exportCSV:it(`${Vm}/exportCSV`),deleteAudits:it(`${Vm}/deleteAudits`)}),Gm=()=>Qi((e=>e[Vm]));function*Bm(){const{sortBy:e,sortDirection:t}=yield Gm();try{const n=yield Hi(ld.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Bi(Km.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Bi(Km.loadItemFailedAction(t))}}function*zm(){try{const e=yield Hi(ld.metadata.getAuditsMetadata);yield Bi(Km.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Bi(Km.loadItemFailedAction(t))}}const qm=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Hm({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield Gm(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield Gm():{rowsData:[]};try{const e=qm(t),{data:l,total:d}=yield Hi(ld.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(Km.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Bi(Km.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Bi(Km.loadItemFailedAction(t))}}function*Jm(){yield Bi(Km.startLoading()),yield zi([Bm(),zm(),Hm({payload:{onlyOneLoad:!1},type:""})]),yield Bi(Km.finishLoading())}function*Ym({payload:e}){const{filters:t}=yield Gm(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Bi(Km.setFilterData(i))}function*Qm({payload:e}){const{filters:t}=yield Gm();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(Km.setFilterData(i))}function*Xm(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield Gm(),a=qm(e);yield Bi(Km.startDownloadingCsv());try{yield ld.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(Km.stopDownloadingCsv())}}function*Zm(){yield Bo(Km.initData,Jm),yield Bo(Km.removeFilter,Ym),yield Bo(Km.filterData,Qm),yield Bo([Km.loadAudits,Km.textSearch,Km.onPageChange],Hm),yield Bo([Km.setFilterData,Km.setDataSorting,Km.startRefresh],(()=>Hm({payload:{appendMode:!1},type:""}))),yield Bo(Km.exportCSV,Xm)}const eb={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},tb={initData:()=>I({},eb),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)})}},nb={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}})))},ib={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:ob,actions:ab}=at({name:Tt,initialState:ib,reducers:I({},tb)}),rb=I({},ab,nb),lb={slack:ld.connectivity.getSlackConfiguration,email:ld.connectivity.getEmailConfiguration,sms:ld.connectivity.getSMSConfiguration,webhook:ld.connectivity.getWebhooksConfigurations,categories:ld.connectivity.getCategories,channelMap:ld.connectivity.getChannelMaps},sb={slack:ld.connectivity.postSlackConfiguration,email:ld.connectivity.postEmailConfiguration,sms:ld.connectivity.postSMSConfiguration,webhook:ld.connectivity.postWebhooksConfiguration},cb=["email","slack","sms","webhook"],ub={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"}},db=["id"],yb=["id","enabled"],fb=["categories","channelMap"];function*gb(e){return yield Hi(Sb,{payload:{api:e},type:""})}function*pb({payload:e=cb}){yield Bi(rb.setConnectivityState({isLoading:!0}));try{const t=yield zi([...e.map(gb),yield Sb({payload:{api:"categories"},type:""}),yield function*(){return(yield zi(e.map((function*(e){return yield Sb({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>I({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Sb({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:ub[e[o]].events(i),active:ub[e[o]].isActive(i),platform:ub[e[o]].title,image:ub[e[o]].image}]}):n:I({},n,{[`${fb[o-e.length]}`]:i})),{list:[],webhook:n});yield Bi(rb.setConnectivityState(I({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Bi(rb.setConnectivityState({isLoading:!1}))}}function*Sb({payload:{api:e,params:t}}){try{return yield Hi(lb[e],t)}catch(e){return}}function*vb(){try{yield Bi(rb.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Hi(ld.connectivity.getSlackChannels);yield Bi(rb.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Bi(rb.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*hb(e,t){const{connectivity:{list:n}}=yield Qi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=ub[e].isActive(t);o!==i.active&&(yield Bi(rb.setConnectivityState({list:n.map((t=>t.key===e?I({},t,{active:o}):t))})))}function*mb({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Qi((e=>e.connectivity));try{if(yield Bi(rb.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,db);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(sb.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Hi(ld.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?ld.connectivity.postEmailConfiguration:ld.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,yb);return yield zi([yield Hi("email"===t?ld.connectivity.patchEmailConfiguration:ld.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Hi("email"===t?ld.connectivity.putEmailSubscriptions:ld.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?ld.connectivity.deleteEmailSubscriptions:ld.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Sb({payload:{api:t},type:""});yield Bi(rb.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield hb(t,e)}else yield Bi(rb.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Hi(sb[e],t),!["sms","email"].includes(e)){const o=yield Sb({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Bi(rb.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield hb(e,o),null==n||n(!0)}}catch(e){var o;yield Bi(rb.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*bb({payload:e}){try{yield ld.connectivity.postSlackCode(e)}catch{}yield Bi(rb.setConnectivityState({error:void 0,isSaving:!1}))}function*Ab(){const{slackChannels:e}=yield Qi((e=>e.connectivity));try{yield Bi(rb.setConnectivityState({slackChannels:I({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Hi(ld.connectivity.getSlackScope);yield Bi(rb.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Bi(rb.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*kb({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Qi((e=>e.connectivity));try{yield Bi(rb.setConnectivityState({isSaving:!0})),yield Hi(ld.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Sb({payload:{api:"webhook"},type:""});o&&(yield Bi(rb.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Tb({payload:e}){try{yield Bi(rb.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Hi(ld.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Bi(rb.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Bi(rb.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Bi(rb.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Pb({payload:e}){try{const{statusCode:t}=yield Hi(ld.connectivity.postWebhookRetry,e);yield Bi(rb.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Bi(rb.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Ib({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Qi((e=>e.connectivity));try{yield Bi(rb.setConnectivityState({webhookLogs:I({},i,{isLoading:!0})}));const o=yield Hi(ld.connectivity.getWebhookLog,e,n,t);yield Bi(rb.setConnectivityState({error:void 0,webhookLogs:I({isLoading:!1},o)}))}catch(e){yield Bi(rb.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Lb={sagas:function*(){yield Go(rb.loadDataAction,pb),yield Bo(rb.loadSlackActions,vb),yield Go(rb.postDataAction,mb),yield Go(rb.postCodeAction,bb),yield Go(rb.loadScope,Ab),yield Go(rb.deleteWebhookConfigAction,kb),yield Go(rb.postWebhookTestAction,Tb),yield Go(rb.postWebhookRetryAction,Pb),yield Bo(rb.loadWebhookLogsAction,Ib)},storeName:Tt,initialState:ib,reducer:ob,actions:rb};function wb(){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 Ob(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>I({},n,{[e]:t(n[e],i)})}}function Eb(e){return Ob(e,((e,t)=>I({},e,{loading:t.payload})))}function Cb(e){return Ob(e,((e,t)=>I({},e,{error:t.payload,loading:!1})))}const Db={loading:!1,error:null,fetching:!0,plans:[]},{actions:Rb,reducer:_b,name:Ub}=at({name:"subscriptions/plans",initialState:Db,reducers:I({},wb())}),Mb=I({loadPlans:it(`${Ub}/loadPlans`)},Rb),Nb={loading:!1,error:null,fetching:!0,config:null},$b=I({},wb()),{actions:Fb,reducer:xb,name:Vb}=at({name:"subscriptions/config",initialState:Nb,reducers:$b}),jb=I({loadPaymentConfiguration:it(`${Vb}/loadPaymentConfiguration`)},Fb),Wb={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Kb=I({},wb(),{setCancellationLoading:Eb("cancellation"),setCancellationError:Cb("cancellation"),setRenewalLoading:Eb("renewal"),setRenewalError:Cb("renewal")}),{reducer:Gb,actions:Bb,name:zb}=at({name:"subscriptions/billing/subscription",initialState:Wb,reducers:Kb}),qb=I({load:it(`${zb}/loadSubscription`),cancelSubscription:it(`${zb}/cancelSubscription`),renewSubscription:it(`${zb}/renewSubscription`)},Bb),Hb={loading:!1,error:null,fetching:!0},Jb=I({},wb()),{reducer:Yb,actions:Qb,name:Xb}=at({name:"subscriptions/billing/information",initialState:Hb,reducers:Jb}),Zb=I({loadBillingInformation:it(`${Xb}/loadBillingInformation`),cancelSubscription:qb.cancelSubscription,renewSubscription:qb.renewSubscription},Qb),eA={loading:!1,error:null,fetching:!0},tA=I({},wb(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,t.payload)}}),{reducer:nA,actions:iA,name:oA}=at({name:"subscriptions/billing/payment",initialState:eA,reducers:tA}),aA=I({loadPaymentMethod:it(`${oA}/loadPaymentMethod`),submitPaymentMethod:it(`${oA}/submitPaymentMethod`),submitPaymentMethodError:it(`${oA}/submitPaymentMethodError`),submitPaymentMethodSuccess:it(`${oA}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:it(`${oA}/updateBillingDetails`,(e=>({payload:e})))},iA),rA={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},lA=I({},wb(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>I({},e,{invoiceDownload:I({},e.invoiceDownload,t.payload)})}}),{reducer:sA,actions:cA,name:uA}=at({name:"subscriptions/billing/invoices",initialState:rA,reducers:lA}),dA=I({loadInvoices:it(`${uA}/loadInvoices`),downloadInvoice:it(`${uA}/downloadInvoice`,(e=>({payload:e})))},cA),yA={information:Hb,invoices:rA,paymentMethod:eA,subscription:Wb},fA={invoices:dA,information:Zb,paymentMethod:aA,subscription:qb},gA=$e({invoices:sA,information:Yb,paymentMethod:nA,subscription:Gb}),pA={fetching:!0,loading:!1,error:null,confirmed:!1},SA=I({},wb()),{actions:vA,reducer:hA,name:mA}=at({name:"subscriptions/checkout",initialState:pA,reducers:SA}),bA=I({loadCheckout:it(`${mA}/loadCheckout`),resetCheckout:it(`${mA}/resetCheckout`),submitCheckout:it(`${mA}/submitCheckout`),confirmCheckout:it(`${mA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:it(`${mA}/errorCheckout`,(e=>({payload:e})))},vA),AA={loading:!1,error:null,cardSetupIntentSecret:null},kA=I({},wb()),{reducer:TA,actions:PA,name:IA}=at({name:"subscriptions/stripe",initialState:AA,reducers:kA}),LA=I({loadCustomer:it(`${IA}/loadCustomer`),createCardSetupIntentSecret:it(`${IA}/createCardSetupIntentSecret`)},PA),wA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:OA,reducer:EA,name:CA}=at({name:"subscriptions/vendorPublicConfig",initialState:wA,reducers:I({},wb())}),DA=I({loadVendorPublicConfiguration:it(`${CA}/loadVendorPublicConfiguration`)},OA),RA={config:Nb,plans:Db,checkout:pA,billing:yA,stripe:AA,vendorPublicConfig:wA},_A={config:jb,billing:fA,plans:Mb,checkout:bA,stripe:LA,vendorPublicConfig:DA},UA=$e({config:xb,billing:gA,plans:_b,checkout:hA,stripe:TA,vendorPublicConfig:EA});let MA,NA,$A;function FA({policy:e}){return{policy:$A.AT_PERIOD_END}}function xA(e){switch(e){case Eu.ACTIVE:return NA.ACTIVE;case Eu.INCOMPLETE:return NA.INCOMPLETE;case Eu.CANCELED:return NA.CANCELED;case Eu.EXPIRED:return NA.EXPIRED;case Eu.TRIALING:return NA.TRIALING;default:return NA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(MA||(MA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(NA||(NA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}($A||($A={}));const VA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Eu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},jA=[{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:""}],KA=[{id:"id",externalId:"externalId",type:Cu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],GA={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*BA(){yield Go(qb.load,zA),yield Go(qb.cancelSubscription,HA),yield Go(qb.renewSubscription,JA)}function*zA(){const e=yield Qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield ek(e)}function*qA(){yield Bi(qb.setLoading(!0));try{const[e]=yield Hi(ld.subscriptions.getManagedSubscriptions);yield Bi(qb.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Bi(qb.setError(e))}}function*HA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(qb.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Eu.ACTIVE)try{yield Bi(qb.setCancellationLoading(!0)),yield Hi(ld.subscriptions.cancelManagedSubscription,t),yield qA(),yield Bi(qb.setCancellationLoading(!1))}catch(e){yield Bi(qb.setCancellationError(e.message))}}function*JA(){const{subscription:e}=yield Qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Bi(qb.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Bi(qb.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Du.AT_PERIOD_END)try{yield Bi(qb.setRenewalLoading(!0)),yield Hi(ld.subscriptions.renewManagedSubscription,t),yield qA(),yield Bi(qb.setRenewalLoading(!1))}catch(e){yield Bi(qb.setCancellationError(e.message))}}function*YA(){yield Bi(qb.setLoading(!0)),yield Xi(500),yield Bi(qb.setState({subscription:VA,fetching:!1,loading:!1,error:null}))}function*QA(){yield Go(qb.load,YA)}function*XA(){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 ek(n,!1):yield Bi(Zb.setError(t?"Not authorized":"Internal feature failure"))}()}function*ek(e,t){yield Bi(Zb.setLoading(!0));try{var n,i;const o=yield Hi(ld.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Hi(ld.subscriptions.getSubscriptionPlan,a):([,l]=yield zi([Hi(qA),Hi(ld.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?NA.ACTIVE:xA(s.status),cancellation:s.cancellation&&FA(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*tk(){yield function*(){var e,t;yield Bi(Zb.setLoading(!0)),yield Xi(500),yield Bi(Zb.setState({loading:!1,fetching:!1,summary:{subscriptionId:VA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ru.Stripe,externallyManaged:!1,currentPlanId:jA[0].id,defaultPlanId:jA[0].id},plan:I({},jA[0],{price:null==(e=jA[0].price)?void 0:e.amount,currency:null==(t=jA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*nk(){yield Go(Zb.loadBillingInformation,tk)}function*ik(){yield Go(aA.loadPaymentMethod,ok),yield Go(aA.submitPaymentMethod,rk),yield Go(aA.submitPaymentMethodError,lk),yield Go(aA.submitPaymentMethodSuccess,sk),yield Go(aA.updatePaymentMethodBillingDetails,ak)}function*ok(){yield Bi(aA.setLoading(!0));try{const e=(yield Hi(ld.subscriptions.getPaymentMethods))[0];yield Bi(aA.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Bi(aA.setError(e.message))}}function*ak({payload:e}){yield Bi(aA.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Hi(ld.subscriptions.updatePaymentMethodBillingDetails,t,I({email:n},i)),yield Hi(ok),null==o||o(!0)}catch(e){yield Bi(aA.setError(e.message)),null==o||o(!1)}yield Bi(aA.setLoading(!1))}function*rk(){yield Bi(aA.setLoading(!0))}function*lk({payload:e}){yield Bi(aA.setError(e))}function*sk(){yield Bi(aA.loadPaymentMethod())}function*ck(){yield Bi(aA.setLoading(!0)),yield Xi(500);const e=KA[0];yield Bi(aA.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*uk(){yield Go(aA.loadPaymentMethod,ck)}function*dk(){yield Go(dA.loadInvoices,yk),yield Go(dA.downloadInvoice,fk)}function*yk(){yield Bi(dA.setLoading(!0));try{const e=(yield Hi(ld.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(dA.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Bi(dA.setError(e.message))}}function*fk({payload:e}){yield Bi(dA.setInvoiceDownloadState({loading:!0,error:null}));try{yield Hi(ld.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Bi(dA.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Bi(dA.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*gk(){yield Bi(dA.setLoading(!0)),yield Xi(500),yield Bi(dA.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 Bi(dA.setLoading(!1))}function*pk(){yield Go(dA.loadInvoices,gk)}function*Sk(){yield zi([Hi(XA),Hi(ik),Hi(dk),Hi(BA)])}function*vk(){yield zi([Hi(nk),Hi(uk),Hi(pk),Hi(QA)])}function*hk(){yield Go(bA.loadCheckout,mk),yield Go(bA.resetCheckout,bk),yield Go(bA.submitCheckout,Ak),yield Go(bA.confirmCheckout,kk),yield Go(bA.errorCheckout,Pk)}function*mk(){yield Bi(bA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*bk(){yield Bi(bA.setState({loading:!1,error:null,confirmed:!1}))}function*Ak(){yield Bi(bA.setState({loading:!0,error:null}))}function*kk({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)===Eu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Bi(bA.setState({loading:!0,error:null})),o&&a)return yield Tk(),void(yield Bi(qb.setState({subscription:I({},n,{status:Eu.ACTIVE})})));try{yield Hi(ld.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield zi([ZA(),ok(),yk()]),yield Tk()}catch(e){yield Bi(bA.setState({loading:!1,error:e.message}))}}else yield Bi(bA.setState({loading:!1,error:"Subscription not found"}))}function*Tk(){yield Bi(bA.setState({loading:!1,error:null,confirmed:!0}))}function*Pk({payload:e}){yield Bi(bA.setState({loading:!1,error:e}))}function*Ik(){yield Go(bA.resetCheckout,bk)}function*Lk(){yield Go(Mb.loadPlans,wk)}function*wk(){yield Bi(Mb.setLoading(!0));try{const e=(yield Hi(ld.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(Mb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Bi(Mb.setError(e.message))}}function*Ok(){yield Bi(Mb.setLoading(!0)),yield Xi(500),yield Bi(Mb.setState({fetching:!1,loading:!1,plans:jA.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*Ek(){yield Go(Mb.loadPlans,Ok)}function*Ck(){yield Go(jb.loadPaymentConfiguration,Dk)}function*Dk(){yield Bi(jb.setLoading(!0));try{(yield Hi(ld.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ru.Stripe))?yield function*(){yield Bi(jb.setLoading(!0));try{const e=yield Hi(ld.subscriptions.getStripePaymentProviderConfiguration);yield Bi(jb.setState({loading:!1,fetching:!1,config:{paymentProvider:MA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Bi(jb.setError(e.message))}}():yield Bi(jb.setError("Payment provider not configured"))}catch(e){yield Bi(jb.setError(e.message))}}function*Rk(){yield Bi(jb.setLoading(!0)),yield Xi(500),yield Bi(jb.setState({loading:!1,fetching:!1,config:{paymentProvider:MA.STRIPE,apiKey:""}}))}function*_k(){yield Go(jb.loadPaymentConfiguration,Rk)}function*Uk(){yield Go(LA.createCardSetupIntentSecret,Mk)}function*Mk({payload:e}){yield Bi(LA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Hi(ld.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Bi(LA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Bi(LA.setError(e.message))}}function*Nk(){yield Go(DA.loadVendorPublicConfiguration,$k)}function*$k(){yield Bi(DA.setLoading(!0));try{const e=yield Hi(ld.subscriptions.getVendorPublicConfigurations);yield Bi(DA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Bi(DA.setError(e.message))}}function*Fk(){yield Bi(DA.setLoading(!0)),yield Xi(500),yield Bi(DA.setState({fetching:!1,loading:!1,vendorPublicConfig:GA}))}function*xk(){yield Go(DA.loadVendorPublicConfiguration,Fk)}var Vk={sagas:function*(){yield zi([Hi(Sk),Hi(hk),Hi(Lk),Hi(Ck),Hi(Uk),Hi(Nk)])},mockSagas:function*(){yield zi([Hi(vk),Hi(Ik),Hi(Ek),Hi(_k),Hi(xk)])},reducer:UA,actions:_A,initialState:RA,storeName:"subscriptions"},jk={sagas:function*(){yield Go(ey.loadVendorPublicInfo,ty)},storeName:It,initialState:Qd,reducer:Xd,actions:ey};const{reducer:Wk}=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}))}}}),Kk=(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}),[ym.storeName]:I({},ym.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:I({},ym.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Fm.storeName]:I({},Fm.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:I({},Fm.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:I({},Fm.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Vm]:I({},xm,null!=(v=null==o?void 0:o.audits)?v:{}),[Lb.storeName]:Lb.initialState,[Vk.storeName]:Vk.initialState,[jk.storeName]:jk.initialState},reducer:$e({root:Wk,[ym.storeName]:ym.reducer,[Fm.storeName]:Fm.reducer,[Vm]:Wm,[Lb.storeName]:Lb.reducer,[Vk.storeName]:Vk.reducer,[jk.storeName]:jk.reducer})});const m=function*(){yield zi([Hi(ym.sagas),Hi(Fm.sagas),Hi(Zm),Hi(Lb.sagas),Hi(Vk.sagas),Hi(jk.sagas)])},b=function*(){yield zi([Hi(ym.mockSagas),Hi(Fm.mockSagas),Hi(Vk.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 Gk=n(714),Bk=n.n(Gk);function zk(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function qk(e){if(e.type)return e;if("#"===e.charAt(0))return qk(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function Hk(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 Jk(e){if(0===e.indexOf("#"))return e;const{values:t}=qk(e);return`#${t.map(((e,t)=>function(e){const t=e.toString(16);return 1===t.length?`0${t}`:t}(3===t?Math.round(255*e):e))).join("")}`}function Yk(e,t){if(e=qk(e),t=zk(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 Hk(e)}function Qk(e,t){if(e=qk(e),t=zk(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 Hk(e)}const Xk=e=>{if(e)return{main:e,light:Jk(Qk(e,.4)),dark:Jk(Yk(e,.15)),hover:Jk(Yk(e,.15)),active:Jk(Yk(e,.2))}},Zk=e=>{if(e)return{main:e,light:Qk(e,.7),dark:Yk(e,.2)}},eT=(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({},Xk(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({},Xk(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({},Xk(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"})}}):{}},tT={},nT={},iT={},oT={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 aT{constructor(){this._theme=tT,this._themeV2=nT,this._navigation=oT,this._localizations=iT}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new aT;return n.set(e),aT._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=Bk().all([null!=(t=oT)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=Bk().all([null!=(i=tT)?i:{},eT(null==e?void 0:e.theme,tT)]),this._themeV2=Bk().all([null!=(o=nT)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=Bk().all([null!=(r=iT)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=oT,this._theme=tT,this._themeV2=nT,this._localizations=iT}}}aT._instances={};var rT={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},lT=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},sT=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},cT=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 uT,dT,yT,fT,gT,pT,ST,vT,hT,mT,bT;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(uT||(uT={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(dT||(dT={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(yT||(yT={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(fT||(fT={})),function(e){e.Invoices="invoices"}(gT||(gT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(pT||(pT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(ST||(ST={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(vT||(vT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(hT||(hT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(mT||(mT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(bT||(bT={}));const AT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},kT={hidden:"hidden",edit:"edit"};var TT="6.66.0-alpha.2",PT=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(TT),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=w(E().mark((function e(){var t,n,i,o,a;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Xo,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:aT.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=rT,e.next=13;break;case 4:return e.prev=4,e.next=7,qu();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=lT(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:Kk({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),P.setInstance(c,this)}var t,n,i,o;return T(e,[{key:"initContainers",value:(o=w(E().mark((function e(t){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;aT.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=w(E().mark((function e(){return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=w(E().mark((function e(){var t;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=w(E().mark((function e(t){var n;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,I({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),IT=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}(),LT=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}(),wT=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}(),OT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},ET=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:Kk({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 PT(this.options,t,!0),aT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,cT(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}(),CT="modern",DT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[CT]},RT=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:Kk({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 PT(this.options,t,!0),aT.set({},t)}var t;return T(e,[{key:"render",value:(t=w(E().mark((function e(t){var n,i,o,a,r=this;return E().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,cT(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 _T(e,t){return _T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_T(e,t)}function UT(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&&_T(e,t)}function MT(e){return MT="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},MT(e)}function NT(e,t){if(t&&("object"===MT(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 $T(e){return $T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$T(e)}function FT(){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 xT(e,t,n){return xT=FT()?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&&_T(o,n.prototype),o},xT.apply(null,arguments)}function VT(e){var t="function"==typeof Map?new Map:void 0;return VT=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 xT(e,arguments,$T(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_T(n,e)},VT(e)}function jT(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=$T(e);if(t){var o=$T(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return NT(this,n)}}var WT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new PT(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){UT(n,e);var t=jT(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=sT(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=sT(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=sT(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=sT(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=sT(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=sT(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}(VT(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}()}));
|