@frontegg/js 6.127.0 → 6.128.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(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||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(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])?i[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):i[a]=o(t[a],n))})),i}(e,n,s):o(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},378:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,i,a;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(i=o;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=o;0!=i--;){var r=a[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:E(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(_([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(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 i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}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 L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function _(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=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 o.next=o}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(k.prototype),d(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,i,a){void 0===a&&(a=Promise);var r=new k(y(e,n,o,i),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=_,O.prototype={constructor:O,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(L),!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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):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),p},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),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,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 o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](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 o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return QL},AdminPortalRenderer:function(){return eO},AppHolder:function(){return w},CheckoutDialog:function(){return XL},FronteggApp:function(){return YL},HostedLogin:function(){return JL},LoginBoxRenderer:function(){return oO},createElement:function(){return CL},defaultTheme:function(){return tO},formatName:function(){return wL},getThemeAdminByName:function(){return ZL},getThemeByName:function(){return nO},initialize:function(){return yO},mockFlagsList:function(){return qL},restoreSearchParams:function(){return RL},waitThemeSetter:function(){return UL}});var e={};n.r(e),n.d(e,{Delete:function(){return mr},Get:function(){return gr},Patch:function(){return vr},Post:function(){return Sr},PostDownload:function(){return Ar},Put:function(){return hr},extractHeadersFromOptions:function(){return br},getBaseUrl:function(){return yr},getMetadataHeaders:function(){return fr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return wr},getParentTenants:function(){return Pr},getParentTenantsById:function(){return Lr},getSubTenants:function(){return Er},getSubTenantsAsTree:function(){return Ir},getTenants:function(){return kr},getTenantsUsersCount:function(){return Or},searchSubTenants:function(){return _r},switchTenant:function(){return Tr}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return cl},getCurrentUserTenantsV3:function(){return pl},getUsersGroups:function(){return fl},getUsersRoles:function(){return yl},getUsersV2:function(){return ul},getUsersV3:function(){return dl},sendResetBreachedPasswordEmails:function(){return gl},updateUserProfileV2:function(){return Sl}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return vl}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return bl},loadFeatureFlags:function(){return Tl}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return ol},MachineToMachineAuthStrategy:function(){return il},OAuthLogout:function(){return Yl},SocialLoginProviders:function(){return nl},acceptInvitation:function(){return Wl},activateAccount:function(){return $l},activateAccountV2:function(){return xl},bulkCreateIPRestriction:function(){return Qr},changePhoneNumber:function(){return Jc},changePhoneNumberWithVerification:function(){return qc},checkIfAllowToRememberMfaDevice:function(){return Ac},createDomainRestriction:function(){return Kr},createIPRestriction:function(){return Jr},createOrUpdateSessionConfigrations:function(){return ic},createSSOConfiguration:function(){return Pc},createSSOConfigurationByMetadata:function(){return _c},createSSODomain:function(){return Cc},createSSOGroup:function(){return Mc},createSamlGroup:function(){return js},createTenantAccessToken:function(){return yc},createUserAccessToken:function(){return dc},deleteAllSessionsForUser:function(){return rc},deleteDomainRestriction:function(){return zr},deleteIPRestriction:function(){return Zr},deleteSSOConfiguration:function(){return Oc},deleteSSODomain:function(){return Uc},deleteSSOGroup:function(){return Gc},deleteSamlGroup:function(){return Ws},deleteSessionForUser:function(){return ac},deleteTenantAccessToken:function(){return cc},deleteTenantApiToken:function(){return vc},deleteUserAccessToken:function(){return uc},deleteUserApiToken:function(){return hc},deleteWebAuthnDevice:function(){return nu},disableMFAAuthenticatorApp:function(){return cs},disableMFASMS:function(){return ds},disableMFAWebAuthn:function(){return fs},disableMfa:function(){return ss},enrollMFAAuthenticatorApp:function(){return ns},enrollMFAAuthenticatorAppForLogin:function(){return Ss},enrollMFAAuthenticatorAppForLoginV2:function(){return vs},enrollMFASMS:function(){return is},enrollMFASMSForLogin:function(){return ks},enrollMFASMSForLoginV2:function(){return Es},enrollMFAWebAuthn:function(){return rs},enrollMFAWebAuthnForLogin:function(){return _s},enrollMFAWebAuthnForLoginV2:function(){return ws},enrollMfa:function(){return es},exchangeOAuthTokens:function(){return Wc},exchangeOAuthTokensV2:function(){return jc},forgotPassword:function(){return Jl},generateLoginResponse:function(){return Pl},generateLoginResponseFromOAuthResponse:function(){return _l},generateLoginResponseFromOAuthResponseV2:function(){return wl},generateLoginResponseV2:function(){return Ll},generateLoginResponseV3:function(){return Ol},getActivateAccountStrategy:function(){return Vl},getCaptchaPolicy:function(){return Gr},getCurrentUserSession:function(){return tc},getCurrentUserSessions:function(){return ec},getCustomSocialLoginProvidersV1:function(){return Js},getDomainRestrictions:function(){return Br},getDomainRestrictionsConfig:function(){return Wr},getGlobalSecurityPolicy:function(){return Cr},getIPRestrictions:function(){return qr},getIPRestrictionsConfig:function(){return Yr},getLockoutPolicy:function(){return Nr},getMFADevices:function(){return ps},getMFAStrategiesConfig:function(){return ru},getMeAndEntitlements:function(){return lu},getMfaPolicy:function(){return Ur},getOidcConfiguration:function(){return Ks},getPasswordConfigPolicy:function(){return jr},getPasswordHistoryPolicy:function(){return $r},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return au},getSSOConfigurations:function(){return Ic},getSSODefaultRoles:function(){return Dc},getSSOGroups:function(){return $c},getSSOPublicConfiguration:function(){return Hs},getSamlConfiguration:function(){return Ds},getSamlRoles:function(){return $s},getSamlRolesGroups:function(){return xs},getSamlVendorConfiguration:function(){return Ms},getSessionConfigurations:function(){return oc},getSocialLoginProviders:function(){return zs},getSocialLoginProvidersV2:function(){return qs},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Ys},getTenantAccessTokensData:function(){return sc},getTenantApiTokensData:function(){return pc},getUserAccessTokensData:function(){return lc},getUserApiTokensData:function(){return fc},getUserById:function(){return mc},getVendorConfig:function(){return Xs},getVendorLockoutPolicy:function(){return Mr},getVendorMfaPolicy:function(){return Rr},getVendorPasswordHistoryPolicy:function(){return xr},getVendorPublicAuthStrategiesConfig:function(){return iu},getWebAuthnDevices:function(){return tu},loadPasswordConfig:function(){return Xl},login:function(){return Nl},loginViaSocialLogin:function(){return Qs},loginWithMfa:function(){return Fl},loginWithMfaV2:function(){return Gl},loginv2:function(){return Ml},logout:function(){return ql},oidcPostLogin:function(){return Dl},oidcPostLoginV2:function(){return Vc},passwordlessPostLogin:function(){return kc},passwordlessPostLoginV2:function(){return Tc},passwordlessPreLogin:function(){return bc},postLogin:function(){return Rl},preDisableMFASMS:function(){return us},preDisableMFAWebAuthn:function(){return ys},preEnrollMFAAuthenticatorApp:function(){return ts},preEnrollMFAAuthenticatorAppForLogin:function(){return gs},preEnrollMFASMS:function(){return os},preEnrollMFASMSForLogin:function(){return Ts},preEnrollMFAWebAuthn:function(){return as},preEnrollMFAWebAuthnForLogin:function(){return Os},preLogin:function(){return Cl},preLoginV2:function(){return xc},preLoginWithIdpType:function(){return Ul},preVerifyMFAEmailCode:function(){return ms},preVerifyMFASMSForLogin:function(){return Is},preVerifyMFAWebAuthnForLogin:function(){return Cs},recoverMfaToken:function(){return Zl},refreshToken:function(){return Kl},refreshTokenV2:function(){return Hl},refreshTokenV3:function(){return zl},resendActivationEmail:function(){return jl},resendInvitationEmail:function(){return Bl},resetPassword:function(){return Ql},resetPhoneNumber:function(){return Hc},revokeSessionsForUser:function(){return nc},saveLockoutPolicy:function(){return Fr},saveMfaPolicy:function(){return Dr},savePasswordHistoryPolicy:function(){return Vr},setSSODefaultRoles:function(){return Nc},signUpUser:function(){return Zs},silentOAuthRefreshToken:function(){return Kc},silentOAuthRefreshTokenV2:function(){return Bc},testCurrentIp:function(){return el},testCurrentIpInAllowList:function(){return tl},updateDomainRestrictionConfig:function(){return Hr},updateIPRestrictionConfig:function(){return Xr},updateSSOConfiguration:function(){return Lc},updateSSOConfigurationByMetadata:function(){return wc},updateSSOGroup:function(){return Fc},updateSamlConfiguration:function(){return Ns},updateSamlGroup:function(){return Bs},updateSamlRoles:function(){return Vs},updateSamlVendorMetadata:function(){return Fs},updateTenantApiTokensData:function(){return Sc},updateUserApiTokensData:function(){return gc},validateSSODomain:function(){return Rc},validateSamlDomain:function(){return Gs},verifyChangePhoneNumber:function(){return Yc},verifyInviteToken:function(){return Ec},verifyMFAAuthenticatorAppForLogin:function(){return hs},verifyMFAEmailCode:function(){return As},verifyMFAEmailCodeV2:function(){return bs},verifyMFASMSForLogin:function(){return Ps},verifyMFASMSForLoginV2:function(){return Ls},verifyMFAWebAuthnForLogin:function(){return Us},verifyMFAWebAuthnForLoginV2:function(){return Rs},verifyMfa:function(){return ls},verifyNewDeviceSession:function(){return ou},verifyResetPhoneNumber:function(){return zc},webAuthnCreateNewDeviceSession:function(){return eu},webAuthnPostLogin:function(){return Xc},webAuthnPostLoginV2:function(){return Zc},webAuthnPreLogin:function(){return Qc}});var s={};n.r(s),n.d(s,{addUser:function(){return fu},changePassword:function(){return du},createInviteUserLink:function(){return Su},deleteInviteUserLink:function(){return hu},deleteUser:function(){return pu},getInviteLinkConfiguration:function(){return Au},getInviteUserLink:function(){return mu},getProfile:function(){return su},loadAvailablePermissions:function(){return Tu},loadAvailableRoles:function(){return bu},loadStats:function(){return ku},loadUsers:function(){return yu},resendActivationLink:function(){return Eu},resendInvitationLink:function(){return Iu},resendInvitationLinkToAllTenants:function(){return Pu},updateInviteUserLink:function(){return vu},updateProfile:function(){return cu},updateProfileImage:function(){return uu},updateUser:function(){return gu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Ou},getAuditsMetadata:function(){return Ru},getCurrentUserIpMetadata:function(){return wu},getIpAdressMetadata:function(){return Du},getNotificationsMetadata:function(){return Cu},getSamlMetadata:function(){return Uu},updateAdminBoxMetadata:function(){return _u}});var u={};n.r(u),n.d(u,{downloadReport:function(){return ju},getReport:function(){return $u},getReports:function(){return Gu},renderReport:function(){return xu},scheduleReport:function(){return Vu},sendReport:function(){return Bu}});var d={};n.r(d),n.d(d,{getNotifications:function(){return Wu},markAllAsRead:function(){return zu},updateNotificationIsPinned:function(){return Hu},updateNotificationStatus:function(){return Ku}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Qu},getAudits:function(){return Yu},getAuditsStats:function(){return Ju}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return dd},deleteEmailSubscriptions:function(){return cd},deleteSMSConfiguration:function(){return vd},deleteSMSSubscriptions:function(){return gd},deleteSlackConfiguration:function(){return id},deleteWebhooksConfiguration:function(){return Ad},getCategories:function(){return Ed},getChannelMaps:function(){return Id},getEmailConfiguration:function(){return rd},getSMSConfiguration:function(){return yd},getSlackChannels:function(){return nd},getSlackConfiguration:function(){return ed},getSlackScope:function(){return td},getWebhookLog:function(){return bd},getWebhooksConfigurations:function(){return hd},patchEmailConfiguration:function(){return sd},patchSMSConfiguration:function(){return pd},postEmailConfiguration:function(){return ld},postSMSConfiguration:function(){return fd},postSlackCode:function(){return ad},postSlackConfiguration:function(){return od},postWebhookRetry:function(){return kd},postWebhookTest:function(){return Td},postWebhooksConfiguration:function(){return md},putEmailSubscriptions:function(){return ud},putSMSSubscriptions:function(){return Sd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Od},getSettings:function(){return Ld},updateSettings:function(){return Pd}});var g={};n.r(g),n.d(g,{addRole:function(){return Rd},attachPermissionToRoles:function(){return Gd},attachPermissionsToRole:function(){return Md},deleteRole:function(){return Dd},getPermissionCategories:function(){return $d},getPermissions:function(){return Fd},getRoles:function(){return Ud},updateRole:function(){return Nd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return vy},ISubscriptionStatus:function(){return gy},PaymentMethodType:function(){return Sy},ProviderType:function(){return hy},TenantCreatedAction:function(){return Ay},TrialEndAction:function(){return my},cancelManagedSubscription:function(){return zd},cancelSubscription:function(){return jd},createStripeCustomer:function(){return ly},createStripePaymentMethodSetupIntentSecret:function(){return cy},createSubscription:function(){return ay},createTenantConfiguration:function(){return yy},getManagedSubscription:function(){return Kd},getManagedSubscriptions:function(){return Hd},getPaymentMethod:function(){return oy},getPaymentMethods:function(){return ny},getPaymentProviders:function(){return fy},getStripeCustomer:function(){return ry},getStripePaymentProviderConfiguration:function(){return sy},getSubscription:function(){return Vd},getSubscriptionInvoice:function(){return Zd},getSubscriptionInvoicePdf:function(){return ey},getSubscriptionInvoices:function(){return Xd},getSubscriptionPlan:function(){return Qd},getSubscriptionPlans:function(){return Jd},getSubscriptionSummaries:function(){return uy},getSubscriptions:function(){return xd},getTenantConfiguration:function(){return dy},getVendorPublicConfigurations:function(){return py},renewManagedSubscription:function(){return qd},renewSubscription:function(){return Bd},updateManagedSubscription:function(){return Yd},updatePaymentMethodBillingDetails:function(){return iy},updateSubscription:function(){return Wd}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return by}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Iy},addUserToTenantAndSubTenants:function(){return ky},addUsersToSubTenant:function(){return Uy},createSubTenant:function(){return Oy},deleteSubTenant:function(){return _y},loadAllUsers:function(){return Ty},removeUserFromTenantAndSubTenants:function(){return Ey},removeUserRolesFromSubTenants:function(){return Py},setUserRolesForSubTenants:function(){return Ly},updateSubAccountAccess:function(){return Cy},updateSubTenant:function(){return wy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Fy},createConfiguration:function(){return Ny},deleteConfiguration:function(){return My},getConfigs:function(){return Ry},updateConfiguration:function(){return Dy}});var A={};n.r(A),n.d(A,{impersonate:function(){return Gy}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Hy},addUsersToGroup:function(){return qy},createGroup:function(){return By},deleteGroup:function(){return Ky},deleteRolesFromGroup:function(){return zy},deleteUsersFromGroup:function(){return Yy},getGroupById:function(){return xy},getGroupConfiguration:function(){return Jy},getGroups:function(){return Vy},getGroupsByIds:function(){return jy},updateGroup:function(){return Wy},updateGroupConfiguration:function(){return Qy}});var T={};n.r(T),n.d(T,{getInsights:function(){return Zy},getRecommendations:function(){return Xy}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return ml},AuthStrategyEnum:function(){return ol},ContextHolder:function(){return Pa},FeatureFlags:function(){return bl},FronteggApiError:function(){return Oa},FronteggContext:function(){return La},FronteggFrameworks:function(){return lo},GroupManagedByEnum:function(){return gf},GroupRelations:function(){return pf},ISubscriptionCancellationPolicy:function(){return vy},ISubscriptionStatus:function(){return gy},InsightCode:function(){return vf},MFAStrategyEnum:function(){return nf},MachineToMachineAuthStrategy:function(){return il},NotEntitledJustification:function(){return hl},PaginationOrderEnum:function(){return so},PaymentMethodType:function(){return Sy},ProviderType:function(){return hy},RecommendationActionKey:function(){return hf},RecommendationCode:function(){return Sf},RecommendationSeverity:function(){return mf},RequestSource:function(){return ro},RestrictionType:function(){return Vn},ScimConnectionSource:function(){return ff},SecondaryAuthStrategy:function(){return ef},SecurityCategory:function(){return Af},SocialLoginProviders:function(){return nl},SortByEnum:function(){return co},TenantSortByEnum:function(){return af},TenantType:function(){return rf},UserManagedByEnum:function(){return of},WebAuthnDeviceType:function(){return tf},api:function(){return bf},countConfigurationUsers:function(){return Fy},createConfiguration:function(){return Ny},default:function(){return Tf},deleteConfiguration:function(){return My},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return lf},fronteggHeaders:function(){return ao},fronteggRefreshTokenUrl:function(){return sf},fronteggSilentRefreshTokenUrl:function(){return cf},fronteggTenantsUrl:function(){return df},fronteggTenantsV3Url:function(){return yf},fronteggUsersUrl:function(){return uf},getConfigs:function(){return Ry},loadFeatureFlags:function(){return Tl},providersArray:function(){return uo},updateConfiguration:function(){return Dy}});var E={};function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="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},P(e)}function L(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function O(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,L(o.key),o)}}function _(e,t,n){return t&&O(e.prototype,t),n&&O(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(E),n.d(E,{AccountDetailsPageTabs:function(){return WL},AccountPageFields:function(){return FL},DomainRestrictionsTabFields:function(){return BL},GeneralSettingsTabFields:function(){return VL},InviteUserModalFields:function(){return ML},IpRestrictionsTabFields:function(){return jL},Metadata:function(){return _L},PrivacyPageFields:function(){return NL},ProfilePageFields:function(){return DL},SecurityPageTabs:function(){return $L},SessionManagementTabFields:function(){return xL},SubscriptionsPageFields:function(){return GL},alpha:function(){return mL},fieldAppearance:function(){return KL},tabAppearance:function(){return HL}});var w=function(){function e(){I(this,e)}return _(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 C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},C.apply(this,arguments)}function U(e,t,n,o,i,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(o,i)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){U(a,o,i,r,l,"next",e)}function l(e){U(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var D=n(841),N=n.n(D);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];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 F(e){return!!e&&!!e[ke]}function G(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)===Ee}(e)||Array.isArray(e)||!!e[Te]||!!e.constructor[Te]||W(e)||K(e))}function $(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Ie)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:K(e)?3:0}function V(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return he&&e instanceof Map}function K(e){return me&&e instanceof Set}function H(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Pe(e);delete t[ke];for(var n=Ie(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||F(e)||!G(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=Y),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function Y(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Le[e];return t||M(18,e),t}function X(){return Se}function Z(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function ee(e){te(e),e.p.forEach(oe),e.p=null}function te(e){e===Se&&(Se=e.l)}function ne(e){return Se={p:[],l:Se,h:e,m:!0,_:0}}function oe(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(ee(t),M(4)),G(e)&&(e=ae(t,e),t.l||le(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ae(t,n,[]),ee(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function ae(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return $(t,(function(i,a){return re(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return le(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;$(3===o.i?new Set(i):i,(function(t,a){return re(e,o,i,t,a,n)})),le(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function re(e,t,n,o,i,a){if(F(i)){var r=ae(e,i,a&&t&&3!==t.i&&!V(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!F(r))return;e.m=!1}if(G(i)&&!J(i)){if(!e.h.F&&e._<1)return;ae(e,i),t&&t.A.l||le(e,i)}}function le(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?H(n):e)[t]}function ce(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function ue(e){e.P||(e.P=!0,e.l&&ue(e.l))}function de(e){e.o||(e.o=z(e.t))}function ye(e,t,n){var o=W(t)?Q("MapSet").N(t,n):K(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:X(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Oe;n&&(i=[o],a=_e);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:X()).p.push(o),o}function fe(e){return F(e)||M(22,e),function e(t){if(!G(t))return t;var n,o=t[ke],i=x(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=pe(t,i),o.I=!1}else n=pe(t,i);return $(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function pe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,Se,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),he="undefined"!=typeof Map,me="undefined"!=typeof Set,Ae="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=ve?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Te=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ke=ve?Symbol.for("immer-state"):"__$immer_state",Ee=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Pe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ie(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Oe={get:function(e,t){if(t===ke)return e;var n=H(e);if(!V(n,t))return function(e,t,n){var o,i=ce(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!G(o)?o:o===se(e.t,t)?(de(e),e.o[t]=ye(e.A.h,o,e)):o},has:function(e,t){return t in H(e)},ownKeys:function(e){return Reflect.ownKeys(H(e))},set:function(e,t,n){var o=ce(H(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=se(H(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(B(n,i)&&(void 0!==n||V(e.t,t)))return!0;de(e),ue(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!==se(e.t,t)||t in e.t?(e.D[t]=!1,de(e),ue(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=H(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},_e={};$(Oe,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Oe.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=Ae,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==o&&"function"!=typeof o&&M(7),G(e)){var l=ne(t),s=ye(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?ee(l):te(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Z(l,o),ie(e,l)}),(function(e){throw ee(l),e})):(Z(l,o),ie(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"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){G(e)||M(8),F(e)&&(e=fe(e));var t=ne(this),n=ye(this,e,void 0);return n[ke].C=!0,te(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return Z(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ae&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return F(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ce=new we,Ue=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),Ue);function De(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){De(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(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 Ge="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function Ve(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 je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Fe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Fe(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Fe(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Fe(3));return a}function d(e){if("function"!=typeof e)throw new Error(Fe(4));if(s)throw new Error(Fe(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Fe(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ve(e))throw new Error(Fe(7));if(void 0===e.type)throw new Error(Fe(8));if(s)throw new Error(Fe(9));try{s=!0,a=i(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(Fe(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Fe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ge]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ge]=p,o}function Be(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}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:xe.INIT}))throw new Error(Fe(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Fe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},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(Fe(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){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 Ke(){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),o=function(){throw new Error(Fe(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function He(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var ze=He();ze.withExtraArgument=He;var qe,Ye=ze,Je=(qe=function(e,t){return qe=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])},qe(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}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Xe=Object.defineProperty,Ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,nt=function(e,t,n){return t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ot=function(e,t){for(var n in t||(t={}))et.call(t,n)&&nt(e,n,t[n]);if(Ze)for(var o=0,i=Ze(t);o<i.length;o++)n=i[o],tt.call(t,n)&&nt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var at=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Je(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,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function rt(e){return G(e)?Re(e,(function(){})):e}function lt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new at);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Ye):o.push(Ye.withExtraArgument(n.extraArgument))),o}function st(e){var t,n=function(e){return lt(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.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=Be(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Ke.apply(void 0,p),S=We;c&&(S=it(ot({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ct(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ot(ot({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.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 ut(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function dt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:rt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ut(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=ot(ot({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ut(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return rt(e())};else{var c=rt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([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 o;if(F(e))return void 0===(o=n(e,t))?e:o;if(G(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ct(c,o):ct(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 yt="listenerMiddleware";ct(yt+"/add"),ct(yt+"/removeAll"),ct(yt+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Oe.get(t,e)},set:function(t){var n=this[ke];Oe.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ue(i);break;case 4:n(i)&&ue(i)}}}function n(e){for(var t=e.t,n=e.k,o=Ie(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!V(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!B(l,r))return!0}}var c=!!t[ke];return o.length!==Ie(t).length+(c?0:1)}function o(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 o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Pe(n);delete a[ke];for(var r=Ie(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)}(o,t),a={i:o?5:4,A:n?n.A:X(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?F(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)$(a,(function(t){t!==ke&&(void 0!==i[t]||V(i,t)?r[t]||e(a[t]):(r[t]=!0,ue(n)))})),$(i,(function(e){void 0!==a[e]||V(a,e)||(r[e]=!1,ue(n))}));else if(5===l){if(o(n)&&(ue(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.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):o(e)}})}();const ft=(e,t)=>n=>C({},n,{[e]:t[e]}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return C({},t,{[e]:C({},t[e],{loaders:C({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),ht=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return C({},o,{[e]:C({},o[e],{[t]:C({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),mt=(e,t,n)=>o=>{var i;return C({},o,{[e]:C({},o[e],{[t]:C({},null==o||null==(i=o[e])?void 0:i[t],n)})})},At=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Tt=new Uint8Array(256);for(let e=0;e<bt.length;e++)Tt[bt.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=Tt[e.charCodeAt(o)],a=Tt[e.charCodeAt(o+1)],r=Tt[e.charCodeAt(o+2)],l=Tt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},Et=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Et(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=bt[t[o]>>2],i+=bt[(3&t[o])<<4|t[o+1]>>4],i+=bt[(15&t[o+1])<<2|t[o+2]>>6],i+=bt[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Et(e[n]);return t}return e};let It,Pt,Lt;!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",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(It||(It={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Pt||(Pt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Ot="FRONTEGG_AFTER_AUTH_REDIRECT_URL",_t="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Ut="auditLogs",Rt="vendor",Dt={flow:Pt.Login,step:It.preLogin,loading:!1,email:"",tenants:[]},Nt={setLoginState:pt("loginState"),resetLoginState:ft("loginState",{loginState:Dt})},Mt={requestAuthorize:ct("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ct("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ct("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:ct("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ct("auth/afterAuthNavigation"),preLogin:ct("auth/preLogin",(e=>({payload:e}))),postLogin:ct("auth/postLogin",(e=>({payload:e}))),login:ct("auth/login",(e=>({payload:e}))),loginWithMfa:ct("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ct("auth/recoverMfa",(e=>({payload:e}))),logout:ct("auth/logout",(e=>({payload:e}))),silentLogout:ct("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ct("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ct("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ct("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ct("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ct("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ct("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ct("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ct("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ct("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ct("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ct("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ct("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ct("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ct("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ct("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ct("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ct("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ct("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ct("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ct("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ct("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ct("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ct("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ct("auth/resetBreachedPassword",(e=>({payload:e})))};let Ft;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ft||(Ft={}));const Gt={step:Ft.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:pt("activateState"),resetActivateState:ft("activateState",{activateState:Gt}),setActivateStrategyState:gt("activateState","activationStrategy")},xt={activateAccount:ct("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ct("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ct("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ct("auth/resendActivationEmail",(e=>({payload:e})))};let Vt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Vt||(Vt={}));const jt={step:Vt.validate},Bt={setAcceptInvitationState:pt("acceptInvitationState"),resetAcceptInvitationState:ft("acceptInvitationState",{acceptInvitationState:jt})},Wt={acceptInvitation:ct("auth/acceptInvitation",(e=>({payload:e})))};let Kt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Kt||(Kt={}));const Ht={step:Kt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:pt("forgotPasswordState"),resetForgotPasswordState:ft("forgotPasswordState",{forgotPasswordState:Ht})},qt={forgotPassword:ct("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ct("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ct("auth/loadPasswordConfig",(e=>({payload:e})))};let Yt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Yt||(Yt={}));const Jt={step:Yt.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:pt("resetPhoneNumberState"),resetResetPhoneNumberState:ft("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Xt={resetPhoneNumber:ct("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ct("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ct("auth/changePhoneNumber",(e=>({payload:e})))},Zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},en={setSSOLoader:St("ssoState"),setSSOError:vt("ssoState"),setSSOState:pt("ssoState"),resetSSOState:ft("ssoState",{ssoState:Zt})},tn={loadSSOConfigurationsV2:ct("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ct("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ct("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ct("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ct("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ct("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ct("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ct("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ct("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ct("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ct("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ct("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ct("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ct("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ct("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ct("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ct("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ct("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ct("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ct("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ct("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ct("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ct("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ct("auth/oidcPostlogin",(e=>({payload:e})))},nn={loading:!1,error:null},on={setProfileState:pt("profileState"),resetProfileState:ft("profileState",{profileState:nn})},an={loadProfile:ct("auth/loadProfile"),saveProfile:ct("auth/saveProfile",(e=>({payload:e}))),changePassword:ct("auth/changePassword",(e=>({payload:e})))};let rn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(rn||(rn={}));const ln={step:rn.verify,loading:!1,saving:!1},sn={setMfaState:pt("mfaState"),resetMfaState:ft("mfaState",{mfaState:ln})},cn={enrollMfa:ct("auth/enrollMfa"),getMFADevices:ct("auth/getMFADevices"),getMFAStrategies:ct("auth/getMFAStrategies"),verifyMfa:ct("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ct("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ct("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ct("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ct("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ct("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ct("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ct("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ct("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ct("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ct("auth/disableMfaWebAuthn",(e=>({payload:e})))},un={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},dn={setTeamLoader:St("teamState"),setTeamError:vt("teamState"),setTeamState:pt("teamState"),resetTeamState:ft("teamState",{teamState:un})},yn={loadUsersV2:ct("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ct("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ct("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ct("auth/loadRoles",(e=>({payload:e}))),addUser:ct("auth/addUser",(e=>({payload:e}))),addUsersBulk:ct("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ct("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ct("auth/updateUser",(e=>({payload:e}))),deleteUser:ct("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ct("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ct("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ct("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ct("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ct("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ct("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ct("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ct("auth/getInvitationLink"),createInvitationLink:ct("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ct("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ct("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ct("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ct("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ct("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ct("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ct("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ct("auth/closeLockUserDialog",(e=>({payload:e})))},fn={firstLoad:!0,loading:!1,error:""},pn={setSocialLoginsState:pt("socialLoginState"),resetSocialLoginsState:ft("socialLoginState",{socialLoginState:fn})},gn={loadSocialLoginsConfiguration:ct("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ct("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ct("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ct("auth/setSocialLoginError",(e=>({payload:e})))};let Sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(Sn||(Sn={}));const vn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:Sn.SignUp},hn={setSignUpState:pt("signUpState"),resetSignUpState:ft("signUpState",{signUpState:vn})},mn={signUpUser:ct("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ct("auth/resetSignUpStateSoft")},An={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:St("apiTokensState"),setApiTokensError:vt("apiTokensState"),setApiTokensState:pt("apiTokensState"),resetApiTokensState:ft("apiTokensState",{apiTokensState:An})},Tn={loadApiTokens:ct("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ct("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ct("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ct("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ct("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ct("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ct("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ct("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={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}},En={setSecurityPolicyState:pt("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ft("securityPolicyState",{securityPolicyState:kn})},In={loadSecurityPolicy:ct("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ct("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ct("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ct("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ct("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ct("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ct("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ct("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ct("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ct("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ct("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ct("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ct("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ct("auth/loadPublicAuthStrategiesPolicy")},Pn={loading:!1},Ln={setAccountSettingsState:pt("accountSettingsState"),resetAccountSettingsState:ft("accountSettingsState",{accountSettingsState:Pn})},On={loadAccountSettings:ct("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ct("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:pt("tenantsState"),resetTenantsState:ft("tenantsState",{tenantsState:_n})},Cn={switchTenant:ct("auth/switchTenant",(e=>({payload:e}))),loadTenants:ct("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ct("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ct("auth/loadSubTenantsTree",(e=>({payload:e})))},Un={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:pt("rolesState"),resetRolesState:ft("rolesState",{rolesState:Un})},Dn={loadRolesAndPermissions:ct("auth/loadRoles",(e=>({payload:e}))),addRole:ct("auth/addRole",(e=>({payload:e}))),updateRole:ct("auth/updateRole",(e=>({payload:e}))),deleteRole:ct("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ct("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ct("auth/attachPermissionToRoles",(e=>({payload:e})))},Nn={loading:!1,sessions:[]},Mn={setSessionsState:pt("sessionsState"),resetSessionsState:ft("sessionsState",{sessionsState:Nn})},Fn={loadUserSessions:ct("auth/loadUserSessions"),loadCurrentUserSession:ct("auth/loadCurrentUserSession"),deleteUserSession:ct("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ct("auth/deleteAllUserSessions"),revokeUserSessions:ct("auth/revokeUserSessions",(e=>({payload:e})))},Gn={loading:!1,configurations:{}},$n={setSessionsPolicyState:pt("sessionsPolicyState"),resetSessionsPolicyState:ft("sessionsPolicyState",{sessionsPolicyState:Gn})},xn={loadSessionsPolicy:ct("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ct("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Vn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Vn||(Vn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Vn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Bn={setRestrictionsState:pt("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:ct("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ct("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ct("auth/loadIpRestrictions"),saveIpRestriction:ct("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ct("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ct("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ct("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ct("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ct("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ct("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Kn={loading:!1},Hn={setProvisioningState:pt("provisioningState"),resetProvisioningState:ft("provisioningState",{provisioningState:Kn})},zn={loadProvisionConnections:ct("auth/loadProvisionConnections"),createProvisionConnection:ct("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ct("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ct("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Yn={setPasskeysState:pt("passkeysState"),resetPasskeysState:ft("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:ct("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ct("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Xn={setUsersGroupsLoader:St("groupsState"),setUsersGroupsError:vt("groupsState"),setGroupsState:pt("groupsState"),resetUsersGroupsState:ft("groupsState",{groupsState:Qn})},Zn={loadGroups:ct("auth/loadUsersGroups"),getGroupById:ct("auth/getGroupById",(e=>({payload:e}))),createGroup:ct("auth/createGroup",(e=>({payload:e}))),updateGroup:ct("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ct("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ct("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ct("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ct("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ct("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ct("auth/getGroupConfiguration"),updateGroupConfiguration:ct("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ct("auth/getUsers",(e=>({payload:e})))},eo={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},to={setGroupsDialogsState:pt("groupsDialogsState"),resetGroupsDialogsState:ft("groupsState",{groupsDialogsState:eo}),openAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},no={loading:!0,error:null},oo={setCustomLoginState:pt("customLoginState"),resetCustomLoginState:ft("customLoginState",{customLoginState:no})},io={loadTenantMetadata:ct("auth/loadTenantMetadata"),updateTenantMetadata:ct("auth/updateTenantMetadata",(e=>({payload:e})))},ao={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ro,lo,so,co;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ro||(ro={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(lo||(lo={})),function(e){e.ASC="ASC",e.DESC="DESC"}(so||(so={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(co||(co={}));const uo=["local","saml","google","github","facebook","microsoft","scim2","slack"],yo={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],topAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:so.DESC,_sortBy:co.name},usersPageOffset:0,accountSettings:{}}},fo={setAllAccountsLoader:St("allAccountsState"),setAllAccountsError:vt("allAccountsState"),setAllAccountsState:pt("allAccountsState"),setSelectedAccountState:gt("allAccountsState","selectedAccount"),resetAllAccountsState:ft("allAccountsState",{allAccountsState:yo})},po={loadAccounts:ct("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ct("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ct("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ct("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ct("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:ct("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ct("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ct("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ct("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ct("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ct("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ct("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setSelectedSubAccountData:ct("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ct("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},go={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},So={setAllAccountDialogsState:pt("allAccountsDialogsState"),resetAllAccountDialogsState:ft("allAccountsDialogsState",{allAccountsDialogsState:go}),openCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",go.createSubAccountDialog),openUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",go.updateSubAccountDialog),openDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",go.deleteSubAccountDialog),openAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",go.addUsersToAccountDialog),openDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",go.deleteUserFromAccountDialog),openEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",go.editUserRolesDialog)},vo={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0},ho={setSecurityCenterState:pt("securityCenterState"),resetSecurityCenterState:ft("securityCenterState",{securityCenterState:vo}),setSecurityCenterStateLoader:St("securityCenterState"),setSecurityCenterStateError:vt("securityCenterState")},mo={loadRecommendations:ct("auth/loadRecommendations"),loadInsights:ct("auth/loadInsights"),sendResetBreachedPasswordEmails:ct("auth/sendResetBreachedPasswordEmails")},Ao={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:vn,loginState:Dt,activateState:Gt,acceptInvitationState:jt,forgotPasswordState:Ht,ssoState:Zt,profileState:nn,customLoginState:no,mfaState:ln,teamState:un,groupsState:Qn,groupsDialogsState:eo,socialLoginState:fn,apiTokensState:An,securityPolicyState:kn,accountSettingsState:Pn,tenantsState:_n,rolesState:Un,resetPhoneNumberState:Jt,sessionsState:Nn,sessionsPolicyState:Gn,restrictionsState:jn,provisioningState:Kn,passkeysState:qn,allAccountsState:yo,allAccountsDialogsState:go,securityCenterState:vo},bo=C({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:()=>{}},Ao);let To;!function(e){e.impersonating="impersonating",e.success="success"}(To||(To={}));const ko={step:To.impersonating,loading:!1},Eo={setImpersonateState:pt("impersonateState"),resetImpersonateState:ft("impersonateState",{impersonateState:ko})},Io={impersonate:ct("impersonation/impersonate",(e=>({payload:e})))},{reducer:Po,actions:Lo}=dt({name:wt,initialState:bo,reducers:C({resetState:e=>C({},e,Ao),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t})),setEntitlements:gt("user","entitlements")},Nt,pn,$t,Eo,Bt,zt,Qt,hn,on,oo,en,sn,dn,Xn,to,bn,En,Ln,wn,Rn,Mn,$n,Bn,Hn,Yn,fo,So,ho)});const Oo=C({loadEntitlements:ct("auth/loadEntitlements",(e=>({payload:e})))},Lo,Mt,gn,xt,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,{},Tn,In,On,Cn,Dn,Fn,xn,Wn,zn,Io,Jn,po,mo);var _o=function(e){return"@@redux-saga/"+e},wo=_o("CANCEL_PROMISE"),Co=_o("CHANNEL_END"),Uo=_o("IO"),Ro=_o("MATCH"),Do=_o("MULTICAST"),No=_o("SAGA_ACTION"),Mo=_o("SELF_CANCELLATION"),Fo=_o("TASK"),Go=_o("TASK_CANCEL"),$o=_o("TERMINATE"),xo=_o("LOCATION");function Vo(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var jo=function(e){return null==e},Bo=function(e){return null!=e},Wo=function(e){return"function"==typeof e},Ko=function(e){return"string"==typeof e},Ho=Array.isArray,zo=function(e){return e&&Wo(e.then)},qo=function(e){return e&&Wo(e.next)&&Wo(e.throw)},Yo=function e(t){return t&&(Ko(t)||Xo(t)||Wo(t)||Ho(t)&&t.every(e))},Jo=function(e){return e&&Wo(e.take)&&Wo(e.close)},Qo=function(e){return Wo(e)&&e.hasOwnProperty("toString")},Xo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Zo=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[wo]=function(){clearTimeout(n)},o},ei=function(e){return function(){return e}},ti=ei(!0),ni=function(){},oi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ii=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ai(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ri=function(e){throw e},li=function(e){return{value:e,done:!0}};function si(e,t,n){void 0===t&&(t=ri),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:li,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function ci(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ui=function(e){return Array.apply(null,new Array(e))},di=function(e){return function(t){return e(Object.defineProperty(t,No,{value:!0}))}},yi=function(e){return e===$o},fi=function(e){return e===Go},pi=function(e){return yi(e)||fi(e)};function gi(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Ho(e)?ui(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||pi(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=ni,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Si(e){return{name:e.name||"anonymous",location:vi(e)}}function vi(e){return e[xo]}var hi=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},mi="TAKE",Ai="CALL",bi="FORK",Ti="SELECT",ki=function(e,t){var n;return(n={})[Uo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Ei(e,t){return void 0===e&&(e="*"),Yo(e)?(Bo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),ki(mi,{pattern:e})):Jo(n=e)&&n[Do]&&Bo(t)&&Yo(t)?ki(mi,{channel:e,pattern:t}):Jo(e)?(Bo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),ki(mi,{channel:e})):void 0;var n}function Ii(e,t){return jo(t)&&(t=e,e=void 0),ki("PUT",{channel:e,action:t})}function Pi(e){var t=ki("ALL",e);return t.combinator=!0,t}function Li(e,t){var n,o=null;return Wo(e)?n=e:(Ho(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Ko(n)&&Wo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Oi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return ki(Ai,Li(e,n))}function _i(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return ki(bi,Li(e,n))}function wi(e){return void 0===e&&(e=Mo),ki("CANCEL",e)}function Ci(e){void 0===e&&(e=oi);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return ki(Ti,{selector:e,args:n})}var Ui=Oi.bind(null,Zo);var Ri=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Di=[],Ni=0;function Mi(e){try{$i(),e()}finally{xi()}}function Fi(e){Di.push(e),Ni||($i(),Vi())}function Gi(e){try{return $i(),e()}finally{Vi()}}function $i(){Ni++}function xi(){Ni--}function Vi(){var e;for(xi();!Ni&&void 0!==(e=Di.shift());)Mi(e)}var ji=function(e){return function(t){return e.some((function(e){return zi(e)(t)}))}},Bi=function(e){return function(t){return e(t)}},Wi=function(e){return function(t){return t.type===String(e)}},Ki=function(e){return function(t){return t.type===e}},Hi=function(){return ti};function zi(e){var t="*"===e?Hi:Ko(e)?Wi:Ho(e)?ji:Qo(e)?Wi:Wo(e)?Bi:Xo(e)?Ki:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var qi={type:Co},Yi=function(e){return e&&e.type===Co};function Ji(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(qi)}))},(e={})[Do]=!0,e.put=function(e){if(!t)if(Yi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Ro](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Hi),t?e(qi):(e[Ro]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),ai(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[No]?l(e):Fi((function(){l(e)}))},r}function Qi(e,t){var n=e[wo];Wo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Xi,Zi=0,ea=function(){return++Zi};function ta(e){e.isRunning()&&e.cancel()}var na=((Xi={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!Yi(e)||r?n(e):n($o)};try{i.take(l,Bo(a)?zi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Xi.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Fi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&zo(t)?Qi(t,n):n(t)}))},Xi.ALL=function(e,t,n,o){var i=o.digestEffect,a=Zi,r=Object.keys(t);if(0!==r.length){var l=gi(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Ho(t)?[]:{})},Xi.RACE=function(e,t,n,o){var i=o.digestEffect,a=Zi,r=Object.keys(t),l=Ho(t)?ui(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||pi(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=ni,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},Xi.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(zo(s))return void Qi(s,n);if(qo(s))return void ya(e,s,l.context,Zi,Si(a),!1,n);n(s)}catch(e){n(e,!0)}},Xi.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){jo(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Xi.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(qo(i))return i;var a=!1;return si((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!zo(i)})}))}catch(e){return si((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Si(t)}(c,a);Gi((function(){var t=ya(e,c,s.context,Zi,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Xi.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&ai(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ho(t)){if(0===t.length)return void n([]);var r=gi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Xi.CANCEL=function(e,t,n,o){var i=o.task;t===Mo?ta(i):Ho(t)?t.forEach(ta):ta(t),n()},Xi.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},Xi.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=hi());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(qi):e.isEmpty()?(n.push(o),o.cancel=function(){ai(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(qi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(qi)}}}}(t.buffer),a=zi(o),r=function t(n){Yi(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},Xi.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Xi.FLUSH=function(e,t,n){t.flush(n)},Xi.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Xi.SET_CONTEXT=function(e,t,n,o){var i=o.task;ii(i.context,t),n()},Xi);function oa(e,t){return e+"?"+t}function ia(e){var t=e.name,n=e.location;return n?t+" "+oa(n.fileName,n.lineNumber):t}function aa(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var ra=null,la=[],sa=function(e){e.crashedEffect=ra,la.push(e)},ca=function(){ra=null,la.length=0},ua=function(){var e,t,n=la[0],o=la.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=vi(e))?t.code+" "+oa(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ia(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+ia(e.meta)})),[aa(la)]).join("\n")};function da(e,t,n,o,i,a,r){var l;void 0===r&&(r=ni);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(ai(i,t),t.cont=ni,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=ni,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,sa({meta:i,cancelledTasks:y}),S.isRoot){var o=ua();ca(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===Go?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={})[Fo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Go,!1))},l.cont=r,l.end=g,l.setContext=function(e){ii(f,e)},l.toPromise=function(){return d||(d=Ri(),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 ya(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){zo(t)?Qi(t,o):qo(t)?ya(e,t,c.context,n,i,!1,o):t&&t[Uo]?(0,na[t.type])(e,t.payload,o,u):o(t)}));d.cancel=ni;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(Go))},status:0},c=da(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ca()):fi(e)?(s.status=1,d.cancel(),i=Wo(t.return)?t.return(Go):{done:!0,value:Go}):i=yi(e)?Wo(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=ea();function s(n,i){a||(a=!0,o.cancel=ni,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){ra=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=ni,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=ni,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function fa(e,t){for(var n=e.channel,o=void 0===n?Ji():n,i=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?ci:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ea();if(s&&(s.rootSagaStarted=s.rootSagaStarted||ni,s.effectTriggered=s.effectTriggered||ni,s.effectResolved=s.effectResolved||ni,s.effectRejected=s.effectRejected||ni,s.effectCancelled=s.effectCancelled||ni,s.actionDispatched=s.actionDispatched||ni,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=oi;var m={channel:o,dispatch:di(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Gi((function(){var e=ya(m,S,l,v,Si(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var pa=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?Ji():a,l=n.sagaMonitor,s=Vo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=fa.bind(null,C({},s,{context:i,channel:r,dispatch:o,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){ii(i,e)},c},ga=function(e){return{done:!0,value:e}},Sa={};function va(e){return Jo(e)?"channel":Qo(e)?String(e):Wo(e)?e.name:String(e)}function ha(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Sa)return ga(t);if(n&&!i)throw r=Sa,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Sa?ga(t):a}return si(l,(function(e){return l(null,e)}),n)}function ma(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ei(e)},l=function(e){return{done:!1,value:_i.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ha({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+va(e)+", "+t.name+")")}function Aa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:Ei(e)},s=function(e){return{done:!1,value:_i.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:wi(e)}},u=function(e){return a=e},d=function(e){return r=e};return ha({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("+va(e)+", "+t.name+")")}function ba(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Ei(e)},l=function(e){return{done:!1,value:Oi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ha({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+va(e)+", "+t.name+")")}function Ta(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:Oi.apply(void 0,[n].concat(a))},s={done:!1,value:Ui(t)};return ha({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Sa}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function ka(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return _i.apply(void 0,[ma,e,t].concat(o))}function Ea(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return _i.apply(void 0,[Aa,e,t].concat(o))}function Ia(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return _i.apply(void 0,[ba,e,t].concat(o))}class Pa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null}static getInstance(){return Pa.instance||(Pa.instance=new Pa),Pa.instance}static setContext(e){Pa.getInstance().context=e}static setAccessToken(e){Pa.getInstance().accessToken=e}static setUser(e){Pa.getInstance().user=e}static setRequestSource(e){Pa.getInstance().requestSource=e}static setOnRedirectTo(e){Pa.getInstance().onRedirectTo=e}static setLogout(e,t){Pa.getInstance().logout=n=>{n?e(n):Pa.onRedirectTo(t)}}static setEntitlementsOptions(e){Pa.getInstance().entitlementsOptions=e}static setAppName(e){Pa.getInstance().appName=e}static getContext(){var e;return null!=(e=Pa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Pa.getInstance().accessToken}static getRequestSource(){return Pa.getInstance().requestSource}static getUser(){return Pa.getInstance().user}static onRedirectTo(e,t){return Pa.getInstance().onRedirectTo(e,t)}static logout(e){return Pa.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Pa.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return Pa.getInstance().appName}}Pa.instance=void 0;const La={getContext:()=>Pa.getContext(),getAccessToken:()=>Pa.getAccessToken(),getUser:()=>Pa.getUser(),onRedirectTo:(e,t)=>Pa.onRedirectTo(e,t),logout:e=>Pa.logout(e)};class Oa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const _a={v1:"/identity/resources/users/webauthn/v1/devices"},wa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ca={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}},passwords:{resetBreachedPasswords:{v1:"identity/resources/users/v1/passwords/breached/reset/bulk"}}},Ua={v1:"/identity/resources/configurations/v1"},Ra={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Da={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Na={v1:"/identity/resources/permissions/v1"},Ma={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Fa={v1:"/identity/resources/roles/v1"},Ga={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},$a={v1:"/identity/resources/impersonation/v1"},xa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Va={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ja={v1:"/team/resources/members/v1"},Ba={v1:"/team/resources/roles/v1"},Wa={v1:"/team/resources/stats/v1"},Ka={v1:"/team/resources/profile"},Ha={v1:"/tenants/resources/account-settings/v1"},za={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},qa={v1:"/tenants/resources/sub-tenants/v1"},Ya={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ja={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"}}}},Qa={v1:"/subscriptions/resources/payment-providers/v1"},Xa={v1:"/subscriptions/resources/subscriptions/v1"},Za={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},er={v1:"/reports/engine/resources/triggers/v1"},tr="/notification",nr="/audits",or={v1:"/event/resources/configurations/v1"},ir="/webhook",ar="/oauth",rr="/flags",lr="/directory/resources/v1/configurations/scim2",sr="/directory/resources/scim/temp",cr="/entitlements/api/v1/user-entitlements",ur={v1:"/security-center/resources/recommendations/v1"},dr={v1:"/security-center/resources/insights/v1"};function yr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function fr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ao.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ao.frameWork]=e.metadataHeaders.framework),o}const pr=async e=>{var t,n,o;const i=Pa.getContext(),a=await async function(e,t){var n;const o=fr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Pa.getAccessToken)(),a=Pa.getRequestSource();t&&(o[ao.contentType]=t),a&&(o[ao.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=yr(e,t),i=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 o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,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:C({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.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 Oa("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}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=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Oa(t?e:"We're facing some difficulties, Please try again",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{}}},gr=async(e,t,n)=>pr(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Sr=async(e,t,n)=>pr(C({url:e,method:"POST",contentType:"application/json",body:t},n)),vr=async(e,t,n)=>pr(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),hr=async(e,t,n)=>pr(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),mr=async(e,t,n)=>pr(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ar=async(e,t,n,o)=>pr(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),br=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{});async function Tr(e){return hr(`${Ca.v1}/tenant`,e)}async function kr(){return gr(`${Ca.v2}/me/tenants`)}async function Er(e){return gr(za.v1,void 0,{headers:br(e)})}async function Ir(e){return gr(za.tree.v1,void 0,{headers:br(e)})}async function Pr(e){return gr(za.parents.v1,void 0,{headers:br(e)})}async function Lr(e,t){return gr(`${za.parents.v1}/${e}`,void 0,{headers:br(t)})}async function Or(e,t){return Sr(`${Ma.users.v1}/count`,e,{headers:br(t)})}async function _r(e,t){return gr(za.v2,e,{headers:br(t)})}async function wr(e,t){return gr(za.metadata.v2,C({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:br(t)})}async function Cr(){return gr(Ua.v1)}async function Ur(){return gr(`${Ua.v1}/mfa-policy`)}async function Rr(){return gr(`${Ua.v1}/mfa-policy/vendor`)}async function Dr(e){return e.id?vr(`${Ua.v1}/mfa-policy`,e):Sr(`${Ua.v1}/mfa-policy`,e)}async function Nr(){return gr(`${Ua.v1}/lockout-policy`)}async function Mr(){return gr(`${Ua.v1}/lockout-policy/vendor`)}async function Fr(e){return e.id?vr(`${Ua.v1}/lockout-policy`,e):Sr(`${Ua.v1}/lockout-policy`,e)}async function Gr(){try{return await gr(`${Ua.v1}/captcha-policy/public`)}catch{return null}}async function $r(){return gr(`${Ua.v1}/password-history-policy`)}async function xr(){return gr(`${Ua.v1}/password-history-policy/vendor`)}async function Vr(e){return e.id?vr(`${Ua.v1}/password-history-policy`,e):Sr(`${Ua.v1}/password-history-policy`,e)}async function jr(){return gr(`${Ua.v1}/password`)}async function Br(){return gr(`${Ra.emailDomain.v1}`)}async function Wr(){return gr(`${Ra.emailDomain.v1}/config`)}async function Kr(e){return Sr(`${Ra.emailDomain.v1}`,e)}async function Hr(e){return Sr(`${Ra.emailDomain.v1}/config`,e)}async function zr(e){return mr(`${Ra.emailDomain.v1}/${e}`)}async function qr(e){return gr(`${Ra.ip.v1}`,e)}async function Yr(){return gr(`${Ra.ip.v1}/config`)}async function Jr(e){return Sr(`${Ra.ip.v1}`,e)}async function Qr(e){return Sr(`${Ra.ip.v1}/bulk`,e)}async function Xr(e){return Sr(`${Ra.ip.v1}/config`,e)}async function Zr(e){return mr(`${Ra.ip.v1}/${e}`)}async function el(){return Sr(`${Ra.ip.v1}/verify`)}async function tl(){return Sr(`${Ra.ip.v1}/verify/allow`)}let nl,ol,il;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(nl||(nl={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ol||(ol={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(il||(il={}));class al extends Error{constructor(e){super(e)}}const rl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new al("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class ll extends Error{constructor(e){super(e)}}const sl=(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(rl(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 rl(t)}})(e.split(".")[n]))}catch(e){throw new ll("Invalid token specified: "+e.message)}};async function cl(e){return Sr(`${Ca.v3}/me/token`,e)}async function ul(e,t){return gr(Ca.v2,e,{headers:br(t)})}async function dl(e,t){return gr(Ca.v3,e,{headers:br(t)})}async function yl(e,t){return gr(Ca.roles.v3,C({},e,{ids:e.ids.join(",")}),{headers:br(t)})}async function fl(e,t){return gr(Ca.groups.v3,C({},e,{ids:e.ids.join(",")}),{headers:br(t)})}async function pl(e){return gr(Ca.tenants.me.v3,void 0,{headers:br(e)})}async function gl(){return Sr(Ca.passwords.resetBreachedPasswords.v1)}async function Sl(e){return hr(`${Ca.v2}/me`,e)}async function vl(){return gr(cr)}let hl;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(hl||(hl={}));const ml="admin_portal_entitlements",Al={flags:{}};class bl{constructor(){var e;this._flags={},this._flags=null!=(e=Al.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new bl;return n.set(e),bl._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=C({},null!=(t=null==Al?void 0:Al.flags)?t:{},null!=e?e:{})}}async function Tl(){return gr(rr)}bl._instances={};const kl=["type"],El=["type"],Il=["type"];async function Pl(e){if(!e.accessToken)return e;Pa.setAccessToken(e.accessToken);const t=await lu(),n=C({},e,e.accessToken?sl(e.accessToken):{},t);return Pa.setUser(n),n}async function Ll(e){if(!e.accessToken)return{user:e};Pa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([lu(),kr()]),o=C({},e,e.accessToken?sl(e.accessToken):{},t);return Pa.setUser(o),{user:o,tenants:n}}async function Ol(e){const{accessToken:t}=e;if(!t)return{user:e};Pa.setAccessToken(t);const[n,o]=await Promise.all([lu(),pl()]),i=C({},e,t?sl(t):{},n);return Pa.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function _l(e){Pa.setAccessToken(e.id_token);const t=await lu(),n=e.id_token?sl(e.id_token):{},o=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Pa.setUser(o),o}async function wl(e){Pa.setAccessToken(e.id_token);const[t,n]=await Promise.all([lu(),pl()]),o=e.id_token?sl(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Pa.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Cl(e){try{const{address:t}=await Sr(`${wa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Ul(e){return Sr(`${wa.v1}/user/saml/prelogin`,e)}async function Rl(e){return Pl(await Sr(`${wa.v1}/user/saml/postlogin`,e))}async function Dl(e){return Pl(await Sr(`${wa.v1}/user/oidc/postlogin`,e))}async function Nl(e){return Pl(await Sr(`${wa.v1}/user`,e))}async function Ml(e){return Ol(await Sr(`${wa.v1}/user`,e))}async function Fl(e){return Pl(await Sr(`${wa.v1}/user/mfa/verify`,e))}async function Gl(e){return Ol(await Sr(`${wa.v1}/user/mfa/verify`,e))}async function $l(e){return Sr(`${Ca.v1}/activate`,e)}async function xl(e){return Ol(await Sr(`${Ca.v1}/activate`,e))}async function Vl(e){return gr(`${Ca.v1}/activate/strategy`,e)}async function jl(e){return Sr(`${Ca.v1}/activate/reset`,e)}async function Bl(e){return Sr(`${Ca.v1}/invitation/reset`,e)}async function Wl(e){return Sr(`${Ca.v1}/invitation/accept`,e)}async function Kl(){return Pl(await Sr(`${wa.v1}/user/token/refresh`))}async function Hl(){return Ll(await Sr(`${wa.v1}/user/token/refresh`))}async function zl(){return Ol(await Sr(`${wa.v1}/user/token/refresh`))}async function ql(){return Sr(`${wa.v1}/logout`)}async function Yl(e){return gr(`${ar}/logout`,e)}async function Jl(e){return Sr(`${Ca.v1}/passwords/reset`,e)}async function Ql(e){return Sr(`${Ca.v1}/passwords/reset/verify`,e)}async function Xl(e){return gr(`${Ca.v1}/passwords/config`,e)}async function Zl(e){return Sr(`${wa.v1}/user/mfa/recover`,e)}async function es(){return Sr(`${Ca.v1}/mfa/enroll`)}async function ts(){return Sr(`${Ca.v1}/mfa/authenticator/enroll`)}async function ns(e){return Sr(`${Ca.v1}/mfa/authenticator/enroll/verify`,e)}async function os(e){return Sr(`${Ca.v1}/mfa/sms/enroll`,e)}async function is(e){return Sr(`${Ca.v1}/mfa/sms/enroll/verify`,e)}async function as(){return Sr(`${Ca.v1}/mfa/webauthn/enroll`)}async function rs(e){return Sr(`${Ca.v1}/mfa/webauthn/enroll/verify`,e)}async function ls(e){return Sr(`${Ca.v1}/mfa/enroll/verify`,e)}async function ss(e){return Sr(`${Ca.v1}/mfa/disable`,e)}async function cs(e,t){return Sr(`${Ca.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function us(e){return Sr(`${Ca.v1}/mfa/sms/${e}/disable`)}async function ds(e,t){return Sr(`${Ca.v1}/mfa/sms/${e}/disable/verify`,t)}async function ys(e){return Sr(`${Ca.v1}/mfa/webauthn/${e}/disable`)}async function fs(e,t){return Sr(`${Ca.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function ps(){return gr(`${Ca.v1}/mfa/devices`)}async function gs(e){return Sr(`${wa.v1}/user/mfa/authenticator/enroll`,e)}async function Ss(e){return Sr(`${wa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function vs(e){return Ol(await Sr(`${wa.v1}/user/mfa/authenticator/enroll/verify`,e))}async function hs(e,t){return Sr(`${wa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function ms(e){return Sr(`${wa.v1}/user/mfa/emailcode`,e)}async function As(e){return Sr(`${wa.v1}/user/mfa/emailcode/verify`,e)}async function bs(e){return Ol(await Sr(`${wa.v1}/user/mfa/emailcode/verify`,e))}async function Ts(e){return Sr(`${wa.v1}/user/mfa/sms/enroll`,e)}async function ks(e){return Sr(`${wa.v1}/user/mfa/sms/enroll/verify`,e)}async function Es(e){return Ol(await Sr(`${wa.v1}/user/mfa/sms/enroll/verify`,e))}async function Is(e,t){return Sr(`${wa.v1}/user/mfa/sms/${e}`,t)}async function Ps(e,t){return Sr(`${wa.v1}/user/mfa/sms/${e}/verify`,t)}async function Ls(e,t){return Ol(await Sr(`${wa.v1}/user/mfa/sms/${e}/verify`,t))}async function Os(e){return Sr(`${wa.v1}/user/mfa/webauthn/enroll`,e)}async function _s(e){return Sr(`${wa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function ws(e){return Ol(await Sr(`${wa.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Cs(e,t){return Sr(`${wa.v1}/user/mfa/webauthn/${e}`,t)}async function Us(e,t){return Sr(`${wa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Rs(e,t){return Ol(await Sr(`${wa.v1}/user/mfa/webauthn/${e}/verify`,t))}async function Ds(){return gr(`${Va.v1}/saml/configurations`)}async function Ns(e){return Sr(`${Va.v1}/saml/configurations`,e)}async function Ms(){return gr(`${Va.v1}/saml/configurations/vendor-config`)}async function Fs(e){return hr(`${Va.v1}/saml/configurations/metadata`,e)}async function Gs(){return hr(`${Va.v1}/saml/validations/domain`)}async function $s(){return gr(`${Va.v1}/saml/configurations/roles/default`)}async function xs(){return gr(`${Va.v2}/saml/configurations/groups`)}async function Vs({roleIds:e}){return Sr(`${Va.v1}/saml/configurations/roles/default`,{roleIds:e})}async function js({roleIds:e,group:t}){return Sr(`${Va.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Bs({roleIds:e,group:t,id:n}){return vr(`${Va.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Ws({id:e}){return mr(`${Va.v2}/saml/configurations/groups/${e}`)}async function Ks(){return gr(`${Va.v1}/oidc/configurations`)}async function Hs(){return gr(`${Va.v2}/configurations/public`)}async function zs(){return gr(Da.v1)}async function qs(){return gr(Da.v2)}async function Ys(){return gr(`${Da.v2}/authenticated`)}async function Js(){return gr(Da.custom.v1)}async function Qs({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),Sr(`${wa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Xs(){return gr(`${Ua.v1}/public`)}async function Zs(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await Sr(`${Ca.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await Ol(n);return C({},a,{user:e,tenants:t,activeTenant:o})}return a}async function ec(){return gr(Ca.sessions.currentUser.v1)}async function tc(){return gr(`${Ca.sessions.currentUser.v1}/current`)}async function nc(e){return Sr(`${Ca.sessions.v1}/revoke`,{userId:e})}async function oc(){return gr(Ca.sessions.configurations.v1)}async function ic(e){await Sr(Ca.sessions.configurations.v1,e)}async function ac(e){await mr(`${Ca.sessions.currentUser.v1}/${e}`)}async function rc(){await mr(`${Ca.sessions.currentUser.v1}/all`)}async function lc(){return gr(Ca.accessTokens.v1)}async function sc(){return gr(Ma.accessTokens.v1)}async function cc({id:e}){return mr(`${Ma.accessTokens.v1}/${e}`)}async function uc({id:e}){return mr(`${Ca.accessTokens.v1}/${e}`)}async function dc(e){return Sr(Ca.accessTokens.v1,e)}async function yc(e){return Sr(Ma.accessTokens.v1,e)}async function fc(){return gr(Ca.apiTokens.v1)}async function pc(){return gr(Ma.apiTokens.v1)}async function gc(e){return Sr(Ca.apiTokens.v1,e)}async function Sc(e){return Sr(Ma.apiTokens.v2,e)}async function vc({tokenId:e}){return mr(`${Ma.apiTokens.v1}/${e}`)}async function hc({tokenId:e}){return mr(`${Ca.apiTokens.v1}/${e}`)}async function mc({userId:e}){return gr(`${Ca.v1}/${e}`)}async function Ac(e){return gr(`${Ua.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function bc(e){let{type:t}=e,n=Vo(e,kl);return Sr(`${wa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Tc(e){let{type:t}=e,n=Vo(e,El);return Ol(await Sr(`${wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function kc(e){let{type:t}=e,n=Vo(e,Il);return Sr(`${wa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ec({token:e}){return Sr(Ma.invites.verify.v1,{token:e})}async function Ic(){return gr(`${Va.v1}/configurations`)}async function Pc(e){return Sr(`${Va.v1}/configurations`,e)}async function Lc(e,t){return vr(`${Va.v1}/configurations/${e}`,t)}async function Oc(e){return mr(`${Va.v1}/configurations/${e}`)}async function _c(e){return Sr(`${Va.v1}/configurations/metadata`,e)}async function wc(e,t){return hr(`${Va.v1}/configurations/${e}/metadata`,t)}async function Cc(e,t){return Sr(`${Va.v1}/configurations/${e}/domains`,t)}async function Uc(e,t){return mr(`${Va.v1}/configurations/${e}/domains/${t}`)}async function Rc(e,t){return hr(`${Va.v1}/configurations/${e}/domains/${t}/validate`)}async function Dc(e){return gr(`${Va.v1}/configurations/${e}/roles`)}async function Nc(e,t){return hr(`${Va.v1}/configurations/${e}/roles`,t)}async function Mc(e,t){return Sr(`${Va.v1}/configurations/${e}/groups`,t)}async function Fc(e,{roleIds:t,group:n,id:o}){return vr(`${Va.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Gc(e,t){return mr(`${Va.v1}/configurations/${e}/groups/${t}`)}async function $c(e){return gr(`${Va.v1}/configurations/${e}/groups`)}async function xc(e){return Sr(`${wa.v2}/user/sso/prelogin`,e)}async function Vc(e){return Pl(await Sr(`${wa.v2}/user/oidc/postlogin`,e))}async function jc(e){return wl(await Sr(`${ar}/token`,e))}async function Bc(){return wl(await Sr(`${ar}/authorize/silent`))}async function Wc(e){return _l(await Sr(`${ar}/token`,e))}async function Kc(){return _l(await Sr(`${ar}/authorize/silent`))}async function Hc(e){return Sr(`${Ca.v1}/phone/reset`,e)}async function zc(e){return Sr(`${Ca.v1}/phone/reset/verify`,e)}async function qc(e){return Sr(`${Ca.v1}/phone`,e)}async function Yc(e){return Sr(`${Ca.v1}/phone/verify`,e)}async function Jc(e){return hr(`${Ca.v1}/phone/change`,e)}async function Qc(e){return Sr(`${wa.v1}/webauthn/prelogin`,e)}async function Xc(e){return Sr(`${wa.v1}/webauthn/postlogin`,e)}async function Zc(e){return Ol(await Sr(`${wa.v1}/webauthn/postlogin`,e))}async function eu(){return Sr(_a.v1)}async function tu(){return gr(_a.v1)}async function nu(e){return mr(`${_a.v1}/${e}`)}async function ou(e){return Sr(`${_a.v1}/verify`,e)}async function iu(){return gr(`${Ua.v1}/auth/strategies/public`)}async function au(){return gr(`${Ua.v1}/auth/strategies`)}async function ru(){return gr(`${Ua.v1}/mfa/strategies`)}async function lu(){const e=gr(`${Ca.v2}/me`);if(function(){if(!Pa.shouldLoadEntitlements())return!1;const[e]=bl.getFeatureFlags([ml],Pa.getAppName()||"");return e}()){const[t,n]=await Promise.all([e,vl()]);return C({},t,{entitlements:n})}return await e}async function su(e){return gr(`${Ca.v2}/me`,null!=e?e:{addRoles:!0})}async function cu(e){return hr(`${Ca.v2}/me`,e)}async function uu(e){return hr(`${Ka.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function du(e){return Sr(`${Ca.v1}/passwords/change`,e)}async function yu(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>C({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return gr(ja.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function fu(e){return Sr(Ca.v2,C({},e,{provider:"local"}))}async function pu(e){return mr(`${ja.v1}/${e.userId}`)}async function gu(e){return hr(ja.v1,e)}async function Su(e){return Sr(Ma.invites.user.v1,C({},e))}async function vu(e){return vr(Ma.invites.user.v1,C({},e))}async function hu(){return mr(Ma.invites.user.v1)}async function mu(){return gr(Ma.invites.user.v1)}async function Au(){return gr(Ma.invites.configuration.v1)}async function bu(){return gr(Ba.v1)}async function Tu(){return gr(Na.v1)}async function ku(){return gr(`${Wa.v1}/members`)}async function Eu(e){return Sr(`${ja.v1}/${e.userId}/resendActivationEmail`,{})}async function Iu(e){return Sr(Ca.v2,C({},e,{provider:"local"}))}async function Pu(e){return Sr(Ca.invitation.resendAll.v1,C({},e))}async function Lu(e){var t,n;const o=await gr("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Ou(){return gr("/metadata/admin-box")}async function _u(e){return Sr("/metadata/admin-box",e)}async function wu(){const e=await gr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Cu=async()=>Lu({entityName:"notifications"}),Uu=async()=>Lu({entityName:"saml"}),Ru=async()=>Lu({entityName:"audits"}),Du=async e=>async function(e){const t=await gr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Nu=["dataFilters"],Mu=["templateId","dataFilters"],Fu=["dataFilters"];async function Gu(e){return gr(`${Za.v2}/tenant-reports`,e)}async function $u(e){return gr(`${Za.v2}/${e.id}/tenant-reports`)}async function xu(e){let{dataFilters:t}=e,n=Vo(e,Nu);return{html:await gr(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Vu(e){let{templateId:t,dataFilters:n}=e,o=Vo(e,Mu);return Sr(`${Za.v2}/${t}/tenant-reports`,C({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ju(e){let{dataFilters:t}=e,n=Vo(e,Fu);const o=await gr(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),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 Bu(e){return Sr(`${er.v1}/tenant-reports`,e)}async function Wu(e){return gr(tr,{params:e})}async function Ku(e){return hr(`${tr}/status`,{params:e})}async function Hu(e){const{notificationId:t,pinStatus:n}=e;return hr(`${tr}/${n}`,{notificationId:t})}async function zu(){return Sr(`${tr}/status/mark-all-read`)}const qu=["endpoint","headerProps"];async function Yu(e){return gr(nr,e)}async function Ju(e){return gr(`${nr}/stats`,e)}async function Qu(e){const{endpoint:t,headerProps:n}=e,o=Vo(e,qu);return Ar(`${nr}/export/${t}`,{properties:n},o)}const Xu=["eventKey"],Zu=["eventKey"],ed=()=>gr(`${Ya.v1}/slack`),td=()=>gr(`${Ya.v1}/slack/applications`),nd=()=>gr(`${Ya.v1}/slack/channels`),od=e=>e.id?vr(`${Ya.v1}/slack/subscription/${e.id}`,e):Sr(`${Ya.v1}/slack/subscriptions`,e),id=e=>mr(`${Ya.v1}/slack/subscriptions/${e.id}`),ad=e=>Sr(`${Ya.v1}/slack/applications/registrations`,{code:e}),rd=()=>gr(`${Ya.v1}/emails`),ld=e=>{let{eventKey:t}=e,n=Vo(e,Xu);return Sr(`${Ya.v1}/emails/${t}`,n)},sd=({eventKey:e,enabled:t})=>vr(`${Ya.v1}/emails/${e}`,{enabled:t}),cd=(e,t)=>mr(`${Ya.v1}/emails/${e}/subscriptions/${t}`),ud=(e,t,n)=>hr(`${Ya.v1}/emails/${t}/subscriptions/${e}`,n),dd=e=>mr(`${Ya.v1}/emails/${e}`),yd=()=>gr(`${Ya.v2}/sms`),fd=e=>{let{eventKey:t}=e,n=Vo(e,Zu);return Sr(`${Ya.v2}/sms/${t}`,n)},pd=({eventKey:e,enabled:t})=>vr(`${Ya.v2}/sms/${e}`,{enabled:t}),gd=(e,t)=>mr(`${Ya.v2}/sms/${e}/subscriptions/${t}`),Sd=(e,t,n)=>hr(`${Ya.v2}/sms/${t}/subscriptions/${e}`,n),vd=e=>mr(`${Ya.v2}/sms/${e}`),hd=()=>gr(ir),md=e=>e._id?vr(`${ir}/${e._id}`,e):Sr(`${ir}/custom`,e),Ad=e=>mr(`${ir}/${e}`),bd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return gr(`${ir}/logs/?${o.toString()}`)},Td=e=>Sr(`${ir}/test`,e),kd=e=>Sr(`${ir}/logs/${e}/retries`),Ed=()=>gr(`${or.v1}/categories`),Id=e=>gr(or.v1,{channels:e});async function Pd(e,t){return hr(Ha.v1,e,{headers:br(t)})}async function Ld(e){return gr(Ha.v1,void 0,{headers:br(e)})}async function Od(){return gr(`${Ha.v1}/public`)}const _d=["roleId"],wd=["roleId"],Cd=["permissionId"];async function Ud(){return gr(Fa.v1)}async function Rd(e){return Sr(Fa.v1,e)}async function Dd({roleId:e}){return mr(`${Fa.v1}/${e}`)}async function Nd(e){let{roleId:t}=e,n=Vo(e,_d);return vr(`${Fa.v1}/${t}`,n)}async function Md(e){let{roleId:t}=e,n=Vo(e,wd);return hr(`${Fa.v1}/${t}/permissions`,n)}async function Fd(){return gr(Na.v1)}async function Gd(e){let{permissionId:t}=e,n=Vo(e,Cd);return hr(`${Na.v1}/${t}/roles`,n)}async function $d(){return gr(`${Na.v1}/categories`)}async function xd(){return gr(Ja.subscriptions.v1)}async function Vd(e){return gr(`${Ja.subscriptions.v1}/${e}`)}async function jd(e){return hr(`${Ja.subscriptions.v1}/${e}/cancellations/`,{})}async function Bd(e){return hr(`${Ja.subscriptions.v1}/${e}/renewals/`,{})}async function Wd(e,{paymentMethodId:t,planId:n}){return hr(`${Ja.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Kd(e){return gr(`${Xa.v1}/${e}`)}async function Hd(){return gr(`${Xa.v1}`)}async function zd(e){return hr(`${Xa.v1}/${e}/cancellations/`,{})}async function qd(e){return hr(`${Xa.v1}/${e}/renewals/`,{})}async function Yd(e,{paymentMethodId:t,planId:n}){return hr(`${Xa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Jd(){return gr(Ja.plans.v1)}async function Qd(e){return gr(`${Ja.plans.v1}/${e}`)}async function Xd(){return gr(Ja.invoices.v1)}async function Zd(e){return gr(`${Ja.invoices.v1}/${e}`)}async function ey(e,t){return gr(`${Ja.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const ty=["email"];async function ny(){return gr(Ja.paymentMethods.v1)}async function oy(e){return gr(`${Ja.paymentMethods.v1}/${e}`)}async function iy(e,t){let{email:n}=t,o=Vo(t,ty);return vr(`${Ja.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function ay(e){return Sr(Ja.paymentProviders.stripe.subscriptions.v1,e)}async function ry(e){return gr(`${Ja.paymentProviders.stripe.customers.v1}/${e}`)}async function ly(e){return Sr(`${Ja.paymentProviders.stripe.customers.v1}`,e)}async function sy(){return gr(`${Ja.paymentProviders.stripe.publicConfigurations.v1}`)}async function cy(e){return Sr(`${Ja.paymentProviders.stripe.setupIntents.v1}`,e)}async function uy(e){return gr(`${Ja.summaries.v1}/${e}`)}async function dy(e){return gr(`${Ja.tenantConfiguration.v1}/${e}`)}async function yy(e){return Sr(`${Ja.tenantConfiguration.v1}`,e)}async function fy(){return gr(Qa.v1)}async function py(){return gr(`${Ja.configurations.vendorPublicConfigurations.v1}`)}let gy,Sy,vy,hy,my,Ay;async function by(){return gr("/vendors/public")}async function Ty(e){return gr(Ga.v1,e)}async function ky(e){return Sr(Ga.v1,e)}async function Ey(e,t){return mr(Ga.v1,e,{headers:br(t)})}async function Iy(e,t,n){return Sr(`${Ga.v1}/${e}/roles`,t,{headers:br(n)})}async function Py(e,t,n){return mr(`${Ga.v1}/${e}/roles`,t,{headers:br(n)})}async function Ly(e,t,n){return vr(`${Ga.v1}/${e}/roles`,t,{headers:br(n)})}async function Oy(e,t){return Sr(qa.v1,e,{headers:br(t)})}async function _y(e,t){return mr(`${qa.v1}/${e}`,void 0,{headers:br(t)})}async function wy({tenantId:e},t,n){return vr(`${qa.v1}/${e}`,t,{headers:br(n)})}async function Cy(e,t,n){return hr(`${Ga.v1}/${e}/access`,t,{headers:br(n)})}async function Uy(e,t){return Sr(`${Ga.v2}/`,e,{headers:br(t)})}async function Ry(){return gr(`${lr}`)}async function Dy(e,t){return vr(`${lr}/${e}`,t)}async function Ny(e){return Sr(`${lr}`,e)}async function My(e){return mr(`${lr}/${e}`)}async function Fy(e){return gr(`${sr}/${e}/Users/count`)}async function Gy(e){return Sr(`${$a.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(gy||(gy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Sy||(Sy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(vy||(vy={})),(hy||(hy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(my||(my={})),function(e){e.CREATE="create_customer"}(Ay||(Ay={}));const $y=["groupId"];async function xy({groupId:e},t){return gr(`${xa.v1}/${e}`,C({},t))}async function Vy(e){return gr(`${xa.v1}`,C({},e))}async function jy(e,t){return Sr(`${xa.getByIds.v1}`,e,{params:t})}async function By(e){return Sr(`${xa.v1}`,e)}async function Wy(e){let{groupId:t}=e,n=Vo(e,$y);return vr(`${xa.v1}/${t}`,n)}async function Ky(e){return mr(`${xa.v1}/${e}`)}async function Hy(e,t){return Sr(`${xa.v1}/${e}/roles`,t)}async function zy(e,t){return mr(`${xa.v1}/${e}/roles`,t)}async function qy(e,t){return Sr(`${xa.v1}/${e}/users`,t)}async function Yy(e,t){return mr(`${xa.v1}/${e}/users`,t)}async function Jy(){return gr(`${xa.configurations.v1}`)}async function Qy(e){return Sr(`${xa.configurations.v1}`,e)}async function Xy(){return gr(ur.v1)}async function Zy(){return gr(dr.v1)}let ef,tf,nf,of,af,rf;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(ef||(ef={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(tf||(tf={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(nf||(nf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(of||(of={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(af||(af={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(rf||(rf={}));const lf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],sf=`${wa.v1}/user/token/refresh`,cf=`${ar}/authorize/silent`,uf=`${Ca.v2}/me`,df=`${Ca.v2}/me/tenants`,yf=`${Ca.v3}/me/tenants`;let ff,pf,gf,Sf,vf,hf,mf,Af;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(ff||(ff={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(pf||(pf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(gf||(gf={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS"}(Sf||(Sf={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.STALE_USERS_EXIST="STALE_USERS_EXIST",e.NO_STALE_USERS_EXIST="NO_STALE_USERS_EXIST",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST"}(vf||(vf={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS"}(hf||(hf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(mf||(mf={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN"}(Af||(Af={}));const bf={auth:l,teams:s,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:t,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:r,directory:m,impersonate:A,groups:b,users:i,entitlements:a,securityCenter:T};var Tf={fetch:e,ContextHolder:Pa,FronteggContext:La,api:bf,FronteggApiError:Oa,AuthStrategyEnum:ol,MachineToMachineAuthStrategy:il,SocialLoginProviders:nl,ISubscriptionCancellationPolicy:vy,ISubscriptionStatus:gy,PaymentMethodType:Sy,ProviderType:hy};let kf,Ef;!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"}(kf||(kf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Ef||(Ef={}));const If="input is invalid type",Pf="undefined"!=typeof ArrayBuffer,Lf="0123456789abcdef".split(""),Of=[-2147483648,8388608,32768,128],_f=[24,16,8,0],wf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Cf=["hex","array","digest","arrayBuffer"],Uf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Pf&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Rf=function(e){return function(t){const n=new Nf(!0).update(t);return null==n?void 0:n[e]()}},Df=function(e){return function(t,n){const o=new Mf(t,!0).update(n);return null==o?void 0:o[e]()}};class Nf{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>Nf.prototype.digest(),e?(Uf[0]=Uf[16]=Uf[1]=Uf[2]=Uf[3]=Uf[4]=Uf[5]=Uf[6]=Uf[7]=Uf[8]=Uf[9]=Uf[10]=Uf[11]=Uf[12]=Uf[13]=Uf[14]=Uf[15]=0,this.blocks=Uf):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(If);if(null===e)throw new Error(If);if(Pf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Pf&&ArrayBuffer.isView(e)))throw new Error(If);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<_f[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<_f[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<_f[3&i++],l[i>>2]|=(128|63&o)<<_f[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<_f[3&i++],l[i>>2]|=(128|o>>6&63)<<_f[3&i++],l[i>>2]|=(128|63&o)<<_f[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<_f[3&i++],l[i>>2]|=(128|o>>12&63)<<_f[3&i++],l[i>>2]|=(128|o>>6&63)<<_f[3&i++],l[i>>2]|=(128|63&o)<<_f[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Of[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+wf[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+wf[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+wf[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+wf[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=Lf[e>>28&15]+Lf[e>>24&15]+Lf[e>>20&15]+Lf[e>>16&15]+Lf[e>>12&15]+Lf[e>>8&15]+Lf[e>>4&15]+Lf[15&e]+Lf[t>>28&15]+Lf[t>>24&15]+Lf[t>>20&15]+Lf[t>>16&15]+Lf[t>>12&15]+Lf[t>>8&15]+Lf[t>>4&15]+Lf[15&t]+Lf[n>>28&15]+Lf[n>>24&15]+Lf[n>>20&15]+Lf[n>>16&15]+Lf[n>>12&15]+Lf[n>>8&15]+Lf[n>>4&15]+Lf[15&n]+Lf[o>>28&15]+Lf[o>>24&15]+Lf[o>>20&15]+Lf[o>>16&15]+Lf[o>>12&15]+Lf[o>>8&15]+Lf[o>>4&15]+Lf[15&o]+Lf[i>>28&15]+Lf[i>>24&15]+Lf[i>>20&15]+Lf[i>>16&15]+Lf[i>>12&15]+Lf[i>>8&15]+Lf[i>>4&15]+Lf[15&i]+Lf[a>>28&15]+Lf[a>>24&15]+Lf[a>>20&15]+Lf[a>>16&15]+Lf[a>>12&15]+Lf[a>>8&15]+Lf[a>>4&15]+Lf[15&a]+Lf[r>>28&15]+Lf[r>>24&15]+Lf[r>>20&15]+Lf[r>>16&15]+Lf[r>>12&15]+Lf[r>>8&15]+Lf[r>>4&15]+Lf[15&r];return s+=Lf[l>>28&15]+Lf[l>>24&15]+Lf[l>>20&15]+Lf[l>>16&15]+Lf[l>>12&15]+Lf[l>>8&15]+Lf[l>>4&15]+Lf[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class Mf extends Nf{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(If);if(null===e)throw new Error(If);if(Pf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Pf&&ArrayBuffer.isView(e)))throw new Error(If)}var i;e.length>64&&(e=null==(i=new Nf(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Nf.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Nf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Nf.prototype.finalize.call(this)}}}const Ff=function(){const e=Rf("hex");e.create=function(){return new Nf},e.update=function(t){return e.create().update(t)};for(let t=0;t<Cf.length;++t){const n=Cf[t];e[n]=Rf(n)}return e}();function Gf(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function $f(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(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,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=Ff.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function xf(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Df("hex");e.create=function(e){return new Mf(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Cf.length;++t){const n=Cf[t];e[n]=Df(n)}}();const Vf=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*jf(e){const t=yield Ci((e=>e.root.appName));return bl.getFeatureFlags(e,t)}const Bf={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Wf=C({},Bf,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Kf=[{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"}],Hf={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},zf=C({},Hf,{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}),qf={loading:!1,error:void 0,saving:!0,profile:Hf},Yf={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"},Jf={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ol.EmailAndPassword,machineToMachineAuthStrategy:il.ClientCredentials},Qf={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Xf={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Zf={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},ep={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},tp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},np=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],op={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:ep,roles:np,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},ip=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],ap={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:[Kf[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Kf[0]],managedBy:gf.FRONTEGG}]},rp={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:[Kf[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Kf[0]],managedBy:gf.FRONTEGG}]},lp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},sp=[rp,ap],cp=[lp],up=[{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}],dp=[{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"}],yp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},fp={isActive:!0,strategy:Vn.ALLOW},pp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Vn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Vn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Vn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Vn.BLOCK,description:"IP 4"}],gp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},rp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Sp=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),vp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:gp(6),roles:[Sp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:gf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:gp(44),roles:[Sp("Editor")],managedBy:gf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:gp(8),roles:[Sp("Viewer")],managedBy:gf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:gp(5),roles:[Sp("Admin")],managedBy:gf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:gp(21),description:"BDR, AE, and inside sales",roles:[Sp("Viewer")],managedBy:gf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:gp(23),description:"Dev success and customer success",roles:[Sp("Admin")],managedBy:gf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:gp(10),description:"The marketing department",roles:[Sp("Viewer")],managedBy:gf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:gp(4),description:"Human resources",roles:[Sp("Viewer")],managedBy:gf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:gp(3),roles:[Sp("Viewer")],managedBy:gf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:gp(8),roles:[Sp("Editor")],managedBy:gf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:gp(4),roles:[Sp("Viewer")],managedBy:gf.FRONTEGG}],hp={scoring:{score:79},recommendations:{items:[{code:Sf.FORCE_MFA,severity:mf.WARNING,category:Af.MFA},{code:Sf.ENABLE_FORCE_RELOGIN,severity:mf.WARNING,category:Af.SESSIONS}]}},mp={insights:{items:[{category:Af.MFA,code:vf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Af.SESSIONS,code:vf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Af.PASSWORD,code:vf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Af.DOMAIN,code:vf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}};let Ap,bp,Tp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ap||(Ap={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(bp||(bp={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Tp||(Tp={})),Tp.profile,Tp.privacy,Tp.personalApiTokens,Tp.account,Tp.users,Tp.groups,Tp.security,Tp.sso,Tp.audits,Tp.webhooks,Tp.apiTokens,Tp.roles,Tp.subscriptions,Tp.allAccounts;const kp=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t,Ep=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Ip=e=>{const{pathname:t}=new URL(e),n=Ep(e);return n?t+n:t},Pp=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Lp="tenantId",Op=e=>e.mfaRequired&&e.mfaToken?(Pa.setAccessToken(null),Pa.setUser(null),!0):(Pa.setAccessToken(e.accessToken),Pa.setUser(e),!1),_p=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return rn.authenticatorApp;if(t)return rn.smsVerifyCode}return rn.verify},wp=e=>{if(1===e.length){const[t]=e;if(t===nf.AuthenticatorApp)return rn.authenticatorApp;if(t===nf.SMS)return rn.smsSetPhoneNumber;if(t===nf.EmailCode)return rn.emailVerifyCode}return rn.verify},Cp=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...Cp(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),Up=["callback"];function*Rp(){yield Ii(Oo.setCustomLoginState({loading:!0}));try{const e=yield Oi(bf.metadata.getAdminBoxMetadata);yield Ii(Oo.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Ii(Oo.setCustomLoginState({loading:!1,error:kp(e)}))}}function*Dp(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Up);try{yield Ii(Oo.setCustomLoginState({error:null,saving:!0}));const e=Cp(n);if(0===e.length)throw new Error("No changes to update");yield Oi(bf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Oi(bf.metadata.getAdminBoxMetadata);yield Ii(Oo.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setCustomLoginState({error:kp(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Np(){var e;const[t]=yield Oi(jf,["admin_portal_login_per_tenant"]),n=!(null==(e=Pa.getContext())||!e.tenantResolver);if(yield Ci((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Ci((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*Mp(){try{var e;if(!(yield Oi(Np)))return;const t=yield Ci((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=bf.accountSettings,{applicationUrl:i}=yield Oi(t?n:o);if(!i)return;const{routes:a}=yield Ci((e=>e.auth)),r=null!=(e=Ep(i))?e:"";yield Ii(Oo.setState({routes:C({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield Ii(Oo.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Fp(){yield Ia(Oo.loadTenantMetadata,Rp),yield Ia(Oo.updateTenantMetadata,Dp)}let Gp;function $p(e){return function*(t){const[n]=yield Oi(jf,["admin-portal-new-security-center-page"]);yield e(t),n&&(yield xp(),yield Vp())}}function*xp(){const e=Gp.RECOMMENDATIONS;yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Oi(bf.securityCenter.getRecommendations);yield Ii(Oo.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield Ii(Oo.setSecurityCenterStateError({key:e,value:kp(t)}))}finally{yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Vp(){const e=Gp.INSIGHTS;yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Oi(bf.securityCenter.getInsights);yield Ii(Oo.setSecurityCenterState({insights:t.items}))}catch(t){yield Ii(Oo.setSecurityCenterStateError({key:e,value:kp(t)}))}finally{yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*jp(){const e=Gp.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!0}));try{yield Oi(bf.users.sendResetBreachedPasswordEmails)}catch(t){yield Ii(Oo.setSecurityCenterStateError({key:e,value:kp(t)}))}finally{yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Bp(){yield ka(Oo.loadRecommendations,xp),yield ka(Oo.loadInsights,Vp),yield ka(Oo.sendResetBreachedPasswordEmails,jp)}function*Wp(){const e=Gp.RECOMMENDATIONS;yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!0})),yield Ui(500),yield Ii(Oo.setSecurityCenterState({recommendations:hp.recommendations.items,score:hp.scoring.score})),yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Kp(){const e=Gp.INSIGHTS;yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!0})),yield Ui(500),yield Ii(Oo.setSecurityCenterState({insights:mp.insights.items})),yield Ii(Oo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hp(){yield ka(Oo.loadRecommendations,Wp),yield ka(Oo.loadInsights,Kp)}!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails"}(Gp||(Gp={}));const zp=["callback"],qp=["callback"],Yp=["callback"],Jp=["callback"],Qp=["callback"],Xp=["callback"];function*Zp(){yield Ii(Oo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getGlobalSecurityPolicy);yield Ii(Oo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyGlobalState({error:kp(e),loading:!1}))}yield Ii(Oo.loadSecurityPolicyMfa()),yield Ii(Oo.loadSecurityPolicyVendorMfa()),yield Ii(Oo.loadSecurityPolicyLockout()),yield Ii(Oo.loadSecurityPolicyVendorLockout()),yield Ii(Oo.loadSecurityPolicyVendorPasswordHistory()),yield Ii(Oo.loadSecurityPolicyCaptcha()),yield Ii(Oo.loadPublicAuthStrategiesPolicy())}function*eg(e){var t,n;if(!(yield Oi(Np)))return e;const o=yield Oi(ng);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?C({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*tg(){yield Ii(Oo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getVendorConfig),t=yield eg(e);yield Ii(Oo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyPublicState({error:kp(e),loading:!1}))}}function*ng(){const e=yield Ci((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Oi(bf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Oi(bf.auth.getVendorPublicAuthStrategiesConfig),t}function*og(){yield Ii(Oo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Oi(ng);yield function*(e){const t=yield Oi(Np);if(!e||!t)return;const{policy:n}=yield Ci((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Ii(Oo.setSecurityPolicyPublicState({policy:C({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Ii(Oo.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyAuthStrategyPublicState({error:kp(e),loading:!1}))}}function*ig(){yield Ii(Oo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getMfaPolicy);yield Ii(Oo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyMfaState({error:kp(e),loading:!1}))}}function*ag(){yield Ii(Oo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getVendorMfaPolicy);yield Ii(Oo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyVendorMfaState({error:kp(e),loading:!1}))}}function*rg(e){let{payload:{callback:t}}=e,n=Vo(e.payload,zp);yield Ii(Oo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Oi(bf.auth.saveMfaPolicy,n);yield Ii(Oo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setSecurityPolicyMfaState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*lg(){yield Ii(Oo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getLockoutPolicy);yield Ii(Oo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyLockoutState({error:kp(e),loading:!1}))}}function*sg(e){let{payload:{callback:t}}=e,n=Vo(e.payload,qp);yield Ii(Oo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Oi(bf.auth.saveLockoutPolicy,n);yield Ii(Oo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setSecurityPolicyLockoutState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*cg(){yield Ii(Oo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getVendorLockoutPolicy);yield Ii(Oo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyVendorLockoutState({error:kp(e),loading:!1}))}}function*ug(){yield Ii(Oo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getCaptchaPolicy);yield Ii(Oo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyCaptchaState({error:kp(e),loading:!1}))}}function*dg(){yield Ii(Oo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getPasswordHistoryPolicy);yield Ii(Oo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyPasswordHistoryState({error:kp(e),loading:!1}))}}function*yg(){yield Ii(Oo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getVendorPasswordHistoryPolicy);yield Ii(Oo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyVendorPasswordHistoryState({error:kp(e),loading:!1}))}}function*fg(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Yp);yield Ii(Oo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Oi(bf.auth.savePasswordHistoryPolicy,n);yield Ii(Oo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setSecurityPolicyPasswordHistoryState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*pg(){yield Ii(Oo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getPasswordConfigPolicy);yield Ii(Oo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyPasswordState({error:kp(e),loading:!1}))}}function*gg(){yield Ia(Oo.loadSecurityPolicy,Zp),yield ka(Oo.saveSecurityPolicyMfa,$p(rg)),yield ka(Oo.loadSecurityPolicyMfa,ig),yield ka(Oo.loadSecurityPolicyVendorMfa,ag),yield ka(Oo.saveSecurityPolicyLockout,$p(sg)),yield ka(Oo.loadSecurityPolicyLockout,lg),yield ka(Oo.loadSecurityPolicyVendorLockout,cg),yield ka(Oo.loadSecurityPolicyCaptcha,ug),yield ka(Oo.saveSecurityPolicyPasswordHistory,$p(fg)),yield ka(Oo.loadSecurityPolicyPasswordHistory,dg),yield ka(Oo.loadSecurityPolicyVendorPasswordHistory,yg),yield ka(Oo.loadVendorPasswordConfig,pg),yield ka(Oo.loadPublicSecurityPolicy,tg),yield ka(Oo.loadPublicAuthStrategiesPolicy,og)}function*Sg(){yield Ii(Oo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Ii(Oo.setSecurityPolicyPublicState({policy:Jf,loading:!1}))}catch(e){yield Ii(Oo.setSecurityPolicyPublicState({error:kp(e),loading:!1}))}}function*vg(){yield Ii(Oo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyGlobalState({policy:Yf,loading:!1})),yield Ii(Oo.loadSecurityPolicyMfa()),yield Ii(Oo.loadSecurityPolicyVendorMfa()),yield Ii(Oo.loadSecurityPolicyLockout()),yield Ii(Oo.loadSecurityPolicyVendorLockout()),yield Ii(Oo.loadSecurityPolicyPasswordHistory()),yield Ii(Oo.loadSecurityPolicyVendorPasswordHistory()),yield Ii(Oo.loadSecurityPolicyCaptcha())}function*hg(){yield Ii(Oo.setSecurityPolicyMfaState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyMfaState({policy:Qf,loading:!1}))}function*mg(){yield Ii(Oo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyVendorMfaState({policy:Qf,loading:!1}))}function*Ag(e){var t;let{payload:{callback:n}}=e,o=Vo(e.payload,Jp);yield Ii(Oo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=C({},Xf,{id:null!=(t=o.id)?t:Xf.id,enforceMFAType:o.enforceMFAType});yield At(),yield Ii(Oo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*bg(){yield Ii(Oo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyLockoutState({policy:Xf,loading:!1}))}function*Tg(){yield Ii(Oo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyVendorLockoutState({policy:Xf,loading:!1}))}function*kg(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Qp);yield Ii(Oo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield At();const o=C({},Xf,n,{id:n.id?n.id:Xf.id});null==t||t(o),yield Ii(Oo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Eg(){yield Ii(Oo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyLockoutState({policy:Xf,loading:!1}))}function*Ig(){yield Ii(Oo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyPasswordHistoryState({policy:Zf,loading:!1}))}function*Pg(){yield Ii(Oo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield At(),yield Ii(Oo.setSecurityPolicyVendorPasswordHistoryState({policy:Zf,loading:!1}))}function*Lg(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Xp);yield Ii(Oo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield At();const o=C({},Zf,n,{id:n.id?n.id:Zf.id});null==t||t(o),yield Ii(Oo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Og(){yield Ia(Oo.loadSecurityPolicy,vg),yield ka(Oo.loadPublicSecurityPolicy,Sg),yield ka(Oo.saveSecurityPolicyMfa,Ag),yield ka(Oo.loadSecurityPolicyMfa,hg),yield ka(Oo.loadSecurityPolicyVendorMfa,mg),yield ka(Oo.saveSecurityPolicyLockout,kg),yield ka(Oo.loadSecurityPolicyLockout,bg),yield ka(Oo.loadSecurityPolicyVendorLockout,Tg),yield ka(Oo.loadSecurityPolicyCaptcha,Eg),yield ka(Oo.saveSecurityPolicyPasswordHistory,Lg),yield ka(Oo.loadSecurityPolicyPasswordHistory,Ig),yield ka(Oo.loadSecurityPolicyVendorPasswordHistory,Pg)}const _g=["events","url"];function*wg(){yield Ii(Oo.setSignUpState({loading:!0}));try{const e=yield Oi(bf.auth.getVendorConfig),t=yield eg(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield Ii(Oo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield Ii(Oo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Ii(Oo.setSignUpState({loading:!1,error:kp(e),firstLoad:!1}))}}function*Cg(e){let{payload:{events:t,url:n}}=e,o=Vo(e.payload,_g);yield Ii(Oo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Ci((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Oi(bf.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:bp.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(!r&&l&&Op(l)){const t=yield mS(l);yield Ii(Oo.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Ci((e=>e.auth));yield Ii(Oo.setSignUpState({loading:!1,shouldActivate:r,stage:Sn.SignUpSuccess})),yield Ii(Oo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:C({},e,{tenants:u,activeTenant:d})}))}}catch(e){Pa.setAccessToken(null),Pa.setUser(null),yield Ii(Oo.setSignUpState({loading:!1,error:kp(e)}))}yield Ii(Oo.setSignUpState({loading:!1}))}function*Ug(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ci((e=>e.auth.signUpState));yield Ii(Oo.resetSignUpState()),yield Ii(Oo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Rg(){yield Ia(Oo.signUpUser,Cg),yield Ia(Oo.resetSignUpStateSoft,Ug)}const Dg={setVendorState:(e,{payload:t})=>C({},e,t)},Ng={loadVendorPublicInfo:ct("vendor/loadVendorPublicInfo")},Mg={loading:!1},{reducer:Fg,actions:Gg}=dt({name:Rt,initialState:Mg,reducers:C({},Dg)}),$g=C({},Gg,Ng);function*xg(){yield Ii($g.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield bf.vendor.getVendorPublicInfo();yield Ii($g.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Ii($g.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Vg={[ol.Code]:It.loginWithOtc,[ol.EmailAndPassword]:It.loginWithPassword,[ol.MagicLink]:It.magicLinkPreLoginSuccess,[ol.SmsCode]:It.loginWithSmsOtc};var jg=n(378),Bg=n.n(jg);function Wg(e,t){return Bg()(e,t)}function*Kg({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Oi(bf.entitlements.loadEntitlements);yield function*(e){Wg(yield Ci((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Ii(Oo.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*Hg(){yield Ia(Oo.loadEntitlements,Kg)}const zg=["callback"],qg=["callback"],Yg=["callback"],Jg=["callback"],Qg=["callback","events"],Xg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["user"],oS=["callback"],iS=["callback"],aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback","deviceId"],cS=["callback"],uS=["callback"],dS=["callback","deviceId"],yS=["callback","deviceId"],fS=["callback","deviceId"];function*pS(e){const t=yield Ci((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return Wg(t,null==e?void 0:e.entitlements)?C({},e,{entitlements:t}):e}function*gS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Ci((e=>e.auth));yield Ii(Oo.setState(C({user:e,tenantsState:C({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*SS(){const e=Pa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Ci((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Oi(Mp),u=yield Ci((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(Ot);d&&![a,r,l,s].includes(d)&&(c=d),window.localStorage.removeItem(Ot),yield At(200),Ii(Oo.resetLoginState());const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Ip(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*vS(){let e;try{var t;const n=yield Oi(bf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Ii(Oo.setState({ssoACS:e}))}function*hS(){try{const{isActive:e}=yield Oi(bf.auth.getSSOPublicConfiguration);yield Ii(Oo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*mS(e){let t=It.loginWithTwoFactor,n={};const{loginState:o}=yield Ci((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Oi(bf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:_p(e.mfaDevices)}:(n={step:wp(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=It.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Pt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}function*AS(e){var t;const{routes:n,loginState:o}=yield Ci((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*bS(){const{hostedLoginBox:e}=yield Ci((e=>e.auth));e?yield Oi(TS):yield Oi(ES)}function*TS(){const{user:e}=yield Ci((e=>e.auth));if(null==e||!e.refreshToken)return Pa.setAccessToken(null),Pa.setUser(null),void(yield Ii(Oo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Oi(bf.auth.exchangeOAuthTokensV2,t),o=yield Oi(pS,n.user);yield Oi(gS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){Pa.setAccessToken(null),Pa.setUser(null),yield Ii(Oo.setState({user:null,isAuthenticated:!1}))}}function*kS(){const{user:e}=yield Ci((e=>e.auth));if(null==e||!e.refreshToken)return Pa.setAccessToken(null),Pa.setUser(null),void(yield Ii(Oo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Oi(bf.auth.exchangeOAuthTokensV2,t),o=yield Oi(pS,n.user);yield Oi(gS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){Pa.setAccessToken(null),Pa.setUser(null),yield Ii(Oo.setState({user:null,isAuthenticated:!1}))}}function*ES(){try{const t=Pa.onRedirectTo,{routes:n,loginState:o}=yield Ci((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Oi(bf.auth.refreshTokenV3);if(Op(i)){const e=yield mS(i);yield Ii(Oo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield AS(i),l=yield Oi(pS,i);yield Oi(gS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield PS(n)}}catch(e){Pa.setAccessToken(null),Pa.setUser(null),yield Ii(Oo.setState({user:void 0,isAuthenticated:!1}))}}function*IS(){try{const t=Pa.onRedirectTo,{routes:n,loginState:o}=yield Ci((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Oi(bf.auth.refreshTokenV3);if(Op(i)){const e=yield mS(i);yield Ii(Oo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Oi(pS,i);if(yield Oi(FS))yield Ii(Oo.setLoginState({step:It.promptPasskeys,loading:!1})),yield Oi(gS,{user:l,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield AS(i);yield Oi(gS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield PS(n)}}}catch(e){Pa.setAccessToken(null),Pa.setUser(null),yield Ii(Oo.setState({user:void 0,isAuthenticated:!1}))}}function*PS(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Pa.onRedirectTo,{routes:i,loginState:a}=yield Ci((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield SS())}function*LS({payload:{callback:e}}){try{const{ip:t}=yield Oi(bf.metadata.getCurrentUserIpMetadata);yield Ii(Oo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*OS({payload:e}){const t=[];(yield Oi(Np))?yield Oi(bS):t.push(Oi(bS)),e&&(yield Ii(Oo.setState({isLoading:!0})),yield Ii(Oo.loadSocialLoginsConfigurationV2()),t.push(Oi(wg)),t.push(Oi(og)),t.push(Oi(hS)),t.push(Oi(xg)),t.push(Oi(vS)),t.push(Oi(Mp))),yield Pi(t),yield Ii(Oo.setState({isLoading:!1}))}function*_S({accessToken:e,user:t}){if(!e)return void(yield Ii(Oo.setState({user:void 0,isAuthenticated:!1})));const n=Pa.onRedirectTo,{routes:o}=yield Ci((e=>e.auth));if(Op(t)){const e=yield mS(t);yield Ii(Oo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*wS({payload:e}){const t=[];yield Ii(Oo.loadSocialLoginsConfigurationV2()),t.push(Oi(wg)),t.push(Oi(hS)),t.push(Oi(xg)),t.push(Oi(vS)),t.push(Oi(_S,e)),t.push(Oi(Mp)),yield Pi(t)}function*CS({payload:e}){const{disableSilentRefresh:t}=yield Ci((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Oi(bf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Oi(gS,e,{isAuthenticated:!0,isLoading:!1})}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Ci((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;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Ii(Oo.setState({isLoading:!0}));const a=xf(),r=xf(),l=yield Oi($f,r);localStorage.setItem(_t,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Oi(Mp);const c=yield Ci((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${yr(n,"/oauth/authorize")}/oauth/authorize`,d=C({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);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Pp(Lp);f&&(d.tenantId=f);o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*US({payload:e}){const t=localStorage.getItem(_t)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Ci((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Oi(Mp);const a=yield Ci((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Oi(bf.auth.exchangeOAuthTokensV2,r);yield Oi(gS,e,{isAuthenticated:!0})}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield SS()}}function*RS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,zg);try{yield Ii(Oo.setLoginState({loading:!0}));const e=yield Oi(bf.auth.changePhoneNumberWithVerification,n);yield Ii(Oo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:It.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e),loading:!1}))}}function*DS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,qg);try{yield Ii(Oo.setLoginState({loading:!0})),yield Oi(bf.auth.verifyChangePhoneNumber,n),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e),loading:!1}))}}function*NS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Yg);try{yield Ii(Oo.setLoginState({loading:!0}));const e=yield Oi(bf.auth.passwordlessPreLogin,C({},n,{type:ol.SmsCode}));yield Ii(Oo.setLoginState({step:It.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e),loading:!1})),null==t||t(e)}}function*MS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Jg);try{const{onRedirectTo:e,routes:o}=yield Ci((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ii(Oo.setLoginState({loading:!0}));const i=yield Oi(bf.auth.passwordlessPreLogin,n),a=Vg[n.type];if(a===It.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield Ii(Oo.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield Ii(Oo.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Ii(Oo.setLoginState({error:kp(e),loading:!1})),null==t||t()}}function*FS(){const{publicAuthStrategyPolicy:e}=yield Ci((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===ef.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Oi(jf,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Oi(bf.auth.getWebAuthnDevices);return yield Ii(Oo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*GS(e){let{payload:{callback:t,events:n}}=e,o=Vo(e.payload,Qg);try{yield Ii(Oo.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Oi(bf.auth.passwordlessPostLoginV2,o),l=Pa.onRedirectTo,{routes:s}=yield Ci((e=>e.auth));if(Op(e)){const t=yield mS(e);yield Ii(Oo.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Ci((e=>e.auth));var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Ap.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Oi(gS,{user:e,tenants:a,activeTenant:r}),yield Ii(Oo.setLoginState({error:void 0})),yield Ii(Oo.setState({isLoading:!1})),o.flow===Pt.Login?(yield Oi(FS))?(yield Ii(Oo.setLoginState({step:It.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield Ii(Oo.setState({isAuthenticated:!0})),yield SS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Ii(Oo.setLoginState({error:kp(e,"Failed to authenticate")}))}finally{yield Ii(Oo.setLoginState({loading:!1}))}}function*$S({payload:e}){try{yield Ii(Oo.setLoginState({loading:!0}));const{name:t}=yield Oi(bf.auth.verifyInviteToken,e);yield Ii(Oo.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Ii(Oo.setLoginState({inviteTokenError:kp(e,"We couldn't verify your invitation")}))}finally{yield Ii(Oo.setLoginState({loading:!1}))}}function*xS({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield Ii(Oo.setLoginState({loading:!0}));try{const i=yield Ci((({auth:{onRedirectTo:e}})=>e)),a=Pp(Lp),{address:r,idpType:l}=yield Oi(bf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Ef.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Ci((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield Ii(Oo.setLoginState({step:It.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield VS({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield VS({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*VS(e){let{callback:t}=e,n=Vo(e,Xg);const o=yield Ci((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield Ii(Oo.setLoginState({step:It.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===ol.EmailAndPassword?(yield Ii(Oo.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t()):[ol.MagicLink,ol.Code,ol.SmsCode].includes(null==o?void 0:o.authStrategy)?yield Ii(Oo.passwordlessPreLogin(C({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield Ii(Oo.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t())}function*jS({payload:{callback:e}}){try{yield Ii(Oo.setLoginState({loading:!0}));const{options:t}=yield Oi(bf.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Ii(Oo.setLoginState({error:kp(t)})),null==e||e(null)}finally{yield Ii(Oo.setLoginState({loading:!1}))}}function*BS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Zg);try{yield Ii(Oo.setLoginState({loading:!0}));const e=Et(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?tf.Platform:tf.CrossPlatform;yield Oi(bf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e)})),null==t||t(null)}finally{yield Ii(Oo.setLoginState({loading:!1}))}}function*WS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,eS);try{var o;yield Ii(Oo.setPasskeysState({loading:!0})),yield Ii(Oo.setLoginState({loading:!0}));const{options:e}=yield Oi(bf.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)}))),yield Ii(Oo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Ii(Oo.setLoginState({error:kp(e)})),null==t||t(null)}finally{yield Ii(Oo.setPasskeysState({loading:!1})),yield Ii(Oo.setLoginState({loading:!1}))}}function*KS(e){let{payload:{callback:t}}=e,n=Vo(e.payload,tS);try{var o;yield Ii(Oo.setPasskeysState({loading:!0})),yield Ii(Oo.setLoginState({loading:!0}));const e=Et(n.publicKey),i=yield Oi(bf.auth.webAuthnPostLoginV2,C({},e,{response:C({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=i,r=Vo(i,nS);if(Op(a)){const e=Pa.onRedirectTo,{routes:t}=yield Ci((e=>e.auth)),n=yield mS(a);yield Ii(Oo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Oi(gS,C({user:a},r),{isAuthenticated:!0}),yield Ii(Oo.setLoginState({error:void 0})),yield SS(),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e)})),null==t||t(null)}finally{yield Ii(Oo.setPasskeysState({loading:!1})),yield Ii(Oo.setLoginState({loading:!1}))}}function*HS({payload:e}){const{onRedirectTo:t,routes:n}=yield Ci((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ii(Oo.setLoginState({loading:!0}));try{const t=yield Oi(bf.auth.postLogin,e);yield Ii(Oo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield SS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Ii(Oo.setLoginState({step:It.loginWithSSOFailed,loading:!1}))}}function*zS({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield Ii(Oo.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Oi(bf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Pa.onRedirectTo,{routes:c}=yield Ci((e=>e.auth));if(Op(a)){const e=yield mS(a);yield Ii(Oo.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ci((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Oi(gS,{user:a,tenants:r,activeTenant:l},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Pt.Login?It.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[o]=yield Oi(jf,["security-center-login-flows"]);t.flow===Pt.Login&&(o&&a.isBreachedPassword?yield Ii(Oo.setLoginState({step:It.breachedPassword,loading:!1})):n&&((yield Oi(FS))?(yield Ii(Oo.setLoginState({step:It.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield SS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Pa.setAccessToken(null),Pa.setUser(null),null==i||i(!1,t),yield Ii(Oo.setLoginState({email:e,error:kp(t),loading:!1}))}}function*qS({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield Ii(Oo.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Oi(bf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Ci((e=>e.auth)),s=l.flow===Pt.Login?It.success:l.step,c=!!i.accessToken;yield Oi(gS,{user:i,tenants:a,activeTenant:r},{loginState:{flow:l.flow,quickLoginToRegister:l.quickLoginToRegister,loading:!1,step:s,error:void 0,tenants:a},isAuthenticated:c}),i.id&&localStorage.setItem("userId",i.id),yield Ii(Oo.setLoginState({error:void 0,loading:!1}));const[u]=yield Oi(jf,["security-center-login-flows"]);l.flow===Pt.Login&&(u&&l.isBreachedPassword?yield Ii(Oo.setLoginState({step:It.breachedPassword,loading:!1})):(yield Oi(FS))?yield Ii(Oo.setLoginState({step:It.promptPasskeys,loading:!1})):yield SS()),null==o||o(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e),loading:!1})),null==o||o(!1,e)}}function*YS({payload:e}){yield Ii(Oo.setLoginState({loading:!0}));try{var t;yield Oi(bf.auth.recoverMfaToken,e),yield Ii(Oo.setLoginState({loading:!1,error:void 0,step:It.preLogin})),yield Ii(Oo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setLoginState({error:kp(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*JS({payload:e}){const{hostedLoginBox:t}=yield Ci((e=>e.auth));yield Ii(Oo.setState({isLoading:!0}));try{t?yield Oi(bf.auth.OAuthLogout):yield Oi(bf.auth.logout)}catch{}yield Ii(Oo.resetState()),yield Ii(Oo.requestAuthorize(!0)),null==e||e()}function*QS({payload:e}){var t;try{yield Oi(bf.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*XS({user:e,tenants:t,activeTenant:n}){const o={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield Ii(Oo.setMfaState(o)),yield Ii(Oo.setUser(e)),yield Ii(Oo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*ZS({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Ci((e=>e.auth));yield Ii(Oo.setUser(e)),yield Ii(Oo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Ci((e=>e.auth.mfaState)),[a]=yield Oi(jf,["security-center-login-flows"]);if(o.flow===Pt.Login)if(a&&o.isBreachedPassword)yield Ii(Oo.setLoginState({step:It.breachedPassword,loading:!1}));else{const e=yield Oi(FS);i===rn.smsVerifyCode&&e?yield Ii(Oo.setLoginState({step:It.promptPasskeys,loading:!1})):yield SS()}yield Ii(Oo.setState({isAuthenticated:!!e.accessToken}))}function*ev(e){let{payload:{callback:t}}=e,n=Vo(e.payload,oS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.preEnrollMFASMSForLogin,n);yield Ii(Oo.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*tv(e){let{payload:{callback:t}}=e,n=Vo(e.payload,iS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.enrollMFASMSForLoginV2,n);yield XS(e),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*nv(e){let{payload:{callback:t}}=e,n=Vo(e.payload,aS);yield Ii(Oo.setLoginState({loading:!0}));try{var o;const e=yield Oi(bf.auth.preEnrollMFAWebAuthnForLogin,n),i=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield Ii(Oo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*ov(e){let{payload:{callback:t}}=e,n=Vo(e.payload,rS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=Et(n.publicKey),o=yield Oi(bf.auth.enrollMFAWebAuthnForLoginV2,C({},n,{options:e}));yield XS(o),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*iv(e){let{payload:{callback:t}}=e,n=Vo(e.payload,lS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield XS(e),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*av(e){let{payload:{callback:t,deviceId:n}}=e,o=Vo(e.payload,sS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.preVerifyMFASMSForLogin,n,o);yield Ii(Oo.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*rv(e){let{payload:{callback:t}}=e,n=Vo(e.payload,cS);try{const e=yield Oi(bf.auth.preVerifyMFAEmailCode,n);yield Ii(Oo.setMfaState({otcToken:e.otcToken,step:rn.emailVerifyCode})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({error:kp(e)})),null==t||t(null)}}function*lv(e){let{payload:{callback:t}}=e,n=Vo(e.payload,uS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.verifyMFAEmailCodeV2,n);yield ZS(e),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*sv(e){let{payload:{callback:t,deviceId:n}}=e,o=Vo(e.payload,dS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=yield Oi(bf.auth.verifyMFASMSForLoginV2,n,o);yield ZS(e),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*cv(e){let{payload:{callback:t,deviceId:n}}=e,o=Vo(e.payload,yS);yield Ii(Oo.setLoginState({loading:!0}));try{var i;const e=yield Oi(bf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield Ii(Oo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*uv(e){let{payload:{callback:t,deviceId:n}}=e,o=Vo(e.payload,fS);yield Ii(Oo.setLoginState({loading:!0}));try{const e=Et(o.publicKey),i=yield Oi(bf.auth.verifyMFAWebAuthnForLoginV2,n,C({},o,{options:e}));yield ZS(i),yield Ii(Oo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)})),null==t||t(null)}}function*dv({payload:e}){yield Ii(Oo.setLoginState({loading:!0}));try{yield Oi(bf.auth.forgotPassword,e),yield Ii(Oo.setLoginState({loading:!1,error:void 0,step:It.breachedPasswordSuccess})),yield Ii(Oo.setState({isAuthenticated:!1}))}catch(e){yield Ii(Oo.setLoginState({loading:!1,error:kp(e)}))}}function*yv(){yield Ia(Oo.requestAuthorize,OS),yield Ia(Oo.requestAuthorizeSSR,wS),yield Ia(Oo.requestHostedLoginAuthorize,CS),yield Ia(Oo.handleHostedLoginCallback,US),yield Ia(Oo.preLogin,xS),yield Ia(Oo.postLogin,HS),yield Ia(Oo.login,zS),yield Ia(Oo.logout,JS),yield Ia(Oo.silentLogout,QS),yield Ia(Oo.loginWithMfa,qS),yield Ia(Oo.recoverMfa,YS),yield Ia(Oo.quickSmsPasswordlessPreLogin,NS),yield Ia(Oo.changePhoneNumberWithVerification,RS),yield Ia(Oo.verifyChangePhoneNumber,DS),yield Ia(Oo.passwordlessPreLogin,MS),yield Ia(Oo.passwordlessPostLogin,GS),yield Ia(Oo.verifyInviteToken,$S),yield Ia(Oo.webAuthnPrelogin,WS),yield Ia(Oo.webAuthnPostLogin,KS),yield Ia(Oo.webAuthnCreateNewDeviceSession,jS),yield Ia(Oo.webAuthnVerifyNewDeviceSession,BS),yield Ia(Oo.afterAuthNavigation,SS),yield Ia(Oo.getUserIP,LS),yield Ia(Oo.preEnrollMFASMSForLogin,ev),yield Ia(Oo.enrollMFASMSForLogin,tv),yield Ia(Oo.preEnrollMFAWebAuthnForLogin,nv),yield Ia(Oo.enrollMFAWebAuthnForLogin,ov),yield Ia(Oo.enrollMFAAuthenticatorAppForLogin,iv),yield Ia(Oo.preVerifyMFASMSForLogin,av),yield Ia(Oo.verifyMFASMSForLogin,sv),yield Ia(Oo.preVerifyMFAWebAuthnForLogin,cv),yield Ia(Oo.verifyMFAWebAuthnForLogin,uv),yield Ia(Oo.preVerifyMFAEmailCode,rv),yield Ia(Oo.verifyMFAEmailCode,lv),yield Ia(Oo.resetBreachedPassword,dv)}function*fv({payload:e}){e&&(yield Ii(Oo.setState({isLoading:!0})));const t=zf;yield Ii(Oo.loadTenants()),yield Ii(Oo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*pv({payload:{callback:e}}){try{const{ip:t}=pp[0];yield Ii(Oo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*gv(){yield Ia(Oo.requestAuthorize,fv),yield Ia(Oo.afterAuthNavigation,SS),yield Ia(Oo.getUserIP,pv)}const Sv=["callback","samlVendor"],vv=["callback","samlVendor"];function*hv(){try{var e,t;yield Ii(Oo.setSSOState({loading:!0}));const n=yield Oi(bf.auth.getSamlConfiguration),o=yield Oi(bf.auth.getOidcConfiguration),i=yield Oi(bf.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield Ii(Oo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield Ii(Oo.setSSOState({error:kp(e),loading:!1}))}}function*mv({payload:e}){const t=yield Ci((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Ii(Oo.setSSOState({error:void 0,[n]:!0}));try{const o=yield Vf(e[0]),i=yield Oi(bf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield Ii(Oo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield Ii(Oo.setSSOState({samlConfiguration:t,error:kp(e),[n]:!1}))}}function*Av({payload:e}){const{configFile:t,callback:n}=e,o=yield Ci((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield Ii(Oo.setSSOState({error:void 0,[i]:!0}));try{const e=yield Vf(t),a=yield Oi(bf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield Ii(Oo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield Ii(Oo.setSSOState({samlConfiguration:o,error:kp(e),[i]:!1})),null==n||n(null,e)}}function*bv({payload:e}){const{callback:t,samlVendor:n}=e,o=Vo(e,Sv),i=yield Ci((e=>e.auth.ssoState.samlConfiguration)),a=C({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Ii(Oo.setSSOState({samlConfiguration:C({},i,a)})));if(yield Ii(Oo.setSSOState({error:void 0,[r]:!0})),e.type===Ef.Saml){var l,s;const e=yield Oi(bf.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 o=Gf(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield Oi(bf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield Ii(Oo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setSSOState({samlConfiguration:i,error:kp(e),[r]:!1})),null==t||t(null,e)}}function*Tv({payload:{callback:e}={}}){const t=yield Ci((e=>e.auth.ssoState.samlConfiguration));try{yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield Oi(bf.auth.validateSamlDomain),yield Ii(Oo.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Ii(Oo.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:kp(n),saving:!1})),null==e||e(null,n)}}function*kv(){try{const e=yield Oi(bf.auth.getSamlRoles),t=yield Oi(bf.auth.getSamlRolesGroups);yield Ii(Oo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Ii(Oo.setSSOState({error:kp(e)}))}}function*Ev({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield Oi(bf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Pi(e.map((e=>Oi(bf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Ii(Oo.setSSOState({error:kp(e)}))}}(n)),yield kv(),yield Ii(Oo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Ii(Oo.setSSOState({error:kp(t),saving:!1})),null==e||e(null,t)}}function*Iv({payload:{callback:e,id:t}}){try{yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield Oi(bf.auth.deleteSamlGroup,{id:t}),yield kv(),yield Ii(Oo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Ii(Oo.setSSOState({error:kp(t),saving:!1})),null==e||e(null,t)}}function*Pv({payload:{group:e,roleIds:t,callback:n}}){try{yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield Oi(bf.auth.createSamlGroup,{group:e,roleIds:t}),yield kv(),yield Ii(Oo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Ii(Oo.setSSOState({error:kp(e),saving:!1})),null==n||n(null,e)}}function*Lv({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Ii(Oo.setSSOState({loading:!0})),yield Oi(bf.auth.oidcPostLoginV2,t),yield Oi(bS),yield Ii(Oo.setSSOState({loading:!1}))}catch(e){yield Ii(Oo.setSSOState({loading:!1,error:kp(e,"Failed to authenticate"),firstLoad:!1}))}}function*Ov(){yield ka(Oo.loadSSOConfigurations,hv),yield ka(Oo.saveSSOConfigurations,bv),yield ka(Oo.saveSSOConfigurationsFile,mv),yield ka(Oo.saveSSOConfigurationsFileWithCallback,Av),yield ka(Oo.validateSSODomain,Tv),yield ka(Oo.loadSSOAuthorizationRoles,kv),yield ka(Oo.updateSSOAuthorizationRoles,Ev),yield ka(Oo.deleteSamlGroup,Iv),yield ka(Oo.createSamlGroup,Pv),yield ka(Oo.oidcPostlogin,Lv)}function*_v(){yield Ii(Oo.setSSOState({loading:!0})),yield At(),yield Ii(Oo.setSSOState({samlConfiguration:ep,loading:!1,firstLoad:!1}))}function*wv({payload:e}){const t="saving";yield Ii(Oo.setSSOState({error:void 0,[t]:!0}));const n=C({},yield Ci((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Ii(Oo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Cv({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Vo(e,vv),r=op.samlConfiguration,l=C({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Ii(Oo.setSSOState({samlConfiguration:C({},r,l)})));yield Ii(Oo.setSSOState({error:void 0,[s]:!0})),yield At(),l.acsUrl=null==tp||null==(t=tp.configuration)?void 0:t.acsUrl,l.spEntityId=null==tp||null==(n=tp.configuration)?void 0:n.spEntityId;const c=Gf(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==i?void 0:i.toLowerCase(),yield At(),yield Ii(Oo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*Uv({payload:{callback:e}={}}){const t=op.samlConfiguration;yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield At(),yield Ii(Oo.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Rv(){yield At(),yield Ii(Oo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Dv({payload:{callback:e,authorizationRoles:t}}){yield Ii(Oo.setSSOState({error:void 0,saving:!0})),yield At(),yield Ii(Oo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Nv(){yield ka(Oo.loadSSOConfigurations,_v),yield ka(Oo.saveSSOConfigurations,Cv),yield ka(Oo.saveSSOConfigurationsFile,wv),yield ka(Oo.validateSSODomain,Uv),yield ka(Oo.loadSSOAuthorizationRoles,Rv),yield ka(Oo.updateSSOAuthorizationRoles,Dv)}const Mv=["callback"],Fv=["callback","ssoConfigId"],Gv=["callback","ssoConfigId"],$v=["callback","ssoConfigId"];function*xv(){try{return yield Oi(bf.auth.getOidcConfiguration)}catch(e){return null}}function*Vv(){try{return yield Oi(bf.metadata.getSamlMetadata)}catch(e){return null}}function*jv(){try{yield Ii(Oo.setSSOLoader({key:kf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Pi([Oi(xv),Oi(Vv)]),n=yield Oi(bf.auth.getSSOConfigurations);yield Ii(Oo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Ii(Oo.setSSOError({key:kf.LOAD_SSO_CONFIGURATIONS,value:kp(e)}))}finally{yield Ii(Oo.setSSOLoader({key:kf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Bv({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Vo(e,Mv),o=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Oi(bf.auth.createSSOConfiguration,C({},n,{enabled:null!=(i=n.enabled)&&i}));yield Ii(Oo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield Ii(Oo.setSSOError({key:kf.SAVE_SSO_CONFIGURATION,value:kp(e)})),null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Wv({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vf(t),i=yield Oi(bf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Ii(Oo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield Ii(Oo.setSSOError({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:kp(e)})),null==n||n(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Kv({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Vo(e,Fv),i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Oi(bf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield Ii(Oo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Ii(Oo.setSSOError({key:kf.UPDATE_SSO_CONFIGURATION,value:kp(e)})),null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Hv({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vf(o),a=yield Oi(bf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield Ii(Oo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Ii(Oo.setSSOError({key:kf.UPDATE_SSO_CONFIGURATION,value:kp(e)})),null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*zv({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{yield Oi(bf.auth.deleteSSOConfiguration,t),yield Ii(Oo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Ii(Oo.setSSOError({key:kf.DELETE_SSO_CONFIGURATION,value:kp(e)})),null==n||n(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*qv({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Vo(e,Gv);yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Oi(bf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield Ii(Oo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Ii(Oo.setSSOError({key:kf.SAVE_SSO_DOMAIN,value:kp(e)})),null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_DOMAIN,value:!1}))}}function*Yv({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield Ii(Oo.setSSOLoader({key:kf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{yield Oi(bf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Ii(Oo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield Ii(Oo.setSSOError({key:kf.DELETE_SSO_DOMAIN,value:kp(e)})),null==o||o(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.DELETE_SSO_DOMAIN,value:!1}))}}function*Jv({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield Ii(Oo.setSSOLoader({key:kf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{yield Oi(bf.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield Ii(Oo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Ii(Oo.setSSOError({key:kf.VALIDATE_SSO_DOMAIN,value:kp(e)})),null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Qv({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{yield Oi(bf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield Ii(Oo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield Ii(Oo.setSSOError({key:kf.UPDATE_SSO_DEFAULT_ROLES,value:kp(t)})),null==e||e(null,t)}finally{yield Ii(Oo.setSSOLoader({key:kf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Xv({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_GROUPS,value:!0}));const i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{yield Pi(t.map((e=>Oi(bf.auth.deleteSSOGroup,n,e)))),yield Pi(e.map((e=>Oi(bf.auth.createSSOGroup,n,e))));const a=yield Oi(bf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?C({},e,{groups:a}):e));yield Ii(Oo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield Ii(Oo.setSSOError({key:kf.SAVE_SSO_GROUPS,value:kp(e)})),null==o||o(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_GROUPS,value:!1}))}}function*Zv({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Pi(t.map((t=>Oi(bf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Ii(Oo.setSSOError({key:kf.SAVE_SSO_GROUPS,value:kp(e)})),null==n||n(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_GROUPS,value:!1}))}}function*eh({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield Oi(gr,t,void 0,{responseType:"plain"}),configMetadata:n};let r,l;o?(r=yield Oi(bf.auth.updateSSOConfigurationByMetadata,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Oi(bf.auth.createSSOConfigurationByMetadata,e),l=[r,...a]),yield Ii(Oo.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*th({payload:e}){yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Vo(e,$v),i=yield Ci((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Oi(bf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Oi(bf.auth.createSSOConfiguration,o),a=[e,...i]),yield Ii(Oo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Ii(Oo.setSSOLoader({key:kf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*nh(){yield ka(Oo.loadSSOConfigurationsV2,jv),yield ka(Oo.saveSSOConfigurationV2,Bv),yield ka(Oo.saveSSODomain,qv),yield ka(Oo.deleteSSODomain,Yv),yield ka(Oo.validateSSODomainV2,Jv),yield ka(Oo.updateSSOConfiguration,Kv),yield ka(Oo.deleteSSOConfiguration,zv),yield ka(Oo.setSSOGroups,Xv),yield ka(Oo.updateSSOGroups,Zv),yield ka(Oo.setSSODefaultRoles,Qv),yield ka(Oo.saveSSOConfigurationByMetadata,Wv),yield ka(Oo.updateSSOConfigurationByMetadata,Hv),yield ka(Oo.saveSSOConfigurationByUrl,eh),yield ka(Oo.saveSSOConfigurationByData,th)}const oh=["callback","profilePictureUrl"],ih=["callback","profilePictureUrl"];function*ah(){yield Ii(Oo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return Oi.apply(void 0,[Ta,e,t,n].concat(i))}(3,2e3,bf.teams.getProfile),t=yield Ci((e=>e.auth.user));Oo.setUser(C({},t,e)),yield Ii(Oo.setProfileState({profile:e,loading:!1}))}catch(e){yield Ii(Oo.setProfileState({loading:!1,error:kp(e)}))}}function*rh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Vo(e.payload,oh);yield Ii(Oo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Ci((e=>e.auth.profileState.profile));let i=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 o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield Oi(bf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=C({},e,o,{profilePictureUrl:i}),r=yield Oi(bf.users.updateUserProfileV2,a),l=yield Ci((e=>e.auth.user));yield Ii(Oo.setUser(C({},l,r))),yield Ii(Oo.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Ii(Oo.setProfileState({saving:!1,error:kp(e),loading:!1})),null==t||t(null,e)}}function*lh({payload:e}){yield Ii(Oo.setProfileState({loading:!0}));try{var t;yield Oi(bf.teams.changePassword,e),yield Ii(Oo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setProfileState({loading:!1,error:kp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*sh(){yield Ia(Oo.loadProfile,ah),yield ka(Oo.saveProfile,rh),yield ka(Oo.changePassword,lh)}function*ch(){yield Ii(Oo.setProfileState({loading:!0})),yield At(),yield Ii(Oo.setUser(C({},zf,Hf))),yield Ii(Oo.setProfileState({loading:!1,profile:Hf}))}function*uh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Vo(e.payload,ih);yield Ii(Oo.setProfileState({saving:!0,error:null}));const i=qf;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},i.profile,o,{profilePictureUrl:a}),l=zf;yield At(),yield Ii(Oo.setUser(C({},l,r))),yield Ii(Oo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*dh({payload:e}){var t;yield Ii(Oo.setProfileState({loading:!0})),yield At(),yield Ii(Oo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*yh(){yield Ia(Oo.loadProfile,ch),yield ka(Oo.saveProfile,uh),yield ka(Oo.changePassword,dh)}const fh=["callback"],ph=["callback"],gh=["user"],Sh=["callback"],vh=["deviceId","callback"],hh=["deviceId","callback"],mh=["callback"],Ah=["deviceId"],bh=["deviceId"],Th=["callback"],kh=["deviceId"],Eh=["callback"];function*Ih(e){const{step:t}=yield Ci((e=>e.auth.mfaState));return{step:e.recoveryCode?rn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Ph(){yield Ii(Oo.setMfaState({saving:!0}));try{const{qrCode:e}=yield Oi(bf.auth.enrollMfa);yield Ii(Oo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)}))}}function*Lh(e){let{payload:{callback:t}}=e,n=Vo(e.payload,fh);yield Ii(Oo.setMfaState({saving:!0}));try{const e=yield Ci((e=>e.auth.user)),o=yield Oi(bf.auth.verifyMfa,n),i=yield Oi(bf.auth.getMFADevices),a=yield Ih(o);yield Ii(Oo.setMfaState(C({},a,{mfaDevices:i}))),yield Ii(Oo.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*Oh(e){let{payload:{callback:t}}=e,n=Vo(e.payload,ph);yield Ii(Oo.setMfaState({loading:!0}));try{const e=yield Oi(bf.auth.loginWithMfaV2,n),{user:o}=e,i=Vo(e,gh),a={step:rn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield Ii(Oo.setMfaState(a)),yield gS(C({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield Ii(Oo.setMfaState({loading:!1,error:kp(e)})),null==t||t(null,e)}}function*_h({payload:e}){yield Ii(Oo.setMfaState({saving:!0}));try{var t;yield Oi(bf.auth.disableMfa,e);const n=yield Oi(bf.auth.getMFADevices);yield Ii(Oo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setMfaState({saving:!1,error:kp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*wh({payload:e}){yield Ii(Oo.setMfaState({saving:!0}));try{var t,n;const o=yield Oi(bf.auth.preEnrollMFAWebAuthn),i=C({},o.options,{challenge:kt(o.options.challenge),user:C({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield Ii(Oo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield Ii(Oo.setMfaState({saving:!1,error:kp(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*Ch(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Sh);yield Ii(Oo.setMfaState({saving:!0}));try{const e=Et(n.publicKey),o=yield Oi(bf.auth.enrollMFAWebAuthn,C({},n,{options:e})),i=yield Oi(bf.auth.getMFADevices),a=yield Ih(o);yield Ii(Oo.setMfaState(C({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*Uh(e){let{payload:{deviceId:t,callback:n}}=e;Vo(e.payload,vh),yield Ii(Oo.setMfaState({saving:!0}));try{var o;const e=yield Oi(bf.auth.preDisableMFAWebAuthn,t),i=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield Ii(Oo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==n||n(null,e)}}function*Rh(e){let{payload:{deviceId:t,callback:n}}=e,o=Vo(e.payload,hh);yield Ii(Oo.setMfaState({saving:!0}));try{const e=Et(o.publicKey);yield Oi(bf.auth.disableMFAWebAuthn,t,C({},o,{options:e}));const i=yield Oi(bf.auth.getMFADevices);yield Ii(Oo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==n||n(!1,e)}}function*Dh({payload:e}){yield Ii(Oo.setMfaState({saving:!0}));try{var t;const n=yield Oi(bf.auth.preEnrollMFASMS,e);yield Ii(Oo.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 Ii(Oo.setMfaState({saving:!1,error:kp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Nh(e){let{payload:{callback:t}}=e,n=Vo(e.payload,mh);yield Ii(Oo.setMfaState({saving:!0}));try{const e=yield Oi(bf.auth.enrollMFASMS,n),o=yield Oi(bf.auth.getMFADevices),i=yield Ih(e);yield Ii(Oo.setMfaState(C({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*Mh(e){let{payload:{deviceId:t}}=e,n=Vo(e.payload,Ah);yield Ii(Oo.setMfaState({saving:!0}));try{var o;const e=yield Oi(bf.auth.preDisableMFASMS,t);yield Ii(Oo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Fh(e){let{payload:{deviceId:t}}=e,n=Vo(e.payload,bh);yield Ii(Oo.setMfaState({saving:!0}));try{var o;yield Oi(bf.auth.disableMFASMS,t,n);const e=yield Oi(bf.auth.getMFADevices);yield Ii(Oo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Gh(){yield Ii(Oo.setMfaState({loading:!0}));try{yield Ci((e=>e.auth.user));const e=yield Oi(bf.auth.getMFADevices);yield Ii(Oo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Ii(Oo.setMfaState({loading:!1,error:kp(e)}))}}function*$h(){yield Ii(Oo.setMfaState({loading:!0}));try{const e=(yield Oi(bf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Ii(Oo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Ii(Oo.setMfaState({loading:!1,error:kp(e)}))}}function*xh(){yield ka(Oo.enrollMfa,Ph),yield ka(Oo.getMFADevices,Gh),yield ka(Oo.getMFAStrategies,$h),yield ka(Oo.verifyMfa,Lh),yield ka(Oo.disableMfa,_h),yield ka(Oo.verifyMfaAfterForce,Oh),yield ka(Oo.preDisableMfaSms,Mh),yield ka(Oo.disableMfaSms,Fh),yield ka(Oo.preEnrollMfaSms,Dh),yield ka(Oo.enrollMfaSms,Nh),yield ka(Oo.preEnrollMfaWebAuthn,wh),yield ka(Oo.enrollMfaWebAuthn,Ch),yield ka(Oo.preDisableMfaWebAuthn,Uh),yield ka(Oo.disableMfaWebAuthn,Rh)}function*Vh(){yield Ii(Oo.setMfaState({saving:!0})),yield Ii(Oo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*jh({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Ci((e=>e.auth.mfaState));yield Ii(Oo.setMfaState({saving:!0})),yield At();const n={token:"token",recoveryCode:"recoveryCode"},o={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield Ii(Oo.setMfaState(o)),yield Ii(Oo.setUser(C({},zf,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Bh(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Th);yield Ii(Oo.setMfaState({loading:!0})),yield At();const o=C({},n,{recoveryCode:"recoveryCode"}),i={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Ii(Oo.setMfaState(i)),yield At(),yield Ii(Oo.setUser(C({},zf,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Wh({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ci((e=>e.auth.mfaState));yield Ii(Oo.setMfaState({saving:!0})),yield At(),yield Ii(Oo.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield Ii(Oo.setUser(C({},zf))),null==(t=e.callback)||t.call(e,!0)}function*Kh(e){let{}=e,t=Vo(e.payload,kh);yield Ii(Oo.setMfaState({saving:!0}));try{var n;yield Ii(Oo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield Ii(Oo.setMfaState({saving:!1,error:kp(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Hh({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ci((e=>e.auth.mfaState));yield Ii(Oo.setMfaState({saving:!0})),yield At(),yield Ii(Oo.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield Ii(Oo.setUser(C({},zf))),null==(t=e.callback)||t.call(e,!0)}function*zh({payload:e}){var t;yield Ii(Oo.setMfaState({saving:!0})),yield At(),yield Ii(Oo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*qh(e){let{payload:{callback:t}}=e;Vo(e.payload,Eh);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ci((e=>e.auth.mfaState));yield Ii(Oo.setMfaState({saving:!0})),yield At();const o={token:"token",recoveryCode:"recoveryCode"},i={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Ii(Oo.setMfaState(i)),yield Ii(Oo.setUser(C({},zf,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Yh(){yield ka(Oo.enrollMfa,Vh),yield ka(Oo.verifyMfa,jh),yield ka(Oo.disableMfa,Wh),yield ka(Oo.verifyMfaAfterForce,Bh),yield ka(Oo.preDisableMfaSms,Kh),yield ka(Oo.disableMfaSms,Hh),yield ka(Oo.preEnrollMfaSms,zh),yield ka(Oo.enrollMfaSms,qh)}const Jh=["callback"];function*Qh({payload:e}){yield Ii(Oo.setForgotPasswordState({loading:!0}));try{var t;yield Oi(bf.auth.forgotPassword,e),yield Ii(Oo.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setForgotPasswordState({loading:!1,error:kp(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Xh(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Jh);yield Ii(Oo.setForgotPasswordState({loading:!0}));try{yield Oi(bf.auth.resetPassword,n),yield Ii(Oo.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==t||t(!0)}catch(e){yield Ii(Oo.setForgotPasswordState({loading:!1,error:kp(e)})),null==t||t(!1,e)}}function*Zh({payload:e}){yield Ii(Oo.setForgotPasswordState({loading:!0}));try{const t=yield Oi(bf.auth.loadPasswordConfig,e);yield Ii(Oo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Ii(Oo.setForgotPasswordState({loading:!1,error:kp(e)}))}}function*em(){yield Ia(Oo.forgotPassword,Qh),yield Ia(Oo.resetPassword,Xh),yield Ia(Oo.loadPasswordConfig,Zh)}let tm;!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"}(tm||(tm={}));const nm=["callback","events"],om=["user"],im=["callback"],am=["callback"];function*rm({payload:{userId:e,token:t}}){yield Ii(Oo.setActivateState({loading:!0,step:Ft.activating}));try{const{isAuthenticated:n}=yield Ci((e=>e.auth));n&&(yield Ii(Oo.silentLogout()));const o=yield Oi(bf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Ii(Oo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield Ii(Oo.setActivateState({loading:!1,step:Ft.activatingForm})))}catch(e){yield Ii(Oo.setActivateState({loading:!1,error:kp(e)}))}}function*lm(e){let{payload:{callback:t,events:n}}=e,o=Vo(e.payload,nm);yield Ii(Oo.setActivateState({loading:!0}));try{const e=Pa.onRedirectTo,{routes:a}=yield Ci((e=>e.auth)),r=yield Oi(bf.auth.activateAccountV2,o),{user:l}=r,s=Vo(r,om);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Op(l)){yield Ii(Oo.setActivateState({step:Ft.success}));const t=yield mS(l);yield Ii(Oo.setState(t)),yield Ui(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield Ii(Oo.setActivateState({step:Ft.success})),null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Ap.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Oi(gS,C({user:l},s),{isAuthenticated:!0}),yield Ui(1e3),yield SS(),yield Ii(Oo.resetActivateState())}null==t||t(!0)}catch(e){yield Ii(Oo.setActivateState({loading:!1,error:kp(e)}))}}function*sm({payload:e}){const{callback:t}=e,n=Vo(e,im);yield Ii(Oo.setActivateStrategyState({loading:!0}));try{const e=yield Oi(bf.auth.getActivateAccountStrategy,n);yield Ii(Oo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Ii(Oo.setActivateStrategyState({loading:!1,error:kp(e)}))}}function*cm({payload:e}){const{callback:t}=e,n=Vo(e,am);yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.email})),yield Ii(Oo.setActivateState({loading:!0}));try{yield Oi(bf.auth.resendActivationEmail,n),yield Ii(Oo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Ii(Oo.setActivateState({loading:!1,error:kp(e)})),yield Ii(Oo.setTeamError({key:tm.RESEND_ACTIVATE_LINK,value:kp(e)})),null==t||t(null,e)}yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*um(){yield Ia(Oo.activateAccount,lm),yield Ia(Oo.preActivateAccount,rm),yield Ia(Oo.getActivateAccountStrategy,sm),yield Ia(Oo.resendActivationEmail,cm)}function*dm({payload:e}){if(e.token&&e.userId)try{yield Ii(Oo.setAcceptInvitationState({error:void 0,step:Vt.pending})),yield Oi(bf.auth.acceptInvitation,e),yield Ii(Oo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Vt.success}}))}catch(e){yield Ii(Oo.setAcceptInvitationState({step:Vt.failed,error:kp(e)}))}else yield Ii(Oo.setAcceptInvitationState({error:void 0,step:Vt.invalid}))}function*ym(){yield Ia(Oo.acceptInvitation,dm)}var fm,pm=new Uint8Array(16);function gm(){if(!fm&&!(fm="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 fm(pm)}for(var Sm=/^(?:[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,vm=function(e){return"string"==typeof e&&Sm.test(e)},hm=[],mm=0;mm<256;++mm)hm.push((mm+256).toString(16).substr(1));var Am=function(e,t,n){var o=(e=e||{}).random||(e.rng||gm)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(hm[e[t+0]]+hm[e[t+1]]+hm[e[t+2]]+hm[e[t+3]]+"-"+hm[e[t+4]]+hm[e[t+5]]+"-"+hm[e[t+6]]+hm[e[t+7]]+"-"+hm[e[t+8]]+hm[e[t+9]]+"-"+hm[e[t+10]]+hm[e[t+11]]+hm[e[t+12]]+hm[e[t+13]]+hm[e[t+14]]+hm[e[t+15]]).toLowerCase();if(!vm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let bm,Tm;!function(e){e.CREATE_GROUP="CREATE_GROUP",e.GET_GROUP="GET_GROUP",e.GET_GROUPS="GET_GROUPS",e.DELETE_GROUP="DELETE_GROUP",e.UPDATE_GROUP="UPDATE_GROUP",e.ADD_USERS_TO_GROUP="ADD_USERS_TO_GROUP",e.DELETE_USERS_FROM_GROUP="DELETE_USERS_FROM_GROUP",e.ADD_ROLES_TO_GROUP="ADD_ROLES_TO_GROUP",e.DELETE_ROLES_FROM_GROUP="DELETE_ROLES_FROM_GROUP",e.GET_GROUP_CONFIGURATION="GET_GROUP_CONFIGURATION",e.UPDATE_GROUP_CONFIGURATION="UPDATE_GROUP_CONFIGURATION",e.GET_TEAM_USERS="GET_TEAM_USERS"}(bm||(bm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Tm||(Tm={}));const km=["callback"],Em=["roles"],Im=["callback"],Pm=["callback","profileImage"],Lm=["callback"],Om=["callback","userId"],_m=["callback"],wm=["callback"],Cm=["callback"],Um=["callback"],Rm=["callback"],Dm=["callback"],Nm=["callback"],Mm=["callback","profileImage"],Fm=["callback"],Gm=["callback"],$m=["callback"],xm=["callback"],Vm=["callback"],jm=["callback"],Bm=()=>Ci((e=>e.auth.teamState));function*Wm(){try{const{groups:e}=yield Oi(bf.groups.getGroups,{_groupsRelations:Tm.roles});return e}catch(e){return[]}}function*Km({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c=null!=(t=e.pageSize)?t:s.pageSize,u=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(o=e.filter)?o:s.filterV2,y=null!=(i=e.sort)?i:s.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==s?void 0:s.shouldShowSubTenantUsersIfReseller;yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!r})),yield Ii(Oo.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield Pi([Oi(bf.users.getUsersV2,C({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Oi(bf.teams.loadAvailableRoles),Oi(bf.teams.loadAvailablePermissions),Oi(Wm)]),s=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield Ii(Oo.setTeamState({users:s.map((e=>C({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:o,roles:i,permissions:a})),null==l||l(t)}catch(e){yield Ii(Oo.setTeamError({key:tm.USERS,value:kp(e)})),yield Ii(Oo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!1}))}function*Hm({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Bm(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!a})),yield Ii(Oo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield Pi([Oi(bf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Oi(bf.teams.loadAvailableRoles),Oi(bf.teams.loadAvailablePermissions)]);yield Ii(Oo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield Ii(Oo.setTeamError({key:tm.USERS,value:e.message})),yield Ii(Oo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!1}))}function*zm({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!r})),yield Ii(Oo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Pi([Oi(bf.subTenants.loadAllUsers,C({},c)),Oi(bf.teams.loadAvailableRoles),Oi(bf.teams.loadAvailablePermissions)]);yield Ii(Oo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield Ii(Oo.setTeamError({key:tm.USERS,value:kp(e)})),yield Ii(Oo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!1}))}function*qm({payload:e}){yield Ii(Oo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Pi([Oi(bf.teams.loadAvailableRoles),Oi(bf.teams.loadAvailablePermissions)]);yield Ii(Oo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Ii(Oo.setTeamError({key:tm.ROLES_AND_PERMISSIONS,value:kp(t)}))}yield Ii(Oo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0}))}function*Ym({payload:e}){const{callback:t}=e,n=Vo(e,km),o=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Oi(bf.teams.addUser,n),{roles:a}=e,r=C({},Vo(e,Em),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield Ii(Oo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:kp(e)})})),null==t||t(null,e)}}function*Jm({payload:e}){const{callback:t}=e,n=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Ii(Oo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Oi(bf.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield Ii(Oo.loadUsersV2(r)),yield Ii(Oo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Qm({payload:e}){const{callback:t}=e,n=Vo(e,Im),o=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield Oi(bf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Oi(bf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Ii(Oo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:kp(e)})})),null==t||t(null,e)}}function*Xm({payload:e}){const{callback:t}=e,n=Vo(e,Pm),{id:o}=n,i=yield Bm(),a=i.users.find((e=>e.id===n.id));yield Ii(Oo.setTeamLoader({key:tm.UPDATE_USER,value:o||""})),yield Ii(Oo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield Ii(Oo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?C({},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 Oi(bf.teams.updateUser,n);null==t||t(e),yield Ii(Oo.setTeamState({users:i.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Ii(Oo.setTeamLoader({key:tm.UPDATE_USER,value:!1}))}catch(e){yield Ii(Oo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:kp(e)}),users:i.users.map((e=>e.id===n.id?C({},e,a):e))})),yield Ii(Oo.setTeamLoader({key:tm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Zm({payload:e}){const{callback:t}=e,n=Vo(e,Lm),o=yield Bm();yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Oi(bf.teams.deleteUser,n),null==t||t(!0),yield Ii(Oo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:kp(e)})})),null==t||t(null,e)}}function*eA({payload:e}){const{callback:t,userId:n}=e,o=Vo(e,Om),i=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield Oi(bf.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Ii(Oo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:kp(e)})})),null==t||t(null,e)}}function*tA({payload:e}){const{callback:t}=e,n=Vo(e,_m),o=yield Bm();yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Oi(bf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Ii(Oo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:kp(e)})})),null==t||t(null,e)}}function*nA({payload:e}){const{callback:t}=e,n=Vo(e,wm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Oi(bf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamError({key:tm.RESEND_ACTIVATE_LINK,value:kp(e)})),null==t||t(null,e)}yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*oA({payload:e}){const{callback:t}=e,n=Vo(e,Cm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Oi(bf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:kp(e)})),null==t||t(null,e)}yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*iA({payload:e}){const{callback:t}=e,n=Vo(e,Um);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Oi(bf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:kp(e)})),null==t||t(null,e)}yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*aA({payload:e}){const{callback:t}=e,n=Vo(e,Rm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Oi(bf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:kp(e)})),null==t||t(null,e)}yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*rA(){yield Ii(Oo.setTeamError({key:tm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Oi(bf.teams.getInviteLinkConfiguration);yield Ii(Oo.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield Ii(Oo.setTeamError({key:tm.CONFIG_TOKEN_LINK,value:kp(e)}))}}function*lA(){yield Ii(Oo.setTeamError({key:tm.GET_TOKEN_LINK,value:!1}));try{yield Oi(rA);const e=yield Oi(bf.teams.getInviteUserLink),{inviteTokenState:t}=yield Bm();yield Ii(Oo.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield Ii(Oo.setTeamError({key:tm.GET_TOKEN_LINK,value:kp(e)}))}}function*sA({payload:{callback:e}}){yield Ii(Oo.setTeamError({key:tm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Bm();try{const n=yield Oi(bf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Ii(Oo.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Ii(Oo.setTeamError({key:tm.CREATE_TOKEN_LINK,value:kp(t)}))}}function*cA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield Bm();yield Ii(Oo.setTeamError({key:tm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Oi(bf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Ii(Oo.setTeamState({inviteTokenState:C({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Ii(Oo.setTeamError({key:tm.UPDATE_TOKEN_LINK,value:kp(t)}))}}function*uA({payload:e}){const{callback:t}=null!=e?e:{};yield Ii(Oo.setTeamError({key:tm.DELETE_TOKEN_LINK,value:!1}));try{yield Oi(bf.teams.deleteInviteUserLink),yield Ii(Oo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Ii(Oo.setTeamError({key:tm.DELETE_TOKEN_LINK,value:kp(e)})),null==t||t(!1,e)}}function*dA({payload:e}){yield Ii(Oo.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*yA({payload:e}){const t=yield Bm(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Ii(Oo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*fA({payload:e}){yield Ii(Oo.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*pA({payload:e}){const t=yield Bm(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Ii(Oo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*gA(){yield Ea(Oo.loadUsers,Hm),yield Ea(Oo.loadUsersV2,Km),yield Ea(Oo.loadAllSubTenantsUsers,zm),yield Ea(Oo.loadRoles,qm),yield ka(Oo.addUser,Ym),yield ka(Oo.addUsersBulk,Jm),yield ka(Oo.addUserToSubTenants,Qm),yield ka(Oo.updateUser,Xm),yield ka(Oo.setUserRolesForSubTenants,eA),yield ka(Oo.deleteUser,Zm),yield ka(Oo.deleteUserFromSubTenants,tA),yield ka(Oo.resendActivationLink,nA),yield ka(Oo.resendInvitationLink,oA),yield ka(Oo.resendInvitationEmail,iA),yield ka(Oo.resendInvitationLinkToAllSubTenants,aA),yield ka(Oo.getInvitationLink,lA),yield ka(Oo.createInvitationLink,sA),yield ka(Oo.updateInvitationLink,cA),yield ka(Oo.deleteInvitationLink,uA),yield ka(Oo.openAddUserDialog,dA),yield ka(Oo.closeAddUserDialog,yA),yield ka(Oo.openDeleteUserDialog,fA),yield ka(Oo.closeDeleteUserDialog,pA)}function*SA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Bm(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filterV2,d=null!=(i=e.sort)?i:l.sortV2;yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!a})),yield Ii(Oo.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield At(),yield Ii(Oo.setTeamState({users:sp,totalPages:2,totalItems:10,roles:np,permissions:ip})),yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!1})),null==r||r(sp)}function*vA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!r})),yield Ii(Oo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield At(),yield Ii(Oo.setTeamState({allUsers:cp,totalPages:2,totalItems:10,roles:np,permissions:ip})),yield Ii(Oo.setTeamLoader({key:tm.USERS,value:!1})),null==l||l(cp)}function*hA({payload:e}){var t;yield Ii(Oo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0})),yield At(),yield Ii(Oo.setTeamState({roles:np,permissions:ip})),yield Ii(Oo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:np,permissions:ip})}function*mA({payload:e}){const{callback:t}=e,n=Vo(e,Dm),o=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},rp,{groups:[]},n,{id:`${Am()}`});null==t||t(i),yield Ii(Oo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*AA({payload:e}){const{callback:t}=e,n=Vo(e,Nm),o=yield Bm();yield Ii(Oo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},rp,n,{id:`${Am()}`});yield Ii(Oo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*bA({payload:e}){var t;const{callback:n}=e,o=Vo(e,Mm),{id:i}=o,a=yield Bm(),r=a.users.find((e=>e.id===o.id));yield Ii(Oo.setTeamLoader({key:tm.UPDATE_USER,value:i||""})),yield Ii(Oo.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield Ii(Oo.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?C({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield At();const l=C({},r,o);null==n||n(l),yield Ii(Oo.setTeamState({users:a.users.map((e=>e.id===l.id?C({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Ii(Oo.setTeamLoader({key:tm.UPDATE_USER,value:!1}))}function*TA({payload:e}){const{callback:t}=e,n=Vo(e,Fm),o=yield Bm();yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*kA({payload:e}){const{callback:t}=e,n=Vo(e,Gm),o=yield Bm();yield Ii(Oo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*EA({payload:e}){const{callback:t}=e,n=Vo(e,$m);yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.userId})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*IA({payload:e}){const{callback:t}=e,n=Vo(e,xm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*PA({payload:e}){const{callback:t}=e,n=Vo(e,Vm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*LA({payload:e}){const{callback:t}=e,n=Vo(e,jm);yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield Ii(Oo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*OA(){yield Ea(Oo.loadUsersV2,SA),yield Ea(Oo.loadAllSubTenantsUsers,vA),yield Ea(Oo.loadRoles,hA),yield ka(Oo.addUser,mA),yield ka(Oo.addUserToSubTenants,AA),yield ka(Oo.updateUser,bA),yield ka(Oo.deleteUser,TA),yield ka(Oo.deleteUserFromSubTenants,kA),yield ka(Oo.resendActivationLink,EA),yield ka(Oo.resendInvitationLink,IA),yield ka(Oo.resendInvitationEmail,PA),yield ka(Oo.resendInvitationLinkToAllSubTenants,LA),yield ka(Oo.openAddUserDialog,dA),yield ka(Oo.closeAddUserDialog,yA),yield ka(Oo.openDeleteUserDialog,fA),yield ka(Oo.closeDeleteUserDialog,pA)}const _A=["authorizationUrl"],wA=["events","url"];function*CA(){try{yield Ii(Oo.setSocialLoginsState({loading:!0}));const e=yield Oi(bf.auth.getSocialLoginProviders);yield Ii(Oo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Ii(Oo.setSocialLoginsState({error:kp(e),loading:!1,firstLoad:!1}))}}function*UA(){const e=yield Ci((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Oi(bf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Oi(bf.auth.getSocialLoginProvidersV2),t}function*RA(){try{const e=yield Ci((e=>e.root.context));yield Ii(Oo.setSocialLoginsState({loading:!0}));const t=yield Oi(UA),{providers:n}=yield Oi(bf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Vo(t,_A);const i=yr(e,null!=n?n:"");return C({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield Ii(Oo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Ii(Oo.setSocialLoginsState({error:kp(e),loading:!1,firstLoad:!1}))}}function*DA(e){let{payload:{events:t,url:n}}=e,o=Vo(e.payload,wA);try{yield Ii(Oo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Oi(bf.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:bp.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Ap.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Ii(Oo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Ci((e=>e.auth));e?yield Oi(kS):yield Oi(IS)}(),localStorage.removeItem("register-quick-login"),yield Ii(Oo.setSocialLoginsState({loading:!1}))}catch(e){yield Ii(Oo.setSocialLoginsState({loading:!1,error:kp(e,"Failed to authenticate"),firstLoad:!1}))}}function*NA({payload:e}){yield Ii(Oo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*MA(){yield Ia(Oo.loadSocialLoginsConfiguration,CA),yield Ia(Oo.loadSocialLoginsConfigurationV2,RA),yield Ia(Oo.loginViaSocialLogin,DA),yield Ea(Oo.setSocialLoginError,NA)}let FA;function*GA({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Ci((e=>e.auth.apiTokensState));try{let e,a;yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Oi(bf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Oi(bf.auth.updateUserApiTokensData,{description:t}),yield Ii(Oo.setApiTokensState({showAddTokenDialog:!1})),yield Ui(200),yield Ii(Oo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Ii(Oo.setApiTokensError({key:FA.ADD_API_TOKEN,value:kp(e)})),yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*$A({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Ci((e=>e.auth.apiTokensState));try{let e,r;yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Oi(bf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Oi(bf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Ii(Oo.setApiTokensState({showAddTokenDialog:!1})),yield Ui(200),yield Ii(Oo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Ii(Oo.setApiTokensError({key:FA.ADD_API_TOKEN,value:kp(e)})),yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*xA({payload:e}){const{apiTokensDataUser:t}=yield Ci((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),n?(yield Oi(bf.auth.deleteUserAccessToken,{id:e}),yield Ii(Oo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Oi(bf.auth.deleteUserApiToken,{tokenId:e}),yield Ii(Oo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}catch(e){yield Ii(Oo.setApiTokensError({key:FA.DELETE_API_TOKEN,value:kp(e)})),yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}}function*VA({payload:e}){const{apiTokensDataTenant:t}=yield Ci((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),n?(yield Oi(bf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Oi(bf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield Ii(Oo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}catch(e){yield Ii(Oo.setApiTokensError({key:FA.DELETE_API_TOKEN,value:kp(e)})),yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}}function*jA({payload:e}){null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Pi([Oi(bf.auth.getUserApiTokensData),Oi(bf.auth.getTenantApiTokensData)]);yield Ii(Oo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:kp(t)})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*BA({payload:e}){null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Oi(bf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Oi(bf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Ii(Oo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Ii(Oo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:kp(t)})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*WA({payload:e}){null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Oi(bf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Oi(bf.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Ii(Oo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Ii(Oo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:kp(t)})),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*KA(){yield Ia(Oo.loadApiTokens,jA),yield Ia(Oo.loadUserApiTokens,BA),yield Ia(Oo.loadTenantApiTokens,WA),yield ka(Oo.addUserApiToken,GA),yield ka(Oo.addTenantApiToken,$A),yield Ea(Oo.deleteTenantApiToken,VA),yield Ea(Oo.deleteUserApiToken,xA)}function*HA({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Ci((e=>e.auth.apiTokensState)),a=C({},Wf,{description:t,roleIds:n,clientId:`CLIENT_ID_${Am()}`});yield Ii(Oo.setApiTokensState({showAddTokenDialog:!1})),yield Ui(200),yield Ii(Oo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ui(200),yield Ii(Oo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*zA({payload:e}){yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),yield Ui(200);const t=[Wf];yield Ii(Oo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Ii(Oo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}function*qA({payload:e}){var t;null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Bf],o=[Wf];yield Ii(Oo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Ui(200),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*YA({payload:e}){var t;null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Bf];yield Ii(Oo.setApiTokensState({apiTokensDataUser:n})),yield Ui(200),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*JA({payload:e}){var t;null!=e&&e.silentLoading||(yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Wf];yield Ii(Oo.setApiTokensState({apiTokensDataTenant:n})),yield Ui(200),yield Ii(Oo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*QA(){yield Ia(Oo.loadApiTokens,qA),yield Ia(Oo.loadUserApiTokens,YA),yield Ia(Oo.loadTenantApiTokens,JA),yield ka(Oo.addTenantApiToken,HA),yield Ea(Oo.deleteTenantApiToken,zA)}function*XA({payload:e}){try{var t;yield Ii(Oo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ci((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Oi(bf.accountSettings.updateSettings,C({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Ii(Oo.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Ii(Oo.setAccountSettingsState({loading:!1,error:kp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*ZA({payload:e}){yield Ii(Oo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Oi(bf.accountSettings.getSettings);yield Ii(Oo.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield Ii(Oo.setAccountSettingsState({loading:!1,error:kp(e)}))}}function*eb(){yield Ia(Oo.saveAccountSettings,XA),yield Ia(Oo.loadAccountSettings,ZA)}function*tb({payload:e}){var t;yield Ii(Oo.setAccountSettingsState({loading:!0})),yield At();const{accountSettingsState:n}=yield Ci((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=C({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Ii(Oo.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*nb({payload:e}){yield Ii(Oo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield At(),yield Ii(Oo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*ob(){yield Ia(Oo.saveAccountSettings,tb),yield Ia(Oo.loadAccountSettings,nb)}function*ib({payload:{tenantId:e,callback:t}}){yield Ii(Oo.setState({isLoading:!0}));try{yield Oi(bf.tenants.switchTenant,{tenantId:e}),yield Oi(bS),(null==t?void 0:t(!0))||(yield Ii(Oo.setState({isLoading:!1})))}catch(e){yield Ii(Oo.setState({isLoading:!1})),null==t||t(!1,e)}}function*ab({payload:e}){yield Ii(Oo.setTenantsState({loading:!0}));try{var t;const n=yield Oi(bf.users.getCurrentUserTenantsV3);yield Ii(Oo.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,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 Ii(Oo.setTenantsState({loading:!1}))}}function*rb({payload:e}){yield Ii(Oo.setTenantsState({loading:!0}));try{var t;const n=yield Oi(bf.tenants.getSubTenants);yield Ii(Oo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lb({payload:e}){yield Ii(Oo.setTenantsState({loading:!0}));try{var t;const n=yield Oi(bf.tenants.getSubTenantsAsTree);yield Ii(Oo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ii(Oo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sb(){yield ka(Oo.loadTenants,ab),yield ka(Oo.loadSubTenants,rb),yield ka(Oo.switchTenant,ib),yield ka(Oo.loadSubTenantsTree,lb)}function*cb(){yield Ii(Oo.setTenantsState({loading:!0})),yield At(),yield Ii(Oo.setTenantsState({tenants:up,activeTenant:up[0],loading:!1}))}function*ub(){yield ka(Oo.loadTenants,cb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(FA||(FA={}));const db=["callback"],yb=["callback"],fb=["callback"],pb=["callback"],gb=["callback"];function*Sb({payload:e}){var t;yield Ii(Oo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Pi([Oi(bf.roles.getRoles),Oi(bf.roles.getPermissions),Oi(bf.roles.getPermissionCategories)]),[t,n,o]=e;yield Ii(Oo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield Ii(Oo.setRolesState({error:kp(e),loading:!1}))}}function*vb(e){let{payload:{callback:t}}=e,n=Vo(e.payload,db);yield Ii(Oo.setRolesState({saving:!0}));try{const e=yield Oi(bf.roles.addRole,n),o=yield Oi(bf.roles.getRoles);yield Ii(Oo.loadRolesAndPermissions({silentLoading:!0})),yield Ii(Oo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setRolesState({error:kp(e),saving:!1})),null==t||t(null,e)}}function*hb(e){let{payload:{callback:t}}=e,n=Vo(e.payload,yb);yield Ii(Oo.setRolesState({saving:!0}));try{yield Oi(bf.roles.deleteRole,n),yield Ii(Oo.loadRolesAndPermissions({silentLoading:!0})),yield Ii(Oo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setRolesState({error:kp(e),saving:!1})),null==t||t(!1,e)}}function*mb(e){let{payload:{callback:t}}=e,n=Vo(e.payload,fb);yield Ii(Oo.setRolesState({saving:!0}));try{const e=yield Oi(bf.roles.updateRole,n);yield Ii(Oo.loadRolesAndPermissions({silentLoading:!0})),yield Ii(Oo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setRolesState({error:kp(e),saving:!1})),null==t||t(null,e)}}function*Ab(e){let{payload:{callback:t}}=e,n=Vo(e.payload,pb);yield Ii(Oo.setRolesState({saving:!0}));try{const e=yield Oi(bf.roles.attachPermissionsToRole,n);yield Ii(Oo.loadRolesAndPermissions({silentLoading:!0})),yield Ii(Oo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setRolesState({error:kp(e),saving:!1})),null==t||t(null,e)}}function*bb(e){let{payload:{callback:t}}=e,n=Vo(e.payload,gb);yield Ii(Oo.setRolesState({saving:!0}));try{const e=yield Oi(bf.roles.attachPermissionToRoles,n);yield Ii(Oo.loadRolesAndPermissions({silentLoading:!0})),yield Ii(Oo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setRolesState({error:kp(e),saving:!1})),null==t||t(null,e)}}function*Tb(){yield Ia(Oo.loadRolesAndPermissions,Sb),yield ka(Oo.addRole,vb),yield ka(Oo.deleteRole,hb),yield ka(Oo.updateRole,mb),yield ka(Oo.attachPermissionsToRole,Ab),yield ka(Oo.attachPermissionToRoles,bb)}function*kb({payload:e}){var t;yield Ii(Oo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Ii(Oo.setRolesState({roles:Kf,loading:!1}))}catch(e){yield Ii(Oo.setRolesState({error:kp(e),loading:!1}))}}function*Eb(){yield Ia(Oo.loadRolesAndPermissions,kb)}const Ib=["callback"],Pb=["callback"],Lb=["callback"];function*Ob(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Ib);yield Ii(Oo.setResetPhoneNumberState({loading:!0}));try{const e=yield Oi(bf.auth.resetPhoneNumber,n);yield Ii(Oo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),yield Ii(Oo.setLoginState({email:n.email}))}catch(e){yield Ii(Oo.setResetPhoneNumberState({loading:!1,error:kp(e)})),null==t||t(null,e)}}function*_b(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Pb);yield Ii(Oo.setResetPhoneNumberState({loading:!0}));try{const e=yield Oi(bf.auth.verifyResetPhoneNumber,n);yield Ii(Oo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Yt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Ii(Oo.setResetPhoneNumberState({loading:!1,error:kp(e)})),null==t||t(null,e)}}function*wb(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Lb);yield Ii(Oo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Ci((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Oi(bf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Ii(Oo.setLoginState({step:It.loginWithSmsOtc})),yield Ii(Oo.passwordlessPreLogin({type:ol.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield Ii(Oo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setResetPhoneNumberState({loading:!1,error:kp(e)})),null==t||t(null,e)}}function*Cb(){yield Ia(Oo.resetPhoneNumber,Ob),yield Ia(Oo.verifyResetPhoneNumber,_b),yield Ia(Oo.changePhoneNumber,wb)}function*Ub(){yield Ii(Oo.setSessionsState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getCurrentUserSessions);yield Ii(Oo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Ii(Oo.setSessionsState({error:e,loading:!1}))}}function*Rb(){yield Ii(Oo.setSessionsState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getCurrentUserSession);yield Ii(Oo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Ii(Oo.setSessionsState({error:e,loading:!1}))}}function*Db({payload:{id:e}}){yield Ii(Oo.setSessionsState({loading:!0,error:null}));try{yield Oi(bf.auth.deleteSessionForUser,e),yield Ii(Oo.loadUserSessions())}catch(e){yield Ii(Oo.setSessionsState({error:e,loading:!1}))}}function*Nb({payload:{callback:e,userId:t}}){yield Ii(Oo.setSessionsState({loading:!0,error:null}));try{yield Oi(bf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Ii(Oo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Mb(){yield Ii(Oo.setSessionsState({loading:!0,error:null}));try{yield Oi(bf.auth.deleteAllSessionsForUser),yield Ii(Oo.loadUserSessions())}catch(e){yield Ii(Oo.setSessionsState({error:e,loading:!1}))}}function*Fb(){yield Ea(Oo.loadUserSessions,Ub),yield Ea(Oo.deleteUserSession,Db),yield Ea(Oo.deleteAllUserSessions,Mb),yield Ea(Oo.loadCurrentUserSession,Rb),yield ka(Oo.revokeUserSessions,Nb)}function*Gb(){yield Ii(Oo.setSessionsState({loading:!0,error:null})),yield Ii(Oo.setSessionsState({sessions:dp,loading:!1}))}function*$b({payload:{id:e}}){yield Ii(Oo.setSessionsState({loading:!0,error:null}));const t=(yield Ci((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Ii(Oo.setSessionsState({sessions:t,loading:!1}))}function*xb(){yield Ii(Oo.setSessionsState({loading:!0,error:null}));const e=dp.filter((e=>e.current));yield Ii(Oo.setSessionsState({sessions:e,loading:!1}))}function*Vb(){yield Ea(Oo.loadUserSessions,Gb),yield Ea(Oo.deleteUserSession,$b),yield Ea(Oo.deleteAllUserSessions,xb)}const jb=["callback"],Bb=["callback"];function*Wb(){yield Ii(Oo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getSessionConfigurations);yield Ii(Oo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Ii(Oo.setSessionsState({error:e,loading:!1}))}}function*Kb({payload:e}){yield Ii(Oo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Vo(e,jb);yield Oi(bf.auth.createOrUpdateSessionConfigrations,n),yield Ii(Oo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Ii(Oo.setSessionsPolicyState({error:e,loading:!1}))}}function*Hb(){yield Ia(Oo.loadSessionsPolicy,Wb),yield Ea(Oo.createOrUpdateSessionsPolicy,$p(Kb))}function*zb(){yield Ii(Oo.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ci((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:yp}));yield Ii(Oo.setSessionsPolicyState(C({},e,{loading:!1})))}function*qb({payload:e}){yield Ii(Oo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Vo(e,Bb);null==t||t(!0),yield Ii(Oo.setSessionsPolicyState({configurations:n,loading:!1}))}function*Yb(){yield Ia(Oo.loadSessionsPolicy,zb),yield Ea(Oo.createOrUpdateSessionsPolicy,qb)}const Jb=["callback"],Qb=["callback"],Xb=["callback"],Zb=["callback"],eT=["callback"],tT=["callback"],nT=["callback"],oT=["callback"],iT=()=>Ci((e=>e.auth.restrictionsState.ipRestrictions)),aT=()=>Ci((e=>e.auth.restrictionsState.emailDomainRestrictions));function*rT(){yield Ii(Oo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Oi(bf.auth.getDomainRestrictionsConfig),t=(yield Oi(bf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Ii(Oo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Ii(Oo.setEmailDomainRestrictionsState({error:kp(e),loading:!1}))}}function*lT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Jb);yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield aT();try{var i;yield Oi(bf.auth.createDomainRestriction,n);const e=(yield Oi(bf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setEmailDomainRestrictionsState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*sT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Qb);yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Oi(bf.auth.updateDomainRestrictionConfig,n),o=(yield Oi(bf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setEmailDomainRestrictionsState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*cT({payload:{id:e}}){yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield aT();try{var n;yield Oi(bf.auth.deleteDomainRestriction,e);const o=(yield Oi(bf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Vn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield Ii(Oo.setEmailDomainRestrictionsState({saving:!1,error:kp(e)}))}}const uT=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Vn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*dT(){yield Ii(Oo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield iT(),t=yield Oi(bf.auth.getIPRestrictionsConfig),n=uT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Oi(bf.auth.getIPRestrictions,n);yield Ii(Oo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield Ii(Oo.setIpRestrictionsState({error:kp(e),loading:!1}))}}function*yT(){try{const{valid:e}=yield Oi(bf.auth.testCurrentIpInAllowList);yield Ii(Oo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Ii(Oo.setIpRestrictionsState({error:kp(e)}))}}function*fT({payload:{callback:e}}){yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ci((e=>e.auth.userIp));yield Pi([Oi(bf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Vn.ALLOW}),Oi(bf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield iT(),o=uT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Oi(bf.auth.getIPRestrictions,o);yield Ii(Oo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Vn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Ii(Oo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*pT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Xb);yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));const o=yield iT();try{var i,a;yield Oi(bf.auth.createIPRestriction,n);const e=yield iT(),r=uT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Oi(bf.auth.getIPRestrictions,r);yield yT(),yield Ii(Oo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:Vn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setIpRestrictionsState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*gT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,Zb);yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));try{yield Oi(bf.auth.updateIPRestrictionConfig,n);const e=yield iT(),o=yield Oi(bf.auth.getIPRestrictionsConfig),i=uT(C({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Oi(bf.auth.getIPRestrictions,i);yield yT(),yield Ii(Oo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setIpRestrictionsState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*ST({payload:{id:e,callback:t}}){yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));const n=yield iT();try{var o;yield Oi(bf.auth.deleteIPRestriction,e);const i=yield iT(),a=uT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Oi(bf.auth.getIPRestrictions,a);yield yT(),yield Ii(Oo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:Vn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setIpRestrictionsState({saving:!1,error:kp(e)})),null==t||t(null,e)}}function*vT(){yield Ia(Oo.loadIpRestrictions,$p(dT)),yield Ia(Oo.loadEmailDomainRestrictions,$p(rT)),yield ka(Oo.saveIpRestriction,$p(pT)),yield ka(Oo.saveIpRestrictionsConfig,$p(gT)),yield ka(Oo.deleteIpRestriction,$p(ST)),yield ka(Oo.checkIfUserIpValid,$p(yT)),yield ka(Oo.addCurrentUserIpAndActivate,$p(fT)),yield ka(Oo.saveEmailDomainRestriction,$p(lT)),yield ka(Oo.saveEmailDomainRestrictionsConfig,$p(sT)),yield ka(Oo.deleteEmailDomainRestriction,$p(cT))}function*hT(){yield Ii(Oo.setIpRestrictionsState({loading:!0,error:null})),yield Ii(Oo.setIpRestrictionsState({data:{restrictions:pp.filter((e=>e.strategy===fp.strategy)),config:fp},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*mT(){yield Ii(Oo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield iT(),t=pp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Ii(Oo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Ii(Oo.setIpRestrictionsState({error:kp(e),loading:!1}))}}function*AT(e){var t,n,o;let{payload:{callback:i}}=e,a=Vo(e.payload,eT);yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));const r=yield iT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Ii(Oo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Vn.ALLOW},restrictions:[...l,C({},a,{createdAt:new Date,updatedAt:new Date,id:Am(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*bT(e){var t,n,o;let{payload:{callback:i}}=e,a=Vo(e.payload,tT);const r=yield iT();yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null})),yield Ii(Oo.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Ii(Oo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*TT({payload:{id:e,callback:t}}){var n;yield Ii(Oo.setIpRestrictionsState({saving:!0,error:null}));const o=yield iT();yield Ii(Oo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:Vn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*kT(){yield Ii(Oo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Ii(Oo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Vn.ALLOW}],config:{active:!0,listType:Vn.ALLOW,blockPublicDomains:!1}}}))}function*ET(e){var t,n;let{payload:{callback:o}}=e,i=Vo(e.payload,nT);const a=yield aT();yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==o||o(!0),yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},i,{id:Date.now().toString()})]},saving:!1}))}function*IT(e){var t;let{payload:{callback:n}}=e,o=Vo(e.payload,oT);const i=yield aT();yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==n||n(!0),yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||Vn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*PT({payload:{id:e}}){var t,n;const o=yield aT();yield Ii(Oo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),yield Ii(Oo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Vn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*LT(){yield Ia(Oo.loadIpRestrictions,hT),yield Ia(Oo.loadEmailDomainRestrictions,kT),yield ka(Oo.saveIpRestriction,AT),yield ka(Oo.saveIpRestrictionsConfig,bT),yield ka(Oo.deleteIpRestriction,TT),yield ka(Oo.checkIfUserIpValid,mT),yield ka(Oo.saveEmailDomainRestriction,ET),yield ka(Oo.saveEmailDomainRestrictionsConfig,IT),yield ka(Oo.deleteEmailDomainRestriction,PT)}const OT=["callback"],_T=["id"];function*wT(e){const{count:t}=yield Oi(bf.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*CT(){yield Ii(Oo.setProvisioningState({loading:!0,error:null}));try{const e=yield Oi(bf.directory.getConfigs),t=yield Pi(e.map((e=>wT(e))));yield Ii(Oo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Ii(Oo.setProvisioningState({error:kp(e),loading:!1}))}}function*UT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,OT);yield Ii(Oo.setProvisioningState({loading:!0,error:null}));try{const e=yield Oi(bf.directory.createConfiguration,n),o=yield Oi(bf.directory.getConfigs),i=yield Pi(o.map((e=>wT(e))));yield Ii(Oo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield Ii(Oo.setProvisioningState({error:kp(e),loading:!1}))}}function*RT(e){let{payload:{id:t}}=e,n=Vo(e.payload,_T);yield Ii(Oo.setProvisioningState({loading:!0,error:null}));try{yield Oi(bf.directory.updateConfiguration,t,n);const e=yield Oi(bf.directory.getConfigs),o=yield Pi(e.map((e=>wT(e))));yield Ii(Oo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield Ii(Oo.setProvisioningState({error:kp(e),loading:!1}))}}function*DT({payload:{id:e,callback:t}}){yield Ii(Oo.setProvisioningState({loading:!0,error:null}));try{yield Oi(bf.directory.deleteConfiguration,e);const n=yield Oi(bf.directory.getConfigs),o=yield Pi(n.map((e=>wT(e))));yield Ii(Oo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setProvisioningState({error:kp(e),loading:!1})),null==t||t(!1,e)}}function*NT(){yield Ia(Oo.loadProvisionConnections,CT),yield ka(Oo.createProvisionConnection,UT),yield ka(Oo.deleteProvisionConnection,DT),yield ka(Oo.updateProvisionConnection,RT)}const MT=["callback","events"];function*FT(e){let{payload:{callback:t}}=e,n=Vo(e.payload,MT);yield Ii(Oo.setImpersonateState({loading:!0}));try{yield Oi(bf.impersonate.impersonate,n),yield Ii(Oo.setImpersonateState({step:To.success})),yield Ui(1e3),yield SS(),yield Ii(Oo.resetImpersonateState()),null==t||t(!0)}catch(e){yield Ii(Oo.setImpersonateState({loading:!1,error:kp(e)}))}}function*GT(){yield Ia(Oo.impersonate,FT)}function*$T({payload:e}){const{callback:t,deviceId:n}=e;yield Ii(Oo.setPasskeysState({loading:!0}));try{yield Oi(bf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Ci((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield Ii(Oo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield Ii(Oo.setPasskeysState({loading:!1,error:kp(e,null)})),null==t||t(null,e)}}function*xT(){yield Ii(Oo.setPasskeysState({loading:!0}));try{const{devices:e}=yield Oi(bf.auth.getWebAuthnDevices);yield Ii(Oo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Ii(Oo.setPasskeysState({loading:!1,error:kp(e,null)}))}}function*VT(){yield ka(Oo.loadWebAuthnDevices,xT),yield ka(Oo.deleteWebAuthnDevice,$T)}const jT=["roleIds","userIds"],BT=()=>Ci((e=>e.auth.groupsState));function*WT({payload:e}){const t=bm.GET_TEAM_USERS;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Oi(bf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Ii(Oo.setGroupsState({teamUsers:n}))}catch(e){yield Ii(Oo.setUsersGroupsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*KT({payload:e}){const t=bm.GET_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Oi(bf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Tm.rolesAndUsers});yield Ii(Oo.setGroupsState({selectedGroup:n}))}catch(e){yield Ii(Oo.setUsersGroupsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*HT(){const e=bm.GET_GROUPS,t=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Oi(bf.groups.getGroups,{_groupsRelations:Tm.rolesAndUsers});yield Ii(Oo.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Ii(Oo.setUsersGroupsError({key:e,value:kp(t)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:e,value:!1}))}}function*zT({payload:e}){const t=bm.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Vo(e,jT);yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Oi(bf.groups.createGroup,C({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield Ii(Oo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield Ii(Oo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Ii(Oo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*qT({payload:e}){const t=bm.UPDATE_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.updateGroup,e),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*YT({payload:e}){const t=bm.DELETE_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.deleteGroup,e.groupId),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*JT({payload:e}){const t=bm.ADD_ROLES_TO_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*QT({payload:e}){const t=bm.DELETE_ROLES_FROM_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*XT({payload:e}){const t=bm.ADD_USERS_TO_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*ZT({payload:e}){const t=bm.DELETE_USERS_FROM_GROUP;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Oi(bf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Ii(Oo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ii(Oo.setUsersGroupsError({key:t,value:kp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*ek(){const e=bm.GET_GROUP_CONFIGURATION;yield Ii(Oo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Oi(bf.groups.getGroupConfiguration);yield Ii(Oo.setGroupsState({groupsConfiguration:t}))}catch(t){yield Ii(Oo.setUsersGroupsError({key:e,value:kp(t)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:e,value:!1}))}}function*tk({payload:e}){const t=bm.UPDATE_GROUP_CONFIGURATION;yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0}));try{yield Oi(bf.groups.updateGroupConfiguration,e),yield Ii(Oo.getGroupConfiguration())}catch(e){yield Ii(Oo.setUsersGroupsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}}function*nk(){yield Ea(Oo.loadGroups,HT),yield Ea(Oo.getGroupById,KT),yield Ea(Oo.createGroup,zT),yield Ea(Oo.updateGroup,qT),yield Ea(Oo.deleteGroup,YT),yield Ea(Oo.addRolesToGroup,JT),yield Ea(Oo.deleteRolesFromGroup,QT),yield Ea(Oo.addUsersToGroup,XT),yield Ea(Oo.deleteUsersFromGroup,ZT),yield Ea(Oo.getGroupConfiguration,ek),yield Ea(Oo.updateGroupConfiguration,tk),yield Ea(Oo.getTeamUsers,WT)}function*ok(){const e=bm.GET_GROUPS;yield Ii(Oo.setUsersGroupsLoader({key:e,value:!0}));const t=vp;yield Ii(Oo.setGroupsState({groups:t})),yield Ii(Oo.setUsersGroupsLoader({key:e,value:!1}))}function*ik({payload:e}){var t;const n=bm.CREATE_GROUP,{groups:o}=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:n,value:!0})),yield Ii(Oo.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:gf.FRONTEGG}),...null!=o?o:[]]})),yield Ui(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:n,value:!1}))}function*ak({payload:e}){var t,n,o,i,a;const r=bm.UPDATE_GROUP,l=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:r,value:!0})),yield Ii(Oo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:gf.FRONTEGG}):t})),selectedGroup:C({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield Ui(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:r,value:!1}))}function*rk({payload:e}){var t,n;const o=bm.DELETE_GROUP,i=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:o,value:!0})),yield Ii(Oo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ui(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:o,value:!1}))}function*lk({payload:e}){var t,n;const o=bm.ADD_ROLES_TO_GROUP,i=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:o,value:!0})),yield Ii(Oo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ui(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:o,value:!1}))}function*sk({payload:e}){var t,n;const o=bm.DELETE_ROLES_FROM_GROUP,i=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:o,value:!0})),yield Ii(Oo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ui(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:o,value:!1}))}function*ck({payload:e}){var t,n;const o=bm.ADD_USERS_TO_GROUP,i=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:o,value:!0})),yield Ii(Oo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ui(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:o,value:!1}))}function*uk({payload:e}){var t,n;const o=bm.DELETE_USERS_FROM_GROUP,i=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:o,value:!0})),yield Ii(Oo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ui(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ii(Oo.setUsersGroupsLoader({key:o,value:!1}))}function*dk(){const e=bm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Ii(Oo.setGroupsState({groupsConfiguration:C({},t)}))),yield Ii(Oo.setUsersGroupsLoader({key:e,value:!1}))}function*yk({payload:e}){const t=bm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield BT();yield Ii(Oo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Ii(Oo.setGroupsState({groupsConfiguration:C({},n,e)}))),yield Ii(Oo.setUsersGroupsLoader({key:t,value:!1}))}function*fk(){yield Ea(Oo.loadGroups,ok),yield Ea(Oo.createGroup,ik),yield Ea(Oo.updateGroup,ak),yield Ea(Oo.deleteGroup,rk),yield Ea(Oo.addRolesToGroup,lk),yield Ea(Oo.deleteRolesFromGroup,sk),yield Ea(Oo.addUsersToGroup,ck),yield Ea(Oo.deleteUsersFromGroup,uk),yield Ea(Oo.getGroupConfiguration,dk),yield Ea(Oo.updateGroupConfiguration,yk)}let pk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(pk||(pk={}));const gk=(e,t,n)=>{var o,i;return e.tenantId===t?C({},e,{name:n}):C({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>gk(e,t,n))))?o:[]})};function Sk(e,t){var n;return C({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Sk(e,t))):[]})}function vk(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return C({},e,{children:t})}return C({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>vk(e,t,n))))?o:[]})}const hk=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),mk=()=>Ci((e=>e.auth.allAccountsState));function*Ak({payload:e}){const t=pk.GET_ACCOUNTS;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield mk(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield mk(),{items:n,_links:i}=yield Oi(bf.tenants.searchSubTenants,r,{jwt:o}),a=yield Oi(bf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=hk({items:n},a),c=vk(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield Ii(Oo.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield mk(),{items:n,_links:o}=yield Oi(bf.tenants.searchSubTenants,r),i=yield Oi(bf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=hk({items:n},i),l=vk(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield Ii(Oo.setAllAccountsState({accounts:l}))}}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*bk({payload:e}){const t=pk.SEARCH_ACCOUNTS;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield mk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Oi(bf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield Ii(Oo.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=pk.GET_USER_JWT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Oi(bf.users.GetUserJwt,{tenantId:n});yield Ii(Oo.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),yield Ii(Oo.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=pk.CREATE_SUB_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield mk(),{selectedAccount:t}=yield mk(),r=yield Oi(bf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=vk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=vk(C({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Ii(Oo.setAllAccountsState({accounts:l})),yield Ii(Oo.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield mk(),t=yield Oi(bf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=vk(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Ii(Oo.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==r||r(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=pk.DELETE_SUB_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield Oi(bf.subTenants.deleteSubTenant,o,{jwt:n});const i=Sk(t,o),a=Sk(null==e?void 0:e.accounts,o);yield Ii(Oo.setAllAccountsState({accounts:i})),yield Ii(Oo.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield mk();yield Oi(bf.subTenants.deleteSubTenant,o);const t=Sk(e,o);yield Ii(Oo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==i||i(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield Oi(bf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=gk(e.accounts,a,o);yield Ii(Oo.setSelectedAccountState({name:o,accounts:i}));const r=gk(t,a,o);yield Ii(Oo.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield mk();yield Oi(bf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=gk(e,a,o);yield Ii(Oo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==i||i(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Pk({payload:e}){const t=pk.DELETE_USERS_FROM_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Oi(bf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield Ii(Oo.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==a||a(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=pk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield mk();try{yield Oi(bf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield Ii(Oo.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==a||a(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=pk.ADD_USERS_TO_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Oi(bf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield Ii(Oo.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==a||a(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*_k({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield mk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Oi(bf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield Ii(Oo.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?C({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)})),null==r||r(!1)}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*wk({payload:e}){var t,n,o,i,a,r,l,s;const c=pk.GET_ACCOUNT_USERS;yield Ii(Oo.setAllAccountsLoader({key:c,value:!0}));const u=yield mk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=C({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Oi(bf.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:C({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Oi(bf.roles.getRoles),i=yield Oi(bf.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return C({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield Ii(Oo.setSelectedAccountState(C({users:a},o)))}else yield Ii(Oo.setSelectedAccountState(C({users:[]},o)))}catch(e){yield Ii(Oo.setAllAccountsError({key:c,value:kp(e)}))}finally{yield Ii(Oo.setAllAccountsLoader({key:c,value:!1}))}}function*Ck({payload:e}){const t=pk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Oi(bf.accountSettings.getSettings,{jwt:n}),u=yield Oi(bf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Oi(bf.tenants.getParentTenants,{jwt:n}),y=yield Oi(bf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield Ii(Oo.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield Ii(Oo.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=pk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Ii(Oo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Oi(bf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield Ii(Oo.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Ii(Oo.setAllAccountsError({key:t,value:kp(e)}))}finally{yield Ii(Oo.setAllAccountsLoader({key:t,value:!1}))}}function*Rk(){yield Ea(Oo.loadAccounts,Ak),yield Ea(Oo.searchAccounts,bk),yield Ea(Oo.updateSubAccountAccessForUser,_k),yield Ea(Oo.getUserJwtForSubAccount,Tk),yield Ea(Oo.createSubAccount,kk),yield Ea(Oo.deleteSubAccount,Ek),yield Ea(Oo.updateSubAccountSettings,Ik),yield Ea(Oo.addUsersToAccount,Ok),yield Ea(Oo.deleteUsersFromAccount,Pk),yield Ea(Oo.setUserRolesForSubAccount,Lk),yield Ea(Oo.getAccountUsers,wk),yield Ea(Oo.setSelectedSubAccountData,Ck),yield Ea(Oo.loadNumberOfUsersForSelectedSubAccount,Uk)}var Dk={sagas:function*(){yield Pi([Oi(yv),Oi(um),Oi(ym),Oi(em),Oi(Cb),Oi(Ov),Oi(nh),Oi(sh),Oi(Fp),Oi(xh),Oi(gA),Oi(nk),Oi(MA),Oi(Rg),Oi(KA),Oi(gg),Oi(eb),Oi(sb),Oi(Tb),Oi(Fb),Oi(Hb),Oi(vT),Oi(NT),Oi(GT),Oi(VT),Oi(Rk),Oi(Hg),Oi(Bp)])},mockSagas:function*(){yield Pi([Oi(gv),Oi(Nv),Oi(yh),Oi(Yh),Oi(OA),Oi(QA),Oi(Og),Oi(Vb),Oi(ob),Oi(ub),Oi(Yb),Oi(LT),Oi(Eb),Oi(fk),Oi(Hp)])},storeName:wt,initialState:bo,reducer:Po,actions:Oo};const Nk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),Mk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Fk={setAuditLogsState:Nk("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:Mk})},Gk={exportAuditsCsv:ct("auditLogs/exportAuditsCsv"),loadAuditLogs:ct("auditLogs/loadAuditLogs",(e=>({payload:e})))},$k={loading:!0},xk={setAuditsMetadataState:Nk("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:$k})},Vk={loadAuditsMetadata:ct("auditLogs/loadAuditsMetadata")},jk={auditLogsState:Mk,auditsMetadataState:$k},{reducer:Bk,actions:Wk}=dt({name:Ut,initialState:jk,reducers:C({resetState:e=>C({},e,jk),setState:(e,{payload:t})=>C({},e,t)},Fk,xk)}),Kk=C({},Wk,Gk,Vk),Hk=e=>"createdAt"!==e.id,zk={total:20,data:Array.from(Array(5).keys()).map((e=>C({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`})))},qk={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}]},Yk=()=>Ci((e=>e.auditLogs.auditLogsState)),Jk=()=>Ci((e=>e.auditLogs.auditsMetadataState));function*Qk(){const e=yield Yk(),{columns:t}=yield Jk();try{const n=e.filter,o=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield Ii(Kk.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield bf.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield Ii(Kk.setAuditLogsState({isDownloadingCsv:!1}))}function*Xk({payload:e}){yield Ii(Kk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Yk(),{columns:n}=yield Jk();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Ii(Kk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield Ii(Kk.loadAuditsMetadata()));const{data:p,total:g}=yield Oi(bf.audits.getAudits,C({offset:c,count:s},y,f));yield Ii(Kk.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield Ii(Kk.setAuditLogsState({loading:!1,error:kp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Zk(){yield ka(Kk.exportAuditsCsv,Qk),yield ka(Kk.loadAuditLogs,Xk)}function*eE({payload:e}){yield Ii(Kk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Yk(),{columns:n}=yield Jk();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Ii(Kk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Ii(Kk.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=zk;let o=n.filter((e=>t=>e.filter(Hk).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield Ii(Kk.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 Ii(Kk.setAuditLogsState({loading:!1,error:kp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tE(){yield ka(Kk.loadAuditLogs,eE)}function*nE(){yield Ii(Kk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Oi(bf.metadata.getAuditsMetadata);yield Ii(Kk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Ii(Kk.setAuditsMetadataState({error:e,loading:!1}))}}function*oE(){yield ka(Kk.loadAuditsMetadata,nE)}function*iE(){yield Ii(Kk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=qk;yield Ii(Kk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Ii(Kk.setAuditsMetadataState({error:e,loading:!1}))}}function*aE(){yield ka(Kk.loadAuditsMetadata,iE)}var rE={sagas:function*(){yield Pi([Oi(Zk),Oi(oE)])},mockSagas:function*(){yield Pi([Oi(tE),Oi(aE)])},storeName:Ut,initialState:jk,reducer:Bk,actions:Kk};const lE={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:sE,actions:cE,reducer:uE}=dt({name:"audits",initialState:lE,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=C({},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]})))}}}),dE=C({},cE,{initData:ct(`${sE}/initData`),loadAudits:ct(`${sE}/loadAudits`),removeFilter:ct(`${sE}/removeFilter`),filterData:ct(`${sE}/filterData`),exportCSV:ct(`${sE}/exportCSV`),deleteAudits:ct(`${sE}/deleteAudits`)}),yE=()=>Ci((e=>e[sE]));function*fE(){const{sortBy:e,sortDirection:t}=yield yE();try{const n=yield Oi(bf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Ii(dE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Ii(dE.loadItemFailedAction(t))}}function*pE(){try{const e=yield Oi(bf.metadata.getAuditsMetadata);yield Ii(dE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Ii(dE.loadItemFailedAction(t))}}const gE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SE({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yE(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yE():{rowsData:[]};try{const e=gE(t),{data:l,total:d}=yield Oi(bf.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Ii(dE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Ii(dE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Ii(dE.loadItemFailedAction(t))}}function*vE(){yield Ii(dE.startLoading()),yield Pi([fE(),pE(),SE({payload:{onlyOneLoad:!1},type:""})]),yield Ii(dE.finishLoading())}function*hE({payload:e}){const{filters:t}=yield yE(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield Ii(dE.setFilterData(o))}function*mE({payload:e}){const{filters:t}=yield yE();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield Ii(dE.setFilterData(o))}function*AE(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yE(),a=gE(e);yield Ii(dE.startDownloadingCsv());try{yield bf.audits.exportAudits(C({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Ii(dE.stopDownloadingCsv())}}function*bE(){yield Ea(dE.initData,vE),yield Ea(dE.removeFilter,hE),yield Ea(dE.filterData,mE),yield Ea([dE.loadAudits,dE.textSearch,dE.onPageChange],SE),yield Ea([dE.setFilterData,dE.setDataSorting,dE.startRefresh],(()=>SE({payload:{appendMode:!1},type:""}))),yield Ea(dE.exportCSV,AE)}const TE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},kE={initData:()=>C({},TE),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},EE={loadSlackActions:ct("connectivity/loadSlackActions"),loadDataAction:ct("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ct("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ct("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ct("connectivity/loadScope"),deleteWebhookConfigAction:ct("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ct("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ct("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},IE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:PE,actions:LE}=dt({name:Ct,initialState:IE,reducers:C({},kE)}),OE=C({},LE,EE),_E={slack:bf.connectivity.getSlackConfiguration,email:bf.connectivity.getEmailConfiguration,sms:bf.connectivity.getSMSConfiguration,webhook:bf.connectivity.getWebhooksConfigurations,categories:bf.connectivity.getCategories,channelMap:bf.connectivity.getChannelMaps},wE={slack:bf.connectivity.postSlackConfiguration,email:bf.connectivity.postEmailConfiguration,sms:bf.connectivity.postSMSConfiguration,webhook:bf.connectivity.postWebhooksConfiguration},CE=["email","slack","sms","webhook"],UE={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"}},RE=["id"],DE=["id","enabled"],NE=["categories","channelMap"];function*ME(e){return yield Oi(GE,{payload:{api:e},type:""})}function*FE({payload:e=CE}){yield Ii(OE.setConnectivityState({isLoading:!0}));try{const t=yield Pi([...e.map(ME),yield GE({payload:{api:"categories"},type:""}),yield function*(){return(yield Pi(e.map((function*(e){return yield GE({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>C({},t,{[`${e[o]}`]:n})),{})}()]),n=yield GE({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?C({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:UE[e[i]].events(o),active:UE[e[i]].isActive(o),platform:UE[e[i]].title,image:UE[e[i]].image}]}):n:C({},n,{[`${NE[i-e.length]}`]:o})),{list:[],webhook:n});yield Ii(OE.setConnectivityState(C({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Ii(OE.setConnectivityState({isLoading:!1}))}}function*GE({payload:{api:e,params:t}}){try{return yield Oi(_E[e],t)}catch(e){return}}function*$E(){try{yield Ii(OE.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Oi(bf.connectivity.getSlackChannels);yield Ii(OE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Ii(OE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xE(e,t){const{connectivity:{list:n}}=yield Ci(),o=n.find((({key:t})=>t===e));if(!o)return;const i=UE[e].isActive(t);i!==o.active&&(yield Ii(OE.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:i}):t))})))}function*VE({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Ci((e=>e.connectivity));try{if(yield Ii(OE.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ci();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Pi([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Vo(e,RE);return n===t.id&&JSON.stringify(C({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Oi(wE.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Oi(bf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ci(),{processIds:o}=yield Ci((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Pi([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Oi("email"===t?bf.connectivity.postEmailConfiguration:bf.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Vo(i,DE);return yield Pi([yield Oi("email"===t?bf.connectivity.patchEmailConfiguration:bf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Oi("email"===t?bf.connectivity.putEmailSubscriptions:bf.connectivity.putSMSSubscriptions,a,o,C({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.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 Oi("email"===t?bf.connectivity.deleteEmailSubscriptions:bf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield GE({payload:{api:t},type:""});yield Ii(OE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield xE(t,e)}else yield Ii(OE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Oi(wE[e],t),!["sms","email"].includes(e)){const i=yield GE({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield Ii(OE.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield xE(e,i),null==n||n(!0)}}catch(e){yield Ii(OE.setConnectivityState({error:kp(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*jE({payload:e}){try{yield bf.connectivity.postSlackCode(e)}catch{}yield Ii(OE.setConnectivityState({error:void 0,isSaving:!1}))}function*BE(){const{slackChannels:e}=yield Ci((e=>e.connectivity));try{yield Ii(OE.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Oi(bf.connectivity.getSlackScope);yield Ii(OE.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Ii(OE.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*WE({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Ci((e=>e.connectivity));try{yield Ii(OE.setConnectivityState({isSaving:!0})),yield Oi(bf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,kp(e))}const i=yield GE({payload:{api:"webhook"},type:""});i&&(yield Ii(OE.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*KE({payload:e}){try{yield Ii(OE.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Oi(bf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Ii(OE.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Ii(OE.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Ii(OE.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*HE({payload:e}){try{const{statusCode:t}=yield Oi(bf.connectivity.postWebhookRetry,e);yield Ii(OE.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Ii(OE.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*zE({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Ci((e=>e.connectivity));try{yield Ii(OE.setConnectivityState({webhookLogs:C({},o,{isLoading:!0})}));const i=yield Oi(bf.connectivity.getWebhookLog,e,n,t);yield Ii(OE.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},i)}))}catch(e){yield Ii(OE.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var qE={sagas:function*(){yield ka(OE.loadDataAction,FE),yield Ea(OE.loadSlackActions,$E),yield ka(OE.postDataAction,VE),yield ka(OE.postCodeAction,jE),yield ka(OE.loadScope,BE),yield ka(OE.deleteWebhookConfigAction,WE),yield ka(OE.postWebhookTestAction,KE),yield ka(OE.postWebhookRetryAction,HE),yield Ea(OE.loadWebhookLogsAction,zE)},storeName:Ct,initialState:IE,reducer:PE,actions:OE};function YE(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function JE(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>C({},n,{[e]:t(n[e],o)})}}function QE(e){return JE(e,((e,t)=>C({},e,{loading:t.payload})))}function XE(e){return JE(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const ZE={loading:!1,error:null,fetching:!0,plans:[]},{actions:eI,reducer:tI,name:nI}=dt({name:"subscriptions/plans",initialState:ZE,reducers:C({},YE())}),oI=C({loadPlans:ct(`${nI}/loadPlans`)},eI),iI={loading:!1,error:null,fetching:!0,config:null},aI=C({},YE()),{actions:rI,reducer:lI,name:sI}=dt({name:"subscriptions/config",initialState:iI,reducers:aI}),cI=C({loadPaymentConfiguration:ct(`${sI}/loadPaymentConfiguration`)},rI),uI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dI=C({},YE(),{setCancellationLoading:QE("cancellation"),setCancellationError:XE("cancellation"),setRenewalLoading:QE("renewal"),setRenewalError:XE("renewal")}),{reducer:yI,actions:fI,name:pI}=dt({name:"subscriptions/billing/subscription",initialState:uI,reducers:dI}),gI=C({load:ct(`${pI}/loadSubscription`),cancelSubscription:ct(`${pI}/cancelSubscription`),renewSubscription:ct(`${pI}/renewSubscription`)},fI),SI={loading:!1,error:null,fetching:!0},vI=C({},YE()),{reducer:hI,actions:mI,name:AI}=dt({name:"subscriptions/billing/information",initialState:SI,reducers:vI}),bI=C({loadBillingInformation:ct(`${AI}/loadBillingInformation`),cancelSubscription:gI.cancelSubscription,renewSubscription:gI.renewSubscription},mI),TI={loading:!1,error:null,fetching:!0},kI=C({},YE(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:EI,actions:II,name:PI}=dt({name:"subscriptions/billing/payment",initialState:TI,reducers:kI}),LI=C({loadPaymentMethod:ct(`${PI}/loadPaymentMethod`),submitPaymentMethod:ct(`${PI}/submitPaymentMethod`),submitPaymentMethodError:ct(`${PI}/submitPaymentMethodError`),submitPaymentMethodSuccess:ct(`${PI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ct(`${PI}/updateBillingDetails`,(e=>({payload:e})))},II),OI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_I=C({},YE(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:wI,actions:CI,name:UI}=dt({name:"subscriptions/billing/invoices",initialState:OI,reducers:_I}),RI=C({loadInvoices:ct(`${UI}/loadInvoices`),downloadInvoice:ct(`${UI}/downloadInvoice`,(e=>({payload:e})))},CI),DI={information:SI,invoices:OI,paymentMethod:TI,subscription:uI},NI={invoices:RI,information:bI,paymentMethod:LI,subscription:gI},MI=Be({invoices:wI,information:hI,paymentMethod:EI,subscription:yI}),FI={fetching:!0,loading:!1,error:null,confirmed:!1},GI=C({},YE()),{actions:$I,reducer:xI,name:VI}=dt({name:"subscriptions/checkout",initialState:FI,reducers:GI}),jI=C({loadCheckout:ct(`${VI}/loadCheckout`),resetCheckout:ct(`${VI}/resetCheckout`),submitCheckout:ct(`${VI}/submitCheckout`),confirmCheckout:ct(`${VI}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ct(`${VI}/errorCheckout`,(e=>({payload:e})))},$I),BI={loading:!1,error:null,cardSetupIntentSecret:null},WI=C({},YE()),{reducer:KI,actions:HI,name:zI}=dt({name:"subscriptions/stripe",initialState:BI,reducers:WI}),qI=C({loadCustomer:ct(`${zI}/loadCustomer`),createCardSetupIntentSecret:ct(`${zI}/createCardSetupIntentSecret`)},HI),YI={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:JI,reducer:QI,name:XI}=dt({name:"subscriptions/vendorPublicConfig",initialState:YI,reducers:C({},YE())}),ZI=C({loadVendorPublicConfiguration:ct(`${XI}/loadVendorPublicConfiguration`)},JI),eP={config:iI,plans:ZE,checkout:FI,billing:DI,stripe:BI,vendorPublicConfig:YI},tP={config:cI,billing:NI,plans:oI,checkout:jI,stripe:qI,vendorPublicConfig:ZI},nP=Be({config:lI,billing:MI,plans:tI,checkout:xI,stripe:KI,vendorPublicConfig:QI});let oP,iP,aP;function rP({policy:e}){return{policy:aP.AT_PERIOD_END}}function lP(e){switch(e){case gy.ACTIVE:return iP.ACTIVE;case gy.INCOMPLETE:return iP.INCOMPLETE;case gy.CANCELED:return iP.CANCELED;case gy.EXPIRED:return iP.EXPIRED;case gy.TRIALING:return iP.TRIALING;default:return iP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oP||(oP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iP||(iP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aP||(aP={}));const sP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:gy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cP=[{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"}],uP=[{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:""}],dP=[{id:"id",externalId:"externalId",type:Sy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fP(){yield ka(gI.load,pP),yield ka(gI.cancelSubscription,SP),yield ka(gI.renewSubscription,vP)}function*pP(){const e=yield Ci((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield TP(e)}function*gP(){yield Ii(gI.setLoading(!0));try{const[e]=yield Oi(bf.subscriptions.getManagedSubscriptions);yield Ii(gI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Ii(gI.setError(e))}}function*SP(){const{subscription:e}=yield Ci((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Ii(gI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Ii(gI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===gy.ACTIVE)try{yield Ii(gI.setCancellationLoading(!0)),yield Oi(bf.subscriptions.cancelManagedSubscription,t),yield gP(),yield Ii(gI.setCancellationLoading(!1))}catch(e){yield Ii(gI.setCancellationError(kp(e)))}}function*vP(){const{subscription:e}=yield Ci((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Ii(gI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Ii(gI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===vy.AT_PERIOD_END)try{yield Ii(gI.setRenewalLoading(!0)),yield Oi(bf.subscriptions.renewManagedSubscription,t),yield gP(),yield Ii(gI.setRenewalLoading(!1))}catch(e){yield Ii(gI.setCancellationError(kp(e)))}}function*hP(){yield Ii(gI.setLoading(!0)),yield Ui(500),yield Ii(gI.setState({subscription:sP,fetching:!1,loading:!1,error:null}))}function*mP(){yield ka(gI.load,hP)}function*AP(){yield ka(bI.loadBillingInformation,bP)}function*bP(){yield function*(e){const t=yield Ci((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ci((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield TP(n,!1):yield Ii(bI.setError(t?"Not authorized":"Internal feature failure"))}()}function*TP(e,t){yield Ii(bI.setLoading(!0));try{var n,o;const i=yield Oi(bf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Oi(bf.subscriptions.getSubscriptionPlan,a):([,l]=yield Pi([Oi(gP),Oi(bf.subscriptions.getSubscriptionPlan,a)]),s=yield Ci((e=>e.subscriptions.billing.subscription.subscription||null))),yield Ii(bI.setState(C({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iP.ACTIVE:lP(s.status),cancellation:s.cancellation&&rP(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==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield Ii(bI.setError(kp(e)))}}function*kP(){yield function*(){var e,t;yield Ii(bI.setLoading(!0)),yield Ui(500),yield Ii(bI.setState({loading:!1,fetching:!1,summary:{subscriptionId:sP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:hy.Stripe,externallyManaged:!1,currentPlanId:cP[0].id,defaultPlanId:cP[0].id},plan:C({},cP[0],{price:null==(e=cP[0].price)?void 0:e.amount,currency:null==(t=cP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*EP(){yield ka(bI.loadBillingInformation,kP)}function*IP(){yield ka(LI.loadPaymentMethod,PP),yield ka(LI.submitPaymentMethod,OP),yield ka(LI.submitPaymentMethodError,_P),yield ka(LI.submitPaymentMethodSuccess,wP),yield ka(LI.updatePaymentMethodBillingDetails,LP)}function*PP(){yield Ii(LI.setLoading(!0));try{const e=(yield Oi(bf.subscriptions.getPaymentMethods))[0];yield Ii(LI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Ii(LI.setError(kp(e)))}}function*LP({payload:e}){yield Ii(LI.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Oi(bf.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},o)),yield Oi(PP),null==i||i(!0)}catch(e){yield Ii(LI.setError(kp(e))),null==i||i(!1)}yield Ii(LI.setLoading(!1))}function*OP(){yield Ii(LI.setLoading(!0))}function*_P({payload:e}){yield Ii(LI.setError(e))}function*wP(){yield Ii(LI.loadPaymentMethod())}function*CP(){yield Ii(LI.setLoading(!0)),yield Ui(500);const e=dP[0];yield Ii(LI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*UP(){yield ka(LI.loadPaymentMethod,CP)}function*RP(){yield ka(RI.loadInvoices,DP),yield ka(RI.downloadInvoice,NP)}function*DP(){yield Ii(RI.setLoading(!0));try{const e=(yield Oi(bf.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 Ii(RI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Ii(RI.setError(kp(e)))}}function*NP({payload:e}){yield Ii(RI.setInvoiceDownloadState({loading:!0,error:null}));try{yield Oi(bf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Ii(RI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Ii(RI.setInvoiceDownloadState({loading:!1,error:kp(e,null)}))}}function*MP(){yield Ii(RI.setLoading(!0)),yield Ui(500),yield Ii(RI.setState({loading:!1,fetching:!1,invoices:uP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Ii(RI.setLoading(!1))}function*FP(){yield ka(RI.loadInvoices,MP)}function*GP(){yield Pi([Oi(AP),Oi(IP),Oi(RP),Oi(fP)])}function*$P(){yield Pi([Oi(EP),Oi(UP),Oi(FP),Oi(mP)])}function*xP(){yield ka(jI.loadCheckout,VP),yield ka(jI.resetCheckout,jP),yield ka(jI.submitCheckout,BP),yield ka(jI.confirmCheckout,WP),yield ka(jI.errorCheckout,HP)}function*VP(){yield Ii(jI.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*jP(){yield Ii(jI.setState({loading:!1,error:null,confirmed:!1}))}function*BP(){yield Ii(jI.setState({loading:!0,error:null}))}function*WP({payload:{paymentMethodId:e,planId:t}}){const n=yield Ci((e=>e.subscriptions.billing.subscription.subscription)),o=yield Ci((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===gy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield Ii(jI.setState({loading:!0,error:null})),i&&a)return yield KP(),void(yield Ii(gI.setState({subscription:C({},n,{status:gy.ACTIVE})})));try{yield Oi(bf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Pi([bP(),PP(),DP()]),yield KP()}catch(e){yield Ii(jI.setState({loading:!1,error:kp(e)}))}}else yield Ii(jI.setState({loading:!1,error:"Subscription not found"}))}function*KP(){yield Ii(jI.setState({loading:!1,error:null,confirmed:!0}))}function*HP({payload:e}){yield Ii(jI.setState({loading:!1,error:e}))}function*zP(){yield ka(jI.resetCheckout,jP)}function*qP(){yield ka(oI.loadPlans,YP)}function*YP(){yield Ii(oI.setLoading(!0));try{const e=(yield Oi(bf.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 Ii(oI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Ii(oI.setError(kp(e)))}}function*JP(){yield Ii(oI.setLoading(!0)),yield Ui(500),yield Ii(oI.setState({fetching:!1,loading:!1,plans:cP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QP(){yield ka(oI.loadPlans,JP)}function*XP(){yield ka(cI.loadPaymentConfiguration,ZP)}function*ZP(){yield Ii(cI.setLoading(!0));try{(yield Oi(bf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===hy.Stripe))?yield function*(){yield Ii(cI.setLoading(!0));try{const e=yield Oi(bf.subscriptions.getStripePaymentProviderConfiguration);yield Ii(cI.setState({loading:!1,fetching:!1,config:{paymentProvider:oP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Ii(cI.setError(kp(e)))}}():yield Ii(cI.setError("Payment provider not configured"))}catch(e){yield Ii(cI.setError(kp(e)))}}function*eL(){yield Ii(cI.setLoading(!0)),yield Ui(500),yield Ii(cI.setState({loading:!1,fetching:!1,config:{paymentProvider:oP.STRIPE,apiKey:""}}))}function*tL(){yield ka(cI.loadPaymentConfiguration,eL)}function*nL(){yield ka(qI.createCardSetupIntentSecret,oL)}function*oL({payload:e}){yield Ii(qI.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Oi(bf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Ii(qI.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Ii(qI.setError(kp(e)))}}function*iL(){yield ka(ZI.loadVendorPublicConfiguration,aL)}function*aL(){yield Ii(ZI.setLoading(!0));try{const e=yield Oi(bf.subscriptions.getVendorPublicConfigurations);yield Ii(ZI.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Ii(ZI.setError(kp(e)))}}function*rL(){yield Ii(ZI.setLoading(!0)),yield Ui(500),yield Ii(ZI.setState({fetching:!1,loading:!1,vendorPublicConfig:yP}))}function*lL(){yield ka(ZI.loadVendorPublicConfiguration,rL)}var sL={sagas:function*(){yield Pi([Oi(GP),Oi(xP),Oi(qP),Oi(XP),Oi(nL),Oi(iL)])},mockSagas:function*(){yield Pi([Oi($P),Oi(zP),Oi(QP),Oi(tL),Oi(lL)])},reducer:nP,actions:tP,initialState:eP,storeName:"subscriptions"},cL={sagas:function*(){yield ka($g.loadVendorPublicInfo,xg)},storeName:Rt,initialState:Mg,reducer:Fg,actions:$g};const{reducer:uL}=dt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Pa.setContext(t),C({},e,{context:t}))}}}),dL=(e,t,n=!1,o,i,a=!1,r="path")=>{const l="undefined"==typeof window;let s=t;if(l&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var c,u,d,y,f,p,g,S,v,h;n||a||Pa.setContext(e.context);const t=pa(),l=[...lt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:l,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[Dk.storeName]:C({},Dk.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:C({},Dk.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[rE.storeName]:C({},rE.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:C({},rE.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:C({},rE.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[sE]:C({},lE,null!=(h=null==i?void 0:i.audits)?h:{}),[qE.storeName]:qE.initialState,[sL.storeName]:sL.initialState,[cL.storeName]:cL.initialState},reducer:Be({root:uL,[Dk.storeName]:Dk.reducer,[rE.storeName]:rE.reducer,[sE]:uE,[qE.storeName]:qE.reducer,[sL.storeName]:sL.reducer,[cL.storeName]:cL.reducer})});const m=function*(){yield Pi([Oi(Dk.sagas),Oi(rE.sagas),Oi(bE),Oi(qE.sagas),Oi(sL.sagas),Oi(cL.sagas)])},A=function*(){yield Pi([Oi(Dk.mockSagas),Oi(rE.mockSagas),Oi(sL.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Oo.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel,s.store.subscribeStateChanged=e=>{let t=s.store.getState();return s.store.subscribe((()=>{const n=s.store.getState();t!=n&&(t=n,e(n))}))}}return s.store},yL=(e,t)=>((()=>{if(!Pa.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")})(),e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t});var fL=n(714),pL=n.n(fL);function gL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function SL(e){if(e.type)return e;if("#"===e.charAt(0))return SL(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 o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=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(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function vL(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function hL(e){if(0===e.indexOf("#"))return e;const{values:t}=SL(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 mL(e,t){return e=SL(e),t=gL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,vL(e)}function AL(e,t){if(e=SL(e),t=gL(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 vL(e)}function bL(e,t){if(e=SL(e),t=gL(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 vL(e)}const TL=e=>{if(e)return{main:e,light:hL(bL(e,.4)),dark:hL(AL(e,.15)),hover:hL(AL(e,.15)),active:hL(AL(e,.2))}},kL=e=>{if(e)return{main:e,light:bL(e,.7),dark:AL(e,.2)}},EL=(e,t)=>{var n,o,i,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)?C({},t,{palette:{primary:C({},TL(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:C({},TL(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:C({},TL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},kL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},kL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},kL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},kL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},IL={},PL={},LL={},OL={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"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]}};class _L{constructor(){this._theme=IL,this._themeV2=PL,this._navigation=OL,this._localizations=LL}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _L;return n.set(e),_L._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,o,i,a,r,l;this._navigation=pL().all([null!=(t=OL)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=pL().all([null!=(o=IL)?o:{},EL(null==e?void 0:e.theme,IL)]),this._themeV2=pL().all([null!=(i=PL)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=pL().all([null!=(r=LL)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=OL,this._theme=IL,this._themeV2=PL,this._localizations=LL}}}_L._instances={};var wL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},CL=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},UL=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))},RL=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let DL,NL,ML,FL,GL,$L,xL,VL,jL,BL,WL;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(DL||(DL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(NL||(NL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(ML||(ML={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(FL||(FL={})),function(e){e.Invoices="invoices"}(GL||(GL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}($L||($L={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(xL||(xL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(VL||(VL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(jL||(jL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(BL||(BL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(WL||(WL={}));const KL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},HL={hidden:"hidden",edit:"edit"};var zL="6.127.0",qL={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},YL=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];I(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(zL),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.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=R(N().mark((function e(){var t,n,o,a,r;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=gr,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.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:_L.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(N().mark((function e(){return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(N().mark((function e(){var t;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}bl.set(qL,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Tl();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),bl.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=i.store.getState().auth.user)?void 0:e.entitlements};var l=wL(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dL({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),Pa.setAppName(l)}var t,n,o,i;return _(e,[{key:"setEntitlementsOptions",value:function(e){Pa.setEntitlementsOptions(C({},e))}},{key:"initContainers",value:(i=R(N().mark((function e(t){return N().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){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;_L.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,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:E})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=R(N().mark((function e(){return N().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){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(N().mark((function e(){var t;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Pa.setRequestSource(ro.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),RL(t),Pa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(N().mark((function e(t){var n;return N().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,C({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:"getFeatureEntitlements",value:function(e){return((e,t)=>{var n;return yL(null==e||null==(n=e.features)?void 0:n[t],hl.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return yL(null==e||null==(n=e.permissions)?void 0:n[t],hl.MISSING_PERMISSION)})(this.getEntitlementsFromStore(),e)}},{key:"getEntitlements",value:function(e){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey):this.getFeatureEntitlements(e.featureKey)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),JL=function(){function e(){I(this,e)}return _(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=w.getInstance(o);e&&t?(Pa.setAccessToken(t),Pa.setUser(C({},n,{accessToken:t})),i.store.dispatch(Oo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Oo.loadTenants())):(Pa.setAccessToken(null),Pa.setUser(null),i.store.dispatch(Oo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),QL=function(){function e(){I(this,e)}return _(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),XL=function(){function e(){I(this,e)}return _(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),ZL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},eO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new YL(this.options,t,!0),_L.set({},t)}var t;return _(e,[{key:"render",value:(t=R(N().mark((function e(t){var n,o,i,a,r=this;return N().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,UL(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}(),tO="modern",nO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[tO]},oO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new YL(this.options,t,!0,a),_L.set({},t)}var t;return _(e,[{key:"render",value:(t=R(N().mark((function e(t){var n,o,i,a,r=this;return N().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,UL(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 iO(e,t){return iO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},iO(e,t)}function aO(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&&iO(e,t)}function rO(e,t){if(t&&("object"===P(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 lO(e){return lO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lO(e)}function sO(){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 cO(e,t,n){return cO=sO()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&iO(i,n.prototype),i},cO.apply(null,arguments)}function uO(e){var t="function"==typeof Map?new Map:void 0;return uO=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 cO(e,arguments,lO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),iO(n,e)},uO(e)}function dO(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,o=lO(e);if(t){var i=lO(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return rO(this,n)}}var yO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new YL(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){aO(n,e);var t=dO(n);function n(){var e;I(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return _(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=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=CL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=CL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=CL(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=CL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=CL(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=CL(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(uO(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
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 o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(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||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(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])?i[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):i[a]=o(t[a],n))})),i}(e,n,s):o(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},378:function(e){"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,i,a;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(i=o;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=o;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=o;0!=i--;){var r=a[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new L(o||[]);return r(a,"_invoke",{value:E(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(_([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(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 i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}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 O(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 _(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=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 o.next=o}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(k.prototype),d(k.prototype,c,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,o,i,a){void 0===a&&(a=Promise);var r=new k(y(e,n,o,i),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=_,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(O),!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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):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),p},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),O(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:_(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,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 o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](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 o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},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 o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return QO},AdminPortalRenderer:function(){return eL},AppHolder:function(){return w},CheckoutDialog:function(){return XO},FronteggApp:function(){return YO},HostedLogin:function(){return JO},LoginBoxRenderer:function(){return oL},createElement:function(){return CO},defaultTheme:function(){return tL},formatName:function(){return wO},getThemeAdminByName:function(){return ZO},getThemeByName:function(){return nL},initialize:function(){return yL},mockFlagsList:function(){return qO},restoreSearchParams:function(){return RO},waitThemeSetter:function(){return UO}});var e={};n.r(e),n.d(e,{Delete:function(){return kr},Get:function(){return mr},Patch:function(){return br},Post:function(){return Ar},PostDownload:function(){return Er},Put:function(){return Tr},extractHeadersFromOptions:function(){return Ir},getBaseUrl:function(){return Sr},getMetadataHeaders:function(){return vr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Dr},getParentTenants:function(){return wr},getParentTenantsById:function(){return Cr},getSubTenants:function(){return Lr},getSubTenantsAsTree:function(){return _r},getTenants:function(){return Or},getTenantsUsersCount:function(){return Ur},searchSubTenants:function(){return Rr},switchTenant:function(){return Pr}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return ul},getCurrentUserTenantsV3:function(){return gl},getUsersGroups:function(){return pl},getUsersRoles:function(){return fl},getUsersV2:function(){return dl},getUsersV3:function(){return yl},sendResetBreachedPasswordEmails:function(){return Sl},updateUserProfileV2:function(){return vl}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return hl}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Tl},loadFeatureFlags:function(){return kl}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return bo},MachineToMachineAuthStrategy:function(){return To},OAuthLogout:function(){return Jl},SocialLoginProviders:function(){return Ao},acceptInvitation:function(){return Kl},activateAccount:function(){return xl},activateAccountV2:function(){return Vl},bulkCreateIPRestriction:function(){return tl},changePhoneNumber:function(){return Qc},changePhoneNumberWithVerification:function(){return Yc},checkIfAllowToRememberMfaDevice:function(){return bc},createDomainRestriction:function(){return Yr},createIPRestriction:function(){return el},createOrUpdateSessionConfigrations:function(){return ac},createSSOConfiguration:function(){return Oc},createSSOConfigurationByMetadata:function(){return wc},createSSODomain:function(){return Uc},createSSOGroup:function(){return Fc},createSamlGroup:function(){return Bs},createTenantAccessToken:function(){return fc},createUserAccessToken:function(){return yc},deleteAllSessionsForUser:function(){return lc},deleteDomainRestriction:function(){return Qr},deleteIPRestriction:function(){return ol},deleteSSOConfiguration:function(){return _c},deleteSSODomain:function(){return Rc},deleteSSOGroup:function(){return $c},deleteSamlGroup:function(){return Ks},deleteSessionForUser:function(){return rc},deleteTenantAccessToken:function(){return uc},deleteTenantApiToken:function(){return hc},deleteUserAccessToken:function(){return dc},deleteUserApiToken:function(){return mc},deleteWebAuthnDevice:function(){return ou},disableMFAAuthenticatorApp:function(){return us},disableMFASMS:function(){return ys},disableMFAWebAuthn:function(){return ps},disableMfa:function(){return cs},enrollMFAAuthenticatorApp:function(){return os},enrollMFAAuthenticatorAppForLogin:function(){return vs},enrollMFAAuthenticatorAppForLoginV2:function(){return hs},enrollMFASMS:function(){return as},enrollMFASMSForLogin:function(){return Es},enrollMFASMSForLoginV2:function(){return Is},enrollMFAWebAuthn:function(){return ls},enrollMFAWebAuthnForLogin:function(){return ws},enrollMFAWebAuthnForLoginV2:function(){return Cs},enrollMfa:function(){return ts},exchangeOAuthTokens:function(){return Kc},exchangeOAuthTokensV2:function(){return Bc},forgotPassword:function(){return Ql},generateLoginResponse:function(){return Ol},generateLoginResponseFromOAuthResponse:function(){return wl},generateLoginResponseFromOAuthResponseV2:function(){return Cl},generateLoginResponseV2:function(){return Ll},generateLoginResponseV3:function(){return _l},getActivateAccountStrategy:function(){return jl},getCaptchaPolicy:function(){return jr},getCurrentUserSession:function(){return nc},getCurrentUserSessions:function(){return tc},getCustomSocialLoginProvidersV1:function(){return Qs},getDomainRestrictions:function(){return zr},getDomainRestrictionsConfig:function(){return qr},getGlobalSecurityPolicy:function(){return Nr},getIPRestrictions:function(){return Xr},getIPRestrictionsConfig:function(){return Zr},getLockoutPolicy:function(){return $r},getMFADevices:function(){return gs},getMFAStrategiesConfig:function(){return lu},getMeAndEntitlements:function(){return su},getMfaPolicy:function(){return Mr},getOidcConfiguration:function(){return Hs},getPasswordConfigPolicy:function(){return Hr},getPasswordHistoryPolicy:function(){return Br},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return ru},getSSOConfigurations:function(){return Pc},getSSODefaultRoles:function(){return Nc},getSSOGroups:function(){return xc},getSSOPublicConfiguration:function(){return zs},getSamlConfiguration:function(){return Ns},getSamlRoles:function(){return xs},getSamlRolesGroups:function(){return Vs},getSamlVendorConfiguration:function(){return Fs},getSessionConfigurations:function(){return ic},getSocialLoginProviders:function(){return qs},getSocialLoginProvidersV2:function(){return Ys},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Js},getTenantAccessTokensData:function(){return cc},getTenantApiTokensData:function(){return gc},getUserAccessTokensData:function(){return sc},getUserApiTokensData:function(){return pc},getUserById:function(){return Ac},getVendorConfig:function(){return Zs},getVendorLockoutPolicy:function(){return xr},getVendorMfaPolicy:function(){return Fr},getVendorPasswordHistoryPolicy:function(){return Wr},getVendorPublicAuthStrategiesConfig:function(){return au},getWebAuthnDevices:function(){return nu},loadPasswordConfig:function(){return Zl},login:function(){return Ml},loginViaSocialLogin:function(){return Xs},loginWithMfa:function(){return Gl},loginWithMfaV2:function(){return $l},loginv2:function(){return Fl},logout:function(){return Yl},oidcPostLogin:function(){return Nl},oidcPostLoginV2:function(){return jc},passwordlessPostLogin:function(){return Ec},passwordlessPostLoginV2:function(){return kc},passwordlessPreLogin:function(){return Tc},postLogin:function(){return Dl},preDisableMFASMS:function(){return ds},preDisableMFAWebAuthn:function(){return fs},preEnrollMFAAuthenticatorApp:function(){return ns},preEnrollMFAAuthenticatorAppForLogin:function(){return Ss},preEnrollMFASMS:function(){return is},preEnrollMFASMSForLogin:function(){return ks},preEnrollMFAWebAuthn:function(){return rs},preEnrollMFAWebAuthnForLogin:function(){return _s},preLogin:function(){return Ul},preLoginV2:function(){return Vc},preLoginWithIdpType:function(){return Rl},preVerifyMFAEmailCode:function(){return As},preVerifyMFASMSForLogin:function(){return Ps},preVerifyMFAWebAuthnForLogin:function(){return Us},recoverMfaToken:function(){return es},refreshToken:function(){return Hl},refreshTokenV2:function(){return zl},refreshTokenV3:function(){return ql},resendActivationEmail:function(){return Bl},resendInvitationEmail:function(){return Wl},resetPassword:function(){return Xl},resetPhoneNumber:function(){return zc},revokeSessionsForUser:function(){return oc},saveLockoutPolicy:function(){return Vr},saveMfaPolicy:function(){return Gr},savePasswordHistoryPolicy:function(){return Kr},setSSODefaultRoles:function(){return Mc},signUpUser:function(){return ec},silentOAuthRefreshToken:function(){return Hc},silentOAuthRefreshTokenV2:function(){return Wc},testCurrentIp:function(){return il},testCurrentIpInAllowList:function(){return al},updateDomainRestrictionConfig:function(){return Jr},updateIPRestrictionConfig:function(){return nl},updateSSOConfiguration:function(){return Lc},updateSSOConfigurationByMetadata:function(){return Cc},updateSSOGroup:function(){return Gc},updateSamlConfiguration:function(){return Ms},updateSamlGroup:function(){return Ws},updateSamlRoles:function(){return js},updateSamlVendorMetadata:function(){return Gs},updateTenantApiTokensData:function(){return vc},updateUserApiTokensData:function(){return Sc},validateSSODomain:function(){return Dc},validateSamlDomain:function(){return $s},verifyChangePhoneNumber:function(){return Jc},verifyInviteToken:function(){return Ic},verifyMFAAuthenticatorAppForLogin:function(){return ms},verifyMFAEmailCode:function(){return bs},verifyMFAEmailCodeV2:function(){return Ts},verifyMFASMSForLogin:function(){return Os},verifyMFASMSForLoginV2:function(){return Ls},verifyMFAWebAuthnForLogin:function(){return Rs},verifyMFAWebAuthnForLoginV2:function(){return Ds},verifyMfa:function(){return ss},verifyNewDeviceSession:function(){return iu},verifyResetPhoneNumber:function(){return qc},webAuthnCreateNewDeviceSession:function(){return tu},webAuthnPostLogin:function(){return Zc},webAuthnPostLoginV2:function(){return eu},webAuthnPreLogin:function(){return Xc}});var s={};n.r(s),n.d(s,{addUser:function(){return pu},changePassword:function(){return yu},createInviteUserLink:function(){return vu},deleteInviteUserLink:function(){return mu},deleteUser:function(){return gu},getInviteLinkConfiguration:function(){return bu},getInviteUserLink:function(){return Au},getProfile:function(){return cu},loadAvailablePermissions:function(){return ku},loadAvailableRoles:function(){return Tu},loadStats:function(){return Eu},loadUsers:function(){return fu},resendActivationLink:function(){return Iu},resendInvitationLink:function(){return Pu},resendInvitationLinkToAllTenants:function(){return Ou},updateInviteUserLink:function(){return hu},updateProfile:function(){return uu},updateProfileImage:function(){return du},updateUser:function(){return Su}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return _u},getAuditsMetadata:function(){return Du},getCurrentUserIpMetadata:function(){return Cu},getIpAdressMetadata:function(){return Nu},getNotificationsMetadata:function(){return Uu},getSamlMetadata:function(){return Ru},updateAdminBoxMetadata:function(){return wu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return Bu},getReport:function(){return xu},getReports:function(){return $u},renderReport:function(){return Vu},scheduleReport:function(){return ju},sendReport:function(){return Wu}});var d={};n.r(d),n.d(d,{getNotifications:function(){return Ku},markAllAsRead:function(){return qu},updateNotificationIsPinned:function(){return zu},updateNotificationStatus:function(){return Hu}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Xu},getAudits:function(){return Ju},getAuditsStats:function(){return Qu}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return yd},deleteEmailSubscriptions:function(){return ud},deleteSMSConfiguration:function(){return hd},deleteSMSSubscriptions:function(){return Sd},deleteSlackConfiguration:function(){return ad},deleteWebhooksConfiguration:function(){return bd},getCategories:function(){return Id},getChannelMaps:function(){return Pd},getEmailConfiguration:function(){return ld},getSMSConfiguration:function(){return fd},getSlackChannels:function(){return od},getSlackConfiguration:function(){return td},getSlackScope:function(){return nd},getWebhookLog:function(){return Td},getWebhooksConfigurations:function(){return md},patchEmailConfiguration:function(){return cd},patchSMSConfiguration:function(){return gd},postEmailConfiguration:function(){return sd},postSMSConfiguration:function(){return pd},postSlackCode:function(){return rd},postSlackConfiguration:function(){return id},postWebhookRetry:function(){return Ed},postWebhookTest:function(){return kd},postWebhooksConfiguration:function(){return Ad},putEmailSubscriptions:function(){return dd},putSMSSubscriptions:function(){return vd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return _d},getSettings:function(){return Ld},updateSettings:function(){return Od}});var g={};n.r(g),n.d(g,{addRole:function(){return Dd},attachPermissionToRoles:function(){return $d},attachPermissionsToRole:function(){return Fd},deleteRole:function(){return Nd},getPermissionCategories:function(){return xd},getPermissions:function(){return Gd},getRoles:function(){return Rd},updateRole:function(){return Md}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return hy},ISubscriptionStatus:function(){return Sy},PaymentMethodType:function(){return vy},ProviderType:function(){return my},TenantCreatedAction:function(){return by},TrialEndAction:function(){return Ay},cancelManagedSubscription:function(){return qd},cancelSubscription:function(){return Bd},createStripeCustomer:function(){return sy},createStripePaymentMethodSetupIntentSecret:function(){return uy},createSubscription:function(){return ry},createTenantConfiguration:function(){return fy},getManagedSubscription:function(){return Hd},getManagedSubscriptions:function(){return zd},getPaymentMethod:function(){return iy},getPaymentMethods:function(){return oy},getPaymentProviders:function(){return py},getStripeCustomer:function(){return ly},getStripePaymentProviderConfiguration:function(){return cy},getSubscription:function(){return jd},getSubscriptionInvoice:function(){return ey},getSubscriptionInvoicePdf:function(){return ty},getSubscriptionInvoices:function(){return Zd},getSubscriptionPlan:function(){return Xd},getSubscriptionPlans:function(){return Qd},getSubscriptionSummaries:function(){return dy},getSubscriptions:function(){return Vd},getTenantConfiguration:function(){return yy},getVendorPublicConfigurations:function(){return gy},renewManagedSubscription:function(){return Yd},renewSubscription:function(){return Wd},updateManagedSubscription:function(){return Jd},updatePaymentMethodBillingDetails:function(){return ay},updateSubscription:function(){return Kd}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Ty}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Py},addUserToTenantAndSubTenants:function(){return Ey},addUsersToSubTenant:function(){return Ry},createSubTenant:function(){return _y},deleteSubTenant:function(){return wy},loadAllUsers:function(){return ky},removeUserFromTenantAndSubTenants:function(){return Iy},removeUserRolesFromSubTenants:function(){return Oy},setUserRolesForSubTenants:function(){return Ly},updateSubAccountAccess:function(){return Uy},updateSubTenant:function(){return Cy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Gy},createConfiguration:function(){return My},deleteConfiguration:function(){return Fy},getConfigs:function(){return Dy},updateConfiguration:function(){return Ny}});var A={};n.r(A),n.d(A,{impersonate:function(){return $y}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return zy},addUsersToGroup:function(){return Yy},createGroup:function(){return Wy},deleteGroup:function(){return Hy},deleteRolesFromGroup:function(){return qy},deleteUsersFromGroup:function(){return Jy},getGroupById:function(){return Vy},getGroupConfiguration:function(){return Qy},getGroups:function(){return jy},getGroupsByIds:function(){return By},updateGroup:function(){return Ky},updateGroupConfiguration:function(){return Xy}});var T={};n.r(T),n.d(T,{getInsights:function(){return ef},getRecommendations:function(){return Zy}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Al},AuthStrategyEnum:function(){return bo},ContextHolder:function(){return wa},FeatureFlags:function(){return Tl},FronteggApiError:function(){return Ua},FronteggContext:function(){return Ca},FronteggFrameworks:function(){return lo},GroupManagedByEnum:function(){return Sf},GroupRelations:function(){return gf},ISubscriptionCancellationPolicy:function(){return hy},ISubscriptionStatus:function(){return Sy},InsightCode:function(){return hf},MFAStrategyEnum:function(){return of},MachineToMachineAuthStrategy:function(){return To},NotEntitledJustification:function(){return ml},PaginationOrderEnum:function(){return so},PaymentMethodType:function(){return vy},ProviderType:function(){return my},RecommendationActionKey:function(){return mf},RecommendationCode:function(){return vf},RecommendationSeverity:function(){return Af},RequestSource:function(){return ro},RestrictionType:function(){return Vn},ScimConnectionSource:function(){return pf},SecondaryAuthStrategy:function(){return tf},SecurityCategory:function(){return bf},SocialLoginProviders:function(){return Ao},SortByEnum:function(){return co},TenantSortByEnum:function(){return rf},TenantType:function(){return lf},UserManagedByEnum:function(){return af},WebAuthnDeviceType:function(){return nf},api:function(){return Tf},countConfigurationUsers:function(){return Gy},createConfiguration:function(){return My},default:function(){return kf},deleteConfiguration:function(){return Fy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return sf},fronteggHeaders:function(){return ao},fronteggRefreshTokenUrl:function(){return cf},fronteggSilentRefreshTokenUrl:function(){return uf},fronteggTenantsUrl:function(){return yf},fronteggTenantsV3Url:function(){return ff},fronteggUsersUrl:function(){return df},getConfigs:function(){return Dy},loadFeatureFlags:function(){return kl},providersArray:function(){return uo},updateConfiguration:function(){return Ny}});var E={};function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="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},P(e)}function O(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==P(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,O(o.key),o)}}function _(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(E),n.d(E,{AccountDetailsPageTabs:function(){return WO},AccountPageFields:function(){return FO},DomainRestrictionsTabFields:function(){return BO},GeneralSettingsTabFields:function(){return VO},InviteUserModalFields:function(){return MO},IpRestrictionsTabFields:function(){return jO},Metadata:function(){return _O},PrivacyPageFields:function(){return NO},ProfilePageFields:function(){return DO},SecurityPageTabs:function(){return $O},SessionManagementTabFields:function(){return xO},SubscriptionsPageFields:function(){return GO},alpha:function(){return mO},fieldAppearance:function(){return KO},tabAppearance:function(){return HO}});var w=function(){function e(){I(this,e)}return _(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 C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},C.apply(this,arguments)}function U(e,t,n,o,i,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(o,i)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){U(a,o,i,r,l,"next",e)}function l(e){U(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var D=n(841),N=n.n(D);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];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 F(e){return!!e&&!!e[ke]}function G(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)===Ee}(e)||Array.isArray(e)||!!e[Te]||!!e.constructor[Te]||W(e)||K(e))}function $(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Ie)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:K(e)?3:0}function V(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return he&&e instanceof Map}function K(e){return me&&e instanceof Set}function H(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Pe(e);delete t[ke];for(var n=Ie(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||F(e)||!G(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=Y),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function Y(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Oe[e];return t||M(18,e),t}function X(){return Se}function Z(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function ee(e){te(e),e.p.forEach(oe),e.p=null}function te(e){e===Se&&(Se=e.l)}function ne(e){return Se={p:[],l:Se,h:e,m:!0,_:0}}function oe(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(ee(t),M(4)),G(e)&&(e=ae(t,e),t.l||le(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ae(t,n,[]),ee(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function ae(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return $(t,(function(i,a){return re(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return le(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;$(3===o.i?new Set(i):i,(function(t,a){return re(e,o,i,t,a,n)})),le(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function re(e,t,n,o,i,a){if(F(i)){var r=ae(e,i,a&&t&&3!==t.i&&!V(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!F(r))return;e.m=!1}if(G(i)&&!J(i)){if(!e.h.F&&e._<1)return;ae(e,i),t&&t.A.l||le(e,i)}}function le(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?H(n):e)[t]}function ce(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function ue(e){e.P||(e.P=!0,e.l&&ue(e.l))}function de(e){e.o||(e.o=z(e.t))}function ye(e,t,n){var o=W(t)?Q("MapSet").N(t,n):K(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:X(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Le;n&&(i=[o],a=_e);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:X()).p.push(o),o}function fe(e){return F(e)||M(22,e),function e(t){if(!G(t))return t;var n,o=t[ke],i=x(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=pe(t,i),o.I=!1}else n=pe(t,i);return $(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function pe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,Se,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),he="undefined"!=typeof Map,me="undefined"!=typeof Set,Ae="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=ve?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Te=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ke=ve?Symbol.for("immer-state"):"__$immer_state",Ee=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Pe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ie(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Oe={},Le={get:function(e,t){if(t===ke)return e;var n=H(e);if(!V(n,t))return function(e,t,n){var o,i=ce(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!G(o)?o:o===se(e.t,t)?(de(e),e.o[t]=ye(e.A.h,o,e)):o},has:function(e,t){return t in H(e)},ownKeys:function(e){return Reflect.ownKeys(H(e))},set:function(e,t,n){var o=ce(H(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=se(H(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(B(n,i)&&(void 0!==n||V(e.t,t)))return!0;de(e),ue(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!==se(e.t,t)||t in e.t?(e.D[t]=!1,de(e),ue(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=H(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},_e={};$(Le,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=Ae,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==o&&"function"!=typeof o&&M(7),G(e)){var l=ne(t),s=ye(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?ee(l):te(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Z(l,o),ie(e,l)}),(function(e){throw ee(l),e})):(Z(l,o),ie(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"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){G(e)||M(8),F(e)&&(e=fe(e));var t=ne(this),n=ye(this,e,void 0);return n[ke].C=!0,te(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return Z(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ae&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return F(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ce=new we,Ue=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),Ue);function De(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){De(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(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 Ge="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function Ve(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 je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Fe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Fe(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Fe(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Fe(3));return a}function d(e){if("function"!=typeof e)throw new Error(Fe(4));if(s)throw new Error(Fe(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Fe(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ve(e))throw new Error(Fe(7));if(void 0===e.type)throw new Error(Fe(8));if(s)throw new Error(Fe(9));try{s=!0,a=i(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(Fe(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Fe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ge]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ge]=p,o}function Be(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}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:xe.INIT}))throw new Error(Fe(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Fe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},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(Fe(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){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 Ke(){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),o=function(){throw new Error(Fe(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function He(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var ze=He();ze.withExtraArgument=He;var qe,Ye=ze,Je=(qe=function(e,t){return qe=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])},qe(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}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Xe=Object.defineProperty,Ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,nt=function(e,t,n){return t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ot=function(e,t){for(var n in t||(t={}))et.call(t,n)&&nt(e,n,t[n]);if(Ze)for(var o=0,i=Ze(t);o<i.length;o++)n=i[o],tt.call(t,n)&&nt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var at=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Je(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,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function rt(e){return G(e)?Re(e,(function(){})):e}function lt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new at);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Ye):o.push(Ye.withExtraArgument(n.extraArgument))),o}function st(e){var t,n=function(e){return lt(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.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=Be(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Ke.apply(void 0,p),S=We;c&&(S=it(ot({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ct(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ot(ot({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.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 ut(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function dt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:rt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ut(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=ot(ot({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ut(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return rt(e())};else{var c=rt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([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 o;if(F(e))return void 0===(o=n(e,t))?e:o;if(G(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ct(c,o):ct(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 yt="listenerMiddleware";ct(yt+"/add"),ct(yt+"/removeAll"),ct(yt+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Le.get(t,e)},set:function(t){var n=this[ke];Le.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ue(i);break;case 4:n(i)&&ue(i)}}}function n(e){for(var t=e.t,n=e.k,o=Ie(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!V(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!B(l,r))return!0}}var c=!!t[ke];return o.length!==Ie(t).length+(c?0:1)}function o(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 o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Oe[e]||(Oe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Pe(n);delete a[ke];for(var r=Ie(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)}(o,t),a={i:o?5:4,A:n?n.A:X(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?F(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)$(a,(function(t){t!==ke&&(void 0!==i[t]||V(i,t)?r[t]||e(a[t]):(r[t]=!0,ue(n)))})),$(i,(function(e){void 0!==a[e]||V(a,e)||(r[e]=!1,ue(n))}));else if(5===l){if(o(n)&&(ue(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.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):o(e)}})}();const ft=(e,t)=>n=>C({},n,{[e]:t[e]}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return C({},t,{[e]:C({},t[e],{loaders:C({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),ht=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return C({},o,{[e]:C({},o[e],{[t]:C({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),mt=(e,t,n)=>o=>{var i;return C({},o,{[e]:C({},o[e],{[t]:C({},null==o||null==(i=o[e])?void 0:i[t],n)})})},At=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Tt=new Uint8Array(256);for(let e=0;e<bt.length;e++)Tt[bt.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=Tt[e.charCodeAt(o)],a=Tt[e.charCodeAt(o+1)],r=Tt[e.charCodeAt(o+2)],l=Tt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},Et=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Et(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=bt[t[o]>>2],i+=bt[(3&t[o])<<4|t[o+1]>>4],i+=bt[(15&t[o+1])<<2|t[o+2]>>6],i+=bt[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Et(e[n]);return t}return e};let It,Pt,Ot;!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",e.promptPasskeys="promptPasskeys",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(It||(It={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Pt||(Pt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ot||(Ot={}));const Lt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",_t="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Ut="auditLogs",Rt="vendor",Dt={flow:Pt.Login,step:It.preLogin,loading:!1,email:"",tenants:[]},Nt={setLoginState:pt("loginState"),resetLoginState:ft("loginState",{loginState:Dt})},Mt={requestAuthorize:ct("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ct("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ct("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:ct("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ct("auth/afterAuthNavigation"),preLogin:ct("auth/preLogin",(e=>({payload:e}))),postLogin:ct("auth/postLogin",(e=>({payload:e}))),login:ct("auth/login",(e=>({payload:e}))),loginWithMfa:ct("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ct("auth/recoverMfa",(e=>({payload:e}))),logout:ct("auth/logout",(e=>({payload:e}))),silentLogout:ct("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ct("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ct("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ct("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ct("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ct("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ct("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ct("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ct("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ct("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ct("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ct("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ct("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ct("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ct("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ct("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ct("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ct("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ct("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ct("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ct("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ct("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ct("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ct("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ct("auth/resetBreachedPassword",(e=>({payload:e})))};let Ft;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ft||(Ft={}));const Gt={step:Ft.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:pt("activateState"),resetActivateState:ft("activateState",{activateState:Gt}),setActivateStrategyState:gt("activateState","activationStrategy")},xt={activateAccount:ct("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ct("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ct("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ct("auth/resendActivationEmail",(e=>({payload:e})))};let Vt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Vt||(Vt={}));const jt={step:Vt.validate},Bt={setAcceptInvitationState:pt("acceptInvitationState"),resetAcceptInvitationState:ft("acceptInvitationState",{acceptInvitationState:jt})},Wt={acceptInvitation:ct("auth/acceptInvitation",(e=>({payload:e})))};let Kt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Kt||(Kt={}));const Ht={step:Kt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:pt("forgotPasswordState"),resetForgotPasswordState:ft("forgotPasswordState",{forgotPasswordState:Ht})},qt={forgotPassword:ct("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ct("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ct("auth/loadPasswordConfig",(e=>({payload:e})))};let Yt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Yt||(Yt={}));const Jt={step:Yt.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:pt("resetPhoneNumberState"),resetResetPhoneNumberState:ft("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Xt={resetPhoneNumber:ct("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ct("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ct("auth/changePhoneNumber",(e=>({payload:e})))},Zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},en={setSSOLoader:St("ssoState"),setSSOError:vt("ssoState"),setSSOState:pt("ssoState"),resetSSOState:ft("ssoState",{ssoState:Zt})},tn={loadSSOConfigurationsV2:ct("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ct("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ct("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ct("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ct("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ct("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ct("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ct("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ct("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ct("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ct("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ct("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ct("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ct("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ct("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ct("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ct("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ct("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ct("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ct("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ct("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ct("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ct("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ct("auth/oidcPostlogin",(e=>({payload:e})))},nn={loading:!1,error:null},on={setProfileState:pt("profileState"),resetProfileState:ft("profileState",{profileState:nn})},an={loadProfile:ct("auth/loadProfile"),saveProfile:ct("auth/saveProfile",(e=>({payload:e}))),changePassword:ct("auth/changePassword",(e=>({payload:e})))};let rn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(rn||(rn={}));const ln={step:rn.verify,loading:!1,saving:!1},sn={setMfaState:pt("mfaState"),resetMfaState:ft("mfaState",{mfaState:ln})},cn={enrollMfa:ct("auth/enrollMfa"),getMFADevices:ct("auth/getMFADevices"),getMFAStrategies:ct("auth/getMFAStrategies"),verifyMfa:ct("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ct("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ct("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ct("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ct("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ct("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ct("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ct("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ct("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ct("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ct("auth/disableMfaWebAuthn",(e=>({payload:e})))},un={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},dn={setTeamLoader:St("teamState"),setTeamError:vt("teamState"),setTeamState:pt("teamState"),resetTeamState:ft("teamState",{teamState:un})},yn={loadUsersV2:ct("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ct("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ct("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ct("auth/loadRoles",(e=>({payload:e}))),addUser:ct("auth/addUser",(e=>({payload:e}))),addUsersBulk:ct("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ct("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ct("auth/updateUser",(e=>({payload:e}))),deleteUser:ct("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ct("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ct("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ct("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ct("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ct("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ct("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ct("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ct("auth/getInvitationLink"),createInvitationLink:ct("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ct("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ct("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ct("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ct("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ct("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ct("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ct("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ct("auth/closeLockUserDialog",(e=>({payload:e})))},fn={firstLoad:!0,loading:!1,error:""},pn={setSocialLoginsState:pt("socialLoginState"),resetSocialLoginsState:ft("socialLoginState",{socialLoginState:fn})},gn={loadSocialLoginsConfiguration:ct("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ct("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ct("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ct("auth/setSocialLoginError",(e=>({payload:e})))};let Sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(Sn||(Sn={}));const vn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:Sn.SignUp},hn={setSignUpState:pt("signUpState"),resetSignUpState:ft("signUpState",{signUpState:vn})},mn={signUpUser:ct("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ct("auth/resetSignUpStateSoft")},An={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:St("apiTokensState"),setApiTokensError:vt("apiTokensState"),setApiTokensState:pt("apiTokensState"),resetApiTokensState:ft("apiTokensState",{apiTokensState:An})},Tn={loadApiTokens:ct("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ct("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ct("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ct("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ct("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ct("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ct("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ct("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={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}},En={setSecurityPolicyState:pt("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ft("securityPolicyState",{securityPolicyState:kn})},In={loadSecurityPolicy:ct("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ct("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ct("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ct("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ct("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ct("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ct("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ct("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ct("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ct("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ct("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ct("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ct("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ct("auth/loadPublicAuthStrategiesPolicy")},Pn={loading:!1},On={setAccountSettingsState:pt("accountSettingsState"),resetAccountSettingsState:ft("accountSettingsState",{accountSettingsState:Pn})},Ln={loadAccountSettings:ct("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ct("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:pt("tenantsState"),resetTenantsState:ft("tenantsState",{tenantsState:_n})},Cn={switchTenant:ct("auth/switchTenant",(e=>({payload:e}))),loadTenants:ct("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ct("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ct("auth/loadSubTenantsTree",(e=>({payload:e})))},Un={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:pt("rolesState"),resetRolesState:ft("rolesState",{rolesState:Un})},Dn={loadRolesAndPermissions:ct("auth/loadRoles",(e=>({payload:e}))),addRole:ct("auth/addRole",(e=>({payload:e}))),updateRole:ct("auth/updateRole",(e=>({payload:e}))),deleteRole:ct("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ct("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ct("auth/attachPermissionToRoles",(e=>({payload:e})))},Nn={loading:!1,sessions:[]},Mn={setSessionsState:pt("sessionsState"),resetSessionsState:ft("sessionsState",{sessionsState:Nn})},Fn={loadUserSessions:ct("auth/loadUserSessions"),loadCurrentUserSession:ct("auth/loadCurrentUserSession"),deleteUserSession:ct("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ct("auth/deleteAllUserSessions"),revokeUserSessions:ct("auth/revokeUserSessions",(e=>({payload:e})))},Gn={loading:!1,configurations:{}},$n={setSessionsPolicyState:pt("sessionsPolicyState"),resetSessionsPolicyState:ft("sessionsPolicyState",{sessionsPolicyState:Gn})},xn={loadSessionsPolicy:ct("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ct("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Vn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Vn||(Vn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Vn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Bn={setRestrictionsState:pt("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:ct("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ct("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ct("auth/loadIpRestrictions"),saveIpRestriction:ct("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ct("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ct("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ct("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ct("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ct("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ct("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Kn={loading:!1},Hn={setProvisioningState:pt("provisioningState"),resetProvisioningState:ft("provisioningState",{provisioningState:Kn})},zn={loadProvisionConnections:ct("auth/loadProvisionConnections"),createProvisionConnection:ct("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ct("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ct("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Yn={setPasskeysState:pt("passkeysState"),resetPasskeysState:ft("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:ct("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ct("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Xn={setUsersGroupsLoader:St("groupsState"),setUsersGroupsError:vt("groupsState"),setGroupsState:pt("groupsState"),resetUsersGroupsState:ft("groupsState",{groupsState:Qn})},Zn={loadGroups:ct("auth/loadUsersGroups"),getGroupById:ct("auth/getGroupById",(e=>({payload:e}))),createGroup:ct("auth/createGroup",(e=>({payload:e}))),updateGroup:ct("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ct("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ct("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ct("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ct("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ct("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ct("auth/getGroupConfiguration"),updateGroupConfiguration:ct("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ct("auth/getUsers",(e=>({payload:e})))},eo={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},to={setGroupsDialogsState:pt("groupsDialogsState"),resetGroupsDialogsState:ft("groupsState",{groupsDialogsState:eo}),openAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},no={loading:!0,error:null},oo={setCustomLoginState:pt("customLoginState"),resetCustomLoginState:ft("customLoginState",{customLoginState:no})},io={loadTenantMetadata:ct("auth/loadTenantMetadata"),updateTenantMetadata:ct("auth/updateTenantMetadata",(e=>({payload:e})))},ao={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ro,lo,so,co;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ro||(ro={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(lo||(lo={})),function(e){e.ASC="ASC",e.DESC="DESC"}(so||(so={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(co||(co={}));const uo=["local","saml","google","github","facebook","microsoft","scim2","slack"],yo={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],topAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:so.DESC,_sortBy:co.name},usersPageOffset:0,accountSettings:{}}},fo={setAllAccountsLoader:St("allAccountsState"),setAllAccountsError:vt("allAccountsState"),setAllAccountsState:pt("allAccountsState"),setSelectedAccountState:gt("allAccountsState","selectedAccount"),resetAllAccountsState:ft("allAccountsState",{allAccountsState:yo})},po={loadAccounts:ct("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ct("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ct("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ct("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ct("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:ct("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ct("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ct("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ct("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ct("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ct("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ct("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setSelectedSubAccountData:ct("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ct("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},go={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},So={setAllAccountDialogsState:pt("allAccountsDialogsState"),resetAllAccountDialogsState:ft("allAccountsDialogsState",{allAccountsDialogsState:go}),openCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",go.createSubAccountDialog),openUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",go.updateSubAccountDialog),openDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",go.deleteSubAccountDialog),openAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",go.addUsersToAccountDialog),openDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",go.deleteUserFromAccountDialog),openEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",go.editUserRolesDialog)},vo={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0},ho={setSecurityCenterState:pt("securityCenterState"),resetSecurityCenterState:ft("securityCenterState",{securityCenterState:vo}),setSecurityCenterStateLoader:St("securityCenterState"),setSecurityCenterStateError:vt("securityCenterState")},mo={loadRecommendations:ct("auth/loadRecommendations"),loadInsights:ct("auth/loadInsights"),sendResetBreachedPasswordEmails:ct("auth/sendResetBreachedPasswordEmails")};let Ao,bo,To;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ao||(Ao={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(bo||(bo={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(To||(To={}));const ko={[bo.Code]:It.loginWithOtc,[bo.EmailAndPassword]:It.loginWithPassword,[bo.MagicLink]:It.magicLinkPreLoginSuccess,[bo.SmsCode]:It.loginWithSmsOtc},Eo={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:vn,loginState:Dt,activateState:Gt,acceptInvitationState:jt,forgotPasswordState:Ht,ssoState:Zt,profileState:nn,customLoginState:no,mfaState:ln,teamState:un,groupsState:Qn,groupsDialogsState:eo,socialLoginState:fn,apiTokensState:An,securityPolicyState:kn,accountSettingsState:Pn,tenantsState:_n,rolesState:Un,resetPhoneNumberState:Jt,sessionsState:Nn,sessionsPolicyState:Gn,restrictionsState:jn,provisioningState:Kn,passkeysState:qn,allAccountsState:yo,allAccountsDialogsState:go,securityCenterState:vo},Io=C({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:()=>{}},Eo);let Po;!function(e){e.impersonating="impersonating",e.success="success"}(Po||(Po={}));const Oo={step:Po.impersonating,loading:!1},Lo={setImpersonateState:pt("impersonateState"),resetImpersonateState:ft("impersonateState",{impersonateState:Oo})},_o={impersonate:ct("impersonation/impersonate",(e=>({payload:e})))},{reducer:wo,actions:Co}=dt({name:wt,initialState:Io,reducers:C({resetState:e=>C({},e,Eo),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t})),setEntitlements:gt("user","entitlements")},Nt,pn,$t,Lo,Bt,zt,Qt,hn,on,oo,en,sn,dn,Xn,to,bn,En,On,wn,Rn,Mn,$n,Bn,Hn,Yn,fo,So,ho)});const Uo=C({loadEntitlements:ct("auth/loadEntitlements",(e=>({payload:e})))},Co,Mt,gn,xt,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,{},Tn,In,Ln,Cn,Dn,Fn,xn,Wn,zn,_o,Jn,po,mo);var Ro=function(e){return"@@redux-saga/"+e},Do=Ro("CANCEL_PROMISE"),No=Ro("CHANNEL_END"),Mo=Ro("IO"),Fo=Ro("MATCH"),Go=Ro("MULTICAST"),$o=Ro("SAGA_ACTION"),xo=Ro("SELF_CANCELLATION"),Vo=Ro("TASK"),jo=Ro("TASK_CANCEL"),Bo=Ro("TERMINATE"),Wo=Ro("LOCATION");function Ko(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Ho=function(e){return null==e},zo=function(e){return null!=e},qo=function(e){return"function"==typeof e},Yo=function(e){return"string"==typeof e},Jo=Array.isArray,Qo=function(e){return e&&qo(e.then)},Xo=function(e){return e&&qo(e.next)&&qo(e.throw)},Zo=function e(t){return t&&(Yo(t)||ni(t)||qo(t)||Jo(t)&&t.every(e))},ei=function(e){return e&&qo(e.take)&&qo(e.close)},ti=function(e){return qo(e)&&e.hasOwnProperty("toString")},ni=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},oi=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[Do]=function(){clearTimeout(n)},o},ii=function(e){return function(){return e}},ai=ii(!0),ri=function(){},li=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var si=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ci(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var ui=function(e){throw e},di=function(e){return{value:e,done:!0}};function yi(e,t,n){void 0===t&&(t=ui),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:di,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function fi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var pi=function(e){return Array.apply(null,new Array(e))},gi=function(e){return function(t){return e(Object.defineProperty(t,$o,{value:!0}))}},Si=function(e){return e===Bo},vi=function(e){return e===jo},hi=function(e){return Si(e)||vi(e)};function mi(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Jo(e)?pi(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||hi(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=ri,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Ai(e){return{name:e.name||"anonymous",location:bi(e)}}function bi(e){return e[Wo]}var Ti=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},ki="TAKE",Ei="CALL",Ii="FORK",Pi="SELECT",Oi=function(e,t){var n;return(n={})[Mo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Li(e,t){return void 0===e&&(e="*"),Zo(e)?(zo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Oi(ki,{pattern:e})):ei(n=e)&&n[Go]&&zo(t)&&Zo(t)?Oi(ki,{channel:e,pattern:t}):ei(e)?(zo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Oi(ki,{channel:e})):void 0;var n}function _i(e,t){return Ho(t)&&(t=e,e=void 0),Oi("PUT",{channel:e,action:t})}function wi(e){var t=Oi("ALL",e);return t.combinator=!0,t}function Ci(e,t){var n,o=null;return qo(e)?n=e:(Jo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Yo(n)&&qo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Ui(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Oi(Ei,Ci(e,n))}function Ri(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Oi(Ii,Ci(e,n))}function Di(e){return void 0===e&&(e=xo),Oi("CANCEL",e)}function Ni(e){void 0===e&&(e=li);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return Oi(Pi,{selector:e,args:n})}var Mi=Ui.bind(null,oi);var Fi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Gi=[],$i=0;function xi(e){try{Bi(),e()}finally{Wi()}}function Vi(e){Gi.push(e),$i||(Bi(),Ki())}function ji(e){try{return Bi(),e()}finally{Ki()}}function Bi(){$i++}function Wi(){$i--}function Ki(){var e;for(Wi();!$i&&void 0!==(e=Gi.shift());)xi(e)}var Hi=function(e){return function(t){return e.some((function(e){return Qi(e)(t)}))}},zi=function(e){return function(t){return e(t)}},qi=function(e){return function(t){return t.type===String(e)}},Yi=function(e){return function(t){return t.type===e}},Ji=function(){return ai};function Qi(e){var t="*"===e?Ji:Yo(e)?qi:Jo(e)?Hi:ti(e)?qi:qo(e)?zi:ni(e)?Yi:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Xi={type:No},Zi=function(e){return e&&e.type===No};function ea(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(Xi)}))},(e={})[Go]=!0,e.put=function(e){if(!t)if(Zi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Fo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Ji),t?e(Xi):(e[Fo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),ci(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[$o]?l(e):Vi((function(){l(e)}))},r}function ta(e,t){var n=e[Do];qo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var na,oa=0,ia=function(){return++oa};function aa(e){e.isRunning()&&e.cancel()}var ra=((na={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!Zi(e)||r?n(e):n(Bo)};try{i.take(l,zo(a)?Qi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},na.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Vi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Qo(t)?ta(t,n):n(t)}))},na.ALL=function(e,t,n,o){var i=o.digestEffect,a=oa,r=Object.keys(t);if(0!==r.length){var l=mi(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Jo(t)?[]:{})},na.RACE=function(e,t,n,o){var i=o.digestEffect,a=oa,r=Object.keys(t),l=Jo(t)?pi(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||hi(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=ri,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},na.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(Qo(s))return void ta(s,n);if(Xo(s))return void Sa(e,s,l.context,oa,Ai(a),!1,n);n(s)}catch(e){n(e,!0)}},na.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){Ho(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},na.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(Xo(i))return i;var a=!1;return yi((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Qo(i)})}))}catch(e){return yi((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ai(t)}(c,a);ji((function(){var t=Sa(e,c,s.context,oa,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},na.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&ci(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Jo(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)},na.CANCEL=function(e,t,n,o){var i=o.task;t===xo?aa(i):Jo(t)?t.forEach(aa):aa(t),n()},na.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},na.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Ti());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Xi):e.isEmpty()?(n.push(o),o.cancel=function(){ci(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(Xi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(Xi)}}}}(t.buffer),a=Qi(o),r=function t(n){Zi(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},na.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},na.FLUSH=function(e,t,n){t.flush(n)},na.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},na.SET_CONTEXT=function(e,t,n,o){var i=o.task;si(i.context,t),n()},na);function la(e,t){return e+"?"+t}function sa(e){var t=e.name,n=e.location;return n?t+" "+la(n.fileName,n.lineNumber):t}function ca(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var ua=null,da=[],ya=function(e){e.crashedEffect=ua,da.push(e)},fa=function(){ua=null,da.length=0},pa=function(){var e,t,n=da[0],o=da.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=bi(e))?t.code+" "+la(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+sa(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+sa(e.meta)})),[ca(da)]).join("\n")};function ga(e,t,n,o,i,a,r){var l;void 0===r&&(r=ri);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(ci(i,t),t.cont=ri,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=ri,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,ya({meta:i,cancelledTasks:y}),S.isRoot){var o=pa();fa(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===jo?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={})[Vo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(jo,!1))},l.cont=r,l.end=g,l.setContext=function(e){si(f,e)},l.toPromise=function(){return d||(d=Fi(),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 Sa(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Qo(t)?ta(t,o):Xo(t)?Sa(e,t,c.context,n,i,!1,o):t&&t[Mo]?(0,ra[t.type])(e,t.payload,o,u):o(t)}));d.cancel=ri;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(jo))},status:0},c=ga(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),fa()):vi(e)?(s.status=1,d.cancel(),i=qo(t.return)?t.return(jo):{done:!0,value:jo}):i=Si(e)?qo(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=ia();function s(n,i){a||(a=!0,o.cancel=ri,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){ua=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=ri,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=ri,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function va(e,t){for(var n=e.channel,o=void 0===n?ea():n,i=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?fi:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ia();if(s&&(s.rootSagaStarted=s.rootSagaStarted||ri,s.effectTriggered=s.effectTriggered||ri,s.effectResolved=s.effectResolved||ri,s.effectRejected=s.effectRejected||ri,s.effectCancelled=s.effectCancelled||ri,s.actionDispatched=s.actionDispatched||ri,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=li;var m={channel:o,dispatch:gi(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return ji((function(){var e=Sa(m,S,l,v,Ai(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var ha=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?ea():a,l=n.sagaMonitor,s=Ko(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=va.bind(null,C({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){si(i,e)},c},ma=function(e){return{done:!0,value:e}},Aa={};function ba(e){return ei(e)?"channel":ti(e)?String(e):qo(e)?e.name:String(e)}function Ta(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Aa)return ma(t);if(n&&!i)throw r=Aa,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Aa?ma(t):a}return yi(l,(function(e){return l(null,e)}),n)}function ka(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Li(e)},l=function(e){return{done:!1,value:Ri.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Ta({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+ba(e)+", "+t.name+")")}function Ea(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:Li(e)},s=function(e){return{done:!1,value:Ri.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Di(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ta({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("+ba(e)+", "+t.name+")")}function Ia(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:Li(e)},l=function(e){return{done:!1,value:Ui.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Ta({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+ba(e)+", "+t.name+")")}function Pa(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:Ui.apply(void 0,[n].concat(a))},s={done:!1,value:Mi(t)};return Ta({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Aa}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function Oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Ri.apply(void 0,[ka,e,t].concat(o))}function La(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Ri.apply(void 0,[Ea,e,t].concat(o))}function _a(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return Ri.apply(void 0,[Ia,e,t].concat(o))}class wa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null}static getInstance(){return wa.instance||(wa.instance=new wa),wa.instance}static setContext(e){wa.getInstance().context=e}static setAccessToken(e){wa.getInstance().accessToken=e}static setUser(e){wa.getInstance().user=e}static setRequestSource(e){wa.getInstance().requestSource=e}static setOnRedirectTo(e){wa.getInstance().onRedirectTo=e}static setLogout(e,t){wa.getInstance().logout=n=>{n?e(n):wa.onRedirectTo(t)}}static setEntitlementsOptions(e){wa.getInstance().entitlementsOptions=e}static setAppName(e){wa.getInstance().appName=e}static getContext(){var e;return null!=(e=wa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return wa.getInstance().accessToken}static getRequestSource(){return wa.getInstance().requestSource}static getUser(){return wa.getInstance().user}static onRedirectTo(e,t){return wa.getInstance().onRedirectTo(e,t)}static logout(e){return wa.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=wa.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return wa.getInstance().appName}}wa.instance=void 0;const Ca={getContext:()=>wa.getContext(),getAccessToken:()=>wa.getAccessToken(),getUser:()=>wa.getUser(),onRedirectTo:(e,t)=>wa.onRedirectTo(e,t),logout:e=>wa.logout(e)};class Ua extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ra={v1:"/identity/resources/users/webauthn/v1/devices"},Da={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Na={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v3:"/identity/resources/users/v3/me/tenants"}},apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}},passwords:{resetBreachedPasswords:{v1:"identity/resources/users/v1/passwords/breached/reset/bulk"}}},Ma={v1:"/identity/resources/configurations/v1"},Fa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ga={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},$a={v1:"/identity/resources/permissions/v1"},xa={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Va={v1:"/identity/resources/roles/v1"},ja={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ba={v1:"/identity/resources/impersonation/v1"},Wa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ka={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Ha={v1:"/team/resources/members/v1"},za={v1:"/team/resources/roles/v1"},qa={v1:"/team/resources/stats/v1"},Ya={v1:"/team/resources/profile"},Ja={v1:"/tenants/resources/account-settings/v1"},Qa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},Xa={v1:"/tenants/resources/sub-tenants/v1"},Za={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},er={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"}}}},tr={v1:"/subscriptions/resources/payment-providers/v1"},nr={v1:"/subscriptions/resources/subscriptions/v1"},or={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},ir={v1:"/reports/engine/resources/triggers/v1"},ar="/notification",rr="/audits",lr={v1:"/event/resources/configurations/v1"},sr="/webhook",cr="/oauth",ur="/flags",dr="/directory/resources/v1/configurations/scim2",yr="/directory/resources/scim/temp",fr="/entitlements/api/v1/user-entitlements",pr={v1:"/security-center/resources/recommendations/v1"},gr={v1:"/security-center/resources/insights/v1"};function Sr(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function vr(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ao.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ao.frameWork]=e.metadataHeaders.framework),o}const hr=async e=>{var t,n,o;const i=wa.getContext(),a=await async function(e,t){var n;const o=vr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:wa.getAccessToken)(),a=wa.getRequestSource();t&&(o[ao.contentType]=t),a&&(o[ao.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=Sr(e,t),i=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 o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,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:C({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.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 Ua("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}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=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Ua(t?e:"We're facing some difficulties, Please try again",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{}}},mr=async(e,t,n)=>hr(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Ar=async(e,t,n)=>hr(C({url:e,method:"POST",contentType:"application/json",body:t},n)),br=async(e,t,n)=>hr(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Tr=async(e,t,n)=>hr(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),kr=async(e,t,n)=>hr(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Er=async(e,t,n,o)=>hr(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Ir=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{});async function Pr(e){return Tr(`${Na.v1}/tenant`,e)}async function Or(){return mr(`${Na.v2}/me/tenants`)}async function Lr(e){return mr(Qa.v1,void 0,{headers:Ir(e)})}async function _r(e){return mr(Qa.tree.v1,void 0,{headers:Ir(e)})}async function wr(e){return mr(Qa.parents.v1,void 0,{headers:Ir(e)})}async function Cr(e,t){return mr(`${Qa.parents.v1}/${e}`,void 0,{headers:Ir(t)})}async function Ur(e,t){return Ar(`${xa.users.v1}/count`,e,{headers:Ir(t)})}async function Rr(e,t){return mr(Qa.v2,e,{headers:Ir(t)})}async function Dr(e,t){return mr(Qa.metadata.v2,C({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Ir(t)})}async function Nr(){return mr(Ma.v1)}async function Mr(){return mr(`${Ma.v1}/mfa-policy`)}async function Fr(){return mr(`${Ma.v1}/mfa-policy/vendor`)}async function Gr(e){return e.id?br(`${Ma.v1}/mfa-policy`,e):Ar(`${Ma.v1}/mfa-policy`,e)}async function $r(){return mr(`${Ma.v1}/lockout-policy`)}async function xr(){return mr(`${Ma.v1}/lockout-policy/vendor`)}async function Vr(e){return e.id?br(`${Ma.v1}/lockout-policy`,e):Ar(`${Ma.v1}/lockout-policy`,e)}async function jr(){try{return await mr(`${Ma.v1}/captcha-policy/public`)}catch{return null}}async function Br(){return mr(`${Ma.v1}/password-history-policy`)}async function Wr(){return mr(`${Ma.v1}/password-history-policy/vendor`)}async function Kr(e){return e.id?br(`${Ma.v1}/password-history-policy`,e):Ar(`${Ma.v1}/password-history-policy`,e)}async function Hr(){return mr(`${Ma.v1}/password`)}async function zr(){return mr(`${Fa.emailDomain.v1}`)}async function qr(){return mr(`${Fa.emailDomain.v1}/config`)}async function Yr(e){return Ar(`${Fa.emailDomain.v1}`,e)}async function Jr(e){return Ar(`${Fa.emailDomain.v1}/config`,e)}async function Qr(e){return kr(`${Fa.emailDomain.v1}/${e}`)}async function Xr(e){return mr(`${Fa.ip.v1}`,e)}async function Zr(){return mr(`${Fa.ip.v1}/config`)}async function el(e){return Ar(`${Fa.ip.v1}`,e)}async function tl(e){return Ar(`${Fa.ip.v1}/bulk`,e)}async function nl(e){return Ar(`${Fa.ip.v1}/config`,e)}async function ol(e){return kr(`${Fa.ip.v1}/${e}`)}async function il(){return Ar(`${Fa.ip.v1}/verify`)}async function al(){return Ar(`${Fa.ip.v1}/verify/allow`)}class rl extends Error{constructor(e){super(e)}}const ll="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new rl("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class sl extends Error{constructor(e){super(e)}}const cl=(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(ll(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 ll(t)}})(e.split(".")[n]))}catch(e){throw new sl("Invalid token specified: "+e.message)}};async function ul(e){return Ar(`${Na.v3}/me/token`,e)}async function dl(e,t){return mr(Na.v2,e,{headers:Ir(t)})}async function yl(e,t){return mr(Na.v3,e,{headers:Ir(t)})}async function fl(e,t){return mr(Na.roles.v3,C({},e,{ids:e.ids.join(",")}),{headers:Ir(t)})}async function pl(e,t){return mr(Na.groups.v3,C({},e,{ids:e.ids.join(",")}),{headers:Ir(t)})}async function gl(e){return mr(Na.tenants.me.v3,void 0,{headers:Ir(e)})}async function Sl(){return Ar(Na.passwords.resetBreachedPasswords.v1)}async function vl(e){return Tr(`${Na.v2}/me`,e)}async function hl(){return mr(fr)}let ml;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(ml||(ml={}));const Al="admin_portal_entitlements",bl={flags:{}};class Tl{constructor(){var e;this._flags={},this._flags=null!=(e=bl.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Tl;return n.set(e),Tl._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=C({},null!=(t=null==bl?void 0:bl.flags)?t:{},null!=e?e:{})}}async function kl(){return mr(ur)}Tl._instances={};const El=["type"],Il=["type"],Pl=["type"];async function Ol(e){if(!e.accessToken)return e;wa.setAccessToken(e.accessToken);const t=await su(),n=C({},e,e.accessToken?cl(e.accessToken):{},t);return wa.setUser(n),n}async function Ll(e){if(!e.accessToken)return{user:e};wa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([su(),Or()]),o=C({},e,e.accessToken?cl(e.accessToken):{},t);return wa.setUser(o),{user:o,tenants:n}}async function _l(e){const{accessToken:t}=e;if(!t)return{user:e};wa.setAccessToken(t);const[n,o]=await Promise.all([su(),gl()]),i=C({},e,t?cl(t):{},n);return wa.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function wl(e){wa.setAccessToken(e.id_token);const t=await su(),n=e.id_token?cl(e.id_token):{},o=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return wa.setUser(o),o}async function Cl(e){wa.setAccessToken(e.id_token);const[t,n]=await Promise.all([su(),gl()]),o=e.id_token?cl(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return wa.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Ul(e){try{const{address:t}=await Ar(`${Da.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Rl(e){return Ar(`${Da.v1}/user/saml/prelogin`,e)}async function Dl(e){return Ol(await Ar(`${Da.v1}/user/saml/postlogin`,e))}async function Nl(e){return Ol(await Ar(`${Da.v1}/user/oidc/postlogin`,e))}async function Ml(e){return Ol(await Ar(`${Da.v1}/user`,e))}async function Fl(e){return _l(await Ar(`${Da.v1}/user`,e))}async function Gl(e){return Ol(await Ar(`${Da.v1}/user/mfa/verify`,e))}async function $l(e){return _l(await Ar(`${Da.v1}/user/mfa/verify`,e))}async function xl(e){return Ar(`${Na.v1}/activate`,e)}async function Vl(e){return _l(await Ar(`${Na.v1}/activate`,e))}async function jl(e){return mr(`${Na.v1}/activate/strategy`,e)}async function Bl(e){return Ar(`${Na.v1}/activate/reset`,e)}async function Wl(e){return Ar(`${Na.v1}/invitation/reset`,e)}async function Kl(e){return Ar(`${Na.v1}/invitation/accept`,e)}async function Hl(){return Ol(await Ar(`${Da.v1}/user/token/refresh`))}async function zl(){return Ll(await Ar(`${Da.v1}/user/token/refresh`))}async function ql(){return _l(await Ar(`${Da.v1}/user/token/refresh`))}async function Yl(){return Ar(`${Da.v1}/logout`)}async function Jl(e){return mr(`${cr}/logout`,e)}async function Ql(e){return Ar(`${Na.v1}/passwords/reset`,e)}async function Xl(e){return Ar(`${Na.v1}/passwords/reset/verify`,e)}async function Zl(e){return mr(`${Na.v1}/passwords/config`,e)}async function es(e){return Ar(`${Da.v1}/user/mfa/recover`,e)}async function ts(){return Ar(`${Na.v1}/mfa/enroll`)}async function ns(){return Ar(`${Na.v1}/mfa/authenticator/enroll`)}async function os(e){return Ar(`${Na.v1}/mfa/authenticator/enroll/verify`,e)}async function is(e){return Ar(`${Na.v1}/mfa/sms/enroll`,e)}async function as(e){return Ar(`${Na.v1}/mfa/sms/enroll/verify`,e)}async function rs(){return Ar(`${Na.v1}/mfa/webauthn/enroll`)}async function ls(e){return Ar(`${Na.v1}/mfa/webauthn/enroll/verify`,e)}async function ss(e){return Ar(`${Na.v1}/mfa/enroll/verify`,e)}async function cs(e){return Ar(`${Na.v1}/mfa/disable`,e)}async function us(e,t){return Ar(`${Na.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ds(e){return Ar(`${Na.v1}/mfa/sms/${e}/disable`)}async function ys(e,t){return Ar(`${Na.v1}/mfa/sms/${e}/disable/verify`,t)}async function fs(e){return Ar(`${Na.v1}/mfa/webauthn/${e}/disable`)}async function ps(e,t){return Ar(`${Na.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function gs(){return mr(`${Na.v1}/mfa/devices`)}async function Ss(e){return Ar(`${Da.v1}/user/mfa/authenticator/enroll`,e)}async function vs(e){return Ar(`${Da.v1}/user/mfa/authenticator/enroll/verify`,e)}async function hs(e){return _l(await Ar(`${Da.v1}/user/mfa/authenticator/enroll/verify`,e))}async function ms(e,t){return Ar(`${Da.v1}/user/mfa/authenticator/${e}/verify`,t)}async function As(e){return Ar(`${Da.v1}/user/mfa/emailcode`,e)}async function bs(e){return Ar(`${Da.v1}/user/mfa/emailcode/verify`,e)}async function Ts(e){return _l(await Ar(`${Da.v1}/user/mfa/emailcode/verify`,e))}async function ks(e){return Ar(`${Da.v1}/user/mfa/sms/enroll`,e)}async function Es(e){return Ar(`${Da.v1}/user/mfa/sms/enroll/verify`,e)}async function Is(e){return _l(await Ar(`${Da.v1}/user/mfa/sms/enroll/verify`,e))}async function Ps(e,t){return Ar(`${Da.v1}/user/mfa/sms/${e}`,t)}async function Os(e,t){return Ar(`${Da.v1}/user/mfa/sms/${e}/verify`,t)}async function Ls(e,t){return _l(await Ar(`${Da.v1}/user/mfa/sms/${e}/verify`,t))}async function _s(e){return Ar(`${Da.v1}/user/mfa/webauthn/enroll`,e)}async function ws(e){return Ar(`${Da.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Cs(e){return _l(await Ar(`${Da.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Us(e,t){return Ar(`${Da.v1}/user/mfa/webauthn/${e}`,t)}async function Rs(e,t){return Ar(`${Da.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Ds(e,t){return _l(await Ar(`${Da.v1}/user/mfa/webauthn/${e}/verify`,t))}async function Ns(){return mr(`${Ka.v1}/saml/configurations`)}async function Ms(e){return Ar(`${Ka.v1}/saml/configurations`,e)}async function Fs(){return mr(`${Ka.v1}/saml/configurations/vendor-config`)}async function Gs(e){return Tr(`${Ka.v1}/saml/configurations/metadata`,e)}async function $s(){return Tr(`${Ka.v1}/saml/validations/domain`)}async function xs(){return mr(`${Ka.v1}/saml/configurations/roles/default`)}async function Vs(){return mr(`${Ka.v2}/saml/configurations/groups`)}async function js({roleIds:e}){return Ar(`${Ka.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Bs({roleIds:e,group:t}){return Ar(`${Ka.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Ws({roleIds:e,group:t,id:n}){return br(`${Ka.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Ks({id:e}){return kr(`${Ka.v2}/saml/configurations/groups/${e}`)}async function Hs(){return mr(`${Ka.v1}/oidc/configurations`)}async function zs(){return mr(`${Ka.v2}/configurations/public`)}async function qs(){return mr(Ga.v1)}async function Ys(){return mr(Ga.v2)}async function Js(){return mr(`${Ga.v2}/authenticated`)}async function Qs(){return mr(Ga.custom.v1)}async function Xs({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),Ar(`${Da.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Zs(){return mr(`${Ma.v1}/public`)}async function ec(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await Ar(`${Na.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await _l(n);return C({},a,{user:e,tenants:t,activeTenant:o})}return a}async function tc(){return mr(Na.sessions.currentUser.v1)}async function nc(){return mr(`${Na.sessions.currentUser.v1}/current`)}async function oc(e){return Ar(`${Na.sessions.v1}/revoke`,{userId:e})}async function ic(){return mr(Na.sessions.configurations.v1)}async function ac(e){await Ar(Na.sessions.configurations.v1,e)}async function rc(e){await kr(`${Na.sessions.currentUser.v1}/${e}`)}async function lc(){await kr(`${Na.sessions.currentUser.v1}/all`)}async function sc(){return mr(Na.accessTokens.v1)}async function cc(){return mr(xa.accessTokens.v1)}async function uc({id:e}){return kr(`${xa.accessTokens.v1}/${e}`)}async function dc({id:e}){return kr(`${Na.accessTokens.v1}/${e}`)}async function yc(e){return Ar(Na.accessTokens.v1,e)}async function fc(e){return Ar(xa.accessTokens.v1,e)}async function pc(){return mr(Na.apiTokens.v1)}async function gc(){return mr(xa.apiTokens.v1)}async function Sc(e){return Ar(Na.apiTokens.v1,e)}async function vc(e){return Ar(xa.apiTokens.v2,e)}async function hc({tokenId:e}){return kr(`${xa.apiTokens.v1}/${e}`)}async function mc({tokenId:e}){return kr(`${Na.apiTokens.v1}/${e}`)}async function Ac({userId:e}){return mr(`${Na.v1}/${e}`)}async function bc(e){return mr(`${Ma.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Tc(e){let{type:t}=e,n=Ko(e,El);return Ar(`${Da.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function kc(e){let{type:t}=e,n=Ko(e,Il);return _l(await Ar(`${Da.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Ec(e){let{type:t}=e,n=Ko(e,Pl);return Ar(`${Da.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ic({token:e}){return Ar(xa.invites.verify.v1,{token:e})}async function Pc(){return mr(`${Ka.v1}/configurations`)}async function Oc(e){return Ar(`${Ka.v1}/configurations`,e)}async function Lc(e,t){return br(`${Ka.v1}/configurations/${e}`,t)}async function _c(e){return kr(`${Ka.v1}/configurations/${e}`)}async function wc(e){return Ar(`${Ka.v1}/configurations/metadata`,e)}async function Cc(e,t){return Tr(`${Ka.v1}/configurations/${e}/metadata`,t)}async function Uc(e,t){return Ar(`${Ka.v1}/configurations/${e}/domains`,t)}async function Rc(e,t){return kr(`${Ka.v1}/configurations/${e}/domains/${t}`)}async function Dc(e,t){return Tr(`${Ka.v1}/configurations/${e}/domains/${t}/validate`)}async function Nc(e){return mr(`${Ka.v1}/configurations/${e}/roles`)}async function Mc(e,t){return Tr(`${Ka.v1}/configurations/${e}/roles`,t)}async function Fc(e,t){return Ar(`${Ka.v1}/configurations/${e}/groups`,t)}async function Gc(e,{roleIds:t,group:n,id:o}){return br(`${Ka.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function $c(e,t){return kr(`${Ka.v1}/configurations/${e}/groups/${t}`)}async function xc(e){return mr(`${Ka.v1}/configurations/${e}/groups`)}async function Vc(e){return Ar(`${Da.v2}/user/sso/prelogin`,e)}async function jc(e){return Ol(await Ar(`${Da.v2}/user/oidc/postlogin`,e))}async function Bc(e){return Cl(await Ar(`${cr}/token`,e))}async function Wc(){return Cl(await Ar(`${cr}/authorize/silent`))}async function Kc(e){return wl(await Ar(`${cr}/token`,e))}async function Hc(){return wl(await Ar(`${cr}/authorize/silent`))}async function zc(e){return Ar(`${Na.v1}/phone/reset`,e)}async function qc(e){return Ar(`${Na.v1}/phone/reset/verify`,e)}async function Yc(e){return Ar(`${Na.v1}/phone`,e)}async function Jc(e){return Ar(`${Na.v1}/phone/verify`,e)}async function Qc(e){return Tr(`${Na.v1}/phone/change`,e)}async function Xc(e){return Ar(`${Da.v1}/webauthn/prelogin`,e)}async function Zc(e){return Ar(`${Da.v1}/webauthn/postlogin`,e)}async function eu(e){return _l(await Ar(`${Da.v1}/webauthn/postlogin`,e))}async function tu(){return Ar(Ra.v1)}async function nu(){return mr(Ra.v1)}async function ou(e){return kr(`${Ra.v1}/${e}`)}async function iu(e){return Ar(`${Ra.v1}/verify`,e)}async function au(){return mr(`${Ma.v1}/auth/strategies/public`)}async function ru(){return mr(`${Ma.v1}/auth/strategies`)}async function lu(){return mr(`${Ma.v1}/mfa/strategies`)}async function su(){const e=mr(`${Na.v2}/me`);if(function(){if(!wa.shouldLoadEntitlements())return!1;const[e]=Tl.getFeatureFlags([Al],wa.getAppName()||"");return e}()){const[t,n]=await Promise.all([e,hl()]);return C({},t,{entitlements:n})}return await e}async function cu(e){return mr(`${Na.v2}/me`,null!=e?e:{addRoles:!0})}async function uu(e){return Tr(`${Na.v2}/me`,e)}async function du(e){return Tr(`${Ya.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function yu(e){return Ar(`${Na.v1}/passwords/change`,e)}async function fu(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>C({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return mr(Ha.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function pu(e){return Ar(Na.v2,C({},e,{provider:"local"}))}async function gu(e){return kr(`${Ha.v1}/${e.userId}`)}async function Su(e){return Tr(Ha.v1,e)}async function vu(e){return Ar(xa.invites.user.v1,C({},e))}async function hu(e){return br(xa.invites.user.v1,C({},e))}async function mu(){return kr(xa.invites.user.v1)}async function Au(){return mr(xa.invites.user.v1)}async function bu(){return mr(xa.invites.configuration.v1)}async function Tu(){return mr(za.v1)}async function ku(){return mr($a.v1)}async function Eu(){return mr(`${qa.v1}/members`)}async function Iu(e){return Ar(`${Ha.v1}/${e.userId}/resendActivationEmail`,{})}async function Pu(e){return Ar(Na.v2,C({},e,{provider:"local"}))}async function Ou(e){return Ar(Na.invitation.resendAll.v1,C({},e))}async function Lu(e){var t,n;const o=await mr("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function _u(){return mr("/metadata/admin-box")}async function wu(e){return Ar("/metadata/admin-box",e)}async function Cu(){const e=await mr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Uu=async()=>Lu({entityName:"notifications"}),Ru=async()=>Lu({entityName:"saml"}),Du=async()=>Lu({entityName:"audits"}),Nu=async e=>async function(e){const t=await mr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Mu=["dataFilters"],Fu=["templateId","dataFilters"],Gu=["dataFilters"];async function $u(e){return mr(`${or.v2}/tenant-reports`,e)}async function xu(e){return mr(`${or.v2}/${e.id}/tenant-reports`)}async function Vu(e){let{dataFilters:t}=e,n=Ko(e,Mu);return{html:await mr(`${ir.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function ju(e){let{templateId:t,dataFilters:n}=e,o=Ko(e,Fu);return Ar(`${or.v2}/${t}/tenant-reports`,C({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Bu(e){let{dataFilters:t}=e,n=Ko(e,Gu);const o=await mr(`${ir.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),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 Wu(e){return Ar(`${ir.v1}/tenant-reports`,e)}async function Ku(e){return mr(ar,{params:e})}async function Hu(e){return Tr(`${ar}/status`,{params:e})}async function zu(e){const{notificationId:t,pinStatus:n}=e;return Tr(`${ar}/${n}`,{notificationId:t})}async function qu(){return Ar(`${ar}/status/mark-all-read`)}const Yu=["endpoint","headerProps"];async function Ju(e){return mr(rr,e)}async function Qu(e){return mr(`${rr}/stats`,e)}async function Xu(e){const{endpoint:t,headerProps:n}=e,o=Ko(e,Yu);return Er(`${rr}/export/${t}`,{properties:n},o)}const Zu=["eventKey"],ed=["eventKey"],td=()=>mr(`${Za.v1}/slack`),nd=()=>mr(`${Za.v1}/slack/applications`),od=()=>mr(`${Za.v1}/slack/channels`),id=e=>e.id?br(`${Za.v1}/slack/subscription/${e.id}`,e):Ar(`${Za.v1}/slack/subscriptions`,e),ad=e=>kr(`${Za.v1}/slack/subscriptions/${e.id}`),rd=e=>Ar(`${Za.v1}/slack/applications/registrations`,{code:e}),ld=()=>mr(`${Za.v1}/emails`),sd=e=>{let{eventKey:t}=e,n=Ko(e,Zu);return Ar(`${Za.v1}/emails/${t}`,n)},cd=({eventKey:e,enabled:t})=>br(`${Za.v1}/emails/${e}`,{enabled:t}),ud=(e,t)=>kr(`${Za.v1}/emails/${e}/subscriptions/${t}`),dd=(e,t,n)=>Tr(`${Za.v1}/emails/${t}/subscriptions/${e}`,n),yd=e=>kr(`${Za.v1}/emails/${e}`),fd=()=>mr(`${Za.v2}/sms`),pd=e=>{let{eventKey:t}=e,n=Ko(e,ed);return Ar(`${Za.v2}/sms/${t}`,n)},gd=({eventKey:e,enabled:t})=>br(`${Za.v2}/sms/${e}`,{enabled:t}),Sd=(e,t)=>kr(`${Za.v2}/sms/${e}/subscriptions/${t}`),vd=(e,t,n)=>Tr(`${Za.v2}/sms/${t}/subscriptions/${e}`,n),hd=e=>kr(`${Za.v2}/sms/${e}`),md=()=>mr(sr),Ad=e=>e._id?br(`${sr}/${e._id}`,e):Ar(`${sr}/custom`,e),bd=e=>kr(`${sr}/${e}`),Td=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return mr(`${sr}/logs/?${o.toString()}`)},kd=e=>Ar(`${sr}/test`,e),Ed=e=>Ar(`${sr}/logs/${e}/retries`),Id=()=>mr(`${lr.v1}/categories`),Pd=e=>mr(lr.v1,{channels:e});async function Od(e,t){return Tr(Ja.v1,e,{headers:Ir(t)})}async function Ld(e){return mr(Ja.v1,void 0,{headers:Ir(e)})}async function _d(){return mr(`${Ja.v1}/public`)}const wd=["roleId"],Cd=["roleId"],Ud=["permissionId"];async function Rd(){return mr(Va.v1)}async function Dd(e){return Ar(Va.v1,e)}async function Nd({roleId:e}){return kr(`${Va.v1}/${e}`)}async function Md(e){let{roleId:t}=e,n=Ko(e,wd);return br(`${Va.v1}/${t}`,n)}async function Fd(e){let{roleId:t}=e,n=Ko(e,Cd);return Tr(`${Va.v1}/${t}/permissions`,n)}async function Gd(){return mr($a.v1)}async function $d(e){let{permissionId:t}=e,n=Ko(e,Ud);return Tr(`${$a.v1}/${t}/roles`,n)}async function xd(){return mr(`${$a.v1}/categories`)}async function Vd(){return mr(er.subscriptions.v1)}async function jd(e){return mr(`${er.subscriptions.v1}/${e}`)}async function Bd(e){return Tr(`${er.subscriptions.v1}/${e}/cancellations/`,{})}async function Wd(e){return Tr(`${er.subscriptions.v1}/${e}/renewals/`,{})}async function Kd(e,{paymentMethodId:t,planId:n}){return Tr(`${er.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Hd(e){return mr(`${nr.v1}/${e}`)}async function zd(){return mr(`${nr.v1}`)}async function qd(e){return Tr(`${nr.v1}/${e}/cancellations/`,{})}async function Yd(e){return Tr(`${nr.v1}/${e}/renewals/`,{})}async function Jd(e,{paymentMethodId:t,planId:n}){return Tr(`${nr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Qd(){return mr(er.plans.v1)}async function Xd(e){return mr(`${er.plans.v1}/${e}`)}async function Zd(){return mr(er.invoices.v1)}async function ey(e){return mr(`${er.invoices.v1}/${e}`)}async function ty(e,t){return mr(`${er.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const ny=["email"];async function oy(){return mr(er.paymentMethods.v1)}async function iy(e){return mr(`${er.paymentMethods.v1}/${e}`)}async function ay(e,t){let{email:n}=t,o=Ko(t,ny);return br(`${er.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function ry(e){return Ar(er.paymentProviders.stripe.subscriptions.v1,e)}async function ly(e){return mr(`${er.paymentProviders.stripe.customers.v1}/${e}`)}async function sy(e){return Ar(`${er.paymentProviders.stripe.customers.v1}`,e)}async function cy(){return mr(`${er.paymentProviders.stripe.publicConfigurations.v1}`)}async function uy(e){return Ar(`${er.paymentProviders.stripe.setupIntents.v1}`,e)}async function dy(e){return mr(`${er.summaries.v1}/${e}`)}async function yy(e){return mr(`${er.tenantConfiguration.v1}/${e}`)}async function fy(e){return Ar(`${er.tenantConfiguration.v1}`,e)}async function py(){return mr(tr.v1)}async function gy(){return mr(`${er.configurations.vendorPublicConfigurations.v1}`)}let Sy,vy,hy,my,Ay,by;async function Ty(){return mr("/vendors/public")}async function ky(e){return mr(ja.v1,e)}async function Ey(e){return Ar(ja.v1,e)}async function Iy(e,t){return kr(ja.v1,e,{headers:Ir(t)})}async function Py(e,t,n){return Ar(`${ja.v1}/${e}/roles`,t,{headers:Ir(n)})}async function Oy(e,t,n){return kr(`${ja.v1}/${e}/roles`,t,{headers:Ir(n)})}async function Ly(e,t,n){return br(`${ja.v1}/${e}/roles`,t,{headers:Ir(n)})}async function _y(e,t){return Ar(Xa.v1,e,{headers:Ir(t)})}async function wy(e,t){return kr(`${Xa.v1}/${e}`,void 0,{headers:Ir(t)})}async function Cy({tenantId:e},t,n){return br(`${Xa.v1}/${e}`,t,{headers:Ir(n)})}async function Uy(e,t,n){return Tr(`${ja.v1}/${e}/access`,t,{headers:Ir(n)})}async function Ry(e,t){return Ar(`${ja.v2}/`,e,{headers:Ir(t)})}async function Dy(){return mr(`${dr}`)}async function Ny(e,t){return br(`${dr}/${e}`,t)}async function My(e){return Ar(`${dr}`,e)}async function Fy(e){return kr(`${dr}/${e}`)}async function Gy(e){return mr(`${yr}/${e}/Users/count`)}async function $y(e){return Ar(`${Ba.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Sy||(Sy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(vy||(vy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hy||(hy={})),(my||(my={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ay||(Ay={})),function(e){e.CREATE="create_customer"}(by||(by={}));const xy=["groupId"];async function Vy({groupId:e},t){return mr(`${Wa.v1}/${e}`,C({},t))}async function jy(e){return mr(`${Wa.v1}`,C({},e))}async function By(e,t){return Ar(`${Wa.getByIds.v1}`,e,{params:t})}async function Wy(e){return Ar(`${Wa.v1}`,e)}async function Ky(e){let{groupId:t}=e,n=Ko(e,xy);return br(`${Wa.v1}/${t}`,n)}async function Hy(e){return kr(`${Wa.v1}/${e}`)}async function zy(e,t){return Ar(`${Wa.v1}/${e}/roles`,t)}async function qy(e,t){return kr(`${Wa.v1}/${e}/roles`,t)}async function Yy(e,t){return Ar(`${Wa.v1}/${e}/users`,t)}async function Jy(e,t){return kr(`${Wa.v1}/${e}/users`,t)}async function Qy(){return mr(`${Wa.configurations.v1}`)}async function Xy(e){return Ar(`${Wa.configurations.v1}`,e)}async function Zy(){return mr(pr.v1)}async function ef(){return mr(gr.v1)}let tf,nf,of,af,rf,lf;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(tf||(tf={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(nf||(nf={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(of||(of={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(af||(af={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(rf||(rf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(lf||(lf={}));const sf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],cf=`${Da.v1}/user/token/refresh`,uf=`${cr}/authorize/silent`,df=`${Na.v2}/me`,yf=`${Na.v2}/me/tenants`,ff=`${Na.v3}/me/tenants`;let pf,gf,Sf,vf,hf,mf,Af,bf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(pf||(pf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(gf||(gf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Sf||(Sf={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS",e.CONFIGURE_SSO="CONFIGURE_SSO"}(vf||(vf={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.STALE_USERS_EXIST="STALE_USERS_EXIST",e.NO_STALE_USERS_EXIST="NO_STALE_USERS_EXIST",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST"}(hf||(hf={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS"}(mf||(mf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Af||(Af={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(bf||(bf={}));const Tf={auth:l,teams:s,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:t,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:r,directory:m,impersonate:A,groups:b,users:i,entitlements:a,securityCenter:T};var kf={fetch:e,ContextHolder:wa,FronteggContext:Ca,api:Tf,FronteggApiError:Ua,AuthStrategyEnum:bo,MachineToMachineAuthStrategy:To,SocialLoginProviders:Ao,ISubscriptionCancellationPolicy:hy,ISubscriptionStatus:Sy,PaymentMethodType:vy,ProviderType:my};let Ef,If;!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"}(Ef||(Ef={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(If||(If={}));const Pf="input is invalid type",Of="undefined"!=typeof ArrayBuffer,Lf="0123456789abcdef".split(""),_f=[-2147483648,8388608,32768,128],wf=[24,16,8,0],Cf=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Uf=["hex","array","digest","arrayBuffer"],Rf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Of&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Df=function(e){return function(t){const n=new Mf(!0).update(t);return null==n?void 0:n[e]()}},Nf=function(e){return function(t,n){const o=new Ff(t,!0).update(n);return null==o?void 0:o[e]()}};class Mf{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>Mf.prototype.digest(),e?(Rf[0]=Rf[16]=Rf[1]=Rf[2]=Rf[3]=Rf[4]=Rf[5]=Rf[6]=Rf[7]=Rf[8]=Rf[9]=Rf[10]=Rf[11]=Rf[12]=Rf[13]=Rf[14]=Rf[15]=0,this.blocks=Rf):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Pf);if(null===e)throw new Error(Pf);if(Of&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Of&&ArrayBuffer.isView(e)))throw new Error(Pf);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<wf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<wf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<wf[3&i++],l[i>>2]|=(128|63&o)<<wf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<wf[3&i++],l[i>>2]|=(128|o>>6&63)<<wf[3&i++],l[i>>2]|=(128|63&o)<<wf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<wf[3&i++],l[i>>2]|=(128|o>>12&63)<<wf[3&i++],l[i>>2]|=(128|o>>6&63)<<wf[3&i++],l[i>>2]|=(128|63&o)<<wf[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=_f[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+Cf[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+Cf[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+Cf[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+Cf[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=Lf[e>>28&15]+Lf[e>>24&15]+Lf[e>>20&15]+Lf[e>>16&15]+Lf[e>>12&15]+Lf[e>>8&15]+Lf[e>>4&15]+Lf[15&e]+Lf[t>>28&15]+Lf[t>>24&15]+Lf[t>>20&15]+Lf[t>>16&15]+Lf[t>>12&15]+Lf[t>>8&15]+Lf[t>>4&15]+Lf[15&t]+Lf[n>>28&15]+Lf[n>>24&15]+Lf[n>>20&15]+Lf[n>>16&15]+Lf[n>>12&15]+Lf[n>>8&15]+Lf[n>>4&15]+Lf[15&n]+Lf[o>>28&15]+Lf[o>>24&15]+Lf[o>>20&15]+Lf[o>>16&15]+Lf[o>>12&15]+Lf[o>>8&15]+Lf[o>>4&15]+Lf[15&o]+Lf[i>>28&15]+Lf[i>>24&15]+Lf[i>>20&15]+Lf[i>>16&15]+Lf[i>>12&15]+Lf[i>>8&15]+Lf[i>>4&15]+Lf[15&i]+Lf[a>>28&15]+Lf[a>>24&15]+Lf[a>>20&15]+Lf[a>>16&15]+Lf[a>>12&15]+Lf[a>>8&15]+Lf[a>>4&15]+Lf[15&a]+Lf[r>>28&15]+Lf[r>>24&15]+Lf[r>>20&15]+Lf[r>>16&15]+Lf[r>>12&15]+Lf[r>>8&15]+Lf[r>>4&15]+Lf[15&r];return s+=Lf[l>>28&15]+Lf[l>>24&15]+Lf[l>>20&15]+Lf[l>>16&15]+Lf[l>>12&15]+Lf[l>>8&15]+Lf[l>>4&15]+Lf[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class Ff extends Mf{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Pf);if(null===e)throw new Error(Pf);if(Of&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Of&&ArrayBuffer.isView(e)))throw new Error(Pf)}var i;e.length>64&&(e=null==(i=new Mf(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Mf.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Mf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Mf.prototype.finalize.call(this)}}}const Gf=function(){const e=Df("hex");e.create=function(){return new Mf},e.update=function(t){return e.create().update(t)};for(let t=0;t<Uf.length;++t){const n=Uf[t];e[n]=Df(n)}return e}();function $f(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function xf(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(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,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=Gf.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Vf(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Nf("hex");e.create=function(e){return new Ff(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Uf.length;++t){const n=Uf[t];e[n]=Nf(n)}}();const jf=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Bf(e){const t=yield Ni((e=>e.root.appName));return Tl.getFeatureFlags(e,t)}const Wf={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Kf=C({},Wf,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Hf=[{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"}],zf={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},qf=C({},zf,{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}),Yf={loading:!1,error:void 0,saving:!0,profile:zf},Jf={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"},Qf={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:bo.EmailAndPassword,machineToMachineAuthStrategy:To.ClientCredentials},Xf={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Zf={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},ep={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},tp={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},np={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},op=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],ip={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:tp,roles:op,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},ap=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],rp={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:[Hf[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Hf[0]],managedBy:Sf.FRONTEGG}]},lp={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:[Hf[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Hf[0]],managedBy:Sf.FRONTEGG}]},sp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},cp=[lp,rp],up=[sp],dp=[{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}],yp=[{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"}],fp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},pp={isActive:!0,strategy:Vn.ALLOW},gp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Vn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Vn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Vn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Vn.BLOCK,description:"IP 4"}],Sp=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},lp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},vp=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),hp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Sp(6),roles:[vp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Sf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Sp(44),roles:[vp("Editor")],managedBy:Sf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Sp(8),roles:[vp("Viewer")],managedBy:Sf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Sp(5),roles:[vp("Admin")],managedBy:Sf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Sp(21),description:"BDR, AE, and inside sales",roles:[vp("Viewer")],managedBy:Sf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Sp(23),description:"Dev success and customer success",roles:[vp("Admin")],managedBy:Sf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Sp(10),description:"The marketing department",roles:[vp("Viewer")],managedBy:Sf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Sp(4),description:"Human resources",roles:[vp("Viewer")],managedBy:Sf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Sp(3),roles:[vp("Viewer")],managedBy:Sf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Sp(8),roles:[vp("Editor")],managedBy:Sf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Sp(4),roles:[vp("Viewer")],managedBy:Sf.FRONTEGG}],mp={scoring:{score:79},recommendations:{items:[{code:vf.FORCE_MFA,severity:Af.WARNING,category:bf.MFA},{code:vf.ENABLE_FORCE_RELOGIN,severity:Af.WARNING,category:bf.SESSIONS}]}},Ap={insights:{items:[{category:bf.MFA,code:hf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:bf.SESSIONS,code:hf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:bf.PASSWORD,code:hf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:bf.DOMAIN,code:hf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}};let bp,Tp,kp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(bp||(bp={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Tp||(Tp={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(kp||(kp={})),kp.profile,kp.privacy,kp.personalApiTokens,kp.account,kp.users,kp.groups,kp.security,kp.sso,kp.audits,kp.webhooks,kp.apiTokens,kp.roles,kp.subscriptions,kp.allAccounts;const Ep=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t,Ip=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Pp=e=>{const{pathname:t}=new URL(e),n=Ip(e);return n?t+n:t},Op=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Lp="tenantId",_p=e=>e.mfaRequired&&e.mfaToken?(wa.setAccessToken(null),wa.setUser(null),!0):(wa.setAccessToken(e.accessToken),wa.setUser(e),!1),wp=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return rn.authenticatorApp;if(t)return rn.smsVerifyCode}return rn.verify},Cp=e=>{if(1===e.length){const[t]=e;if(t===of.AuthenticatorApp)return rn.authenticatorApp;if(t===of.SMS)return rn.smsSetPhoneNumber;if(t===of.EmailCode)return rn.emailVerifyCode}return rn.verify},Up=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...Up(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),Rp=["callback"];function*Dp(){yield _i(Uo.setCustomLoginState({loading:!0}));try{const e=yield Ui(Tf.metadata.getAdminBoxMetadata);yield _i(Uo.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield _i(Uo.setCustomLoginState({loading:!1,error:Ep(e)}))}}function*Np(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Rp);try{yield _i(Uo.setCustomLoginState({error:null,saving:!0}));const e=Up(n);if(0===e.length)throw new Error("No changes to update");yield Ui(Tf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Ui(Tf.metadata.getAdminBoxMetadata);yield _i(Uo.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setCustomLoginState({error:Ep(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Mp(){var e;const[t]=yield Ui(Bf,["admin_portal_login_per_tenant"]),n=!(null==(e=wa.getContext())||!e.tenantResolver);if(yield Ni((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Ni((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*Fp(){try{var e;if(!(yield Ui(Mp)))return;const t=yield Ni((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=Tf.accountSettings,{applicationUrl:i}=yield Ui(t?n:o);if(!i)return;const{routes:a}=yield Ni((e=>e.auth)),r=null!=(e=Ip(i))?e:"";yield _i(Uo.setState({routes:C({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield _i(Uo.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Gp(){yield _a(Uo.loadTenantMetadata,Dp),yield _a(Uo.updateTenantMetadata,Np)}let $p;function xp(e){return function*(t){const[n]=yield Ui(Bf,["admin-portal-new-security-center-page"]);yield e(t),n&&(yield Vp(),yield jp())}}function*Vp(){const e=$p.RECOMMENDATIONS;yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Ui(Tf.securityCenter.getRecommendations);yield _i(Uo.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield _i(Uo.setSecurityCenterStateError({key:e,value:Ep(t)}))}finally{yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*jp(){const e=$p.INSIGHTS;yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Ui(Tf.securityCenter.getInsights);yield _i(Uo.setSecurityCenterState({insights:t.items}))}catch(t){yield _i(Uo.setSecurityCenterStateError({key:e,value:Ep(t)}))}finally{yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Bp(){const e=$p.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!0}));try{yield Ui(Tf.users.sendResetBreachedPasswordEmails)}catch(t){yield _i(Uo.setSecurityCenterStateError({key:e,value:Ep(t)}))}finally{yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Wp(){yield Oa(Uo.loadRecommendations,Vp),yield Oa(Uo.loadInsights,jp),yield Oa(Uo.sendResetBreachedPasswordEmails,Bp)}function*Kp(){const e=$p.RECOMMENDATIONS;yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!0})),yield Mi(500),yield _i(Uo.setSecurityCenterState({recommendations:mp.recommendations.items,score:mp.scoring.score})),yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hp(){const e=$p.INSIGHTS;yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!0})),yield Mi(500),yield _i(Uo.setSecurityCenterState({insights:Ap.insights.items})),yield _i(Uo.setSecurityCenterStateLoader({key:e,value:!1}))}function*zp(){yield Oa(Uo.loadRecommendations,Kp),yield Oa(Uo.loadInsights,Hp)}!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails"}($p||($p={}));const qp=["callback"],Yp=["callback"],Jp=["callback"],Qp=["callback"],Xp=["callback"],Zp=["callback"];function*eg(){yield _i(Uo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getGlobalSecurityPolicy);yield _i(Uo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyGlobalState({error:Ep(e),loading:!1}))}yield _i(Uo.loadSecurityPolicyMfa()),yield _i(Uo.loadSecurityPolicyVendorMfa()),yield _i(Uo.loadSecurityPolicyLockout()),yield _i(Uo.loadSecurityPolicyVendorLockout()),yield _i(Uo.loadSecurityPolicyVendorPasswordHistory()),yield _i(Uo.loadSecurityPolicyCaptcha()),yield _i(Uo.loadPublicAuthStrategiesPolicy())}function*tg(e){var t,n;if(!(yield Ui(Mp)))return e;const o=yield Ui(og);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?C({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*ng(){yield _i(Uo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getVendorConfig),t=yield tg(e);yield _i(Uo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyPublicState({error:Ep(e),loading:!1}))}}function*og(){const e=yield Ni((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ui(Tf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Ui(Tf.auth.getVendorPublicAuthStrategiesConfig),t}function*ig(){yield _i(Uo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Ui(og);yield function*(e){const t=yield Ui(Mp);if(!e||!t)return;const{policy:n}=yield Ni((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield _i(Uo.setSecurityPolicyPublicState({policy:C({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield _i(Uo.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyAuthStrategyPublicState({error:Ep(e),loading:!1}))}}function*ag(){yield _i(Uo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getMfaPolicy);yield _i(Uo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyMfaState({error:Ep(e),loading:!1}))}}function*rg(){yield _i(Uo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getVendorMfaPolicy);yield _i(Uo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyVendorMfaState({error:Ep(e),loading:!1}))}}function*lg(e){let{payload:{callback:t}}=e,n=Ko(e.payload,qp);yield _i(Uo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ui(Tf.auth.saveMfaPolicy,n);yield _i(Uo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setSecurityPolicyMfaState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*sg(){yield _i(Uo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getLockoutPolicy);yield _i(Uo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyLockoutState({error:Ep(e),loading:!1}))}}function*cg(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Yp);yield _i(Uo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ui(Tf.auth.saveLockoutPolicy,n);yield _i(Uo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setSecurityPolicyLockoutState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*ug(){yield _i(Uo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getVendorLockoutPolicy);yield _i(Uo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyVendorLockoutState({error:Ep(e),loading:!1}))}}function*dg(){yield _i(Uo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getCaptchaPolicy);yield _i(Uo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyCaptchaState({error:Ep(e),loading:!1}))}}function*yg(){yield _i(Uo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getPasswordHistoryPolicy);yield _i(Uo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyPasswordHistoryState({error:Ep(e),loading:!1}))}}function*fg(){yield _i(Uo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getVendorPasswordHistoryPolicy);yield _i(Uo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyVendorPasswordHistoryState({error:Ep(e),loading:!1}))}}function*pg(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Jp);yield _i(Uo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ui(Tf.auth.savePasswordHistoryPolicy,n);yield _i(Uo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setSecurityPolicyPasswordHistoryState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*gg(){yield _i(Uo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getPasswordConfigPolicy);yield _i(Uo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyPasswordState({error:Ep(e),loading:!1}))}}function*Sg(){yield _a(Uo.loadSecurityPolicy,eg),yield Oa(Uo.saveSecurityPolicyMfa,xp(lg)),yield Oa(Uo.loadSecurityPolicyMfa,ag),yield Oa(Uo.loadSecurityPolicyVendorMfa,rg),yield Oa(Uo.saveSecurityPolicyLockout,xp(cg)),yield Oa(Uo.loadSecurityPolicyLockout,sg),yield Oa(Uo.loadSecurityPolicyVendorLockout,ug),yield Oa(Uo.loadSecurityPolicyCaptcha,dg),yield Oa(Uo.saveSecurityPolicyPasswordHistory,xp(pg)),yield Oa(Uo.loadSecurityPolicyPasswordHistory,yg),yield Oa(Uo.loadSecurityPolicyVendorPasswordHistory,fg),yield Oa(Uo.loadVendorPasswordConfig,gg),yield Oa(Uo.loadPublicSecurityPolicy,ng),yield Oa(Uo.loadPublicAuthStrategiesPolicy,ig)}function*vg(){yield _i(Uo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield _i(Uo.setSecurityPolicyPublicState({policy:Qf,loading:!1}))}catch(e){yield _i(Uo.setSecurityPolicyPublicState({error:Ep(e),loading:!1}))}}function*hg(){yield _i(Uo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyGlobalState({policy:Jf,loading:!1})),yield _i(Uo.loadSecurityPolicyMfa()),yield _i(Uo.loadSecurityPolicyVendorMfa()),yield _i(Uo.loadSecurityPolicyLockout()),yield _i(Uo.loadSecurityPolicyVendorLockout()),yield _i(Uo.loadSecurityPolicyPasswordHistory()),yield _i(Uo.loadSecurityPolicyVendorPasswordHistory()),yield _i(Uo.loadSecurityPolicyCaptcha())}function*mg(){yield _i(Uo.setSecurityPolicyMfaState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyMfaState({policy:Xf,loading:!1}))}function*Ag(){yield _i(Uo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyVendorMfaState({policy:Xf,loading:!1}))}function*bg(e){var t;let{payload:{callback:n}}=e,o=Ko(e.payload,Qp);yield _i(Uo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=C({},Zf,{id:null!=(t=o.id)?t:Zf.id,enforceMFAType:o.enforceMFAType});yield At(),yield _i(Uo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*Tg(){yield _i(Uo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyLockoutState({policy:Zf,loading:!1}))}function*kg(){yield _i(Uo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyVendorLockoutState({policy:Zf,loading:!1}))}function*Eg(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Xp);yield _i(Uo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield At();const o=C({},Zf,n,{id:n.id?n.id:Zf.id});null==t||t(o),yield _i(Uo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Ig(){yield _i(Uo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyLockoutState({policy:Zf,loading:!1}))}function*Pg(){yield _i(Uo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyPasswordHistoryState({policy:ep,loading:!1}))}function*Og(){yield _i(Uo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield At(),yield _i(Uo.setSecurityPolicyVendorPasswordHistoryState({policy:ep,loading:!1}))}function*Lg(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Zp);yield _i(Uo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield At();const o=C({},ep,n,{id:n.id?n.id:ep.id});null==t||t(o),yield _i(Uo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*_g(){yield _a(Uo.loadSecurityPolicy,hg),yield Oa(Uo.loadPublicSecurityPolicy,vg),yield Oa(Uo.saveSecurityPolicyMfa,bg),yield Oa(Uo.loadSecurityPolicyMfa,mg),yield Oa(Uo.loadSecurityPolicyVendorMfa,Ag),yield Oa(Uo.saveSecurityPolicyLockout,Eg),yield Oa(Uo.loadSecurityPolicyLockout,Tg),yield Oa(Uo.loadSecurityPolicyVendorLockout,kg),yield Oa(Uo.loadSecurityPolicyCaptcha,Ig),yield Oa(Uo.saveSecurityPolicyPasswordHistory,Lg),yield Oa(Uo.loadSecurityPolicyPasswordHistory,Pg),yield Oa(Uo.loadSecurityPolicyVendorPasswordHistory,Og)}const wg=["events","url"];function*Cg(){yield _i(Uo.setSignUpState({loading:!0}));try{const e=yield Ui(Tf.auth.getVendorConfig),t=yield tg(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield _i(Uo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield _i(Uo.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield _i(Uo.setSignUpState({loading:!1,error:Ep(e),firstLoad:!1}))}}function*Ug(e){let{payload:{events:t,url:n}}=e,o=Ko(e.payload,wg);yield _i(Uo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Ni((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Ui(Tf.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Tp.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(!r&&l&&_p(l)){const t=yield mS(l);yield _i(Uo.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Ni((e=>e.auth));yield _i(Uo.setSignUpState({loading:!1,shouldActivate:r,stage:Sn.SignUpSuccess})),yield _i(Uo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:C({},e,{tenants:u,activeTenant:d})}))}}catch(e){wa.setAccessToken(null),wa.setUser(null),yield _i(Uo.setSignUpState({loading:!1,error:Ep(e)}))}yield _i(Uo.setSignUpState({loading:!1}))}function*Rg(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ni((e=>e.auth.signUpState));yield _i(Uo.resetSignUpState()),yield _i(Uo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Dg(){yield _a(Uo.signUpUser,Ug),yield _a(Uo.resetSignUpStateSoft,Rg)}const Ng={setVendorState:(e,{payload:t})=>C({},e,t)},Mg={loadVendorPublicInfo:ct("vendor/loadVendorPublicInfo")},Fg={loading:!1},{reducer:Gg,actions:$g}=dt({name:Rt,initialState:Fg,reducers:C({},Ng)}),xg=C({},$g,Mg);function*Vg(){yield _i(xg.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Tf.vendor.getVendorPublicInfo();yield _i(xg.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield _i(xg.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var jg=n(378),Bg=n.n(jg);function Wg(e,t){return Bg()(e,t)}function*Kg({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Ui(Tf.entitlements.loadEntitlements);yield function*(e){Wg(yield Ni((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield _i(Uo.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*Hg(){yield _a(Uo.loadEntitlements,Kg)}const zg=["callback"],qg=["callback"],Yg=["callback"],Jg=["callback"],Qg=["callback","events"],Xg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["user"],oS=["callback"],iS=["callback"],aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback","deviceId"],cS=["callback"],uS=["callback"],dS=["callback","deviceId"],yS=["callback","deviceId"],fS=["callback","deviceId"];function*pS(e){const t=yield Ni((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return Wg(t,null==e?void 0:e.entitlements)?C({},e,{entitlements:t}):e}function*gS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Ni((e=>e.auth));yield _i(Uo.setState(C({user:e,tenantsState:C({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*SS(){const e=wa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Ni((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Ui(Fp),u=yield Ni((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(Lt);d&&![a,r,l,s].includes(d)&&(c=d),window.localStorage.removeItem(Lt),yield At(200),_i(Uo.resetLoginState());const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?Pp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*vS(){let e;try{var t;const n=yield Ui(Tf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield _i(Uo.setState({ssoACS:e}))}function*hS(){try{const{isActive:e}=yield Ui(Tf.auth.getSSOPublicConfiguration);yield _i(Uo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*mS(e){let t=It.loginWithTwoFactor,n={};const{loginState:o}=yield Ni((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ui(Tf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:wp(e.mfaDevices)}:(n={step:Cp(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=It.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Pt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}function*AS(e){var t;const{routes:n,loginState:o}=yield Ni((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*bS(){const{hostedLoginBox:e}=yield Ni((e=>e.auth));e?yield Ui(TS):yield Ui(ES)}function*TS(){const{user:e}=yield Ni((e=>e.auth));if(null==e||!e.refreshToken)return wa.setAccessToken(null),wa.setUser(null),void(yield _i(Uo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ui(Tf.auth.exchangeOAuthTokensV2,t),o=yield Ui(pS,n.user);yield Ui(gS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){wa.setAccessToken(null),wa.setUser(null),yield _i(Uo.setState({user:null,isAuthenticated:!1}))}}function*kS(){const{user:e}=yield Ni((e=>e.auth));if(null==e||!e.refreshToken)return wa.setAccessToken(null),wa.setUser(null),void(yield _i(Uo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ui(Tf.auth.exchangeOAuthTokensV2,t),o=yield Ui(pS,n.user);yield Ui(gS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){wa.setAccessToken(null),wa.setUser(null),yield _i(Uo.setState({user:null,isAuthenticated:!1}))}}function*ES(){try{const t=wa.onRedirectTo,{routes:n,loginState:o}=yield Ni((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ui(Tf.auth.refreshTokenV3);if(_p(i)){const e=yield mS(i);yield _i(Uo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield AS(i),l=yield Ui(pS,i);yield Ui(gS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield PS(n)}}catch(e){wa.setAccessToken(null),wa.setUser(null),yield _i(Uo.setState({user:void 0,isAuthenticated:!1}))}}function*IS(){try{const t=wa.onRedirectTo,{routes:n,loginState:o}=yield Ni((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ui(Tf.auth.refreshTokenV3);if(_p(i)){const e=yield mS(i);yield _i(Uo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Ui(pS,i);if(yield Ui(FS))yield _i(Uo.setLoginState({step:It.promptPasskeys,loading:!1})),yield Ui(gS,{user:l,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield AS(i);yield Ui(gS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield PS(n)}}}catch(e){wa.setAccessToken(null),wa.setUser(null),yield _i(Uo.setState({user:void 0,isAuthenticated:!1}))}}function*PS(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=wa.onRedirectTo,{routes:i,loginState:a}=yield Ni((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield SS())}function*OS({payload:{callback:e}}){try{const{ip:t}=yield Ui(Tf.metadata.getCurrentUserIpMetadata);yield _i(Uo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*LS({payload:e}){const t=[];(yield Ui(Mp))?yield Ui(bS):t.push(Ui(bS)),e&&(yield _i(Uo.setState({isLoading:!0})),yield _i(Uo.loadSocialLoginsConfigurationV2()),t.push(Ui(Cg)),t.push(Ui(ig)),t.push(Ui(hS)),t.push(Ui(Vg)),t.push(Ui(vS)),t.push(Ui(Fp))),yield wi(t),yield _i(Uo.setState({isLoading:!1}))}function*_S({accessToken:e,user:t}){if(!e)return void(yield _i(Uo.setState({user:void 0,isAuthenticated:!1})));const n=wa.onRedirectTo,{routes:o}=yield Ni((e=>e.auth));if(_p(t)){const e=yield mS(t);yield _i(Uo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*wS({payload:e}){const t=[];yield _i(Uo.loadSocialLoginsConfigurationV2()),t.push(Ui(Cg)),t.push(Ui(hS)),t.push(Ui(Vg)),t.push(Ui(vS)),t.push(Ui(_S,e)),t.push(Ui(Fp)),yield wi(t)}function*CS({payload:e}){const{disableSilentRefresh:t}=yield Ni((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Ui(Tf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Ui(gS,e,{isAuthenticated:!0,isLoading:!1})}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Ni((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;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield _i(Uo.setState({isLoading:!0}));const a=Vf(),r=Vf(),l=yield Ui(xf,r);localStorage.setItem(_t,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Ui(Fp);const c=yield Ni((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${Sr(n,"/oauth/authorize")}/oauth/authorize`,d=C({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);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Op(Lp);f&&(d.tenantId=f);o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*US({payload:e}){const t=localStorage.getItem(_t)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Ni((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Ui(Fp);const a=yield Ni((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Ui(Tf.auth.exchangeOAuthTokensV2,r);yield Ui(gS,e,{isAuthenticated:!0})}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield SS()}}function*RS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,zg);try{yield _i(Uo.setLoginState({loading:!0}));const e=yield Ui(Tf.auth.changePhoneNumberWithVerification,n);yield _i(Uo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:It.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e),loading:!1}))}}function*DS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,qg);try{yield _i(Uo.setLoginState({loading:!0})),yield Ui(Tf.auth.verifyChangePhoneNumber,n),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e),loading:!1}))}}function*NS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Yg);try{yield _i(Uo.setLoginState({loading:!0}));const e=yield Ui(Tf.auth.passwordlessPreLogin,C({},n,{type:bo.SmsCode}));yield _i(Uo.setLoginState({step:It.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e),loading:!1})),null==t||t(e)}}function*MS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Jg);try{const{onRedirectTo:e,routes:o}=yield Ni((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield _i(Uo.setLoginState({loading:!0}));const i=yield Ui(Tf.auth.passwordlessPreLogin,n),a=ko[n.type];if(a===It.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield _i(Uo.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield _i(Uo.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield _i(Uo.setLoginState({error:Ep(e),loading:!1})),null==t||t()}}function*FS(){const{publicAuthStrategyPolicy:e}=yield Ni((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===tf.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Ui(Bf,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ui(Tf.auth.getWebAuthnDevices);return yield _i(Uo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*GS(e){let{payload:{callback:t,events:n}}=e,o=Ko(e.payload,Qg);try{yield _i(Uo.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Ui(Tf.auth.passwordlessPostLoginV2,o),l=wa.onRedirectTo,{routes:s}=yield Ni((e=>e.auth));if(_p(e)){const t=yield mS(e);yield _i(Uo.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Ni((e=>e.auth));var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:bp.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Ui(gS,{user:e,tenants:a,activeTenant:r}),yield _i(Uo.setLoginState({error:void 0})),yield _i(Uo.setState({isLoading:!1})),o.flow===Pt.Login?(yield Ui(FS))?(yield _i(Uo.setLoginState({step:It.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield _i(Uo.setState({isAuthenticated:!0})),yield SS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield _i(Uo.setLoginState({error:Ep(e,"Failed to authenticate")}))}finally{yield _i(Uo.setLoginState({loading:!1}))}}function*$S({payload:e}){try{yield _i(Uo.setLoginState({loading:!0}));const{name:t}=yield Ui(Tf.auth.verifyInviteToken,e);yield _i(Uo.setLoginState({inviteTokenTenantName:t}))}catch(e){yield _i(Uo.setLoginState({inviteTokenError:Ep(e,"We couldn't verify your invitation")}))}finally{yield _i(Uo.setLoginState({loading:!1}))}}function*xS({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield _i(Uo.setLoginState({loading:!0}));try{const i=yield Ni((({auth:{onRedirectTo:e}})=>e)),a=Op(Lp),{address:r,idpType:l}=yield Ui(Tf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===If.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Ni((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield _i(Uo.setLoginState({step:It.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield VS({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield VS({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*VS(e){let{callback:t}=e,n=Ko(e,Xg);const o=yield Ni((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield _i(Uo.setLoginState({step:It.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===bo.EmailAndPassword?(yield _i(Uo.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t()):[bo.MagicLink,bo.Code,bo.SmsCode].includes(null==o?void 0:o.authStrategy)?yield _i(Uo.passwordlessPreLogin(C({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield _i(Uo.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t())}function*jS({payload:{callback:e}}){try{yield _i(Uo.setLoginState({loading:!0}));const{options:t}=yield Ui(Tf.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield _i(Uo.setLoginState({error:Ep(t)})),null==e||e(null)}finally{yield _i(Uo.setLoginState({loading:!1}))}}function*BS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Zg);try{yield _i(Uo.setLoginState({loading:!0}));const e=Et(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?nf.Platform:nf.CrossPlatform;yield Ui(Tf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e)})),null==t||t(null)}finally{yield _i(Uo.setLoginState({loading:!1}))}}function*WS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,eS);try{var o;yield _i(Uo.setPasskeysState({loading:!0})),yield _i(Uo.setLoginState({loading:!0}));const{options:e}=yield Ui(Tf.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)}))),yield _i(Uo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield _i(Uo.setLoginState({error:Ep(e)})),null==t||t(null)}finally{yield _i(Uo.setPasskeysState({loading:!1})),yield _i(Uo.setLoginState({loading:!1}))}}function*KS(e){let{payload:{callback:t}}=e,n=Ko(e.payload,tS);try{var o;yield _i(Uo.setPasskeysState({loading:!0})),yield _i(Uo.setLoginState({loading:!0}));const e=Et(n.publicKey),i=yield Ui(Tf.auth.webAuthnPostLoginV2,C({},e,{response:C({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=i,r=Ko(i,nS);if(_p(a)){const e=wa.onRedirectTo,{routes:t}=yield Ni((e=>e.auth)),n=yield mS(a);yield _i(Uo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Ui(gS,C({user:a},r),{isAuthenticated:!0}),yield _i(Uo.setLoginState({error:void 0})),yield SS(),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e)})),null==t||t(null)}finally{yield _i(Uo.setPasskeysState({loading:!1})),yield _i(Uo.setLoginState({loading:!1}))}}function*HS({payload:e}){const{onRedirectTo:t,routes:n}=yield Ni((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield _i(Uo.setLoginState({loading:!0}));try{const t=yield Ui(Tf.auth.postLogin,e);yield _i(Uo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield SS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield _i(Uo.setLoginState({step:It.loginWithSSOFailed,loading:!1}))}}function*zS({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield _i(Uo.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Ui(Tf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=wa.onRedirectTo,{routes:c}=yield Ni((e=>e.auth));if(_p(a)){const e=yield mS(a);yield _i(Uo.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ni((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Ui(gS,{user:a,tenants:r,activeTenant:l},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Pt.Login?It.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[o]=yield Ui(Bf,["security-center-login-flows"]);t.flow===Pt.Login&&(o&&a.isBreachedPassword?yield _i(Uo.setLoginState({step:It.breachedPassword,loading:!1})):n&&((yield Ui(FS))?(yield _i(Uo.setLoginState({step:It.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield SS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){wa.setAccessToken(null),wa.setUser(null),null==i||i(!1,t),yield _i(Uo.setLoginState({email:e,error:Ep(t),loading:!1}))}}function*qS({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield _i(Uo.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Ui(Tf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Ni((e=>e.auth)),s=l.flow===Pt.Login?It.success:l.step,c=!!i.accessToken;yield Ui(gS,{user:i,tenants:a,activeTenant:r},{loginState:{flow:l.flow,quickLoginToRegister:l.quickLoginToRegister,loading:!1,step:s,error:void 0,tenants:a},isAuthenticated:c}),i.id&&localStorage.setItem("userId",i.id),yield _i(Uo.setLoginState({error:void 0,loading:!1}));const[u]=yield Ui(Bf,["security-center-login-flows"]);l.flow===Pt.Login&&(u&&l.isBreachedPassword?yield _i(Uo.setLoginState({step:It.breachedPassword,loading:!1})):(yield Ui(FS))?yield _i(Uo.setLoginState({step:It.promptPasskeys,loading:!1})):yield SS()),null==o||o(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e),loading:!1})),null==o||o(!1,e)}}function*YS({payload:e}){yield _i(Uo.setLoginState({loading:!0}));try{var t;yield Ui(Tf.auth.recoverMfaToken,e),yield _i(Uo.setLoginState({loading:!1,error:void 0,step:It.preLogin})),yield _i(Uo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setLoginState({error:Ep(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*JS({payload:e}){const{hostedLoginBox:t}=yield Ni((e=>e.auth));yield _i(Uo.setState({isLoading:!0}));try{t?yield Ui(Tf.auth.OAuthLogout):yield Ui(Tf.auth.logout)}catch{}yield _i(Uo.resetState()),yield _i(Uo.requestAuthorize(!0)),null==e||e()}function*QS({payload:e}){var t;try{yield Ui(Tf.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*XS({user:e,tenants:t,activeTenant:n}){const o={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield _i(Uo.setMfaState(o)),yield _i(Uo.setUser(e)),yield _i(Uo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*ZS({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Ni((e=>e.auth));yield _i(Uo.setUser(e)),yield _i(Uo.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Ni((e=>e.auth.mfaState)),[a]=yield Ui(Bf,["security-center-login-flows"]);if(o.flow===Pt.Login)if(a&&o.isBreachedPassword)yield _i(Uo.setLoginState({step:It.breachedPassword,loading:!1}));else{const e=yield Ui(FS);i===rn.smsVerifyCode&&e?yield _i(Uo.setLoginState({step:It.promptPasskeys,loading:!1})):yield SS()}yield _i(Uo.setState({isAuthenticated:!!e.accessToken}))}function*ev(e){let{payload:{callback:t}}=e,n=Ko(e.payload,oS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.preEnrollMFASMSForLogin,n);yield _i(Uo.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*tv(e){let{payload:{callback:t}}=e,n=Ko(e.payload,iS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.enrollMFASMSForLoginV2,n);yield XS(e),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*nv(e){let{payload:{callback:t}}=e,n=Ko(e.payload,aS);yield _i(Uo.setLoginState({loading:!0}));try{var o;const e=yield Ui(Tf.auth.preEnrollMFAWebAuthnForLogin,n),i=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield _i(Uo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*ov(e){let{payload:{callback:t}}=e,n=Ko(e.payload,rS);yield _i(Uo.setLoginState({loading:!0}));try{const e=Et(n.publicKey),o=yield Ui(Tf.auth.enrollMFAWebAuthnForLoginV2,C({},n,{options:e}));yield XS(o),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*iv(e){let{payload:{callback:t}}=e,n=Ko(e.payload,lS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield XS(e),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*av(e){let{payload:{callback:t,deviceId:n}}=e,o=Ko(e.payload,sS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.preVerifyMFASMSForLogin,n,o);yield _i(Uo.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*rv(e){let{payload:{callback:t}}=e,n=Ko(e.payload,cS);try{const e=yield Ui(Tf.auth.preVerifyMFAEmailCode,n);yield _i(Uo.setMfaState({otcToken:e.otcToken,step:rn.emailVerifyCode})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({error:Ep(e)})),null==t||t(null)}}function*lv(e){let{payload:{callback:t}}=e,n=Ko(e.payload,uS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.verifyMFAEmailCodeV2,n);yield ZS(e),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*sv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ko(e.payload,dS);yield _i(Uo.setLoginState({loading:!0}));try{const e=yield Ui(Tf.auth.verifyMFASMSForLoginV2,n,o);yield ZS(e),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*cv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ko(e.payload,yS);yield _i(Uo.setLoginState({loading:!0}));try{var i;const e=yield Ui(Tf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield _i(Uo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*uv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ko(e.payload,fS);yield _i(Uo.setLoginState({loading:!0}));try{const e=Et(o.publicKey),i=yield Ui(Tf.auth.verifyMFAWebAuthnForLoginV2,n,C({},o,{options:e}));yield ZS(i),yield _i(Uo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)})),null==t||t(null)}}function*dv({payload:e}){yield _i(Uo.setLoginState({loading:!0}));try{yield Ui(Tf.auth.forgotPassword,e),yield _i(Uo.setLoginState({loading:!1,error:void 0,step:It.breachedPasswordSuccess})),yield _i(Uo.setState({isAuthenticated:!1}))}catch(e){yield _i(Uo.setLoginState({loading:!1,error:Ep(e)}))}}function*yv(){yield _a(Uo.requestAuthorize,LS),yield _a(Uo.requestAuthorizeSSR,wS),yield _a(Uo.requestHostedLoginAuthorize,CS),yield _a(Uo.handleHostedLoginCallback,US),yield _a(Uo.preLogin,xS),yield _a(Uo.postLogin,HS),yield _a(Uo.login,zS),yield _a(Uo.logout,JS),yield _a(Uo.silentLogout,QS),yield _a(Uo.loginWithMfa,qS),yield _a(Uo.recoverMfa,YS),yield _a(Uo.quickSmsPasswordlessPreLogin,NS),yield _a(Uo.changePhoneNumberWithVerification,RS),yield _a(Uo.verifyChangePhoneNumber,DS),yield _a(Uo.passwordlessPreLogin,MS),yield _a(Uo.passwordlessPostLogin,GS),yield _a(Uo.verifyInviteToken,$S),yield _a(Uo.webAuthnPrelogin,WS),yield _a(Uo.webAuthnPostLogin,KS),yield _a(Uo.webAuthnCreateNewDeviceSession,jS),yield _a(Uo.webAuthnVerifyNewDeviceSession,BS),yield _a(Uo.afterAuthNavigation,SS),yield _a(Uo.getUserIP,OS),yield _a(Uo.preEnrollMFASMSForLogin,ev),yield _a(Uo.enrollMFASMSForLogin,tv),yield _a(Uo.preEnrollMFAWebAuthnForLogin,nv),yield _a(Uo.enrollMFAWebAuthnForLogin,ov),yield _a(Uo.enrollMFAAuthenticatorAppForLogin,iv),yield _a(Uo.preVerifyMFASMSForLogin,av),yield _a(Uo.verifyMFASMSForLogin,sv),yield _a(Uo.preVerifyMFAWebAuthnForLogin,cv),yield _a(Uo.verifyMFAWebAuthnForLogin,uv),yield _a(Uo.preVerifyMFAEmailCode,rv),yield _a(Uo.verifyMFAEmailCode,lv),yield _a(Uo.resetBreachedPassword,dv)}function*fv({payload:e}){e&&(yield _i(Uo.setState({isLoading:!0})));const t=qf;yield _i(Uo.loadTenants()),yield _i(Uo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*pv({payload:{callback:e}}){try{const{ip:t}=gp[0];yield _i(Uo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*gv(){yield _a(Uo.requestAuthorize,fv),yield _a(Uo.afterAuthNavigation,SS),yield _a(Uo.getUserIP,pv)}const Sv=["callback","samlVendor"],vv=["callback","samlVendor"];function*hv(){try{var e,t;yield _i(Uo.setSSOState({loading:!0}));const n=yield Ui(Tf.auth.getSamlConfiguration),o=yield Ui(Tf.auth.getOidcConfiguration),i=yield Ui(Tf.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield _i(Uo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield _i(Uo.setSSOState({error:Ep(e),loading:!1}))}}function*mv({payload:e}){const t=yield Ni((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield _i(Uo.setSSOState({error:void 0,[n]:!0}));try{const o=yield jf(e[0]),i=yield Ui(Tf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield _i(Uo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield _i(Uo.setSSOState({samlConfiguration:t,error:Ep(e),[n]:!1}))}}function*Av({payload:e}){const{configFile:t,callback:n}=e,o=yield Ni((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield _i(Uo.setSSOState({error:void 0,[i]:!0}));try{const e=yield jf(t),a=yield Ui(Tf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield _i(Uo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield _i(Uo.setSSOState({samlConfiguration:o,error:Ep(e),[i]:!1})),null==n||n(null,e)}}function*bv({payload:e}){const{callback:t,samlVendor:n}=e,o=Ko(e,Sv),i=yield Ni((e=>e.auth.ssoState.samlConfiguration)),a=C({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield _i(Uo.setSSOState({samlConfiguration:C({},i,a)})));if(yield _i(Uo.setSSOState({error:void 0,[r]:!0})),e.type===If.Saml){var l,s;const e=yield Ui(Tf.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 o=$f(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield Ui(Tf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield _i(Uo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setSSOState({samlConfiguration:i,error:Ep(e),[r]:!1})),null==t||t(null,e)}}function*Tv({payload:{callback:e}={}}){const t=yield Ni((e=>e.auth.ssoState.samlConfiguration));try{yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield Ui(Tf.auth.validateSamlDomain),yield _i(Uo.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield _i(Uo.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:Ep(n),saving:!1})),null==e||e(null,n)}}function*kv(){try{const e=yield Ui(Tf.auth.getSamlRoles),t=yield Ui(Tf.auth.getSamlRolesGroups);yield _i(Uo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield _i(Uo.setSSOState({error:Ep(e)}))}}function*Ev({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield Ui(Tf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield wi(e.map((e=>Ui(Tf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield _i(Uo.setSSOState({error:Ep(e)}))}}(n)),yield kv(),yield _i(Uo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield _i(Uo.setSSOState({error:Ep(t),saving:!1})),null==e||e(null,t)}}function*Iv({payload:{callback:e,id:t}}){try{yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield Ui(Tf.auth.deleteSamlGroup,{id:t}),yield kv(),yield _i(Uo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield _i(Uo.setSSOState({error:Ep(t),saving:!1})),null==e||e(null,t)}}function*Pv({payload:{group:e,roleIds:t,callback:n}}){try{yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield Ui(Tf.auth.createSamlGroup,{group:e,roleIds:t}),yield kv(),yield _i(Uo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield _i(Uo.setSSOState({error:Ep(e),saving:!1})),null==n||n(null,e)}}function*Ov({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield _i(Uo.setSSOState({loading:!0})),yield Ui(Tf.auth.oidcPostLoginV2,t),yield Ui(bS),yield _i(Uo.setSSOState({loading:!1}))}catch(e){yield _i(Uo.setSSOState({loading:!1,error:Ep(e,"Failed to authenticate"),firstLoad:!1}))}}function*Lv(){yield Oa(Uo.loadSSOConfigurations,hv),yield Oa(Uo.saveSSOConfigurations,bv),yield Oa(Uo.saveSSOConfigurationsFile,mv),yield Oa(Uo.saveSSOConfigurationsFileWithCallback,Av),yield Oa(Uo.validateSSODomain,Tv),yield Oa(Uo.loadSSOAuthorizationRoles,kv),yield Oa(Uo.updateSSOAuthorizationRoles,Ev),yield Oa(Uo.deleteSamlGroup,Iv),yield Oa(Uo.createSamlGroup,Pv),yield Oa(Uo.oidcPostlogin,Ov)}function*_v(){yield _i(Uo.setSSOState({loading:!0})),yield At(),yield _i(Uo.setSSOState({samlConfiguration:tp,loading:!1,firstLoad:!1}))}function*wv({payload:e}){const t="saving";yield _i(Uo.setSSOState({error:void 0,[t]:!0}));const n=C({},yield Ni((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield _i(Uo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Cv({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ko(e,vv),r=ip.samlConfiguration,l=C({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield _i(Uo.setSSOState({samlConfiguration:C({},r,l)})));yield _i(Uo.setSSOState({error:void 0,[s]:!0})),yield At(),l.acsUrl=null==np||null==(t=np.configuration)?void 0:t.acsUrl,l.spEntityId=null==np||null==(n=np.configuration)?void 0:n.spEntityId;const c=$f(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==i?void 0:i.toLowerCase(),yield At(),yield _i(Uo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*Uv({payload:{callback:e}={}}){const t=ip.samlConfiguration;yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield At(),yield _i(Uo.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Rv(){yield At(),yield _i(Uo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Dv({payload:{callback:e,authorizationRoles:t}}){yield _i(Uo.setSSOState({error:void 0,saving:!0})),yield At(),yield _i(Uo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Nv(){yield Oa(Uo.loadSSOConfigurations,_v),yield Oa(Uo.saveSSOConfigurations,Cv),yield Oa(Uo.saveSSOConfigurationsFile,wv),yield Oa(Uo.validateSSODomain,Uv),yield Oa(Uo.loadSSOAuthorizationRoles,Rv),yield Oa(Uo.updateSSOAuthorizationRoles,Dv)}const Mv=["callback"],Fv=["callback","ssoConfigId"],Gv=["callback","ssoConfigId"],$v=["callback","ssoConfigId"];function*xv(){try{return yield Ui(Tf.auth.getOidcConfiguration)}catch(e){return null}}function*Vv(){try{return yield Ui(Tf.metadata.getSamlMetadata)}catch(e){return null}}function*jv(){try{yield _i(Uo.setSSOLoader({key:Ef.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield wi([Ui(xv),Ui(Vv)]),n=yield Ui(Tf.auth.getSSOConfigurations);yield _i(Uo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield _i(Uo.setSSOError({key:Ef.LOAD_SSO_CONFIGURATIONS,value:Ep(e)}))}finally{yield _i(Uo.setSSOLoader({key:Ef.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Bv({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ko(e,Mv),o=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ui(Tf.auth.createSSOConfiguration,C({},n,{enabled:null!=(i=n.enabled)&&i}));yield _i(Uo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield _i(Uo.setSSOError({key:Ef.SAVE_SSO_CONFIGURATION,value:Ep(e)})),null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Wv({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jf(t),i=yield Ui(Tf.auth.createSSOConfigurationByMetadata,{metadata:e});yield _i(Uo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield _i(Uo.setSSOError({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Ep(e)})),null==n||n(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Kv({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ko(e,Fv),i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ui(Tf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield _i(Uo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield _i(Uo.setSSOError({key:Ef.UPDATE_SSO_CONFIGURATION,value:Ep(e)})),null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Hv({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield jf(o),a=yield Ui(Tf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield _i(Uo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield _i(Uo.setSSOError({key:Ef.UPDATE_SSO_CONFIGURATION,value:Ep(e)})),null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*zv({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(Tf.auth.deleteSSOConfiguration,t),yield _i(Uo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield _i(Uo.setSSOError({key:Ef.DELETE_SSO_CONFIGURATION,value:Ep(e)})),null==n||n(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.DELETE_SSO_CONFIGURATION,value:!1}))}}function*qv({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ko(e,Gv);yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_DOMAIN,value:!0}));const i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ui(Tf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield _i(Uo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield _i(Uo.setSSOError({key:Ef.SAVE_SSO_DOMAIN,value:Ep(e)})),null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_DOMAIN,value:!1}))}}function*Yv({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield _i(Uo.setSSOLoader({key:Ef.DELETE_SSO_DOMAIN,value:!0}));const i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(Tf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield _i(Uo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield _i(Uo.setSSOError({key:Ef.DELETE_SSO_DOMAIN,value:Ep(e)})),null==o||o(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.DELETE_SSO_DOMAIN,value:!1}))}}function*Jv({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield _i(Uo.setSSOLoader({key:Ef.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(Tf.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield _i(Uo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield _i(Uo.setSSOError({key:Ef.VALIDATE_SSO_DOMAIN,value:Ep(e)})),null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Qv({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(Tf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield _i(Uo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield _i(Uo.setSSOError({key:Ef.UPDATE_SSO_DEFAULT_ROLES,value:Ep(t)})),null==e||e(null,t)}finally{yield _i(Uo.setSSOLoader({key:Ef.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Xv({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_GROUPS,value:!0}));const i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{yield wi(t.map((e=>Ui(Tf.auth.deleteSSOGroup,n,e)))),yield wi(e.map((e=>Ui(Tf.auth.createSSOGroup,n,e))));const a=yield Ui(Tf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?C({},e,{groups:a}):e));yield _i(Uo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield _i(Uo.setSSOError({key:Ef.SAVE_SSO_GROUPS,value:Ep(e)})),null==o||o(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_GROUPS,value:!1}))}}function*Zv({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield wi(t.map((t=>Ui(Tf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield _i(Uo.setSSOError({key:Ef.SAVE_SSO_GROUPS,value:Ep(e)})),null==n||n(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_GROUPS,value:!1}))}}function*eh({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield Ui(mr,t,void 0,{responseType:"plain"}),configMetadata:n};let r,l;o?(r=yield Ui(Tf.auth.updateSSOConfigurationByMetadata,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ui(Tf.auth.createSSOConfigurationByMetadata,e),l=[r,...a]),yield _i(Uo.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*th({payload:e}){yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ko(e,$v),i=yield Ni((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ui(Tf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ui(Tf.auth.createSSOConfiguration,o),a=[e,...i]),yield _i(Uo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield _i(Uo.setSSOLoader({key:Ef.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*nh(){yield Oa(Uo.loadSSOConfigurationsV2,jv),yield Oa(Uo.saveSSOConfigurationV2,Bv),yield Oa(Uo.saveSSODomain,qv),yield Oa(Uo.deleteSSODomain,Yv),yield Oa(Uo.validateSSODomainV2,Jv),yield Oa(Uo.updateSSOConfiguration,Kv),yield Oa(Uo.deleteSSOConfiguration,zv),yield Oa(Uo.setSSOGroups,Xv),yield Oa(Uo.updateSSOGroups,Zv),yield Oa(Uo.setSSODefaultRoles,Qv),yield Oa(Uo.saveSSOConfigurationByMetadata,Wv),yield Oa(Uo.updateSSOConfigurationByMetadata,Hv),yield Oa(Uo.saveSSOConfigurationByUrl,eh),yield Oa(Uo.saveSSOConfigurationByData,th)}const oh=["callback","profilePictureUrl"],ih=["callback","profilePictureUrl"];function*ah(){yield _i(Uo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return Ui.apply(void 0,[Pa,e,t,n].concat(i))}(3,2e3,Tf.teams.getProfile),t=yield Ni((e=>e.auth.user));Uo.setUser(C({},t,e)),yield _i(Uo.setProfileState({profile:e,loading:!1}))}catch(e){yield _i(Uo.setProfileState({loading:!1,error:Ep(e)}))}}function*rh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ko(e.payload,oh);yield _i(Uo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Ni((e=>e.auth.profileState.profile));let i=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 o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield Ui(Tf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=C({},e,o,{profilePictureUrl:i}),r=yield Ui(Tf.users.updateUserProfileV2,a),l=yield Ni((e=>e.auth.user));yield _i(Uo.setUser(C({},l,r))),yield _i(Uo.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield _i(Uo.setProfileState({saving:!1,error:Ep(e),loading:!1})),null==t||t(null,e)}}function*lh({payload:e}){yield _i(Uo.setProfileState({loading:!0}));try{var t;yield Ui(Tf.teams.changePassword,e),yield _i(Uo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setProfileState({loading:!1,error:Ep(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*sh(){yield _a(Uo.loadProfile,ah),yield Oa(Uo.saveProfile,rh),yield Oa(Uo.changePassword,lh)}function*ch(){yield _i(Uo.setProfileState({loading:!0})),yield At(),yield _i(Uo.setUser(C({},qf,zf))),yield _i(Uo.setProfileState({loading:!1,profile:zf}))}function*uh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ko(e.payload,ih);yield _i(Uo.setProfileState({saving:!0,error:null}));const i=Yf;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},i.profile,o,{profilePictureUrl:a}),l=qf;yield At(),yield _i(Uo.setUser(C({},l,r))),yield _i(Uo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*dh({payload:e}){var t;yield _i(Uo.setProfileState({loading:!0})),yield At(),yield _i(Uo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*yh(){yield _a(Uo.loadProfile,ch),yield Oa(Uo.saveProfile,uh),yield Oa(Uo.changePassword,dh)}const fh=["callback"],ph=["callback"],gh=["user"],Sh=["callback"],vh=["deviceId","callback"],hh=["deviceId","callback"],mh=["callback"],Ah=["deviceId"],bh=["deviceId"],Th=["callback"],kh=["deviceId"],Eh=["callback"];function*Ih(e){const{step:t}=yield Ni((e=>e.auth.mfaState));return{step:e.recoveryCode?rn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Ph(){yield _i(Uo.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ui(Tf.auth.enrollMfa);yield _i(Uo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)}))}}function*Oh(e){let{payload:{callback:t}}=e,n=Ko(e.payload,fh);yield _i(Uo.setMfaState({saving:!0}));try{const e=yield Ni((e=>e.auth.user)),o=yield Ui(Tf.auth.verifyMfa,n),i=yield Ui(Tf.auth.getMFADevices),a=yield Ih(o);yield _i(Uo.setMfaState(C({},a,{mfaDevices:i}))),yield _i(Uo.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*Lh(e){let{payload:{callback:t}}=e,n=Ko(e.payload,ph);yield _i(Uo.setMfaState({loading:!0}));try{const e=yield Ui(Tf.auth.loginWithMfaV2,n),{user:o}=e,i=Ko(e,gh),a={step:rn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield _i(Uo.setMfaState(a)),yield gS(C({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield _i(Uo.setMfaState({loading:!1,error:Ep(e)})),null==t||t(null,e)}}function*_h({payload:e}){yield _i(Uo.setMfaState({saving:!0}));try{var t;yield Ui(Tf.auth.disableMfa,e);const n=yield Ui(Tf.auth.getMFADevices);yield _i(Uo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setMfaState({saving:!1,error:Ep(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*wh({payload:e}){yield _i(Uo.setMfaState({saving:!0}));try{var t,n;const o=yield Ui(Tf.auth.preEnrollMFAWebAuthn),i=C({},o.options,{challenge:kt(o.options.challenge),user:C({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield _i(Uo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield _i(Uo.setMfaState({saving:!1,error:Ep(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*Ch(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Sh);yield _i(Uo.setMfaState({saving:!0}));try{const e=Et(n.publicKey),o=yield Ui(Tf.auth.enrollMFAWebAuthn,C({},n,{options:e})),i=yield Ui(Tf.auth.getMFADevices),a=yield Ih(o);yield _i(Uo.setMfaState(C({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*Uh(e){let{payload:{deviceId:t,callback:n}}=e;Ko(e.payload,vh),yield _i(Uo.setMfaState({saving:!0}));try{var o;const e=yield Ui(Tf.auth.preDisableMFAWebAuthn,t),i=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield _i(Uo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==n||n(null,e)}}function*Rh(e){let{payload:{deviceId:t,callback:n}}=e,o=Ko(e.payload,hh);yield _i(Uo.setMfaState({saving:!0}));try{const e=Et(o.publicKey);yield Ui(Tf.auth.disableMFAWebAuthn,t,C({},o,{options:e}));const i=yield Ui(Tf.auth.getMFADevices);yield _i(Uo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==n||n(!1,e)}}function*Dh({payload:e}){yield _i(Uo.setMfaState({saving:!0}));try{var t;const n=yield Ui(Tf.auth.preEnrollMFASMS,e);yield _i(Uo.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setMfaState({saving:!1,error:Ep(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Nh(e){let{payload:{callback:t}}=e,n=Ko(e.payload,mh);yield _i(Uo.setMfaState({saving:!0}));try{const e=yield Ui(Tf.auth.enrollMFASMS,n),o=yield Ui(Tf.auth.getMFADevices),i=yield Ih(e);yield _i(Uo.setMfaState(C({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*Mh(e){let{payload:{deviceId:t}}=e,n=Ko(e.payload,Ah);yield _i(Uo.setMfaState({saving:!0}));try{var o;const e=yield Ui(Tf.auth.preDisableMFASMS,t);yield _i(Uo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Fh(e){let{payload:{deviceId:t}}=e,n=Ko(e.payload,bh);yield _i(Uo.setMfaState({saving:!0}));try{var o;yield Ui(Tf.auth.disableMFASMS,t,n);const e=yield Ui(Tf.auth.getMFADevices);yield _i(Uo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Gh(){yield _i(Uo.setMfaState({loading:!0}));try{yield Ni((e=>e.auth.user));const e=yield Ui(Tf.auth.getMFADevices);yield _i(Uo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield _i(Uo.setMfaState({loading:!1,error:Ep(e)}))}}function*$h(){yield _i(Uo.setMfaState({loading:!0}));try{const e=(yield Ui(Tf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield _i(Uo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield _i(Uo.setMfaState({loading:!1,error:Ep(e)}))}}function*xh(){yield Oa(Uo.enrollMfa,Ph),yield Oa(Uo.getMFADevices,Gh),yield Oa(Uo.getMFAStrategies,$h),yield Oa(Uo.verifyMfa,Oh),yield Oa(Uo.disableMfa,_h),yield Oa(Uo.verifyMfaAfterForce,Lh),yield Oa(Uo.preDisableMfaSms,Mh),yield Oa(Uo.disableMfaSms,Fh),yield Oa(Uo.preEnrollMfaSms,Dh),yield Oa(Uo.enrollMfaSms,Nh),yield Oa(Uo.preEnrollMfaWebAuthn,wh),yield Oa(Uo.enrollMfaWebAuthn,Ch),yield Oa(Uo.preDisableMfaWebAuthn,Uh),yield Oa(Uo.disableMfaWebAuthn,Rh)}function*Vh(){yield _i(Uo.setMfaState({saving:!0})),yield _i(Uo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*jh({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Ni((e=>e.auth.mfaState));yield _i(Uo.setMfaState({saving:!0})),yield At();const n={token:"token",recoveryCode:"recoveryCode"},o={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield _i(Uo.setMfaState(o)),yield _i(Uo.setUser(C({},qf,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Bh(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Th);yield _i(Uo.setMfaState({loading:!0})),yield At();const o=C({},n,{recoveryCode:"recoveryCode"}),i={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield _i(Uo.setMfaState(i)),yield At(),yield _i(Uo.setUser(C({},qf,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Wh({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ni((e=>e.auth.mfaState));yield _i(Uo.setMfaState({saving:!0})),yield At(),yield _i(Uo.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield _i(Uo.setUser(C({},qf))),null==(t=e.callback)||t.call(e,!0)}function*Kh(e){let{}=e,t=Ko(e.payload,kh);yield _i(Uo.setMfaState({saving:!0}));try{var n;yield _i(Uo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield _i(Uo.setMfaState({saving:!1,error:Ep(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Hh({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ni((e=>e.auth.mfaState));yield _i(Uo.setMfaState({saving:!0})),yield At(),yield _i(Uo.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield _i(Uo.setUser(C({},qf))),null==(t=e.callback)||t.call(e,!0)}function*zh({payload:e}){var t;yield _i(Uo.setMfaState({saving:!0})),yield At(),yield _i(Uo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*qh(e){let{payload:{callback:t}}=e;Ko(e.payload,Eh);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Ni((e=>e.auth.mfaState));yield _i(Uo.setMfaState({saving:!0})),yield At();const o={token:"token",recoveryCode:"recoveryCode"},i={step:rn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield _i(Uo.setMfaState(i)),yield _i(Uo.setUser(C({},qf,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Yh(){yield Oa(Uo.enrollMfa,Vh),yield Oa(Uo.verifyMfa,jh),yield Oa(Uo.disableMfa,Wh),yield Oa(Uo.verifyMfaAfterForce,Bh),yield Oa(Uo.preDisableMfaSms,Kh),yield Oa(Uo.disableMfaSms,Hh),yield Oa(Uo.preEnrollMfaSms,zh),yield Oa(Uo.enrollMfaSms,qh)}const Jh=["callback"];function*Qh({payload:e}){yield _i(Uo.setForgotPasswordState({loading:!0}));try{var t;yield Ui(Tf.auth.forgotPassword,e),yield _i(Uo.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setForgotPasswordState({loading:!1,error:Ep(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Xh(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Jh);yield _i(Uo.setForgotPasswordState({loading:!0}));try{yield Ui(Tf.auth.resetPassword,n),yield _i(Uo.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==t||t(!0)}catch(e){yield _i(Uo.setForgotPasswordState({loading:!1,error:Ep(e)})),null==t||t(!1,e)}}function*Zh({payload:e}){yield _i(Uo.setForgotPasswordState({loading:!0}));try{const t=yield Ui(Tf.auth.loadPasswordConfig,e);yield _i(Uo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield _i(Uo.setForgotPasswordState({loading:!1,error:Ep(e)}))}}function*em(){yield _a(Uo.forgotPassword,Qh),yield _a(Uo.resetPassword,Xh),yield _a(Uo.loadPasswordConfig,Zh)}let tm;!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"}(tm||(tm={}));const nm=["callback","events"],om=["user"],im=["callback"],am=["callback"];function*rm({payload:{userId:e,token:t}}){yield _i(Uo.setActivateState({loading:!0,step:Ft.activating}));try{const{isAuthenticated:n}=yield Ni((e=>e.auth));n&&(yield _i(Uo.silentLogout()));const o=yield Ui(Tf.auth.getActivateAccountStrategy,{userId:e,token:t});yield _i(Uo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield _i(Uo.setActivateState({loading:!1,step:Ft.activatingForm})))}catch(e){yield _i(Uo.setActivateState({loading:!1,error:Ep(e)}))}}function*lm(e){let{payload:{callback:t,events:n}}=e,o=Ko(e.payload,nm);yield _i(Uo.setActivateState({loading:!0}));try{const e=wa.onRedirectTo,{routes:a}=yield Ni((e=>e.auth)),r=yield Ui(Tf.auth.activateAccountV2,o),{user:l}=r,s=Ko(r,om);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(_p(l)){yield _i(Uo.setActivateState({step:Ft.success}));const t=yield mS(l);yield _i(Uo.setState(t)),yield Mi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield _i(Uo.setActivateState({step:Ft.success})),null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:bp.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Ui(gS,C({user:l},s),{isAuthenticated:!0}),yield Mi(1e3),yield SS(),yield _i(Uo.resetActivateState())}null==t||t(!0)}catch(e){yield _i(Uo.setActivateState({loading:!1,error:Ep(e)}))}}function*sm({payload:e}){const{callback:t}=e,n=Ko(e,im);yield _i(Uo.setActivateStrategyState({loading:!0}));try{const e=yield Ui(Tf.auth.getActivateAccountStrategy,n);yield _i(Uo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield _i(Uo.setActivateStrategyState({loading:!1,error:Ep(e)}))}}function*cm({payload:e}){const{callback:t}=e,n=Ko(e,am);yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.email})),yield _i(Uo.setActivateState({loading:!0}));try{yield Ui(Tf.auth.resendActivationEmail,n),yield _i(Uo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield _i(Uo.setActivateState({loading:!1,error:Ep(e)})),yield _i(Uo.setTeamError({key:tm.RESEND_ACTIVATE_LINK,value:Ep(e)})),null==t||t(null,e)}yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*um(){yield _a(Uo.activateAccount,lm),yield _a(Uo.preActivateAccount,rm),yield _a(Uo.getActivateAccountStrategy,sm),yield _a(Uo.resendActivationEmail,cm)}function*dm({payload:e}){if(e.token&&e.userId)try{yield _i(Uo.setAcceptInvitationState({error:void 0,step:Vt.pending})),yield Ui(Tf.auth.acceptInvitation,e),yield _i(Uo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Vt.success}}))}catch(e){yield _i(Uo.setAcceptInvitationState({step:Vt.failed,error:Ep(e)}))}else yield _i(Uo.setAcceptInvitationState({error:void 0,step:Vt.invalid}))}function*ym(){yield _a(Uo.acceptInvitation,dm)}var fm,pm=new Uint8Array(16);function gm(){if(!fm&&!(fm="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 fm(pm)}for(var Sm=/^(?:[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,vm=function(e){return"string"==typeof e&&Sm.test(e)},hm=[],mm=0;mm<256;++mm)hm.push((mm+256).toString(16).substr(1));var Am=function(e,t,n){var o=(e=e||{}).random||(e.rng||gm)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(hm[e[t+0]]+hm[e[t+1]]+hm[e[t+2]]+hm[e[t+3]]+"-"+hm[e[t+4]]+hm[e[t+5]]+"-"+hm[e[t+6]]+hm[e[t+7]]+"-"+hm[e[t+8]]+hm[e[t+9]]+"-"+hm[e[t+10]]+hm[e[t+11]]+hm[e[t+12]]+hm[e[t+13]]+hm[e[t+14]]+hm[e[t+15]]).toLowerCase();if(!vm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let bm,Tm;!function(e){e.CREATE_GROUP="CREATE_GROUP",e.GET_GROUP="GET_GROUP",e.GET_GROUPS="GET_GROUPS",e.DELETE_GROUP="DELETE_GROUP",e.UPDATE_GROUP="UPDATE_GROUP",e.ADD_USERS_TO_GROUP="ADD_USERS_TO_GROUP",e.DELETE_USERS_FROM_GROUP="DELETE_USERS_FROM_GROUP",e.ADD_ROLES_TO_GROUP="ADD_ROLES_TO_GROUP",e.DELETE_ROLES_FROM_GROUP="DELETE_ROLES_FROM_GROUP",e.GET_GROUP_CONFIGURATION="GET_GROUP_CONFIGURATION",e.UPDATE_GROUP_CONFIGURATION="UPDATE_GROUP_CONFIGURATION",e.GET_TEAM_USERS="GET_TEAM_USERS"}(bm||(bm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Tm||(Tm={}));const km=["callback"],Em=["roles"],Im=["callback"],Pm=["callback","profileImage"],Om=["callback"],Lm=["callback","userId"],_m=["callback"],wm=["callback"],Cm=["callback"],Um=["callback"],Rm=["callback"],Dm=["callback"],Nm=["callback"],Mm=["callback","profileImage"],Fm=["callback"],Gm=["callback"],$m=["callback"],xm=["callback"],Vm=["callback"],jm=["callback"],Bm=()=>Ni((e=>e.auth.teamState));function*Wm(){try{const{groups:e}=yield Ui(Tf.groups.getGroups,{_groupsRelations:Tm.roles});return e}catch(e){return[]}}function*Km({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c=null!=(t=e.pageSize)?t:s.pageSize,u=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(o=e.filter)?o:s.filterV2,y=null!=(i=e.sort)?i:s.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==s?void 0:s.shouldShowSubTenantUsersIfReseller;yield _i(Uo.setTeamLoader({key:tm.USERS,value:!r})),yield _i(Uo.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield wi([Ui(Tf.users.getUsersV2,C({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Ui(Tf.teams.loadAvailableRoles),Ui(Tf.teams.loadAvailablePermissions),Ui(Wm)]),s=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield _i(Uo.setTeamState({users:s.map((e=>C({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:o,roles:i,permissions:a})),null==l||l(t)}catch(e){yield _i(Uo.setTeamError({key:tm.USERS,value:Ep(e)})),yield _i(Uo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield _i(Uo.setTeamLoader({key:tm.USERS,value:!1}))}function*Hm({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Bm(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield _i(Uo.setTeamLoader({key:tm.USERS,value:!a})),yield _i(Uo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield wi([Ui(Tf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ui(Tf.teams.loadAvailableRoles),Ui(Tf.teams.loadAvailablePermissions)]);yield _i(Uo.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield _i(Uo.setTeamError({key:tm.USERS,value:e.message})),yield _i(Uo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield _i(Uo.setTeamLoader({key:tm.USERS,value:!1}))}function*zm({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield _i(Uo.setTeamLoader({key:tm.USERS,value:!r})),yield _i(Uo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield wi([Ui(Tf.subTenants.loadAllUsers,C({},c)),Ui(Tf.teams.loadAvailableRoles),Ui(Tf.teams.loadAvailablePermissions)]);yield _i(Uo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield _i(Uo.setTeamError({key:tm.USERS,value:Ep(e)})),yield _i(Uo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield _i(Uo.setTeamLoader({key:tm.USERS,value:!1}))}function*qm({payload:e}){yield _i(Uo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield wi([Ui(Tf.teams.loadAvailableRoles),Ui(Tf.teams.loadAvailablePermissions)]);yield _i(Uo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield _i(Uo.setTeamError({key:tm.ROLES_AND_PERMISSIONS,value:Ep(t)}))}yield _i(Uo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0}))}function*Ym({payload:e}){const{callback:t}=e,n=Ko(e,km),o=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ui(Tf.teams.addUser,n),{roles:a}=e,r=C({},Ko(e,Em),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield _i(Uo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:Ep(e)})})),null==t||t(null,e)}}function*Jm({payload:e}){const{callback:t}=e,n=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield _i(Uo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Ui(Tf.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield _i(Uo.loadUsersV2(r)),yield _i(Uo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Qm({payload:e}){const{callback:t}=e,n=Ko(e,Im),o=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield Ui(Tf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ui(Tf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield _i(Uo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:Ep(e)})})),null==t||t(null,e)}}function*Xm({payload:e}){const{callback:t}=e,n=Ko(e,Pm),{id:o}=n,i=yield Bm(),a=i.users.find((e=>e.id===n.id));yield _i(Uo.setTeamLoader({key:tm.UPDATE_USER,value:o||""})),yield _i(Uo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield _i(Uo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?C({},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 Ui(Tf.teams.updateUser,n);null==t||t(e),yield _i(Uo.setTeamState({users:i.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield _i(Uo.setTeamLoader({key:tm.UPDATE_USER,value:!1}))}catch(e){yield _i(Uo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:Ep(e)}),users:i.users.map((e=>e.id===n.id?C({},e,a):e))})),yield _i(Uo.setTeamLoader({key:tm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Zm({payload:e}){const{callback:t}=e,n=Ko(e,Om),o=yield Bm();yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Ui(Tf.teams.deleteUser,n),null==t||t(!0),yield _i(Uo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:Ep(e)})})),null==t||t(null,e)}}function*eA({payload:e}){const{callback:t,userId:n}=e,o=Ko(e,Lm),i=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield Ui(Tf.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield _i(Uo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield _i(Uo.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:Ep(e)})})),null==t||t(null,e)}}function*tA({payload:e}){const{callback:t}=e,n=Ko(e,_m),o=yield Bm();yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Ui(Tf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield _i(Uo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:Ep(e)})})),null==t||t(null,e)}}function*nA({payload:e}){const{callback:t}=e,n=Ko(e,wm);yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ui(Tf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield _i(Uo.setTeamError({key:tm.RESEND_ACTIVATE_LINK,value:Ep(e)})),null==t||t(null,e)}yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*oA({payload:e}){const{callback:t}=e,n=Ko(e,Cm);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ui(Tf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield _i(Uo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:Ep(e)})),null==t||t(null,e)}yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*iA({payload:e}){const{callback:t}=e,n=Ko(e,Um);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ui(Tf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield _i(Uo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:Ep(e)})),null==t||t(null,e)}yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*aA({payload:e}){const{callback:t}=e,n=Ko(e,Rm);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ui(Tf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield _i(Uo.setTeamError({key:tm.RESEND_INVITATION_LINK,value:Ep(e)})),null==t||t(null,e)}yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*rA(){yield _i(Uo.setTeamError({key:tm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ui(Tf.teams.getInviteLinkConfiguration);yield _i(Uo.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield _i(Uo.setTeamError({key:tm.CONFIG_TOKEN_LINK,value:Ep(e)}))}}function*lA(){yield _i(Uo.setTeamError({key:tm.GET_TOKEN_LINK,value:!1}));try{yield Ui(rA);const e=yield Ui(Tf.teams.getInviteUserLink),{inviteTokenState:t}=yield Bm();yield _i(Uo.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield _i(Uo.setTeamError({key:tm.GET_TOKEN_LINK,value:Ep(e)}))}}function*sA({payload:{callback:e}}){yield _i(Uo.setTeamError({key:tm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Bm();try{const n=yield Ui(Tf.teams.createInviteUserLink,{expiresInMinutes:43200});yield _i(Uo.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield _i(Uo.setTeamError({key:tm.CREATE_TOKEN_LINK,value:Ep(t)}))}}function*cA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield Bm();yield _i(Uo.setTeamError({key:tm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ui(Tf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield _i(Uo.setTeamState({inviteTokenState:C({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield _i(Uo.setTeamError({key:tm.UPDATE_TOKEN_LINK,value:Ep(t)}))}}function*uA({payload:e}){const{callback:t}=null!=e?e:{};yield _i(Uo.setTeamError({key:tm.DELETE_TOKEN_LINK,value:!1}));try{yield Ui(Tf.teams.deleteInviteUserLink),yield _i(Uo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield _i(Uo.setTeamError({key:tm.DELETE_TOKEN_LINK,value:Ep(e)})),null==t||t(!1,e)}}function*dA({payload:e}){yield _i(Uo.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*yA({payload:e}){const t=yield Bm(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield _i(Uo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*fA({payload:e}){yield _i(Uo.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*pA({payload:e}){const t=yield Bm(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield _i(Uo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*gA(){yield La(Uo.loadUsers,Hm),yield La(Uo.loadUsersV2,Km),yield La(Uo.loadAllSubTenantsUsers,zm),yield La(Uo.loadRoles,qm),yield Oa(Uo.addUser,Ym),yield Oa(Uo.addUsersBulk,Jm),yield Oa(Uo.addUserToSubTenants,Qm),yield Oa(Uo.updateUser,Xm),yield Oa(Uo.setUserRolesForSubTenants,eA),yield Oa(Uo.deleteUser,Zm),yield Oa(Uo.deleteUserFromSubTenants,tA),yield Oa(Uo.resendActivationLink,nA),yield Oa(Uo.resendInvitationLink,oA),yield Oa(Uo.resendInvitationEmail,iA),yield Oa(Uo.resendInvitationLinkToAllSubTenants,aA),yield Oa(Uo.getInvitationLink,lA),yield Oa(Uo.createInvitationLink,sA),yield Oa(Uo.updateInvitationLink,cA),yield Oa(Uo.deleteInvitationLink,uA),yield Oa(Uo.openAddUserDialog,dA),yield Oa(Uo.closeAddUserDialog,yA),yield Oa(Uo.openDeleteUserDialog,fA),yield Oa(Uo.closeDeleteUserDialog,pA)}function*SA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield Bm(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filterV2,d=null!=(i=e.sort)?i:l.sortV2;yield _i(Uo.setTeamLoader({key:tm.USERS,value:!a})),yield _i(Uo.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield At(),yield _i(Uo.setTeamState({users:cp,totalPages:2,totalItems:10,roles:op,permissions:ap})),yield _i(Uo.setTeamLoader({key:tm.USERS,value:!1})),null==r||r(cp)}function*vA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield Bm(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield _i(Uo.setTeamLoader({key:tm.USERS,value:!r})),yield _i(Uo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield At(),yield _i(Uo.setTeamState({allUsers:up,totalPages:2,totalItems:10,roles:op,permissions:ap})),yield _i(Uo.setTeamLoader({key:tm.USERS,value:!1})),null==l||l(up)}function*hA({payload:e}){var t;yield _i(Uo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0})),yield At(),yield _i(Uo.setTeamState({roles:op,permissions:ap})),yield _i(Uo.setTeamLoader({key:tm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:op,permissions:ap})}function*mA({payload:e}){const{callback:t}=e,n=Ko(e,Dm),o=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},lp,{groups:[]},n,{id:`${Am()}`});null==t||t(i),yield _i(Uo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*AA({payload:e}){const{callback:t}=e,n=Ko(e,Nm),o=yield Bm();yield _i(Uo.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},lp,n,{id:`${Am()}`});yield _i(Uo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*bA({payload:e}){var t;const{callback:n}=e,o=Ko(e,Mm),{id:i}=o,a=yield Bm(),r=a.users.find((e=>e.id===o.id));yield _i(Uo.setTeamLoader({key:tm.UPDATE_USER,value:i||""})),yield _i(Uo.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield _i(Uo.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?C({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield At();const l=C({},r,o);null==n||n(l),yield _i(Uo.setTeamState({users:a.users.map((e=>e.id===l.id?C({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield _i(Uo.setTeamLoader({key:tm.UPDATE_USER,value:!1}))}function*TA({payload:e}){const{callback:t}=e,n=Ko(e,Fm),o=yield Bm();yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield _i(Uo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*kA({payload:e}){const{callback:t}=e,n=Ko(e,Gm),o=yield Bm();yield _i(Uo.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield _i(Uo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*EA({payload:e}){const{callback:t}=e,n=Ko(e,$m);yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:n.userId})),yield At(),null==t||t(!0),yield _i(Uo.setTeamLoader({key:tm.RESEND_ACTIVATE_LINK,value:!1}))}function*IA({payload:e}){const{callback:t}=e,n=Ko(e,xm);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*PA({payload:e}){const{callback:t}=e,n=Ko(e,Vm);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*OA({payload:e}){const{callback:t}=e,n=Ko(e,jm);yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield _i(Uo.setTeamLoader({key:tm.RESEND_INVITATION_LINK,value:!1}))}function*LA(){yield La(Uo.loadUsersV2,SA),yield La(Uo.loadAllSubTenantsUsers,vA),yield La(Uo.loadRoles,hA),yield Oa(Uo.addUser,mA),yield Oa(Uo.addUserToSubTenants,AA),yield Oa(Uo.updateUser,bA),yield Oa(Uo.deleteUser,TA),yield Oa(Uo.deleteUserFromSubTenants,kA),yield Oa(Uo.resendActivationLink,EA),yield Oa(Uo.resendInvitationLink,IA),yield Oa(Uo.resendInvitationEmail,PA),yield Oa(Uo.resendInvitationLinkToAllSubTenants,OA),yield Oa(Uo.openAddUserDialog,dA),yield Oa(Uo.closeAddUserDialog,yA),yield Oa(Uo.openDeleteUserDialog,fA),yield Oa(Uo.closeDeleteUserDialog,pA)}const _A=["authorizationUrl"],wA=["events","url"];function*CA(){try{yield _i(Uo.setSocialLoginsState({loading:!0}));const e=yield Ui(Tf.auth.getSocialLoginProviders);yield _i(Uo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield _i(Uo.setSocialLoginsState({error:Ep(e),loading:!1,firstLoad:!1}))}}function*UA(){const e=yield Ni((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ui(Tf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Ui(Tf.auth.getSocialLoginProvidersV2),t}function*RA(){try{const e=yield Ni((e=>e.root.context));yield _i(Uo.setSocialLoginsState({loading:!0}));const t=yield Ui(UA),{providers:n}=yield Ui(Tf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ko(t,_A);const i=Sr(e,null!=n?n:"");return C({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield _i(Uo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield _i(Uo.setSocialLoginsState({error:Ep(e),loading:!1,firstLoad:!1}))}}function*DA(e){let{payload:{events:t,url:n}}=e,o=Ko(e.payload,wA);try{yield _i(Uo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ui(Tf.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Tp.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:bp.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield _i(Uo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Ni((e=>e.auth));e?yield Ui(kS):yield Ui(IS)}(),localStorage.removeItem("register-quick-login"),yield _i(Uo.setSocialLoginsState({loading:!1}))}catch(e){yield _i(Uo.setSocialLoginsState({loading:!1,error:Ep(e,"Failed to authenticate"),firstLoad:!1}))}}function*NA({payload:e}){yield _i(Uo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*MA(){yield _a(Uo.loadSocialLoginsConfiguration,CA),yield _a(Uo.loadSocialLoginsConfigurationV2,RA),yield _a(Uo.loginViaSocialLogin,DA),yield La(Uo.setSocialLoginError,NA)}let FA;function*GA({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Ni((e=>e.auth.apiTokensState));try{let e,a;yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ui(Tf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ui(Tf.auth.updateUserApiTokensData,{description:t}),yield _i(Uo.setApiTokensState({showAddTokenDialog:!1})),yield Mi(200),yield _i(Uo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield _i(Uo.setApiTokensError({key:FA.ADD_API_TOKEN,value:Ep(e)})),yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*$A({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Ni((e=>e.auth.apiTokensState));try{let e,r;yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ui(Tf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ui(Tf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield _i(Uo.setApiTokensState({showAddTokenDialog:!1})),yield Mi(200),yield _i(Uo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield _i(Uo.setApiTokensError({key:FA.ADD_API_TOKEN,value:Ep(e)})),yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*xA({payload:e}){const{apiTokensDataUser:t}=yield Ni((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),n?(yield Ui(Tf.auth.deleteUserAccessToken,{id:e}),yield _i(Uo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ui(Tf.auth.deleteUserApiToken,{tokenId:e}),yield _i(Uo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}catch(e){yield _i(Uo.setApiTokensError({key:FA.DELETE_API_TOKEN,value:Ep(e)})),yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}}function*VA({payload:e}){const{apiTokensDataTenant:t}=yield Ni((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),n?(yield Ui(Tf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ui(Tf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield _i(Uo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}catch(e){yield _i(Uo.setApiTokensError({key:FA.DELETE_API_TOKEN,value:Ep(e)})),yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}}function*jA({payload:e}){null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield wi([Ui(Tf.auth.getUserApiTokensData),Ui(Tf.auth.getTenantApiTokensData)]);yield _i(Uo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:Ep(t)})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*BA({payload:e}){null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ui(Tf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ui(Tf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield _i(Uo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield _i(Uo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:Ep(t)})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*WA({payload:e}){null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ui(Tf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ui(Tf.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield _i(Uo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield _i(Uo.setApiTokensError({key:FA.LOAD_API_TOKENS,value:Ep(t)})),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*KA(){yield _a(Uo.loadApiTokens,jA),yield _a(Uo.loadUserApiTokens,BA),yield _a(Uo.loadTenantApiTokens,WA),yield Oa(Uo.addUserApiToken,GA),yield Oa(Uo.addTenantApiToken,$A),yield La(Uo.deleteTenantApiToken,VA),yield La(Uo.deleteUserApiToken,xA)}function*HA({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Ni((e=>e.auth.apiTokensState)),a=C({},Kf,{description:t,roleIds:n,clientId:`CLIENT_ID_${Am()}`});yield _i(Uo.setApiTokensState({showAddTokenDialog:!1})),yield Mi(200),yield _i(Uo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Mi(200),yield _i(Uo.setApiTokensLoader({key:FA.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*zA({payload:e}){yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!0})),yield Mi(200);const t=[Kf];yield _i(Uo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield _i(Uo.setApiTokensLoader({key:FA.DELETE_API_TOKEN,value:!1}))}function*qA({payload:e}){var t;null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Wf],o=[Kf];yield _i(Uo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Mi(200),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*YA({payload:e}){var t;null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Wf];yield _i(Uo.setApiTokensState({apiTokensDataUser:n})),yield Mi(200),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*JA({payload:e}){var t;null!=e&&e.silentLoading||(yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!0})));const n=[Kf];yield _i(Uo.setApiTokensState({apiTokensDataTenant:n})),yield Mi(200),yield _i(Uo.setApiTokensLoader({key:FA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*QA(){yield _a(Uo.loadApiTokens,qA),yield _a(Uo.loadUserApiTokens,YA),yield _a(Uo.loadTenantApiTokens,JA),yield Oa(Uo.addTenantApiToken,HA),yield La(Uo.deleteTenantApiToken,zA)}function*XA({payload:e}){try{var t;yield _i(Uo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ni((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Ui(Tf.accountSettings.updateSettings,C({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield _i(Uo.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield _i(Uo.setAccountSettingsState({loading:!1,error:Ep(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*ZA({payload:e}){yield _i(Uo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ui(Tf.accountSettings.getSettings);yield _i(Uo.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield _i(Uo.setAccountSettingsState({loading:!1,error:Ep(e)}))}}function*eb(){yield _a(Uo.saveAccountSettings,XA),yield _a(Uo.loadAccountSettings,ZA)}function*tb({payload:e}){var t;yield _i(Uo.setAccountSettingsState({loading:!0})),yield At();const{accountSettingsState:n}=yield Ni((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=C({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield _i(Uo.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*nb({payload:e}){yield _i(Uo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield At(),yield _i(Uo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*ob(){yield _a(Uo.saveAccountSettings,tb),yield _a(Uo.loadAccountSettings,nb)}function*ib({payload:{tenantId:e,callback:t}}){yield _i(Uo.setState({isLoading:!0}));try{yield Ui(Tf.tenants.switchTenant,{tenantId:e}),yield Ui(bS),(null==t?void 0:t(!0))||(yield _i(Uo.setState({isLoading:!1})))}catch(e){yield _i(Uo.setState({isLoading:!1})),null==t||t(!1,e)}}function*ab({payload:e}){yield _i(Uo.setTenantsState({loading:!0}));try{var t;const n=yield Ui(Tf.users.getCurrentUserTenantsV3);yield _i(Uo.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield _i(Uo.setTenantsState({loading:!1}))}}function*rb({payload:e}){yield _i(Uo.setTenantsState({loading:!0}));try{var t;const n=yield Ui(Tf.tenants.getSubTenants);yield _i(Uo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lb({payload:e}){yield _i(Uo.setTenantsState({loading:!0}));try{var t;const n=yield Ui(Tf.tenants.getSubTenantsAsTree);yield _i(Uo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield _i(Uo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sb(){yield Oa(Uo.loadTenants,ab),yield Oa(Uo.loadSubTenants,rb),yield Oa(Uo.switchTenant,ib),yield Oa(Uo.loadSubTenantsTree,lb)}function*cb(){yield _i(Uo.setTenantsState({loading:!0})),yield At(),yield _i(Uo.setTenantsState({tenants:dp,activeTenant:dp[0],loading:!1}))}function*ub(){yield Oa(Uo.loadTenants,cb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(FA||(FA={}));const db=["callback"],yb=["callback"],fb=["callback"],pb=["callback"],gb=["callback"];function*Sb({payload:e}){var t;yield _i(Uo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield wi([Ui(Tf.roles.getRoles),Ui(Tf.roles.getPermissions),Ui(Tf.roles.getPermissionCategories)]),[t,n,o]=e;yield _i(Uo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield _i(Uo.setRolesState({error:Ep(e),loading:!1}))}}function*vb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,db);yield _i(Uo.setRolesState({saving:!0}));try{const e=yield Ui(Tf.roles.addRole,n),o=yield Ui(Tf.roles.getRoles);yield _i(Uo.loadRolesAndPermissions({silentLoading:!0})),yield _i(Uo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setRolesState({error:Ep(e),saving:!1})),null==t||t(null,e)}}function*hb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,yb);yield _i(Uo.setRolesState({saving:!0}));try{yield Ui(Tf.roles.deleteRole,n),yield _i(Uo.loadRolesAndPermissions({silentLoading:!0})),yield _i(Uo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setRolesState({error:Ep(e),saving:!1})),null==t||t(!1,e)}}function*mb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,fb);yield _i(Uo.setRolesState({saving:!0}));try{const e=yield Ui(Tf.roles.updateRole,n);yield _i(Uo.loadRolesAndPermissions({silentLoading:!0})),yield _i(Uo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setRolesState({error:Ep(e),saving:!1})),null==t||t(null,e)}}function*Ab(e){let{payload:{callback:t}}=e,n=Ko(e.payload,pb);yield _i(Uo.setRolesState({saving:!0}));try{const e=yield Ui(Tf.roles.attachPermissionsToRole,n);yield _i(Uo.loadRolesAndPermissions({silentLoading:!0})),yield _i(Uo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setRolesState({error:Ep(e),saving:!1})),null==t||t(null,e)}}function*bb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,gb);yield _i(Uo.setRolesState({saving:!0}));try{const e=yield Ui(Tf.roles.attachPermissionToRoles,n);yield _i(Uo.loadRolesAndPermissions({silentLoading:!0})),yield _i(Uo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield _i(Uo.setRolesState({error:Ep(e),saving:!1})),null==t||t(null,e)}}function*Tb(){yield _a(Uo.loadRolesAndPermissions,Sb),yield Oa(Uo.addRole,vb),yield Oa(Uo.deleteRole,hb),yield Oa(Uo.updateRole,mb),yield Oa(Uo.attachPermissionsToRole,Ab),yield Oa(Uo.attachPermissionToRoles,bb)}function*kb({payload:e}){var t;yield _i(Uo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield _i(Uo.setRolesState({roles:Hf,loading:!1}))}catch(e){yield _i(Uo.setRolesState({error:Ep(e),loading:!1}))}}function*Eb(){yield _a(Uo.loadRolesAndPermissions,kb)}const Ib=["callback"],Pb=["callback"],Ob=["callback"];function*Lb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Ib);yield _i(Uo.setResetPhoneNumberState({loading:!0}));try{const e=yield Ui(Tf.auth.resetPhoneNumber,n);yield _i(Uo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),yield _i(Uo.setLoginState({email:n.email}))}catch(e){yield _i(Uo.setResetPhoneNumberState({loading:!1,error:Ep(e)})),null==t||t(null,e)}}function*_b(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Pb);yield _i(Uo.setResetPhoneNumberState({loading:!0}));try{const e=yield Ui(Tf.auth.verifyResetPhoneNumber,n);yield _i(Uo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Yt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield _i(Uo.setResetPhoneNumberState({loading:!1,error:Ep(e)})),null==t||t(null,e)}}function*wb(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Ob);yield _i(Uo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Ni((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ui(Tf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield _i(Uo.setLoginState({step:It.loginWithSmsOtc})),yield _i(Uo.passwordlessPreLogin({type:bo.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield _i(Uo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setResetPhoneNumberState({loading:!1,error:Ep(e)})),null==t||t(null,e)}}function*Cb(){yield _a(Uo.resetPhoneNumber,Lb),yield _a(Uo.verifyResetPhoneNumber,_b),yield _a(Uo.changePhoneNumber,wb)}function*Ub(){yield _i(Uo.setSessionsState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getCurrentUserSessions);yield _i(Uo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield _i(Uo.setSessionsState({error:e,loading:!1}))}}function*Rb(){yield _i(Uo.setSessionsState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getCurrentUserSession);yield _i(Uo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield _i(Uo.setSessionsState({error:e,loading:!1}))}}function*Db({payload:{id:e}}){yield _i(Uo.setSessionsState({loading:!0,error:null}));try{yield Ui(Tf.auth.deleteSessionForUser,e),yield _i(Uo.loadUserSessions())}catch(e){yield _i(Uo.setSessionsState({error:e,loading:!1}))}}function*Nb({payload:{callback:e,userId:t}}){yield _i(Uo.setSessionsState({loading:!0,error:null}));try{yield Ui(Tf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield _i(Uo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Mb(){yield _i(Uo.setSessionsState({loading:!0,error:null}));try{yield Ui(Tf.auth.deleteAllSessionsForUser),yield _i(Uo.loadUserSessions())}catch(e){yield _i(Uo.setSessionsState({error:e,loading:!1}))}}function*Fb(){yield La(Uo.loadUserSessions,Ub),yield La(Uo.deleteUserSession,Db),yield La(Uo.deleteAllUserSessions,Mb),yield La(Uo.loadCurrentUserSession,Rb),yield Oa(Uo.revokeUserSessions,Nb)}function*Gb(){yield _i(Uo.setSessionsState({loading:!0,error:null})),yield _i(Uo.setSessionsState({sessions:yp,loading:!1}))}function*$b({payload:{id:e}}){yield _i(Uo.setSessionsState({loading:!0,error:null}));const t=(yield Ni((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield _i(Uo.setSessionsState({sessions:t,loading:!1}))}function*xb(){yield _i(Uo.setSessionsState({loading:!0,error:null}));const e=yp.filter((e=>e.current));yield _i(Uo.setSessionsState({sessions:e,loading:!1}))}function*Vb(){yield La(Uo.loadUserSessions,Gb),yield La(Uo.deleteUserSession,$b),yield La(Uo.deleteAllUserSessions,xb)}const jb=["callback"],Bb=["callback"];function*Wb(){yield _i(Uo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getSessionConfigurations);yield _i(Uo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield _i(Uo.setSessionsState({error:e,loading:!1}))}}function*Kb({payload:e}){yield _i(Uo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ko(e,jb);yield Ui(Tf.auth.createOrUpdateSessionConfigrations,n),yield _i(Uo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield _i(Uo.setSessionsPolicyState({error:e,loading:!1}))}}function*Hb(){yield _a(Uo.loadSessionsPolicy,Wb),yield La(Uo.createOrUpdateSessionsPolicy,xp(Kb))}function*zb(){yield _i(Uo.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ni((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:fp}));yield _i(Uo.setSessionsPolicyState(C({},e,{loading:!1})))}function*qb({payload:e}){yield _i(Uo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ko(e,Bb);null==t||t(!0),yield _i(Uo.setSessionsPolicyState({configurations:n,loading:!1}))}function*Yb(){yield _a(Uo.loadSessionsPolicy,zb),yield La(Uo.createOrUpdateSessionsPolicy,qb)}const Jb=["callback"],Qb=["callback"],Xb=["callback"],Zb=["callback"],eT=["callback"],tT=["callback"],nT=["callback"],oT=["callback"],iT=()=>Ni((e=>e.auth.restrictionsState.ipRestrictions)),aT=()=>Ni((e=>e.auth.restrictionsState.emailDomainRestrictions));function*rT(){yield _i(Uo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ui(Tf.auth.getDomainRestrictionsConfig),t=(yield Ui(Tf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield _i(Uo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield _i(Uo.setEmailDomainRestrictionsState({error:Ep(e),loading:!1}))}}function*lT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Jb);yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield aT();try{var i;yield Ui(Tf.auth.createDomainRestriction,n);const e=(yield Ui(Tf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield _i(Uo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setEmailDomainRestrictionsState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*sT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Qb);yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ui(Tf.auth.updateDomainRestrictionConfig,n),o=(yield Ui(Tf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield _i(Uo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setEmailDomainRestrictionsState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*cT({payload:{id:e}}){yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield aT();try{var n;yield Ui(Tf.auth.deleteDomainRestriction,e);const o=(yield Ui(Tf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield _i(Uo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Vn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield _i(Uo.setEmailDomainRestrictionsState({saving:!1,error:Ep(e)}))}}const uT=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Vn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*dT(){yield _i(Uo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield iT(),t=yield Ui(Tf.auth.getIPRestrictionsConfig),n=uT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ui(Tf.auth.getIPRestrictions,n);yield _i(Uo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield _i(Uo.setIpRestrictionsState({error:Ep(e),loading:!1}))}}function*yT(){try{const{valid:e}=yield Ui(Tf.auth.testCurrentIpInAllowList);yield _i(Uo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield _i(Uo.setIpRestrictionsState({error:Ep(e)}))}}function*fT({payload:{callback:e}}){yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ni((e=>e.auth.userIp));yield wi([Ui(Tf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Vn.ALLOW}),Ui(Tf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield iT(),o=uT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ui(Tf.auth.getIPRestrictions,o);yield _i(Uo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Vn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield _i(Uo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*pT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Xb);yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));const o=yield iT();try{var i,a;yield Ui(Tf.auth.createIPRestriction,n);const e=yield iT(),r=uT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ui(Tf.auth.getIPRestrictions,r);yield yT(),yield _i(Uo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:Vn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setIpRestrictionsState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*gT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,Zb);yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));try{yield Ui(Tf.auth.updateIPRestrictionConfig,n);const e=yield iT(),o=yield Ui(Tf.auth.getIPRestrictionsConfig),i=uT(C({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ui(Tf.auth.getIPRestrictions,i);yield yT(),yield _i(Uo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setIpRestrictionsState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*ST({payload:{id:e,callback:t}}){yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));const n=yield iT();try{var o;yield Ui(Tf.auth.deleteIPRestriction,e);const i=yield iT(),a=uT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ui(Tf.auth.getIPRestrictions,a);yield yT(),yield _i(Uo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:Vn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setIpRestrictionsState({saving:!1,error:Ep(e)})),null==t||t(null,e)}}function*vT(){yield _a(Uo.loadIpRestrictions,xp(dT)),yield _a(Uo.loadEmailDomainRestrictions,xp(rT)),yield Oa(Uo.saveIpRestriction,xp(pT)),yield Oa(Uo.saveIpRestrictionsConfig,xp(gT)),yield Oa(Uo.deleteIpRestriction,xp(ST)),yield Oa(Uo.checkIfUserIpValid,xp(yT)),yield Oa(Uo.addCurrentUserIpAndActivate,xp(fT)),yield Oa(Uo.saveEmailDomainRestriction,xp(lT)),yield Oa(Uo.saveEmailDomainRestrictionsConfig,xp(sT)),yield Oa(Uo.deleteEmailDomainRestriction,xp(cT))}function*hT(){yield _i(Uo.setIpRestrictionsState({loading:!0,error:null})),yield _i(Uo.setIpRestrictionsState({data:{restrictions:gp.filter((e=>e.strategy===pp.strategy)),config:pp},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*mT(){yield _i(Uo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield iT(),t=gp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield _i(Uo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield _i(Uo.setIpRestrictionsState({error:Ep(e),loading:!1}))}}function*AT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ko(e.payload,eT);yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));const r=yield iT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield _i(Uo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Vn.ALLOW},restrictions:[...l,C({},a,{createdAt:new Date,updatedAt:new Date,id:Am(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*bT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ko(e.payload,tT);const r=yield iT();yield _i(Uo.setIpRestrictionsState({saving:!0,error:null})),yield _i(Uo.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield _i(Uo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*TT({payload:{id:e,callback:t}}){var n;yield _i(Uo.setIpRestrictionsState({saving:!0,error:null}));const o=yield iT();yield _i(Uo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:Vn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*kT(){yield _i(Uo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield _i(Uo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Vn.ALLOW}],config:{active:!0,listType:Vn.ALLOW,blockPublicDomains:!1}}}))}function*ET(e){var t,n;let{payload:{callback:o}}=e,i=Ko(e.payload,nT);const a=yield aT();yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==o||o(!0),yield _i(Uo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},i,{id:Date.now().toString()})]},saving:!1}))}function*IT(e){var t;let{payload:{callback:n}}=e,o=Ko(e.payload,oT);const i=yield aT();yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==n||n(!0),yield _i(Uo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||Vn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*PT({payload:{id:e}}){var t,n;const o=yield aT();yield _i(Uo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),yield _i(Uo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Vn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*OT(){yield _a(Uo.loadIpRestrictions,hT),yield _a(Uo.loadEmailDomainRestrictions,kT),yield Oa(Uo.saveIpRestriction,AT),yield Oa(Uo.saveIpRestrictionsConfig,bT),yield Oa(Uo.deleteIpRestriction,TT),yield Oa(Uo.checkIfUserIpValid,mT),yield Oa(Uo.saveEmailDomainRestriction,ET),yield Oa(Uo.saveEmailDomainRestrictionsConfig,IT),yield Oa(Uo.deleteEmailDomainRestriction,PT)}const LT=["callback"],_T=["id"];function*wT(e){const{count:t}=yield Ui(Tf.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*CT(){yield _i(Uo.setProvisioningState({loading:!0,error:null}));try{const e=yield Ui(Tf.directory.getConfigs),t=yield wi(e.map((e=>wT(e))));yield _i(Uo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield _i(Uo.setProvisioningState({error:Ep(e),loading:!1}))}}function*UT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,LT);yield _i(Uo.setProvisioningState({loading:!0,error:null}));try{const e=yield Ui(Tf.directory.createConfiguration,n),o=yield Ui(Tf.directory.getConfigs),i=yield wi(o.map((e=>wT(e))));yield _i(Uo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield _i(Uo.setProvisioningState({error:Ep(e),loading:!1}))}}function*RT(e){let{payload:{id:t}}=e,n=Ko(e.payload,_T);yield _i(Uo.setProvisioningState({loading:!0,error:null}));try{yield Ui(Tf.directory.updateConfiguration,t,n);const e=yield Ui(Tf.directory.getConfigs),o=yield wi(e.map((e=>wT(e))));yield _i(Uo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield _i(Uo.setProvisioningState({error:Ep(e),loading:!1}))}}function*DT({payload:{id:e,callback:t}}){yield _i(Uo.setProvisioningState({loading:!0,error:null}));try{yield Ui(Tf.directory.deleteConfiguration,e);const n=yield Ui(Tf.directory.getConfigs),o=yield wi(n.map((e=>wT(e))));yield _i(Uo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setProvisioningState({error:Ep(e),loading:!1})),null==t||t(!1,e)}}function*NT(){yield _a(Uo.loadProvisionConnections,CT),yield Oa(Uo.createProvisionConnection,UT),yield Oa(Uo.deleteProvisionConnection,DT),yield Oa(Uo.updateProvisionConnection,RT)}const MT=["callback","events"];function*FT(e){let{payload:{callback:t}}=e,n=Ko(e.payload,MT);yield _i(Uo.setImpersonateState({loading:!0}));try{yield Ui(Tf.impersonate.impersonate,n),yield _i(Uo.setImpersonateState({step:Po.success})),yield Mi(1e3),yield SS(),yield _i(Uo.resetImpersonateState()),null==t||t(!0)}catch(e){yield _i(Uo.setImpersonateState({loading:!1,error:Ep(e)}))}}function*GT(){yield _a(Uo.impersonate,FT)}function*$T({payload:e}){const{callback:t,deviceId:n}=e;yield _i(Uo.setPasskeysState({loading:!0}));try{yield Ui(Tf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Ni((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield _i(Uo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield _i(Uo.setPasskeysState({loading:!1,error:Ep(e,null)})),null==t||t(null,e)}}function*xT(){yield _i(Uo.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ui(Tf.auth.getWebAuthnDevices);yield _i(Uo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield _i(Uo.setPasskeysState({loading:!1,error:Ep(e,null)}))}}function*VT(){yield Oa(Uo.loadWebAuthnDevices,xT),yield Oa(Uo.deleteWebAuthnDevice,$T)}const jT=["roleIds","userIds"],BT=()=>Ni((e=>e.auth.groupsState));function*WT({payload:e}){const t=bm.GET_TEAM_USERS;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ui(Tf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield _i(Uo.setGroupsState({teamUsers:n}))}catch(e){yield _i(Uo.setUsersGroupsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*KT({payload:e}){const t=bm.GET_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ui(Tf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Tm.rolesAndUsers});yield _i(Uo.setGroupsState({selectedGroup:n}))}catch(e){yield _i(Uo.setUsersGroupsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*HT(){const e=bm.GET_GROUPS,t=yield BT();yield _i(Uo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ui(Tf.groups.getGroups,{_groupsRelations:Tm.rolesAndUsers});yield _i(Uo.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield _i(Uo.setUsersGroupsError({key:e,value:Ep(t)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:e,value:!1}))}}function*zT({payload:e}){const t=bm.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ko(e,jT);yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ui(Tf.groups.createGroup,C({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield _i(Uo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield _i(Uo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield _i(Uo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*qT({payload:e}){const t=bm.UPDATE_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.updateGroup,e),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*YT({payload:e}){const t=bm.DELETE_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.deleteGroup,e.groupId),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*JT({payload:e}){const t=bm.ADD_ROLES_TO_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*QT({payload:e}){const t=bm.DELETE_ROLES_FROM_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*XT({payload:e}){const t=bm.ADD_USERS_TO_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*ZT({payload:e}){const t=bm.DELETE_USERS_FROM_GROUP;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ui(Tf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield _i(Uo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield _i(Uo.setUsersGroupsError({key:t,value:Ep(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*ek(){const e=bm.GET_GROUP_CONFIGURATION;yield _i(Uo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ui(Tf.groups.getGroupConfiguration);yield _i(Uo.setGroupsState({groupsConfiguration:t}))}catch(t){yield _i(Uo.setUsersGroupsError({key:e,value:Ep(t)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:e,value:!1}))}}function*tk({payload:e}){const t=bm.UPDATE_GROUP_CONFIGURATION;yield _i(Uo.setUsersGroupsLoader({key:t,value:!0}));try{yield Ui(Tf.groups.updateGroupConfiguration,e),yield _i(Uo.getGroupConfiguration())}catch(e){yield _i(Uo.setUsersGroupsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}}function*nk(){yield La(Uo.loadGroups,HT),yield La(Uo.getGroupById,KT),yield La(Uo.createGroup,zT),yield La(Uo.updateGroup,qT),yield La(Uo.deleteGroup,YT),yield La(Uo.addRolesToGroup,JT),yield La(Uo.deleteRolesFromGroup,QT),yield La(Uo.addUsersToGroup,XT),yield La(Uo.deleteUsersFromGroup,ZT),yield La(Uo.getGroupConfiguration,ek),yield La(Uo.updateGroupConfiguration,tk),yield La(Uo.getTeamUsers,WT)}function*ok(){const e=bm.GET_GROUPS;yield _i(Uo.setUsersGroupsLoader({key:e,value:!0}));const t=hp;yield _i(Uo.setGroupsState({groups:t})),yield _i(Uo.setUsersGroupsLoader({key:e,value:!1}))}function*ik({payload:e}){var t;const n=bm.CREATE_GROUP,{groups:o}=yield BT();yield _i(Uo.setUsersGroupsLoader({key:n,value:!0})),yield _i(Uo.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:Sf.FRONTEGG}),...null!=o?o:[]]})),yield Mi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:n,value:!1}))}function*ak({payload:e}){var t,n,o,i,a;const r=bm.UPDATE_GROUP,l=yield BT();yield _i(Uo.setUsersGroupsLoader({key:r,value:!0})),yield _i(Uo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Sf.FRONTEGG}):t})),selectedGroup:C({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield Mi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:r,value:!1}))}function*rk({payload:e}){var t,n;const o=bm.DELETE_GROUP,i=yield BT();yield _i(Uo.setUsersGroupsLoader({key:o,value:!0})),yield _i(Uo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Mi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:o,value:!1}))}function*lk({payload:e}){var t,n;const o=bm.ADD_ROLES_TO_GROUP,i=yield BT();yield _i(Uo.setUsersGroupsLoader({key:o,value:!0})),yield _i(Uo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Mi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:o,value:!1}))}function*sk({payload:e}){var t,n;const o=bm.DELETE_ROLES_FROM_GROUP,i=yield BT();yield _i(Uo.setUsersGroupsLoader({key:o,value:!0})),yield _i(Uo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Mi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:o,value:!1}))}function*ck({payload:e}){var t,n;const o=bm.ADD_USERS_TO_GROUP,i=yield BT();yield _i(Uo.setUsersGroupsLoader({key:o,value:!0})),yield _i(Uo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Mi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:o,value:!1}))}function*uk({payload:e}){var t,n;const o=bm.DELETE_USERS_FROM_GROUP,i=yield BT();yield _i(Uo.setUsersGroupsLoader({key:o,value:!0})),yield _i(Uo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Mi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield _i(Uo.setUsersGroupsLoader({key:o,value:!1}))}function*dk(){const e=bm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield BT();yield _i(Uo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield _i(Uo.setGroupsState({groupsConfiguration:C({},t)}))),yield _i(Uo.setUsersGroupsLoader({key:e,value:!1}))}function*yk({payload:e}){const t=bm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield BT();yield _i(Uo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield _i(Uo.setGroupsState({groupsConfiguration:C({},n,e)}))),yield _i(Uo.setUsersGroupsLoader({key:t,value:!1}))}function*fk(){yield La(Uo.loadGroups,ok),yield La(Uo.createGroup,ik),yield La(Uo.updateGroup,ak),yield La(Uo.deleteGroup,rk),yield La(Uo.addRolesToGroup,lk),yield La(Uo.deleteRolesFromGroup,sk),yield La(Uo.addUsersToGroup,ck),yield La(Uo.deleteUsersFromGroup,uk),yield La(Uo.getGroupConfiguration,dk),yield La(Uo.updateGroupConfiguration,yk)}let pk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(pk||(pk={}));const gk=(e,t,n)=>{var o,i;return e.tenantId===t?C({},e,{name:n}):C({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>gk(e,t,n))))?o:[]})};function Sk(e,t){var n;return C({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Sk(e,t))):[]})}function vk(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return C({},e,{children:t})}return C({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>vk(e,t,n))))?o:[]})}const hk=({items:e},t)=>e.map((e=>{var n,o;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(o=t.find((t=>t.tenantId===e.tenantId)))?void 0:o.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),mk=()=>Ni((e=>e.auth.allAccountsState));function*Ak({payload:e}){const t=pk.GET_ACCOUNTS;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield mk(),{jwt:o,_limit:i,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(o){var l;const{selectedAccount:t}=yield mk(),{items:n,_links:i}=yield Ui(Tf.tenants.searchSubTenants,r,{jwt:o}),a=yield Ui(Tf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=hk({items:n},a),c=vk(t.accounts?t.accounts:t,null!=(l=null==e?void 0:e._subTenantId)?l:"",s.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next}))));yield _i(Uo.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield mk(),{items:n,_links:o}=yield Ui(Tf.tenants.searchSubTenants,r),i=yield Ui(Tf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=hk({items:n},i),l=vk(t,null!=(s=null==e?void 0:e._subTenantId)?s:"",a.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==o?void 0:o.next}))));yield _i(Uo.setAllAccountsState({accounts:l}))}}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*bk({payload:e}){const t=pk.SEARCH_ACCOUNTS;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield mk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ui(Tf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield _i(Uo.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=pk.GET_USER_JWT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ui(Tf.users.GetUserJwt,{tenantId:n});yield _i(Uo.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),yield _i(Uo.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=pk.CREATE_SUB_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield mk(),{selectedAccount:t}=yield mk(),r=yield Ui(Tf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=vk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=vk(C({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield _i(Uo.setAllAccountsState({accounts:l})),yield _i(Uo.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield mk(),t=yield Ui(Tf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=vk(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield _i(Uo.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==r||r(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=pk.DELETE_SUB_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield Ui(Tf.subTenants.deleteSubTenant,o,{jwt:n});const i=Sk(t,o),a=Sk(null==e?void 0:e.accounts,o);yield _i(Uo.setAllAccountsState({accounts:i})),yield _i(Uo.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield mk();yield Ui(Tf.subTenants.deleteSubTenant,o);const t=Sk(e,o);yield _i(Uo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==i||i(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_SETTINGS;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield mk();yield Ui(Tf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=gk(e.accounts,a,o);yield _i(Uo.setSelectedAccountState({name:o,accounts:i}));const r=gk(t,a,o);yield _i(Uo.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield mk();yield Ui(Tf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=gk(e,a,o);yield _i(Uo.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==i||i(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Pk({payload:e}){const t=pk.DELETE_USERS_FROM_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Ui(Tf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield _i(Uo.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==a||a(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=pk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield mk();try{yield Ui(Tf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield _i(Uo.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==a||a(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=pk.ADD_USERS_TO_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Ui(Tf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield _i(Uo.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==a||a(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*_k({payload:e}){const t=pk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield mk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ui(Tf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield _i(Uo.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?C({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)})),null==r||r(!1)}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*wk({payload:e}){var t,n,o,i,a,r,l,s;const c=pk.GET_ACCOUNT_USERS;yield _i(Uo.setAllAccountsLoader({key:c,value:!0}));const u=yield mk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(o=u.selectedAccount)||null==(i=o.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(l=u.selectedAccount)||null==(s=l.usersQueryParams)?void 0:s._limit)?a:10,S=C({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Ui(Tf.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:C({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield Ui(Tf.roles.getRoles),i=yield Ui(Tf.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return C({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}));yield _i(Uo.setSelectedAccountState(C({users:a},o)))}else yield _i(Uo.setSelectedAccountState(C({users:[]},o)))}catch(e){yield _i(Uo.setAllAccountsError({key:c,value:Ep(e)}))}finally{yield _i(Uo.setAllAccountsLoader({key:c,value:!1}))}}function*Ck({payload:e}){const t=pk.SET_SELECTED_SUB_ACCOUNT_DATA;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Ui(Tf.accountSettings.getSettings,{jwt:n}),u=yield Ui(Tf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ui(Tf.tenants.getParentTenants,{jwt:n}),y=yield Ui(Tf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield _i(Uo.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(l=e.tenantId)?l:"",numberOfUsers:null==(s=u[0])?void 0:s.totalUsers,createdAt:void 0,children:[]}})),yield _i(Uo.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=pk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield _i(Uo.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Ui(Tf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield _i(Uo.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield _i(Uo.setAllAccountsError({key:t,value:Ep(e)}))}finally{yield _i(Uo.setAllAccountsLoader({key:t,value:!1}))}}function*Rk(){yield La(Uo.loadAccounts,Ak),yield La(Uo.searchAccounts,bk),yield La(Uo.updateSubAccountAccessForUser,_k),yield La(Uo.getUserJwtForSubAccount,Tk),yield La(Uo.createSubAccount,kk),yield La(Uo.deleteSubAccount,Ek),yield La(Uo.updateSubAccountSettings,Ik),yield La(Uo.addUsersToAccount,Lk),yield La(Uo.deleteUsersFromAccount,Pk),yield La(Uo.setUserRolesForSubAccount,Ok),yield La(Uo.getAccountUsers,wk),yield La(Uo.setSelectedSubAccountData,Ck),yield La(Uo.loadNumberOfUsersForSelectedSubAccount,Uk)}var Dk={sagas:function*(){yield wi([Ui(yv),Ui(um),Ui(ym),Ui(em),Ui(Cb),Ui(Lv),Ui(nh),Ui(sh),Ui(Gp),Ui(xh),Ui(gA),Ui(nk),Ui(MA),Ui(Dg),Ui(KA),Ui(Sg),Ui(eb),Ui(sb),Ui(Tb),Ui(Fb),Ui(Hb),Ui(vT),Ui(NT),Ui(GT),Ui(VT),Ui(Rk),Ui(Hg),Ui(Wp)])},mockSagas:function*(){yield wi([Ui(gv),Ui(Nv),Ui(yh),Ui(Yh),Ui(LA),Ui(QA),Ui(_g),Ui(Vb),Ui(ob),Ui(ub),Ui(Yb),Ui(OT),Ui(Eb),Ui(fk),Ui(zp)])},storeName:wt,initialState:Io,reducer:wo,actions:Uo};const Nk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),Mk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Fk={setAuditLogsState:Nk("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:Mk})},Gk={exportAuditsCsv:ct("auditLogs/exportAuditsCsv"),loadAuditLogs:ct("auditLogs/loadAuditLogs",(e=>({payload:e})))},$k={loading:!0},xk={setAuditsMetadataState:Nk("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:$k})},Vk={loadAuditsMetadata:ct("auditLogs/loadAuditsMetadata")},jk={auditLogsState:Mk,auditsMetadataState:$k},{reducer:Bk,actions:Wk}=dt({name:Ut,initialState:jk,reducers:C({resetState:e=>C({},e,jk),setState:(e,{payload:t})=>C({},e,t)},Fk,xk)}),Kk=C({},Wk,Gk,Vk),Hk=e=>"createdAt"!==e.id,zk={total:20,data:Array.from(Array(5).keys()).map((e=>C({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`})))},qk={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}]},Yk=()=>Ni((e=>e.auditLogs.auditLogsState)),Jk=()=>Ni((e=>e.auditLogs.auditsMetadataState));function*Qk(){const e=yield Yk(),{columns:t}=yield Jk();try{const n=e.filter,o=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield _i(Kk.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Tf.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield _i(Kk.setAuditLogsState({isDownloadingCsv:!1}))}function*Xk({payload:e}){yield _i(Kk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Yk(),{columns:n}=yield Jk();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield _i(Kk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield _i(Kk.loadAuditsMetadata()));const{data:p,total:g}=yield Ui(Tf.audits.getAudits,C({offset:c,count:s},y,f));yield _i(Kk.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield _i(Kk.setAuditLogsState({loading:!1,error:Ep(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Zk(){yield Oa(Kk.exportAuditsCsv,Qk),yield Oa(Kk.loadAuditLogs,Xk)}function*eE({payload:e}){yield _i(Kk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Yk(),{columns:n}=yield Jk();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield _i(Kk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield _i(Kk.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=zk;let o=n.filter((e=>t=>e.filter(Hk).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield _i(Kk.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield _i(Kk.setAuditLogsState({loading:!1,error:Ep(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*tE(){yield Oa(Kk.loadAuditLogs,eE)}function*nE(){yield _i(Kk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ui(Tf.metadata.getAuditsMetadata);yield _i(Kk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield _i(Kk.setAuditsMetadataState({error:e,loading:!1}))}}function*oE(){yield Oa(Kk.loadAuditsMetadata,nE)}function*iE(){yield _i(Kk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=qk;yield _i(Kk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield _i(Kk.setAuditsMetadataState({error:e,loading:!1}))}}function*aE(){yield Oa(Kk.loadAuditsMetadata,iE)}var rE={sagas:function*(){yield wi([Ui(Zk),Ui(oE)])},mockSagas:function*(){yield wi([Ui(tE),Ui(aE)])},storeName:Ut,initialState:jk,reducer:Bk,actions:Kk};const lE={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:sE,actions:cE,reducer:uE}=dt({name:"audits",initialState:lE,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=C({},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]})))}}}),dE=C({},cE,{initData:ct(`${sE}/initData`),loadAudits:ct(`${sE}/loadAudits`),removeFilter:ct(`${sE}/removeFilter`),filterData:ct(`${sE}/filterData`),exportCSV:ct(`${sE}/exportCSV`),deleteAudits:ct(`${sE}/deleteAudits`)}),yE=()=>Ni((e=>e[sE]));function*fE(){const{sortBy:e,sortDirection:t}=yield yE();try{const n=yield Ui(Tf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield _i(dE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield _i(dE.loadItemFailedAction(t))}}function*pE(){try{const e=yield Ui(Tf.metadata.getAuditsMetadata);yield _i(dE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield _i(dE.loadItemFailedAction(t))}}const gE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*SE({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield yE(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield yE():{rowsData:[]};try{const e=gE(t),{data:l,total:d}=yield Ui(Tf.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield _i(dE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield _i(dE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield _i(dE.loadItemFailedAction(t))}}function*vE(){yield _i(dE.startLoading()),yield wi([fE(),pE(),SE({payload:{onlyOneLoad:!1},type:""})]),yield _i(dE.finishLoading())}function*hE({payload:e}){const{filters:t}=yield yE(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield _i(dE.setFilterData(o))}function*mE({payload:e}){const{filters:t}=yield yE();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield _i(dE.setFilterData(o))}function*AE(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield yE(),a=gE(e);yield _i(dE.startDownloadingCsv());try{yield Tf.audits.exportAudits(C({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield _i(dE.stopDownloadingCsv())}}function*bE(){yield La(dE.initData,vE),yield La(dE.removeFilter,hE),yield La(dE.filterData,mE),yield La([dE.loadAudits,dE.textSearch,dE.onPageChange],SE),yield La([dE.setFilterData,dE.setDataSorting,dE.startRefresh],(()=>SE({payload:{appendMode:!1},type:""}))),yield La(dE.exportCSV,AE)}const TE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},kE={initData:()=>C({},TE),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},EE={loadSlackActions:ct("connectivity/loadSlackActions"),loadDataAction:ct("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ct("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ct("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ct("connectivity/loadScope"),deleteWebhookConfigAction:ct("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ct("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ct("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},IE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:PE,actions:OE}=dt({name:Ct,initialState:IE,reducers:C({},kE)}),LE=C({},OE,EE),_E={slack:Tf.connectivity.getSlackConfiguration,email:Tf.connectivity.getEmailConfiguration,sms:Tf.connectivity.getSMSConfiguration,webhook:Tf.connectivity.getWebhooksConfigurations,categories:Tf.connectivity.getCategories,channelMap:Tf.connectivity.getChannelMaps},wE={slack:Tf.connectivity.postSlackConfiguration,email:Tf.connectivity.postEmailConfiguration,sms:Tf.connectivity.postSMSConfiguration,webhook:Tf.connectivity.postWebhooksConfiguration},CE=["email","slack","sms","webhook"],UE={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"}},RE=["id"],DE=["id","enabled"],NE=["categories","channelMap"];function*ME(e){return yield Ui(GE,{payload:{api:e},type:""})}function*FE({payload:e=CE}){yield _i(LE.setConnectivityState({isLoading:!0}));try{const t=yield wi([...e.map(ME),yield GE({payload:{api:"categories"},type:""}),yield function*(){return(yield wi(e.map((function*(e){return yield GE({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>C({},t,{[`${e[o]}`]:n})),{})}()]),n=yield GE({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?C({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:UE[e[i]].events(o),active:UE[e[i]].isActive(o),platform:UE[e[i]].title,image:UE[e[i]].image}]}):n:C({},n,{[`${NE[i-e.length]}`]:o})),{list:[],webhook:n});yield _i(LE.setConnectivityState(C({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield _i(LE.setConnectivityState({isLoading:!1}))}}function*GE({payload:{api:e,params:t}}){try{return yield Ui(_E[e],t)}catch(e){return}}function*$E(){try{yield _i(LE.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ui(Tf.connectivity.getSlackChannels);yield _i(LE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield _i(LE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xE(e,t){const{connectivity:{list:n}}=yield Ni(),o=n.find((({key:t})=>t===e));if(!o)return;const i=UE[e].isActive(t);i!==o.active&&(yield _i(LE.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:i}):t))})))}function*VE({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Ni((e=>e.connectivity));try{if(yield _i(LE.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ni();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield wi([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Ko(e,RE);return n===t.id&&JSON.stringify(C({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Ui(wE.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ui(Tf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ni(),{processIds:o}=yield Ni((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield wi([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Ui("email"===t?Tf.connectivity.postEmailConfiguration:Tf.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Ko(i,DE);return yield wi([yield Ui("email"===t?Tf.connectivity.patchEmailConfiguration:Tf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ui("email"===t?Tf.connectivity.putEmailSubscriptions:Tf.connectivity.putSMSSubscriptions,a,o,C({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.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 Ui("email"===t?Tf.connectivity.deleteEmailSubscriptions:Tf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield GE({payload:{api:t},type:""});yield _i(LE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield xE(t,e)}else yield _i(LE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ui(wE[e],t),!["sms","email"].includes(e)){const i=yield GE({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield _i(LE.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield xE(e,i),null==n||n(!0)}}catch(e){yield _i(LE.setConnectivityState({error:Ep(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*jE({payload:e}){try{yield Tf.connectivity.postSlackCode(e)}catch{}yield _i(LE.setConnectivityState({error:void 0,isSaving:!1}))}function*BE(){const{slackChannels:e}=yield Ni((e=>e.connectivity));try{yield _i(LE.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ui(Tf.connectivity.getSlackScope);yield _i(LE.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield _i(LE.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*WE({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Ni((e=>e.connectivity));try{yield _i(LE.setConnectivityState({isSaving:!0})),yield Ui(Tf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Ep(e))}const i=yield GE({payload:{api:"webhook"},type:""});i&&(yield _i(LE.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*KE({payload:e}){try{yield _i(LE.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ui(Tf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield _i(LE.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield _i(LE.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield _i(LE.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*HE({payload:e}){try{const{statusCode:t}=yield Ui(Tf.connectivity.postWebhookRetry,e);yield _i(LE.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield _i(LE.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*zE({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Ni((e=>e.connectivity));try{yield _i(LE.setConnectivityState({webhookLogs:C({},o,{isLoading:!0})}));const i=yield Ui(Tf.connectivity.getWebhookLog,e,n,t);yield _i(LE.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},i)}))}catch(e){yield _i(LE.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var qE={sagas:function*(){yield Oa(LE.loadDataAction,FE),yield La(LE.loadSlackActions,$E),yield Oa(LE.postDataAction,VE),yield Oa(LE.postCodeAction,jE),yield Oa(LE.loadScope,BE),yield Oa(LE.deleteWebhookConfigAction,WE),yield Oa(LE.postWebhookTestAction,KE),yield Oa(LE.postWebhookRetryAction,HE),yield La(LE.loadWebhookLogsAction,zE)},storeName:Ct,initialState:IE,reducer:PE,actions:LE};function YE(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function JE(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>C({},n,{[e]:t(n[e],o)})}}function QE(e){return JE(e,((e,t)=>C({},e,{loading:t.payload})))}function XE(e){return JE(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const ZE={loading:!1,error:null,fetching:!0,plans:[]},{actions:eI,reducer:tI,name:nI}=dt({name:"subscriptions/plans",initialState:ZE,reducers:C({},YE())}),oI=C({loadPlans:ct(`${nI}/loadPlans`)},eI),iI={loading:!1,error:null,fetching:!0,config:null},aI=C({},YE()),{actions:rI,reducer:lI,name:sI}=dt({name:"subscriptions/config",initialState:iI,reducers:aI}),cI=C({loadPaymentConfiguration:ct(`${sI}/loadPaymentConfiguration`)},rI),uI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dI=C({},YE(),{setCancellationLoading:QE("cancellation"),setCancellationError:XE("cancellation"),setRenewalLoading:QE("renewal"),setRenewalError:XE("renewal")}),{reducer:yI,actions:fI,name:pI}=dt({name:"subscriptions/billing/subscription",initialState:uI,reducers:dI}),gI=C({load:ct(`${pI}/loadSubscription`),cancelSubscription:ct(`${pI}/cancelSubscription`),renewSubscription:ct(`${pI}/renewSubscription`)},fI),SI={loading:!1,error:null,fetching:!0},vI=C({},YE()),{reducer:hI,actions:mI,name:AI}=dt({name:"subscriptions/billing/information",initialState:SI,reducers:vI}),bI=C({loadBillingInformation:ct(`${AI}/loadBillingInformation`),cancelSubscription:gI.cancelSubscription,renewSubscription:gI.renewSubscription},mI),TI={loading:!1,error:null,fetching:!0},kI=C({},YE(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:EI,actions:II,name:PI}=dt({name:"subscriptions/billing/payment",initialState:TI,reducers:kI}),OI=C({loadPaymentMethod:ct(`${PI}/loadPaymentMethod`),submitPaymentMethod:ct(`${PI}/submitPaymentMethod`),submitPaymentMethodError:ct(`${PI}/submitPaymentMethodError`),submitPaymentMethodSuccess:ct(`${PI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ct(`${PI}/updateBillingDetails`,(e=>({payload:e})))},II),LI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_I=C({},YE(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:wI,actions:CI,name:UI}=dt({name:"subscriptions/billing/invoices",initialState:LI,reducers:_I}),RI=C({loadInvoices:ct(`${UI}/loadInvoices`),downloadInvoice:ct(`${UI}/downloadInvoice`,(e=>({payload:e})))},CI),DI={information:SI,invoices:LI,paymentMethod:TI,subscription:uI},NI={invoices:RI,information:bI,paymentMethod:OI,subscription:gI},MI=Be({invoices:wI,information:hI,paymentMethod:EI,subscription:yI}),FI={fetching:!0,loading:!1,error:null,confirmed:!1},GI=C({},YE()),{actions:$I,reducer:xI,name:VI}=dt({name:"subscriptions/checkout",initialState:FI,reducers:GI}),jI=C({loadCheckout:ct(`${VI}/loadCheckout`),resetCheckout:ct(`${VI}/resetCheckout`),submitCheckout:ct(`${VI}/submitCheckout`),confirmCheckout:ct(`${VI}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ct(`${VI}/errorCheckout`,(e=>({payload:e})))},$I),BI={loading:!1,error:null,cardSetupIntentSecret:null},WI=C({},YE()),{reducer:KI,actions:HI,name:zI}=dt({name:"subscriptions/stripe",initialState:BI,reducers:WI}),qI=C({loadCustomer:ct(`${zI}/loadCustomer`),createCardSetupIntentSecret:ct(`${zI}/createCardSetupIntentSecret`)},HI),YI={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:JI,reducer:QI,name:XI}=dt({name:"subscriptions/vendorPublicConfig",initialState:YI,reducers:C({},YE())}),ZI=C({loadVendorPublicConfiguration:ct(`${XI}/loadVendorPublicConfiguration`)},JI),eP={config:iI,plans:ZE,checkout:FI,billing:DI,stripe:BI,vendorPublicConfig:YI},tP={config:cI,billing:NI,plans:oI,checkout:jI,stripe:qI,vendorPublicConfig:ZI},nP=Be({config:lI,billing:MI,plans:tI,checkout:xI,stripe:KI,vendorPublicConfig:QI});let oP,iP,aP;function rP({policy:e}){return{policy:aP.AT_PERIOD_END}}function lP(e){switch(e){case Sy.ACTIVE:return iP.ACTIVE;case Sy.INCOMPLETE:return iP.INCOMPLETE;case Sy.CANCELED:return iP.CANCELED;case Sy.EXPIRED:return iP.EXPIRED;case Sy.TRIALING:return iP.TRIALING;default:return iP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(oP||(oP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(iP||(iP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aP||(aP={}));const sP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Sy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cP=[{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"}],uP=[{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:""}],dP=[{id:"id",externalId:"externalId",type:vy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fP(){yield Oa(gI.load,pP),yield Oa(gI.cancelSubscription,SP),yield Oa(gI.renewSubscription,vP)}function*pP(){const e=yield Ni((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield TP(e)}function*gP(){yield _i(gI.setLoading(!0));try{const[e]=yield Ui(Tf.subscriptions.getManagedSubscriptions);yield _i(gI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield _i(gI.setError(e))}}function*SP(){const{subscription:e}=yield Ni((e=>e.subscriptions.billing.subscription));if(!e)return void(yield _i(gI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield _i(gI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Sy.ACTIVE)try{yield _i(gI.setCancellationLoading(!0)),yield Ui(Tf.subscriptions.cancelManagedSubscription,t),yield gP(),yield _i(gI.setCancellationLoading(!1))}catch(e){yield _i(gI.setCancellationError(Ep(e)))}}function*vP(){const{subscription:e}=yield Ni((e=>e.subscriptions.billing.subscription));if(!e)return void(yield _i(gI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield _i(gI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===hy.AT_PERIOD_END)try{yield _i(gI.setRenewalLoading(!0)),yield Ui(Tf.subscriptions.renewManagedSubscription,t),yield gP(),yield _i(gI.setRenewalLoading(!1))}catch(e){yield _i(gI.setCancellationError(Ep(e)))}}function*hP(){yield _i(gI.setLoading(!0)),yield Mi(500),yield _i(gI.setState({subscription:sP,fetching:!1,loading:!1,error:null}))}function*mP(){yield Oa(gI.load,hP)}function*AP(){yield Oa(bI.loadBillingInformation,bP)}function*bP(){yield function*(e){const t=yield Ni((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ni((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield TP(n,!1):yield _i(bI.setError(t?"Not authorized":"Internal feature failure"))}()}function*TP(e,t){yield _i(bI.setLoading(!0));try{var n,o;const i=yield Ui(Tf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ui(Tf.subscriptions.getSubscriptionPlan,a):([,l]=yield wi([Ui(gP),Ui(Tf.subscriptions.getSubscriptionPlan,a)]),s=yield Ni((e=>e.subscriptions.billing.subscription.subscription||null))),yield _i(bI.setState(C({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?iP.ACTIVE:lP(s.status),cancellation:s.cancellation&&rP(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==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield _i(bI.setError(Ep(e)))}}function*kP(){yield function*(){var e,t;yield _i(bI.setLoading(!0)),yield Mi(500),yield _i(bI.setState({loading:!1,fetching:!1,summary:{subscriptionId:sP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:my.Stripe,externallyManaged:!1,currentPlanId:cP[0].id,defaultPlanId:cP[0].id},plan:C({},cP[0],{price:null==(e=cP[0].price)?void 0:e.amount,currency:null==(t=cP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*EP(){yield Oa(bI.loadBillingInformation,kP)}function*IP(){yield Oa(OI.loadPaymentMethod,PP),yield Oa(OI.submitPaymentMethod,LP),yield Oa(OI.submitPaymentMethodError,_P),yield Oa(OI.submitPaymentMethodSuccess,wP),yield Oa(OI.updatePaymentMethodBillingDetails,OP)}function*PP(){yield _i(OI.setLoading(!0));try{const e=(yield Ui(Tf.subscriptions.getPaymentMethods))[0];yield _i(OI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield _i(OI.setError(Ep(e)))}}function*OP({payload:e}){yield _i(OI.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ui(Tf.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},o)),yield Ui(PP),null==i||i(!0)}catch(e){yield _i(OI.setError(Ep(e))),null==i||i(!1)}yield _i(OI.setLoading(!1))}function*LP(){yield _i(OI.setLoading(!0))}function*_P({payload:e}){yield _i(OI.setError(e))}function*wP(){yield _i(OI.loadPaymentMethod())}function*CP(){yield _i(OI.setLoading(!0)),yield Mi(500);const e=dP[0];yield _i(OI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*UP(){yield Oa(OI.loadPaymentMethod,CP)}function*RP(){yield Oa(RI.loadInvoices,DP),yield Oa(RI.downloadInvoice,NP)}function*DP(){yield _i(RI.setLoading(!0));try{const e=(yield Ui(Tf.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield _i(RI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield _i(RI.setError(Ep(e)))}}function*NP({payload:e}){yield _i(RI.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ui(Tf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield _i(RI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield _i(RI.setInvoiceDownloadState({loading:!1,error:Ep(e,null)}))}}function*MP(){yield _i(RI.setLoading(!0)),yield Mi(500),yield _i(RI.setState({loading:!1,fetching:!1,invoices:uP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield _i(RI.setLoading(!1))}function*FP(){yield Oa(RI.loadInvoices,MP)}function*GP(){yield wi([Ui(AP),Ui(IP),Ui(RP),Ui(fP)])}function*$P(){yield wi([Ui(EP),Ui(UP),Ui(FP),Ui(mP)])}function*xP(){yield Oa(jI.loadCheckout,VP),yield Oa(jI.resetCheckout,jP),yield Oa(jI.submitCheckout,BP),yield Oa(jI.confirmCheckout,WP),yield Oa(jI.errorCheckout,HP)}function*VP(){yield _i(jI.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*jP(){yield _i(jI.setState({loading:!1,error:null,confirmed:!1}))}function*BP(){yield _i(jI.setState({loading:!0,error:null}))}function*WP({payload:{paymentMethodId:e,planId:t}}){const n=yield Ni((e=>e.subscriptions.billing.subscription.subscription)),o=yield Ni((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Sy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield _i(jI.setState({loading:!0,error:null})),i&&a)return yield KP(),void(yield _i(gI.setState({subscription:C({},n,{status:Sy.ACTIVE})})));try{yield Ui(Tf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield wi([bP(),PP(),DP()]),yield KP()}catch(e){yield _i(jI.setState({loading:!1,error:Ep(e)}))}}else yield _i(jI.setState({loading:!1,error:"Subscription not found"}))}function*KP(){yield _i(jI.setState({loading:!1,error:null,confirmed:!0}))}function*HP({payload:e}){yield _i(jI.setState({loading:!1,error:e}))}function*zP(){yield Oa(jI.resetCheckout,jP)}function*qP(){yield Oa(oI.loadPlans,YP)}function*YP(){yield _i(oI.setLoading(!0));try{const e=(yield Ui(Tf.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield _i(oI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield _i(oI.setError(Ep(e)))}}function*JP(){yield _i(oI.setLoading(!0)),yield Mi(500),yield _i(oI.setState({fetching:!1,loading:!1,plans:cP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QP(){yield Oa(oI.loadPlans,JP)}function*XP(){yield Oa(cI.loadPaymentConfiguration,ZP)}function*ZP(){yield _i(cI.setLoading(!0));try{(yield Ui(Tf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===my.Stripe))?yield function*(){yield _i(cI.setLoading(!0));try{const e=yield Ui(Tf.subscriptions.getStripePaymentProviderConfiguration);yield _i(cI.setState({loading:!1,fetching:!1,config:{paymentProvider:oP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield _i(cI.setError(Ep(e)))}}():yield _i(cI.setError("Payment provider not configured"))}catch(e){yield _i(cI.setError(Ep(e)))}}function*eO(){yield _i(cI.setLoading(!0)),yield Mi(500),yield _i(cI.setState({loading:!1,fetching:!1,config:{paymentProvider:oP.STRIPE,apiKey:""}}))}function*tO(){yield Oa(cI.loadPaymentConfiguration,eO)}function*nO(){yield Oa(qI.createCardSetupIntentSecret,oO)}function*oO({payload:e}){yield _i(qI.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ui(Tf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield _i(qI.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield _i(qI.setError(Ep(e)))}}function*iO(){yield Oa(ZI.loadVendorPublicConfiguration,aO)}function*aO(){yield _i(ZI.setLoading(!0));try{const e=yield Ui(Tf.subscriptions.getVendorPublicConfigurations);yield _i(ZI.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield _i(ZI.setError(Ep(e)))}}function*rO(){yield _i(ZI.setLoading(!0)),yield Mi(500),yield _i(ZI.setState({fetching:!1,loading:!1,vendorPublicConfig:yP}))}function*lO(){yield Oa(ZI.loadVendorPublicConfiguration,rO)}var sO={sagas:function*(){yield wi([Ui(GP),Ui(xP),Ui(qP),Ui(XP),Ui(nO),Ui(iO)])},mockSagas:function*(){yield wi([Ui($P),Ui(zP),Ui(QP),Ui(tO),Ui(lO)])},reducer:nP,actions:tP,initialState:eP,storeName:"subscriptions"},cO={sagas:function*(){yield Oa(xg.loadVendorPublicInfo,Vg)},storeName:Rt,initialState:Fg,reducer:Gg,actions:xg};const{reducer:uO}=dt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(wa.setContext(t),C({},e,{context:t}))}}}),dO=(e,t,n=!1,o,i,a=!1,r="path")=>{const l="undefined"==typeof window;let s=t;if(l&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var c,u,d,y,f,p,g,S,v,h;n||a||wa.setContext(e.context);const t=ha(),l=[...lt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:l,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[Dk.storeName]:C({},Dk.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:C({},Dk.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[rE.storeName]:C({},rE.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:C({},rE.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:C({},rE.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[sE]:C({},lE,null!=(h=null==i?void 0:i.audits)?h:{}),[qE.storeName]:qE.initialState,[sO.storeName]:sO.initialState,[cO.storeName]:cO.initialState},reducer:Be({root:uO,[Dk.storeName]:Dk.reducer,[rE.storeName]:rE.reducer,[sE]:uE,[qE.storeName]:qE.reducer,[sO.storeName]:sO.reducer,[cO.storeName]:cO.reducer})});const m=function*(){yield wi([Ui(Dk.sagas),Ui(rE.sagas),Ui(bE),Ui(qE.sagas),Ui(sO.sagas),Ui(cO.sagas)])},A=function*(){yield wi([Ui(Dk.mockSagas),Ui(rE.mockSagas),Ui(sO.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Uo.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel,s.store.subscribeStateChanged=e=>{let t=s.store.getState();return s.store.subscribe((()=>{const n=s.store.getState();t!=n&&(t=n,e(n))}))}}return s.store},yO=(e,t)=>((()=>{if(!wa.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")})(),e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t});var fO=n(714),pO=n.n(fO);function gO(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function SO(e){if(e.type)return e;if("#"===e.charAt(0))return SO(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 o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=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(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function vO(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function hO(e){if(0===e.indexOf("#"))return e;const{values:t}=SO(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 mO(e,t){return e=SO(e),t=gO(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,vO(e)}function AO(e,t){if(e=SO(e),t=gO(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 vO(e)}function bO(e,t){if(e=SO(e),t=gO(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 vO(e)}const TO=e=>{if(e)return{main:e,light:hO(bO(e,.4)),dark:hO(AO(e,.15)),hover:hO(AO(e,.15)),active:hO(AO(e,.2))}},kO=e=>{if(e)return{main:e,light:bO(e,.7),dark:AO(e,.2)}},EO=(e,t)=>{var n,o,i,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)?C({},t,{palette:{primary:C({},TO(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:C({},TO(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:C({},TO(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},kO(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},kO(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},kO(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},kO(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},IO={},PO={},OO={},LO={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"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]}};class _O{constructor(){this._theme=IO,this._themeV2=PO,this._navigation=LO,this._localizations=OO}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _O;return n.set(e),_O._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,o,i,a,r,l;this._navigation=pO().all([null!=(t=LO)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=pO().all([null!=(o=IO)?o:{},EO(null==e?void 0:e.theme,IO)]),this._themeV2=pO().all([null!=(i=PO)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=pO().all([null!=(r=OO)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=LO,this._theme=IO,this._themeV2=PO,this._localizations=OO}}}_O._instances={};var wO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},CO=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},UO=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))},RO=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let DO,NO,MO,FO,GO,$O,xO,VO,jO,BO,WO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(DO||(DO={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(NO||(NO={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(MO||(MO={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(FO||(FO={})),function(e){e.Invoices="invoices"}(GO||(GO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}($O||($O={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(xO||(xO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(VO||(VO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(jO||(jO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(BO||(BO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(WO||(WO={}));const KO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},HO={hidden:"hidden",edit:"edit"};var zO="6.128.0",qO={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on"},YO=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];I(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(zO),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.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=R(N().mark((function e(){var t,n,o,a,r;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=mr,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.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:_O.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(N().mark((function e(){return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(N().mark((function e(){var t;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}Tl.set(qO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,kl();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Tl.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=i.store.getState().auth.user)?void 0:e.entitlements};var l=wO(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=dO({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),wa.setAppName(l)}var t,n,o,i;return _(e,[{key:"setEntitlementsOptions",value:function(e){wa.setEntitlementsOptions(C({},e))}},{key:"initContainers",value:(i=R(N().mark((function e(t){return N().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){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;_O.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,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:E})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=R(N().mark((function e(){return N().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){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(N().mark((function e(){var t;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return wa.setRequestSource(ro.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),RO(t),wa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(N().mark((function e(t){var n;return N().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,C({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:"getFeatureEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.features)?void 0:n[t],ml.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return yO(null==e||null==(n=e.permissions)?void 0:n[t],ml.MISSING_PERMISSION)})(this.getEntitlementsFromStore(),e)}},{key:"getEntitlements",value:function(e){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey):this.getFeatureEntitlements(e.featureKey)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),JO=function(){function e(){I(this,e)}return _(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=w.getInstance(o);e&&t?(wa.setAccessToken(t),wa.setUser(C({},n,{accessToken:t})),i.store.dispatch(Uo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Uo.loadTenants())):(wa.setAccessToken(null),wa.setUser(null),i.store.dispatch(Uo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),QO=function(){function e(){I(this,e)}return _(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),XO=function(){function e(){I(this,e)}return _(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),ZO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},eL=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new YO(this.options,t,!0),_O.set({},t)}var t;return _(e,[{key:"render",value:(t=R(N().mark((function e(t){var n,o,i,a,r=this;return N().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,UO(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}(),tL="modern",nL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[tL]},oL=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=dO({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new YO(this.options,t,!0,a),_O.set({},t)}var t;return _(e,[{key:"render",value:(t=R(N().mark((function e(t){var n,o,i,a,r=this;return N().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,o=function(e){r.themeSetter=e},i=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:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,UO(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 iL(e,t){return iL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},iL(e,t)}function aL(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&&iL(e,t)}function rL(e,t){if(t&&("object"===P(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 lL(e){return lL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},lL(e)}function sL(){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 cL(e,t,n){return cL=sL()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&iL(i,n.prototype),i},cL.apply(null,arguments)}function uL(e){var t="function"==typeof Map?new Map:void 0;return uL=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 cL(e,arguments,lL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),iL(n,e)},uL(e)}function dL(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,o=lL(e);if(t){var i=lL(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return rL(this,n)}}var yL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new YO(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){aL(n,e);var t=dL(n);function n(){var e;I(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return _(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=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=CO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=CO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=CO(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=CO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=CO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=CO(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(uL(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));