@frontegg/js 6.138.0 → 6.139.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +100 -67
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function 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 LO},AdminPortalRenderer:function(){return wO},AppHolder:function(){return w},CheckoutDialog:function(){return OO},FronteggApp:function(){return IO},HostedLogin:function(){return PO},LoginBoxRenderer:function(){return RO},createElement:function(){return lO},defaultTheme:function(){return CO},formatName:function(){return rO},getThemeAdminByName:function(){return _O},getThemeByName:function(){return UO},initialize:function(){return BO},mockFlagsList:function(){return EO},restoreSearchParams:function(){return cO},waitThemeSetter:function(){return sO}});var e={};n.r(e),n.d(e,{Delete:function(){return Er},Get:function(){return Ar},Patch:function(){return Tr},Post:function(){return br},PostDownload:function(){return Ir},Put:function(){return kr},extractHeadersFromOptions:function(){return Pr},getBaseUrl:function(){return vr},getMetadataHeaders:function(){return hr}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Nr},getParentTenants:function(){return Cr},getParentTenantsById:function(){return Ur},getSubTenants:function(){return _r},getSubTenantsAsTree:function(){return wr},getTenants:function(){return Or},getTenantsUsersCount:function(){return Rr},searchSubTenants:function(){return Dr},switchTenant:function(){return Lr}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return Sl},getCurrentUserTenantsV3:function(){return bl},getUsersGroups:function(){return Al},getUsersRoles:function(){return ml},getUsersV2:function(){return vl},getUsersV3:function(){return hl},sendResetBreachedPasswordEmails:function(){return Tl},updateUserProfileV2:function(){return kl}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return El}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Ol},loadFeatureFlags:function(){return _l}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return To},MachineToMachineAuthStrategy:function(){return ko},OAuthLogout:function(){return is},SocialLoginProviders:function(){return bo},acceptInvitation:function(){return Zl},activateAccount:function(){return ql},activateAccountV2:function(){return Yl},bulkCreateIPRestriction:function(){return nl},changePhoneNumber:function(){return lu},changePhoneNumberWithVerification:function(){return au},checkIfAllowToRememberMfaDevice:function(){return _c},createDomainRestriction:function(){return Jr},createIPRestriction:function(){return tl},createOrUpdateSessionConfigrations:function(){return fc},createSSOConfiguration:function(){return Nc},createSSOConfigurationByMetadata:function(){return Gc},createSSOConfigurationByMetadataUrl:function(){return xc},createSSODomain:function(){return Bc},createSSOGroup:function(){return zc},createSamlGroup:function(){return Qs},createTenantAccessToken:function(){return bc},createUserAccessToken:function(){return Ac},deleteAllSessionsForUser:function(){return gc},deleteDomainRestriction:function(){return Xr},deleteIPRestriction:function(){return il},deleteSSOConfiguration:function(){return Fc},deleteSSODomain:function(){return jc},deleteSSOGroup:function(){return Yc},deleteSamlGroup:function(){return Zs},deleteSessionForUser:function(){return pc},deleteTenantAccessToken:function(){return hc},deleteTenantApiToken:function(){return Pc},deleteUserAccessToken:function(){return mc},deleteUserApiToken:function(){return Lc},deleteWebAuthnDevice:function(){return fu},disableMFAAuthenticatorApp:function(){return hs},disableMFASMS:function(){return As},disableMFAWebAuthn:function(){return Ts},disableMfa:function(){return vs},enrollMFAAuthenticatorApp:function(){return ds},enrollMFAAuthenticatorAppForLogin:function(){return Is},enrollMFAAuthenticatorAppForLoginV2:function(){return Ps},enrollMFASMS:function(){return fs},enrollMFASMSForLogin:function(){return Us},enrollMFASMSForLoginV2:function(){return Rs},enrollMFAWebAuthn:function(){return gs},enrollMFAWebAuthnForLogin:function(){return Gs},enrollMFAWebAuthnForLoginV2:function(){return $s},enrollMfa:function(){return cs},exchangeOAuthTokens:function(){return tu},exchangeOAuthTokensV2:function(){return Zc},forgotPassword:function(){return as},generateLoginResponse:function(){return Rl},generateLoginResponseFromOAuthResponse:function(){return Gl},generateLoginResponseFromOAuthResponseV2:function(){return $l},generateLoginResponseV2:function(){return Dl},generateLoginResponseV3:function(){return Fl},getActivateAccountStrategy:function(){return Jl},getCaptchaPolicy:function(){return jr},getCurrentUserSession:function(){return uc},getCurrentUserSessions:function(){return cc},getCustomSocialLoginProvidersV1:function(){return ac},getDomainRestrictions:function(){return qr},getDomainRestrictionsConfig:function(){return Yr},getGlobalSecurityPolicy:function(){return Mr},getIPRestrictions:function(){return Zr},getIPRestrictionsConfig:function(){return el},getLockoutPolicy:function(){return xr},getMFADevices:function(){return ks},getMFAStrategiesConfig:function(){return vu},getMeAndEntitlements:function(){return Au},getMeV2:function(){return mu},getMfaPolicy:function(){return Fr},getOidcConfiguration:function(){return ec},getPasswordConfigPolicy:function(){return zr},getPasswordHistoryPolicy:function(){return Wr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Su},getSSOConfigurations:function(){return Dc},getSSODefaultRoles:function(){return Kc},getSSOGroups:function(){return Jc},getSSOPublicConfiguration:function(){return tc},getSamlConfiguration:function(){return js},getSamlRoles:function(){return qs},getSamlRolesGroups:function(){return Ys},getSamlVendorConfiguration:function(){return Ks},getSessionConfigurations:function(){return yc},getSocialLoginProviders:function(){return nc},getSocialLoginProvidersV2:function(){return oc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return ic},getTenantAccessTokensData:function(){return vc},getTenantApiTokensData:function(){return kc},getUserAccessTokensData:function(){return Sc},getUserApiTokensData:function(){return Tc},getUserAuthorization:function(){return hu},getUserById:function(){return Oc},getVendorConfig:function(){return lc},getVendorLockoutPolicy:function(){return Vr},getVendorMfaPolicy:function(){return Gr},getVendorPasswordHistoryPolicy:function(){return Kr},getVendorPublicAuthStrategiesConfig:function(){return gu},getWebAuthnDevices:function(){return yu},loadPasswordConfig:function(){return ls},login:function(){return Wl},loginViaSocialLogin:function(){return rc},loginWithMfa:function(){return Hl},loginWithMfaV2:function(){return zl},loginv2:function(){return Kl},logout:function(){return os},oidcPostLogin:function(){return jl},oidcPostLoginV2:function(){return Xc},passwordlessPostLogin:function(){return Uc},passwordlessPostLoginV2:function(){return Cc},passwordlessPreLogin:function(){return wc},postLogin:function(){return Bl},preDisableMFASMS:function(){return ms},preDisableMFAWebAuthn:function(){return bs},preEnrollMFAAuthenticatorApp:function(){return us},preEnrollMFAAuthenticatorAppForLogin:function(){return Es},preEnrollMFASMS:function(){return ys},preEnrollMFASMSForLogin:function(){return Cs},preEnrollMFAWebAuthn:function(){return ps},preEnrollMFAWebAuthnForLogin:function(){return Fs},preLogin:function(){return xl},preLoginV2:function(){return Qc},preLoginWithIdpType:function(){return Vl},preVerifyMFAEmailCode:function(){return Os},preVerifyMFASMSForLogin:function(){return Ds},preVerifyMFAWebAuthnForLogin:function(){return xs},recoverMfaToken:function(){return ss},refreshToken:function(){return es},refreshTokenV2:function(){return ts},refreshTokenV3:function(){return ns},resendActivationEmail:function(){return Ql},resendInvitationEmail:function(){return Xl},resetPassword:function(){return rs},resetPhoneNumber:function(){return ou},revokeSessionsForUser:function(){return dc},saveLockoutPolicy:function(){return Br},saveMfaPolicy:function(){return $r},savePasswordHistoryPolicy:function(){return Hr},setSSODefaultRoles:function(){return Hc},signUpUser:function(){return sc},silentOAuthRefreshToken:function(){return nu},silentOAuthRefreshTokenV2:function(){return eu},testCurrentIp:function(){return al},testCurrentIpInAllowList:function(){return rl},updateDomainRestrictionConfig:function(){return Qr},updateIPRestrictionConfig:function(){return ol},updateSSOConfiguration:function(){return Mc},updateSSOConfigurationByMetadata:function(){return $c},updateSSOConfigurationByMetadataUrl:function(){return Vc},updateSSOGroup:function(){return qc},updateSamlConfiguration:function(){return Ws},updateSamlGroup:function(){return Xs},updateSamlRoles:function(){return Js},updateSamlVendorMetadata:function(){return Hs},updateTenantApiTokensData:function(){return Ic},updateUserApiTokensData:function(){return Ec},validateSSODomain:function(){return Wc},validateSamlDomain:function(){return zs},verifyChangePhoneNumber:function(){return ru},verifyInviteToken:function(){return Rc},verifyMFAAuthenticatorAppForLogin:function(){return Ls},verifyMFAEmailCode:function(){return _s},verifyMFAEmailCodeV2:function(){return ws},verifyMFASMSForLogin:function(){return Ns},verifyMFASMSForLoginV2:function(){return Ms},verifyMFAWebAuthnForLogin:function(){return Vs},verifyMFAWebAuthnForLoginV2:function(){return Bs},verifyMfa:function(){return Ss},verifyNewDeviceSession:function(){return pu},verifyResetPhoneNumber:function(){return iu},webAuthnCreateNewDeviceSession:function(){return du},webAuthnPostLogin:function(){return cu},webAuthnPostLoginV2:function(){return uu},webAuthnPreLogin:function(){return su}});var s={};n.r(s),n.d(s,{addUser:function(){return Pu},changePassword:function(){return Eu},createInviteUserLink:function(){return _u},deleteInviteUserLink:function(){return Cu},deleteUser:function(){return Lu},getInviteLinkConfiguration:function(){return Ru},getInviteUserLink:function(){return Uu},getProfile:function(){return bu},loadAvailablePermissions:function(){return Nu},loadAvailableRoles:function(){return Du},loadStats:function(){return Mu},loadUsers:function(){return Iu},resendActivationLink:function(){return Fu},resendInvitationLink:function(){return Gu},resendInvitationLinkToAllTenants:function(){return $u},updateInviteUserLink:function(){return wu},updateProfile:function(){return Tu},updateProfileImage:function(){return ku},updateUser:function(){return Ou}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Vu},getAuditsMetadata:function(){return Hu},getCurrentUserIpMetadata:function(){return ju},getIpAdressMetadata:function(){return zu},getNotificationsMetadata:function(){return Wu},getSamlMetadata:function(){return Ku},updateAdminBoxMetadata:function(){return Bu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return td},getReport:function(){return Xu},getReports:function(){return Qu},renderReport:function(){return Zu},scheduleReport:function(){return ed},sendReport:function(){return nd}});var d={};n.r(d),n.d(d,{getNotifications:function(){return od},markAllAsRead:function(){return rd},updateNotificationIsPinned:function(){return ad},updateNotificationStatus:function(){return id}});var y={};n.r(y),n.d(y,{exportAudits:function(){return ud},getAudits:function(){return sd},getAuditsStats:function(){return cd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Ed},deleteEmailSubscriptions:function(){return Td},deleteSMSConfiguration:function(){return wd},deleteSMSSubscriptions:function(){return Od},deleteSlackConfiguration:function(){return vd},deleteWebhooksConfiguration:function(){return Rd},getCategories:function(){return Fd},getChannelMaps:function(){return Gd},getEmailConfiguration:function(){return md},getSMSConfiguration:function(){return Id},getSlackChannels:function(){return gd},getSlackConfiguration:function(){return fd},getSlackScope:function(){return pd},getWebhookLog:function(){return Dd},getWebhooksConfigurations:function(){return Cd},patchEmailConfiguration:function(){return bd},patchSMSConfiguration:function(){return Ld},postEmailConfiguration:function(){return Ad},postSMSConfiguration:function(){return Pd},postSlackCode:function(){return hd},postSlackConfiguration:function(){return Sd},postWebhookRetry:function(){return Md},postWebhookTest:function(){return Nd},postWebhooksConfiguration:function(){return Ud},putEmailSubscriptions:function(){return kd},putSMSSubscriptions:function(){return _d}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Vd},getSettings:function(){return xd},updateSettings:function(){return $d}});var g={};n.r(g),n.d(g,{addRole:function(){return Hd},attachPermissionToRoles:function(){return Qd},attachPermissionsToRole:function(){return Yd},deleteRole:function(){return zd},getPermissionCategories:function(){return Xd},getPermissions:function(){return Jd},getRoles:function(){return Kd},updateRole:function(){return qd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return wy},ISubscriptionStatus:function(){return Oy},PaymentMethodType:function(){return _y},ProviderType:function(){return Cy},TenantCreatedAction:function(){return Ry},TrialEndAction:function(){return Uy},cancelManagedSubscription:function(){return ry},cancelSubscription:function(){return ty},createStripeCustomer:function(){return Ay},createStripePaymentMethodSetupIntentSecret:function(){return Ty},createSubscription:function(){return hy},createTenantConfiguration:function(){return Iy},getManagedSubscription:function(){return iy},getManagedSubscriptions:function(){return ay},getPaymentMethod:function(){return Sy},getPaymentMethods:function(){return gy},getPaymentProviders:function(){return Py},getStripeCustomer:function(){return my},getStripePaymentProviderConfiguration:function(){return by},getSubscription:function(){return ey},getSubscriptionInvoice:function(){return yy},getSubscriptionInvoicePdf:function(){return fy},getSubscriptionInvoices:function(){return dy},getSubscriptionPlan:function(){return uy},getSubscriptionPlans:function(){return cy},getSubscriptionSummaries:function(){return ky},getSubscriptions:function(){return Zd},getTenantConfiguration:function(){return Ey},getVendorPublicConfigurations:function(){return Ly},renewManagedSubscription:function(){return ly},renewSubscription:function(){return ny},updateManagedSubscription:function(){return sy},updatePaymentMethodBillingDetails:function(){return vy},updateSubscription:function(){return oy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Dy}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Gy},addUserToTenantAndSubTenants:function(){return My},addUsersToSubTenant:function(){return Ky},createSubTenant:function(){return Vy},deleteSubTenant:function(){return By},loadAllUsers:function(){return Ny},removeUserFromTenantAndSubTenants:function(){return Fy},removeUserRolesFromSubTenants:function(){return $y},setUserRolesForSubTenants:function(){return xy},updateSubAccountAccess:function(){return Wy},updateSubTenant:function(){return jy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Jy},createConfiguration:function(){return qy},deleteConfiguration:function(){return Yy},getConfigs:function(){return Hy},updateConfiguration:function(){return zy}});var A={};n.r(A),n.d(A,{impersonate:function(){return Qy}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return rf},addUsersToGroup:function(){return sf},createGroup:function(){return nf},deleteGroup:function(){return af},deleteRolesFromGroup:function(){return lf},deleteUsersFromGroup:function(){return cf},getGroupById:function(){return Zy},getGroupConfiguration:function(){return uf},getGroups:function(){return ef},getGroupsByIds:function(){return tf},updateGroup:function(){return of},updateGroupConfiguration:function(){return df}});var T={};n.r(T),n.d(T,{getInsights:function(){return ff},getRecommendations:function(){return yf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Pl},AuthStrategyEnum:function(){return To},ContextHolder:function(){return Ca},FeatureFlags:function(){return Ol},FronteggApiError:function(){return Ra},FronteggContext:function(){return Ua},FronteggFrameworks:function(){return lo},GetUsersFilterPreset:function(){return uo},GroupManagedByEnum:function(){return If},GroupRelations:function(){return Ef},ISubscriptionCancellationPolicy:function(){return wy},ISubscriptionStatus:function(){return Oy},InsightCode:function(){return Lf},LOAD_AUTHORIZATION_FF:function(){return pl},MFAStrategyEnum:function(){return fl},MachineToMachineAuthStrategy:function(){return ko},NotEntitledJustification:function(){return Il},PaginationOrderEnum:function(){return so},PaymentMethodType:function(){return _y},ProviderType:function(){return Cy},RecommendationActionKey:function(){return Of},RecommendationCode:function(){return Pf},RecommendationSeverity:function(){return _f},RequestSource:function(){return ro},RestrictionType:function(){return Vn},ScimConnectionSource:function(){return kf},SecondaryAuthStrategy:function(){return dl},SecurityCategory:function(){return wf},SocialLoginProviders:function(){return bo},SortByEnum:function(){return co},TenantSortByEnum:function(){return gf},TenantType:function(){return Sf},UserManagedByEnum:function(){return pf},WebAuthnDeviceType:function(){return yl},api:function(){return Cf},countConfigurationUsers:function(){return Jy},createConfiguration:function(){return qy},default:function(){return Uf},deleteConfiguration:function(){return Yy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return vf},fronteggHeaders:function(){return ao},fronteggRefreshTokenUrl:function(){return hf},fronteggSilentRefreshTokenUrl:function(){return mf},fronteggTenantsUrl:function(){return bf},fronteggTenantsV3Url:function(){return Tf},fronteggUsersUrl:function(){return Af},getConfigs:function(){return Hy},loadFeatureFlags:function(){return _l},providersArray:function(){return yo},updateConfiguration:function(){return zy}});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 AO},AccountPageFields:function(){return fO},DomainRestrictionsTabFields:function(){return mO},GeneralSettingsTabFields:function(){return vO},InviteUserModalFields:function(){return yO},IpRestrictionsTabFields:function(){return hO},Metadata:function(){return aO},PrivacyPageFields:function(){return dO},ProfilePageFields:function(){return uO},SecurityPageTabs:function(){return gO},SessionManagementTabFields:function(){return SO},SubscriptionsPageFields:function(){return pO},alpha:function(){return YL},fieldAppearance:function(){return bO},tabAppearance:function(){return TO}});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 B(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 j(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(B(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||B(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(j(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 Be(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(Be)(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 je(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=je(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)),Be(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:!j(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}))),requestHostedLoginAuthorizeV2:ct("auth/requestHostedLoginAuthorizeV2",(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 Bt={step:Vt.validate},jt={setAcceptInvitationState:pt("acceptInvitationState"),resetAcceptInvitationState:ft("acceptInvitationState",{acceptInvitationState:Bt})},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 Bn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Vn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={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,uo;!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={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(uo||(uo={}));const yo=["local","saml","google","github","facebook","microsoft","scim2","slack"],fo={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:so.DESC,_sortBy:co.name},usersPageOffset:0,accountSettings:{}}},po={setAllAccountsLoader:St("allAccountsState"),setAllAccountsError:vt("allAccountsState"),setAllAccountsState:pt("allAccountsState"),setSelectedAccountState:gt("allAccountsState","selectedAccount"),resetAllAccountsState:ft("allAccountsState",{allAccountsState:fo})},go={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}))),setRootAccountData:ct("auth/setRootAccountData"),setSelectedSubAccountData:ct("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ct("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},So={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:[]}},vo={setAllAccountDialogsState:pt("allAccountsDialogsState"),resetAllAccountDialogsState:ft("allAccountsDialogsState",{allAccountsDialogsState:So}),openCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",So.createSubAccountDialog),openUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",So.updateSubAccountDialog),openDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",So.deleteSubAccountDialog),openAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",So.addUsersToAccountDialog),openDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",So.deleteUserFromAccountDialog),openEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",So.editUserRolesDialog)},ho={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_presetParams:{_maxInactiveSeconds:7776e3}}}},mo={setSecurityCenterState:pt("securityCenterState"),resetSecurityCenterState:ft("securityCenterState",{securityCenterState:ho}),setSecurityCenterStateLoader:St("securityCenterState"),setSecurityCenterStateError:vt("securityCenterState")},Ao={loadRecommendations:ct("auth/loadRecommendations"),loadInsights:ct("auth/loadInsights"),sendResetBreachedPasswordEmail:ct("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ct("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ct("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ct("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ct("auth/loadInactiveUsers",(e=>({payload:e})))};let bo,To,ko;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(bo||(bo={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(To||(To={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(ko||(ko={}));const Eo={[To.Code]:It.loginWithOtc,[To.EmailAndPassword]:It.loginWithPassword,[To.MagicLink]:It.magicLinkPreLoginSuccess,[To.SmsCode]:It.loginWithSmsOtc},Io={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:vn,loginState:Dt,activateState:Gt,acceptInvitationState:Bt,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:Bn,provisioningState:Kn,passkeysState:qn,allAccountsState:fo,allAccountsDialogsState:So,securityCenterState:ho},Po=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:()=>{}},Io);let Lo;!function(e){e.impersonating="impersonating",e.success="success"}(Lo||(Lo={}));const Oo={step:Lo.impersonating,loading:!1},_o={setImpersonateState:pt("impersonateState"),resetImpersonateState:ft("impersonateState",{impersonateState:Oo})},wo={impersonate:ct("impersonation/impersonate",(e=>({payload:e})))},{reducer:Co,actions:Uo}=dt({name:wt,initialState:Po,reducers:C({resetState:e=>C({},e,Io),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t})),setEntitlements:gt("user","entitlements")},Nt,pn,$t,_o,jt,zt,Qt,hn,on,oo,en,sn,dn,Xn,to,bn,En,Ln,wn,Rn,Mn,$n,jn,Hn,Yn,po,vo,mo)});const Ro=C({loadEntitlements:ct("auth/loadEntitlements",(e=>({payload:e})))},Uo,Mt,gn,xt,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,{},Tn,In,On,Cn,Dn,Fn,xn,Wn,zn,wo,Jn,go,Ao);var Do=function(e){return"@@redux-saga/"+e},No=Do("CANCEL_PROMISE"),Mo=Do("CHANNEL_END"),Fo=Do("IO"),Go=Do("MATCH"),$o=Do("MULTICAST"),xo=Do("SAGA_ACTION"),Vo=Do("SELF_CANCELLATION"),Bo=Do("TASK"),jo=Do("TASK_CANCEL"),Wo=Do("TERMINATE"),Ko=Do("LOCATION");function Ho(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 zo=function(e){return null==e},qo=function(e){return null!=e},Yo=function(e){return"function"==typeof e},Jo=function(e){return"string"==typeof e},Qo=Array.isArray,Xo=function(e){return e&&Yo(e.then)},Zo=function(e){return e&&Yo(e.next)&&Yo(e.throw)},ei=function e(t){return t&&(Jo(t)||oi(t)||Yo(t)||Qo(t)&&t.every(e))},ti=function(e){return e&&Yo(e.take)&&Yo(e.close)},ni=function(e){return Yo(e)&&e.hasOwnProperty("toString")},oi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},ii=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[No]=function(){clearTimeout(n)},o},ai=function(e){return function(){return e}},ri=ai(!0),li=function(){},si=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ci=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ui(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var di=function(e){throw e},yi=function(e){return{value:e,done:!0}};function fi(e,t,n){void 0===t&&(t=di),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:yi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function pi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var gi=function(e){return Array.apply(null,new Array(e))},Si=function(e){return function(t){return e(Object.defineProperty(t,xo,{value:!0}))}},vi=function(e){return e===Wo},hi=function(e){return e===jo},mi=function(e){return vi(e)||hi(e)};function Ai(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Qo(e)?gi(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||mi(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=li,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function bi(e){return{name:e.name||"anonymous",location:Ti(e)}}function Ti(e){return e[Ko]}var ki=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)},Ei="TAKE",Ii="CALL",Pi="FORK",Li="SELECT",Oi=function(e,t){var n;return(n={})[Fo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function _i(e,t){return void 0===e&&(e="*"),ei(e)?(qo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Oi(Ei,{pattern:e})):ti(n=e)&&n[$o]&&qo(t)&&ei(t)?Oi(Ei,{channel:e,pattern:t}):ti(e)?(qo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Oi(Ei,{channel:e})):void 0;var n}function wi(e,t){return zo(t)&&(t=e,e=void 0),Oi("PUT",{channel:e,action:t})}function Ci(e){var t=Oi("ALL",e);return t.combinator=!0,t}function Ui(e,t){var n,o=null;return Yo(e)?n=e:(Qo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Jo(n)&&Yo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}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,Ui(e,n))}function Di(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(Pi,Ui(e,n))}function Ni(e){return void 0===e&&(e=Vo),Oi("CANCEL",e)}function Mi(e){void 0===e&&(e=si);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(Li,{selector:e,args:n})}var Fi=Ri.bind(null,ii);var Gi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},$i=[],xi=0;function Vi(e){try{Wi(),e()}finally{Ki()}}function Bi(e){$i.push(e),xi||(Wi(),Hi())}function ji(e){try{return Wi(),e()}finally{Hi()}}function Wi(){xi++}function Ki(){xi--}function Hi(){var e;for(Ki();!xi&&void 0!==(e=$i.shift());)Vi(e)}var zi=function(e){return function(t){return e.some((function(e){return Xi(e)(t)}))}},qi=function(e){return function(t){return e(t)}},Yi=function(e){return function(t){return t.type===String(e)}},Ji=function(e){return function(t){return t.type===e}},Qi=function(){return ri};function Xi(e){var t="*"===e?Qi:Jo(e)?Yi:Qo(e)?zi:ni(e)?Yi:Yo(e)?qi:oi(e)?Ji:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Zi={type:Mo},ea=function(e){return e&&e.type===Mo};function ta(){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(Zi)}))},(e={})[$o]=!0,e.put=function(e){if(!t)if(ea(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[Go](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Qi),t?e(Zi):(e[Go]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),ui(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[xo]?l(e):Bi((function(){l(e)}))},r}function na(e,t){var n=e[No];Yo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var oa,ia=0,aa=function(){return++ia};function ra(e){e.isRunning()&&e.cancel()}var la=((oa={}).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):!ea(e)||r?n(e):n(Wo)};try{i.take(l,qo(a)?Xi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},oa.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Bi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Xo(t)?na(t,n):n(t)}))},oa.ALL=function(e,t,n,o){var i=o.digestEffect,a=ia,r=Object.keys(t);if(0!==r.length){var l=Ai(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Qo(t)?[]:{})},oa.RACE=function(e,t,n,o){var i=o.digestEffect,a=ia,r=Object.keys(t),l=Qo(t)?gi(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||mi(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=li,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)}))},oa.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(Xo(s))return void na(s,n);if(Zo(s))return void va(e,s,l.context,ia,bi(a),!1,n);n(s)}catch(e){n(e,!0)}},oa.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){zo(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},oa.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(Zo(i))return i;var a=!1;return fi((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Xo(i)})}))}catch(e){return fi((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:bi(t)}(c,a);ji((function(){var t=va(e,c,s.context,ia,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},oa.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()&&ui(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Qo(t)){if(0===t.length)return void n([]);var r=Ai(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},oa.CANCEL=function(e,t,n,o){var i=o.task;t===Vo?ra(i):Qo(t)?t.forEach(ra):ra(t),n()},oa.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)}},oa.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=ki());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Zi):e.isEmpty()?(n.push(o),o.cancel=function(){ui(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(Zi):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])(Zi)}}}}(t.buffer),a=Xi(o),r=function t(n){ea(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)},oa.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},oa.FLUSH=function(e,t,n){t.flush(n)},oa.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},oa.SET_CONTEXT=function(e,t,n,o){var i=o.task;ci(i.context,t),n()},oa);function sa(e,t){return e+"?"+t}function ca(e){var t=e.name,n=e.location;return n?t+" "+sa(n.fileName,n.lineNumber):t}function ua(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 da=null,ya=[],fa=function(e){e.crashedEffect=da,ya.push(e)},pa=function(){da=null,ya.length=0},ga=function(){var e,t,n=ya[0],o=ya.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Ti(e))?t.code+" "+sa(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ca(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+ca(e.meta)})),[ua(ya)]).join("\n")};function Sa(e,t,n,o,i,a,r){var l;void 0===r&&(r=li);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||(ui(i,t),t.cont=li,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=li,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,fa({meta:i,cancelledTasks:y}),S.isRoot){var o=ga();pa(),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={})[Bo]=!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){ci(f,e)},l.toPromise=function(){return d||(d=Gi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function va(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Xo(t)?na(t,o):Zo(t)?va(e,t,c.context,n,i,!1,o):t&&t[Fo]?(0,la[t.type])(e,t.payload,o,u):o(t)}));d.cancel=li;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(jo))},status:0},c=Sa(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),pa()):hi(e)?(s.status=1,d.cancel(),i=Yo(t.return)?t.return(jo):{done:!0,value:jo}):i=vi(e)?Yo(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=aa();function s(n,i){a||(a=!0,o.cancel=li,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){da=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=li,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=li,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function ha(e,t){for(var n=e.channel,o=void 0===n?ta():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?pi: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=aa();if(s&&(s.rootSagaStarted=s.rootSagaStarted||li,s.effectTriggered=s.effectTriggered||li,s.effectResolved=s.effectResolved||li,s.effectRejected=s.effectRejected||li,s.effectCancelled=s.effectCancelled||li,s.actionDispatched=s.actionDispatched||li,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=si;var m={channel:o,dispatch:Si(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return ji((function(){var e=va(m,S,l,v,bi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var ma=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?ta():a,l=n.sagaMonitor,s=Ho(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=ha.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){ci(i,e)},c},Aa=function(e){return{done:!0,value:e}},ba={};function Ta(e){return ti(e)?"channel":ni(e)?String(e):Yo(e)?e.name:String(e)}function ka(e,t,n){var o,i,a,r=t;function l(t,n){if(r===ba)return Aa(t);if(n&&!i)throw r=ba,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===ba?Aa(t):a}return fi(l,(function(e){return l(null,e)}),n)}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={done:!1,value:_i(e)},l=function(e){return{done:!1,value:Di.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ka({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Ta(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,l={done:!1,value:_i(e)},s=function(e){return{done:!1,value:Di.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Ni(e)}},u=function(e){return a=e},d=function(e){return r=e};return ka({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("+Ta(e)+", "+t.name+")")}function Pa(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:_i(e)},l=function(e){return{done:!1,value:Ri.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return ka({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Ta(e)+", "+t.name+")")}function La(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:Ri.apply(void 0,[n].concat(a))},s={done:!1,value:Fi(t)};return ka({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:ba}},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 Di.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 Di.apply(void 0,[Ia,e,t].concat(o))}function wa(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 Di.apply(void 0,[Pa,e,t].concat(o))}class Ca{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 Ca.instance||(Ca.instance=new Ca),Ca.instance}static setContext(e){Ca.getInstance().context=e}static setAccessToken(e){Ca.getInstance().accessToken=e}static setUser(e){Ca.getInstance().user=e}static setRequestSource(e){Ca.getInstance().requestSource=e}static setOnRedirectTo(e){Ca.getInstance().onRedirectTo=e}static setLogout(e,t){Ca.getInstance().logout=n=>{n?e(n):Ca.onRedirectTo(t)}}static setEntitlementsOptions(e){Ca.getInstance().entitlementsOptions=e}static setAppName(e){Ca.getInstance().appName=e}static getContext(){var e;return null!=(e=Ca.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ca.getInstance().accessToken}static getRequestSource(){return Ca.getInstance().requestSource}static getUser(){return Ca.getInstance().user}static onRedirectTo(e,t){return Ca.getInstance().onRedirectTo(e,t)}static logout(e){return Ca.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Ca.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return Ca.getInstance().appName}}Ca.instance=void 0;const Ua={getContext:()=>Ca.getContext(),getAccessToken:()=>Ca.getAccessToken(),getUser:()=>Ca.getUser(),onRedirectTo:(e,t)=>Ca.onRedirectTo(e,t),logout:e=>Ca.logout(e)};class Ra extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Da={v1:"/identity/resources/users/webauthn/v1/devices"},Na={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ma={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"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"}},Fa={v1:"/identity/resources/configurations/v1"},Ga={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},$a={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},xa={v1:"/identity/resources/permissions/v1"},Va={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"}},Ba={v1:"/identity/resources/roles/v1"},ja={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Wa={v1:"/identity/resources/impersonation/v1"},Ka={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ha={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},za={v1:"/team/resources/members/v1"},qa={v1:"/team/resources/roles/v1"},Ya={v1:"/team/resources/stats/v1"},Ja={v1:"/team/resources/profile"},Qa={v1:"/tenants/resources/account-settings/v1"},Xa={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"}},Za={v1:"/tenants/resources/sub-tenants/v1"},er={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},tr={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"}}}},nr={v1:"/subscriptions/resources/payment-providers/v1"},or={v1:"/subscriptions/resources/subscriptions/v1"},ir={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},ar={v1:"/reports/engine/resources/triggers/v1"},rr="/notification",lr="/audits",sr={v1:"/event/resources/configurations/v1"},cr="/webhook",ur="/oauth",dr="/flags",yr="/directory/resources/v1/configurations/scim2",fr="/directory/resources/scim/temp",pr="/entitlements/api/v1/user-entitlements",gr={v1:"/security-center/resources/recommendations/v1"},Sr={v1:"/security-center/resources/insights/v1"};function vr(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 hr(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 mr=async e=>{var t,n,o;const i=Ca.getContext(),a=await async function(e,t){var n;const o=hr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ca.getAccessToken)(),a=Ca.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=vr(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 Ra("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 Ra(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{}}},Ar=async(e,t,n)=>mr(C({url:e,method:"GET",contentType:"application/json",params:t},n)),br=async(e,t,n)=>mr(C({url:e,method:"POST",contentType:"application/json",body:t},n)),Tr=async(e,t,n)=>mr(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),kr=async(e,t,n)=>mr(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),Er=async(e,t,n)=>mr(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ir=async(e,t,n,o)=>mr(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Pr=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{});async function Lr(e){return kr(`${Ma.v1}/tenant`,e)}async function Or(){return Ar(`${Ma.v2}/me/tenants`)}async function _r(e){return Ar(Xa.v1,void 0,{headers:Pr(e)})}async function wr(e){return Ar(Xa.tree.v1,void 0,{headers:Pr(e)})}async function Cr(e){return Ar(Xa.parents.v1,void 0,{headers:Pr(e)})}async function Ur(e,t){return Ar(`${Xa.parents.v1}/${e}`,void 0,{headers:Pr(t)})}async function Rr(e,t){return br(`${Va.users.v1}/count`,e,{headers:Pr(t)})}async function Dr(e,t){return Ar(Xa.v2,e,{headers:Pr(t)})}async function Nr(e,t){return Ar(Xa.metadata.v2,C({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Pr(t)})}async function Mr(){return Ar(Fa.v1)}async function Fr(){return Ar(`${Fa.v1}/mfa-policy`)}async function Gr(){return Ar(`${Fa.v1}/mfa-policy/vendor`)}async function $r(e){return e.id?Tr(`${Fa.v1}/mfa-policy`,e):br(`${Fa.v1}/mfa-policy`,e)}async function xr(){return Ar(`${Fa.v1}/lockout-policy`)}async function Vr(){return Ar(`${Fa.v1}/lockout-policy/vendor`)}async function Br(e){return e.id?Tr(`${Fa.v1}/lockout-policy`,e):br(`${Fa.v1}/lockout-policy`,e)}async function jr(){try{return await Ar(`${Fa.v1}/captcha-policy/public`)}catch{return null}}async function Wr(){return Ar(`${Fa.v1}/password-history-policy`)}async function Kr(){return Ar(`${Fa.v1}/password-history-policy/vendor`)}async function Hr(e){return e.id?Tr(`${Fa.v1}/password-history-policy`,e):br(`${Fa.v1}/password-history-policy`,e)}async function zr(){return Ar(`${Fa.v1}/password`)}async function qr(){return Ar(`${Ga.emailDomain.v1}`)}async function Yr(){return Ar(`${Ga.emailDomain.v1}/config`)}async function Jr(e){return br(`${Ga.emailDomain.v1}`,e)}async function Qr(e){return br(`${Ga.emailDomain.v1}/config`,e)}async function Xr(e){return Er(`${Ga.emailDomain.v1}/${e}`)}async function Zr(e){return Ar(`${Ga.ip.v1}`,e)}async function el(){return Ar(`${Ga.ip.v1}/config`)}async function tl(e){return br(`${Ga.ip.v1}`,e)}async function nl(e){return br(`${Ga.ip.v1}/bulk`,e)}async function ol(e){return br(`${Ga.ip.v1}/config`,e)}async function il(e){return Er(`${Ga.ip.v1}/${e}`)}async function al(){return br(`${Ga.ip.v1}/verify`)}async function rl(){return br(`${Ga.ip.v1}/verify/allow`)}class ll extends Error{constructor(e){super(e)}}const sl="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new ll("'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 cl extends Error{constructor(e){super(e)}}const ul=(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(sl(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 sl(t)}})(e.split(".")[n]))}catch(e){throw new cl("Invalid token specified: "+e.message)}};let dl,yl,fl;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(dl||(dl={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(yl||(yl={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(fl||(fl={}));const pl="admin_portal_should_load_authorization",gl=["_presetParams"];async function Sl(e){return br(`${Ma.v3}/me/token`,e)}async function vl(e,t){return Ar(Ma.v2,e,{headers:Pr(t)})}async function hl(e,t){const{_presetParams:n}=e,o=C({},Ho(e,gl),{_presetParams:n?JSON.stringify(n):void 0});return Ar(Ma.v3,o,{headers:Pr(t)})}async function ml(e,t){return Ar(Ma.roles.v3,C({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function Al(e,t){return Ar(Ma.groups.v3,C({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function bl(e){return Ar(Ma.tenants.me.v3,void 0,{headers:Pr(e)})}async function Tl(){return br(Ma.passwords.resetBreachedPasswords.v1)}async function kl(e){return kr(`${Ma.v2}/me`,e)}async function El(){return Ar(pr)}let Il;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Il||(Il={}));const Pl="admin_portal_entitlements",Ll={flags:{}};class Ol{constructor(){var e;this._flags={},this._flags=null!=(e=Ll.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ol;return n.set(e),Ol._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==Ll?void 0:Ll.flags)?t:{},null!=e?e:{})}}async function _l(){return Ar(dr)}Ol._instances={};const wl=["type"],Cl=["type"],Ul=["type"];async function Rl(e){if(!e.accessToken)return e;Ca.setAccessToken(e.accessToken);const t=await Au(),n=C({},e,e.accessToken?ul(e.accessToken):{},t);return Ca.setUser(n),n}async function Dl(e){if(!e.accessToken)return{user:e};Ca.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Au(),Or()]),o=C({},e,e.accessToken?ul(e.accessToken):{},t);return Ca.setUser(o),{user:o,tenants:n}}function Nl(){if(!Ca.shouldLoadEntitlements())return!1;const[e]=Ol.getFeatureFlags([Pl],Ca.getAppName()||"");return e}function Ml(){const[e]=Ol.getFeatureFlags([pl],Ca.getAppName()||"");return e}async function Fl(e){const{accessToken:t}=e;if(!t)return{user:e};Ca.setAccessToken(t);const[n,o]=await Promise.all([Au(),bl()]),i=C({},e,t?ul(t):{},n);return Ca.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Gl(e){Ca.setAccessToken(e.id_token);const t=await Au(),n=e.id_token?ul(e.id_token):{},o=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Ca.setUser(o),o}async function $l(e){Ca.setAccessToken(e.id_token);const[t,n]=await Promise.all([Au(),bl()]),o=e.id_token?ul(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Ca.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function xl(e){try{const{address:t}=await br(`${Na.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Vl(e){return br(`${Na.v1}/user/saml/prelogin`,e)}async function Bl(e){return Rl(await br(`${Na.v1}/user/saml/postlogin`,e))}async function jl(e){return Rl(await br(`${Na.v1}/user/oidc/postlogin`,e))}async function Wl(e){return Rl(await br(`${Na.v1}/user`,e))}async function Kl(e){return Fl(await br(`${Na.v1}/user`,e))}async function Hl(e){return Rl(await br(`${Na.v1}/user/mfa/verify`,e))}async function zl(e){return Fl(await br(`${Na.v1}/user/mfa/verify`,e))}async function ql(e){return br(`${Ma.v1}/activate`,e)}async function Yl(e){return Fl(await br(`${Ma.v1}/activate`,e))}async function Jl(e){return Ar(`${Ma.v1}/activate/strategy`,e)}async function Ql(e){return br(`${Ma.v1}/activate/reset`,e)}async function Xl(e){return br(`${Ma.v1}/invitation/reset`,e)}async function Zl(e){return br(`${Ma.v1}/invitation/accept`,e)}async function es(){return Rl(await br(`${Na.v1}/user/token/refresh`))}async function ts(){return Dl(await br(`${Na.v1}/user/token/refresh`))}async function ns(){return Fl(await br(`${Na.v1}/user/token/refresh`))}async function os(){return br(`${Na.v1}/logout`)}async function is(e){return Ar(`${ur}/logout`,e)}async function as(e){return br(`${Ma.v1}/passwords/reset`,e)}async function rs(e){return br(`${Ma.v1}/passwords/reset/verify`,e)}async function ls(e){return Ar(`${Ma.v1}/passwords/config`,e)}async function ss(e){return br(`${Na.v1}/user/mfa/recover`,e)}async function cs(){return br(`${Ma.v1}/mfa/enroll`)}async function us(){return br(`${Ma.v1}/mfa/authenticator/enroll`)}async function ds(e){return br(`${Ma.v1}/mfa/authenticator/enroll/verify`,e)}async function ys(e){return br(`${Ma.v1}/mfa/sms/enroll`,e)}async function fs(e){return br(`${Ma.v1}/mfa/sms/enroll/verify`,e)}async function ps(){return br(`${Ma.v1}/mfa/webauthn/enroll`)}async function gs(e){return br(`${Ma.v1}/mfa/webauthn/enroll/verify`,e)}async function Ss(e){return br(`${Ma.v1}/mfa/enroll/verify`,e)}async function vs(e){return br(`${Ma.v1}/mfa/disable`,e)}async function hs(e,t){return br(`${Ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ms(e){return br(`${Ma.v1}/mfa/sms/${e}/disable`)}async function As(e,t){return br(`${Ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function bs(e){return br(`${Ma.v1}/mfa/webauthn/${e}/disable`)}async function Ts(e,t){return br(`${Ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function ks(){return Ar(`${Ma.v1}/mfa/devices`)}async function Es(e){return br(`${Na.v1}/user/mfa/authenticator/enroll`,e)}async function Is(e){return br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Ps(e){return Fl(await br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Ls(e,t){return br(`${Na.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Os(e){return br(`${Na.v1}/user/mfa/emailcode`,e)}async function _s(e){return br(`${Na.v1}/user/mfa/emailcode/verify`,e)}async function ws(e){return Fl(await br(`${Na.v1}/user/mfa/emailcode/verify`,e))}async function Cs(e){return br(`${Na.v1}/user/mfa/sms/enroll`,e)}async function Us(e){return br(`${Na.v1}/user/mfa/sms/enroll/verify`,e)}async function Rs(e){return Fl(await br(`${Na.v1}/user/mfa/sms/enroll/verify`,e))}async function Ds(e,t){return br(`${Na.v1}/user/mfa/sms/${e}`,t)}async function Ns(e,t){return br(`${Na.v1}/user/mfa/sms/${e}/verify`,t)}async function Ms(e,t){return Fl(await br(`${Na.v1}/user/mfa/sms/${e}/verify`,t))}async function Fs(e){return br(`${Na.v1}/user/mfa/webauthn/enroll`,e)}async function Gs(e){return br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e)}async function $s(e){return Fl(await br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e))}async function xs(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}`,t)}async function Vs(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Bs(e,t){return Fl(await br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t))}async function js(){return Ar(`${Ha.v1}/saml/configurations`)}async function Ws(e){return br(`${Ha.v1}/saml/configurations`,e)}async function Ks(){return Ar(`${Ha.v1}/saml/configurations/vendor-config`)}async function Hs(e){return kr(`${Ha.v1}/saml/configurations/metadata`,e)}async function zs(){return kr(`${Ha.v1}/saml/validations/domain`)}async function qs(){return Ar(`${Ha.v1}/saml/configurations/roles/default`)}async function Ys(){return Ar(`${Ha.v2}/saml/configurations/groups`)}async function Js({roleIds:e}){return br(`${Ha.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Qs({roleIds:e,group:t}){return br(`${Ha.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Xs({roleIds:e,group:t,id:n}){return Tr(`${Ha.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Zs({id:e}){return Er(`${Ha.v2}/saml/configurations/groups/${e}`)}async function ec(){return Ar(`${Ha.v1}/oidc/configurations`)}async function tc(){return Ar(`${Ha.v2}/configurations/public`)}async function nc(){return Ar($a.v1)}async function oc(){return Ar($a.v2)}async function ic(){return Ar(`${$a.v2}/authenticated`)}async function ac(){return Ar($a.custom.v1)}async function rc({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),br(`${Na.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function lc(){return Ar(`${Fa.v1}/public`)}async function sc(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await br(`${Ma.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await Fl(n);return C({},a,{user:e,tenants:t,activeTenant:o})}return a}async function cc(){return Ar(Ma.sessions.currentUser.v1)}async function uc(){return Ar(`${Ma.sessions.currentUser.v1}/current`)}async function dc(e){return br(`${Ma.sessions.v1}/revoke`,{userId:e})}async function yc(){return Ar(Ma.sessions.configurations.v1)}async function fc(e){await br(Ma.sessions.configurations.v1,e)}async function pc(e){await Er(`${Ma.sessions.currentUser.v1}/${e}`)}async function gc(){await Er(`${Ma.sessions.currentUser.v1}/all`)}async function Sc(){return Ar(Ma.accessTokens.v1)}async function vc(){return Ar(Va.accessTokens.v1)}async function hc({id:e}){return Er(`${Va.accessTokens.v1}/${e}`)}async function mc({id:e}){return Er(`${Ma.accessTokens.v1}/${e}`)}async function Ac(e){return br(Ma.accessTokens.v1,e)}async function bc(e){return br(Va.accessTokens.v1,e)}async function Tc(){return Ar(Ma.apiTokens.v1)}async function kc(){return Ar(Va.apiTokens.v1)}async function Ec(e){return br(Ma.apiTokens.v1,e)}async function Ic(e){return br(Va.apiTokens.v2,e)}async function Pc({tokenId:e}){return Er(`${Va.apiTokens.v1}/${e}`)}async function Lc({tokenId:e}){return Er(`${Ma.apiTokens.v1}/${e}`)}async function Oc({userId:e}){return Ar(`${Ma.v1}/${e}`)}async function _c(e){return Ar(`${Fa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function wc(e){let{type:t}=e,n=Ho(e,wl);return br(`${Na.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Cc(e){let{type:t}=e,n=Ho(e,Cl);return Fl(await br(`${Na.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Uc(e){let{type:t}=e,n=Ho(e,Ul);return br(`${Na.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Rc({token:e}){return br(Va.invites.verify.v1,{token:e})}async function Dc(){return Ar(`${Ha.v1}/configurations`)}async function Nc(e){return br(`${Ha.v1}/configurations`,e)}async function Mc(e,t){return Tr(`${Ha.v1}/configurations/${e}`,t)}async function Fc(e){return Er(`${Ha.v1}/configurations/${e}`)}async function Gc(e){return br(`${Ha.v1}/configurations/metadata`,e)}async function $c(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata`,t)}async function xc(e){return br(`${Ha.v1}/configurations/metadata-url`,e)}async function Vc(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata-url`,t)}async function Bc(e,t){return br(`${Ha.v1}/configurations/${e}/domains`,t)}async function jc(e,t){return Er(`${Ha.v1}/configurations/${e}/domains/${t}`)}async function Wc(e,t){return kr(`${Ha.v1}/configurations/${e}/domains/${t}/validate`)}async function Kc(e){return Ar(`${Ha.v1}/configurations/${e}/roles`)}async function Hc(e,t){return kr(`${Ha.v1}/configurations/${e}/roles`,t)}async function zc(e,t){return br(`${Ha.v1}/configurations/${e}/groups`,t)}async function qc(e,{roleIds:t,group:n,id:o}){return Tr(`${Ha.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Yc(e,t){return Er(`${Ha.v1}/configurations/${e}/groups/${t}`)}async function Jc(e){return Ar(`${Ha.v1}/configurations/${e}/groups`)}async function Qc(e){return br(`${Na.v2}/user/sso/prelogin`,e)}async function Xc(e){return Rl(await br(`${Na.v2}/user/oidc/postlogin`,e))}async function Zc(e){return $l(await br(`${ur}/token`,e))}async function eu(){return $l(await br(`${ur}/authorize/silent`))}async function tu(e){return Gl(await br(`${ur}/token`,e))}async function nu(){return Gl(await br(`${ur}/authorize/silent`))}async function ou(e){return br(`${Ma.v1}/phone/reset`,e)}async function iu(e){return br(`${Ma.v1}/phone/reset/verify`,e)}async function au(e){return br(`${Ma.v1}/phone`,e)}async function ru(e){return br(`${Ma.v1}/phone/verify`,e)}async function lu(e){return kr(`${Ma.v1}/phone/change`,e)}async function su(e){return br(`${Na.v1}/webauthn/prelogin`,e)}async function cu(e){return br(`${Na.v1}/webauthn/postlogin`,e)}async function uu(e){return Fl(await br(`${Na.v1}/webauthn/postlogin`,e))}async function du(){return br(Da.v1)}async function yu(){return Ar(Da.v1)}async function fu(e){return Er(`${Da.v1}/${e}`)}async function pu(e){return br(`${Da.v1}/verify`,e)}async function gu(){return Ar(`${Fa.v1}/auth/strategies/public`)}async function Su(){return Ar(`${Fa.v1}/auth/strategies`)}async function vu(){return Ar(`${Fa.v1}/mfa/strategies`)}async function hu(){return Ar(`${Ma.authorization.v1}`)}async function mu(){return Ar(`${Ma.v2}/me`)}async function Au(){const e=[{action:mu,shouldLoad:!0},{action:El,shouldLoad:Nl()},{action:hu,shouldLoad:Ml()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,o]=await Promise.all(e);return C({},t,null!=o?o:{},{entitlements:n})}async function bu(e){return Ar(`${Ma.v2}/me`,null!=e?e:{addRoles:!0})}async function Tu(e){return kr(`${Ma.v2}/me`,e)}async function ku(e){return kr(`${Ja.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Eu(e){return br(`${Ma.v1}/passwords/change`,e)}async function Iu(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 Ar(za.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Pu(e){return br(Ma.v2,C({},e,{provider:"local"}))}async function Lu(e){return Er(`${za.v1}/${e.userId}`)}async function Ou(e){return kr(za.v1,e)}async function _u(e){return br(Va.invites.user.v1,C({},e))}async function wu(e){return Tr(Va.invites.user.v1,C({},e))}async function Cu(){return Er(Va.invites.user.v1)}async function Uu(){return Ar(Va.invites.user.v1)}async function Ru(){return Ar(Va.invites.configuration.v1)}async function Du(){return Ar(qa.v1)}async function Nu(){return Ar(xa.v1)}async function Mu(){return Ar(`${Ya.v1}/members`)}async function Fu(e){return br(`${za.v1}/${e.userId}/resendActivationEmail`,{})}async function Gu(e){return br(Ma.v2,C({},e,{provider:"local"}))}async function $u(e){return br(Ma.invitation.resendAll.v1,C({},e))}async function xu(e){var t,n;const o=await Ar("/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 Vu(){return Ar("/metadata/admin-box")}async function Bu(e){return br("/metadata/admin-box",e)}async function ju(){const e=await Ar("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Wu=async()=>xu({entityName:"notifications"}),Ku=async()=>xu({entityName:"saml"}),Hu=async()=>xu({entityName:"audits"}),zu=async e=>async function(e){const t=await Ar(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),qu=["dataFilters"],Yu=["templateId","dataFilters"],Ju=["dataFilters"];async function Qu(e){return Ar(`${ir.v2}/tenant-reports`,e)}async function Xu(e){return Ar(`${ir.v2}/${e.id}/tenant-reports`)}async function Zu(e){let{dataFilters:t}=e,n=Ho(e,qu);return{html:await Ar(`${ar.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function ed(e){let{templateId:t,dataFilters:n}=e,o=Ho(e,Yu);return br(`${ir.v2}/${t}/tenant-reports`,C({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function td(e){let{dataFilters:t}=e,n=Ho(e,Ju);const o=await Ar(`${ar.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 nd(e){return br(`${ar.v1}/tenant-reports`,e)}async function od(e){return Ar(rr,{params:e})}async function id(e){return kr(`${rr}/status`,{params:e})}async function ad(e){const{notificationId:t,pinStatus:n}=e;return kr(`${rr}/${n}`,{notificationId:t})}async function rd(){return br(`${rr}/status/mark-all-read`)}const ld=["endpoint","headerProps"];async function sd(e){return Ar(lr,e)}async function cd(e){return Ar(`${lr}/stats`,e)}async function ud(e){const{endpoint:t,headerProps:n}=e,o=Ho(e,ld);return Ir(`${lr}/export/${t}`,{properties:n},o)}const dd=["eventKey"],yd=["eventKey"],fd=()=>Ar(`${er.v1}/slack`),pd=()=>Ar(`${er.v1}/slack/applications`),gd=()=>Ar(`${er.v1}/slack/channels`),Sd=e=>e.id?Tr(`${er.v1}/slack/subscription/${e.id}`,e):br(`${er.v1}/slack/subscriptions`,e),vd=e=>Er(`${er.v1}/slack/subscriptions/${e.id}`),hd=e=>br(`${er.v1}/slack/applications/registrations`,{code:e}),md=()=>Ar(`${er.v1}/emails`),Ad=e=>{let{eventKey:t}=e,n=Ho(e,dd);return br(`${er.v1}/emails/${t}`,n)},bd=({eventKey:e,enabled:t})=>Tr(`${er.v1}/emails/${e}`,{enabled:t}),Td=(e,t)=>Er(`${er.v1}/emails/${e}/subscriptions/${t}`),kd=(e,t,n)=>kr(`${er.v1}/emails/${t}/subscriptions/${e}`,n),Ed=e=>Er(`${er.v1}/emails/${e}`),Id=()=>Ar(`${er.v2}/sms`),Pd=e=>{let{eventKey:t}=e,n=Ho(e,yd);return br(`${er.v2}/sms/${t}`,n)},Ld=({eventKey:e,enabled:t})=>Tr(`${er.v2}/sms/${e}`,{enabled:t}),Od=(e,t)=>Er(`${er.v2}/sms/${e}/subscriptions/${t}`),_d=(e,t,n)=>kr(`${er.v2}/sms/${t}/subscriptions/${e}`,n),wd=e=>Er(`${er.v2}/sms/${e}`),Cd=()=>Ar(cr),Ud=e=>e._id?Tr(`${cr}/${e._id}`,e):br(`${cr}/custom`,e),Rd=e=>Er(`${cr}/${e}`),Dd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ar(`${cr}/logs/?${o.toString()}`)},Nd=e=>br(`${cr}/test`,e),Md=e=>br(`${cr}/logs/${e}/retries`),Fd=()=>Ar(`${sr.v1}/categories`),Gd=e=>Ar(sr.v1,{channels:e});async function $d(e,t){return kr(Qa.v1,e,{headers:Pr(t)})}async function xd(e){return Ar(Qa.v1,void 0,{headers:Pr(e)})}async function Vd(){return Ar(`${Qa.v1}/public`)}const Bd=["roleId"],jd=["roleId"],Wd=["permissionId"];async function Kd(){return Ar(Ba.v1)}async function Hd(e){return br(Ba.v1,e)}async function zd({roleId:e}){return Er(`${Ba.v1}/${e}`)}async function qd(e){let{roleId:t}=e,n=Ho(e,Bd);return Tr(`${Ba.v1}/${t}`,n)}async function Yd(e){let{roleId:t}=e,n=Ho(e,jd);return kr(`${Ba.v1}/${t}/permissions`,n)}async function Jd(){return Ar(xa.v1)}async function Qd(e){let{permissionId:t}=e,n=Ho(e,Wd);return kr(`${xa.v1}/${t}/roles`,n)}async function Xd(){return Ar(`${xa.v1}/categories`)}async function Zd(){return Ar(tr.subscriptions.v1)}async function ey(e){return Ar(`${tr.subscriptions.v1}/${e}`)}async function ty(e){return kr(`${tr.subscriptions.v1}/${e}/cancellations/`,{})}async function ny(e){return kr(`${tr.subscriptions.v1}/${e}/renewals/`,{})}async function oy(e,{paymentMethodId:t,planId:n}){return kr(`${tr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function iy(e){return Ar(`${or.v1}/${e}`)}async function ay(){return Ar(`${or.v1}`)}async function ry(e){return kr(`${or.v1}/${e}/cancellations/`,{})}async function ly(e){return kr(`${or.v1}/${e}/renewals/`,{})}async function sy(e,{paymentMethodId:t,planId:n}){return kr(`${or.v1}/${e}`,{paymentMethodId:t,planId:n})}async function cy(){return Ar(tr.plans.v1)}async function uy(e){return Ar(`${tr.plans.v1}/${e}`)}async function dy(){return Ar(tr.invoices.v1)}async function yy(e){return Ar(`${tr.invoices.v1}/${e}`)}async function fy(e,t){return Ar(`${tr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const py=["email"];async function gy(){return Ar(tr.paymentMethods.v1)}async function Sy(e){return Ar(`${tr.paymentMethods.v1}/${e}`)}async function vy(e,t){let{email:n}=t,o=Ho(t,py);return Tr(`${tr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function hy(e){return br(tr.paymentProviders.stripe.subscriptions.v1,e)}async function my(e){return Ar(`${tr.paymentProviders.stripe.customers.v1}/${e}`)}async function Ay(e){return br(`${tr.paymentProviders.stripe.customers.v1}`,e)}async function by(){return Ar(`${tr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Ty(e){return br(`${tr.paymentProviders.stripe.setupIntents.v1}`,e)}async function ky(e){return Ar(`${tr.summaries.v1}/${e}`)}async function Ey(e){return Ar(`${tr.tenantConfiguration.v1}/${e}`)}async function Iy(e){return br(`${tr.tenantConfiguration.v1}`,e)}async function Py(){return Ar(nr.v1)}async function Ly(){return Ar(`${tr.configurations.vendorPublicConfigurations.v1}`)}let Oy,_y,wy,Cy,Uy,Ry;async function Dy(){return Ar("/vendors/public")}async function Ny(e){return Ar(ja.v1,e)}async function My(e){return br(ja.v1,e)}async function Fy(e,t){return Er(ja.v1,e,{headers:Pr(t)})}async function Gy(e,t,n){return br(`${ja.v1}/${e}/roles`,t,{headers:Pr(n)})}async function $y(e,t,n){return Er(`${ja.v1}/${e}/roles`,t,{headers:Pr(n)})}async function xy(e,t,n){return Tr(`${ja.v1}/${e}/roles`,t,{headers:Pr(n)})}async function Vy(e,t){return br(Za.v1,e,{headers:Pr(t)})}async function By(e,t){return Er(`${Za.v1}/${e}`,void 0,{headers:Pr(t)})}async function jy({tenantId:e},t,n){return Tr(`${Za.v1}/${e}`,t,{headers:Pr(n)})}async function Wy(e,t,n){return kr(`${ja.v1}/${e}/access`,t,{headers:Pr(n)})}async function Ky(e,t){return br(`${ja.v2}/`,e,{headers:Pr(t)})}async function Hy(){return Ar(`${yr}`)}async function zy(e,t){return Tr(`${yr}/${e}`,t)}async function qy(e){return br(`${yr}`,e)}async function Yy(e){return Er(`${yr}/${e}`)}async function Jy(e){return Ar(`${fr}/${e}/Users/count`)}async function Qy(e){return br(`${Wa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Oy||(Oy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(_y||(_y={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(wy||(wy={})),(Cy||(Cy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Uy||(Uy={})),function(e){e.CREATE="create_customer"}(Ry||(Ry={}));const Xy=["groupId"];async function Zy({groupId:e},t){return Ar(`${Ka.v1}/${e}`,C({},t))}async function ef(e){return Ar(`${Ka.v1}`,C({},e))}async function tf(e,t){return br(`${Ka.getByIds.v1}`,e,{params:t})}async function nf(e){return br(`${Ka.v1}`,e)}async function of(e){let{groupId:t}=e,n=Ho(e,Xy);return Tr(`${Ka.v1}/${t}`,n)}async function af(e){return Er(`${Ka.v1}/${e}`)}async function rf(e,t){return br(`${Ka.v1}/${e}/roles`,t)}async function lf(e,t){return Er(`${Ka.v1}/${e}/roles`,t)}async function sf(e,t){return br(`${Ka.v1}/${e}/users`,t)}async function cf(e,t){return Er(`${Ka.v1}/${e}/users`,t)}async function uf(){return Ar(`${Ka.configurations.v1}`)}async function df(e){return br(`${Ka.configurations.v1}`,e)}async function yf(){return Ar(gr.v1)}async function ff(){return Ar(Sr.v1)}let pf,gf,Sf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(pf||(pf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(gf||(gf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Sf||(Sf={}));const vf=[/^(.*)\/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],hf=`${Na.v1}/user/token/refresh`,mf=`${ur}/authorize/silent`,Af=`${Ma.v2}/me`,bf=`${Ma.v2}/me/tenants`,Tf=`${Ma.v3}/me/tenants`;let kf,Ef,If,Pf,Lf,Of,_f,wf;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(kf||(kf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Ef||(Ef={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(If||(If={})),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.CONFIGURE_SSO="CONFIGURE_SSO"}(Pf||(Pf={})),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.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",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Lf||(Lf={})),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"}(Of||(Of={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(_f||(_f={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(wf||(wf={}));const Cf={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 Uf={fetch:e,ContextHolder:Ca,FronteggContext:Ua,api:Cf,FronteggApiError:Ra,AuthStrategyEnum:To,MachineToMachineAuthStrategy:ko,SocialLoginProviders:bo,ISubscriptionCancellationPolicy:wy,ISubscriptionStatus:Oy,PaymentMethodType:_y,ProviderType:Cy};let Rf,Df;!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"}(Rf||(Rf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Df||(Df={}));const Nf="input is invalid type",Mf="undefined"!=typeof ArrayBuffer,Ff="0123456789abcdef".split(""),Gf=[-2147483648,8388608,32768,128],$f=[24,16,8,0],xf=[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],Vf=["hex","array","digest","arrayBuffer"],Bf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Mf&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const jf=function(e){return function(t){const n=new Kf(!0).update(t);return null==n?void 0:n[e]()}},Wf=function(e){return function(t,n){const o=new Hf(t,!0).update(n);return null==o?void 0:o[e]()}};class Kf{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=()=>Kf.prototype.digest(),e?(Bf[0]=Bf[16]=Bf[1]=Bf[2]=Bf[3]=Bf[4]=Bf[5]=Bf[6]=Bf[7]=Bf[8]=Bf[9]=Bf[10]=Bf[11]=Bf[12]=Bf[13]=Bf[14]=Bf[15]=0,this.blocks=Bf):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(Nf);if(null===e)throw new Error(Nf);if(Mf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Mf&&ArrayBuffer.isView(e)))throw new Error(Nf);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]|=Gf[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+xf[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+xf[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+xf[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+xf[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=Ff[e>>28&15]+Ff[e>>24&15]+Ff[e>>20&15]+Ff[e>>16&15]+Ff[e>>12&15]+Ff[e>>8&15]+Ff[e>>4&15]+Ff[15&e]+Ff[t>>28&15]+Ff[t>>24&15]+Ff[t>>20&15]+Ff[t>>16&15]+Ff[t>>12&15]+Ff[t>>8&15]+Ff[t>>4&15]+Ff[15&t]+Ff[n>>28&15]+Ff[n>>24&15]+Ff[n>>20&15]+Ff[n>>16&15]+Ff[n>>12&15]+Ff[n>>8&15]+Ff[n>>4&15]+Ff[15&n]+Ff[o>>28&15]+Ff[o>>24&15]+Ff[o>>20&15]+Ff[o>>16&15]+Ff[o>>12&15]+Ff[o>>8&15]+Ff[o>>4&15]+Ff[15&o]+Ff[i>>28&15]+Ff[i>>24&15]+Ff[i>>20&15]+Ff[i>>16&15]+Ff[i>>12&15]+Ff[i>>8&15]+Ff[i>>4&15]+Ff[15&i]+Ff[a>>28&15]+Ff[a>>24&15]+Ff[a>>20&15]+Ff[a>>16&15]+Ff[a>>12&15]+Ff[a>>8&15]+Ff[a>>4&15]+Ff[15&a]+Ff[r>>28&15]+Ff[r>>24&15]+Ff[r>>20&15]+Ff[r>>16&15]+Ff[r>>12&15]+Ff[r>>8&15]+Ff[r>>4&15]+Ff[15&r];return s+=Ff[l>>28&15]+Ff[l>>24&15]+Ff[l>>20&15]+Ff[l>>16&15]+Ff[l>>12&15]+Ff[l>>8&15]+Ff[l>>4&15]+Ff[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 Hf extends Kf{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(Nf);if(null===e)throw new Error(Nf);if(Mf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Mf&&ArrayBuffer.isView(e)))throw new Error(Nf)}var i;e.length>64&&(e=null==(i=new Kf(!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}Kf.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();Kf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Kf.prototype.finalize.call(this)}}}const zf=function(){const e=jf("hex");e.create=function(){return new Kf},e.update=function(t){return e.create().update(t)};for(let t=0;t<Vf.length;++t){const n=Vf[t];e[n]=jf(n)}return e}();function qf(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Yf(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=zf.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Jf(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=Wf("hex");e.create=function(e){return new Hf(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Vf.length;++t){const n=Vf[t];e[n]=Wf(n)}}();const Qf=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Xf(e){const t=yield Mi((e=>e.root.appName));return Ol.getFeatureFlags(e,t)}const Zf={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ep=C({},Zf,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),tp=[{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"}],np={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},op=C({},np,{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}),ip={loading:!1,error:void 0,saving:!0,profile:np},ap={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"},rp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:To.EmailAndPassword,machineToMachineAuthStrategy:ko.ClientCredentials},lp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},sp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},cp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},up={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},dp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},yp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],fp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:up,roles:yp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},pp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],gp={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:[tp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[tp[0]],managedBy:If.FRONTEGG}]},Sp={id:gp.id,email:gp.email,name:gp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[tp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},vp={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:[tp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[tp[0]],managedBy:If.FRONTEGG}]},hp={id:vp.id,email:vp.email,name:vp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[tp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},mp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ap=[vp,gp],bp=[hp,Sp],Tp=[mp],kp=[{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}],Ep=[{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"}],Ip={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Pp={isActive:!0,strategy:Vn.ALLOW},Lp=[{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"}],Op=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},vp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},_p=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"}),wp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Op(6),roles:[_p("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:If.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Op(44),roles:[_p("Editor")],managedBy:If.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Op(8),roles:[_p("Viewer")],managedBy:If.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Op(5),roles:[_p("Admin")],managedBy:If.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Op(21),description:"BDR, AE, and inside sales",roles:[_p("Viewer")],managedBy:If.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Op(23),description:"Dev success and customer success",roles:[_p("Admin")],managedBy:If.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Op(10),description:"The marketing department",roles:[_p("Viewer")],managedBy:If.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Op(4),description:"Human resources",roles:[_p("Viewer")],managedBy:If.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Op(3),roles:[_p("Viewer")],managedBy:If.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Op(8),roles:[_p("Editor")],managedBy:If.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Op(4),roles:[_p("Viewer")],managedBy:If.FRONTEGG}],Cp={scoring:{score:79},recommendations:{items:[{code:Pf.FORCE_MFA,severity:_f.WARNING,category:wf.MFA},{code:Pf.ENABLE_FORCE_RELOGIN,severity:_f.WARNING,category:wf.SESSIONS}]}},Up={insights:{items:[{category:wf.MFA,code:Lf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:wf.SESSIONS,code:Lf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:wf.PASSWORD,code:Lf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:wf.DOMAIN,code:Lf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},Rp={users:bp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Dp={users:[bp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_presetParams:{_maxInactiveSeconds:7776e3}}},Np={users:[bp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let Mp,Fp,Gp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Mp||(Mp={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Fp||(Fp={})),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"}(Gp||(Gp={})),Gp.profile,Gp.privacy,Gp.personalApiTokens,Gp.account,Gp.users,Gp.groups,Gp.security,Gp.sso,Gp.audits,Gp.webhooks,Gp.apiTokens,Gp.roles,Gp.subscriptions,Gp.allAccounts;const $p=(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,xp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Vp=e=>{const{pathname:t}=new URL(e),n=xp(e);return n?t+n:t},Bp=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},jp="tenantId",Wp=e=>e.mfaRequired&&e.mfaToken?(Ca.setAccessToken(null),Ca.setUser(null),!0):(Ca.setAccessToken(e.accessToken),Ca.setUser(e),!1),Kp=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},Hp=e=>{if(1===e.length){const[t]=e;if(t===fl.AuthenticatorApp)return rn.authenticatorApp;if(t===fl.SMS)return rn.smsSetPhoneNumber;if(t===fl.EmailCode)return rn.emailVerifyCode}return rn.verify},zp=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...zp(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),qp=["callback"];function*Yp(){yield wi(Ro.setCustomLoginState({loading:!0}));try{const e=yield Ri(Cf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield wi(Ro.setCustomLoginState({loading:!1,error:$p(e)}))}}function*Jp(e){let{payload:{callback:t}}=e,n=Ho(e.payload,qp);try{yield wi(Ro.setCustomLoginState({error:null,saving:!0}));const e=zp(n);if(0===e.length)throw new Error("No changes to update");yield Ri(Cf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Ri(Cf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setCustomLoginState({error:$p(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Qp(){var e;const[t]=yield Ri(Xf,["admin_portal_login_per_tenant"]),n=!(null==(e=Ca.getContext())||!e.tenantResolver);if(yield Mi((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Mi((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*Xp(){try{var e;if(!(yield Ri(Qp)))return;const t=yield Mi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=Cf.accountSettings,{applicationUrl:i}=yield Ri(t?n:o);if(!i)return;const{routes:a}=yield Mi((e=>e.auth)),r=null!=(e=xp(i))?e:"";yield wi(Ro.setState({routes:C({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield wi(Ro.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Zp(){yield wa(Ro.loadTenantMetadata,Yp),yield wa(Ro.updateTenantMetadata,Jp)}let eg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(eg||(eg={}));const tg=["callback"];function ng(e){return function*(t){const[n]=yield Ri(Xf,["security-center-admin-portal"]);yield e(t),n&&(yield og(),yield ig())}}function*og(){const e=eg.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Ri(Cf.securityCenter.getRecommendations);yield wi(Ro.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:$p(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*ig(){const e=eg.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Ri(Cf.securityCenter.getInsights);yield wi(Ro.setSecurityCenterState({insights:t.items}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:$p(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*ag(e){let{payload:{callback:t}}=e,n=Ho(e.payload,tg);const o=eg.SEND_BREACHED_PASSWORD_EMAIL;yield wi(Ro.setSecurityCenterStateError({key:o,value:!1})),yield wi(Ro.setSecurityCenterStateLoader({key:o,value:!0}));try{yield Ri(Cf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield wi(Ro.setSecurityCenterStateError({key:o,value:$p(e)})),null==t||t(!1,e)}finally{yield wi(Ro.setSecurityCenterStateLoader({key:o,value:!1}))}}function*rg({payload:{callback:e}}){const t=eg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield wi(Ro.setSecurityCenterStateError({key:t,value:!1})),yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Ri(Cf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield wi(Ro.setSecurityCenterStateError({key:t,value:$p(n)})),null==e||e(!1)}finally{yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!1}))}}function*lg({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r,_presetParams:l}){var s,c,u,d;yield wi(Ro.setSecurityCenterStateError({key:e,value:!1})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(s=null!=o?o:null==t||null==(c=t.queryParams)?void 0:c._offset)?s:0,f=null!=(u=null!=i?i:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=C({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_presetParams:l},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Ri(Cf.users.getUsersV3,p),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:y,queryParams:C({_offset:y,_limit:f,_presetParams:l},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Ri(Cf.roles.getRoles),o=yield Ri(Cf.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return C({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield wi(Ro.setSecurityCenterState({[n]:C({users:e},a)}))}else yield wi(Ro.setSecurityCenterState({[n]:C({users:[]},a)}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:$p(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*sg({payload:e}){var t;const n=eg.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield lg(C({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:uo.BREACHED_PASSWORDS,tableState:o},e))}function*cg({payload:e}){var t;const n=eg.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield lg(C({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:uo.MFA_UNENROLLED,tableState:o},e))}function*ug({payload:e}){var t;const n=eg.INACTIVE_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield lg(C({key:n,updateStateKey:"inactiveUsersTable",_preset:uo.INACTIVE,tableState:o},e))}function*dg(){yield Oa(Ro.loadRecommendations,og),yield Oa(Ro.loadInsights,ig),yield Oa(Ro.sendResetBreachedPasswordEmail,ag),yield Oa(Ro.sendBulkResetBreachedPasswordEmails,rg),yield Oa(Ro.loadBreachedPasswordUsers,sg),yield Oa(Ro.loadUnenrolledMfaUsers,cg),yield Oa(Ro.loadInactiveUsers,ug)}function*yg(){const e=eg.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({recommendations:Cp.recommendations.items,score:Cp.scoring.score})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*fg(){const e=eg.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({insights:Up.insights.items})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*pg(){const e=eg.BREACHED_PASSWORD_USERS_TABLE;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({breachedPasswordUsersTable:Rp})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*gg(){const e=eg.UNENROLLED_MFA_USERS_TABLE;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({unenrolledMfaUsersTable:Np})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*Sg(){const e=eg.INACTIVE_USERS_TABLE;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({inactiveUsersTable:Dp})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*vg({payload:{callback:e}}){const t=eg.SEND_BREACHED_PASSWORD_EMAIL;yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!0})),yield Fi(500),null==e||e(!0),yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!1}))}function*hg(){yield Oa(Ro.loadRecommendations,yg),yield Oa(Ro.loadInsights,fg),yield Oa(Ro.loadBreachedPasswordUsers,pg),yield Oa(Ro.loadUnenrolledMfaUsers,gg),yield Oa(Ro.loadInactiveUsers,Sg),yield Oa(Ro.sendResetBreachedPasswordEmail,vg)}const mg=["callback"],Ag=["callback"],bg=["callback"],Tg=["callback"],kg=["callback"],Eg=["callback"];function*Ig(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getGlobalSecurityPolicy);yield wi(Ro.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyGlobalState({error:$p(e),loading:!1}))}yield wi(Ro.loadSecurityPolicyMfa()),yield wi(Ro.loadSecurityPolicyVendorMfa()),yield wi(Ro.loadSecurityPolicyLockout()),yield wi(Ro.loadSecurityPolicyVendorLockout()),yield wi(Ro.loadSecurityPolicyVendorPasswordHistory()),yield wi(Ro.loadSecurityPolicyCaptcha()),yield wi(Ro.loadPublicAuthStrategiesPolicy())}function*Pg(e){var t,n;if(!(yield Ri(Qp)))return e;const o=yield Ri(Og);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?C({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*Lg(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getVendorConfig),t=yield Pg(e);yield wi(Ro.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:$p(e),loading:!1}))}}function*Og(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(Cf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Ri(Cf.auth.getVendorPublicAuthStrategiesConfig),t}function*_g(){yield wi(Ro.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Ri(Og);yield function*(e){const t=yield Ri(Qp);if(!e||!t)return;const{policy:n}=yield Mi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield wi(Ro.setSecurityPolicyPublicState({policy:C({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield wi(Ro.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyAuthStrategyPublicState({error:$p(e),loading:!1}))}}function*wg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getMfaPolicy);yield wi(Ro.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyMfaState({error:$p(e),loading:!1}))}}function*Cg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getVendorMfaPolicy);yield wi(Ro.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorMfaState({error:$p(e),loading:!1}))}}function*Ug(e){let{payload:{callback:t}}=e,n=Ho(e.payload,mg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ri(Cf.auth.saveMfaPolicy,n);yield wi(Ro.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyMfaState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*Rg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getLockoutPolicy);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({error:$p(e),loading:!1}))}}function*Dg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ag);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ri(Cf.auth.saveLockoutPolicy,n);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*Ng(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getVendorLockoutPolicy);yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorLockoutState({error:$p(e),loading:!1}))}}function*Mg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getCaptchaPolicy);yield wi(Ro.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyCaptchaState({error:$p(e),loading:!1}))}}function*Fg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({error:$p(e),loading:!1}))}}function*Gg(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getVendorPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({error:$p(e),loading:!1}))}}function*$g(e){let{payload:{callback:t}}=e,n=Ho(e.payload,bg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ri(Cf.auth.savePasswordHistoryPolicy,n);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*xg(){yield wi(Ro.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getPasswordConfigPolicy);yield wi(Ro.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordState({error:$p(e),loading:!1}))}}function*Vg(){yield wa(Ro.loadSecurityPolicy,Ig),yield Oa(Ro.saveSecurityPolicyMfa,ng(Ug)),yield Oa(Ro.loadSecurityPolicyMfa,wg),yield Oa(Ro.loadSecurityPolicyVendorMfa,Cg),yield Oa(Ro.saveSecurityPolicyLockout,ng(Dg)),yield Oa(Ro.loadSecurityPolicyLockout,Rg),yield Oa(Ro.loadSecurityPolicyVendorLockout,Ng),yield Oa(Ro.loadSecurityPolicyCaptcha,Mg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,ng($g)),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Fg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,Gg),yield Oa(Ro.loadVendorPasswordConfig,xg),yield Oa(Ro.loadPublicSecurityPolicy,Lg),yield Oa(Ro.loadPublicAuthStrategiesPolicy,_g)}function*Bg(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield wi(Ro.setSecurityPolicyPublicState({policy:rp,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:$p(e),loading:!1}))}}function*jg(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyGlobalState({policy:ap,loading:!1})),yield wi(Ro.loadSecurityPolicyMfa()),yield wi(Ro.loadSecurityPolicyVendorMfa()),yield wi(Ro.loadSecurityPolicyLockout()),yield wi(Ro.loadSecurityPolicyVendorLockout()),yield wi(Ro.loadSecurityPolicyPasswordHistory()),yield wi(Ro.loadSecurityPolicyVendorPasswordHistory()),yield wi(Ro.loadSecurityPolicyCaptcha())}function*Wg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:lp,loading:!1}))}function*Kg(){yield wi(Ro.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorMfaState({policy:lp,loading:!1}))}function*Hg(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,Tg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));const i=C({},sp,{id:null!=(t=o.id)?t:sp.id,enforceMFAType:o.enforceMFAType});yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*zg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:sp,loading:!1}))}function*qg(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:sp,loading:!1}))}function*Yg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,kg);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null})),yield At();const o=C({},sp,n,{id:n.id?n.id:sp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Jg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:sp,loading:!1}))}function*Qg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:cp,loading:!1}))}function*Xg(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:cp,loading:!1}))}function*Zg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Eg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield At();const o=C({},cp,n,{id:n.id?n.id:cp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*eS(){yield wa(Ro.loadSecurityPolicy,jg),yield Oa(Ro.loadPublicSecurityPolicy,Bg),yield Oa(Ro.saveSecurityPolicyMfa,Hg),yield Oa(Ro.loadSecurityPolicyMfa,Wg),yield Oa(Ro.loadSecurityPolicyVendorMfa,Kg),yield Oa(Ro.saveSecurityPolicyLockout,Yg),yield Oa(Ro.loadSecurityPolicyLockout,zg),yield Oa(Ro.loadSecurityPolicyVendorLockout,qg),yield Oa(Ro.loadSecurityPolicyCaptcha,Jg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,Zg),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Qg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,Xg)}const tS=["events","url"];function*nS(){yield wi(Ro.setSignUpState({loading:!0}));try{const e=yield Ri(Cf.auth.getVendorConfig),t=yield Pg(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield wi(Ro.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield wi(Ro.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield wi(Ro.setSignUpState({loading:!1,error:$p(e),firstLoad:!1}))}}function*oS(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,tS);yield wi(Ro.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Mi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Ri(Cf.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:Fp.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(!r&&l&&Wp(l)){const t=yield WS(l);yield wi(Ro.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Mi((e=>e.auth));yield wi(Ro.setSignUpState({loading:!1,shouldActivate:r,stage:Sn.SignUpSuccess})),yield wi(Ro.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:C({},e,{tenants:u,activeTenant:d})}))}}catch(e){Ca.setAccessToken(null),Ca.setUser(null),yield wi(Ro.setSignUpState({loading:!1,error:$p(e)}))}yield wi(Ro.setSignUpState({loading:!1}))}function*iS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Mi((e=>e.auth.signUpState));yield wi(Ro.resetSignUpState()),yield wi(Ro.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*aS(){yield wa(Ro.signUpUser,oS),yield wa(Ro.resetSignUpStateSoft,iS)}const rS={setVendorState:(e,{payload:t})=>C({},e,t)},lS={loadVendorPublicInfo:ct("vendor/loadVendorPublicInfo")},sS={loading:!1},{reducer:cS,actions:uS}=dt({name:Rt,initialState:sS,reducers:C({},rS)}),dS=C({},uS,lS);function*yS(){yield wi(dS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Cf.vendor.getVendorPublicInfo();yield wi(dS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield wi(dS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var fS=n(378),pS=n.n(fS);function gS(e,t){return pS()(e,t)}function*SS({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Ri(Cf.entitlements.loadEntitlements);yield function*(e){gS(yield Mi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield wi(Ro.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*vS(){yield wa(Ro.loadEntitlements,SS)}const hS=["callback"],mS=["callback"],AS=["callback"],bS=["callback"],TS=["callback","events"],kS=["callback"],ES=["callback"],IS=["callback"],PS=["callback"],LS=["user"],OS=["callback"],_S=["callback"],wS=["callback"],CS=["callback"],US=["callback"],RS=["callback","deviceId"],DS=["callback"],NS=["callback"],MS=["callback","deviceId"],FS=["callback","deviceId"],GS=["callback","deviceId"];function*$S(e){const t=yield Mi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return gS(t,null==e?void 0:e.entitlements)?C({},e,{entitlements:t}):e}function*xS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Mi((e=>e.auth));yield wi(Ro.setState(C({user:e,tenantsState:C({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*VS(){const e=Ca.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Mi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Ri(Xp),u=yield Mi((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),wi(Ro.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?Vp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*BS(){let e;try{var t;const n=yield Ri(Cf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield wi(Ro.setState({ssoACS:e}))}function*jS(){try{const{isActive:e}=yield Ri(Cf.auth.getSSOPublicConfiguration);yield wi(Ro.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*WS(e){let t=It.loginWithTwoFactor,n={};const{loginState:o}=yield Mi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ri(Cf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Kp(e.mfaDevices)}:(n={step:Hp(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*KS(e){var t;const{routes:n,loginState:o}=yield Mi((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*HS(){const{hostedLoginBox:e}=yield Mi((e=>e.auth));e?yield Ri(zS):yield Ri(YS)}function*zS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ca.setAccessToken(null),Ca.setUser(null),void(yield wi(Ro.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ri(Cf.auth.exchangeOAuthTokensV2,t),o=yield Ri($S,n.user);yield Ri(xS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ca.setAccessToken(null),Ca.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*qS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ca.setAccessToken(null),Ca.setUser(null),void(yield wi(Ro.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Ri(Cf.auth.exchangeOAuthTokensV2,t),o=yield Ri($S,n.user);yield Ri(xS,C({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ca.setAccessToken(null),Ca.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*YS(){try{const t=Ca.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(Cf.auth.refreshTokenV3);if(Wp(i)){const e=yield WS(i);yield wi(Ro.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 KS(i),l=yield Ri($S,i);yield Ri(xS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield QS(n)}}catch(e){Ca.setAccessToken(null),Ca.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*JS(){try{const t=Ca.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(Cf.auth.refreshTokenV3);if(Wp(i)){const e=yield WS(i);yield wi(Ro.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Ri($S,i);if(yield Ri(yv))yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),yield Ri(xS,{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 KS(i);yield Ri(xS,{user:l,tenants:a,activeTenant:r},{loginState:C({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield QS(n)}}}catch(e){Ca.setAccessToken(null),Ca.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*QS(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ca.onRedirectTo,{routes:i,loginState:a}=yield Mi((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 VS())}function*XS({payload:{callback:e}}){try{const{ip:t}=yield Ri(Cf.metadata.getCurrentUserIpMetadata);yield wi(Ro.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ZS({payload:e}){const t=[];(yield Ri(Qp))?yield Ri(HS):t.push(Ri(HS)),e&&(yield wi(Ro.setState({isLoading:!0})),yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(nS)),t.push(Ri(_g)),t.push(Ri(jS)),t.push(Ri(yS)),t.push(Ri(BS)),t.push(Ri(Xp))),yield Ci(t),yield wi(Ro.setState({isLoading:!1}))}function*ev({accessToken:e,user:t}){if(!e)return void(yield wi(Ro.setState({user:void 0,isAuthenticated:!1})));const n=Ca.onRedirectTo,{routes:o}=yield Mi((e=>e.auth));if(Wp(t)){const e=yield WS(t);yield wi(Ro.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*tv({payload:e}){const t=[];yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(nS)),t.push(Ri(jS)),t.push(Ri(yS)),t.push(Ri(BS)),t.push(Ri(ev,e)),t.push(Ri(Xp)),yield Ci(t)}const nv=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}};function*ov(){const e=yield Ri(Cf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Ri(xS,e,{isAuthenticated:!0,isLoading:!1})}function*iv({payload:e}){const{disableSilentRefresh:t}=yield Mi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield ov()}catch(t){yield rv(e)}}function*av({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Mi((e=>({urlStrategy:e.root.urlStrategy}))),t=nv(e);if(yield wi(Ro.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield Mi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(o)throw new Error("silent refresh is disabled");yield ov()}catch(n){if(!t)return void(yield wi(Ro.setState({isLoading:!1})));yield rv(e)}}function*rv(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Mi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(nv(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield wi(Ro.setState({isLoading:!0}));const a=Jf(),r=Jf(),l=yield Ri(Yf,r);localStorage.setItem(_t,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Ri(Xp);const c=yield Mi((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=`${vr(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=Bp(jp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*lv({payload:e}){const t=localStorage.getItem(_t)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Mi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Ri(Xp);const a=yield Mi((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 Ri(Cf.auth.exchangeOAuthTokensV2,r);yield Ri(xS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield wi(Ro.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield VS()}}function*sv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,hS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(Cf.auth.changePhoneNumberWithVerification,n);yield wi(Ro.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:It.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e),loading:!1}))}}function*cv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,mS);try{yield wi(Ro.setLoginState({loading:!0})),yield Ri(Cf.auth.verifyChangePhoneNumber,n),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e),loading:!1}))}}function*uv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,AS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(Cf.auth.passwordlessPreLogin,C({},n,{type:To.SmsCode}));yield wi(Ro.setLoginState({step:It.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e),loading:!1})),null==t||t(e)}}function*dv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,bS);try{const{onRedirectTo:e,routes:o}=yield Mi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield wi(Ro.setLoginState({loading:!0}));const i=yield Ri(Cf.auth.passwordlessPreLogin,n),a=Eo[n.type];if(a===It.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield wi(Ro.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield wi(Ro.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield wi(Ro.setLoginState({error:$p(e),loading:!1})),null==t||t()}}function*yv(){const{publicAuthStrategyPolicy:e}=yield Mi((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===dl.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Ri(Xf,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ri(Cf.auth.getWebAuthnDevices);return yield wi(Ro.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*fv(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,TS);try{yield wi(Ro.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Ri(Cf.auth.passwordlessPostLoginV2,o),l=Ca.onRedirectTo,{routes:s}=yield Mi((e=>e.auth));if(Wp(e)){const t=yield WS(e);yield wi(Ro.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Mi((e=>e.auth));var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Mp.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Ri(xS,{user:e,tenants:a,activeTenant:r}),yield wi(Ro.setLoginState({error:void 0})),yield wi(Ro.setState({isLoading:!1})),o.flow===Pt.Login?(yield Ri(yv))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield wi(Ro.setState({isAuthenticated:!0})),yield VS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield wi(Ro.setLoginState({error:$p(e,"Failed to authenticate")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*pv({payload:e}){try{yield wi(Ro.setLoginState({loading:!0}));const{name:t}=yield Ri(Cf.auth.verifyInviteToken,e);yield wi(Ro.setLoginState({inviteTokenTenantName:t}))}catch(e){yield wi(Ro.setLoginState({inviteTokenError:$p(e,"We couldn't verify your invitation")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*gv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield wi(Ro.setLoginState({loading:!0}));try{const i=yield Mi((({auth:{onRedirectTo:e}})=>e)),a=Bp(jp),{address:r,idpType:l}=yield Ri(Cf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Df.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Mi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield wi(Ro.setLoginState({step:It.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield Sv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield Sv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*Sv(e){let{callback:t}=e,n=Ho(e,kS);const o=yield Mi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield wi(Ro.setLoginState({step:It.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===To.EmailAndPassword?(yield wi(Ro.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t()):[To.MagicLink,To.Code,To.SmsCode].includes(null==o?void 0:o.authStrategy)?yield wi(Ro.passwordlessPreLogin(C({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield wi(Ro.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t())}function*vv({payload:{callback:e}}){try{yield wi(Ro.setLoginState({loading:!0}));const{options:t}=yield Ri(Cf.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield wi(Ro.setLoginState({error:$p(t)})),null==e||e(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*hv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ES);try{yield wi(Ro.setLoginState({loading:!0}));const e=Et(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?yl.Platform:yl.CrossPlatform;yield Ri(Cf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e)})),null==t||t(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*mv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,IS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const{options:e}=yield Ri(Cf.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 wi(Ro.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield wi(Ro.setLoginState({error:$p(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*Av(e){let{payload:{callback:t}}=e,n=Ho(e.payload,PS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const e=Et(n.publicKey),i=yield Ri(Cf.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=Ho(i,LS);if(Wp(a)){const e=Ca.onRedirectTo,{routes:t}=yield Mi((e=>e.auth)),n=yield WS(a);yield wi(Ro.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Ri(xS,C({user:a},r),{isAuthenticated:!0}),yield wi(Ro.setLoginState({error:void 0})),yield VS(),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*bv({payload:e}){const{onRedirectTo:t,routes:n}=yield Mi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield wi(Ro.setLoginState({loading:!0}));try{const t=yield Ri(Cf.auth.postLogin,e);yield wi(Ro.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield VS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield wi(Ro.setLoginState({step:It.loginWithSSOFailed,loading:!1}))}}function*Tv({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield wi(Ro.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Ri(Cf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Ca.onRedirectTo,{routes:c}=yield Mi((e=>e.auth));if(Wp(a)){const e=yield WS(a);yield wi(Ro.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Mi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Ri(xS,{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 Ri(Xf,["security-center-show-login-flows"]);t.flow===Pt.Login&&(o&&a.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):n&&((yield Ri(yv))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield VS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ca.setAccessToken(null),Ca.setUser(null),null==i||i(!1,t),yield wi(Ro.setLoginState({email:e,error:$p(t),loading:!1}))}}function*kv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield wi(Ro.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Ri(Cf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Mi((e=>e.auth)),s=l.flow===Pt.Login?It.success:l.step,c=!!i.accessToken;yield Ri(xS,{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 wi(Ro.setLoginState({error:void 0,loading:!1}));const[u]=yield Ri(Xf,["security-center-show-login-flows"]);l.flow===Pt.Login&&(u&&l.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):(yield Ri(yv))?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield VS()),null==o||o(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e),loading:!1})),null==o||o(!1,e)}}function*Ev({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{var t;yield Ri(Cf.auth.recoverMfaToken,e),yield wi(Ro.setLoginState({loading:!1,error:void 0,step:It.preLogin})),yield wi(Ro.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setLoginState({error:$p(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Iv({payload:e}){const{hostedLoginBox:t}=yield Mi((e=>e.auth));yield wi(Ro.setState({isLoading:!0}));try{t?yield Ri(Cf.auth.OAuthLogout):yield Ri(Cf.auth.logout)}catch{}yield wi(Ro.resetState()),yield wi(Ro.requestAuthorize(!0)),null==e||e()}function*Pv({payload:e}){var t;try{yield Ri(Cf.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*Lv({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 wi(Ro.setMfaState(o)),yield wi(Ro.setUser(e)),yield wi(Ro.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ov({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Mi((e=>e.auth));yield wi(Ro.setUser(e)),yield wi(Ro.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Mi((e=>e.auth.mfaState)),[a]=yield Ri(Xf,["security-center-show-login-flows"]);if(o.flow===Pt.Login)if(a&&o.isBreachedPassword)yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1}));else{const e=yield Ri(yv);i===rn.smsVerifyCode&&e?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield VS()}yield wi(Ro.setState({isAuthenticated:!!e.accessToken}))}function*_v(e){let{payload:{callback:t}}=e,n=Ho(e.payload,OS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.preEnrollMFASMSForLogin,n);yield wi(Ro.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*wv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,_S);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.enrollMFASMSForLoginV2,n);yield Lv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Cv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,wS);yield wi(Ro.setLoginState({loading:!0}));try{var o;const e=yield Ri(Cf.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 wi(Ro.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Uv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,CS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(n.publicKey),o=yield Ri(Cf.auth.enrollMFAWebAuthnForLoginV2,C({},n,{options:e}));yield Lv(o),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Rv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,US);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Lv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Dv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,RS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.preVerifyMFASMSForLogin,n,o);yield wi(Ro.setMfaState({otcToken:e.otcToken,step:rn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Nv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,DS);try{const e=yield Ri(Cf.auth.preVerifyMFAEmailCode,n);yield wi(Ro.setMfaState({otcToken:e.otcToken,step:rn.emailVerifyCode})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:$p(e)})),null==t||t(null)}}function*Mv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,NS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.verifyMFAEmailCodeV2,n);yield Ov(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Fv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,MS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(Cf.auth.verifyMFASMSForLoginV2,n,o);yield Ov(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*Gv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,FS);yield wi(Ro.setLoginState({loading:!0}));try{var i;const e=yield Ri(Cf.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 wi(Ro.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*$v(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,GS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(o.publicKey),i=yield Ri(Cf.auth.verifyMFAWebAuthnForLoginV2,n,C({},o,{options:e}));yield Ov(i),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)})),null==t||t(null)}}function*xv({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{yield Ri(Cf.auth.forgotPassword,e),yield wi(Ro.setLoginState({loading:!1,error:void 0,step:It.breachedPasswordSuccess})),yield wi(Ro.setState({isAuthenticated:!1}))}catch(e){yield wi(Ro.setLoginState({loading:!1,error:$p(e)}))}}function*Vv(){yield wa(Ro.requestAuthorize,ZS),yield wa(Ro.requestAuthorizeSSR,tv),yield wa(Ro.requestHostedLoginAuthorize,iv),yield wa(Ro.requestHostedLoginAuthorizeV2,av),yield wa(Ro.handleHostedLoginCallback,lv),yield wa(Ro.preLogin,gv),yield wa(Ro.postLogin,bv),yield wa(Ro.login,Tv),yield wa(Ro.logout,Iv),yield wa(Ro.silentLogout,Pv),yield wa(Ro.loginWithMfa,kv),yield wa(Ro.recoverMfa,Ev),yield wa(Ro.quickSmsPasswordlessPreLogin,uv),yield wa(Ro.changePhoneNumberWithVerification,sv),yield wa(Ro.verifyChangePhoneNumber,cv),yield wa(Ro.passwordlessPreLogin,dv),yield wa(Ro.passwordlessPostLogin,fv),yield wa(Ro.verifyInviteToken,pv),yield wa(Ro.webAuthnPrelogin,mv),yield wa(Ro.webAuthnPostLogin,Av),yield wa(Ro.webAuthnCreateNewDeviceSession,vv),yield wa(Ro.webAuthnVerifyNewDeviceSession,hv),yield wa(Ro.afterAuthNavigation,VS),yield wa(Ro.getUserIP,XS),yield wa(Ro.preEnrollMFASMSForLogin,_v),yield wa(Ro.enrollMFASMSForLogin,wv),yield wa(Ro.preEnrollMFAWebAuthnForLogin,Cv),yield wa(Ro.enrollMFAWebAuthnForLogin,Uv),yield wa(Ro.enrollMFAAuthenticatorAppForLogin,Rv),yield wa(Ro.preVerifyMFASMSForLogin,Dv),yield wa(Ro.verifyMFASMSForLogin,Fv),yield wa(Ro.preVerifyMFAWebAuthnForLogin,Gv),yield wa(Ro.verifyMFAWebAuthnForLogin,$v),yield wa(Ro.preVerifyMFAEmailCode,Nv),yield wa(Ro.verifyMFAEmailCode,Mv),yield wa(Ro.resetBreachedPassword,xv)}function*Bv({payload:e}){e&&(yield wi(Ro.setState({isLoading:!0})));const t=op;yield wi(Ro.loadTenants()),yield wi(Ro.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*jv({payload:{callback:e}}){try{const{ip:t}=Lp[0];yield wi(Ro.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Wv(){yield wa(Ro.requestAuthorize,Bv),yield wa(Ro.afterAuthNavigation,VS),yield wa(Ro.getUserIP,jv)}const Kv=["callback","samlVendor"],Hv=["callback","samlVendor"];function*zv(){try{var e,t;yield wi(Ro.setSSOState({loading:!0}));const n=yield Ri(Cf.auth.getSamlConfiguration),o=yield Ri(Cf.auth.getOidcConfiguration),i=yield Ri(Cf.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 wi(Ro.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield wi(Ro.setSSOState({error:$p(e),loading:!1}))}}function*qv({payload:e}){const t=yield Mi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield wi(Ro.setSSOState({error:void 0,[n]:!0}));try{const o=yield Qf(e[0]),i=yield Ri(Cf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield wi(Ro.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield wi(Ro.setSSOState({samlConfiguration:t,error:$p(e),[n]:!1}))}}function*Yv({payload:e}){const{configFile:t,callback:n}=e,o=yield Mi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield wi(Ro.setSSOState({error:void 0,[i]:!0}));try{const e=yield Qf(t),a=yield Ri(Cf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield wi(Ro.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield wi(Ro.setSSOState({samlConfiguration:o,error:$p(e),[i]:!1})),null==n||n(null,e)}}function*Jv({payload:e}){const{callback:t,samlVendor:n}=e,o=Ho(e,Kv),i=yield Mi((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 wi(Ro.setSSOState({samlConfiguration:C({},i,a)})));if(yield wi(Ro.setSSOState({error:void 0,[r]:!0})),e.type===Df.Saml){var l,s;const e=yield Ri(Cf.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=qf(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 Ri(Cf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield wi(Ro.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setSSOState({samlConfiguration:i,error:$p(e),[r]:!1})),null==t||t(null,e)}}function*Qv({payload:{callback:e}={}}){const t=yield Mi((e=>e.auth.ssoState.samlConfiguration));try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(Cf.auth.validateSamlDomain),yield wi(Ro.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield wi(Ro.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:$p(n),saving:!1})),null==e||e(null,n)}}function*Xv(){try{const e=yield Ri(Cf.auth.getSamlRoles),t=yield Ri(Cf.auth.getSamlRolesGroups);yield wi(Ro.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield wi(Ro.setSSOState({error:$p(e)}))}}function*Zv({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(Cf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ci(e.map((e=>Ri(Cf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield wi(Ro.setSSOState({error:$p(e)}))}}(n)),yield Xv(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:$p(t),saving:!1})),null==e||e(null,t)}}function*eh({payload:{callback:e,id:t}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(Cf.auth.deleteSamlGroup,{id:t}),yield Xv(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:$p(t),saving:!1})),null==e||e(null,t)}}function*th({payload:{group:e,roleIds:t,callback:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(Cf.auth.createSamlGroup,{group:e,roleIds:t}),yield Xv(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield wi(Ro.setSSOState({error:$p(e),saving:!1})),null==n||n(null,e)}}function*nh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield wi(Ro.setSSOState({loading:!0})),yield Ri(Cf.auth.oidcPostLoginV2,t),yield Ri(HS),yield wi(Ro.setSSOState({loading:!1}))}catch(e){yield wi(Ro.setSSOState({loading:!1,error:$p(e,"Failed to authenticate"),firstLoad:!1}))}}function*oh(){yield Oa(Ro.loadSSOConfigurations,zv),yield Oa(Ro.saveSSOConfigurations,Jv),yield Oa(Ro.saveSSOConfigurationsFile,qv),yield Oa(Ro.saveSSOConfigurationsFileWithCallback,Yv),yield Oa(Ro.validateSSODomain,Qv),yield Oa(Ro.loadSSOAuthorizationRoles,Xv),yield Oa(Ro.updateSSOAuthorizationRoles,Zv),yield Oa(Ro.deleteSamlGroup,eh),yield Oa(Ro.createSamlGroup,th),yield Oa(Ro.oidcPostlogin,nh)}function*ih(){yield wi(Ro.setSSOState({loading:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:up,loading:!1,firstLoad:!1}))}function*ah({payload:e}){const t="saving";yield wi(Ro.setSSOState({error:void 0,[t]:!0}));const n=C({},yield Mi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield wi(Ro.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*rh({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ho(e,Hv),r=fp.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 wi(Ro.setSSOState({samlConfiguration:C({},r,l)})));yield wi(Ro.setSSOState({error:void 0,[s]:!0})),yield At(),l.acsUrl=null==dp||null==(t=dp.configuration)?void 0:t.acsUrl,l.spEntityId=null==dp||null==(n=dp.configuration)?void 0:n.spEntityId;const c=qf(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 wi(Ro.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*lh({payload:{callback:e}={}}){const t=fp.samlConfiguration;yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*sh(){yield At(),yield wi(Ro.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ch({payload:{callback:e,authorizationRoles:t}}){yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield At(),yield wi(Ro.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*uh(){yield Oa(Ro.loadSSOConfigurations,ih),yield Oa(Ro.saveSSOConfigurations,rh),yield Oa(Ro.saveSSOConfigurationsFile,ah),yield Oa(Ro.validateSSODomain,lh),yield Oa(Ro.loadSSOAuthorizationRoles,sh),yield Oa(Ro.updateSSOAuthorizationRoles,ch)}const dh=["callback"],yh=["callback","ssoConfigId"],fh=["callback","ssoConfigId"],ph=["callback","ssoConfigId"];function*gh(){try{return yield Ri(Cf.auth.getOidcConfiguration)}catch(e){return null}}function*Sh(){try{return yield Ri(Cf.metadata.getSamlMetadata)}catch(e){return null}}function*vh(){try{yield wi(Ro.setSSOLoader({key:Rf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ci([Ri(gh),Ri(Sh)]),n=yield Ri(Cf.auth.getSSOConfigurations);yield wi(Ro.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield wi(Ro.setSSOError({key:Rf.LOAD_SSO_CONFIGURATIONS,value:$p(e)}))}finally{yield wi(Ro.setSSOLoader({key:Rf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hh({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ho(e,dh),o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ri(Cf.auth.createSSOConfiguration,C({},n,{enabled:null!=(i=n.enabled)&&i}));yield wi(Ro.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield wi(Ro.setSSOError({key:Rf.SAVE_SSO_CONFIGURATION,value:$p(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mh({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Qf(t),i=yield Ri(Cf.auth.createSSOConfigurationByMetadata,{metadata:e});yield wi(Ro.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield wi(Ro.setSSOError({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:$p(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Ah({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,yh),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(Cf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield wi(Ro.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield wi(Ro.setSSOError({key:Rf.UPDATE_SSO_CONFIGURATION,value:$p(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bh({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Qf(o),a=yield Ri(Cf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield wi(Ro.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield wi(Ro.setSSOError({key:Rf.UPDATE_SSO_CONFIGURATION,value:$p(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Th({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(Cf.auth.deleteSSOConfiguration,t),yield wi(Ro.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield wi(Ro.setSSOError({key:Rf.DELETE_SSO_CONFIGURATION,value:$p(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*kh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ho(e,fh);yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(Cf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield wi(Ro.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield wi(Ro.setSSOError({key:Rf.SAVE_SSO_DOMAIN,value:$p(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_DOMAIN,value:!1}))}}function*Eh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield wi(Ro.setSSOLoader({key:Rf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(Cf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield wi(Ro.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield wi(Ro.setSSOError({key:Rf.DELETE_SSO_DOMAIN,value:$p(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.DELETE_SSO_DOMAIN,value:!1}))}}function*Ih({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield wi(Ro.setSSOLoader({key:Rf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(Cf.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 wi(Ro.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield wi(Ro.setSSOError({key:Rf.VALIDATE_SSO_DOMAIN,value:$p(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Ph({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(Cf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield wi(Ro.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOError({key:Rf.UPDATE_SSO_DEFAULT_ROLES,value:$p(t)})),null==e||e(null,t)}finally{yield wi(Ro.setSSOLoader({key:Rf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Lh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_GROUPS,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ci(t.map((e=>Ri(Cf.auth.deleteSSOGroup,n,e)))),yield Ci(e.map((e=>Ri(Cf.auth.createSSOGroup,n,e))));const a=yield Ri(Cf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?C({},e,{groups:a}):e));yield wi(Ro.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield wi(Ro.setSSOError({key:Rf.SAVE_SSO_GROUPS,value:$p(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_GROUPS,value:!1}))}}function*Oh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ci(t.map((t=>Ri(Cf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield wi(Ro.setSSOError({key:Rf.SAVE_SSO_GROUPS,value:$p(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_GROUPS,value:!1}))}}function*_h({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,l;o?(r=yield Ri(Cf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ri(Cf.auth.createSSOConfigurationByMetadataUrl,e),l=[r,...a]),yield wi(Ro.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wh({payload:e}){yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,ph),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ri(Cf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ri(Cf.auth.createSSOConfiguration,o),a=[e,...i]),yield wi(Ro.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Rf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Ch(){yield Oa(Ro.loadSSOConfigurationsV2,vh),yield Oa(Ro.saveSSOConfigurationV2,hh),yield Oa(Ro.saveSSODomain,kh),yield Oa(Ro.deleteSSODomain,Eh),yield Oa(Ro.validateSSODomainV2,Ih),yield Oa(Ro.updateSSOConfiguration,Ah),yield Oa(Ro.deleteSSOConfiguration,Th),yield Oa(Ro.setSSOGroups,Lh),yield Oa(Ro.updateSSOGroups,Oh),yield Oa(Ro.setSSODefaultRoles,Ph),yield Oa(Ro.saveSSOConfigurationByMetadata,mh),yield Oa(Ro.updateSSOConfigurationByMetadata,bh),yield Oa(Ro.saveSSOConfigurationByUrl,_h),yield Oa(Ro.saveSSOConfigurationByData,wh)}const Uh=["callback","profilePictureUrl"],Rh=["callback","profilePictureUrl"];function*Dh(){yield wi(Ro.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 Ri.apply(void 0,[La,e,t,n].concat(i))}(3,2e3,Cf.teams.getProfile),t=yield Mi((e=>e.auth.user));Ro.setUser(C({},t,e)),yield wi(Ro.setProfileState({profile:e,loading:!1}))}catch(e){yield wi(Ro.setProfileState({loading:!1,error:$p(e)}))}}function*Nh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,Uh);yield wi(Ro.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Mi((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 Ri(Cf.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 Ri(Cf.users.updateUserProfileV2,a),l=yield Mi((e=>e.auth.user));yield wi(Ro.setUser(C({},l,r))),yield wi(Ro.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield wi(Ro.setProfileState({saving:!1,error:$p(e),loading:!1})),null==t||t(null,e)}}function*Mh({payload:e}){yield wi(Ro.setProfileState({loading:!0}));try{var t;yield Ri(Cf.teams.changePassword,e),yield wi(Ro.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setProfileState({loading:!1,error:$p(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Fh(){yield wa(Ro.loadProfile,Dh),yield Oa(Ro.saveProfile,Nh),yield Oa(Ro.changePassword,Mh)}function*Gh(){yield wi(Ro.setProfileState({loading:!0})),yield At(),yield wi(Ro.setUser(C({},op,np))),yield wi(Ro.setProfileState({loading:!1,profile:np}))}function*$h(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,Rh);yield wi(Ro.setProfileState({saving:!0,error:null}));const i=ip;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=op;yield At(),yield wi(Ro.setUser(C({},l,r))),yield wi(Ro.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*xh({payload:e}){var t;yield wi(Ro.setProfileState({loading:!0})),yield At(),yield wi(Ro.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Vh(){yield wa(Ro.loadProfile,Gh),yield Oa(Ro.saveProfile,$h),yield Oa(Ro.changePassword,xh)}const Bh=["callback"],jh=["callback"],Wh=["user"],Kh=["callback"],Hh=["deviceId","callback"],zh=["deviceId","callback"],qh=["callback"],Yh=["deviceId"],Jh=["deviceId"],Qh=["callback"],Xh=["deviceId"],Zh=["callback"];function*em(e){const{step:t}=yield Mi((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*tm(){yield wi(Ro.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ri(Cf.auth.enrollMfa);yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)}))}}function*nm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Bh);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Mi((e=>e.auth.user)),o=yield Ri(Cf.auth.verifyMfa,n),i=yield Ri(Cf.auth.getMFADevices),a=yield em(o);yield wi(Ro.setMfaState(C({},a,{mfaDevices:i}))),yield wi(Ro.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*om(e){let{payload:{callback:t}}=e,n=Ho(e.payload,jh);yield wi(Ro.setMfaState({loading:!0}));try{const e=yield Ri(Cf.auth.loginWithMfaV2,n),{user:o}=e,i=Ho(e,Wh),a={step:rn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield wi(Ro.setMfaState(a)),yield xS(C({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({loading:!1,error:$p(e)})),null==t||t(null,e)}}function*im({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;yield Ri(Cf.auth.disableMfa,e);const n=yield Ri(Cf.auth.getMFADevices);yield wi(Ro.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setMfaState({saving:!1,error:$p(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*am({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t,n;const o=yield Ri(Cf.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 wi(Ro.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield wi(Ro.setMfaState({saving:!1,error:$p(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*rm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Kh);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(n.publicKey),o=yield Ri(Cf.auth.enrollMFAWebAuthn,C({},n,{options:e})),i=yield Ri(Cf.auth.getMFADevices),a=yield em(o);yield wi(Ro.setMfaState(C({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*lm(e){let{payload:{deviceId:t,callback:n}}=e;Ho(e.payload,Hh),yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(Cf.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 wi(Ro.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==n||n(null,e)}}function*sm(e){let{payload:{deviceId:t,callback:n}}=e,o=Ho(e.payload,zh);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(o.publicKey);yield Ri(Cf.auth.disableMFAWebAuthn,t,C({},o,{options:e}));const i=yield Ri(Cf.auth.getMFADevices);yield wi(Ro.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==n||n(!1,e)}}function*cm({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;const n=yield Ri(Cf.auth.preEnrollMFASMS,e);yield wi(Ro.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 wi(Ro.setMfaState({saving:!1,error:$p(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*um(e){let{payload:{callback:t}}=e,n=Ho(e.payload,qh);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Ri(Cf.auth.enrollMFASMS,n),o=yield Ri(Cf.auth.getMFADevices),i=yield em(e);yield wi(Ro.setMfaState(C({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*dm(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Yh);yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(Cf.auth.preDisableMFASMS,t);yield wi(Ro.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 wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*ym(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Jh);yield wi(Ro.setMfaState({saving:!0}));try{var o;yield Ri(Cf.auth.disableMFASMS,t,n);const e=yield Ri(Cf.auth.getMFADevices);yield wi(Ro.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*fm(){yield wi(Ro.setMfaState({loading:!0}));try{yield Mi((e=>e.auth.user));const e=yield Ri(Cf.auth.getMFADevices);yield wi(Ro.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield wi(Ro.setMfaState({loading:!1,error:$p(e)}))}}function*pm(){yield wi(Ro.setMfaState({loading:!0}));try{const e=(yield Ri(Cf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield wi(Ro.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield wi(Ro.setMfaState({loading:!1,error:$p(e)}))}}function*gm(){yield Oa(Ro.enrollMfa,tm),yield Oa(Ro.getMFADevices,fm),yield Oa(Ro.getMFAStrategies,pm),yield Oa(Ro.verifyMfa,nm),yield Oa(Ro.disableMfa,im),yield Oa(Ro.verifyMfaAfterForce,om),yield Oa(Ro.preDisableMfaSms,dm),yield Oa(Ro.disableMfaSms,ym),yield Oa(Ro.preEnrollMfaSms,cm),yield Oa(Ro.enrollMfaSms,um),yield Oa(Ro.preEnrollMfaWebAuthn,am),yield Oa(Ro.enrollMfaWebAuthn,rm),yield Oa(Ro.preDisableMfaWebAuthn,lm),yield Oa(Ro.disableMfaWebAuthn,sm)}function*Sm(){yield wi(Ro.setMfaState({saving:!0})),yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*vm({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Mi((e=>e.auth.mfaState));yield wi(Ro.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 wi(Ro.setMfaState(o)),yield wi(Ro.setUser(C({},op,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*hm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Qh);yield wi(Ro.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 wi(Ro.setMfaState(i)),yield At(),yield wi(Ro.setUser(C({},op,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*mm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Mi((e=>e.auth.mfaState));yield wi(Ro.setMfaState({saving:!0})),yield At(),yield wi(Ro.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield wi(Ro.setUser(C({},op))),null==(t=e.callback)||t.call(e,!0)}function*Am(e){let{}=e,t=Ho(e.payload,Xh);yield wi(Ro.setMfaState({saving:!0}));try{var n;yield wi(Ro.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield wi(Ro.setMfaState({saving:!1,error:$p(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*bm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Mi((e=>e.auth.mfaState));yield wi(Ro.setMfaState({saving:!0})),yield At(),yield wi(Ro.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield wi(Ro.setUser(C({},op))),null==(t=e.callback)||t.call(e,!0)}function*Tm({payload:e}){var t;yield wi(Ro.setMfaState({saving:!0})),yield At(),yield wi(Ro.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*km(e){let{payload:{callback:t}}=e;Ho(e.payload,Zh);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Mi((e=>e.auth.mfaState));yield wi(Ro.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 wi(Ro.setMfaState(i)),yield wi(Ro.setUser(C({},op,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Em(){yield Oa(Ro.enrollMfa,Sm),yield Oa(Ro.verifyMfa,vm),yield Oa(Ro.disableMfa,mm),yield Oa(Ro.verifyMfaAfterForce,hm),yield Oa(Ro.preDisableMfaSms,Am),yield Oa(Ro.disableMfaSms,bm),yield Oa(Ro.preEnrollMfaSms,Tm),yield Oa(Ro.enrollMfaSms,km)}const Im=["callback"];function*Pm({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{var t;yield Ri(Cf.auth.forgotPassword,e),yield wi(Ro.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setForgotPasswordState({loading:!1,error:$p(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Im);yield wi(Ro.setForgotPasswordState({loading:!0}));try{yield Ri(Cf.auth.resetPassword,n),yield wi(Ro.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==t||t(!0)}catch(e){yield wi(Ro.setForgotPasswordState({loading:!1,error:$p(e)})),null==t||t(!1,e)}}function*Om({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{const t=yield Ri(Cf.auth.loadPasswordConfig,e);yield wi(Ro.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield wi(Ro.setForgotPasswordState({loading:!1,error:$p(e)}))}}function*_m(){yield wa(Ro.forgotPassword,Pm),yield wa(Ro.resetPassword,Lm),yield wa(Ro.loadPasswordConfig,Om)}let wm;!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"}(wm||(wm={}));const Cm=["callback","events"],Um=["user"],Rm=["callback"],Dm=["callback"];function*Nm({payload:{userId:e,token:t}}){yield wi(Ro.setActivateState({loading:!0,step:Ft.activating}));try{const{isAuthenticated:n}=yield Mi((e=>e.auth));n&&(yield wi(Ro.silentLogout()));const o=yield Ri(Cf.auth.getActivateAccountStrategy,{userId:e,token:t});yield wi(Ro.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield wi(Ro.setActivateState({loading:!1,step:Ft.activatingForm})))}catch(e){yield wi(Ro.setActivateState({loading:!1,error:$p(e)}))}}function*Mm(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,Cm);yield wi(Ro.setActivateState({loading:!0}));try{const e=Ca.onRedirectTo,{routes:a}=yield Mi((e=>e.auth)),r=yield Ri(Cf.auth.activateAccountV2,o),{user:l}=r,s=Ho(r,Um);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Wp(l)){yield wi(Ro.setActivateState({step:Ft.success}));const t=yield WS(l);yield wi(Ro.setState(t)),yield Fi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield wi(Ro.setActivateState({step:Ft.success})),null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Mp.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Ri(xS,C({user:l},s),{isAuthenticated:!0}),yield Fi(1e3),yield VS(),yield wi(Ro.resetActivateState())}null==t||t(!0)}catch(e){yield wi(Ro.setActivateState({loading:!1,error:$p(e)}))}}function*Fm({payload:e}){const{callback:t}=e,n=Ho(e,Rm);yield wi(Ro.setActivateStrategyState({loading:!0}));try{const e=yield Ri(Cf.auth.getActivateAccountStrategy,n);yield wi(Ro.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield wi(Ro.setActivateStrategyState({loading:!1,error:$p(e)}))}}function*Gm({payload:e}){const{callback:t}=e,n=Ho(e,Dm);yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:n.email})),yield wi(Ro.setActivateState({loading:!0}));try{yield Ri(Cf.auth.resendActivationEmail,n),yield wi(Ro.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield wi(Ro.setActivateState({loading:!1,error:$p(e)})),yield wi(Ro.setTeamError({key:wm.RESEND_ACTIVATE_LINK,value:$p(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:!1}))}function*$m(){yield wa(Ro.activateAccount,Mm),yield wa(Ro.preActivateAccount,Nm),yield wa(Ro.getActivateAccountStrategy,Fm),yield wa(Ro.resendActivationEmail,Gm)}function*xm({payload:e}){if(e.token&&e.userId)try{yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.pending})),yield Ri(Cf.auth.acceptInvitation,e),yield wi(Ro.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Vt.success}}))}catch(e){yield wi(Ro.setAcceptInvitationState({step:Vt.failed,error:$p(e)}))}else yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.invalid}))}function*Vm(){yield wa(Ro.acceptInvitation,xm)}var Bm,jm=new Uint8Array(16);function Wm(){if(!Bm&&!(Bm="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 Bm(jm)}for(var Km=/^(?:[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,Hm=function(e){return"string"==typeof e&&Km.test(e)},zm=[],qm=0;qm<256;++qm)zm.push((qm+256).toString(16).substr(1));var Ym=function(e,t,n){var o=(e=e||{}).random||(e.rng||Wm)();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=(zm[e[t+0]]+zm[e[t+1]]+zm[e[t+2]]+zm[e[t+3]]+"-"+zm[e[t+4]]+zm[e[t+5]]+"-"+zm[e[t+6]]+zm[e[t+7]]+"-"+zm[e[t+8]]+zm[e[t+9]]+"-"+zm[e[t+10]]+zm[e[t+11]]+zm[e[t+12]]+zm[e[t+13]]+zm[e[t+14]]+zm[e[t+15]]).toLowerCase();if(!Hm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let Jm,Qm;!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"}(Jm||(Jm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Qm||(Qm={}));const Xm=["callback"],Zm=["roles"],eA=["callback"],tA=["callback","profileImage"],nA=["callback"],oA=["callback","userId"],iA=["callback"],aA=["callback"],rA=["callback"],lA=["callback"],sA=["callback"],cA=["callback"],uA=["callback"],dA=["callback","profileImage"],yA=["callback"],fA=["callback"],pA=["callback"],gA=["callback"],SA=["callback"],vA=["callback"],hA=()=>Mi((e=>e.auth.teamState));function*mA(){try{const{groups:e}=yield Ri(Cf.groups.getGroups,{_groupsRelations:Qm.roles});return e}catch(e){return[]}}function*AA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield hA(),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 wi(Ro.setTeamLoader({key:wm.USERS,value:!r})),yield wi(Ro.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield Ci([Ri(Cf.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})),Ri(Cf.teams.loadAvailableRoles),Ri(Cf.teams.loadAvailablePermissions),Ri(mA)]),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 wi(Ro.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 wi(Ro.setTeamError({key:wm.USERS,value:$p(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:wm.USERS,value:!1}))}function*bA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield hA(),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 wi(Ro.setTeamLoader({key:wm.USERS,value:!a})),yield wi(Ro.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield Ci([Ri(Cf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ri(Cf.teams.loadAvailableRoles),Ri(Cf.teams.loadAvailablePermissions)]);yield wi(Ro.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield wi(Ro.setTeamError({key:wm.USERS,value:e.message})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield wi(Ro.setTeamLoader({key:wm.USERS,value:!1}))}function*TA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield hA(),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 wi(Ro.setTeamLoader({key:wm.USERS,value:!r})),yield wi(Ro.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ci([Ri(Cf.subTenants.loadAllUsers,C({},c)),Ri(Cf.teams.loadAvailableRoles),Ri(Cf.teams.loadAvailablePermissions)]);yield wi(Ro.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield wi(Ro.setTeamError({key:wm.USERS,value:$p(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:wm.USERS,value:!1}))}function*kA({payload:e}){yield wi(Ro.setTeamLoader({key:wm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ci([Ri(Cf.teams.loadAvailableRoles),Ri(Cf.teams.loadAvailablePermissions)]);yield wi(Ro.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 wi(Ro.setTeamError({key:wm.ROLES_AND_PERMISSIONS,value:$p(t)}))}yield wi(Ro.setTeamLoader({key:wm.ROLES_AND_PERMISSIONS,value:!0}))}function*EA({payload:e}){const{callback:t}=e,n=Ho(e,Xm),o=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ri(Cf.teams.addUser,n),{roles:a}=e,r=C({},Ho(e,Zm),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield wi(Ro.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:$p(e)})})),null==t||t(null,e)}}function*IA({payload:e}){const{callback:t}=e,n=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield wi(Ro.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Ri(Cf.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 wi(Ro.loadUsersV2(r)),yield wi(Ro.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*PA({payload:e}){const{callback:t}=e,n=Ho(e,eA),o=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield Ri(Cf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ri(Cf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield wi(Ro.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:$p(e)})})),null==t||t(null,e)}}function*LA({payload:e}){const{callback:t}=e,n=Ho(e,tA),{id:o}=n,i=yield hA(),a=i.users.find((e=>e.id===n.id));yield wi(Ro.setTeamLoader({key:wm.UPDATE_USER,value:o||""})),yield wi(Ro.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield wi(Ro.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 Ri(Cf.teams.updateUser,n);null==t||t(e),yield wi(Ro.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 wi(Ro.setTeamLoader({key:wm.UPDATE_USER,value:!1}))}catch(e){yield wi(Ro.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:$p(e)}),users:i.users.map((e=>e.id===n.id?C({},e,a):e))})),yield wi(Ro.setTeamLoader({key:wm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*OA({payload:e}){const{callback:t}=e,n=Ho(e,nA),o=yield hA();yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(Cf.teams.deleteUser,n),null==t||t(!0),yield wi(Ro.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:$p(e)})})),null==t||t(null,e)}}function*_A({payload:e}){const{callback:t,userId:n}=e,o=Ho(e,oA),i=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield Ri(Cf.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 wi(Ro.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 wi(Ro.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:$p(e)})})),null==t||t(null,e)}}function*wA({payload:e}){const{callback:t}=e,n=Ho(e,iA),o=yield hA();yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(Cf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield wi(Ro.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!1,error:$p(e)})})),null==t||t(null,e)}}function*CA({payload:e}){const{callback:t}=e,n=Ho(e,aA);yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ri(Cf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:wm.RESEND_ACTIVATE_LINK,value:$p(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:!1}))}function*UA({payload:e}){const{callback:t}=e,n=Ho(e,rA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(Cf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:wm.RESEND_INVITATION_LINK,value:$p(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*RA({payload:e}){const{callback:t}=e,n=Ho(e,lA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(Cf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:wm.RESEND_INVITATION_LINK,value:$p(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*DA({payload:e}){const{callback:t}=e,n=Ho(e,sA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(Cf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:wm.RESEND_INVITATION_LINK,value:$p(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*NA(){yield wi(Ro.setTeamError({key:wm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ri(Cf.teams.getInviteLinkConfiguration);yield wi(Ro.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield wi(Ro.setTeamError({key:wm.CONFIG_TOKEN_LINK,value:$p(e)}))}}function*MA(){yield wi(Ro.setTeamError({key:wm.GET_TOKEN_LINK,value:!1}));try{yield Ri(NA);const e=yield Ri(Cf.teams.getInviteUserLink),{inviteTokenState:t}=yield hA();yield wi(Ro.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield wi(Ro.setTeamError({key:wm.GET_TOKEN_LINK,value:$p(e)}))}}function*FA({payload:{callback:e}}){yield wi(Ro.setTeamError({key:wm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield hA();try{const n=yield Ri(Cf.teams.createInviteUserLink,{expiresInMinutes:43200});yield wi(Ro.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:wm.CREATE_TOKEN_LINK,value:$p(t)}))}}function*GA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield hA();yield wi(Ro.setTeamError({key:wm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ri(Cf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield wi(Ro.setTeamState({inviteTokenState:C({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:wm.UPDATE_TOKEN_LINK,value:$p(t)}))}}function*$A({payload:e}){const{callback:t}=null!=e?e:{};yield wi(Ro.setTeamError({key:wm.DELETE_TOKEN_LINK,value:!1}));try{yield Ri(Cf.teams.deleteInviteUserLink),yield wi(Ro.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:wm.DELETE_TOKEN_LINK,value:$p(e)})),null==t||t(!1,e)}}function*xA({payload:e}){yield wi(Ro.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*VA({payload:e}){const t=yield hA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*BA({payload:e}){yield wi(Ro.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*jA({payload:e}){const t=yield hA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*WA(){yield _a(Ro.loadUsers,bA),yield _a(Ro.loadUsersV2,AA),yield _a(Ro.loadAllSubTenantsUsers,TA),yield _a(Ro.loadRoles,kA),yield Oa(Ro.addUser,EA),yield Oa(Ro.addUsersBulk,IA),yield Oa(Ro.addUserToSubTenants,PA),yield Oa(Ro.updateUser,LA),yield Oa(Ro.setUserRolesForSubTenants,_A),yield Oa(Ro.deleteUser,OA),yield Oa(Ro.deleteUserFromSubTenants,wA),yield Oa(Ro.resendActivationLink,CA),yield Oa(Ro.resendInvitationLink,UA),yield Oa(Ro.resendInvitationEmail,RA),yield Oa(Ro.resendInvitationLinkToAllSubTenants,DA),yield Oa(Ro.getInvitationLink,MA),yield Oa(Ro.createInvitationLink,FA),yield Oa(Ro.updateInvitationLink,GA),yield Oa(Ro.deleteInvitationLink,$A),yield Oa(Ro.openAddUserDialog,xA),yield Oa(Ro.closeAddUserDialog,VA),yield Oa(Ro.openDeleteUserDialog,BA),yield Oa(Ro.closeDeleteUserDialog,jA)}function*KA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield hA(),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 wi(Ro.setTeamLoader({key:wm.USERS,value:!a})),yield wi(Ro.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield At(),yield wi(Ro.setTeamState({users:Ap,totalPages:2,totalItems:10,roles:yp,permissions:pp})),yield wi(Ro.setTeamLoader({key:wm.USERS,value:!1})),null==r||r(Ap)}function*HA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield hA(),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 wi(Ro.setTeamLoader({key:wm.USERS,value:!r})),yield wi(Ro.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield At(),yield wi(Ro.setTeamState({allUsers:Tp,totalPages:2,totalItems:10,roles:yp,permissions:pp})),yield wi(Ro.setTeamLoader({key:wm.USERS,value:!1})),null==l||l(Tp)}function*zA({payload:e}){var t;yield wi(Ro.setTeamLoader({key:wm.ROLES_AND_PERMISSIONS,value:!0})),yield At(),yield wi(Ro.setTeamState({roles:yp,permissions:pp})),yield wi(Ro.setTeamLoader({key:wm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:yp,permissions:pp})}function*qA({payload:e}){const{callback:t}=e,n=Ho(e,cA),o=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},vp,{groups:[]},n,{id:`${Ym()}`});null==t||t(i),yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*YA({payload:e}){const{callback:t}=e,n=Ho(e,uA),o=yield hA();yield wi(Ro.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield At();const i=C({},vp,n,{id:`${Ym()}`});yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*JA({payload:e}){var t;const{callback:n}=e,o=Ho(e,dA),{id:i}=o,a=yield hA(),r=a.users.find((e=>e.id===o.id));yield wi(Ro.setTeamLoader({key:wm.UPDATE_USER,value:i||""})),yield wi(Ro.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield wi(Ro.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 wi(Ro.setTeamState({users:a.users.map((e=>e.id===l.id?C({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield wi(Ro.setTeamLoader({key:wm.UPDATE_USER,value:!1}))}function*QA({payload:e}){const{callback:t}=e,n=Ho(e,yA),o=yield hA();yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield wi(Ro.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*XA({payload:e}){const{callback:t}=e,n=Ho(e,fA),o=yield hA();yield wi(Ro.setTeamState({deleteUserDialogState:C({},o.deleteUserDialogState,{loading:!0})})),yield At(),null==t||t(!0),yield wi(Ro.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ZA({payload:e}){const{callback:t}=e,n=Ho(e,pA);yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:n.userId})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:wm.RESEND_ACTIVATE_LINK,value:!1}))}function*eb({payload:e}){const{callback:t}=e,n=Ho(e,gA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*tb({payload:e}){const{callback:t}=e,n=Ho(e,SA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*nb({payload:e}){const{callback:t}=e,n=Ho(e,vA);yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:wm.RESEND_INVITATION_LINK,value:!1}))}function*ob(){yield _a(Ro.loadUsersV2,KA),yield _a(Ro.loadAllSubTenantsUsers,HA),yield _a(Ro.loadRoles,zA),yield Oa(Ro.addUser,qA),yield Oa(Ro.addUserToSubTenants,YA),yield Oa(Ro.updateUser,JA),yield Oa(Ro.deleteUser,QA),yield Oa(Ro.deleteUserFromSubTenants,XA),yield Oa(Ro.resendActivationLink,ZA),yield Oa(Ro.resendInvitationLink,eb),yield Oa(Ro.resendInvitationEmail,tb),yield Oa(Ro.resendInvitationLinkToAllSubTenants,nb),yield Oa(Ro.openAddUserDialog,xA),yield Oa(Ro.closeAddUserDialog,VA),yield Oa(Ro.openDeleteUserDialog,BA),yield Oa(Ro.closeDeleteUserDialog,jA)}const ib=["authorizationUrl"],ab=["events","url"];function*rb(){try{yield wi(Ro.setSocialLoginsState({loading:!0}));const e=yield Ri(Cf.auth.getSocialLoginProviders);yield wi(Ro.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({error:$p(e),loading:!1,firstLoad:!1}))}}function*lb(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(Cf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Ri(Cf.auth.getSocialLoginProvidersV2),t}function*sb(){try{const e=yield Mi((e=>e.root.context));yield wi(Ro.setSocialLoginsState({loading:!0}));const t=yield Ri(lb),{providers:n}=yield Ri(Cf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ho(t,ib);const i=vr(e,null!=n?n:"");return C({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield wi(Ro.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({error:$p(e),loading:!1,firstLoad:!1}))}}function*cb(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,ab);try{yield wi(Ro.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ri(Cf.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Fp.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Mp.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield wi(Ro.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Mi((e=>e.auth));e?yield Ri(qS):yield Ri(JS)}(),localStorage.removeItem("register-quick-login"),yield wi(Ro.setSocialLoginsState({loading:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({loading:!1,error:$p(e,"Failed to authenticate"),firstLoad:!1}))}}function*ub({payload:e}){yield wi(Ro.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*db(){yield wa(Ro.loadSocialLoginsConfiguration,rb),yield wa(Ro.loadSocialLoginsConfigurationV2,sb),yield wa(Ro.loginViaSocialLogin,cb),yield _a(Ro.setSocialLoginError,ub)}let yb;function*fb({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Mi((e=>e.auth.apiTokensState));try{let e,a;yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ri(Cf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ri(Cf.auth.updateUserApiTokensData,{description:t}),yield wi(Ro.setApiTokensState({showAddTokenDialog:!1})),yield Fi(200),yield wi(Ro.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield wi(Ro.setApiTokensError({key:yb.ADD_API_TOKEN,value:$p(e)})),yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*pb({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Mi((e=>e.auth.apiTokensState));try{let e,r;yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ri(Cf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ri(Cf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield wi(Ro.setApiTokensState({showAddTokenDialog:!1})),yield Fi(200),yield wi(Ro.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield wi(Ro.setApiTokensError({key:yb.ADD_API_TOKEN,value:$p(e)})),yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*gb({payload:e}){const{apiTokensDataUser:t}=yield Mi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!0})),n?(yield Ri(Cf.auth.deleteUserAccessToken,{id:e}),yield wi(Ro.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ri(Cf.auth.deleteUserApiToken,{tokenId:e}),yield wi(Ro.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:yb.DELETE_API_TOKEN,value:$p(e)})),yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!1}))}}function*Sb({payload:e}){const{apiTokensDataTenant:t}=yield Mi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!0})),n?(yield Ri(Cf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ri(Cf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield wi(Ro.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:yb.DELETE_API_TOKEN,value:$p(e)})),yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!1}))}}function*vb({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ci([Ri(Cf.auth.getUserApiTokensData),Ri(Cf.auth.getTenantApiTokensData)]);yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setApiTokensError({key:yb.LOAD_API_TOKENS,value:$p(t)})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*hb({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(Cf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ri(Cf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield wi(Ro.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:yb.LOAD_API_TOKENS,value:$p(t)})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*mb({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(Cf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ri(Cf.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 wi(Ro.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:yb.LOAD_API_TOKENS,value:$p(t)})),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Ab(){yield wa(Ro.loadApiTokens,vb),yield wa(Ro.loadUserApiTokens,hb),yield wa(Ro.loadTenantApiTokens,mb),yield Oa(Ro.addUserApiToken,fb),yield Oa(Ro.addTenantApiToken,pb),yield _a(Ro.deleteTenantApiToken,Sb),yield _a(Ro.deleteUserApiToken,gb)}function*bb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Mi((e=>e.auth.apiTokensState)),a=C({},ep,{description:t,roleIds:n,clientId:`CLIENT_ID_${Ym()}`});yield wi(Ro.setApiTokensState({showAddTokenDialog:!1})),yield Fi(200),yield wi(Ro.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:yb.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Tb({payload:e}){yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!0})),yield Fi(200);const t=[ep];yield wi(Ro.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield wi(Ro.setApiTokensLoader({key:yb.DELETE_API_TOKEN,value:!1}))}function*kb({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));const n=[Zf],o=[ep];yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Eb({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));const n=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataUser:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Ib({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!0})));const n=[ep];yield wi(Ro.setApiTokensState({apiTokensDataTenant:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:yb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Pb(){yield wa(Ro.loadApiTokens,kb),yield wa(Ro.loadUserApiTokens,Eb),yield wa(Ro.loadTenantApiTokens,Ib),yield Oa(Ro.addTenantApiToken,bb),yield _a(Ro.deleteTenantApiToken,Tb)}function*Lb({payload:e}){try{var t;yield wi(Ro.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Mi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Ri(Cf.accountSettings.updateSettings,C({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield wi(Ro.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield wi(Ro.setAccountSettingsState({loading:!1,error:$p(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Ob({payload:e}){yield wi(Ro.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ri(Cf.accountSettings.getSettings);yield wi(Ro.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield wi(Ro.setAccountSettingsState({loading:!1,error:$p(e)}))}}function*_b(){yield wa(Ro.saveAccountSettings,Lb),yield wa(Ro.loadAccountSettings,Ob)}function*wb({payload:e}){var t;yield wi(Ro.setAccountSettingsState({loading:!0})),yield At();const{accountSettingsState:n}=yield Mi((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 wi(Ro.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Cb({payload:e}){yield wi(Ro.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield At(),yield wi(Ro.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Ub(){yield wa(Ro.saveAccountSettings,wb),yield wa(Ro.loadAccountSettings,Cb)}function*Rb({payload:{tenantId:e,callback:t}}){yield wi(Ro.setState({isLoading:!0}));try{yield Ri(Cf.tenants.switchTenant,{tenantId:e}),yield Ri(HS),(null==t?void 0:t(!0))||(yield wi(Ro.setState({isLoading:!1})))}catch(e){yield wi(Ro.setState({isLoading:!1})),null==t||t(!1,e)}}function*Db({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(Cf.users.getCurrentUserTenantsV3);yield wi(Ro.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 wi(Ro.setTenantsState({loading:!1}))}}function*Nb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(Cf.tenants.getSubTenants);yield wi(Ro.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Mb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(Cf.tenants.getSubTenantsAsTree);yield wi(Ro.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Fb(){yield Oa(Ro.loadTenants,Db),yield Oa(Ro.loadSubTenants,Nb),yield Oa(Ro.switchTenant,Rb),yield Oa(Ro.loadSubTenantsTree,Mb)}function*Gb(){yield wi(Ro.setTenantsState({loading:!0})),yield At(),yield wi(Ro.setTenantsState({tenants:kp,activeTenant:kp[0],loading:!1}))}function*$b(){yield Oa(Ro.loadTenants,Gb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(yb||(yb={}));const xb=["callback"],Vb=["callback"],Bb=["callback"],jb=["callback"],Wb=["callback"];function*Kb({payload:e}){var t;yield wi(Ro.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ci([Ri(Cf.roles.getRoles),Ri(Cf.roles.getPermissions),Ri(Cf.roles.getPermissionCategories)]),[t,n,o]=e;yield wi(Ro.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield wi(Ro.setRolesState({error:$p(e),loading:!1}))}}function*Hb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,xb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(Cf.roles.addRole,n),o=yield Ri(Cf.roles.getRoles);yield wi(Ro.loadRolesAndPermissions({silentLoading:!0})),yield wi(Ro.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setRolesState({error:$p(e),saving:!1})),null==t||t(null,e)}}function*zb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Vb);yield wi(Ro.setRolesState({saving:!0}));try{yield Ri(Cf.roles.deleteRole,n),yield wi(Ro.loadRolesAndPermissions({silentLoading:!0})),yield wi(Ro.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setRolesState({error:$p(e),saving:!1})),null==t||t(!1,e)}}function*qb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Bb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(Cf.roles.updateRole,n);yield wi(Ro.loadRolesAndPermissions({silentLoading:!0})),yield wi(Ro.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setRolesState({error:$p(e),saving:!1})),null==t||t(null,e)}}function*Yb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,jb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(Cf.roles.attachPermissionsToRole,n);yield wi(Ro.loadRolesAndPermissions({silentLoading:!0})),yield wi(Ro.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setRolesState({error:$p(e),saving:!1})),null==t||t(null,e)}}function*Jb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Wb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(Cf.roles.attachPermissionToRoles,n);yield wi(Ro.loadRolesAndPermissions({silentLoading:!0})),yield wi(Ro.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setRolesState({error:$p(e),saving:!1})),null==t||t(null,e)}}function*Qb(){yield wa(Ro.loadRolesAndPermissions,Kb),yield Oa(Ro.addRole,Hb),yield Oa(Ro.deleteRole,zb),yield Oa(Ro.updateRole,qb),yield Oa(Ro.attachPermissionsToRole,Yb),yield Oa(Ro.attachPermissionToRoles,Jb)}function*Xb({payload:e}){var t;yield wi(Ro.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield wi(Ro.setRolesState({roles:tp,loading:!1}))}catch(e){yield wi(Ro.setRolesState({error:$p(e),loading:!1}))}}function*Zb(){yield wa(Ro.loadRolesAndPermissions,Xb)}const eT=["callback"],tT=["callback"],nT=["callback"];function*oT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,eT);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(Cf.auth.resetPhoneNumber,n);yield wi(Ro.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Yt.VerifyResetPhoneNumber})),yield wi(Ro.setLoginState({email:n.email}))}catch(e){yield wi(Ro.setResetPhoneNumberState({loading:!1,error:$p(e)})),null==t||t(null,e)}}function*iT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,tT);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(Cf.auth.verifyResetPhoneNumber,n);yield wi(Ro.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Yt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield wi(Ro.setResetPhoneNumberState({loading:!1,error:$p(e)})),null==t||t(null,e)}}function*aT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,nT);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Mi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ri(Cf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield wi(Ro.setLoginState({step:It.loginWithSmsOtc})),yield wi(Ro.passwordlessPreLogin({type:To.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield wi(Ro.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setResetPhoneNumberState({loading:!1,error:$p(e)})),null==t||t(null,e)}}function*rT(){yield wa(Ro.resetPhoneNumber,oT),yield wa(Ro.verifyResetPhoneNumber,iT),yield wa(Ro.changePhoneNumber,aT)}function*lT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getCurrentUserSessions);yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*sT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getCurrentUserSession);yield wi(Ro.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*cT({payload:{id:e}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(Cf.auth.deleteSessionForUser,e),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*uT({payload:{callback:e,userId:t}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(Cf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield wi(Ro.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*dT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(Cf.auth.deleteAllSessionsForUser),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*yT(){yield _a(Ro.loadUserSessions,lT),yield _a(Ro.deleteUserSession,cT),yield _a(Ro.deleteAllUserSessions,dT),yield _a(Ro.loadCurrentUserSession,sT),yield Oa(Ro.revokeUserSessions,uT)}function*fT(){yield wi(Ro.setSessionsState({loading:!0,error:null})),yield wi(Ro.setSessionsState({sessions:Ep,loading:!1}))}function*pT({payload:{id:e}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));const t=(yield Mi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield wi(Ro.setSessionsState({sessions:t,loading:!1}))}function*gT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));const e=Ep.filter((e=>e.current));yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}function*ST(){yield _a(Ro.loadUserSessions,fT),yield _a(Ro.deleteUserSession,pT),yield _a(Ro.deleteAllUserSessions,gT)}const vT=["callback"],hT=["callback"];function*mT(){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getSessionConfigurations);yield wi(Ro.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*AT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ho(e,vT);yield Ri(Cf.auth.createOrUpdateSessionConfigrations,n),yield wi(Ro.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield wi(Ro.setSessionsPolicyState({error:e,loading:!1}))}}function*bT(){yield wa(Ro.loadSessionsPolicy,mT),yield _a(Ro.createOrUpdateSessionsPolicy,ng(AT))}function*TT(){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));const e=yield Mi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Ip}));yield wi(Ro.setSessionsPolicyState(C({},e,{loading:!1})))}function*kT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ho(e,hT);null==t||t(!0),yield wi(Ro.setSessionsPolicyState({configurations:n,loading:!1}))}function*ET(){yield wa(Ro.loadSessionsPolicy,TT),yield _a(Ro.createOrUpdateSessionsPolicy,kT)}const IT=["callback"],PT=["callback"],LT=["callback"],OT=["callback"],_T=["callback"],wT=["callback"],CT=["callback"],UT=["callback"],RT=()=>Mi((e=>e.auth.restrictionsState.ipRestrictions)),DT=()=>Mi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*NT(){yield wi(Ro.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ri(Cf.auth.getDomainRestrictionsConfig),t=(yield Ri(Cf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield wi(Ro.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield wi(Ro.setEmailDomainRestrictionsState({error:$p(e),loading:!1}))}}function*MT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,IT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield DT();try{var i;yield Ri(Cf.auth.createDomainRestriction,n);const e=(yield Ri(Cf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield wi(Ro.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 wi(Ro.setEmailDomainRestrictionsState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*FT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,PT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ri(Cf.auth.updateDomainRestrictionConfig,n),o=(yield Ri(Cf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield wi(Ro.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setEmailDomainRestrictionsState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*GT({payload:{id:e}}){yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield DT();try{var n;yield Ri(Cf.auth.deleteDomainRestriction,e);const o=(yield Ri(Cf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield wi(Ro.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 wi(Ro.setEmailDomainRestrictionsState({saving:!1,error:$p(e)}))}}const $T=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*xT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield RT(),t=yield Ri(Cf.auth.getIPRestrictionsConfig),n=$T({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ri(Cf.auth.getIPRestrictions,n);yield wi(Ro.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield wi(Ro.setIpRestrictionsState({error:$p(e),loading:!1}))}}function*VT(){try{const{valid:e}=yield Ri(Cf.auth.testCurrentIpInAllowList);yield wi(Ro.setIpRestrictionsState({userIpValid:e}))}catch(e){yield wi(Ro.setIpRestrictionsState({error:$p(e)}))}}function*BT({payload:{callback:e}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Mi((e=>e.auth.userIp));yield Ci([Ri(Cf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Vn.ALLOW}),Ri(Cf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield RT(),o=$T(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ri(Cf.auth.getIPRestrictions,o);yield wi(Ro.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 wi(Ro.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*jT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,LT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield RT();try{var i,a;yield Ri(Cf.auth.createIPRestriction,n);const e=yield RT(),r=$T(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ri(Cf.auth.getIPRestrictions,r);yield VT(),yield wi(Ro.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 wi(Ro.setIpRestrictionsState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*WT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,OT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{yield Ri(Cf.auth.updateIPRestrictionConfig,n);const e=yield RT(),o=yield Ri(Cf.auth.getIPRestrictionsConfig),i=$T(C({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ri(Cf.auth.getIPRestrictions,i);yield VT(),yield wi(Ro.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setIpRestrictionsState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*KT({payload:{id:e,callback:t}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const n=yield RT();try{var o;yield Ri(Cf.auth.deleteIPRestriction,e);const i=yield RT(),a=$T(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ri(Cf.auth.getIPRestrictions,a);yield VT(),yield wi(Ro.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 wi(Ro.setIpRestrictionsState({saving:!1,error:$p(e)})),null==t||t(null,e)}}function*HT(){yield wa(Ro.loadIpRestrictions,ng(xT)),yield wa(Ro.loadEmailDomainRestrictions,ng(NT)),yield Oa(Ro.saveIpRestriction,ng(jT)),yield Oa(Ro.saveIpRestrictionsConfig,ng(WT)),yield Oa(Ro.deleteIpRestriction,ng(KT)),yield Oa(Ro.checkIfUserIpValid,ng(VT)),yield Oa(Ro.addCurrentUserIpAndActivate,ng(BT)),yield Oa(Ro.saveEmailDomainRestriction,ng(MT)),yield Oa(Ro.saveEmailDomainRestrictionsConfig,ng(FT)),yield Oa(Ro.deleteEmailDomainRestriction,ng(GT))}function*zT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null})),yield wi(Ro.setIpRestrictionsState({data:{restrictions:Lp.filter((e=>e.strategy===Pp.strategy)),config:Pp},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*qT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield RT(),t=Lp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield wi(Ro.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield wi(Ro.setIpRestrictionsState({error:$p(e),loading:!1}))}}function*YT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,_T);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const r=yield RT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield wi(Ro.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:Ym(),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*JT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,wT);const r=yield RT();yield wi(Ro.setIpRestrictionsState({saving:!0,error:null})),yield wi(Ro.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 wi(Ro.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*QT({payload:{id:e,callback:t}}){var n;yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield RT();yield wi(Ro.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*XT(){yield wi(Ro.setEmailDomainRestrictionsState({loading:!0,error:null})),yield wi(Ro.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Vn.ALLOW}],config:{active:!0,listType:Vn.ALLOW,blockPublicDomains:!1}}}))}function*ZT(e){var t,n;let{payload:{callback:o}}=e,i=Ho(e.payload,CT);const a=yield DT();yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==o||o(!0),yield wi(Ro.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*ek(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,UT);const i=yield DT();yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),null==n||n(!0),yield wi(Ro.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*tk({payload:{id:e}}){var t,n;const o=yield DT();yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null})),yield At(),yield wi(Ro.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*nk(){yield wa(Ro.loadIpRestrictions,zT),yield wa(Ro.loadEmailDomainRestrictions,XT),yield Oa(Ro.saveIpRestriction,YT),yield Oa(Ro.saveIpRestrictionsConfig,JT),yield Oa(Ro.deleteIpRestriction,QT),yield Oa(Ro.checkIfUserIpValid,qT),yield Oa(Ro.saveEmailDomainRestriction,ZT),yield Oa(Ro.saveEmailDomainRestrictionsConfig,ek),yield Oa(Ro.deleteEmailDomainRestriction,tk)}const ok=["callback"],ik=["id"];function*ak(e){const{count:t}=yield Ri(Cf.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*rk(){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(Cf.directory.getConfigs),t=yield Ci(e.map((e=>ak(e))));yield wi(Ro.setProvisioningState({connections:t,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:$p(e),loading:!1}))}}function*lk(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ok);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(Cf.directory.createConfiguration,n),o=yield Ri(Cf.directory.getConfigs),i=yield Ci(o.map((e=>ak(e))));yield wi(Ro.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield wi(Ro.setProvisioningState({error:$p(e),loading:!1}))}}function*sk(e){let{payload:{id:t}}=e,n=Ho(e.payload,ik);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(Cf.directory.updateConfiguration,t,n);const e=yield Ri(Cf.directory.getConfigs),o=yield Ci(e.map((e=>ak(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:$p(e),loading:!1}))}}function*ck({payload:{id:e,callback:t}}){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(Cf.directory.deleteConfiguration,e);const n=yield Ri(Cf.directory.getConfigs),o=yield Ci(n.map((e=>ak(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setProvisioningState({error:$p(e),loading:!1})),null==t||t(!1,e)}}function*uk(){yield wa(Ro.loadProvisionConnections,rk),yield Oa(Ro.createProvisionConnection,lk),yield Oa(Ro.deleteProvisionConnection,ck),yield Oa(Ro.updateProvisionConnection,sk)}const dk=["callback","events"];function*yk(e){let{payload:{callback:t}}=e,n=Ho(e.payload,dk);yield wi(Ro.setImpersonateState({loading:!0}));try{yield Ri(Cf.impersonate.impersonate,n),yield wi(Ro.setImpersonateState({step:Lo.success})),yield Fi(1e3),yield VS(),yield wi(Ro.resetImpersonateState()),null==t||t(!0)}catch(e){yield wi(Ro.setImpersonateState({loading:!1,error:$p(e)}))}}function*fk(){yield wa(Ro.impersonate,yk)}function*pk({payload:e}){const{callback:t,deviceId:n}=e;yield wi(Ro.setPasskeysState({loading:!0}));try{yield Ri(Cf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Mi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield wi(Ro.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setPasskeysState({loading:!1,error:$p(e,null)})),null==t||t(null,e)}}function*gk(){yield wi(Ro.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ri(Cf.auth.getWebAuthnDevices);yield wi(Ro.setPasskeysState({devices:e,loading:!1}))}catch(e){yield wi(Ro.setPasskeysState({loading:!1,error:$p(e,null)}))}}function*Sk(){yield Oa(Ro.loadWebAuthnDevices,gk),yield Oa(Ro.deleteWebAuthnDevice,pk)}const vk=["roleIds","userIds"],hk=()=>Mi((e=>e.auth.groupsState));function*mk({payload:e}){const t=Jm.GET_TEAM_USERS;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ri(Cf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield wi(Ro.setGroupsState({teamUsers:n}))}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Ak({payload:e}){const t=Jm.GET_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ri(Cf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Qm.rolesAndUsers});yield wi(Ro.setGroupsState({selectedGroup:n}))}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*bk(){const e=Jm.GET_GROUPS,t=yield hk();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ri(Cf.groups.getGroups,{_groupsRelations:Qm.rolesAndUsers});yield wi(Ro.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 wi(Ro.setUsersGroupsError({key:e,value:$p(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*Tk({payload:e}){const t=Jm.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ho(e,vk);yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ri(Cf.groups.createGroup,C({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield wi(Ro.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield wi(Ro.addRolesToGroup({groupId:r.id,roleIds:n}))),yield wi(Ro.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=Jm.UPDATE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.updateGroup,e),yield wi(Ro.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=Jm.DELETE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.deleteGroup,e.groupId),yield wi(Ro.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Ik({payload:e}){const t=Jm.ADD_ROLES_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield wi(Ro.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Pk({payload:e}){const t=Jm.DELETE_ROLES_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield wi(Ro.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=Jm.ADD_USERS_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield wi(Ro.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 wi(Ro.setUsersGroupsError({key:t,value:$p(n)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=Jm.DELETE_USERS_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(Cf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield wi(Ro.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield wi(Ro.setUsersGroupsError({key:t,value:$p(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*_k(){const e=Jm.GET_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ri(Cf.groups.getGroupConfiguration);yield wi(Ro.setGroupsState({groupsConfiguration:t}))}catch(t){yield wi(Ro.setUsersGroupsError({key:e,value:$p(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*wk({payload:e}){const t=Jm.UPDATE_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{yield Ri(Cf.groups.updateGroupConfiguration,e),yield wi(Ro.getGroupConfiguration())}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Ck(){yield _a(Ro.loadGroups,bk),yield _a(Ro.getGroupById,Ak),yield _a(Ro.createGroup,Tk),yield _a(Ro.updateGroup,kk),yield _a(Ro.deleteGroup,Ek),yield _a(Ro.addRolesToGroup,Ik),yield _a(Ro.deleteRolesFromGroup,Pk),yield _a(Ro.addUsersToGroup,Lk),yield _a(Ro.deleteUsersFromGroup,Ok),yield _a(Ro.getGroupConfiguration,_k),yield _a(Ro.updateGroupConfiguration,wk),yield _a(Ro.getTeamUsers,mk)}function*Uk(){const e=Jm.GET_GROUPS;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));const t=wp;yield wi(Ro.setGroupsState({groups:t})),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Rk({payload:e}){var t;const n=Jm.CREATE_GROUP,{groups:o}=yield hk();yield wi(Ro.setUsersGroupsLoader({key:n,value:!0})),yield wi(Ro.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:If.FRONTEGG}),...null!=o?o:[]]})),yield Fi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:n,value:!1}))}function*Dk({payload:e}){var t,n,o,i,a;const r=Jm.UPDATE_GROUP,l=yield hk();yield wi(Ro.setUsersGroupsLoader({key:r,value:!0})),yield wi(Ro.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:If.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 Fi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:r,value:!1}))}function*Nk({payload:e}){var t,n;const o=Jm.DELETE_GROUP,i=yield hk();yield wi(Ro.setUsersGroupsLoader({key:o,value:!0})),yield wi(Ro.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Fi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:o,value:!1}))}function*Mk({payload:e}){var t,n;const o=Jm.ADD_ROLES_TO_GROUP,i=yield hk();yield wi(Ro.setUsersGroupsLoader({key:o,value:!0})),yield wi(Ro.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 Fi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:o,value:!1}))}function*Fk({payload:e}){var t,n;const o=Jm.DELETE_ROLES_FROM_GROUP,i=yield hk();yield wi(Ro.setUsersGroupsLoader({key:o,value:!0})),yield wi(Ro.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 Fi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:o,value:!1}))}function*Gk({payload:e}){var t,n;const o=Jm.ADD_USERS_TO_GROUP,i=yield hk();yield wi(Ro.setUsersGroupsLoader({key:o,value:!0})),yield wi(Ro.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 Fi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:o,value:!1}))}function*$k({payload:e}){var t,n;const o=Jm.DELETE_USERS_FROM_GROUP,i=yield hk();yield wi(Ro.setUsersGroupsLoader({key:o,value:!0})),yield wi(Ro.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 Fi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:o,value:!1}))}function*xk(){const e=Jm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield hk();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0})),t&&(yield wi(Ro.setGroupsState({groupsConfiguration:C({},t)}))),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Vk({payload:e}){const t=Jm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield hk();yield wi(Ro.setUsersGroupsLoader({key:t,value:!0})),n&&(yield wi(Ro.setGroupsState({groupsConfiguration:C({},n,e)}))),yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}function*Bk(){yield _a(Ro.loadGroups,Uk),yield _a(Ro.createGroup,Rk),yield _a(Ro.updateGroup,Dk),yield _a(Ro.deleteGroup,Nk),yield _a(Ro.addRolesToGroup,Mk),yield _a(Ro.deleteRolesFromGroup,Fk),yield _a(Ro.addUsersToGroup,Gk),yield _a(Ro.deleteUsersFromGroup,$k),yield _a(Ro.getGroupConfiguration,xk),yield _a(Ro.updateGroupConfiguration,Vk)}let jk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",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"}(jk||(jk={}));const Wk=(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=>Wk(e,t,n))))?o:[]})};function Kk(e,t){var n;return C({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Kk(e,t))):[]})}function Hk(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=>Hk(e,t,n))))?o:[]})}const zk=({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}})),qk=()=>Mi((e=>e.auth.allAccountsState));function*Yk({payload:e}){const t=jk.GET_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield qk(),{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 qk(),{items:n,_links:i}=yield Ri(Cf.tenants.searchSubTenants,r,{jwt:o}),a=yield Ri(Cf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=zk({items:n},a),c=Hk(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 wi(Ro.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield qk(),{items:n,_links:o}=yield Ri(Cf.tenants.searchSubTenants,r),i=yield Ri(Cf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=zk({items:n},i),l=Hk(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 wi(Ro.setAllAccountsState({accounts:l}))}}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Jk({payload:e}){const t=jk.SEARCH_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield qk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ri(Cf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield wi(Ro.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Qk({payload:e}){const t=jk.GET_USER_JWT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ri(Cf.users.GetUserJwt,{tenantId:n});yield wi(Ro.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),yield wi(Ro.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Xk({payload:e}){const t=jk.CREATE_SUB_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield qk(),{selectedAccount:t}=yield qk(),r=yield Ri(Cf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=Hk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=Hk(C({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield wi(Ro.setAllAccountsState({accounts:l})),yield wi(Ro.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield qk(),t=yield Ri(Cf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=Hk(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield wi(Ro.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Zk({payload:e}){const t=jk.DELETE_SUB_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield qk();yield Ri(Cf.subTenants.deleteSubTenant,o,{jwt:n});const i=Kk(t,o),a=Kk(null==e?void 0:e.accounts,o);yield wi(Ro.setAllAccountsState({accounts:i})),yield wi(Ro.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield qk();yield Ri(Cf.subTenants.deleteSubTenant,o);const t=Kk(e,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*eE({payload:e}){const t=jk.UPDATE_SUB_ACCOUNT_SETTINGS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield qk();yield Ri(Cf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Wk(e.accounts,a,o);yield wi(Ro.setSelectedAccountState({name:o,accounts:i}));const r=Wk(t,a,o);yield wi(Ro.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield qk();yield Ri(Cf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Wk(e,a,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*tE({payload:e}){const t=jk.DELETE_USERS_FROM_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Ri(Cf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield wi(Ro.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*nE({payload:e}){const t=jk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield qk();try{yield Ri(Cf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield wi(Ro.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*oE({payload:e}){const t=jk.ADD_USERS_TO_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Ri(Cf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield wi(Ro.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*iE({payload:e}){const t=jk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield qk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ri(Cf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield wi(Ro.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 wi(Ro.setAllAccountsError({key:t,value:$p(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*aE({payload:e}){var t,n,o,i,a,r,l,s;const c=jk.GET_ACCOUNT_USERS;yield wi(Ro.setAllAccountsLoader({key:c,value:!0}));const u=yield qk(),{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 Ri(Cf.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 Ri(Cf.roles.getRoles),i=yield Ri(Cf.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 wi(Ro.setSelectedAccountState(C({users:a},o)))}else yield wi(Ro.setSelectedAccountState(C({users:[]},o)))}catch(e){yield wi(Ro.setAllAccountsError({key:c,value:$p(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:c,value:!1}))}}function*rE({payload:e}){const t=jk.SET_SELECTED_SUB_ACCOUNT_DATA;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Ri(Cf.accountSettings.getSettings,{jwt:n}),u=yield Ri(Cf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ri(Cf.tenants.getParentTenants,{jwt:n}),y=yield Ri(Cf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield wi(Ro.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 wi(Ro.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*lE(){const e=jk.SET_ROOT_ACCOUNT_DATA;yield wi(Ro.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Mi((e=>e.auth.tenantsState)),{accounts:n}=yield qk();if(t)try{var o;const i=yield Ri(Cf.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(o=i[0])?void 0:o.totalUsers,createdAt:null==t?void 0:t.createdAt};yield wi(Ro.setAllAccountsState({rootAccount:a,accounts:C({},n,a)}))}catch(t){yield wi(Ro.setAllAccountsError({key:e,value:$p(t)}))}finally{yield wi(Ro.setAllAccountsLoader({key:e,value:!1}))}}function*sE({payload:e}){const t=jk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Ri(Cf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield wi(Ro.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:$p(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*cE(){yield _a(Ro.loadAccounts,Yk),yield _a(Ro.searchAccounts,Jk),yield _a(Ro.updateSubAccountAccessForUser,iE),yield _a(Ro.getUserJwtForSubAccount,Qk),yield _a(Ro.createSubAccount,Xk),yield _a(Ro.deleteSubAccount,Zk),yield _a(Ro.updateSubAccountSettings,eE),yield _a(Ro.addUsersToAccount,oE),yield _a(Ro.deleteUsersFromAccount,tE),yield _a(Ro.setUserRolesForSubAccount,nE),yield _a(Ro.getAccountUsers,aE),yield _a(Ro.setRootAccountData,lE),yield _a(Ro.setSelectedSubAccountData,rE),yield _a(Ro.loadNumberOfUsersForSelectedSubAccount,sE)}var uE={sagas:function*(){yield Ci([Ri(Vv),Ri($m),Ri(Vm),Ri(_m),Ri(rT),Ri(oh),Ri(Ch),Ri(Fh),Ri(Zp),Ri(gm),Ri(WA),Ri(Ck),Ri(db),Ri(aS),Ri(Ab),Ri(Vg),Ri(_b),Ri(Fb),Ri(Qb),Ri(yT),Ri(bT),Ri(HT),Ri(uk),Ri(fk),Ri(Sk),Ri(cE),Ri(vS),Ri(dg)])},mockSagas:function*(){yield Ci([Ri(Wv),Ri(uh),Ri(Vh),Ri(Em),Ri(ob),Ri(Pb),Ri(eS),Ri(ST),Ri(Ub),Ri($b),Ri(ET),Ri(nk),Ri(Zb),Ri(Bk),Ri(hg)])},storeName:wt,initialState:Po,reducer:Co,actions:Ro};const dE=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),yE={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},fE={setAuditLogsState:dE("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:yE})},pE={exportAuditsCsv:ct("auditLogs/exportAuditsCsv"),loadAuditLogs:ct("auditLogs/loadAuditLogs",(e=>({payload:e})))},gE={loading:!0},SE={setAuditsMetadataState:dE("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:gE})},vE={loadAuditsMetadata:ct("auditLogs/loadAuditsMetadata")},hE={auditLogsState:yE,auditsMetadataState:gE},{reducer:mE,actions:AE}=dt({name:Ut,initialState:hE,reducers:C({resetState:e=>C({},e,hE),setState:(e,{payload:t})=>C({},e,t)},fE,SE)}),bE=C({},AE,pE,vE),TE=e=>"createdAt"!==e.id,kE={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`})))},EE={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}]},IE=()=>Mi((e=>e.auditLogs.auditLogsState)),PE=()=>Mi((e=>e.auditLogs.auditsMetadataState));function*LE(){const e=yield IE(),{columns:t}=yield PE();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 wi(bE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Cf.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield wi(bE.setAuditLogsState({isDownloadingCsv:!1}))}function*OE({payload:e}){yield wi(bE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield IE(),{columns:n}=yield PE();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 wi(bE.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 wi(bE.loadAuditsMetadata()));const{data:p,total:g}=yield Ri(Cf.audits.getAudits,C({offset:c,count:s},y,f));yield wi(bE.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 wi(bE.setAuditLogsState({loading:!1,error:$p(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*_E(){yield Oa(bE.exportAuditsCsv,LE),yield Oa(bE.loadAuditLogs,OE)}function*wE({payload:e}){yield wi(bE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield IE(),{columns:n}=yield PE();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 wi(bE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield wi(bE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=kE;let o=n.filter((e=>t=>e.filter(TE).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 wi(bE.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 wi(bE.setAuditLogsState({loading:!1,error:$p(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*CE(){yield Oa(bE.loadAuditLogs,wE)}function*UE(){yield wi(bE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ri(Cf.metadata.getAuditsMetadata);yield wi(bE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(bE.setAuditsMetadataState({error:e,loading:!1}))}}function*RE(){yield Oa(bE.loadAuditsMetadata,UE)}function*DE(){yield wi(bE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=EE;yield wi(bE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(bE.setAuditsMetadataState({error:e,loading:!1}))}}function*NE(){yield Oa(bE.loadAuditsMetadata,DE)}var ME={sagas:function*(){yield Ci([Ri(_E),Ri(RE)])},mockSagas:function*(){yield Ci([Ri(CE),Ri(NE)])},storeName:Ut,initialState:hE,reducer:mE,actions:bE};const FE={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:GE,actions:$E,reducer:xE}=dt({name:"audits",initialState:FE,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]})))}}}),VE=C({},$E,{initData:ct(`${GE}/initData`),loadAudits:ct(`${GE}/loadAudits`),removeFilter:ct(`${GE}/removeFilter`),filterData:ct(`${GE}/filterData`),exportCSV:ct(`${GE}/exportCSV`),deleteAudits:ct(`${GE}/deleteAudits`)}),BE=()=>Mi((e=>e[GE]));function*jE(){const{sortBy:e,sortDirection:t}=yield BE();try{const n=yield Ri(Cf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield wi(VE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield wi(VE.loadItemFailedAction(t))}}function*WE(){try{const e=yield Ri(Cf.metadata.getAuditsMetadata);yield wi(VE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield wi(VE.loadItemFailedAction(t))}}const KE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*HE({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield BE(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield BE():{rowsData:[]};try{const e=KE(t),{data:l,total:d}=yield Ri(Cf.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 wi(VE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield wi(VE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield wi(VE.loadItemFailedAction(t))}}function*zE(){yield wi(VE.startLoading()),yield Ci([jE(),WE(),HE({payload:{onlyOneLoad:!1},type:""})]),yield wi(VE.finishLoading())}function*qE({payload:e}){const{filters:t}=yield BE(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield wi(VE.setFilterData(o))}function*YE({payload:e}){const{filters:t}=yield BE();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 wi(VE.setFilterData(o))}function*JE(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield BE(),a=KE(e);yield wi(VE.startDownloadingCsv());try{yield Cf.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 wi(VE.stopDownloadingCsv())}}function*QE(){yield _a(VE.initData,zE),yield _a(VE.removeFilter,qE),yield _a(VE.filterData,YE),yield _a([VE.loadAudits,VE.textSearch,VE.onPageChange],HE),yield _a([VE.setFilterData,VE.setDataSorting,VE.startRefresh],(()=>HE({payload:{appendMode:!1},type:""}))),yield _a(VE.exportCSV,JE)}const XE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},ZE={initData:()=>C({},XE),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)})}},eI={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}})))},tI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:nI,actions:oI}=dt({name:Ct,initialState:tI,reducers:C({},ZE)}),iI=C({},oI,eI),aI={slack:Cf.connectivity.getSlackConfiguration,email:Cf.connectivity.getEmailConfiguration,sms:Cf.connectivity.getSMSConfiguration,webhook:Cf.connectivity.getWebhooksConfigurations,categories:Cf.connectivity.getCategories,channelMap:Cf.connectivity.getChannelMaps},rI={slack:Cf.connectivity.postSlackConfiguration,email:Cf.connectivity.postEmailConfiguration,sms:Cf.connectivity.postSMSConfiguration,webhook:Cf.connectivity.postWebhooksConfiguration},lI=["email","slack","sms","webhook"],sI={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"}},cI=["id"],uI=["id","enabled"],dI=["categories","channelMap"];function*yI(e){return yield Ri(pI,{payload:{api:e},type:""})}function*fI({payload:e=lI}){yield wi(iI.setConnectivityState({isLoading:!0}));try{const t=yield Ci([...e.map(yI),yield pI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ci(e.map((function*(e){return yield pI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>C({},t,{[`${e[o]}`]:n})),{})}()]),n=yield pI({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:sI[e[i]].events(o),active:sI[e[i]].isActive(o),platform:sI[e[i]].title,image:sI[e[i]].image}]}):n:C({},n,{[`${dI[i-e.length]}`]:o})),{list:[],webhook:n});yield wi(iI.setConnectivityState(C({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield wi(iI.setConnectivityState({isLoading:!1}))}}function*pI({payload:{api:e,params:t}}){try{return yield Ri(aI[e],t)}catch(e){return}}function*gI(){try{yield wi(iI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ri(Cf.connectivity.getSlackChannels);yield wi(iI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield wi(iI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*SI(e,t){const{connectivity:{list:n}}=yield Mi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=sI[e].isActive(t);i!==o.active&&(yield wi(iI.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:i}):t))})))}function*vI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Mi((e=>e.connectivity));try{if(yield wi(iI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Mi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ci([...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=Ho(e,cI);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 Ri(rI.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ri(Cf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Mi(),{processIds:o}=yield Mi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ci([...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 Ri("email"===t?Cf.connectivity.postEmailConfiguration:Cf.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=Ho(i,uI);return yield Ci([yield Ri("email"===t?Cf.connectivity.patchEmailConfiguration:Cf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ri("email"===t?Cf.connectivity.putEmailSubscriptions:Cf.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 Ri("email"===t?Cf.connectivity.deleteEmailSubscriptions:Cf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield pI({payload:{api:t},type:""});yield wi(iI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield SI(t,e)}else yield wi(iI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ri(rI[e],t),!["sms","email"].includes(e)){const i=yield pI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield wi(iI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield SI(e,i),null==n||n(!0)}}catch(e){yield wi(iI.setConnectivityState({error:$p(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*hI({payload:e}){try{yield Cf.connectivity.postSlackCode(e)}catch{}yield wi(iI.setConnectivityState({error:void 0,isSaving:!1}))}function*mI(){const{slackChannels:e}=yield Mi((e=>e.connectivity));try{yield wi(iI.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ri(Cf.connectivity.getSlackScope);yield wi(iI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield wi(iI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*AI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Mi((e=>e.connectivity));try{yield wi(iI.setConnectivityState({isSaving:!0})),yield Ri(Cf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,$p(e))}const i=yield pI({payload:{api:"webhook"},type:""});i&&(yield wi(iI.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*bI({payload:e}){try{yield wi(iI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ri(Cf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield wi(iI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield wi(iI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield wi(iI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*TI({payload:e}){try{const{statusCode:t}=yield Ri(Cf.connectivity.postWebhookRetry,e);yield wi(iI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield wi(iI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*kI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Mi((e=>e.connectivity));try{yield wi(iI.setConnectivityState({webhookLogs:C({},o,{isLoading:!0})}));const i=yield Ri(Cf.connectivity.getWebhookLog,e,n,t);yield wi(iI.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},i)}))}catch(e){yield wi(iI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var EI={sagas:function*(){yield Oa(iI.loadDataAction,fI),yield _a(iI.loadSlackActions,gI),yield Oa(iI.postDataAction,vI),yield Oa(iI.postCodeAction,hI),yield Oa(iI.loadScope,mI),yield Oa(iI.deleteWebhookConfigAction,AI),yield Oa(iI.postWebhookTestAction,bI),yield Oa(iI.postWebhookRetryAction,TI),yield _a(iI.loadWebhookLogsAction,kI)},storeName:Ct,initialState:tI,reducer:nI,actions:iI};function II(){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 PI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>C({},n,{[e]:t(n[e],o)})}}function LI(e){return PI(e,((e,t)=>C({},e,{loading:t.payload})))}function OI(e){return PI(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const _I={loading:!1,error:null,fetching:!0,plans:[]},{actions:wI,reducer:CI,name:UI}=dt({name:"subscriptions/plans",initialState:_I,reducers:C({},II())}),RI=C({loadPlans:ct(`${UI}/loadPlans`)},wI),DI={loading:!1,error:null,fetching:!0,config:null},NI=C({},II()),{actions:MI,reducer:FI,name:GI}=dt({name:"subscriptions/config",initialState:DI,reducers:NI}),$I=C({loadPaymentConfiguration:ct(`${GI}/loadPaymentConfiguration`)},MI),xI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},VI=C({},II(),{setCancellationLoading:LI("cancellation"),setCancellationError:OI("cancellation"),setRenewalLoading:LI("renewal"),setRenewalError:OI("renewal")}),{reducer:BI,actions:jI,name:WI}=dt({name:"subscriptions/billing/subscription",initialState:xI,reducers:VI}),KI=C({load:ct(`${WI}/loadSubscription`),cancelSubscription:ct(`${WI}/cancelSubscription`),renewSubscription:ct(`${WI}/renewSubscription`)},jI),HI={loading:!1,error:null,fetching:!0},zI=C({},II()),{reducer:qI,actions:YI,name:JI}=dt({name:"subscriptions/billing/information",initialState:HI,reducers:zI}),QI=C({loadBillingInformation:ct(`${JI}/loadBillingInformation`),cancelSubscription:KI.cancelSubscription,renewSubscription:KI.renewSubscription},YI),XI={loading:!1,error:null,fetching:!0},ZI=C({},II(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:eP,actions:tP,name:nP}=dt({name:"subscriptions/billing/payment",initialState:XI,reducers:ZI}),oP=C({loadPaymentMethod:ct(`${nP}/loadPaymentMethod`),submitPaymentMethod:ct(`${nP}/submitPaymentMethod`),submitPaymentMethodError:ct(`${nP}/submitPaymentMethodError`),submitPaymentMethodSuccess:ct(`${nP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ct(`${nP}/updateBillingDetails`,(e=>({payload:e})))},tP),iP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},aP=C({},II(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:rP,actions:lP,name:sP}=dt({name:"subscriptions/billing/invoices",initialState:iP,reducers:aP}),cP=C({loadInvoices:ct(`${sP}/loadInvoices`),downloadInvoice:ct(`${sP}/downloadInvoice`,(e=>({payload:e})))},lP),uP={information:HI,invoices:iP,paymentMethod:XI,subscription:xI},dP={invoices:cP,information:QI,paymentMethod:oP,subscription:KI},yP=je({invoices:rP,information:qI,paymentMethod:eP,subscription:BI}),fP={fetching:!0,loading:!1,error:null,confirmed:!1},pP=C({},II()),{actions:gP,reducer:SP,name:vP}=dt({name:"subscriptions/checkout",initialState:fP,reducers:pP}),hP=C({loadCheckout:ct(`${vP}/loadCheckout`),resetCheckout:ct(`${vP}/resetCheckout`),submitCheckout:ct(`${vP}/submitCheckout`),confirmCheckout:ct(`${vP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ct(`${vP}/errorCheckout`,(e=>({payload:e})))},gP),mP={loading:!1,error:null,cardSetupIntentSecret:null},AP=C({},II()),{reducer:bP,actions:TP,name:kP}=dt({name:"subscriptions/stripe",initialState:mP,reducers:AP}),EP=C({loadCustomer:ct(`${kP}/loadCustomer`),createCardSetupIntentSecret:ct(`${kP}/createCardSetupIntentSecret`)},TP),IP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:PP,reducer:LP,name:OP}=dt({name:"subscriptions/vendorPublicConfig",initialState:IP,reducers:C({},II())}),_P=C({loadVendorPublicConfiguration:ct(`${OP}/loadVendorPublicConfiguration`)},PP),wP={config:DI,plans:_I,checkout:fP,billing:uP,stripe:mP,vendorPublicConfig:IP},CP={config:$I,billing:dP,plans:RI,checkout:hP,stripe:EP,vendorPublicConfig:_P},UP=je({config:FI,billing:yP,plans:CI,checkout:SP,stripe:bP,vendorPublicConfig:LP});let RP,DP,NP;function MP({policy:e}){return{policy:NP.AT_PERIOD_END}}function FP(e){switch(e){case Oy.ACTIVE:return DP.ACTIVE;case Oy.INCOMPLETE:return DP.INCOMPLETE;case Oy.CANCELED:return DP.CANCELED;case Oy.EXPIRED:return DP.EXPIRED;case Oy.TRIALING:return DP.TRIALING;default:return DP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(RP||(RP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(DP||(DP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(NP||(NP={}));const GP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Oy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},$P=[{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"}],xP=[{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:""}],VP=[{id:"id",externalId:"externalId",type:_y.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],BP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*jP(){yield Oa(KI.load,WP),yield Oa(KI.cancelSubscription,HP),yield Oa(KI.renewSubscription,zP)}function*WP(){const e=yield Mi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield XP(e)}function*KP(){yield wi(KI.setLoading(!0));try{const[e]=yield Ri(Cf.subscriptions.getManagedSubscriptions);yield wi(KI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield wi(KI.setError(e))}}function*HP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(KI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(KI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Oy.ACTIVE)try{yield wi(KI.setCancellationLoading(!0)),yield Ri(Cf.subscriptions.cancelManagedSubscription,t),yield KP(),yield wi(KI.setCancellationLoading(!1))}catch(e){yield wi(KI.setCancellationError($p(e)))}}function*zP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(KI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(KI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===wy.AT_PERIOD_END)try{yield wi(KI.setRenewalLoading(!0)),yield Ri(Cf.subscriptions.renewManagedSubscription,t),yield KP(),yield wi(KI.setRenewalLoading(!1))}catch(e){yield wi(KI.setCancellationError($p(e)))}}function*qP(){yield wi(KI.setLoading(!0)),yield Fi(500),yield wi(KI.setState({subscription:GP,fetching:!1,loading:!1,error:null}))}function*YP(){yield Oa(KI.load,qP)}function*JP(){yield Oa(QI.loadBillingInformation,QP)}function*QP(){yield function*(e){const t=yield Mi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Mi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield XP(n,!1):yield wi(QI.setError(t?"Not authorized":"Internal feature failure"))}()}function*XP(e,t){yield wi(QI.setLoading(!0));try{var n,o;const i=yield Ri(Cf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ri(Cf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ci([Ri(KP),Ri(Cf.subscriptions.getSubscriptionPlan,a)]),s=yield Mi((e=>e.subscriptions.billing.subscription.subscription||null))),yield wi(QI.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?DP.ACTIVE:FP(s.status),cancellation:s.cancellation&&MP(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 wi(QI.setError($p(e)))}}function*ZP(){yield function*(){var e,t;yield wi(QI.setLoading(!0)),yield Fi(500),yield wi(QI.setState({loading:!1,fetching:!1,summary:{subscriptionId:GP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Cy.Stripe,externallyManaged:!1,currentPlanId:$P[0].id,defaultPlanId:$P[0].id},plan:C({},$P[0],{price:null==(e=$P[0].price)?void 0:e.amount,currency:null==(t=$P[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*eL(){yield Oa(QI.loadBillingInformation,ZP)}function*tL(){yield Oa(oP.loadPaymentMethod,nL),yield Oa(oP.submitPaymentMethod,iL),yield Oa(oP.submitPaymentMethodError,aL),yield Oa(oP.submitPaymentMethodSuccess,rL),yield Oa(oP.updatePaymentMethodBillingDetails,oL)}function*nL(){yield wi(oP.setLoading(!0));try{const e=(yield Ri(Cf.subscriptions.getPaymentMethods))[0];yield wi(oP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield wi(oP.setError($p(e)))}}function*oL({payload:e}){yield wi(oP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ri(Cf.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},o)),yield Ri(nL),null==i||i(!0)}catch(e){yield wi(oP.setError($p(e))),null==i||i(!1)}yield wi(oP.setLoading(!1))}function*iL(){yield wi(oP.setLoading(!0))}function*aL({payload:e}){yield wi(oP.setError(e))}function*rL(){yield wi(oP.loadPaymentMethod())}function*lL(){yield wi(oP.setLoading(!0)),yield Fi(500);const e=VP[0];yield wi(oP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*sL(){yield Oa(oP.loadPaymentMethod,lL)}function*cL(){yield Oa(cP.loadInvoices,uL),yield Oa(cP.downloadInvoice,dL)}function*uL(){yield wi(cP.setLoading(!0));try{const e=(yield Ri(Cf.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 wi(cP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield wi(cP.setError($p(e)))}}function*dL({payload:e}){yield wi(cP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ri(Cf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield wi(cP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield wi(cP.setInvoiceDownloadState({loading:!1,error:$p(e,null)}))}}function*yL(){yield wi(cP.setLoading(!0)),yield Fi(500),yield wi(cP.setState({loading:!1,fetching:!1,invoices:xP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield wi(cP.setLoading(!1))}function*fL(){yield Oa(cP.loadInvoices,yL)}function*pL(){yield Ci([Ri(JP),Ri(tL),Ri(cL),Ri(jP)])}function*gL(){yield Ci([Ri(eL),Ri(sL),Ri(fL),Ri(YP)])}function*SL(){yield Oa(hP.loadCheckout,vL),yield Oa(hP.resetCheckout,hL),yield Oa(hP.submitCheckout,mL),yield Oa(hP.confirmCheckout,AL),yield Oa(hP.errorCheckout,TL)}function*vL(){yield wi(hP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*hL(){yield wi(hP.setState({loading:!1,error:null,confirmed:!1}))}function*mL(){yield wi(hP.setState({loading:!0,error:null}))}function*AL({payload:{paymentMethodId:e,planId:t}}){const n=yield Mi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Mi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Oy.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield wi(hP.setState({loading:!0,error:null})),i&&a)return yield bL(),void(yield wi(KI.setState({subscription:C({},n,{status:Oy.ACTIVE})})));try{yield Ri(Cf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ci([QP(),nL(),uL()]),yield bL()}catch(e){yield wi(hP.setState({loading:!1,error:$p(e)}))}}else yield wi(hP.setState({loading:!1,error:"Subscription not found"}))}function*bL(){yield wi(hP.setState({loading:!1,error:null,confirmed:!0}))}function*TL({payload:e}){yield wi(hP.setState({loading:!1,error:e}))}function*kL(){yield Oa(hP.resetCheckout,hL)}function*EL(){yield Oa(RI.loadPlans,IL)}function*IL(){yield wi(RI.setLoading(!0));try{const e=(yield Ri(Cf.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 wi(RI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield wi(RI.setError($p(e)))}}function*PL(){yield wi(RI.setLoading(!0)),yield Fi(500),yield wi(RI.setState({fetching:!1,loading:!1,plans:$P.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*LL(){yield Oa(RI.loadPlans,PL)}function*OL(){yield Oa($I.loadPaymentConfiguration,_L)}function*_L(){yield wi($I.setLoading(!0));try{(yield Ri(Cf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Cy.Stripe))?yield function*(){yield wi($I.setLoading(!0));try{const e=yield Ri(Cf.subscriptions.getStripePaymentProviderConfiguration);yield wi($I.setState({loading:!1,fetching:!1,config:{paymentProvider:RP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield wi($I.setError($p(e)))}}():yield wi($I.setError("Payment provider not configured"))}catch(e){yield wi($I.setError($p(e)))}}function*wL(){yield wi($I.setLoading(!0)),yield Fi(500),yield wi($I.setState({loading:!1,fetching:!1,config:{paymentProvider:RP.STRIPE,apiKey:""}}))}function*CL(){yield Oa($I.loadPaymentConfiguration,wL)}function*UL(){yield Oa(EP.createCardSetupIntentSecret,RL)}function*RL({payload:e}){yield wi(EP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ri(Cf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield wi(EP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield wi(EP.setError($p(e)))}}function*DL(){yield Oa(_P.loadVendorPublicConfiguration,NL)}function*NL(){yield wi(_P.setLoading(!0));try{const e=yield Ri(Cf.subscriptions.getVendorPublicConfigurations);yield wi(_P.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield wi(_P.setError($p(e)))}}function*ML(){yield wi(_P.setLoading(!0)),yield Fi(500),yield wi(_P.setState({fetching:!1,loading:!1,vendorPublicConfig:BP}))}function*FL(){yield Oa(_P.loadVendorPublicConfiguration,ML)}var GL={sagas:function*(){yield Ci([Ri(pL),Ri(SL),Ri(EL),Ri(OL),Ri(UL),Ri(DL)])},mockSagas:function*(){yield Ci([Ri(gL),Ri(kL),Ri(LL),Ri(CL),Ri(FL)])},reducer:UP,actions:CP,initialState:wP,storeName:"subscriptions"},$L={sagas:function*(){yield Oa(dS.loadVendorPublicInfo,yS)},storeName:Rt,initialState:sS,reducer:cS,actions:dS};const{reducer:xL}=dt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ca.setContext(t),C({},e,{context:t}))}}}),VL=(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||Ca.setContext(e.context);const t=ma(),l=[...lt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:l,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[uE.storeName]:C({},uE.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:C({},uE.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[ME.storeName]:C({},ME.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:C({},ME.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:C({},ME.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[GE]:C({},FE,null!=(h=null==i?void 0:i.audits)?h:{}),[EI.storeName]:EI.initialState,[GL.storeName]:GL.initialState,[$L.storeName]:$L.initialState},reducer:je({root:xL,[uE.storeName]:uE.reducer,[ME.storeName]:ME.reducer,[GE]:xE,[EI.storeName]:EI.reducer,[GL.storeName]:GL.reducer,[$L.storeName]:$L.reducer})});const m=function*(){yield Ci([Ri(uE.sagas),Ri(ME.sagas),Ri(QE),Ri(EI.sagas),Ri(GL.sagas),Ri($L.sagas)])},A=function*(){yield Ci([Ri(uE.mockSagas),Ri(ME.mockSagas),Ri(GL.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Ro.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},BL=(e,t)=>((()=>{if(!Ca.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 jL=n(714),WL=n.n(jL);function KL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function HL(e){if(e.type)return e;if("#"===e.charAt(0))return HL(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 zL(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 qL(e){if(0===e.indexOf("#"))return e;const{values:t}=HL(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 YL(e,t){return e=HL(e),t=KL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,zL(e)}function JL(e,t){if(e=HL(e),t=KL(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 zL(e)}function QL(e,t){if(e=HL(e),t=KL(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 zL(e)}const XL=e=>{if(e)return{main:e,light:qL(QL(e,.4)),dark:qL(JL(e,.15)),hover:qL(JL(e,.15)),active:qL(JL(e,.2))}},ZL=e=>{if(e)return{main:e,light:QL(e,.7),dark:JL(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({},XL(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({},XL(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({},XL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},ZL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},ZL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},ZL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},ZL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},tO={},nO={},oO={},iO={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"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}};class aO{constructor(){this._theme=tO,this._themeV2=nO,this._navigation=iO,this._localizations=oO}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new aO;return n.set(e),aO._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=WL().all([null!=(t=iO)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=WL().all([null!=(o=tO)?o:{},eO(null==e?void 0:e.theme,tO)]),this._themeV2=WL().all([null!=(i=nO)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=WL().all([null!=(r=oO)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=iO,this._theme=tO,this._themeV2=nO,this._localizations=oO}}}aO._instances={};var rO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},lO=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},sO=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)}))},cO=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 uO,dO,yO,fO,pO,gO,SO,vO,hO,mO,AO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(uO||(uO={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(dO||(dO={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(yO||(yO={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(fO||(fO={})),function(e){e.Invoices="invoices"}(pO||(pO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(gO||(gO={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(SO||(SO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(vO||(vO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(hO||(hO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(mO||(mO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(AO||(AO={}));const bO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},TO={hidden:"hidden",edit:"edit"};var kO="6.138.0",EO={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"},IO=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(kO),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=Ar,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:aO.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(N().mark((function e(){var t,n,o;return N().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=null==(t=i.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,i.options.builderMode||"nextjs"===i.options.framework||(i.options.hostedLoginBox&&!i.options.customLoginBox&&o?i.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):i.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2: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}Ol.set(EO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,_l();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Ol.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.setFeatureFlagsForPreview=function(e){Ol.set(C({},EO,e),i.name)},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=rO(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=VL({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),Ca.setAppName(l)}var t,n,o,i;return _(e,[{key:"setEntitlementsOptions",value:function(e){Ca.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;aO.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 Ca.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(),cO(t),Ca.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 BL(null==e||null==(n=e.features)?void 0:n[t],Il.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return BL(null==e||null==(n=e.permissions)?void 0:n[t],Il.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}(),PO=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?(Ca.setAccessToken(t),Ca.setUser(C({},n,{accessToken:t})),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Ro.loadTenants())):(Ca.setAccessToken(null),Ca.setUser(null),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),LO=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}(),OO=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}(),_O=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},wO=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=VL({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 IO(this.options,t,!0),aO.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,sO(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}(),CO="modern",UO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[CO]},RO=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=VL({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 IO(this.options,t,!0,a),aO.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,sO(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 DO(e,t){return DO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},DO(e,t)}function NO(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&&DO(e,t)}function MO(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 FO(e){return FO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},FO(e)}function GO(){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 $O(e,t,n){return $O=GO()?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&&DO(i,n.prototype),i},$O.apply(null,arguments)}function xO(e){var t="function"==typeof Map?new Map:void 0;return xO=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 $O(e,arguments,FO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),DO(n,e)},xO(e)}function VO(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=FO(e);if(t){var i=FO(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return MO(this,n)}}var BO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new IO(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){NO(n,e);var t=VO(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=lO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=lO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=lO(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=lO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=lO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=lO(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}(xO(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 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 DO},AdminPortalRenderer:function(){return FO},AppHolder:function(){return C},CheckoutDialog:function(){return NO},FronteggApp:function(){return UO},HostedLogin:function(){return RO},LoginBoxRenderer:function(){return xO},createElement:function(){return pO},defaultTheme:function(){return GO},formatName:function(){return fO},getThemeAdminByName:function(){return MO},getThemeByName:function(){return $O},initialize:function(){return YO},mockFlagsList:function(){return CO},restoreSearchParams:function(){return SO},waitThemeSetter:function(){return gO}});var e={};n.r(e),n.d(e,{Delete:function(){return Pr},Get:function(){return Tr},Patch:function(){return Er},Post:function(){return kr},PostDownload:function(){return Lr},Put:function(){return Ir},extractHeadersFromOptions:function(){return Or},getBaseUrl:function(){return mr},getMetadataHeaders:function(){return Ar}});var t={};n.r(t),n.d(t,{getHierarchyMetadata:function(){return Fr},getParentTenants:function(){return Rr},getParentTenantsById:function(){return Dr},getSubTenants:function(){return Cr},getSubTenantsAsTree:function(){return Ur},getTenants:function(){return wr},getTenantsUsersCount:function(){return Nr},searchSubTenants:function(){return Mr},switchTenant:function(){return _r}});var i={};n.r(i),n.d(i,{GetUserJwt:function(){return vl},getCurrentUserTenantsV3:function(){return Tl},getUsersGroups:function(){return bl},getUsersRoles:function(){return Al},getUsersV2:function(){return hl},getUsersV3:function(){return ml},sendResetBreachedPasswordEmails:function(){return kl},updateUserProfileV2:function(){return El}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return Il}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return _l},loadFeatureFlags:function(){return wl}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return ko},MachineToMachineAuthStrategy:function(){return Eo},OAuthLogout:function(){return as},SocialLoginProviders:function(){return To},acceptInvitation:function(){return es},activateAccount:function(){return Yl},activateAccountV2:function(){return Jl},bulkCreateIPRestriction:function(){return il},changePhoneNumber:function(){return su},changePhoneNumberWithVerification:function(){return ru},checkIfAllowToRememberMfaDevice:function(){return wc},createDomainRestriction:function(){return Xr},createIPRestriction:function(){return ol},createOrUpdateSessionConfigrations:function(){return pc},createSSOConfiguration:function(){return Mc},createSSOConfigurationByMetadata:function(){return $c},createSSOConfigurationByMetadataUrl:function(){return Vc},createSSODomain:function(){return jc},createSSOGroup:function(){return qc},createSamlGroup:function(){return Xs},createTenantAccessToken:function(){return Tc},createUserAccessToken:function(){return bc},deleteAllSessionsForUser:function(){return Sc},deleteDomainRestriction:function(){return el},deleteIPRestriction:function(){return rl},deleteSSOConfiguration:function(){return Gc},deleteSSODomain:function(){return Wc},deleteSSOGroup:function(){return Jc},deleteSamlGroup:function(){return ec},deleteSessionForUser:function(){return gc},deleteTenantAccessToken:function(){return mc},deleteTenantApiToken:function(){return Lc},deleteUserAccessToken:function(){return Ac},deleteUserApiToken:function(){return Oc},deleteWebAuthnDevice:function(){return pu},disableMFAAuthenticatorApp:function(){return ms},disableMFASMS:function(){return bs},disableMFAWebAuthn:function(){return ks},disableMfa:function(){return hs},enrollMFAAuthenticatorApp:function(){return ys},enrollMFAAuthenticatorAppForLogin:function(){return Ps},enrollMFAAuthenticatorAppForLoginV2:function(){return Ls},enrollMFASMS:function(){return ps},enrollMFASMSForLogin:function(){return Rs},enrollMFASMSForLoginV2:function(){return Ds},enrollMFAWebAuthn:function(){return Ss},enrollMFAWebAuthnForLogin:function(){return $s},enrollMFAWebAuthnForLoginV2:function(){return xs},enrollMfa:function(){return us},exchangeOAuthTokens:function(){return nu},exchangeOAuthTokensV2:function(){return eu},forgotPassword:function(){return rs},generateLoginResponse:function(){return Dl},generateLoginResponseFromOAuthResponse:function(){return $l},generateLoginResponseFromOAuthResponseV2:function(){return xl},generateLoginResponseV2:function(){return Nl},generateLoginResponseV3:function(){return Gl},getActivateAccountStrategy:function(){return Ql},getCaptchaPolicy:function(){return Kr},getCurrentUserSession:function(){return dc},getCurrentUserSessions:function(){return uc},getCustomSocialLoginProvidersV1:function(){return rc},getDomainRestrictions:function(){return Jr},getDomainRestrictionsConfig:function(){return Qr},getGlobalSecurityPolicy:function(){return Gr},getIPRestrictions:function(){return tl},getIPRestrictionsConfig:function(){return nl},getLockoutPolicy:function(){return Br},getMFADevices:function(){return Es},getMFAStrategiesConfig:function(){return hu},getMeAndEntitlements:function(){return bu},getMeV2:function(){return Au},getMfaPolicy:function(){return $r},getOidcConfiguration:function(){return tc},getPasswordConfigPolicy:function(){return Yr},getPasswordHistoryPolicy:function(){return Hr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return vu},getSSOConfigurations:function(){return Nc},getSSODefaultRoles:function(){return Hc},getSSOGroups:function(){return Qc},getSSOPublicConfiguration:function(){return nc},getSamlConfiguration:function(){return Ws},getSamlRoles:function(){return Ys},getSamlRolesGroups:function(){return Js},getSamlVendorConfiguration:function(){return Hs},getSessionConfigurations:function(){return fc},getSocialLoginProviders:function(){return oc},getSocialLoginProvidersV2:function(){return ic},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return ac},getTenantAccessTokensData:function(){return hc},getTenantApiTokensData:function(){return Ec},getUserAccessTokensData:function(){return vc},getUserApiTokensData:function(){return kc},getUserAuthorization:function(){return mu},getUserById:function(){return _c},getVendorConfig:function(){return sc},getVendorLockoutPolicy:function(){return jr},getVendorMfaPolicy:function(){return xr},getVendorPasswordHistoryPolicy:function(){return zr},getVendorPublicAuthStrategiesConfig:function(){return Su},getWebAuthnDevices:function(){return fu},loadPasswordConfig:function(){return ss},login:function(){return Kl},loginViaSocialLogin:function(){return lc},loginWithMfa:function(){return zl},loginWithMfaV2:function(){return ql},loginv2:function(){return Hl},logout:function(){return is},oidcPostLogin:function(){return Wl},oidcPostLoginV2:function(){return Zc},passwordlessPostLogin:function(){return Rc},passwordlessPostLoginV2:function(){return Uc},passwordlessPreLogin:function(){return Cc},postLogin:function(){return jl},preDisableMFASMS:function(){return As},preDisableMFAWebAuthn:function(){return Ts},preEnrollMFAAuthenticatorApp:function(){return ds},preEnrollMFAAuthenticatorAppForLogin:function(){return Is},preEnrollMFASMS:function(){return fs},preEnrollMFASMSForLogin:function(){return Us},preEnrollMFAWebAuthn:function(){return gs},preEnrollMFAWebAuthnForLogin:function(){return Gs},preLogin:function(){return Vl},preLoginV2:function(){return Xc},preLoginWithIdpType:function(){return Bl},preVerifyMFAEmailCode:function(){return _s},preVerifyMFASMSForLogin:function(){return Ns},preVerifyMFAWebAuthnForLogin:function(){return Vs},recoverMfaToken:function(){return cs},refreshToken:function(){return ts},refreshTokenV2:function(){return ns},refreshTokenV3:function(){return os},resendActivationEmail:function(){return Xl},resendInvitationEmail:function(){return Zl},resetPassword:function(){return ls},resetPhoneNumber:function(){return iu},revokeSessionsForUser:function(){return yc},saveLockoutPolicy:function(){return Wr},saveMfaPolicy:function(){return Vr},savePasswordHistoryPolicy:function(){return qr},setSSODefaultRoles:function(){return zc},signUpUser:function(){return cc},silentOAuthRefreshToken:function(){return ou},silentOAuthRefreshTokenV2:function(){return tu},testCurrentIp:function(){return ll},testCurrentIpInAllowList:function(){return sl},updateDomainRestrictionConfig:function(){return Zr},updateIPRestrictionConfig:function(){return al},updateSSOConfiguration:function(){return Fc},updateSSOConfigurationByMetadata:function(){return xc},updateSSOConfigurationByMetadataUrl:function(){return Bc},updateSSOGroup:function(){return Yc},updateSamlConfiguration:function(){return Ks},updateSamlGroup:function(){return Zs},updateSamlRoles:function(){return Qs},updateSamlVendorMetadata:function(){return zs},updateTenantApiTokensData:function(){return Pc},updateUserApiTokensData:function(){return Ic},validateSSODomain:function(){return Kc},validateSamlDomain:function(){return qs},verifyChangePhoneNumber:function(){return lu},verifyInviteToken:function(){return Dc},verifyMFAAuthenticatorAppForLogin:function(){return Os},verifyMFAEmailCode:function(){return ws},verifyMFAEmailCodeV2:function(){return Cs},verifyMFASMSForLogin:function(){return Ms},verifyMFASMSForLoginV2:function(){return Fs},verifyMFAWebAuthnForLogin:function(){return Bs},verifyMFAWebAuthnForLoginV2:function(){return js},verifyMfa:function(){return vs},verifyNewDeviceSession:function(){return gu},verifyResetPhoneNumber:function(){return au},webAuthnCreateNewDeviceSession:function(){return yu},webAuthnPostLogin:function(){return uu},webAuthnPostLoginV2:function(){return du},webAuthnPreLogin:function(){return cu}});var s={};n.r(s),n.d(s,{addUser:function(){return Lu},changePassword:function(){return Iu},createInviteUserLink:function(){return wu},deleteInviteUserLink:function(){return Uu},deleteUser:function(){return Ou},getInviteLinkConfiguration:function(){return Du},getInviteUserLink:function(){return Ru},getProfile:function(){return Tu},loadAvailablePermissions:function(){return Mu},loadAvailableRoles:function(){return Nu},loadStats:function(){return Fu},loadUsers:function(){return Pu},resendActivationLink:function(){return Gu},resendInvitationLink:function(){return $u},resendInvitationLinkToAllTenants:function(){return xu},updateInviteUserLink:function(){return Cu},updateProfile:function(){return ku},updateProfileImage:function(){return Eu},updateUser:function(){return _u}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return Bu},getAuditsMetadata:function(){return zu},getCurrentUserIpMetadata:function(){return Wu},getIpAdressMetadata:function(){return qu},getNotificationsMetadata:function(){return Ku},getSamlMetadata:function(){return Hu},updateAdminBoxMetadata:function(){return ju}});var u={};n.r(u),n.d(u,{downloadReport:function(){return nd},getReport:function(){return Zu},getReports:function(){return Xu},renderReport:function(){return ed},scheduleReport:function(){return td},sendReport:function(){return od}});var d={};n.r(d),n.d(d,{getNotifications:function(){return id},markAllAsRead:function(){return ld},updateNotificationIsPinned:function(){return rd},updateNotificationStatus:function(){return ad}});var y={};n.r(y),n.d(y,{exportAudits:function(){return dd},getAudits:function(){return cd},getAuditsStats:function(){return ud}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Id},deleteEmailSubscriptions:function(){return kd},deleteSMSConfiguration:function(){return Cd},deleteSMSSubscriptions:function(){return _d},deleteSlackConfiguration:function(){return hd},deleteWebhooksConfiguration:function(){return Dd},getCategories:function(){return Gd},getChannelMaps:function(){return $d},getEmailConfiguration:function(){return Ad},getSMSConfiguration:function(){return Pd},getSlackChannels:function(){return Sd},getSlackConfiguration:function(){return pd},getSlackScope:function(){return gd},getWebhookLog:function(){return Nd},getWebhooksConfigurations:function(){return Ud},patchEmailConfiguration:function(){return Td},patchSMSConfiguration:function(){return Od},postEmailConfiguration:function(){return bd},postSMSConfiguration:function(){return Ld},postSlackCode:function(){return md},postSlackConfiguration:function(){return vd},postWebhookRetry:function(){return Fd},postWebhookTest:function(){return Md},postWebhooksConfiguration:function(){return Rd},putEmailSubscriptions:function(){return Ed},putSMSSubscriptions:function(){return wd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return Bd},getSettings:function(){return Vd},updateSettings:function(){return xd}});var g={};n.r(g),n.d(g,{addRole:function(){return zd},attachPermissionToRoles:function(){return Xd},attachPermissionsToRole:function(){return Jd},deleteRole:function(){return qd},getPermissionCategories:function(){return Zd},getPermissions:function(){return Qd},getRoles:function(){return Hd},updateRole:function(){return Yd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Cy},ISubscriptionStatus:function(){return _y},PaymentMethodType:function(){return wy},ProviderType:function(){return Uy},TenantCreatedAction:function(){return Dy},TrialEndAction:function(){return Ry},cancelManagedSubscription:function(){return ly},cancelSubscription:function(){return ny},createStripeCustomer:function(){return by},createStripePaymentMethodSetupIntentSecret:function(){return ky},createSubscription:function(){return my},createTenantConfiguration:function(){return Py},getManagedSubscription:function(){return ay},getManagedSubscriptions:function(){return ry},getPaymentMethod:function(){return vy},getPaymentMethods:function(){return Sy},getPaymentProviders:function(){return Ly},getStripeCustomer:function(){return Ay},getStripePaymentProviderConfiguration:function(){return Ty},getSubscription:function(){return ty},getSubscriptionInvoice:function(){return fy},getSubscriptionInvoicePdf:function(){return py},getSubscriptionInvoices:function(){return yy},getSubscriptionPlan:function(){return dy},getSubscriptionPlans:function(){return uy},getSubscriptionSummaries:function(){return Ey},getSubscriptions:function(){return ey},getTenantConfiguration:function(){return Iy},getVendorPublicConfigurations:function(){return Oy},renewManagedSubscription:function(){return sy},renewSubscription:function(){return oy},updateManagedSubscription:function(){return cy},updatePaymentMethodBillingDetails:function(){return hy},updateSubscription:function(){return iy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Ny}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return $y},addUserToTenantAndSubTenants:function(){return Fy},addUsersToSubTenant:function(){return Hy},createSubTenant:function(){return By},deleteSubTenant:function(){return jy},loadAllUsers:function(){return My},removeUserFromTenantAndSubTenants:function(){return Gy},removeUserRolesFromSubTenants:function(){return xy},setUserRolesForSubTenants:function(){return Vy},updateSubAccountAccess:function(){return Ky},updateSubTenant:function(){return Wy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Qy},createConfiguration:function(){return Yy},deleteConfiguration:function(){return Jy},getConfigs:function(){return zy},updateConfiguration:function(){return qy}});var A={};n.r(A),n.d(A,{impersonate:function(){return Xy}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return lf},addUsersToGroup:function(){return cf},createGroup:function(){return of},deleteGroup:function(){return rf},deleteRolesFromGroup:function(){return sf},deleteUsersFromGroup:function(){return uf},getGroupById:function(){return ef},getGroupConfiguration:function(){return df},getGroups:function(){return tf},getGroupsByIds:function(){return nf},updateGroup:function(){return af},updateGroupConfiguration:function(){return yf}});var T={};n.r(T),n.d(T,{getInsights:function(){return pf},getRecommendations:function(){return ff}});var k={};n.r(k),n.d(k,{createPhoneNumber:function(){return Sf},deletePhoneNumber:function(){return hf},getUserPhoneNumbers:function(){return gf},updatePhoneNumber:function(){return vf},verifyDeletePhoneNumber:function(){return Af},verifyPhoneNumber:function(){return mf}});var E={};n.r(E),n.d(E,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Ll},AuthStrategyEnum:function(){return ko},ContextHolder:function(){return Ua},FeatureFlags:function(){return _l},FronteggApiError:function(){return Da},FronteggContext:function(){return Ra},FronteggFrameworks:function(){return so},GetUsersFilterPreset:function(){return yo},GroupManagedByEnum:function(){return Uf},GroupRelations:function(){return Cf},ISubscriptionCancellationPolicy:function(){return Cy},ISubscriptionStatus:function(){return _y},InsightCode:function(){return Df},LOAD_AUTHORIZATION_FF:function(){return Sl},MFAStrategyEnum:function(){return gl},MachineToMachineAuthStrategy:function(){return Eo},NotEntitledJustification:function(){return Pl},PaginationOrderEnum:function(){return co},PaymentMethodType:function(){return wy},ProviderType:function(){return Uy},RecommendationActionKey:function(){return Nf},RecommendationCode:function(){return Rf},RecommendationSeverity:function(){return Mf},RequestSource:function(){return lo},RestrictionType:function(){return Bn},ScimConnectionSource:function(){return wf},SecondaryAuthStrategy:function(){return fl},SecurityCategory:function(){return Ff},SocialLoginProviders:function(){return To},SortByEnum:function(){return uo},TenantSortByEnum:function(){return Tf},TenantType:function(){return kf},UserManagedByEnum:function(){return bf},WebAuthnDeviceType:function(){return pl},api:function(){return Gf},countConfigurationUsers:function(){return Qy},createConfiguration:function(){return Yy},default:function(){return $f},deleteConfiguration:function(){return Jy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Ef},fronteggHeaders:function(){return ro},fronteggRefreshTokenUrl:function(){return If},fronteggSilentRefreshTokenUrl:function(){return Pf},fronteggTenantsUrl:function(){return Of},fronteggTenantsV3Url:function(){return _f},fronteggUsersUrl:function(){return Lf},getConfigs:function(){return zy},loadFeatureFlags:function(){return wl},providersArray:function(){return fo},updateConfiguration:function(){return qy}});var I={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e){return L="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},L(e)}function O(e){var t=function(e,t){if("object"!==L(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==L(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===L(t)?t:String(t)}function _(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 w(e,t,n){return t&&_(e.prototype,t),n&&_(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(I),n.d(I,{AccountDetailsPageTabs:function(){return LO},AccountPageFields:function(){return AO},DomainRestrictionsTabFields:function(){return PO},GeneralSettingsTabFields:function(){return EO},InviteUserModalFields:function(){return mO},IpRestrictionsTabFields:function(){return IO},Metadata:function(){return yO},PrivacyPageFields:function(){return hO},ProfilePageFields:function(){return vO},SecurityPageTabs:function(){return TO},SessionManagementTabFields:function(){return kO},SubscriptionsPageFields:function(){return bO},alpha:function(){return nO},fieldAppearance:function(){return OO},tabAppearance:function(){return _O}});var C=function(){function e(){P(this,e)}return w(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 U(){return U=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},U.apply(this,arguments)}function R(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 D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){R(a,o,i,r,l,"next",e)}function l(e){R(a,o,i,r,l,"throw",e)}r(void 0)}))}}C._apps={};var N=n(841),M=n.n(N);function F(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 G(e){return!!e&&!!e[Ee]}function $(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)===Ie}(e)||Array.isArray(e)||!!e[ke]||!!e.constructor[ke]||K(e)||H(e))}function x(e,t,n){void 0===n&&(n=!1),0===V(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function V(e){var t=e[Ee];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:K(e)?2:H(e)?3:0}function B(e,t){return 2===V(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=V(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function W(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function K(e){return me&&e instanceof Map}function H(e){return Ae&&e instanceof Set}function z(e){return e.o||e.t}function q(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ee];for(var n=Pe(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 Y(e,t){return void 0===t&&(t=!1),Q(e)||G(e)||!$(e)||(V(e)>1&&(e.set=e.add=e.clear=e.delete=J),Object.freeze(e),t&&x(e,(function(e,t){return Y(t,!0)}),!0)),e}function J(){F(2)}function Q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function X(e){var t=Oe[e];return t||F(18,e),t}function Z(){return ve}function ee(e,t){t&&(X("Patches"),e.u=[],e.s=[],e.v=t)}function te(e){ne(e),e.p.forEach(ie),e.p=null}function ne(e){e===ve&&(ve=e.l)}function oe(e){return ve={p:[],l:ve,h:e,m:!0,_:0}}function ie(e){var t=e[Ee];0===t.i||1===t.i?t.j():t.O=!0}function ae(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||X("ES5").S(t,e,o),o?(n[Ee].P&&(te(t),F(4)),$(e)&&(e=re(t,e),t.l||se(t,e)),t.u&&X("Patches").M(n[Ee].t,e,t.u,t.s)):e=re(t,n,[]),te(t),t.u&&t.v(t.u,t.s),e!==Te?e:void 0}function re(e,t,n){if(Q(t))return t;var o=t[Ee];if(!o)return x(t,(function(i,a){return le(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return se(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=q(o.k):o.o;x(3===o.i?new Set(i):i,(function(t,a){return le(e,o,i,t,a,n)})),se(e,i,!1),n&&e.u&&X("Patches").R(o,n,e.u,e.s)}return o.o}function le(e,t,n,o,i,a){if(G(i)){var r=re(e,i,a&&t&&3!==t.i&&!B(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!G(r))return;e.m=!1}if($(i)&&!Q(i)){if(!e.h.F&&e._<1)return;re(e,i),t&&t.A.l||se(e,i)}}function se(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Y(t,n)}function ce(e,t){var n=e[Ee];return(n?z(n):e)[t]}function ue(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 de(e){e.P||(e.P=!0,e.l&&de(e.l))}function ye(e){e.o||(e.o=q(e.t))}function fe(e,t,n){var o=K(t)?X("MapSet").N(t,n):H(t)?X("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:Z(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=_e;n&&(i=[o],a=we);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):X("ES5").J(t,n);return(n?n.A:Z()).p.push(o),o}function pe(e){return G(e)||F(22,e),function e(t){if(!$(t))return t;var n,o=t[Ee],i=V(t);if(o){if(!o.P&&(o.i<4||!X("ES5").K(o)))return o.t;o.I=!0,n=ge(t,i),o.I=!1}else n=ge(t,i);return x(n,(function(t,i){o&&function(e,t){return 2===V(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function ge(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return q(e)}var Se,ve,he="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),me="undefined"!=typeof Map,Ae="undefined"!=typeof Set,be="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Te=he?Symbol.for("immer-nothing"):((Se={})["immer-nothing"]=!0,Se),ke=he?Symbol.for("immer-draftable"):"__$immer_draftable",Ee=he?Symbol.for("immer-state"):"__$immer_state",Ie=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Oe={},_e={get:function(e,t){if(t===Ee)return e;var n=z(e);if(!B(n,t))return function(e,t,n){var o,i=ue(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||!$(o)?o:o===ce(e.t,t)?(ye(e),e.o[t]=fe(e.A.h,o,e)):o},has:function(e,t){return t in z(e)},ownKeys:function(e){return Reflect.ownKeys(z(e))},set:function(e,t,n){var o=ue(z(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ce(z(e),t),a=null==i?void 0:i[Ee];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(W(n,i)&&(void 0!==n||B(e.t,t)))return!0;ye(e),de(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!==ce(e.t,t)||t in e.t?(e.D[t]=!1,ye(e),de(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=z(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(){F(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){F(12)}},we={};x(_e,(function(e,t){we[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),we.deleteProperty=function(e,t){return we.set.call(this,e,t,void 0)},we.set=function(e,t,n){return _e.set.call(this,e[0],t,n,e[0])};var Ce=function(){function e(e){var t=this;this.g=be,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&&F(6),void 0!==o&&"function"!=typeof o&&F(7),$(e)){var l=oe(t),s=fe(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?te(l):ne(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ee(l,o),ae(e,l)}),(function(e){throw te(l),e})):(ee(l,o),ae(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Te&&(r=void 0),t.F&&Y(r,!0),o){var u=[],d=[];X("Patches").M(e,r,u,d),o(u,d)}return r}F(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){$(e)||F(8),G(e)&&(e=pe(e));var t=oe(this),n=fe(this,e,void 0);return n[Ee].C=!0,ne(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ee]).A;return ee(n,t),ae(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!be&&F(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=X("Patches").$;return G(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new Ce,Re=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Re);function Ne(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 Me(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 Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){Ne(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(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 $e="function"==typeof Symbol&&Symbol.observable||"@@observable",xe=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ve={INIT:"@@redux/INIT"+xe(),REPLACE:"@@redux/REPLACE"+xe(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+xe()}};function Be(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(Ge(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ge(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Ge(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(Ge(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ge(4));if(s)throw new Error(Ge(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Ge(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Be(e))throw new Error(Ge(7));if(void 0===e.type)throw new Error(Ge(8));if(s)throw new Error(Ge(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(Ge(10));i=e,y({type:Ve.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ge(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[$e]=function(){return this},e}return y({type:Ve.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[$e]=p,o}function We(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:Ve.INIT}))throw new Error(Ge(12));if(void 0===n(void 0,{type:Ve.PROBE_UNKNOWN_ACTION()}))throw new Error(Ge(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(Ge(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ke(){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 He(){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(Ge(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ke.apply(void 0,a)(n.dispatch),Fe(Fe({},n),{},{dispatch:o})}}}function ze(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 qe=ze();qe.withExtraArgument=ze;var Ye,Je=qe,Qe=(Ye=function(e,t){return Ye=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])},Ye(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}Ye(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Xe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Ze=Object.defineProperty,et=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),tt=Object.prototype.hasOwnProperty,nt=Object.prototype.propertyIsEnumerable,ot=function(e,t,n){return t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},it=function(e,t){for(var n in t||(t={}))tt.call(t,n)&&ot(e,n,t[n]);if(et)for(var o=0,i=et(t);o<i.length;o++)n=i[o],nt.call(t,n)&&ot(e,n,t[n]);return e},at="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ke:Ke.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var rt=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 Qe(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,Xe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Xe([void 0],e.concat(this))))},t}(Array);function lt(e){return $(e)?De(e,(function(){})):e}function st(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new rt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Je):o.push(Je.withExtraArgument(n.extraArgument))),o}function ct(e){var t,n=function(e){return st(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=We(a)}var p=l;"function"==typeof p&&(p=p(n));var g=He.apply(void 0,p),S=Ke;c&&(S=at(it({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Xe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ut(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 it(it({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 dt(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 yt(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:lt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?dt(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=it(it({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?dt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return lt(e())};else{var c=lt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Xe([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(G(e))return void 0===(o=n(e,t))?e:o;if($(e))return De(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?ut(c,o):ut(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 ft="listenerMiddleware";ut(ft+"/add"),ut(ft+"/removeAll"),ut(ft+"/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[Ee];return _e.get(t,e)},set:function(t){var n=this[Ee];_e.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][Ee];if(!i.P)switch(i.i){case 5:o(i)&&de(i);break;case 4:n(i)&&de(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==Ee){var r=t[a];if(void 0===r&&!B(t,a))return!0;var l=n[a],s=l&&l[Ee];if(s?s.t!==r:!W(l,r))return!0}}var c=!!t[Ee];return o.length!==Pe(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=Le(n);delete a[Ee];for(var r=Pe(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:Z(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Ee,{value:a,writable:!0}),i},S:function(e,n,i){i?G(n)&&n[Ee].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ee];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)x(a,(function(t){t!==Ee&&(void 0!==i[t]||B(i,t)?r[t]||e(a[t]):(r[t]=!0,de(n)))})),x(i,(function(e){void 0!==a[e]||B(a,e)||(r[e]=!1,de(n))}));else if(5===l){if(o(n)&&(de(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 pt=(e,t)=>n=>U({},n,{[e]:t[e]}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),St=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),ht=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),mt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),At=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},bt=(e=500)=>new Promise((t=>setTimeout(t,e))),Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",kt=new Uint8Array(256);for(let e=0;e<Tt.length;e++)kt[Tt.charCodeAt(e)]=e;const Et=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=kt[e.charCodeAt(o)],a=kt[e.charCodeAt(o+1)],r=kt[e.charCodeAt(o+2)],l=kt[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},It=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(It(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+=Tt[t[o]>>2],i+=Tt[(3&t[o])<<4|t[o+1]>>4],i+=Tt[(15&t[o+1])<<2|t[o+2]>>6],i+=Tt[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]=It(e[n]);return t}return e};let Pt,Lt,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"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ot||(Ot={}));const _t="FRONTEGG_AFTER_AUTH_REDIRECT_URL",wt="HOSTED_LOGIN_VERIFIER_KEY",Ct="auth",Ut="connectivity",Rt="auditLogs",Dt="vendor",Nt={flow:Lt.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Mt={setLoginState:gt("loginState"),resetLoginState:pt("loginState",{loginState:Nt})},Ft={requestAuthorize:ut("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ut("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ut("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:ut("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:ut("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ut("auth/afterAuthNavigation"),preLogin:ut("auth/preLogin",(e=>({payload:e}))),postLogin:ut("auth/postLogin",(e=>({payload:e}))),login:ut("auth/login",(e=>({payload:e}))),loginWithMfa:ut("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ut("auth/recoverMfa",(e=>({payload:e}))),logout:ut("auth/logout",(e=>({payload:e}))),silentLogout:ut("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ut("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ut("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ut("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ut("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ut("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ut("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ut("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ut("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ut("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ut("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ut("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ut("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ut("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ut("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ut("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ut("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ut("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ut("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ut("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ut("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ut("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ut("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ut("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ut("auth/resetBreachedPassword",(e=>({payload:e})))};let Gt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Gt||(Gt={}));const $t={step:Gt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},xt={setActivateState:gt("activateState"),resetActivateState:pt("activateState",{activateState:$t}),setActivateStrategyState:St("activateState","activationStrategy")},Vt={activateAccount:ut("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ut("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ut("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ut("auth/resendActivationEmail",(e=>({payload:e})))};let Bt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Bt||(Bt={}));const jt={step:Bt.validate},Wt={setAcceptInvitationState:gt("acceptInvitationState"),resetAcceptInvitationState:pt("acceptInvitationState",{acceptInvitationState:jt})},Kt={acceptInvitation:ut("auth/acceptInvitation",(e=>({payload:e})))};let Ht;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Ht||(Ht={}));const zt={step:Ht.forgotPassword,loading:!1,email:"",passwordConfig:null},qt={setForgotPasswordState:gt("forgotPasswordState"),resetForgotPasswordState:pt("forgotPasswordState",{forgotPasswordState:zt})},Yt={forgotPassword:ut("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ut("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ut("auth/loadPasswordConfig",(e=>({payload:e})))};let Jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Jt||(Jt={}));const Qt={step:Jt.ResetPhoneNumber,loading:!1},Xt={setResetPhoneNumberState:gt("resetPhoneNumberState"),resetResetPhoneNumberState:pt("resetPhoneNumberState",{resetPhoneNumberState:Qt})},Zt={resetPhoneNumber:ut("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ut("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ut("auth/changePhoneNumber",(e=>({payload:e})))},en={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},tn={setSSOLoader:vt("ssoState"),setSSOError:ht("ssoState"),setSSOState:gt("ssoState"),resetSSOState:pt("ssoState",{ssoState:en})},nn={loadSSOConfigurationsV2:ut("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ut("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ut("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ut("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ut("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ut("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ut("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ut("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ut("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ut("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ut("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ut("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ut("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ut("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ut("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ut("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ut("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ut("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ut("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ut("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ut("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ut("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ut("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ut("auth/oidcPostlogin",(e=>({payload:e})))},on={loading:!1,error:null},an={setProfileState:gt("profileState"),resetProfileState:pt("profileState",{profileState:on})},rn={loadProfile:ut("auth/loadProfile"),saveProfile:ut("auth/saveProfile",(e=>({payload:e}))),changePassword:ut("auth/changePassword",(e=>({payload:e})))};let ln;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(ln||(ln={}));const sn={step:ln.verify,loading:!1,saving:!1},cn={setMfaState:gt("mfaState"),resetMfaState:pt("mfaState",{mfaState:sn})},un={enrollMfa:ut("auth/enrollMfa"),getMFADevices:ut("auth/getMFADevices"),getMFAStrategies:ut("auth/getMFAStrategies"),verifyMfa:ut("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ut("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ut("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ut("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ut("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ut("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ut("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ut("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ut("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ut("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ut("auth/disableMfaWebAuthn",(e=>({payload:e})))},dn={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}},yn={setTeamLoader:vt("teamState"),setTeamError:ht("teamState"),setTeamState:gt("teamState"),resetTeamState:pt("teamState",{teamState:dn})},fn={loadUsersV2:ut("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ut("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ut("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ut("auth/loadRoles",(e=>({payload:e}))),addUser:ut("auth/addUser",(e=>({payload:e}))),addUsersBulk:ut("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ut("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ut("auth/updateUser",(e=>({payload:e}))),deleteUser:ut("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ut("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ut("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ut("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ut("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ut("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ut("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ut("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ut("auth/getInvitationLink"),createInvitationLink:ut("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ut("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ut("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ut("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ut("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ut("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ut("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ut("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ut("auth/closeLockUserDialog",(e=>({payload:e})))},pn={firstLoad:!0,loading:!1,error:""},gn={setSocialLoginsState:gt("socialLoginState"),resetSocialLoginsState:pt("socialLoginState",{socialLoginState:pn})},Sn={loadSocialLoginsConfiguration:ut("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ut("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ut("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ut("auth/setSocialLoginError",(e=>({payload:e})))};let vn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(vn||(vn={}));const hn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:vn.SignUp},mn={setSignUpState:gt("signUpState"),resetSignUpState:pt("signUpState",{signUpState:hn})},An={signUpUser:ut("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ut("auth/resetSignUpStateSoft")},bn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},Tn={setApiTokensLoader:vt("apiTokensState"),setApiTokensError:ht("apiTokensState"),setApiTokensState:gt("apiTokensState"),resetApiTokensState:pt("apiTokensState",{apiTokensState:bn})},kn={loadApiTokens:ut("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ut("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ut("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ut("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ut("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ut("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ut("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ut("auth/deleteTenantApiToken",(e=>({payload:e})))},En={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}},In={setSecurityPolicyState:gt("securityPolicyState"),setSecurityPolicyGlobalState:St("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:St("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:St("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:St("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:St("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:St("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:St("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:St("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:St("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:St("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:St("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:pt("securityPolicyState",{securityPolicyState:En})},Pn={loadSecurityPolicy:ut("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ut("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ut("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ut("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ut("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ut("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ut("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ut("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ut("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ut("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ut("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ut("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ut("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ut("auth/loadPublicAuthStrategiesPolicy")},Ln={loading:!1},On={setAccountSettingsState:gt("accountSettingsState"),resetAccountSettingsState:pt("accountSettingsState",{accountSettingsState:Ln})},_n={loadAccountSettings:ut("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ut("auth/saveAccountSettings",(e=>({payload:e})))},wn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Cn={setTenantsState:gt("tenantsState"),resetTenantsState:pt("tenantsState",{tenantsState:wn})},Un={switchTenant:ut("auth/switchTenant",(e=>({payload:e}))),loadTenants:ut("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ut("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ut("auth/loadSubTenantsTree",(e=>({payload:e})))},Rn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:gt("rolesState"),resetRolesState:pt("rolesState",{rolesState:Rn})},Nn={loadRolesAndPermissions:ut("auth/loadRoles",(e=>({payload:e}))),addRole:ut("auth/addRole",(e=>({payload:e}))),updateRole:ut("auth/updateRole",(e=>({payload:e}))),deleteRole:ut("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ut("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ut("auth/attachPermissionToRoles",(e=>({payload:e})))},Mn={loading:!1,sessions:[]},Fn={setSessionsState:gt("sessionsState"),resetSessionsState:pt("sessionsState",{sessionsState:Mn})},Gn={loadUserSessions:ut("auth/loadUserSessions"),loadCurrentUserSession:ut("auth/loadCurrentUserSession"),deleteUserSession:ut("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ut("auth/deleteAllUserSessions"),revokeUserSessions:ut("auth/revokeUserSessions",(e=>({payload:e})))},$n={loading:!1,configurations:{}},xn={setSessionsPolicyState:gt("sessionsPolicyState"),resetSessionsPolicyState:pt("sessionsPolicyState",{sessionsPolicyState:$n})},Vn={loadSessionsPolicy:ut("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ut("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Bn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Bn||(Bn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Bn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Wn={setRestrictionsState:gt("restrictionsState"),setIpRestrictionsState:St("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:St("restrictionsState","emailDomainRestrictions")},Kn={checkIfUserIpValid:ut("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ut("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ut("auth/loadIpRestrictions"),saveIpRestriction:ut("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ut("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ut("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ut("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ut("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ut("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ut("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Hn={loading:!1},zn={setProvisioningState:gt("provisioningState"),resetProvisioningState:pt("provisioningState",{provisioningState:Hn})},qn={loadProvisionConnections:ut("auth/loadProvisionConnections"),createProvisionConnection:ut("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ut("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ut("auth/updateProvisionConnection",(e=>({payload:e})))},Yn={devices:[],loading:!1,error:null},Jn={setPasskeysState:gt("passkeysState"),resetPasskeysState:pt("passkeysState",{passkeysState:Yn})},Qn={loadWebAuthnDevices:ut("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ut("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Xn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Zn={setUsersGroupsLoader:vt("groupsState"),setUsersGroupsError:ht("groupsState"),setGroupsState:gt("groupsState"),resetUsersGroupsState:pt("groupsState",{groupsState:Xn})},eo={loadGroups:ut("auth/loadUsersGroups"),getGroupById:ut("auth/getGroupById",(e=>({payload:e}))),createGroup:ut("auth/createGroup",(e=>({payload:e}))),updateGroup:ut("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ut("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ut("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ut("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ut("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ut("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ut("auth/getGroupConfiguration"),updateGroupConfiguration:ut("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ut("auth/getUsers",(e=>({payload:e})))},to={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}},no={setGroupsDialogsState:gt("groupsDialogsState"),resetGroupsDialogsState:pt("groupsState",{groupsDialogsState:to}),openAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:At("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:At("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:At("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:At("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:At("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},oo={loading:!0,error:null},io={setCustomLoginState:gt("customLoginState"),resetCustomLoginState:pt("customLoginState",{customLoginState:oo})},ao={loadTenantMetadata:ut("auth/loadTenantMetadata"),updateTenantMetadata:ut("auth/updateTenantMetadata",(e=>({payload:e})))},ro={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let lo,so,co,uo,yo;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(lo||(lo={})),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"}(so||(so={})),function(e){e.ASC="ASC",e.DESC="DESC"}(co||(co={})),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"}(uo||(uo={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(yo||(yo={}));const fo=["local","saml","google","github","facebook","microsoft","scim2","slack"],po={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:co.DESC,_sortBy:uo.name},usersPageOffset:0,accountSettings:{}}},go={setAllAccountsLoader:vt("allAccountsState"),setAllAccountsError:ht("allAccountsState"),setAllAccountsState:gt("allAccountsState"),setSelectedAccountState:St("allAccountsState","selectedAccount"),resetAllAccountsState:pt("allAccountsState",{allAccountsState:po})},So={loadAccounts:ut("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ut("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ut("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ut("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ut("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:ut("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ut("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ut("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ut("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ut("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ut("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ut("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:ut("auth/setRootAccountData"),setSelectedSubAccountData:ut("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ut("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},vo={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:[]}},ho={setAllAccountDialogsState:gt("allAccountsDialogsState"),resetAllAccountDialogsState:pt("allAccountsDialogsState",{allAccountsDialogsState:vo}),openCreateSubAccountDialog:mt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:At("allAccountsDialogsState","createSubAccountDialog",vo.createSubAccountDialog),openUpdateSubAccountDialog:mt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:At("allAccountsDialogsState","updateSubAccountDialog",vo.updateSubAccountDialog),openDeleteSubAccountDialog:mt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:At("allAccountsDialogsState","deleteSubAccountDialog",vo.deleteSubAccountDialog),openAddUsersToAccountDialog:mt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:At("allAccountsDialogsState","addUsersToAccountDialog",vo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:mt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:At("allAccountsDialogsState","deleteUserFromAccountDialog",vo.deleteUserFromAccountDialog),openEditUserRolesDialog:mt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:At("allAccountsDialogsState","editUserRolesDialog",vo.editUserRolesDialog)},mo={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ao={setSecurityCenterState:gt("securityCenterState"),resetSecurityCenterState:pt("securityCenterState",{securityCenterState:mo}),setSecurityCenterStateLoader:vt("securityCenterState"),setSecurityCenterStateError:ht("securityCenterState")},bo={loadRecommendations:ut("auth/loadRecommendations"),loadInsights:ut("auth/loadInsights"),sendResetBreachedPasswordEmail:ut("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ut("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ut("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ut("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ut("auth/loadInactiveUsers",(e=>({payload:e})))};let To,ko,Eo;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(To||(To={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(ko||(ko={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Eo||(Eo={}));const Io={[ko.Code]:Pt.loginWithOtc,[ko.EmailAndPassword]:Pt.loginWithPassword,[ko.MagicLink]:Pt.magicLinkPreLoginSuccess,[ko.SmsCode]:Pt.loginWithSmsOtc},Po={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:hn,loginState:Nt,activateState:$t,acceptInvitationState:jt,forgotPasswordState:zt,ssoState:en,profileState:on,customLoginState:oo,mfaState:sn,teamState:dn,groupsState:Xn,groupsDialogsState:to,socialLoginState:pn,apiTokensState:bn,securityPolicyState:En,accountSettingsState:Ln,tenantsState:wn,rolesState:Rn,resetPhoneNumberState:Qt,sessionsState:Mn,sessionsPolicyState:$n,restrictionsState:jn,provisioningState:Hn,passkeysState:Yn,allAccountsState:po,allAccountsDialogsState:vo,securityCenterState:mo},Lo=U({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:()=>{}},Po);let Oo;!function(e){e.impersonating="impersonating",e.success="success"}(Oo||(Oo={}));const _o={step:Oo.impersonating,loading:!1},wo={setImpersonateState:gt("impersonateState"),resetImpersonateState:pt("impersonateState",{impersonateState:_o})},Co={impersonate:ut("impersonation/impersonate",(e=>({payload:e})))},{reducer:Uo,actions:Ro}=yt({name:Ct,initialState:Lo,reducers:U({resetState:e=>U({},e,Po),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t})),setEntitlements:St("user","entitlements")},Mt,gn,xt,wo,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,no,Tn,In,On,Cn,Dn,Fn,xn,Wn,zn,Jn,go,ho,Ao)});const Do=U({loadEntitlements:ut("auth/loadEntitlements",(e=>({payload:e})))},Ro,Ft,Sn,Vt,Kt,Yt,Zt,An,rn,ao,nn,un,fn,eo,{},kn,Pn,_n,Un,Nn,Gn,Vn,Kn,qn,Co,Qn,So,bo);var No=function(e){return"@@redux-saga/"+e},Mo=No("CANCEL_PROMISE"),Fo=No("CHANNEL_END"),Go=No("IO"),$o=No("MATCH"),xo=No("MULTICAST"),Vo=No("SAGA_ACTION"),Bo=No("SELF_CANCELLATION"),jo=No("TASK"),Wo=No("TASK_CANCEL"),Ko=No("TERMINATE"),Ho=No("LOCATION");function zo(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 qo=function(e){return null==e},Yo=function(e){return null!=e},Jo=function(e){return"function"==typeof e},Qo=function(e){return"string"==typeof e},Xo=Array.isArray,Zo=function(e){return e&&Jo(e.then)},ei=function(e){return e&&Jo(e.next)&&Jo(e.throw)},ti=function e(t){return t&&(Qo(t)||ii(t)||Jo(t)||Xo(t)&&t.every(e))},ni=function(e){return e&&Jo(e.take)&&Jo(e.close)},oi=function(e){return Jo(e)&&e.hasOwnProperty("toString")},ii=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},ai=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[Mo]=function(){clearTimeout(n)},o},ri=function(e){return function(){return e}},li=ri(!0),si=function(){},ci=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ui=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function di(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var yi=function(e){throw e},fi=function(e){return{value:e,done:!0}};function pi(e,t,n){void 0===t&&(t=yi),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:fi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function gi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Si=function(e){return Array.apply(null,new Array(e))},vi=function(e){return function(t){return e(Object.defineProperty(t,Vo,{value:!0}))}},hi=function(e){return e===Ko},mi=function(e){return e===Wo},Ai=function(e){return hi(e)||mi(e)};function bi(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Xo(e)?Si(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||Ai(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=si,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Ti(e){return{name:e.name||"anonymous",location:ki(e)}}function ki(e){return e[Ho]}var Ei=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)},Ii="TAKE",Pi="CALL",Li="FORK",Oi="SELECT",_i=function(e,t){var n;return(n={})[Go]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function wi(e,t){return void 0===e&&(e="*"),ti(e)?(Yo(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),_i(Ii,{pattern:e})):ni(n=e)&&n[xo]&&Yo(t)&&ti(t)?_i(Ii,{channel:e,pattern:t}):ni(e)?(Yo(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),_i(Ii,{channel:e})):void 0;var n}function Ci(e,t){return qo(t)&&(t=e,e=void 0),_i("PUT",{channel:e,action:t})}function Ui(e){var t=_i("ALL",e);return t.combinator=!0,t}function Ri(e,t){var n,o=null;return Jo(e)?n=e:(Xo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Qo(n)&&Jo(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function Di(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 _i(Pi,Ri(e,n))}function Ni(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 _i(Li,Ri(e,n))}function Mi(e){return void 0===e&&(e=Bo),_i("CANCEL",e)}function Fi(e){void 0===e&&(e=ci);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return _i(Oi,{selector:e,args:n})}var Gi=Di.bind(null,ai);var $i=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},xi=[],Vi=0;function Bi(e){try{Ki(),e()}finally{Hi()}}function ji(e){xi.push(e),Vi||(Ki(),zi())}function Wi(e){try{return Ki(),e()}finally{zi()}}function Ki(){Vi++}function Hi(){Vi--}function zi(){var e;for(Hi();!Vi&&void 0!==(e=xi.shift());)Bi(e)}var qi=function(e){return function(t){return e.some((function(e){return Zi(e)(t)}))}},Yi=function(e){return function(t){return e(t)}},Ji=function(e){return function(t){return t.type===String(e)}},Qi=function(e){return function(t){return t.type===e}},Xi=function(){return li};function Zi(e){var t="*"===e?Xi:Qo(e)?Ji:Xo(e)?qi:oi(e)?Ji:Jo(e)?Yi:ii(e)?Qi:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ea={type:Fo},ta=function(e){return e&&e.type===Fo};function na(){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(ea)}))},(e={})[xo]=!0,e.put=function(e){if(!t)if(ta(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[$o](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Xi),t?e(ea):(e[$o]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),di(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Vo]?l(e):ji((function(){l(e)}))},r}function oa(e,t){var n=e[Mo];Jo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ia,aa=0,ra=function(){return++aa};function la(e){e.isRunning()&&e.cancel()}var sa=((ia={}).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):!ta(e)||r?n(e):n(Ko)};try{i.take(l,Yo(a)?Zi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},ia.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;ji((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Zo(t)?oa(t,n):n(t)}))},ia.ALL=function(e,t,n,o){var i=o.digestEffect,a=aa,r=Object.keys(t);if(0!==r.length){var l=bi(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Xo(t)?[]:{})},ia.RACE=function(e,t,n,o){var i=o.digestEffect,a=aa,r=Object.keys(t),l=Xo(t)?Si(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||Ai(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=si,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)}))},ia.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 oa(s,n);if(ei(s))return void ha(e,s,l.context,aa,Ti(a),!1,n);n(s)}catch(e){n(e,!0)}},ia.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){qo(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ia.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(ei(i))return i;var a=!1;return pi((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Zo(i)})}))}catch(e){return pi((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ti(t)}(c,a);Wi((function(){var t=ha(e,c,s.context,aa,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},ia.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()&&di(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Xo(t)){if(0===t.length)return void n([]);var r=bi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ia.CANCEL=function(e,t,n,o){var i=o.task;t===Bo?la(i):Xo(t)?t.forEach(la):la(t),n()},ia.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)}},ia.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Ei());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(ea):e.isEmpty()?(n.push(o),o.cancel=function(){di(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(ea):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])(ea)}}}}(t.buffer),a=Zi(o),r=function t(n){ta(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)},ia.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},ia.FLUSH=function(e,t,n){t.flush(n)},ia.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},ia.SET_CONTEXT=function(e,t,n,o){var i=o.task;ui(i.context,t),n()},ia);function ca(e,t){return e+"?"+t}function ua(e){var t=e.name,n=e.location;return n?t+" "+ca(n.fileName,n.lineNumber):t}function da(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 ya=null,fa=[],pa=function(e){e.crashedEffect=ya,fa.push(e)},ga=function(){ya=null,fa.length=0},Sa=function(){var e,t,n=fa[0],o=fa.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=ki(e))?t.code+" "+ca(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ua(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+ua(e.meta)})),[da(fa)]).join("\n")};function va(e,t,n,o,i,a,r){var l;void 0===r&&(r=si);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||(di(i,t),t.cont=si,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=si,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,pa({meta:i,cancelledTasks:y}),S.isRoot){var o=Sa();ga(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===Wo?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={})[jo]=!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(Wo,!1))},l.cont=r,l.end=g,l.setContext=function(e){ui(f,e)},l.toPromise=function(){return d||(d=$i(),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 ha(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Zo(t)?oa(t,o):ei(t)?ha(e,t,c.context,n,i,!1,o):t&&t[Go]?(0,sa[t.type])(e,t.payload,o,u):o(t)}));d.cancel=si;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(Wo))},status:0},c=va(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),ga()):mi(e)?(s.status=1,d.cancel(),i=Jo(t.return)?t.return(Wo):{done:!0,value:Wo}):i=hi(e)?Jo(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=ra();function s(n,i){a||(a=!0,o.cancel=si,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){ya=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=si,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=si,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function ma(e,t){for(var n=e.channel,o=void 0===n?na():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?gi: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=ra();if(s&&(s.rootSagaStarted=s.rootSagaStarted||si,s.effectTriggered=s.effectTriggered||si,s.effectResolved=s.effectResolved||si,s.effectRejected=s.effectRejected||si,s.effectCancelled=s.effectCancelled||si,s.actionDispatched=s.actionDispatched||si,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ke.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=ci;var m={channel:o,dispatch:vi(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Wi((function(){var e=ha(m,S,l,v,Ti(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Aa=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?na():a,l=n.sagaMonitor,s=zo(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=ma.bind(null,U({},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){ui(i,e)},c},ba=function(e){return{done:!0,value:e}},Ta={};function ka(e){return ni(e)?"channel":oi(e)?String(e):Jo(e)?e.name:String(e)}function Ea(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Ta)return ba(t);if(n&&!i)throw r=Ta,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===Ta?ba(t):a}return pi(l,(function(e){return l(null,e)}),n)}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:wi(e)},l=function(e){return{done:!1,value:Ni.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Ea({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+ka(e)+", "+t.name+")")}function Pa(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:wi(e)},s=function(e){return{done:!1,value:Ni.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Mi(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ea({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("+ka(e)+", "+t.name+")")}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];var a,r={done:!1,value:wi(e)},l=function(e){return{done:!1,value:Di.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Ea({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+ka(e)+", "+t.name+")")}function Oa(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:Di.apply(void 0,[n].concat(a))},s={done:!1,value:Gi(t)};return Ea({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Ta}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}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 Ni.apply(void 0,[Ia,e,t].concat(o))}function wa(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 Ni.apply(void 0,[Pa,e,t].concat(o))}function Ca(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 Ni.apply(void 0,[La,e,t].concat(o))}class Ua{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 Ua.instance||(Ua.instance=new Ua),Ua.instance}static setContext(e){Ua.getInstance().context=e}static setAccessToken(e){Ua.getInstance().accessToken=e}static setUser(e){Ua.getInstance().user=e}static setRequestSource(e){Ua.getInstance().requestSource=e}static setOnRedirectTo(e){Ua.getInstance().onRedirectTo=e}static setLogout(e,t){Ua.getInstance().logout=n=>{n?e(n):Ua.onRedirectTo(t)}}static setEntitlementsOptions(e){Ua.getInstance().entitlementsOptions=e}static setAppName(e){Ua.getInstance().appName=e}static getContext(){var e;return null!=(e=Ua.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Ua.getInstance().accessToken}static getRequestSource(){return Ua.getInstance().requestSource}static getUser(){return Ua.getInstance().user}static onRedirectTo(e,t){return Ua.getInstance().onRedirectTo(e,t)}static logout(e){return Ua.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Ua.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static getAppName(){return Ua.getInstance().appName}}Ua.instance=void 0;const Ra={getContext:()=>Ua.getContext(),getAccessToken:()=>Ua.getAccessToken(),getUser:()=>Ua.getUser(),onRedirectTo:(e,t)=>Ua.onRedirectTo(e,t),logout:e=>Ua.logout(e)};class Da extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Na={v1:"/identity/resources/users/webauthn/v1/devices"},Ma={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Fa={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"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"}},Ga={v1:"/identity/resources/configurations/v1"},$a={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},xa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Va={v1:"/identity/resources/permissions/v1"},Ba={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"}},ja={v1:"/identity/resources/roles/v1"},Wa={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ka={v1:"/identity/resources/impersonation/v1"},Ha={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},za={v1:"/identity/resources/phoneNumbers/v1"},qa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Ya={v1:"/team/resources/members/v1"},Ja={v1:"/team/resources/roles/v1"},Qa={v1:"/team/resources/stats/v1"},Xa={v1:"/team/resources/profile"},Za={v1:"/tenants/resources/account-settings/v1"},er={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"}},tr={v1:"/tenants/resources/sub-tenants/v1"},nr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},or={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"}}}},ir={v1:"/subscriptions/resources/payment-providers/v1"},ar={v1:"/subscriptions/resources/subscriptions/v1"},rr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},lr={v1:"/reports/engine/resources/triggers/v1"},sr="/notification",cr="/audits",ur={v1:"/event/resources/configurations/v1"},dr="/webhook",yr="/oauth",fr="/flags",pr="/directory/resources/v1/configurations/scim2",gr="/directory/resources/scim/temp",Sr="/entitlements/api/v1/user-entitlements",vr={v1:"/security-center/resources/recommendations/v1"},hr={v1:"/security-center/resources/insights/v1"};function mr(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 Ar(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ro.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ro.frameWork]=e.metadataHeaders.framework),o}const br=async e=>{var t,n,o;const i=Ua.getContext(),a=await async function(e,t){var n;const o=Ar(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ua.getAccessToken)(),a=Ua.getRequestSource();t&&(o[ro.contentType]=t),a&&(o[ro.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=mr(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:U({},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 Da("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 Da(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{}}},Tr=async(e,t,n)=>br(U({url:e,method:"GET",contentType:"application/json",params:t},n)),kr=async(e,t,n)=>br(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Er=async(e,t,n)=>br(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ir=async(e,t,n)=>br(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),Pr=async(e,t,n)=>br(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Lr=async(e,t,n,o)=>br(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Or=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function _r(e){return Ir(`${Fa.v1}/tenant`,e)}async function wr(){return Tr(`${Fa.v2}/me/tenants`)}async function Cr(e){return Tr(er.v1,void 0,{headers:Or(e)})}async function Ur(e){return Tr(er.tree.v1,void 0,{headers:Or(e)})}async function Rr(e){return Tr(er.parents.v1,void 0,{headers:Or(e)})}async function Dr(e,t){return Tr(`${er.parents.v1}/${e}`,void 0,{headers:Or(t)})}async function Nr(e,t){return kr(`${Ba.users.v1}/count`,e,{headers:Or(t)})}async function Mr(e,t){return Tr(er.v2,e,{headers:Or(t)})}async function Fr(e,t){return Tr(er.metadata.v2,U({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Or(t)})}async function Gr(){return Tr(Ga.v1)}async function $r(){return Tr(`${Ga.v1}/mfa-policy`)}async function xr(){return Tr(`${Ga.v1}/mfa-policy/vendor`)}async function Vr(e){return e.id?Er(`${Ga.v1}/mfa-policy`,e):kr(`${Ga.v1}/mfa-policy`,e)}async function Br(){return Tr(`${Ga.v1}/lockout-policy`)}async function jr(){return Tr(`${Ga.v1}/lockout-policy/vendor`)}async function Wr(e){return e.id?Er(`${Ga.v1}/lockout-policy`,e):kr(`${Ga.v1}/lockout-policy`,e)}async function Kr(){try{return await Tr(`${Ga.v1}/captcha-policy/public`)}catch{return null}}async function Hr(){return Tr(`${Ga.v1}/password-history-policy`)}async function zr(){return Tr(`${Ga.v1}/password-history-policy/vendor`)}async function qr(e){return e.id?Er(`${Ga.v1}/password-history-policy`,e):kr(`${Ga.v1}/password-history-policy`,e)}async function Yr(){return Tr(`${Ga.v1}/password`)}async function Jr(){return Tr(`${$a.emailDomain.v1}`)}async function Qr(){return Tr(`${$a.emailDomain.v1}/config`)}async function Xr(e){return kr(`${$a.emailDomain.v1}`,e)}async function Zr(e){return kr(`${$a.emailDomain.v1}/config`,e)}async function el(e){return Pr(`${$a.emailDomain.v1}/${e}`)}async function tl(e){return Tr(`${$a.ip.v1}`,e)}async function nl(){return Tr(`${$a.ip.v1}/config`)}async function ol(e){return kr(`${$a.ip.v1}`,e)}async function il(e){return kr(`${$a.ip.v1}/bulk`,e)}async function al(e){return kr(`${$a.ip.v1}/config`,e)}async function rl(e){return Pr(`${$a.ip.v1}/${e}`)}async function ll(){return kr(`${$a.ip.v1}/verify`)}async function sl(){return kr(`${$a.ip.v1}/verify/allow`)}class cl extends Error{constructor(e){super(e)}}const ul="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new cl("'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 dl extends Error{constructor(e){super(e)}}const yl=(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(ul(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 ul(t)}})(e.split(".")[n]))}catch(e){throw new dl("Invalid token specified: "+e.message)}};let fl,pl,gl;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(fl||(fl={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(pl||(pl={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(gl||(gl={}));const Sl="admin_portal_should_load_authorization";async function vl(e){return kr(`${Fa.v3}/me/token`,e)}async function hl(e,t){return Tr(Fa.v2,e,{headers:Or(t)})}async function ml(e,t){return Tr(Fa.v3,e,{headers:Or(t)})}async function Al(e,t){return Tr(Fa.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Or(t)})}async function bl(e,t){return Tr(Fa.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Or(t)})}async function Tl(e){return Tr(Fa.tenants.me.v3,void 0,{headers:Or(e)})}async function kl(){return kr(Fa.passwords.resetBreachedPasswords.v1)}async function El(e){return Ir(`${Fa.v2}/me`,e)}async function Il(){return Tr(Sr)}let Pl;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Pl||(Pl={}));const Ll="admin_portal_entitlements",Ol={flags:{}};class _l{constructor(){var e;this._flags={},this._flags=null!=(e=Ol.flags)?e:{}}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}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=U({},null!=(t=null==Ol?void 0:Ol.flags)?t:{},null!=e?e:{})}}async function wl(){return Tr(fr)}_l._instances={};const Cl=["type"],Ul=["type"],Rl=["type"];async function Dl(e){if(!e.accessToken)return e;Ua.setAccessToken(e.accessToken);const t=await bu(),n=U({},e,e.accessToken?yl(e.accessToken):{},t);return Ua.setUser(n),n}async function Nl(e){if(!e.accessToken)return{user:e};Ua.setAccessToken(e.accessToken);const[t,n]=await Promise.all([bu(),wr()]),o=U({},e,e.accessToken?yl(e.accessToken):{},t);return Ua.setUser(o),{user:o,tenants:n}}function Ml(){if(!Ua.shouldLoadEntitlements())return!1;const[e]=_l.getFeatureFlags([Ll],Ua.getAppName()||"");return e}function Fl(){const[e]=_l.getFeatureFlags([Sl],Ua.getAppName()||"");return e}async function Gl(e){const{accessToken:t}=e;if(!t)return{user:e};Ua.setAccessToken(t);const[n,o]=await Promise.all([bu(),Tl()]),i=U({},e,t?yl(t):{},n);return Ua.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function $l(e){Ua.setAccessToken(e.id_token);const t=await bu(),n=e.id_token?yl(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Ua.setUser(o),o}async function xl(e){Ua.setAccessToken(e.id_token);const[t,n]=await Promise.all([bu(),Tl()]),o=e.id_token?yl(e.id_token):{},i=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},o,t,{expiresIn:e.expires_in||300});return Ua.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function Vl(e){try{const{address:t}=await kr(`${Ma.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Bl(e){return kr(`${Ma.v1}/user/saml/prelogin`,e)}async function jl(e){return Dl(await kr(`${Ma.v1}/user/saml/postlogin`,e))}async function Wl(e){return Dl(await kr(`${Ma.v1}/user/oidc/postlogin`,e))}async function Kl(e){return Dl(await kr(`${Ma.v1}/user`,e))}async function Hl(e){return Gl(await kr(`${Ma.v1}/user`,e))}async function zl(e){return Dl(await kr(`${Ma.v1}/user/mfa/verify`,e))}async function ql(e){return Gl(await kr(`${Ma.v1}/user/mfa/verify`,e))}async function Yl(e){return kr(`${Fa.v1}/activate`,e)}async function Jl(e){return Gl(await kr(`${Fa.v1}/activate`,e))}async function Ql(e){return Tr(`${Fa.v1}/activate/strategy`,e)}async function Xl(e){return kr(`${Fa.v1}/activate/reset`,e)}async function Zl(e){return kr(`${Fa.v1}/invitation/reset`,e)}async function es(e){return kr(`${Fa.v1}/invitation/accept`,e)}async function ts(){return Dl(await kr(`${Ma.v1}/user/token/refresh`))}async function ns(){return Nl(await kr(`${Ma.v1}/user/token/refresh`))}async function os(){return Gl(await kr(`${Ma.v1}/user/token/refresh`))}async function is(){return kr(`${Ma.v1}/logout`)}async function as(e){return Tr(`${yr}/logout`,e)}async function rs(e){return kr(`${Fa.v1}/passwords/reset`,e)}async function ls(e){return kr(`${Fa.v1}/passwords/reset/verify`,e)}async function ss(e){return Tr(`${Fa.v1}/passwords/config`,e)}async function cs(e){return kr(`${Ma.v1}/user/mfa/recover`,e)}async function us(){return kr(`${Fa.v1}/mfa/enroll`)}async function ds(){return kr(`${Fa.v1}/mfa/authenticator/enroll`)}async function ys(e){return kr(`${Fa.v1}/mfa/authenticator/enroll/verify`,e)}async function fs(e){return kr(`${Fa.v1}/mfa/sms/enroll`,e)}async function ps(e){return kr(`${Fa.v1}/mfa/sms/enroll/verify`,e)}async function gs(){return kr(`${Fa.v1}/mfa/webauthn/enroll`)}async function Ss(e){return kr(`${Fa.v1}/mfa/webauthn/enroll/verify`,e)}async function vs(e){return kr(`${Fa.v1}/mfa/enroll/verify`,e)}async function hs(e){return kr(`${Fa.v1}/mfa/disable`,e)}async function ms(e,t){return kr(`${Fa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function As(e){return kr(`${Fa.v1}/mfa/sms/${e}/disable`)}async function bs(e,t){return kr(`${Fa.v1}/mfa/sms/${e}/disable/verify`,t)}async function Ts(e){return kr(`${Fa.v1}/mfa/webauthn/${e}/disable`)}async function ks(e,t){return kr(`${Fa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Es(){return Tr(`${Fa.v1}/mfa/devices`)}async function Is(e){return kr(`${Ma.v1}/user/mfa/authenticator/enroll`,e)}async function Ps(e){return kr(`${Ma.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Ls(e){return Gl(await kr(`${Ma.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Os(e,t){return kr(`${Ma.v1}/user/mfa/authenticator/${e}/verify`,t)}async function _s(e){return kr(`${Ma.v1}/user/mfa/emailcode`,e)}async function ws(e){return kr(`${Ma.v1}/user/mfa/emailcode/verify`,e)}async function Cs(e){return Gl(await kr(`${Ma.v1}/user/mfa/emailcode/verify`,e))}async function Us(e){return kr(`${Ma.v1}/user/mfa/sms/enroll`,e)}async function Rs(e){return kr(`${Ma.v1}/user/mfa/sms/enroll/verify`,e)}async function Ds(e){return Gl(await kr(`${Ma.v1}/user/mfa/sms/enroll/verify`,e))}async function Ns(e,t){return kr(`${Ma.v1}/user/mfa/sms/${e}`,t)}async function Ms(e,t){return kr(`${Ma.v1}/user/mfa/sms/${e}/verify`,t)}async function Fs(e,t){return Gl(await kr(`${Ma.v1}/user/mfa/sms/${e}/verify`,t))}async function Gs(e){return kr(`${Ma.v1}/user/mfa/webauthn/enroll`,e)}async function $s(e){return kr(`${Ma.v1}/user/mfa/webauthn/enroll/verify`,e)}async function xs(e){return Gl(await kr(`${Ma.v1}/user/mfa/webauthn/enroll/verify`,e))}async function Vs(e,t){return kr(`${Ma.v1}/user/mfa/webauthn/${e}`,t)}async function Bs(e,t){return kr(`${Ma.v1}/user/mfa/webauthn/${e}/verify`,t)}async function js(e,t){return Gl(await kr(`${Ma.v1}/user/mfa/webauthn/${e}/verify`,t))}async function Ws(){return Tr(`${qa.v1}/saml/configurations`)}async function Ks(e){return kr(`${qa.v1}/saml/configurations`,e)}async function Hs(){return Tr(`${qa.v1}/saml/configurations/vendor-config`)}async function zs(e){return Ir(`${qa.v1}/saml/configurations/metadata`,e)}async function qs(){return Ir(`${qa.v1}/saml/validations/domain`)}async function Ys(){return Tr(`${qa.v1}/saml/configurations/roles/default`)}async function Js(){return Tr(`${qa.v2}/saml/configurations/groups`)}async function Qs({roleIds:e}){return kr(`${qa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Xs({roleIds:e,group:t}){return kr(`${qa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Zs({roleIds:e,group:t,id:n}){return Er(`${qa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function ec({id:e}){return Pr(`${qa.v2}/saml/configurations/groups/${e}`)}async function tc(){return Tr(`${qa.v1}/oidc/configurations`)}async function nc(){return Tr(`${qa.v2}/configurations/public`)}async function oc(){return Tr(xa.v1)}async function ic(){return Tr(xa.v2)}async function ac(){return Tr(`${xa.v2}/authenticated`)}async function rc(){return Tr(xa.custom.v1)}async function lc({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),kr(`${Ma.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function sc(){return Tr(`${Ga.v1}/public`)}async function cc(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await kr(`${Fa.v1}/signUp`,e),a={shouldActivate:t,userId:o,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:o}=await Gl(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function uc(){return Tr(Fa.sessions.currentUser.v1)}async function dc(){return Tr(`${Fa.sessions.currentUser.v1}/current`)}async function yc(e){return kr(`${Fa.sessions.v1}/revoke`,{userId:e})}async function fc(){return Tr(Fa.sessions.configurations.v1)}async function pc(e){await kr(Fa.sessions.configurations.v1,e)}async function gc(e){await Pr(`${Fa.sessions.currentUser.v1}/${e}`)}async function Sc(){await Pr(`${Fa.sessions.currentUser.v1}/all`)}async function vc(){return Tr(Fa.accessTokens.v1)}async function hc(){return Tr(Ba.accessTokens.v1)}async function mc({id:e}){return Pr(`${Ba.accessTokens.v1}/${e}`)}async function Ac({id:e}){return Pr(`${Fa.accessTokens.v1}/${e}`)}async function bc(e){return kr(Fa.accessTokens.v1,e)}async function Tc(e){return kr(Ba.accessTokens.v1,e)}async function kc(){return Tr(Fa.apiTokens.v1)}async function Ec(){return Tr(Ba.apiTokens.v1)}async function Ic(e){return kr(Fa.apiTokens.v1,e)}async function Pc(e){return kr(Ba.apiTokens.v2,e)}async function Lc({tokenId:e}){return Pr(`${Ba.apiTokens.v1}/${e}`)}async function Oc({tokenId:e}){return Pr(`${Fa.apiTokens.v1}/${e}`)}async function _c({userId:e}){return Tr(`${Fa.v1}/${e}`)}async function wc(e){return Tr(`${Ga.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Cc(e){let{type:t}=e,n=zo(e,Cl);return kr(`${Ma.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Uc(e){let{type:t}=e,n=zo(e,Ul);return Gl(await kr(`${Ma.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Rc(e){let{type:t}=e,n=zo(e,Rl);return kr(`${Ma.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Dc({token:e}){return kr(Ba.invites.verify.v1,{token:e})}async function Nc(){return Tr(`${qa.v1}/configurations`)}async function Mc(e){return kr(`${qa.v1}/configurations`,e)}async function Fc(e,t){return Er(`${qa.v1}/configurations/${e}`,t)}async function Gc(e){return Pr(`${qa.v1}/configurations/${e}`)}async function $c(e){return kr(`${qa.v1}/configurations/metadata`,e)}async function xc(e,t){return Ir(`${qa.v1}/configurations/${e}/metadata`,t)}async function Vc(e){return kr(`${qa.v1}/configurations/metadata-url`,e)}async function Bc(e,t){return Ir(`${qa.v1}/configurations/${e}/metadata-url`,t)}async function jc(e,t){return kr(`${qa.v1}/configurations/${e}/domains`,t)}async function Wc(e,t){return Pr(`${qa.v1}/configurations/${e}/domains/${t}`)}async function Kc(e,t){return Ir(`${qa.v1}/configurations/${e}/domains/${t}/validate`)}async function Hc(e){return Tr(`${qa.v1}/configurations/${e}/roles`)}async function zc(e,t){return Ir(`${qa.v1}/configurations/${e}/roles`,t)}async function qc(e,t){return kr(`${qa.v1}/configurations/${e}/groups`,t)}async function Yc(e,{roleIds:t,group:n,id:o}){return Er(`${qa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Jc(e,t){return Pr(`${qa.v1}/configurations/${e}/groups/${t}`)}async function Qc(e){return Tr(`${qa.v1}/configurations/${e}/groups`)}async function Xc(e){return kr(`${Ma.v2}/user/sso/prelogin`,e)}async function Zc(e){return Dl(await kr(`${Ma.v2}/user/oidc/postlogin`,e))}async function eu(e){return xl(await kr(`${yr}/token`,e))}async function tu(){return xl(await kr(`${yr}/authorize/silent`))}async function nu(e){return $l(await kr(`${yr}/token`,e))}async function ou(){return $l(await kr(`${yr}/authorize/silent`))}async function iu(e){return kr(`${Fa.v1}/phone/reset`,e)}async function au(e){return kr(`${Fa.v1}/phone/reset/verify`,e)}async function ru(e){return kr(`${Fa.v1}/phone`,e)}async function lu(e){return kr(`${Fa.v1}/phone/verify`,e)}async function su(e){return Ir(`${Fa.v1}/phone/change`,e)}async function cu(e){return kr(`${Ma.v1}/webauthn/prelogin`,e)}async function uu(e){return kr(`${Ma.v1}/webauthn/postlogin`,e)}async function du(e){return Gl(await kr(`${Ma.v1}/webauthn/postlogin`,e))}async function yu(){return kr(Na.v1)}async function fu(){return Tr(Na.v1)}async function pu(e){return Pr(`${Na.v1}/${e}`)}async function gu(e){return kr(`${Na.v1}/verify`,e)}async function Su(){return Tr(`${Ga.v1}/auth/strategies/public`)}async function vu(){return Tr(`${Ga.v1}/auth/strategies`)}async function hu(){return Tr(`${Ga.v1}/mfa/strategies`)}async function mu(){return Tr(`${Fa.authorization.v1}`)}async function Au(){return Tr(`${Fa.v2}/me`)}async function bu(){const e=[{action:Au,shouldLoad:!0},{action:Il,shouldLoad:Ml()},{action:mu,shouldLoad:Fl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,o]=await Promise.all(e);return U({},t,null!=o?o:{},{entitlements:n})}async function Tu(e){return Tr(`${Fa.v2}/me`,null!=e?e:{addRoles:!0})}async function ku(e){return Ir(`${Fa.v2}/me`,e)}async function Eu(e){return Ir(`${Xa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Iu(e){return kr(`${Fa.v1}/passwords/change`,e)}async function Pu(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},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 Tr(Ya.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Lu(e){return kr(Fa.v2,U({},e,{provider:"local"}))}async function Ou(e){return Pr(`${Ya.v1}/${e.userId}`)}async function _u(e){return Ir(Ya.v1,e)}async function wu(e){return kr(Ba.invites.user.v1,U({},e))}async function Cu(e){return Er(Ba.invites.user.v1,U({},e))}async function Uu(){return Pr(Ba.invites.user.v1)}async function Ru(){return Tr(Ba.invites.user.v1)}async function Du(){return Tr(Ba.invites.configuration.v1)}async function Nu(){return Tr(Ja.v1)}async function Mu(){return Tr(Va.v1)}async function Fu(){return Tr(`${Qa.v1}/members`)}async function Gu(e){return kr(`${Ya.v1}/${e.userId}/resendActivationEmail`,{})}async function $u(e){return kr(Fa.v2,U({},e,{provider:"local"}))}async function xu(e){return kr(Fa.invitation.resendAll.v1,U({},e))}async function Vu(e){var t,n;const o=await Tr("/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 Bu(){return Tr("/metadata/admin-box")}async function ju(e){return kr("/metadata/admin-box",e)}async function Wu(){const e=await Tr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Ku=async()=>Vu({entityName:"notifications"}),Hu=async()=>Vu({entityName:"saml"}),zu=async()=>Vu({entityName:"audits"}),qu=async e=>async function(e){const t=await Tr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Yu=["dataFilters"],Ju=["templateId","dataFilters"],Qu=["dataFilters"];async function Xu(e){return Tr(`${rr.v2}/tenant-reports`,e)}async function Zu(e){return Tr(`${rr.v2}/${e.id}/tenant-reports`)}async function ed(e){let{dataFilters:t}=e,n=zo(e,Yu);return{html:await Tr(`${lr.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function td(e){let{templateId:t,dataFilters:n}=e,o=zo(e,Ju);return kr(`${rr.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function nd(e){let{dataFilters:t}=e,n=zo(e,Qu);const o=await Tr(`${lr.v1}/preview-report`,U({},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 od(e){return kr(`${lr.v1}/tenant-reports`,e)}async function id(e){return Tr(sr,{params:e})}async function ad(e){return Ir(`${sr}/status`,{params:e})}async function rd(e){const{notificationId:t,pinStatus:n}=e;return Ir(`${sr}/${n}`,{notificationId:t})}async function ld(){return kr(`${sr}/status/mark-all-read`)}const sd=["endpoint","headerProps"];async function cd(e){return Tr(cr,e)}async function ud(e){return Tr(`${cr}/stats`,e)}async function dd(e){const{endpoint:t,headerProps:n}=e,o=zo(e,sd);return Lr(`${cr}/export/${t}`,{properties:n},o)}const yd=["eventKey"],fd=["eventKey"],pd=()=>Tr(`${nr.v1}/slack`),gd=()=>Tr(`${nr.v1}/slack/applications`),Sd=()=>Tr(`${nr.v1}/slack/channels`),vd=e=>e.id?Er(`${nr.v1}/slack/subscription/${e.id}`,e):kr(`${nr.v1}/slack/subscriptions`,e),hd=e=>Pr(`${nr.v1}/slack/subscriptions/${e.id}`),md=e=>kr(`${nr.v1}/slack/applications/registrations`,{code:e}),Ad=()=>Tr(`${nr.v1}/emails`),bd=e=>{let{eventKey:t}=e,n=zo(e,yd);return kr(`${nr.v1}/emails/${t}`,n)},Td=({eventKey:e,enabled:t})=>Er(`${nr.v1}/emails/${e}`,{enabled:t}),kd=(e,t)=>Pr(`${nr.v1}/emails/${e}/subscriptions/${t}`),Ed=(e,t,n)=>Ir(`${nr.v1}/emails/${t}/subscriptions/${e}`,n),Id=e=>Pr(`${nr.v1}/emails/${e}`),Pd=()=>Tr(`${nr.v2}/sms`),Ld=e=>{let{eventKey:t}=e,n=zo(e,fd);return kr(`${nr.v2}/sms/${t}`,n)},Od=({eventKey:e,enabled:t})=>Er(`${nr.v2}/sms/${e}`,{enabled:t}),_d=(e,t)=>Pr(`${nr.v2}/sms/${e}/subscriptions/${t}`),wd=(e,t,n)=>Ir(`${nr.v2}/sms/${t}/subscriptions/${e}`,n),Cd=e=>Pr(`${nr.v2}/sms/${e}`),Ud=()=>Tr(dr),Rd=e=>e._id?Er(`${dr}/${e._id}`,e):kr(`${dr}/custom`,e),Dd=e=>Pr(`${dr}/${e}`),Nd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Tr(`${dr}/logs/?${o.toString()}`)},Md=e=>kr(`${dr}/test`,e),Fd=e=>kr(`${dr}/logs/${e}/retries`),Gd=()=>Tr(`${ur.v1}/categories`),$d=e=>Tr(ur.v1,{channels:e});async function xd(e,t){return Ir(Za.v1,e,{headers:Or(t)})}async function Vd(e){return Tr(Za.v1,void 0,{headers:Or(e)})}async function Bd(){return Tr(`${Za.v1}/public`)}const jd=["roleId"],Wd=["roleId"],Kd=["permissionId"];async function Hd(){return Tr(ja.v1)}async function zd(e){return kr(ja.v1,e)}async function qd({roleId:e}){return Pr(`${ja.v1}/${e}`)}async function Yd(e){let{roleId:t}=e,n=zo(e,jd);return Er(`${ja.v1}/${t}`,n)}async function Jd(e){let{roleId:t}=e,n=zo(e,Wd);return Ir(`${ja.v1}/${t}/permissions`,n)}async function Qd(){return Tr(Va.v1)}async function Xd(e){let{permissionId:t}=e,n=zo(e,Kd);return Ir(`${Va.v1}/${t}/roles`,n)}async function Zd(){return Tr(`${Va.v1}/categories`)}async function ey(){return Tr(or.subscriptions.v1)}async function ty(e){return Tr(`${or.subscriptions.v1}/${e}`)}async function ny(e){return Ir(`${or.subscriptions.v1}/${e}/cancellations/`,{})}async function oy(e){return Ir(`${or.subscriptions.v1}/${e}/renewals/`,{})}async function iy(e,{paymentMethodId:t,planId:n}){return Ir(`${or.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ay(e){return Tr(`${ar.v1}/${e}`)}async function ry(){return Tr(`${ar.v1}`)}async function ly(e){return Ir(`${ar.v1}/${e}/cancellations/`,{})}async function sy(e){return Ir(`${ar.v1}/${e}/renewals/`,{})}async function cy(e,{paymentMethodId:t,planId:n}){return Ir(`${ar.v1}/${e}`,{paymentMethodId:t,planId:n})}async function uy(){return Tr(or.plans.v1)}async function dy(e){return Tr(`${or.plans.v1}/${e}`)}async function yy(){return Tr(or.invoices.v1)}async function fy(e){return Tr(`${or.invoices.v1}/${e}`)}async function py(e,t){return Tr(`${or.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const gy=["email"];async function Sy(){return Tr(or.paymentMethods.v1)}async function vy(e){return Tr(`${or.paymentMethods.v1}/${e}`)}async function hy(e,t){let{email:n}=t,o=zo(t,gy);return Er(`${or.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function my(e){return kr(or.paymentProviders.stripe.subscriptions.v1,e)}async function Ay(e){return Tr(`${or.paymentProviders.stripe.customers.v1}/${e}`)}async function by(e){return kr(`${or.paymentProviders.stripe.customers.v1}`,e)}async function Ty(){return Tr(`${or.paymentProviders.stripe.publicConfigurations.v1}`)}async function ky(e){return kr(`${or.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ey(e){return Tr(`${or.summaries.v1}/${e}`)}async function Iy(e){return Tr(`${or.tenantConfiguration.v1}/${e}`)}async function Py(e){return kr(`${or.tenantConfiguration.v1}`,e)}async function Ly(){return Tr(ir.v1)}async function Oy(){return Tr(`${or.configurations.vendorPublicConfigurations.v1}`)}let _y,wy,Cy,Uy,Ry,Dy;async function Ny(){return Tr("/vendors/public")}async function My(e){return Tr(Wa.v1,e)}async function Fy(e){return kr(Wa.v1,e)}async function Gy(e,t){return Pr(Wa.v1,e,{headers:Or(t)})}async function $y(e,t,n){return kr(`${Wa.v1}/${e}/roles`,t,{headers:Or(n)})}async function xy(e,t,n){return Pr(`${Wa.v1}/${e}/roles`,t,{headers:Or(n)})}async function Vy(e,t,n){return Er(`${Wa.v1}/${e}/roles`,t,{headers:Or(n)})}async function By(e,t){return kr(tr.v1,e,{headers:Or(t)})}async function jy(e,t){return Pr(`${tr.v1}/${e}`,void 0,{headers:Or(t)})}async function Wy({tenantId:e},t,n){return Er(`${tr.v1}/${e}`,t,{headers:Or(n)})}async function Ky(e,t,n){return Ir(`${Wa.v1}/${e}/access`,t,{headers:Or(n)})}async function Hy(e,t){return kr(`${Wa.v2}/`,e,{headers:Or(t)})}async function zy(){return Tr(`${pr}`)}async function qy(e,t){return Er(`${pr}/${e}`,t)}async function Yy(e){return kr(`${pr}`,e)}async function Jy(e){return Pr(`${pr}/${e}`)}async function Qy(e){return Tr(`${gr}/${e}/Users/count`)}async function Xy(e){return kr(`${Ka.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(_y||(_y={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(wy||(wy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Cy||(Cy={})),(Uy||(Uy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ry||(Ry={})),function(e){e.CREATE="create_customer"}(Dy||(Dy={}));const Zy=["groupId"];async function ef({groupId:e},t){return Tr(`${Ha.v1}/${e}`,U({},t))}async function tf(e){return Tr(`${Ha.v1}`,U({},e))}async function nf(e,t){return kr(`${Ha.getByIds.v1}`,e,{params:t})}async function of(e){return kr(`${Ha.v1}`,e)}async function af(e){let{groupId:t}=e,n=zo(e,Zy);return Er(`${Ha.v1}/${t}`,n)}async function rf(e){return Pr(`${Ha.v1}/${e}`)}async function lf(e,t){return kr(`${Ha.v1}/${e}/roles`,t)}async function sf(e,t){return Pr(`${Ha.v1}/${e}/roles`,t)}async function cf(e,t){return kr(`${Ha.v1}/${e}/users`,t)}async function uf(e,t){return Pr(`${Ha.v1}/${e}/users`,t)}async function df(){return Tr(`${Ha.configurations.v1}`)}async function yf(e){return kr(`${Ha.configurations.v1}`,e)}async function ff(){return Tr(vr.v1)}async function pf(){return Tr(hr.v1)}async function gf(e){return Tr(`${za.v1}`,e)}async function Sf(e){return kr(`${za.v1}`,e)}async function vf(e,t){return Er(`${za.v1}/${e}`,t)}async function hf(e){return Pr(`${za.v1}/${e}`)}async function mf(e,t){return kr(`${za.v1}/${e}/verify`,t)}async function Af(e,t){return kr(`${za.v1}/${e}/delete/verify`,t)}let bf,Tf,kf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(bf||(bf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Tf||(Tf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(kf||(kf={}));const Ef=[/^(.*)\/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],If=`${Ma.v1}/user/token/refresh`,Pf=`${yr}/authorize/silent`,Lf=`${Fa.v2}/me`,Of=`${Fa.v2}/me/tenants`,_f=`${Fa.v3}/me/tenants`;let wf,Cf,Uf,Rf,Df,Nf,Mf,Ff;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(wf||(wf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Cf||(Cf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Uf||(Uf={})),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.CONFIGURE_SSO="CONFIGURE_SSO"}(Rf||(Rf={})),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.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",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Df||(Df={})),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"}(Nf||(Nf={})),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",e.SSO="SSO"}(Ff||(Ff={}));const Gf={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,userPhoneNumbers:k};var $f={fetch:e,ContextHolder:Ua,FronteggContext:Ra,api:Gf,FronteggApiError:Da,AuthStrategyEnum:ko,MachineToMachineAuthStrategy:Eo,SocialLoginProviders:To,ISubscriptionCancellationPolicy:Cy,ISubscriptionStatus:_y,PaymentMethodType:wy,ProviderType:Uy};let xf,Vf;!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"}(xf||(xf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Vf||(Vf={}));const Bf="input is invalid type",jf="undefined"!=typeof ArrayBuffer,Wf="0123456789abcdef".split(""),Kf=[-2147483648,8388608,32768,128],Hf=[24,16,8,0],zf=[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],qf=["hex","array","digest","arrayBuffer"],Yf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),jf&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Jf=function(e){return function(t){const n=new Xf(!0).update(t);return null==n?void 0:n[e]()}},Qf=function(e){return function(t,n){const o=new Zf(t,!0).update(n);return null==o?void 0:o[e]()}};class Xf{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=()=>Xf.prototype.digest(),e?(Yf[0]=Yf[16]=Yf[1]=Yf[2]=Yf[3]=Yf[4]=Yf[5]=Yf[6]=Yf[7]=Yf[8]=Yf[9]=Yf[10]=Yf[11]=Yf[12]=Yf[13]=Yf[14]=Yf[15]=0,this.blocks=Yf):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(Bf);if(null===e)throw new Error(Bf);if(jf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||jf&&ArrayBuffer.isView(e)))throw new Error(Bf);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]<<Hf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Hf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Hf[3&i++],l[i>>2]|=(128|63&o)<<Hf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Hf[3&i++],l[i>>2]|=(128|o>>6&63)<<Hf[3&i++],l[i>>2]|=(128|63&o)<<Hf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Hf[3&i++],l[i>>2]|=(128|o>>12&63)<<Hf[3&i++],l[i>>2]|=(128|o>>6&63)<<Hf[3&i++],l[i>>2]|=(128|63&o)<<Hf[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]|=Kf[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+zf[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+zf[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+zf[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+zf[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=Wf[e>>28&15]+Wf[e>>24&15]+Wf[e>>20&15]+Wf[e>>16&15]+Wf[e>>12&15]+Wf[e>>8&15]+Wf[e>>4&15]+Wf[15&e]+Wf[t>>28&15]+Wf[t>>24&15]+Wf[t>>20&15]+Wf[t>>16&15]+Wf[t>>12&15]+Wf[t>>8&15]+Wf[t>>4&15]+Wf[15&t]+Wf[n>>28&15]+Wf[n>>24&15]+Wf[n>>20&15]+Wf[n>>16&15]+Wf[n>>12&15]+Wf[n>>8&15]+Wf[n>>4&15]+Wf[15&n]+Wf[o>>28&15]+Wf[o>>24&15]+Wf[o>>20&15]+Wf[o>>16&15]+Wf[o>>12&15]+Wf[o>>8&15]+Wf[o>>4&15]+Wf[15&o]+Wf[i>>28&15]+Wf[i>>24&15]+Wf[i>>20&15]+Wf[i>>16&15]+Wf[i>>12&15]+Wf[i>>8&15]+Wf[i>>4&15]+Wf[15&i]+Wf[a>>28&15]+Wf[a>>24&15]+Wf[a>>20&15]+Wf[a>>16&15]+Wf[a>>12&15]+Wf[a>>8&15]+Wf[a>>4&15]+Wf[15&a]+Wf[r>>28&15]+Wf[r>>24&15]+Wf[r>>20&15]+Wf[r>>16&15]+Wf[r>>12&15]+Wf[r>>8&15]+Wf[r>>4&15]+Wf[15&r];return s+=Wf[l>>28&15]+Wf[l>>24&15]+Wf[l>>20&15]+Wf[l>>16&15]+Wf[l>>12&15]+Wf[l>>8&15]+Wf[l>>4&15]+Wf[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 Zf extends Xf{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(Bf);if(null===e)throw new Error(Bf);if(jf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||jf&&ArrayBuffer.isView(e)))throw new Error(Bf)}var i;e.length>64&&(e=null==(i=new Xf(!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}Xf.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();Xf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Xf.prototype.finalize.call(this)}}}const ep=function(){const e=Jf("hex");e.create=function(){return new Xf},e.update=function(t){return e.create().update(t)};for(let t=0;t<qf.length;++t){const n=qf[t];e[n]=Jf(n)}return e}();function tp(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function np(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=ep.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function op(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=Qf("hex");e.create=function(e){return new Zf(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<qf.length;++t){const n=qf[t];e[n]=Qf(n)}}();const ip=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*ap(e){const t=yield Fi((e=>e.root.appName));return _l.getFeatureFlags(e,t)}const rp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},lp=U({},rp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),sp=[{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"}],cp={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},up=U({},cp,{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}),dp={loading:!1,error:void 0,saving:!0,profile:cp},yp={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"},fp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:ko.EmailAndPassword,machineToMachineAuthStrategy:Eo.ClientCredentials},pp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},gp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Sp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},vp={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},hp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},mp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Ap={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:vp,roles:mp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},bp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Tp={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:[sp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[sp[0]],managedBy:Uf.FRONTEGG}]},kp={id:Tp.id,email:Tp.email,name:Tp.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[sp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Ep={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:[sp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[sp[0]],managedBy:Uf.FRONTEGG}]},Ip={id:Ep.id,email:Ep.email,name:Ep.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[sp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Pp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Lp=[Ep,Tp],Op=[Ip,kp],_p=[Pp],wp=[{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}],Cp=[{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"}],Up={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Rp={isActive:!0,strategy:Bn.ALLOW},Dp=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Bn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Bn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Bn.BLOCK,description:"IP 4"}],Np=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},Ep,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Mp=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"}),Fp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Np(6),roles:[Mp("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Uf.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Np(44),roles:[Mp("Editor")],managedBy:Uf.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Np(8),roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Np(5),roles:[Mp("Admin")],managedBy:Uf.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Np(21),description:"BDR, AE, and inside sales",roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Np(23),description:"Dev success and customer success",roles:[Mp("Admin")],managedBy:Uf.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Np(10),description:"The marketing department",roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Np(4),description:"Human resources",roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Np(3),roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Np(8),roles:[Mp("Editor")],managedBy:Uf.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Np(4),roles:[Mp("Viewer")],managedBy:Uf.FRONTEGG}],Gp={scoring:{score:79},recommendations:{items:[{code:Rf.FORCE_MFA,severity:Mf.WARNING,category:Ff.MFA},{code:Rf.ENABLE_FORCE_RELOGIN,severity:Mf.WARNING,category:Ff.SESSIONS}]}},$p={insights:{items:[{category:Ff.MFA,code:Df.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Ff.SESSIONS,code:Df.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Ff.PASSWORD,code:Df.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Ff.DOMAIN,code:Df.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},xp={users:Op,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Vp={users:[Op[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},Bp={users:[Op[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let jp,Wp,Kp;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(jp||(jp={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Wp||(Wp={})),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 Hp=(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,zp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},qp=e=>{const{pathname:t}=new URL(e),n=zp(e);return n?t+n:t},Yp=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Jp="tenantId",Qp=e=>e.mfaRequired&&e.mfaToken?(Ua.setAccessToken(null),Ua.setUser(null),!0):(Ua.setAccessToken(e.accessToken),Ua.setUser(e),!1),Xp=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 ln.authenticatorApp;if(t)return ln.smsVerifyCode}return ln.verify},Zp=e=>{if(1===e.length){const[t]=e;if(t===gl.AuthenticatorApp)return ln.authenticatorApp;if(t===gl.SMS)return ln.smsSetPhoneNumber;if(t===gl.EmailCode)return ln.emailVerifyCode}return ln.verify},eg=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...eg(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),tg=["callback"];function*ng(){yield Ci(Do.setCustomLoginState({loading:!0}));try{const e=yield Di(Gf.metadata.getAdminBoxMetadata);yield Ci(Do.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Ci(Do.setCustomLoginState({loading:!1,error:Hp(e)}))}}function*og(e){let{payload:{callback:t}}=e,n=zo(e.payload,tg);try{yield Ci(Do.setCustomLoginState({error:null,saving:!0}));const e=eg(n);if(0===e.length)throw new Error("No changes to update");yield Di(Gf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Di(Gf.metadata.getAdminBoxMetadata);yield Ci(Do.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setCustomLoginState({error:Hp(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*ig(){var e;const[t]=yield Di(ap,["admin_portal_login_per_tenant"]),n=!(null==(e=Ua.getContext())||!e.tenantResolver);if(yield Fi((e=>e.auth.isAuthenticated))){var o;const e=yield null!=(o=Fi((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&o;return t&&n&&e}return t&&n}function*ag(){try{var e;if(!(yield Di(ig)))return;const t=yield Fi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=Gf.accountSettings,{applicationUrl:i}=yield Di(t?n:o);if(!i)return;const{routes:a}=yield Fi((e=>e.auth)),r=null!=(e=zp(i))?e:"";yield Ci(Do.setState({routes:U({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield Ci(Do.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*rg(){yield Ca(Do.loadTenantMetadata,ng),yield Ca(Do.updateTenantMetadata,og)}let lg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(lg||(lg={}));const sg=["callback"];function cg(e){return function*(t){const[n]=yield Di(ap,["security-center-admin-portal"]);yield e(t),n&&(yield ug(),yield dg())}}function*ug(){const e=lg.RECOMMENDATIONS;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Di(Gf.securityCenter.getRecommendations);yield Ci(Do.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==o?void 0:o.score)?t:0}))}catch(t){yield Ci(Do.setSecurityCenterStateError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}}function*dg(){const e=lg.INSIGHTS;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Di(Gf.securityCenter.getInsights);yield Ci(Do.setSecurityCenterState({insights:t.items}))}catch(t){yield Ci(Do.setSecurityCenterStateError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}}function*yg(e){let{payload:{callback:t}}=e,n=zo(e.payload,sg);const o=lg.SEND_BREACHED_PASSWORD_EMAIL;yield Ci(Do.setSecurityCenterStateError({key:o,value:!1})),yield Ci(Do.setSecurityCenterStateLoader({key:o,value:!0}));try{yield Di(Gf.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Ci(Do.setSecurityCenterStateError({key:o,value:Hp(e)})),null==t||t(!1,e)}finally{yield Ci(Do.setSecurityCenterStateLoader({key:o,value:!1}))}}function*fg({payload:{callback:e}}){const t=lg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Ci(Do.setSecurityCenterStateError({key:t,value:!1})),yield Ci(Do.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Di(Gf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Ci(Do.setSecurityCenterStateError({key:t,value:Hp(n)})),null==e||e(!1)}finally{yield Ci(Do.setSecurityCenterStateLoader({key:t,value:!1}))}}function*pg({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r,_maxInactiveSeconds:l}){var s,c,u,d;yield Ci(Do.setSecurityCenterStateError({key:e,value:!1})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(s=null!=o?o:null==t||null==(c=t.queryParams)?void 0:c._offset)?s:0,f=null!=(u=null!=i?i:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=U({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:l},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Di(Gf.users.getUsersV3,p),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:y,queryParams:U({_offset:y,_limit:f,_maxInactiveSeconds:l},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Di(Gf.roles.getRoles),o=yield Di(Gf.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return U({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield Ci(Do.setSecurityCenterState({[n]:U({users:e},a)}))}else yield Ci(Do.setSecurityCenterState({[n]:U({users:[]},a)}))}catch(t){yield Ci(Do.setSecurityCenterStateError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}}function*gg({payload:e}){var t;const n=lg.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Fi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield pg(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:yo.BREACHED_PASSWORDS,tableState:o},e))}function*Sg({payload:e}){var t;const n=lg.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Fi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield pg(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:yo.MFA_UNENROLLED,tableState:o},e))}function*vg({payload:e}){var t;const n=lg.INACTIVE_USERS_TABLE,o=yield null!=(t=Fi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield pg(U({key:n,updateStateKey:"inactiveUsersTable",_preset:yo.INACTIVE,tableState:o},e))}function*hg(){yield _a(Do.loadRecommendations,ug),yield _a(Do.loadInsights,dg),yield _a(Do.sendResetBreachedPasswordEmail,yg),yield _a(Do.sendBulkResetBreachedPasswordEmails,fg),yield _a(Do.loadBreachedPasswordUsers,gg),yield _a(Do.loadUnenrolledMfaUsers,Sg),yield _a(Do.loadInactiveUsers,vg)}function*mg(){const e=lg.RECOMMENDATIONS;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0})),yield Gi(500),yield Ci(Do.setSecurityCenterState({recommendations:Gp.recommendations.items,score:Gp.scoring.score})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}function*Ag(){const e=lg.INSIGHTS;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0})),yield Gi(500),yield Ci(Do.setSecurityCenterState({insights:$p.insights.items})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}function*bg(){const e=lg.BREACHED_PASSWORD_USERS_TABLE;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0})),yield Gi(500),yield Ci(Do.setSecurityCenterState({breachedPasswordUsersTable:xp})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}function*Tg(){const e=lg.UNENROLLED_MFA_USERS_TABLE;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0})),yield Gi(500),yield Ci(Do.setSecurityCenterState({unenrolledMfaUsersTable:Bp})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}function*kg(){const e=lg.INACTIVE_USERS_TABLE;yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!0})),yield Gi(500),yield Ci(Do.setSecurityCenterState({inactiveUsersTable:Vp})),yield Ci(Do.setSecurityCenterStateLoader({key:e,value:!1}))}function*Eg({payload:{callback:e}}){const t=lg.SEND_BREACHED_PASSWORD_EMAIL;yield Ci(Do.setSecurityCenterStateLoader({key:t,value:!0})),yield Gi(500),null==e||e(!0),yield Ci(Do.setSecurityCenterStateLoader({key:t,value:!1}))}function*Ig(){yield _a(Do.loadRecommendations,mg),yield _a(Do.loadInsights,Ag),yield _a(Do.loadBreachedPasswordUsers,bg),yield _a(Do.loadUnenrolledMfaUsers,Tg),yield _a(Do.loadInactiveUsers,kg),yield _a(Do.sendResetBreachedPasswordEmail,Eg)}const Pg=["callback"],Lg=["callback"],Og=["callback"],_g=["callback"],wg=["callback"],Cg=["callback"];function*Ug(){yield Ci(Do.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getGlobalSecurityPolicy);yield Ci(Do.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyGlobalState({error:Hp(e),loading:!1}))}yield Ci(Do.loadSecurityPolicyMfa()),yield Ci(Do.loadSecurityPolicyVendorMfa()),yield Ci(Do.loadSecurityPolicyLockout()),yield Ci(Do.loadSecurityPolicyVendorLockout()),yield Ci(Do.loadSecurityPolicyVendorPasswordHistory()),yield Ci(Do.loadSecurityPolicyCaptcha()),yield Ci(Do.loadPublicAuthStrategiesPolicy())}function*Rg(e){var t,n;if(!(yield Di(ig)))return e;const o=yield Di(Ng);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*Dg(){yield Ci(Do.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getVendorConfig),t=yield Rg(e);yield Ci(Do.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyPublicState({error:Hp(e),loading:!1}))}}function*Ng(){const e=yield Fi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Di(Gf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Di(Gf.auth.getVendorPublicAuthStrategiesConfig),t}function*Mg(){yield Ci(Do.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Di(Ng);yield function*(e){const t=yield Di(ig);if(!e||!t)return;const{policy:n}=yield Fi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Ci(Do.setSecurityPolicyPublicState({policy:U({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Ci(Do.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyAuthStrategyPublicState({error:Hp(e),loading:!1}))}}function*Fg(){yield Ci(Do.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getMfaPolicy);yield Ci(Do.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyMfaState({error:Hp(e),loading:!1}))}}function*Gg(){yield Ci(Do.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getVendorMfaPolicy);yield Ci(Do.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyVendorMfaState({error:Hp(e),loading:!1}))}}function*$g(e){let{payload:{callback:t}}=e,n=zo(e.payload,Pg);yield Ci(Do.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Di(Gf.auth.saveMfaPolicy,n);yield Ci(Do.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setSecurityPolicyMfaState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*xg(){yield Ci(Do.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getLockoutPolicy);yield Ci(Do.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyLockoutState({error:Hp(e),loading:!1}))}}function*Vg(e){let{payload:{callback:t}}=e,n=zo(e.payload,Lg);yield Ci(Do.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Di(Gf.auth.saveLockoutPolicy,n);yield Ci(Do.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setSecurityPolicyLockoutState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*Bg(){yield Ci(Do.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getVendorLockoutPolicy);yield Ci(Do.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyVendorLockoutState({error:Hp(e),loading:!1}))}}function*jg(){yield Ci(Do.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getCaptchaPolicy);yield Ci(Do.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyCaptchaState({error:Hp(e),loading:!1}))}}function*Wg(){yield Ci(Do.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getPasswordHistoryPolicy);yield Ci(Do.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyPasswordHistoryState({error:Hp(e),loading:!1}))}}function*Kg(){yield Ci(Do.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getVendorPasswordHistoryPolicy);yield Ci(Do.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyVendorPasswordHistoryState({error:Hp(e),loading:!1}))}}function*Hg(e){let{payload:{callback:t}}=e,n=zo(e.payload,Og);yield Ci(Do.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Di(Gf.auth.savePasswordHistoryPolicy,n);yield Ci(Do.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setSecurityPolicyPasswordHistoryState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*zg(){yield Ci(Do.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getPasswordConfigPolicy);yield Ci(Do.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyPasswordState({error:Hp(e),loading:!1}))}}function*qg(){yield Ca(Do.loadSecurityPolicy,Ug),yield _a(Do.saveSecurityPolicyMfa,cg($g)),yield _a(Do.loadSecurityPolicyMfa,Fg),yield _a(Do.loadSecurityPolicyVendorMfa,Gg),yield _a(Do.saveSecurityPolicyLockout,cg(Vg)),yield _a(Do.loadSecurityPolicyLockout,xg),yield _a(Do.loadSecurityPolicyVendorLockout,Bg),yield _a(Do.loadSecurityPolicyCaptcha,jg),yield _a(Do.saveSecurityPolicyPasswordHistory,cg(Hg)),yield _a(Do.loadSecurityPolicyPasswordHistory,Wg),yield _a(Do.loadSecurityPolicyVendorPasswordHistory,Kg),yield _a(Do.loadVendorPasswordConfig,zg),yield _a(Do.loadPublicSecurityPolicy,Dg),yield _a(Do.loadPublicAuthStrategiesPolicy,Mg)}function*Yg(){yield Ci(Do.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Ci(Do.setSecurityPolicyPublicState({policy:fp,loading:!1}))}catch(e){yield Ci(Do.setSecurityPolicyPublicState({error:Hp(e),loading:!1}))}}function*Jg(){yield Ci(Do.setSecurityPolicyGlobalState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyGlobalState({policy:yp,loading:!1})),yield Ci(Do.loadSecurityPolicyMfa()),yield Ci(Do.loadSecurityPolicyVendorMfa()),yield Ci(Do.loadSecurityPolicyLockout()),yield Ci(Do.loadSecurityPolicyVendorLockout()),yield Ci(Do.loadSecurityPolicyPasswordHistory()),yield Ci(Do.loadSecurityPolicyVendorPasswordHistory()),yield Ci(Do.loadSecurityPolicyCaptcha())}function*Qg(){yield Ci(Do.setSecurityPolicyMfaState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyMfaState({policy:pp,loading:!1}))}function*Xg(){yield Ci(Do.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyVendorMfaState({policy:pp,loading:!1}))}function*Zg(e){var t;let{payload:{callback:n}}=e,o=zo(e.payload,_g);yield Ci(Do.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},gp,{id:null!=(t=o.id)?t:gp.id,enforceMFAType:o.enforceMFAType});yield bt(),yield Ci(Do.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*eS(){yield Ci(Do.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyLockoutState({policy:gp,loading:!1}))}function*tS(){yield Ci(Do.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyVendorLockoutState({policy:gp,loading:!1}))}function*nS(e){let{payload:{callback:t}}=e,n=zo(e.payload,wg);yield Ci(Do.setSecurityPolicyLockoutState({saving:!0,error:null})),yield bt();const o=U({},gp,n,{id:n.id?n.id:gp.id});null==t||t(o),yield Ci(Do.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*oS(){yield Ci(Do.setSecurityPolicyLockoutState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyLockoutState({policy:gp,loading:!1}))}function*iS(){yield Ci(Do.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyPasswordHistoryState({policy:Sp,loading:!1}))}function*aS(){yield Ci(Do.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield bt(),yield Ci(Do.setSecurityPolicyVendorPasswordHistoryState({policy:Sp,loading:!1}))}function*rS(e){let{payload:{callback:t}}=e,n=zo(e.payload,Cg);yield Ci(Do.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield bt();const o=U({},Sp,n,{id:n.id?n.id:Sp.id});null==t||t(o),yield Ci(Do.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*lS(){yield Ca(Do.loadSecurityPolicy,Jg),yield _a(Do.loadPublicSecurityPolicy,Yg),yield _a(Do.saveSecurityPolicyMfa,Zg),yield _a(Do.loadSecurityPolicyMfa,Qg),yield _a(Do.loadSecurityPolicyVendorMfa,Xg),yield _a(Do.saveSecurityPolicyLockout,nS),yield _a(Do.loadSecurityPolicyLockout,eS),yield _a(Do.loadSecurityPolicyVendorLockout,tS),yield _a(Do.loadSecurityPolicyCaptcha,oS),yield _a(Do.saveSecurityPolicyPasswordHistory,rS),yield _a(Do.loadSecurityPolicyPasswordHistory,iS),yield _a(Do.loadSecurityPolicyVendorPasswordHistory,aS)}const sS=["events","url"];function*cS(){yield Ci(Do.setSignUpState({loading:!0}));try{const e=yield Di(Gf.auth.getVendorConfig),t=yield Rg(e),{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield Ci(Do.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield Ci(Do.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Ci(Do.setSignUpState({loading:!1,error:Hp(e),firstLoad:!1}))}}function*uS(e){let{payload:{events:t,url:n}}=e,o=zo(e.payload,sS);yield Ci(Do.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Fi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c,tenants:u=[],activeTenant:d}=yield Di(Gf.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:Wp.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(!r&&l&&Qp(l)){const t=yield QS(l);yield Ci(Do.setState(t)),a(e.loginUrl)}else{const{tenantsState:e}=yield Fi((e=>e.auth));yield Ci(Do.setSignUpState({loading:!1,shouldActivate:r,stage:vn.SignUpSuccess})),yield Ci(Do.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:U({},e,{tenants:u,activeTenant:d})}))}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield Ci(Do.setSignUpState({loading:!1,error:Hp(e)}))}yield Ci(Do.setSignUpState({loading:!1}))}function*dS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Fi((e=>e.auth.signUpState));yield Ci(Do.resetSignUpState()),yield Ci(Do.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*yS(){yield Ca(Do.signUpUser,uS),yield Ca(Do.resetSignUpStateSoft,dS)}const fS={setVendorState:(e,{payload:t})=>U({},e,t)},pS={loadVendorPublicInfo:ut("vendor/loadVendorPublicInfo")},gS={loading:!1},{reducer:SS,actions:vS}=yt({name:Dt,initialState:gS,reducers:U({},fS)}),hS=U({},vS,pS);function*mS(){yield Ci(hS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Gf.vendor.getVendorPublicInfo();yield Ci(hS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Ci(hS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var AS=n(378),bS=n.n(AS);function TS(e,t){return bS()(e,t)}function*kS({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Di(Gf.entitlements.loadEntitlements);yield function*(e){TS(yield Fi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Ci(Do.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*ES(){yield Ca(Do.loadEntitlements,kS)}const IS=["callback"],PS=["callback"],LS=["callback"],OS=["callback"],_S=["callback","events"],wS=["callback"],CS=["callback"],US=["callback"],RS=["callback"],DS=["user"],NS=["callback"],MS=["callback"],FS=["callback"],GS=["callback"],$S=["callback"],xS=["callback","deviceId"],VS=["callback"],BS=["callback"],jS=["callback","deviceId"],WS=["callback","deviceId"],KS=["callback","deviceId"];function*HS(e){const t=yield Fi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return TS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*zS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Fi((e=>e.auth));yield Ci(Do.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*qS(){const e=Ua.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield Fi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;u||(yield Di(ag),u=yield Fi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})));const d=window.localStorage.getItem(_t);d&&![a,r,l,s].includes(d)&&(c=d),window.localStorage.removeItem(_t),yield bt(200),Ci(Do.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?qp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*YS(){let e;try{var t;const n=yield Di(Gf.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Ci(Do.setState({ssoACS:e}))}function*JS(){try{const{isActive:e}=yield Di(Gf.auth.getSSOPublicConfiguration);yield Ci(Do.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*QS(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield Fi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Di(Gf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Xp(e.mfaDevices)}:(n={step:Zp(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},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*XS(e){var t;const{routes:n,loginState:o}=yield Fi((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*ZS(){const{hostedLoginBox:e}=yield Fi((e=>e.auth));e?yield Di(ev):yield Di(nv)}function*ev(){const{user:e}=yield Fi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.setUser(null),void(yield Ci(Do.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Di(Gf.auth.exchangeOAuthTokensV2,t),o=yield Di(HS,n.user);yield Di(zS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield Ci(Do.setState({user:null,isAuthenticated:!1}))}}function*tv(){const{user:e}=yield Fi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.setUser(null),void(yield Ci(Do.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Di(Gf.auth.exchangeOAuthTokensV2,t),o=yield Di(HS,n.user);yield Di(zS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield Ci(Do.setState({user:null,isAuthenticated:!1}))}}function*nv(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Fi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Di(Gf.auth.refreshTokenV3);if(Qp(i)){const e=yield QS(i);yield Ci(Do.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 XS(i),l=yield Di(HS,i);yield Di(zS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield iv(n)}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield Ci(Do.setState({user:void 0,isAuthenticated:!1}))}}function*ov(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Fi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Di(Gf.auth.refreshTokenV3);if(Qp(i)){const e=yield QS(i);yield Ci(Do.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Di(HS,i);if(yield Di(mv))yield Ci(Do.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield Di(zS,{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 XS(i);yield Di(zS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield iv(n)}}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield Ci(Do.setState({user:void 0,isAuthenticated:!1}))}}function*iv(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ua.onRedirectTo,{routes:i,loginState:a}=yield Fi((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 qS())}function*av({payload:{callback:e}}){try{const{ip:t}=yield Di(Gf.metadata.getCurrentUserIpMetadata);yield Ci(Do.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*rv({payload:e}){const t=[];(yield Di(ig))?yield Di(ZS):t.push(Di(ZS)),e&&(yield Ci(Do.setState({isLoading:!0})),yield Ci(Do.loadSocialLoginsConfigurationV2()),t.push(Di(cS)),t.push(Di(Mg)),t.push(Di(JS)),t.push(Di(mS)),t.push(Di(YS)),t.push(Di(ag))),yield Ui(t),yield Ci(Do.setState({isLoading:!1}))}function*lv({accessToken:e,user:t}){if(!e)return void(yield Ci(Do.setState({user:void 0,isAuthenticated:!1})));const n=Ua.onRedirectTo,{routes:o}=yield Fi((e=>e.auth));if(Qp(t)){const e=yield QS(t);yield Ci(Do.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*sv({payload:e}){const t=[];yield Ci(Do.loadSocialLoginsConfigurationV2()),t.push(Di(cS)),t.push(Di(JS)),t.push(Di(mS)),t.push(Di(YS)),t.push(Di(lv,e)),t.push(Di(ag)),yield Ui(t)}const cv=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}};function*uv(){const e=yield Di(Gf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Di(zS,e,{isAuthenticated:!0,isLoading:!1})}function*dv({payload:e}){const{disableSilentRefresh:t}=yield Fi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield uv()}catch(t){yield fv(e)}}function*yv({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Fi((e=>({urlStrategy:e.root.urlStrategy}))),t=cv(e);if(yield Ci(Do.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:o}=yield Fi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(o)throw new Error("silent refresh is disabled");yield uv()}catch(n){if(!t)return void(yield Ci(Do.setState({isLoading:!1})));yield fv(e)}}function*fv(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield Fi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(cv(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Ci(Do.setState({isLoading:!0}));const a=op(),r=op(),l=yield Di(np,r);localStorage.setItem(wt,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Di(ag);const c=yield Fi((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=`${mr(n,"/oauth/authorize")}/oauth/authorize`,d=U({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=Yp(Jp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*pv({payload:e}){const t=localStorage.getItem(wt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield Fi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;yield Di(ag);const a=yield Fi((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 Di(Gf.auth.exchangeOAuthTokensV2,r);yield Di(zS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Ci(Do.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield qS()}}function*gv(e){let{payload:{callback:t}}=e,n=zo(e.payload,IS);try{yield Ci(Do.setLoginState({loading:!0}));const e=yield Di(Gf.auth.changePhoneNumberWithVerification,n);yield Ci(Do.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e),loading:!1}))}}function*Sv(e){let{payload:{callback:t}}=e,n=zo(e.payload,PS);try{yield Ci(Do.setLoginState({loading:!0})),yield Di(Gf.auth.verifyChangePhoneNumber,n),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e),loading:!1}))}}function*vv(e){let{payload:{callback:t}}=e,n=zo(e.payload,LS);try{yield Ci(Do.setLoginState({loading:!0}));const e=yield Di(Gf.auth.passwordlessPreLogin,U({},n,{type:ko.SmsCode}));yield Ci(Do.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e),loading:!1})),null==t||t(e)}}function*hv(e){let{payload:{callback:t}}=e,n=zo(e.payload,OS);try{const{onRedirectTo:e,routes:o}=yield Fi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ci(Do.setLoginState({loading:!0}));const i=yield Di(Gf.auth.passwordlessPreLogin,n),a=Io[n.type];if(a===Pt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield Ci(Do.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Jt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield Ci(Do.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield Ci(Do.setLoginState({error:Hp(e),loading:!1})),null==t||t()}}function*mv(){const{publicAuthStrategyPolicy:e}=yield Fi((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===fl.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Di(ap,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Di(Gf.auth.getWebAuthnDevices);return yield Ci(Do.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Av(e){let{payload:{callback:t,events:n}}=e,o=zo(e.payload,_S);try{yield Ci(Do.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Di(Gf.auth.passwordlessPostLoginV2,o),l=Ua.onRedirectTo,{routes:s}=yield Fi((e=>e.auth));if(Qp(e)){const t=yield QS(e);yield Ci(Do.setState(t)),l(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield Fi((e=>e.auth));var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:jp.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Di(zS,{user:e,tenants:a,activeTenant:r}),yield Ci(Do.setLoginState({error:void 0})),yield Ci(Do.setState({isLoading:!1})),o.flow===Lt.Login?(yield Di(mv))?(yield Ci(Do.setLoginState({step:Pt.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield Ci(Do.setState({isAuthenticated:!0})),yield qS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Ci(Do.setLoginState({error:Hp(e,"Failed to authenticate")}))}finally{yield Ci(Do.setLoginState({loading:!1}))}}function*bv({payload:e}){try{yield Ci(Do.setLoginState({loading:!0}));const{name:t}=yield Di(Gf.auth.verifyInviteToken,e);yield Ci(Do.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Ci(Do.setLoginState({inviteTokenError:Hp(e,"We couldn't verify your invitation")}))}finally{yield Ci(Do.setLoginState({loading:!1}))}}function*Tv({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield Ci(Do.setLoginState({loading:!0}));try{const i=yield Fi((({auth:{onRedirectTo:e}})=>e)),a=Yp(Jp),{address:r,idpType:l}=yield Di(Gf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Vf.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield Fi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield Ci(Do.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield kv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield kv({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*kv(e){let{callback:t}=e,n=zo(e,wS);const o=yield Fi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield Ci(Do.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===ko.EmailAndPassword?(yield Ci(Do.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[ko.MagicLink,ko.Code,ko.SmsCode].includes(null==o?void 0:o.authStrategy)?yield Ci(Do.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield Ci(Do.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*Ev({payload:{callback:e}}){try{yield Ci(Do.setLoginState({loading:!0}));const{options:t}=yield Di(Gf.auth.webAuthnCreateNewDeviceSession);t.user.id=Et(t.user.id),t.challenge=Et(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Ci(Do.setLoginState({error:Hp(t)})),null==e||e(null)}finally{yield Ci(Do.setLoginState({loading:!1}))}}function*Iv(e){let{payload:{callback:t}}=e,n=zo(e.payload,CS);try{yield Ci(Do.setLoginState({loading:!0}));const e=It(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?pl.Platform:pl.CrossPlatform;yield Di(Gf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e)})),null==t||t(null)}finally{yield Ci(Do.setLoginState({loading:!1}))}}function*Pv(e){let{payload:{callback:t}}=e,n=zo(e.payload,US);try{var o;yield Ci(Do.setPasskeysState({loading:!0})),yield Ci(Do.setLoginState({loading:!0}));const{options:e}=yield Di(Gf.auth.webAuthnPreLogin,n);e.challenge=Et(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)}))),yield Ci(Do.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Ci(Do.setLoginState({error:Hp(e)})),null==t||t(null)}finally{yield Ci(Do.setPasskeysState({loading:!1})),yield Ci(Do.setLoginState({loading:!1}))}}function*Lv(e){let{payload:{callback:t}}=e,n=zo(e.payload,RS);try{var o;yield Ci(Do.setPasskeysState({loading:!0})),yield Ci(Do.setLoginState({loading:!0}));const e=It(n.publicKey),i=yield Di(Gf.auth.webAuthnPostLoginV2,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=i,r=zo(i,DS);if(Qp(a)){const e=Ua.onRedirectTo,{routes:t}=yield Fi((e=>e.auth)),n=yield QS(a);yield Ci(Do.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Di(zS,U({user:a},r),{isAuthenticated:!0}),yield Ci(Do.setLoginState({error:void 0})),yield qS(),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e)})),null==t||t(null)}finally{yield Ci(Do.setPasskeysState({loading:!1})),yield Ci(Do.setLoginState({loading:!1}))}}function*Ov({payload:e}){const{onRedirectTo:t,routes:n}=yield Fi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Ci(Do.setLoginState({loading:!0}));try{const t=yield Di(Gf.auth.postLogin,e);yield Ci(Do.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield qS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Ci(Do.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*_v({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield Ci(Do.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:l}=yield Di(Gf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Ua.onRedirectTo,{routes:c}=yield Fi((e=>e.auth));if(Qp(a)){const e=yield QS(a);yield Ci(Do.setState(e)),s(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Fi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Di(zS,{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===Lt.Login?Pt.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[o]=yield Di(ap,["security-center-show-login-flows"]);t.flow===Lt.Login&&(o&&a.isBreachedPassword?yield Ci(Do.setLoginState({step:Pt.breachedPassword,loading:!1})):n&&((yield Di(mv))?(yield Ci(Do.setLoginState({step:Pt.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield qS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ua.setAccessToken(null),Ua.setUser(null),null==i||i(!1,t),yield Ci(Do.setLoginState({email:e,error:Hp(t),loading:!1}))}}function*wv({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield Ci(Do.setLoginState({loading:!0}));try{const{user:i,tenants:a=[],activeTenant:r}=yield Di(Gf.auth.loginWithMfaV2,{mfaToken:e,value:t,rememberDevice:n}),{loginState:l}=yield Fi((e=>e.auth)),s=l.flow===Lt.Login?Pt.success:l.step,c=!!i.accessToken;yield Di(zS,{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 Ci(Do.setLoginState({error:void 0,loading:!1}));const[u]=yield Di(ap,["security-center-show-login-flows"]);l.flow===Lt.Login&&(u&&l.isBreachedPassword?yield Ci(Do.setLoginState({step:Pt.breachedPassword,loading:!1})):(yield Di(mv))?yield Ci(Do.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield qS()),null==o||o(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e),loading:!1})),null==o||o(!1,e)}}function*Cv({payload:e}){yield Ci(Do.setLoginState({loading:!0}));try{var t;yield Di(Gf.auth.recoverMfaToken,e),yield Ci(Do.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield Ci(Do.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setLoginState({error:Hp(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Uv({payload:e}){const{hostedLoginBox:t}=yield Fi((e=>e.auth));yield Ci(Do.setState({isLoading:!0}));try{t?yield Di(Gf.auth.OAuthLogout):yield Di(Gf.auth.logout)}catch{}yield Ci(Do.resetState()),yield Ci(Do.requestAuthorize(!0)),null==e||e()}function*Rv({payload:e}){var t;try{yield Di(Gf.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*Dv({user:e,tenants:t,activeTenant:n}){const o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield Ci(Do.setMfaState(o)),yield Ci(Do.setUser(e)),yield Ci(Do.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Nv({user:e,tenants:t,activeTenant:n}){const{loginState:o}=yield Fi((e=>e.auth));yield Ci(Do.setUser(e)),yield Ci(Do.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield Fi((e=>e.auth.mfaState)),[a]=yield Di(ap,["security-center-show-login-flows"]);if(o.flow===Lt.Login)if(a&&o.isBreachedPassword)yield Ci(Do.setLoginState({step:Pt.breachedPassword,loading:!1}));else{const e=yield Di(mv);i===ln.smsVerifyCode&&e?yield Ci(Do.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield qS()}yield Ci(Do.setState({isAuthenticated:!!e.accessToken}))}function*Mv(e){let{payload:{callback:t}}=e,n=zo(e.payload,NS);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.preEnrollMFASMSForLogin,n);yield Ci(Do.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Fv(e){let{payload:{callback:t}}=e,n=zo(e.payload,MS);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.enrollMFASMSForLoginV2,n);yield Dv(e),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Gv(e){let{payload:{callback:t}}=e,n=zo(e.payload,FS);yield Ci(Do.setLoginState({loading:!0}));try{var o;const e=yield Di(Gf.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:Et(e.options.challenge),user:U({},e.options.user,{id:Et(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Ci(Do.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*$v(e){let{payload:{callback:t}}=e,n=zo(e.payload,GS);yield Ci(Do.setLoginState({loading:!0}));try{const e=It(n.publicKey),o=yield Di(Gf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield Dv(o),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*xv(e){let{payload:{callback:t}}=e,n=zo(e.payload,$S);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Dv(e),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Vv(e){let{payload:{callback:t,deviceId:n}}=e,o=zo(e.payload,xS);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.preVerifyMFASMSForLogin,n,o);yield Ci(Do.setMfaState({otcToken:e.otcToken,step:ln.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Bv(e){let{payload:{callback:t}}=e,n=zo(e.payload,VS);try{const e=yield Di(Gf.auth.preVerifyMFAEmailCode,n);yield Ci(Do.setMfaState({otcToken:e.otcToken,step:ln.emailVerifyCode})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({error:Hp(e)})),null==t||t(null)}}function*jv(e){let{payload:{callback:t}}=e,n=zo(e.payload,BS);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.verifyMFAEmailCodeV2,n);yield Nv(e),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Wv(e){let{payload:{callback:t,deviceId:n}}=e,o=zo(e.payload,jS);yield Ci(Do.setLoginState({loading:!0}));try{const e=yield Di(Gf.auth.verifyMFASMSForLoginV2,n,o);yield Nv(e),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Kv(e){let{payload:{callback:t,deviceId:n}}=e,o=zo(e.payload,WS);yield Ci(Do.setLoginState({loading:!0}));try{var i;const e=yield Di(Gf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:Et(e.id)})))});yield Ci(Do.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*Hv(e){let{payload:{callback:t,deviceId:n}}=e,o=zo(e.payload,KS);yield Ci(Do.setLoginState({loading:!0}));try{const e=It(o.publicKey),i=yield Di(Gf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield Nv(i),yield Ci(Do.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)})),null==t||t(null)}}function*zv({payload:e}){yield Ci(Do.setLoginState({loading:!0}));try{yield Di(Gf.auth.forgotPassword,e),yield Ci(Do.setLoginState({loading:!1,error:void 0,step:Pt.breachedPasswordSuccess})),yield Ci(Do.setState({isAuthenticated:!1}))}catch(e){yield Ci(Do.setLoginState({loading:!1,error:Hp(e)}))}}function*qv(){yield Ca(Do.requestAuthorize,rv),yield Ca(Do.requestAuthorizeSSR,sv),yield Ca(Do.requestHostedLoginAuthorize,dv),yield Ca(Do.requestHostedLoginAuthorizeV2,yv),yield Ca(Do.handleHostedLoginCallback,pv),yield Ca(Do.preLogin,Tv),yield Ca(Do.postLogin,Ov),yield Ca(Do.login,_v),yield Ca(Do.logout,Uv),yield Ca(Do.silentLogout,Rv),yield Ca(Do.loginWithMfa,wv),yield Ca(Do.recoverMfa,Cv),yield Ca(Do.quickSmsPasswordlessPreLogin,vv),yield Ca(Do.changePhoneNumberWithVerification,gv),yield Ca(Do.verifyChangePhoneNumber,Sv),yield Ca(Do.passwordlessPreLogin,hv),yield Ca(Do.passwordlessPostLogin,Av),yield Ca(Do.verifyInviteToken,bv),yield Ca(Do.webAuthnPrelogin,Pv),yield Ca(Do.webAuthnPostLogin,Lv),yield Ca(Do.webAuthnCreateNewDeviceSession,Ev),yield Ca(Do.webAuthnVerifyNewDeviceSession,Iv),yield Ca(Do.afterAuthNavigation,qS),yield Ca(Do.getUserIP,av),yield Ca(Do.preEnrollMFASMSForLogin,Mv),yield Ca(Do.enrollMFASMSForLogin,Fv),yield Ca(Do.preEnrollMFAWebAuthnForLogin,Gv),yield Ca(Do.enrollMFAWebAuthnForLogin,$v),yield Ca(Do.enrollMFAAuthenticatorAppForLogin,xv),yield Ca(Do.preVerifyMFASMSForLogin,Vv),yield Ca(Do.verifyMFASMSForLogin,Wv),yield Ca(Do.preVerifyMFAWebAuthnForLogin,Kv),yield Ca(Do.verifyMFAWebAuthnForLogin,Hv),yield Ca(Do.preVerifyMFAEmailCode,Bv),yield Ca(Do.verifyMFAEmailCode,jv),yield Ca(Do.resetBreachedPassword,zv)}function*Yv({payload:e}){e&&(yield Ci(Do.setState({isLoading:!0})));const t=up;yield Ci(Do.loadTenants()),yield Ci(Do.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Jv({payload:{callback:e}}){try{const{ip:t}=Dp[0];yield Ci(Do.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Qv(){yield Ca(Do.requestAuthorize,Yv),yield Ca(Do.afterAuthNavigation,qS),yield Ca(Do.getUserIP,Jv)}const Xv=["callback","samlVendor"],Zv=["callback","samlVendor"];function*eh(){try{var e,t;yield Ci(Do.setSSOState({loading:!0}));const n=yield Di(Gf.auth.getSamlConfiguration),o=yield Di(Gf.auth.getOidcConfiguration),i=yield Di(Gf.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 Ci(Do.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield Ci(Do.setSSOState({error:Hp(e),loading:!1}))}}function*th({payload:e}){const t=yield Fi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Ci(Do.setSSOState({error:void 0,[n]:!0}));try{const o=yield ip(e[0]),i=yield Di(Gf.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield Ci(Do.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield Ci(Do.setSSOState({samlConfiguration:t,error:Hp(e),[n]:!1}))}}function*nh({payload:e}){const{configFile:t,callback:n}=e,o=yield Fi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield Ci(Do.setSSOState({error:void 0,[i]:!0}));try{const e=yield ip(t),a=yield Di(Gf.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield Ci(Do.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield Ci(Do.setSSOState({samlConfiguration:o,error:Hp(e),[i]:!1})),null==n||n(null,e)}}function*oh({payload:e}){const{callback:t,samlVendor:n}=e,o=zo(e,Xv),i=yield Fi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Ci(Do.setSSOState({samlConfiguration:U({},i,a)})));if(yield Ci(Do.setSSOState({error:void 0,[r]:!0})),e.type===Vf.Saml){var l,s;const e=yield Di(Gf.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=tp(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 Di(Gf.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield Ci(Do.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setSSOState({samlConfiguration:i,error:Hp(e),[r]:!1})),null==t||t(null,e)}}function*ih({payload:{callback:e}={}}){const t=yield Fi((e=>e.auth.ssoState.samlConfiguration));try{yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield Di(Gf.auth.validateSamlDomain),yield Ci(Do.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Ci(Do.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:Hp(n),saving:!1})),null==e||e(null,n)}}function*ah(){try{const e=yield Di(Gf.auth.getSamlRoles),t=yield Di(Gf.auth.getSamlRolesGroups);yield Ci(Do.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Ci(Do.setSSOState({error:Hp(e)}))}}function*rh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield Di(Gf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ui(e.map((e=>Di(Gf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Ci(Do.setSSOState({error:Hp(e)}))}}(n)),yield ah(),yield Ci(Do.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Ci(Do.setSSOState({error:Hp(t),saving:!1})),null==e||e(null,t)}}function*lh({payload:{callback:e,id:t}}){try{yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield Di(Gf.auth.deleteSamlGroup,{id:t}),yield ah(),yield Ci(Do.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Ci(Do.setSSOState({error:Hp(t),saving:!1})),null==e||e(null,t)}}function*sh({payload:{group:e,roleIds:t,callback:n}}){try{yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield Di(Gf.auth.createSamlGroup,{group:e,roleIds:t}),yield ah(),yield Ci(Do.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Ci(Do.setSSOState({error:Hp(e),saving:!1})),null==n||n(null,e)}}function*ch({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Ci(Do.setSSOState({loading:!0})),yield Di(Gf.auth.oidcPostLoginV2,t),yield Di(ZS),yield Ci(Do.setSSOState({loading:!1}))}catch(e){yield Ci(Do.setSSOState({loading:!1,error:Hp(e,"Failed to authenticate"),firstLoad:!1}))}}function*uh(){yield _a(Do.loadSSOConfigurations,eh),yield _a(Do.saveSSOConfigurations,oh),yield _a(Do.saveSSOConfigurationsFile,th),yield _a(Do.saveSSOConfigurationsFileWithCallback,nh),yield _a(Do.validateSSODomain,ih),yield _a(Do.loadSSOAuthorizationRoles,ah),yield _a(Do.updateSSOAuthorizationRoles,rh),yield _a(Do.deleteSamlGroup,lh),yield _a(Do.createSamlGroup,sh),yield _a(Do.oidcPostlogin,ch)}function*dh(){yield Ci(Do.setSSOState({loading:!0})),yield bt(),yield Ci(Do.setSSOState({samlConfiguration:vp,loading:!1,firstLoad:!1}))}function*yh({payload:e}){const t="saving";yield Ci(Do.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Fi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Ci(Do.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*fh({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=zo(e,Zv),r=Ap.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield Ci(Do.setSSOState({samlConfiguration:U({},r,l)})));yield Ci(Do.setSSOState({error:void 0,[s]:!0})),yield bt(),l.acsUrl=null==hp||null==(t=hp.configuration)?void 0:t.acsUrl,l.spEntityId=null==hp||null==(n=hp.configuration)?void 0:n.spEntityId;const c=tp(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 bt(),yield Ci(Do.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*ph({payload:{callback:e}={}}){const t=Ap.samlConfiguration;yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield bt(),yield Ci(Do.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*gh(){yield bt(),yield Ci(Do.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Sh({payload:{callback:e,authorizationRoles:t}}){yield Ci(Do.setSSOState({error:void 0,saving:!0})),yield bt(),yield Ci(Do.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*vh(){yield _a(Do.loadSSOConfigurations,dh),yield _a(Do.saveSSOConfigurations,fh),yield _a(Do.saveSSOConfigurationsFile,yh),yield _a(Do.validateSSODomain,ph),yield _a(Do.loadSSOAuthorizationRoles,gh),yield _a(Do.updateSSOAuthorizationRoles,Sh)}const hh=["callback"],mh=["callback","ssoConfigId"],Ah=["callback","ssoConfigId"],bh=["callback","ssoConfigId"];function*Th(){try{return yield Di(Gf.auth.getOidcConfiguration)}catch(e){return null}}function*kh(){try{return yield Di(Gf.metadata.getSamlMetadata)}catch(e){return null}}function*Eh(){try{yield Ci(Do.setSSOLoader({key:xf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ui([Di(Th),Di(kh)]),n=yield Di(Gf.auth.getSSOConfigurations);yield Ci(Do.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Ci(Do.setSSOError({key:xf.LOAD_SSO_CONFIGURATIONS,value:Hp(e)}))}finally{yield Ci(Do.setSSOLoader({key:xf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Ih({payload:e}){yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=zo(e,hh),o=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Di(Gf.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield Ci(Do.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield Ci(Do.setSSOError({key:xf.SAVE_SSO_CONFIGURATION,value:Hp(e)})),null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Ph({payload:e}){yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ip(t),i=yield Di(Gf.auth.createSSOConfigurationByMetadata,{metadata:e});yield Ci(Do.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield Ci(Do.setSSOError({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Hp(e)})),null==n||n(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Lh({payload:e}){yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=zo(e,mh),i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Di(Gf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield Ci(Do.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Ci(Do.setSSOError({key:xf.UPDATE_SSO_CONFIGURATION,value:Hp(e)})),null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Oh({payload:e}){yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ip(o),a=yield Di(Gf.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield Ci(Do.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Ci(Do.setSSOError({key:xf.UPDATE_SSO_CONFIGURATION,value:Hp(e)})),null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*_h({payload:e}){yield Ci(Do.setSSOLoader({key:xf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{yield Di(Gf.auth.deleteSSOConfiguration,t),yield Ci(Do.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Ci(Do.setSSOError({key:xf.DELETE_SSO_CONFIGURATION,value:Hp(e)})),null==n||n(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*wh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=zo(e,Ah);yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Di(Gf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield Ci(Do.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Ci(Do.setSSOError({key:xf.SAVE_SSO_DOMAIN,value:Hp(e)})),null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_DOMAIN,value:!1}))}}function*Ch({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield Ci(Do.setSSOLoader({key:xf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{yield Di(Gf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Ci(Do.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield Ci(Do.setSSOError({key:xf.DELETE_SSO_DOMAIN,value:Hp(e)})),null==o||o(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.DELETE_SSO_DOMAIN,value:!1}))}}function*Uh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield Ci(Do.setSSOLoader({key:xf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{yield Di(Gf.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield Ci(Do.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Ci(Do.setSSOError({key:xf.VALIDATE_SSO_DOMAIN,value:Hp(e)})),null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Rh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{yield Di(Gf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield Ci(Do.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield Ci(Do.setSSOError({key:xf.UPDATE_SSO_DEFAULT_ROLES,value:Hp(t)})),null==e||e(null,t)}finally{yield Ci(Do.setSSOLoader({key:xf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Dh({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_GROUPS,value:!0}));const i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(t.map((e=>Di(Gf.auth.deleteSSOGroup,n,e)))),yield Ui(e.map((e=>Di(Gf.auth.createSSOGroup,n,e))));const a=yield Di(Gf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield Ci(Do.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield Ci(Do.setSSOError({key:xf.SAVE_SSO_GROUPS,value:Hp(e)})),null==o||o(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_GROUPS,value:!1}))}}function*Nh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ui(t.map((t=>Di(Gf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Ci(Do.setSSOError({key:xf.SAVE_SSO_GROUPS,value:Hp(e)})),null==n||n(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_GROUPS,value:!1}))}}function*Mh({payload:e}){yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,l;o?(r=yield Di(Gf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Di(Gf.auth.createSSOConfigurationByMetadataUrl,e),l=[r,...a]),yield Ci(Do.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Fh({payload:e}){yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=zo(e,bh),i=yield Fi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Di(Gf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Di(Gf.auth.createSSOConfiguration,o),a=[e,...i]),yield Ci(Do.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Ci(Do.setSSOLoader({key:xf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Gh(){yield _a(Do.loadSSOConfigurationsV2,Eh),yield _a(Do.saveSSOConfigurationV2,Ih),yield _a(Do.saveSSODomain,wh),yield _a(Do.deleteSSODomain,Ch),yield _a(Do.validateSSODomainV2,Uh),yield _a(Do.updateSSOConfiguration,Lh),yield _a(Do.deleteSSOConfiguration,_h),yield _a(Do.setSSOGroups,Dh),yield _a(Do.updateSSOGroups,Nh),yield _a(Do.setSSODefaultRoles,Rh),yield _a(Do.saveSSOConfigurationByMetadata,Ph),yield _a(Do.updateSSOConfigurationByMetadata,Oh),yield _a(Do.saveSSOConfigurationByUrl,Mh),yield _a(Do.saveSSOConfigurationByData,Fh)}const $h=["callback","profilePictureUrl"],xh=["callback","profilePictureUrl"];function*Vh(){yield Ci(Do.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 Di.apply(void 0,[Oa,e,t,n].concat(i))}(3,2e3,Gf.teams.getProfile),t=yield Fi((e=>e.auth.user));Do.setUser(U({},t,e)),yield Ci(Do.setProfileState({profile:e,loading:!1}))}catch(e){yield Ci(Do.setProfileState({loading:!1,error:Hp(e)}))}}function*Bh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=zo(e.payload,$h);yield Ci(Do.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Fi((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 Di(Gf.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield Di(Gf.users.updateUserProfileV2,a),l=yield Fi((e=>e.auth.user));yield Ci(Do.setUser(U({},l,r))),yield Ci(Do.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Ci(Do.setProfileState({saving:!1,error:Hp(e),loading:!1})),null==t||t(null,e)}}function*jh({payload:e}){yield Ci(Do.setProfileState({loading:!0}));try{var t;yield Di(Gf.teams.changePassword,e),yield Ci(Do.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setProfileState({loading:!1,error:Hp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Wh(){yield Ca(Do.loadProfile,Vh),yield _a(Do.saveProfile,Bh),yield _a(Do.changePassword,jh)}function*Kh(){yield Ci(Do.setProfileState({loading:!0})),yield bt(),yield Ci(Do.setUser(U({},up,cp))),yield Ci(Do.setProfileState({loading:!1,profile:cp}))}function*Hh(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=zo(e.payload,xh);yield Ci(Do.setProfileState({saving:!0,error:null}));const i=dp;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=up;yield bt(),yield Ci(Do.setUser(U({},l,r))),yield Ci(Do.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*zh({payload:e}){var t;yield Ci(Do.setProfileState({loading:!0})),yield bt(),yield Ci(Do.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*qh(){yield Ca(Do.loadProfile,Kh),yield _a(Do.saveProfile,Hh),yield _a(Do.changePassword,zh)}const Yh=["callback"],Jh=["callback"],Qh=["user"],Xh=["callback"],Zh=["deviceId","callback"],em=["deviceId","callback"],tm=["callback"],nm=["deviceId"],om=["deviceId"],im=["callback"],am=["deviceId"],rm=["callback"];function*lm(e){const{step:t}=yield Fi((e=>e.auth.mfaState));return{step:e.recoveryCode?ln.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*sm(){yield Ci(Do.setMfaState({saving:!0}));try{const{qrCode:e}=yield Di(Gf.auth.enrollMfa);yield Ci(Do.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)}))}}function*cm(e){let{payload:{callback:t}}=e,n=zo(e.payload,Yh);yield Ci(Do.setMfaState({saving:!0}));try{const e=yield Fi((e=>e.auth.user)),o=yield Di(Gf.auth.verifyMfa,n),i=yield Di(Gf.auth.getMFADevices),a=yield lm(o);yield Ci(Do.setMfaState(U({},a,{mfaDevices:i}))),yield Ci(Do.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*um(e){let{payload:{callback:t}}=e,n=zo(e.payload,Jh);yield Ci(Do.setMfaState({loading:!0}));try{const e=yield Di(Gf.auth.loginWithMfaV2,n),{user:o}=e,i=zo(e,Qh),a={step:ln.recoveryCode,loading:!1,saving:!1,error:void 0};null!=o&&o.recoveryCode&&(a.recoveryCode=o.recoveryCode),yield Ci(Do.setMfaState(a)),yield zS(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield Ci(Do.setMfaState({loading:!1,error:Hp(e)})),null==t||t(null,e)}}function*dm({payload:e}){yield Ci(Do.setMfaState({saving:!0}));try{var t;yield Di(Gf.auth.disableMfa,e);const n=yield Di(Gf.auth.getMFADevices);yield Ci(Do.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setMfaState({saving:!1,error:Hp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*ym({payload:e}){yield Ci(Do.setMfaState({saving:!0}));try{var t,n;const o=yield Di(Gf.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:Et(o.options.challenge),user:U({},o.options.user,{id:Et(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:Et(e.id)})))});yield Ci(Do.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield Ci(Do.setMfaState({saving:!1,error:Hp(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*fm(e){let{payload:{callback:t}}=e,n=zo(e.payload,Xh);yield Ci(Do.setMfaState({saving:!0}));try{const e=It(n.publicKey),o=yield Di(Gf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Di(Gf.auth.getMFADevices),a=yield lm(o);yield Ci(Do.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*pm(e){let{payload:{deviceId:t,callback:n}}=e;zo(e.payload,Zh),yield Ci(Do.setMfaState({saving:!0}));try{var o;const e=yield Di(Gf.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:Et(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:Et(e.id)})))});yield Ci(Do.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==n||n(null,e)}}function*gm(e){let{payload:{deviceId:t,callback:n}}=e,o=zo(e.payload,em);yield Ci(Do.setMfaState({saving:!0}));try{const e=It(o.publicKey);yield Di(Gf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Di(Gf.auth.getMFADevices);yield Ci(Do.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==n||n(!1,e)}}function*Sm({payload:e}){yield Ci(Do.setMfaState({saving:!0}));try{var t;const n=yield Di(Gf.auth.preEnrollMFASMS,e);yield Ci(Do.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 Ci(Do.setMfaState({saving:!1,error:Hp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*vm(e){let{payload:{callback:t}}=e,n=zo(e.payload,tm);yield Ci(Do.setMfaState({saving:!0}));try{const e=yield Di(Gf.auth.enrollMFASMS,n),o=yield Di(Gf.auth.getMFADevices),i=yield lm(e);yield Ci(Do.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*hm(e){let{payload:{deviceId:t}}=e,n=zo(e.payload,nm);yield Ci(Do.setMfaState({saving:!0}));try{var o;const e=yield Di(Gf.auth.preDisableMFASMS,t);yield Ci(Do.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 Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*mm(e){let{payload:{deviceId:t}}=e,n=zo(e.payload,om);yield Ci(Do.setMfaState({saving:!0}));try{var o;yield Di(Gf.auth.disableMFASMS,t,n);const e=yield Di(Gf.auth.getMFADevices);yield Ci(Do.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Am(){yield Ci(Do.setMfaState({loading:!0}));try{yield Fi((e=>e.auth.user));const e=yield Di(Gf.auth.getMFADevices);yield Ci(Do.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Ci(Do.setMfaState({loading:!1,error:Hp(e)}))}}function*bm(){yield Ci(Do.setMfaState({loading:!0}));try{const e=(yield Di(Gf.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Ci(Do.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Ci(Do.setMfaState({loading:!1,error:Hp(e)}))}}function*Tm(){yield _a(Do.enrollMfa,sm),yield _a(Do.getMFADevices,Am),yield _a(Do.getMFAStrategies,bm),yield _a(Do.verifyMfa,cm),yield _a(Do.disableMfa,dm),yield _a(Do.verifyMfaAfterForce,um),yield _a(Do.preDisableMfaSms,hm),yield _a(Do.disableMfaSms,mm),yield _a(Do.preEnrollMfaSms,Sm),yield _a(Do.enrollMfaSms,vm),yield _a(Do.preEnrollMfaWebAuthn,ym),yield _a(Do.enrollMfaWebAuthn,fm),yield _a(Do.preDisableMfaWebAuthn,pm),yield _a(Do.disableMfaWebAuthn,gm)}function*km(){yield Ci(Do.setMfaState({saving:!0})),yield Ci(Do.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Em({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Fi((e=>e.auth.mfaState));yield Ci(Do.setMfaState({saving:!0})),yield bt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield Ci(Do.setMfaState(o)),yield Ci(Do.setUser(U({},up,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Im(e){let{payload:{callback:t}}=e,n=zo(e.payload,im);yield Ci(Do.setMfaState({loading:!0})),yield bt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Ci(Do.setMfaState(i)),yield bt(),yield Ci(Do.setUser(U({},up,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Pm({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Fi((e=>e.auth.mfaState));yield Ci(Do.setMfaState({saving:!0})),yield bt(),yield Ci(Do.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield Ci(Do.setUser(U({},up))),null==(t=e.callback)||t.call(e,!0)}function*Lm(e){let{}=e,t=zo(e.payload,am);yield Ci(Do.setMfaState({saving:!0}));try{var n;yield Ci(Do.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield Ci(Do.setMfaState({saving:!1,error:Hp(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*Om({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Fi((e=>e.auth.mfaState));yield Ci(Do.setMfaState({saving:!0})),yield bt(),yield Ci(Do.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield Ci(Do.setUser(U({},up))),null==(t=e.callback)||t.call(e,!0)}function*_m({payload:e}){var t;yield Ci(Do.setMfaState({saving:!0})),yield bt(),yield Ci(Do.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*wm(e){let{payload:{callback:t}}=e;zo(e.payload,rm);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Fi((e=>e.auth.mfaState));yield Ci(Do.setMfaState({saving:!0})),yield bt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:ln.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield Ci(Do.setMfaState(i)),yield Ci(Do.setUser(U({},up,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*Cm(){yield _a(Do.enrollMfa,km),yield _a(Do.verifyMfa,Em),yield _a(Do.disableMfa,Pm),yield _a(Do.verifyMfaAfterForce,Im),yield _a(Do.preDisableMfaSms,Lm),yield _a(Do.disableMfaSms,Om),yield _a(Do.preEnrollMfaSms,_m),yield _a(Do.enrollMfaSms,wm)}const Um=["callback"];function*Rm({payload:e}){yield Ci(Do.setForgotPasswordState({loading:!0}));try{var t;yield Di(Gf.auth.forgotPassword,e),yield Ci(Do.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setForgotPasswordState({loading:!1,error:Hp(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Dm(e){let{payload:{callback:t}}=e,n=zo(e.payload,Um);yield Ci(Do.setForgotPasswordState({loading:!0}));try{yield Di(Gf.auth.resetPassword,n),yield Ci(Do.setForgotPasswordState({loading:!1,error:void 0,step:Ht.success})),null==t||t(!0)}catch(e){yield Ci(Do.setForgotPasswordState({loading:!1,error:Hp(e)})),null==t||t(!1,e)}}function*Nm({payload:e}){yield Ci(Do.setForgotPasswordState({loading:!0}));try{const t=yield Di(Gf.auth.loadPasswordConfig,e);yield Ci(Do.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Ci(Do.setForgotPasswordState({loading:!1,error:Hp(e)}))}}function*Mm(){yield Ca(Do.forgotPassword,Rm),yield Ca(Do.resetPassword,Dm),yield Ca(Do.loadPasswordConfig,Nm)}let Fm;!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"}(Fm||(Fm={}));const Gm=["callback","events"],$m=["user"],xm=["callback"],Vm=["callback"];function*Bm({payload:{userId:e,token:t}}){yield Ci(Do.setActivateState({loading:!0,step:Gt.activating}));try{const{isAuthenticated:n}=yield Fi((e=>e.auth));n&&(yield Ci(Do.silentLogout()));const o=yield Di(Gf.auth.getActivateAccountStrategy,{userId:e,token:t});yield Ci(Do.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield Ci(Do.setActivateState({loading:!1,step:Gt.activatingForm})))}catch(e){yield Ci(Do.setActivateState({loading:!1,error:Hp(e)}))}}function*jm(e){let{payload:{callback:t,events:n}}=e,o=zo(e.payload,Gm);yield Ci(Do.setActivateState({loading:!0}));try{const e=Ua.onRedirectTo,{routes:a}=yield Fi((e=>e.auth)),r=yield Di(Gf.auth.activateAccountV2,o),{user:l}=r,s=zo(r,$m);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Qp(l)){yield Ci(Do.setActivateState({step:Gt.success}));const t=yield QS(l);yield Ci(Do.setState(t)),yield Gi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield Ci(Do.setActivateState({step:Gt.success})),null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:jp.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Di(zS,U({user:l},s),{isAuthenticated:!0}),yield Gi(1e3),yield qS(),yield Ci(Do.resetActivateState())}null==t||t(!0)}catch(e){yield Ci(Do.setActivateState({loading:!1,error:Hp(e)}))}}function*Wm({payload:e}){const{callback:t}=e,n=zo(e,xm);yield Ci(Do.setActivateStrategyState({loading:!0}));try{const e=yield Di(Gf.auth.getActivateAccountStrategy,n);yield Ci(Do.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Ci(Do.setActivateStrategyState({loading:!1,error:Hp(e)}))}}function*Km({payload:e}){const{callback:t}=e,n=zo(e,Vm);yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:n.email})),yield Ci(Do.setActivateState({loading:!0}));try{yield Di(Gf.auth.resendActivationEmail,n),yield Ci(Do.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Ci(Do.setActivateState({loading:!1,error:Hp(e)})),yield Ci(Do.setTeamError({key:Fm.RESEND_ACTIVATE_LINK,value:Hp(e)})),null==t||t(null,e)}yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:!1}))}function*Hm(){yield Ca(Do.activateAccount,jm),yield Ca(Do.preActivateAccount,Bm),yield Ca(Do.getActivateAccountStrategy,Wm),yield Ca(Do.resendActivationEmail,Km)}function*zm({payload:e}){if(e.token&&e.userId)try{yield Ci(Do.setAcceptInvitationState({error:void 0,step:Bt.pending})),yield Di(Gf.auth.acceptInvitation,e),yield Ci(Do.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Bt.success}}))}catch(e){yield Ci(Do.setAcceptInvitationState({step:Bt.failed,error:Hp(e)}))}else yield Ci(Do.setAcceptInvitationState({error:void 0,step:Bt.invalid}))}function*qm(){yield Ca(Do.acceptInvitation,zm)}var Ym,Jm=new Uint8Array(16);function Qm(){if(!Ym&&!(Ym="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 Ym(Jm)}for(var Xm=/^(?:[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,Zm=function(e){return"string"==typeof e&&Xm.test(e)},eA=[],tA=0;tA<256;++tA)eA.push((tA+256).toString(16).substr(1));var nA=function(e,t,n){var o=(e=e||{}).random||(e.rng||Qm)();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=(eA[e[t+0]]+eA[e[t+1]]+eA[e[t+2]]+eA[e[t+3]]+"-"+eA[e[t+4]]+eA[e[t+5]]+"-"+eA[e[t+6]]+eA[e[t+7]]+"-"+eA[e[t+8]]+eA[e[t+9]]+"-"+eA[e[t+10]]+eA[e[t+11]]+eA[e[t+12]]+eA[e[t+13]]+eA[e[t+14]]+eA[e[t+15]]).toLowerCase();if(!Zm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let oA,iA;!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"}(oA||(oA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(iA||(iA={}));const aA=["callback"],rA=["roles"],lA=["callback"],sA=["callback","profileImage"],cA=["callback"],uA=["callback","userId"],dA=["callback"],yA=["callback"],fA=["callback"],pA=["callback"],gA=["callback"],SA=["callback"],vA=["callback"],hA=["callback","profileImage"],mA=["callback"],AA=["callback"],bA=["callback"],TA=["callback"],kA=["callback"],EA=["callback"],IA=()=>Fi((e=>e.auth.teamState));function*PA(){try{const{groups:e}=yield Di(Gf.groups.getGroups,{_groupsRelations:iA.roles});return e}catch(e){return[]}}function*LA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield IA(),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 Ci(Do.setTeamLoader({key:Fm.USERS,value:!r})),yield Ci(Do.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:o}},{items:i},{items:a},r]=yield Ui([Di(Gf.users.getUsersV2,U({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Di(Gf.teams.loadAvailableRoles),Di(Gf.teams.loadAvailablePermissions),Di(PA)]),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 U({},e,{groups:n})}));yield Ci(Do.setTeamState({users:s.map((e=>U({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:o,roles:i,permissions:a})),null==l||l(t)}catch(e){yield Ci(Do.setTeamError({key:Fm.USERS,value:Hp(e)})),yield Ci(Do.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Ci(Do.setTeamLoader({key:Fm.USERS,value:!1}))}function*OA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield IA(),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 Ci(Do.setTeamLoader({key:Fm.USERS,value:!a})),yield Ci(Do.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i}]=yield Ui([Di(Gf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Di(Gf.teams.loadAvailableRoles),Di(Gf.teams.loadAvailablePermissions)]);yield Ci(Do.setTeamState({users:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield Ci(Do.setTeamError({key:Fm.USERS,value:e.message})),yield Ci(Do.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Ci(Do.setTeamLoader({key:Fm.USERS,value:!1}))}function*_A({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield IA(),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 Ci(Do.setTeamLoader({key:Fm.USERS,value:!r})),yield Ci(Do.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ui([Di(Gf.subTenants.loadAllUsers,U({},c)),Di(Gf.teams.loadAvailableRoles),Di(Gf.teams.loadAvailablePermissions)]);yield Ci(Do.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield Ci(Do.setTeamError({key:Fm.USERS,value:Hp(e)})),yield Ci(Do.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield Ci(Do.setTeamLoader({key:Fm.USERS,value:!1}))}function*wA({payload:e}){yield Ci(Do.setTeamLoader({key:Fm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ui([Di(Gf.teams.loadAvailableRoles),Di(Gf.teams.loadAvailablePermissions)]);yield Ci(Do.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 Ci(Do.setTeamError({key:Fm.ROLES_AND_PERMISSIONS,value:Hp(t)}))}yield Ci(Do.setTeamLoader({key:Fm.ROLES_AND_PERMISSIONS,value:!0}))}function*CA({payload:e}){const{callback:t}=e,n=zo(e,aA),o=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Di(Gf.teams.addUser,n),{roles:a}=e,r=U({},zo(e,rA),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield Ci(Do.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:Hp(e)})})),null==t||t(null,e)}}function*UA({payload:e}){const{callback:t}=e,n=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Ci(Do.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Di(Gf.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 Ci(Do.loadUsersV2(r)),yield Ci(Do.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*RA({payload:e}){const{callback:t}=e,n=zo(e,lA),o=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Di(Gf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Di(Gf.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Ci(Do.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:Hp(e)})})),null==t||t(null,e)}}function*DA({payload:e}){const{callback:t}=e,n=zo(e,sA),{id:o}=n,i=yield IA(),a=i.users.find((e=>e.id===n.id));yield Ci(Do.setTeamLoader({key:Fm.UPDATE_USER,value:o||""})),yield Ci(Do.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield Ci(Do.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},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 Di(Gf.teams.updateUser,n);null==t||t(e),yield Ci(Do.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Ci(Do.setTeamLoader({key:Fm.UPDATE_USER,value:!1}))}catch(e){yield Ci(Do.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Hp(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield Ci(Do.setTeamLoader({key:Fm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*NA({payload:e}){const{callback:t}=e,n=zo(e,cA),o=yield IA();yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Di(Gf.teams.deleteUser,n),null==t||t(!0),yield Ci(Do.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:Hp(e)})})),null==t||t(null,e)}}function*MA({payload:e}){const{callback:t,userId:n}=e,o=zo(e,uA),i=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Di(Gf.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},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 Ci(Do.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Ci(Do.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Hp(e)})})),null==t||t(null,e)}}function*FA({payload:e}){const{callback:t}=e,n=zo(e,dA),o=yield IA();yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Di(Gf.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Ci(Do.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:Hp(e)})})),null==t||t(null,e)}}function*GA({payload:e}){const{callback:t}=e,n=zo(e,yA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Di(Gf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Ci(Do.setTeamError({key:Fm.RESEND_ACTIVATE_LINK,value:Hp(e)})),null==t||t(null,e)}yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:!1}))}function*$A({payload:e}){const{callback:t}=e,n=zo(e,fA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email}));try{yield Di(Gf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Ci(Do.setTeamError({key:Fm.RESEND_INVITATION_LINK,value:Hp(e)})),null==t||t(null,e)}yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*xA({payload:e}){const{callback:t}=e,n=zo(e,pA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email}));try{yield Di(Gf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Ci(Do.setTeamError({key:Fm.RESEND_INVITATION_LINK,value:Hp(e)})),null==t||t(null,e)}yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*VA({payload:e}){const{callback:t}=e,n=zo(e,gA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email}));try{yield Di(Gf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Ci(Do.setTeamError({key:Fm.RESEND_INVITATION_LINK,value:Hp(e)})),null==t||t(null,e)}yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*BA(){yield Ci(Do.setTeamError({key:Fm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Di(Gf.teams.getInviteLinkConfiguration);yield Ci(Do.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield Ci(Do.setTeamError({key:Fm.CONFIG_TOKEN_LINK,value:Hp(e)}))}}function*jA(){yield Ci(Do.setTeamError({key:Fm.GET_TOKEN_LINK,value:!1}));try{yield Di(BA);const e=yield Di(Gf.teams.getInviteUserLink),{inviteTokenState:t}=yield IA();yield Ci(Do.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield Ci(Do.setTeamError({key:Fm.GET_TOKEN_LINK,value:Hp(e)}))}}function*WA({payload:{callback:e}}){yield Ci(Do.setTeamError({key:Fm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield IA();try{const n=yield Di(Gf.teams.createInviteUserLink,{expiresInMinutes:43200});yield Ci(Do.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Ci(Do.setTeamError({key:Fm.CREATE_TOKEN_LINK,value:Hp(t)}))}}function*KA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield IA();yield Ci(Do.setTeamError({key:Fm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Di(Gf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Ci(Do.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Ci(Do.setTeamError({key:Fm.UPDATE_TOKEN_LINK,value:Hp(t)}))}}function*HA({payload:e}){const{callback:t}=null!=e?e:{};yield Ci(Do.setTeamError({key:Fm.DELETE_TOKEN_LINK,value:!1}));try{yield Di(Gf.teams.deleteInviteUserLink),yield Ci(Do.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Ci(Do.setTeamError({key:Fm.DELETE_TOKEN_LINK,value:Hp(e)})),null==t||t(!1,e)}}function*zA({payload:e}){yield Ci(Do.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*qA({payload:e}){const t=yield IA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Ci(Do.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*YA({payload:e}){yield Ci(Do.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*JA({payload:e}){const t=yield IA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Ci(Do.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*QA(){yield wa(Do.loadUsers,OA),yield wa(Do.loadUsersV2,LA),yield wa(Do.loadAllSubTenantsUsers,_A),yield wa(Do.loadRoles,wA),yield _a(Do.addUser,CA),yield _a(Do.addUsersBulk,UA),yield _a(Do.addUserToSubTenants,RA),yield _a(Do.updateUser,DA),yield _a(Do.setUserRolesForSubTenants,MA),yield _a(Do.deleteUser,NA),yield _a(Do.deleteUserFromSubTenants,FA),yield _a(Do.resendActivationLink,GA),yield _a(Do.resendInvitationLink,$A),yield _a(Do.resendInvitationEmail,xA),yield _a(Do.resendInvitationLinkToAllSubTenants,VA),yield _a(Do.getInvitationLink,jA),yield _a(Do.createInvitationLink,WA),yield _a(Do.updateInvitationLink,KA),yield _a(Do.deleteInvitationLink,HA),yield _a(Do.openAddUserDialog,zA),yield _a(Do.closeAddUserDialog,qA),yield _a(Do.openDeleteUserDialog,YA),yield _a(Do.closeDeleteUserDialog,JA)}function*XA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield IA(),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 Ci(Do.setTeamLoader({key:Fm.USERS,value:!a})),yield Ci(Do.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield bt(),yield Ci(Do.setTeamState({users:Lp,totalPages:2,totalItems:10,roles:mp,permissions:bp})),yield Ci(Do.setTeamLoader({key:Fm.USERS,value:!1})),null==r||r(Lp)}function*ZA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield IA(),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 Ci(Do.setTeamLoader({key:Fm.USERS,value:!r})),yield Ci(Do.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield bt(),yield Ci(Do.setTeamState({allUsers:_p,totalPages:2,totalItems:10,roles:mp,permissions:bp})),yield Ci(Do.setTeamLoader({key:Fm.USERS,value:!1})),null==l||l(_p)}function*eb({payload:e}){var t;yield Ci(Do.setTeamLoader({key:Fm.ROLES_AND_PERMISSIONS,value:!0})),yield bt(),yield Ci(Do.setTeamState({roles:mp,permissions:bp})),yield Ci(Do.setTeamLoader({key:Fm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:mp,permissions:bp})}function*tb({payload:e}){const{callback:t}=e,n=zo(e,SA),o=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Ep,{groups:[]},n,{id:`${nA()}`});null==t||t(i),yield Ci(Do.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*nb({payload:e}){const{callback:t}=e,n=zo(e,vA),o=yield IA();yield Ci(Do.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield bt();const i=U({},Ep,n,{id:`${nA()}`});yield Ci(Do.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*ob({payload:e}){var t;const{callback:n}=e,o=zo(e,hA),{id:i}=o,a=yield IA(),r=a.users.find((e=>e.id===o.id));yield Ci(Do.setTeamLoader({key:Fm.UPDATE_USER,value:i||""})),yield Ci(Do.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield Ci(Do.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield bt();const l=U({},r,o);null==n||n(l),yield Ci(Do.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Ci(Do.setTeamLoader({key:Fm.UPDATE_USER,value:!1}))}function*ib({payload:e}){const{callback:t}=e,n=zo(e,mA),o=yield IA();yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ab({payload:e}){const{callback:t}=e,n=zo(e,AA),o=yield IA();yield Ci(Do.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*rb({payload:e}){const{callback:t}=e,n=zo(e,bA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:n.userId})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamLoader({key:Fm.RESEND_ACTIVATE_LINK,value:!1}))}function*lb({payload:e}){const{callback:t}=e,n=zo(e,TA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*sb({payload:e}){const{callback:t}=e,n=zo(e,kA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*cb({payload:e}){const{callback:t}=e,n=zo(e,EA);yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:n.email})),yield bt(),null==t||t(!0),yield Ci(Do.setTeamLoader({key:Fm.RESEND_INVITATION_LINK,value:!1}))}function*ub(){yield wa(Do.loadUsersV2,XA),yield wa(Do.loadAllSubTenantsUsers,ZA),yield wa(Do.loadRoles,eb),yield _a(Do.addUser,tb),yield _a(Do.addUserToSubTenants,nb),yield _a(Do.updateUser,ob),yield _a(Do.deleteUser,ib),yield _a(Do.deleteUserFromSubTenants,ab),yield _a(Do.resendActivationLink,rb),yield _a(Do.resendInvitationLink,lb),yield _a(Do.resendInvitationEmail,sb),yield _a(Do.resendInvitationLinkToAllSubTenants,cb),yield _a(Do.openAddUserDialog,zA),yield _a(Do.closeAddUserDialog,qA),yield _a(Do.openDeleteUserDialog,YA),yield _a(Do.closeDeleteUserDialog,JA)}const db=["authorizationUrl"],yb=["events","url"];function*fb(){try{yield Ci(Do.setSocialLoginsState({loading:!0}));const e=yield Di(Gf.auth.getSocialLoginProviders);yield Ci(Do.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Ci(Do.setSocialLoginsState({error:Hp(e),loading:!1,firstLoad:!1}))}}function*pb(){const e=yield Fi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Di(Gf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Di(Gf.auth.getSocialLoginProvidersV2),t}function*gb(){try{const e=yield Fi((e=>e.root.context));yield Ci(Do.setSocialLoginsState({loading:!0}));const t=yield Di(pb),{providers:n}=yield Di(Gf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=zo(t,db);const i=mr(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield Ci(Do.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield Ci(Do.setSocialLoginsState({error:Hp(e),loading:!1,firstLoad:!1}))}}function*Sb(e){let{payload:{events:t,url:n}}=e,o=zo(e.payload,yb);try{yield Ci(Do.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Di(Gf.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Wp.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:jp.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield Ci(Do.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Fi((e=>e.auth));e?yield Di(tv):yield Di(ov)}(),localStorage.removeItem("register-quick-login"),yield Ci(Do.setSocialLoginsState({loading:!1}))}catch(e){yield Ci(Do.setSocialLoginsState({loading:!1,error:Hp(e,"Failed to authenticate"),firstLoad:!1}))}}function*vb({payload:e}){yield Ci(Do.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*hb(){yield Ca(Do.loadSocialLoginsConfiguration,fb),yield Ca(Do.loadSocialLoginsConfigurationV2,gb),yield Ca(Do.loginViaSocialLogin,Sb),yield wa(Do.setSocialLoginError,vb)}let mb;function*Ab({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield Fi((e=>e.auth.apiTokensState));try{let e,a;yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Di(Gf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Di(Gf.auth.updateUserApiTokensData,{description:t}),yield Ci(Do.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield Ci(Do.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Ci(Do.setApiTokensError({key:mb.ADD_API_TOKEN,value:Hp(e)})),yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*bb({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield Fi((e=>e.auth.apiTokensState));try{let e,r;yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Di(Gf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Di(Gf.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield Ci(Do.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield Ci(Do.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Ci(Do.setApiTokensError({key:mb.ADD_API_TOKEN,value:Hp(e)})),yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*Tb({payload:e}){const{apiTokensDataUser:t}=yield Fi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!0})),n?(yield Di(Gf.auth.deleteUserAccessToken,{id:e}),yield Ci(Do.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Di(Gf.auth.deleteUserApiToken,{tokenId:e}),yield Ci(Do.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Ci(Do.setApiTokensError({key:mb.DELETE_API_TOKEN,value:Hp(e)})),yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!1}))}}function*kb({payload:e}){const{apiTokensDataTenant:t}=yield Fi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!0})),n?(yield Di(Gf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Di(Gf.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield Ci(Do.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!1}))}catch(e){yield Ci(Do.setApiTokensError({key:mb.DELETE_API_TOKEN,value:Hp(e)})),yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!1}))}}function*Eb({payload:e}){null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ui([Di(Gf.auth.getUserApiTokensData),Di(Gf.auth.getTenantApiTokensData)]);yield Ci(Do.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setApiTokensError({key:mb.LOAD_API_TOKENS,value:Hp(t)})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Ib({payload:e}){null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Di(Gf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Di(Gf.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Ci(Do.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Ci(Do.setApiTokensError({key:mb.LOAD_API_TOKENS,value:Hp(t)})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Pb({payload:e}){null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Di(Gf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Di(Gf.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 Ci(Do.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield Ci(Do.setApiTokensError({key:mb.LOAD_API_TOKENS,value:Hp(t)})),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Lb(){yield Ca(Do.loadApiTokens,Eb),yield Ca(Do.loadUserApiTokens,Ib),yield Ca(Do.loadTenantApiTokens,Pb),yield _a(Do.addUserApiToken,Ab),yield _a(Do.addTenantApiToken,bb),yield wa(Do.deleteTenantApiToken,kb),yield wa(Do.deleteUserApiToken,Tb)}function*Ob({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Fi((e=>e.auth.apiTokensState)),a=U({},lp,{description:t,roleIds:n,clientId:`CLIENT_ID_${nA()}`});yield Ci(Do.setApiTokensState({showAddTokenDialog:!1})),yield Gi(200),yield Ci(Do.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Gi(200),yield Ci(Do.setApiTokensLoader({key:mb.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*_b({payload:e}){yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!0})),yield Gi(200);const t=[lp];yield Ci(Do.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Ci(Do.setApiTokensLoader({key:mb.DELETE_API_TOKEN,value:!1}))}function*wb({payload:e}){var t;null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));const n=[rp],o=[lp];yield Ci(Do.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Gi(200),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Cb({payload:e}){var t;null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));const n=[rp];yield Ci(Do.setApiTokensState({apiTokensDataUser:n})),yield Gi(200),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Ub({payload:e}){var t;null!=e&&e.silentLoading||(yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!0})));const n=[lp];yield Ci(Do.setApiTokensState({apiTokensDataTenant:n})),yield Gi(200),yield Ci(Do.setApiTokensLoader({key:mb.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Rb(){yield Ca(Do.loadApiTokens,wb),yield Ca(Do.loadUserApiTokens,Cb),yield Ca(Do.loadTenantApiTokens,Ub),yield _a(Do.addTenantApiToken,Ob),yield wa(Do.deleteTenantApiToken,_b)}function*Db({payload:e}){try{var t;yield Ci(Do.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Fi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Di(Gf.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield Ci(Do.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Ci(Do.setAccountSettingsState({loading:!1,error:Hp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Nb({payload:e}){yield Ci(Do.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Di(Gf.accountSettings.getSettings);yield Ci(Do.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield Ci(Do.setAccountSettingsState({loading:!1,error:Hp(e)}))}}function*Mb(){yield Ca(Do.saveAccountSettings,Db),yield Ca(Do.loadAccountSettings,Nb)}function*Fb({payload:e}){var t;yield Ci(Do.setAccountSettingsState({loading:!0})),yield bt();const{accountSettingsState:n}=yield Fi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield Ci(Do.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Gb({payload:e}){yield Ci(Do.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield bt(),yield Ci(Do.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*$b(){yield Ca(Do.saveAccountSettings,Fb),yield Ca(Do.loadAccountSettings,Gb)}function*xb({payload:{tenantId:e,callback:t}}){yield Ci(Do.setState({isLoading:!0}));try{yield Di(Gf.tenants.switchTenant,{tenantId:e}),yield Di(ZS),(null==t?void 0:t(!0))||(yield Ci(Do.setState({isLoading:!1})))}catch(e){yield Ci(Do.setState({isLoading:!1})),null==t||t(!1,e)}}function*Vb({payload:e}){yield Ci(Do.setTenantsState({loading:!0}));try{var t;const n=yield Di(Gf.users.getCurrentUserTenantsV3);yield Ci(Do.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 Ci(Do.setTenantsState({loading:!1}))}}function*Bb({payload:e}){yield Ci(Do.setTenantsState({loading:!0}));try{var t;const n=yield Di(Gf.tenants.getSubTenants);yield Ci(Do.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*jb({payload:e}){yield Ci(Do.setTenantsState({loading:!0}));try{var t;const n=yield Di(Gf.tenants.getSubTenantsAsTree);yield Ci(Do.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Ci(Do.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Wb(){yield _a(Do.loadTenants,Vb),yield _a(Do.loadSubTenants,Bb),yield _a(Do.switchTenant,xb),yield _a(Do.loadSubTenantsTree,jb)}function*Kb(){yield Ci(Do.setTenantsState({loading:!0})),yield bt(),yield Ci(Do.setTenantsState({tenants:wp,activeTenant:wp[0],loading:!1}))}function*Hb(){yield _a(Do.loadTenants,Kb)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(mb||(mb={}));const zb=["callback"],qb=["callback"],Yb=["callback"],Jb=["callback"],Qb=["callback"];function*Xb({payload:e}){var t;yield Ci(Do.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ui([Di(Gf.roles.getRoles),Di(Gf.roles.getPermissions),Di(Gf.roles.getPermissionCategories)]),[t,n,o]=e;yield Ci(Do.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield Ci(Do.setRolesState({error:Hp(e),loading:!1}))}}function*Zb(e){let{payload:{callback:t}}=e,n=zo(e.payload,zb);yield Ci(Do.setRolesState({saving:!0}));try{const e=yield Di(Gf.roles.addRole,n),o=yield Di(Gf.roles.getRoles);yield Ci(Do.loadRolesAndPermissions({silentLoading:!0})),yield Ci(Do.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setRolesState({error:Hp(e),saving:!1})),null==t||t(null,e)}}function*eT(e){let{payload:{callback:t}}=e,n=zo(e.payload,qb);yield Ci(Do.setRolesState({saving:!0}));try{yield Di(Gf.roles.deleteRole,n),yield Ci(Do.loadRolesAndPermissions({silentLoading:!0})),yield Ci(Do.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setRolesState({error:Hp(e),saving:!1})),null==t||t(!1,e)}}function*tT(e){let{payload:{callback:t}}=e,n=zo(e.payload,Yb);yield Ci(Do.setRolesState({saving:!0}));try{const e=yield Di(Gf.roles.updateRole,n);yield Ci(Do.loadRolesAndPermissions({silentLoading:!0})),yield Ci(Do.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setRolesState({error:Hp(e),saving:!1})),null==t||t(null,e)}}function*nT(e){let{payload:{callback:t}}=e,n=zo(e.payload,Jb);yield Ci(Do.setRolesState({saving:!0}));try{const e=yield Di(Gf.roles.attachPermissionsToRole,n);yield Ci(Do.loadRolesAndPermissions({silentLoading:!0})),yield Ci(Do.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setRolesState({error:Hp(e),saving:!1})),null==t||t(null,e)}}function*oT(e){let{payload:{callback:t}}=e,n=zo(e.payload,Qb);yield Ci(Do.setRolesState({saving:!0}));try{const e=yield Di(Gf.roles.attachPermissionToRoles,n);yield Ci(Do.loadRolesAndPermissions({silentLoading:!0})),yield Ci(Do.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Ci(Do.setRolesState({error:Hp(e),saving:!1})),null==t||t(null,e)}}function*iT(){yield Ca(Do.loadRolesAndPermissions,Xb),yield _a(Do.addRole,Zb),yield _a(Do.deleteRole,eT),yield _a(Do.updateRole,tT),yield _a(Do.attachPermissionsToRole,nT),yield _a(Do.attachPermissionToRoles,oT)}function*aT({payload:e}){var t;yield Ci(Do.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Ci(Do.setRolesState({roles:sp,loading:!1}))}catch(e){yield Ci(Do.setRolesState({error:Hp(e),loading:!1}))}}function*rT(){yield Ca(Do.loadRolesAndPermissions,aT)}const lT=["callback"],sT=["callback"],cT=["callback"];function*uT(e){let{payload:{callback:t}}=e,n=zo(e.payload,lT);yield Ci(Do.setResetPhoneNumberState({loading:!0}));try{const e=yield Di(Gf.auth.resetPhoneNumber,n);yield Ci(Do.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Jt.VerifyResetPhoneNumber})),yield Ci(Do.setLoginState({email:n.email}))}catch(e){yield Ci(Do.setResetPhoneNumberState({loading:!1,error:Hp(e)})),null==t||t(null,e)}}function*dT(e){let{payload:{callback:t}}=e,n=zo(e.payload,sT);yield Ci(Do.setResetPhoneNumberState({loading:!0}));try{const e=yield Di(Gf.auth.verifyResetPhoneNumber,n);yield Ci(Do.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Ci(Do.setResetPhoneNumberState({loading:!1,error:Hp(e)})),null==t||t(null,e)}}function*yT(e){let{payload:{callback:t}}=e,n=zo(e.payload,cT);yield Ci(Do.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield Fi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Di(Gf.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Ci(Do.setLoginState({step:Pt.loginWithSmsOtc})),yield Ci(Do.passwordlessPreLogin({type:ko.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield Ci(Do.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setResetPhoneNumberState({loading:!1,error:Hp(e)})),null==t||t(null,e)}}function*fT(){yield Ca(Do.resetPhoneNumber,uT),yield Ca(Do.verifyResetPhoneNumber,dT),yield Ca(Do.changePhoneNumber,yT)}function*pT(){yield Ci(Do.setSessionsState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getCurrentUserSessions);yield Ci(Do.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Ci(Do.setSessionsState({error:e,loading:!1}))}}function*gT(){yield Ci(Do.setSessionsState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getCurrentUserSession);yield Ci(Do.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Ci(Do.setSessionsState({error:e,loading:!1}))}}function*ST({payload:{id:e}}){yield Ci(Do.setSessionsState({loading:!0,error:null}));try{yield Di(Gf.auth.deleteSessionForUser,e),yield Ci(Do.loadUserSessions())}catch(e){yield Ci(Do.setSessionsState({error:e,loading:!1}))}}function*vT({payload:{callback:e,userId:t}}){yield Ci(Do.setSessionsState({loading:!0,error:null}));try{yield Di(Gf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Ci(Do.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*hT(){yield Ci(Do.setSessionsState({loading:!0,error:null}));try{yield Di(Gf.auth.deleteAllSessionsForUser),yield Ci(Do.loadUserSessions())}catch(e){yield Ci(Do.setSessionsState({error:e,loading:!1}))}}function*mT(){yield wa(Do.loadUserSessions,pT),yield wa(Do.deleteUserSession,ST),yield wa(Do.deleteAllUserSessions,hT),yield wa(Do.loadCurrentUserSession,gT),yield _a(Do.revokeUserSessions,vT)}function*AT(){yield Ci(Do.setSessionsState({loading:!0,error:null})),yield Ci(Do.setSessionsState({sessions:Cp,loading:!1}))}function*bT({payload:{id:e}}){yield Ci(Do.setSessionsState({loading:!0,error:null}));const t=(yield Fi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Ci(Do.setSessionsState({sessions:t,loading:!1}))}function*TT(){yield Ci(Do.setSessionsState({loading:!0,error:null}));const e=Cp.filter((e=>e.current));yield Ci(Do.setSessionsState({sessions:e,loading:!1}))}function*kT(){yield wa(Do.loadUserSessions,AT),yield wa(Do.deleteUserSession,bT),yield wa(Do.deleteAllUserSessions,TT)}const ET=["callback"],IT=["callback"];function*PT(){yield Ci(Do.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getSessionConfigurations);yield Ci(Do.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Ci(Do.setSessionsState({error:e,loading:!1}))}}function*LT({payload:e}){yield Ci(Do.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=zo(e,ET);yield Di(Gf.auth.createOrUpdateSessionConfigrations,n),yield Ci(Do.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Ci(Do.setSessionsPolicyState({error:e,loading:!1}))}}function*OT(){yield Ca(Do.loadSessionsPolicy,PT),yield wa(Do.createOrUpdateSessionsPolicy,cg(LT))}function*_T(){yield Ci(Do.setSessionsPolicyState({loading:!0,error:null}));const e=yield Fi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Up}));yield Ci(Do.setSessionsPolicyState(U({},e,{loading:!1})))}function*wT({payload:e}){yield Ci(Do.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=zo(e,IT);null==t||t(!0),yield Ci(Do.setSessionsPolicyState({configurations:n,loading:!1}))}function*CT(){yield Ca(Do.loadSessionsPolicy,_T),yield wa(Do.createOrUpdateSessionsPolicy,wT)}const UT=["callback"],RT=["callback"],DT=["callback"],NT=["callback"],MT=["callback"],FT=["callback"],GT=["callback"],$T=["callback"],xT=()=>Fi((e=>e.auth.restrictionsState.ipRestrictions)),VT=()=>Fi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*BT(){yield Ci(Do.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Di(Gf.auth.getDomainRestrictionsConfig),t=(yield Di(Gf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Ci(Do.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Ci(Do.setEmailDomainRestrictionsState({error:Hp(e),loading:!1}))}}function*jT(e){let{payload:{callback:t}}=e,n=zo(e.payload,UT);yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield VT();try{var i;yield Di(Gf.auth.createDomainRestriction,n);const e=(yield Di(Gf.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield Ci(Do.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 Ci(Do.setEmailDomainRestrictionsState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*WT(e){let{payload:{callback:t}}=e,n=zo(e.payload,RT);yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Di(Gf.auth.updateDomainRestrictionConfig,n),o=(yield Di(Gf.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Ci(Do.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setEmailDomainRestrictionsState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*KT({payload:{id:e}}){yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield VT();try{var n;yield Di(Gf.auth.deleteDomainRestriction,e);const o=(yield Di(Gf.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Ci(Do.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield Ci(Do.setEmailDomainRestrictionsState({saving:!1,error:Hp(e)}))}}const HT=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Bn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*zT(){yield Ci(Do.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield xT(),t=yield Di(Gf.auth.getIPRestrictionsConfig),n=HT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Di(Gf.auth.getIPRestrictions,n);yield Ci(Do.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield Ci(Do.setIpRestrictionsState({error:Hp(e),loading:!1}))}}function*qT(){try{const{valid:e}=yield Di(Gf.auth.testCurrentIpInAllowList);yield Ci(Do.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Ci(Do.setIpRestrictionsState({error:Hp(e)}))}}function*YT({payload:{callback:e}}){yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Fi((e=>e.auth.userIp));yield Ui([Di(Gf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Bn.ALLOW}),Di(Gf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield xT(),o=HT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Di(Gf.auth.getIPRestrictions,o);yield Ci(Do.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Bn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Ci(Do.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*JT(e){let{payload:{callback:t}}=e,n=zo(e.payload,DT);yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));const o=yield xT();try{var i,a;yield Di(Gf.auth.createIPRestriction,n);const e=yield xT(),r=HT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Di(Gf.auth.getIPRestrictions,r);yield qT(),yield Ci(Do.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:Bn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setIpRestrictionsState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*QT(e){let{payload:{callback:t}}=e,n=zo(e.payload,NT);yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));try{yield Di(Gf.auth.updateIPRestrictionConfig,n);const e=yield xT(),o=yield Di(Gf.auth.getIPRestrictionsConfig),i=HT(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Di(Gf.auth.getIPRestrictions,i);yield qT(),yield Ci(Do.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setIpRestrictionsState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*XT({payload:{id:e,callback:t}}){yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));const n=yield xT();try{var o;yield Di(Gf.auth.deleteIPRestriction,e);const i=yield xT(),a=HT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Di(Gf.auth.getIPRestrictions,a);yield qT(),yield Ci(Do.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setIpRestrictionsState({saving:!1,error:Hp(e)})),null==t||t(null,e)}}function*ZT(){yield Ca(Do.loadIpRestrictions,cg(zT)),yield Ca(Do.loadEmailDomainRestrictions,cg(BT)),yield _a(Do.saveIpRestriction,cg(JT)),yield _a(Do.saveIpRestrictionsConfig,cg(QT)),yield _a(Do.deleteIpRestriction,cg(XT)),yield _a(Do.checkIfUserIpValid,cg(qT)),yield _a(Do.addCurrentUserIpAndActivate,cg(YT)),yield _a(Do.saveEmailDomainRestriction,cg(jT)),yield _a(Do.saveEmailDomainRestrictionsConfig,cg(WT)),yield _a(Do.deleteEmailDomainRestriction,cg(KT))}function*ek(){yield Ci(Do.setIpRestrictionsState({loading:!0,error:null})),yield Ci(Do.setIpRestrictionsState({data:{restrictions:Dp.filter((e=>e.strategy===Rp.strategy)),config:Rp},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*tk(){yield Ci(Do.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield xT(),t=Dp[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Ci(Do.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Ci(Do.setIpRestrictionsState({error:Hp(e),loading:!1}))}}function*nk(e){var t,n,o;let{payload:{callback:i}}=e,a=zo(e.payload,MT);yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));const r=yield xT(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Ci(Do.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Bn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:nA(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*ok(e){var t,n,o;let{payload:{callback:i}}=e,a=zo(e.payload,FT);const r=yield xT();yield Ci(Do.setIpRestrictionsState({saving:!0,error:null})),yield Ci(Do.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Ci(Do.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*ik({payload:{id:e,callback:t}}){var n;yield Ci(Do.setIpRestrictionsState({saving:!0,error:null}));const o=yield xT();yield Ci(Do.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:Bn.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Bn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*ak(){yield Ci(Do.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Ci(Do.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Bn.ALLOW}],config:{active:!0,listType:Bn.ALLOW,blockPublicDomains:!1}}}))}function*rk(e){var t,n;let{payload:{callback:o}}=e,i=zo(e.payload,GT);const a=yield VT();yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==o||o(!0),yield Ci(Do.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)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*lk(e){var t;let{payload:{callback:n}}=e,o=zo(e.payload,$T);const i=yield VT();yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),null==n||n(!0),yield Ci(Do.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||Bn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*sk({payload:{id:e}}){var t,n;const o=yield VT();yield Ci(Do.setEmailDomainRestrictionsState({saving:!0,error:null})),yield bt(),yield Ci(Do.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Bn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*ck(){yield Ca(Do.loadIpRestrictions,ek),yield Ca(Do.loadEmailDomainRestrictions,ak),yield _a(Do.saveIpRestriction,nk),yield _a(Do.saveIpRestrictionsConfig,ok),yield _a(Do.deleteIpRestriction,ik),yield _a(Do.checkIfUserIpValid,tk),yield _a(Do.saveEmailDomainRestriction,rk),yield _a(Do.saveEmailDomainRestrictionsConfig,lk),yield _a(Do.deleteEmailDomainRestriction,sk)}const uk=["callback"],dk=["id"];function*yk(e){const{count:t}=yield Di(Gf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*fk(){yield Ci(Do.setProvisioningState({loading:!0,error:null}));try{const e=yield Di(Gf.directory.getConfigs),t=yield Ui(e.map((e=>yk(e))));yield Ci(Do.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Ci(Do.setProvisioningState({error:Hp(e),loading:!1}))}}function*pk(e){let{payload:{callback:t}}=e,n=zo(e.payload,uk);yield Ci(Do.setProvisioningState({loading:!0,error:null}));try{const e=yield Di(Gf.directory.createConfiguration,n),o=yield Di(Gf.directory.getConfigs),i=yield Ui(o.map((e=>yk(e))));yield Ci(Do.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield Ci(Do.setProvisioningState({error:Hp(e),loading:!1}))}}function*gk(e){let{payload:{id:t}}=e,n=zo(e.payload,dk);yield Ci(Do.setProvisioningState({loading:!0,error:null}));try{yield Di(Gf.directory.updateConfiguration,t,n);const e=yield Di(Gf.directory.getConfigs),o=yield Ui(e.map((e=>yk(e))));yield Ci(Do.setProvisioningState({connections:o,loading:!1}))}catch(e){yield Ci(Do.setProvisioningState({error:Hp(e),loading:!1}))}}function*Sk({payload:{id:e,callback:t}}){yield Ci(Do.setProvisioningState({loading:!0,error:null}));try{yield Di(Gf.directory.deleteConfiguration,e);const n=yield Di(Gf.directory.getConfigs),o=yield Ui(n.map((e=>yk(e))));yield Ci(Do.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setProvisioningState({error:Hp(e),loading:!1})),null==t||t(!1,e)}}function*vk(){yield Ca(Do.loadProvisionConnections,fk),yield _a(Do.createProvisionConnection,pk),yield _a(Do.deleteProvisionConnection,Sk),yield _a(Do.updateProvisionConnection,gk)}const hk=["callback","events"];function*mk(e){let{payload:{callback:t}}=e,n=zo(e.payload,hk);yield Ci(Do.setImpersonateState({loading:!0}));try{yield Di(Gf.impersonate.impersonate,n),yield Ci(Do.setImpersonateState({step:Oo.success})),yield Gi(1e3),yield qS(),yield Ci(Do.resetImpersonateState()),null==t||t(!0)}catch(e){yield Ci(Do.setImpersonateState({loading:!1,error:Hp(e)}))}}function*Ak(){yield Ca(Do.impersonate,mk)}function*bk({payload:e}){const{callback:t,deviceId:n}=e;yield Ci(Do.setPasskeysState({loading:!0}));try{yield Di(Gf.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Fi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield Ci(Do.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield Ci(Do.setPasskeysState({loading:!1,error:Hp(e,null)})),null==t||t(null,e)}}function*Tk(){yield Ci(Do.setPasskeysState({loading:!0}));try{const{devices:e}=yield Di(Gf.auth.getWebAuthnDevices);yield Ci(Do.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Ci(Do.setPasskeysState({loading:!1,error:Hp(e,null)}))}}function*kk(){yield _a(Do.loadWebAuthnDevices,Tk),yield _a(Do.deleteWebAuthnDevice,bk)}const Ek=["roleIds","userIds"],Ik=()=>Fi((e=>e.auth.groupsState));function*Pk({payload:e}){const t=oA.GET_TEAM_USERS;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Di(Gf.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Ci(Do.setGroupsState({teamUsers:n}))}catch(e){yield Ci(Do.setUsersGroupsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=oA.GET_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Di(Gf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:iA.rolesAndUsers});yield Ci(Do.setGroupsState({selectedGroup:n}))}catch(e){yield Ci(Do.setUsersGroupsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Ok(){const e=oA.GET_GROUPS,t=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Di(Gf.groups.getGroups,{_groupsRelations:iA.rolesAndUsers});yield Ci(Do.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Ci(Do.setUsersGroupsError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:e,value:!1}))}}function*_k({payload:e}){const t=oA.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=zo(e,Ek);yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Di(Gf.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield Ci(Do.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield Ci(Do.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Ci(Do.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*wk({payload:e}){const t=oA.UPDATE_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.updateGroup,e),yield Ci(Do.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Ck({payload:e}){const t=oA.DELETE_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.deleteGroup,e.groupId),yield Ci(Do.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=oA.ADD_ROLES_TO_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Ci(Do.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk({payload:e}){const t=oA.DELETE_ROLES_FROM_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Ci(Do.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Dk({payload:e}){const t=oA.ADD_USERS_TO_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Ci(Do.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 Ci(Do.setUsersGroupsError({key:t,value:Hp(n)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk({payload:e}){const t=oA.DELETE_USERS_FROM_GROUP;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Di(Gf.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Ci(Do.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield Ci(Do.setUsersGroupsError({key:t,value:Hp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Mk(){const e=oA.GET_GROUP_CONFIGURATION;yield Ci(Do.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Di(Gf.groups.getGroupConfiguration);yield Ci(Do.setGroupsState({groupsConfiguration:t}))}catch(t){yield Ci(Do.setUsersGroupsError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:e,value:!1}))}}function*Fk({payload:e}){const t=oA.UPDATE_GROUP_CONFIGURATION;yield Ci(Do.setUsersGroupsLoader({key:t,value:!0}));try{yield Di(Gf.groups.updateGroupConfiguration,e),yield Ci(Do.getGroupConfiguration())}catch(e){yield Ci(Do.setUsersGroupsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}}function*Gk(){yield wa(Do.loadGroups,Ok),yield wa(Do.getGroupById,Lk),yield wa(Do.createGroup,_k),yield wa(Do.updateGroup,wk),yield wa(Do.deleteGroup,Ck),yield wa(Do.addRolesToGroup,Uk),yield wa(Do.deleteRolesFromGroup,Rk),yield wa(Do.addUsersToGroup,Dk),yield wa(Do.deleteUsersFromGroup,Nk),yield wa(Do.getGroupConfiguration,Mk),yield wa(Do.updateGroupConfiguration,Fk),yield wa(Do.getTeamUsers,Pk)}function*$k(){const e=oA.GET_GROUPS;yield Ci(Do.setUsersGroupsLoader({key:e,value:!0}));const t=Fp;yield Ci(Do.setGroupsState({groups:t})),yield Ci(Do.setUsersGroupsLoader({key:e,value:!1}))}function*xk({payload:e}){var t;const n=oA.CREATE_GROUP,{groups:o}=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:n,value:!0})),yield Ci(Do.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Uf.FRONTEGG}),...null!=o?o:[]]})),yield Gi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:n,value:!1}))}function*Vk({payload:e}){var t,n,o,i,a;const r=oA.UPDATE_GROUP,l=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:r,value:!0})),yield Ci(Do.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Uf.FRONTEGG}):t})),selectedGroup:U({},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 Gi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:r,value:!1}))}function*Bk({payload:e}){var t,n;const o=oA.DELETE_GROUP,i=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:o,value:!0})),yield Ci(Do.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Gi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:o,value:!1}))}function*jk({payload:e}){var t,n;const o=oA.ADD_ROLES_TO_GROUP,i=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:o,value:!0})),yield Ci(Do.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Gi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:o,value:!1}))}function*Wk({payload:e}){var t,n;const o=oA.DELETE_ROLES_FROM_GROUP,i=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:o,value:!0})),yield Ci(Do.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Gi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:o,value:!1}))}function*Kk({payload:e}){var t,n;const o=oA.ADD_USERS_TO_GROUP,i=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:o,value:!0})),yield Ci(Do.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Gi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:o,value:!1}))}function*Hk({payload:e}){var t,n;const o=oA.DELETE_USERS_FROM_GROUP,i=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:o,value:!0})),yield Ci(Do.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Gi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Ci(Do.setUsersGroupsLoader({key:o,value:!1}))}function*zk(){const e=oA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Ci(Do.setGroupsState({groupsConfiguration:U({},t)}))),yield Ci(Do.setUsersGroupsLoader({key:e,value:!1}))}function*qk({payload:e}){const t=oA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Ik();yield Ci(Do.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Ci(Do.setGroupsState({groupsConfiguration:U({},n,e)}))),yield Ci(Do.setUsersGroupsLoader({key:t,value:!1}))}function*Yk(){yield wa(Do.loadGroups,$k),yield wa(Do.createGroup,xk),yield wa(Do.updateGroup,Vk),yield wa(Do.deleteGroup,Bk),yield wa(Do.addRolesToGroup,jk),yield wa(Do.deleteRolesFromGroup,Wk),yield wa(Do.addUsersToGroup,Kk),yield wa(Do.deleteUsersFromGroup,Hk),yield wa(Do.getGroupConfiguration,zk),yield wa(Do.updateGroupConfiguration,qk)}let Jk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",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"}(Jk||(Jk={}));const Qk=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>Qk(e,t,n))))?o:[]})};function Xk(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Xk(e,t))):[]})}function Zk(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 U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>Zk(e,t,n))))?o:[]})}const eE=({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}})),tE=()=>Fi((e=>e.auth.allAccountsState));function*nE({payload:e}){const t=Jk.GET_ACCOUNTS;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield tE(),{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 tE(),{items:n,_links:i}=yield Di(Gf.tenants.searchSubTenants,r,{jwt:o}),a=yield Di(Gf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=eE({items:n},a),c=Zk(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 Ci(Do.setSelectedAccountState({accounts:c}))}else{var s;const{accounts:t}=yield tE(),{items:n,_links:o}=yield Di(Gf.tenants.searchSubTenants,r),i=yield Di(Gf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=eE({items:n},i),l=Zk(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 Ci(Do.setAllAccountsState({accounts:l}))}}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*oE({payload:e}){const t=Jk.SEARCH_ACCOUNTS;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield tE(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Di(Gf.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield Ci(Do.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*iE({payload:e}){const t=Jk.GET_USER_JWT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Di(Gf.users.GetUserJwt,{tenantId:n});yield Ci(Do.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==o||o(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),yield Ci(Do.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*aE({payload:e}){const t=Jk.CREATE_SUB_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:o,tenantId:i,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield tE(),{selectedAccount:t}=yield tE(),r=yield Di(Gf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=Zk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=Zk(U({name:"",tenantId:""},null==t?void 0:t.accounts),null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Ci(Do.setAllAccountsState({accounts:l})),yield Ci(Do.setSelectedAccountState({accounts:s}))}else{const{accounts:e}=yield tE(),t=yield Di(Gf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=Zk(e,null!=o?o:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Ci(Do.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==r||r(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*rE({payload:e}){const t=Jk.DELETE_SUB_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:o,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield tE();yield Di(Gf.subTenants.deleteSubTenant,o,{jwt:n});const i=Xk(t,o),a=Xk(null==e?void 0:e.accounts,o);yield Ci(Do.setAllAccountsState({accounts:i})),yield Ci(Do.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield tE();yield Di(Gf.subTenants.deleteSubTenant,o);const t=Xk(e,o);yield Ci(Do.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==i||i(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*lE({payload:e}){const t=Jk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:o,callback:i,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield tE();yield Di(Gf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Qk(e.accounts,a,o);yield Ci(Do.setSelectedAccountState({name:o,accounts:i}));const r=Qk(t,a,o);yield Ci(Do.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield tE();yield Di(Gf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Qk(e,a,o);yield Ci(Do.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==i||i(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*sE({payload:e}){const t=Jk.DELETE_USERS_FROM_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield Di(Gf.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),yield Ci(Do.getAccountUsers({jwt:i,_tenantId:o[0].tenantId})),null==a||a(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==a||a(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*cE({payload:e}){const t=Jk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e,{selectedAccount:r}=yield tE();try{yield Di(Gf.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),yield Ci(Do.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==a||a(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*uE({payload:e}){const t=Jk.ADD_USERS_TO_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a,allowSubAccountAccess:r=!1,roleIds:l}=e;try{yield Di(Gf.subTenants.addUsersToSubTenant,{users:n,tenantId:o,allowSubAccountAccess:r,roleIds:l},{jwt:i}),yield Ci(Do.getAccountUsers({jwt:i,_tenantId:o})),null==a||a(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==a||a(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*dE({payload:e}){const t=Jk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield tE(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Di(Gf.subTenants.updateSubAccountAccess,o,{allowAccess:i},{jwt:a}),yield Ci(Do.setSelectedAccountState({users:null==n||null==(l=n.users)?void 0:l.map((e=>e.id===o?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)})),null==r||r(!1)}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*yE({payload:e}){var t,n,o,i,a,r,l,s;const c=Jk.GET_ACCOUNT_USERS;yield Ci(Do.setAllAccountsLoader({key:c,value:!0}));const u=yield tE(),{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=U({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Di(Gf.users.getUsersV3,S,{jwt:d}),o={totalUsersItems:t,totalUsersPages:n,usersQueryParams:U({_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 Di(Gf.roles.getRoles),i=yield Di(Gf.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 U({},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 Ci(Do.setSelectedAccountState(U({users:a},o)))}else yield Ci(Do.setSelectedAccountState(U({users:[]},o)))}catch(e){yield Ci(Do.setAllAccountsError({key:c,value:Hp(e)}))}finally{yield Ci(Do.setAllAccountsLoader({key:c,value:!1}))}}function*fE({payload:e}){const t=Jk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var o,i,a,r,l,s,c;const e=yield Di(Gf.accountSettings.getSettings,{jwt:n}),u=yield Di(Gf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Di(Gf.tenants.getParentTenants,{jwt:n}),y=yield Di(Gf.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield Ci(Do.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 Ci(Do.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*pE(){const e=Jk.SET_ROOT_ACCOUNT_DATA;yield Ci(Do.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Fi((e=>e.auth.tenantsState)),{accounts:n}=yield tE();if(t)try{var o;const i=yield Di(Gf.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(o=i[0])?void 0:o.totalUsers,createdAt:null==t?void 0:t.createdAt};yield Ci(Do.setAllAccountsState({rootAccount:a,accounts:U({},n,a)}))}catch(t){yield Ci(Do.setAllAccountsError({key:e,value:Hp(t)}))}finally{yield Ci(Do.setAllAccountsLoader({key:e,value:!1}))}}function*gE({payload:e}){const t=Jk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Ci(Do.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:o}=e;try{const e=yield Di(Gf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield Ci(Do.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Ci(Do.setAllAccountsError({key:t,value:Hp(e)}))}finally{yield Ci(Do.setAllAccountsLoader({key:t,value:!1}))}}function*SE(){yield wa(Do.loadAccounts,nE),yield wa(Do.searchAccounts,oE),yield wa(Do.updateSubAccountAccessForUser,dE),yield wa(Do.getUserJwtForSubAccount,iE),yield wa(Do.createSubAccount,aE),yield wa(Do.deleteSubAccount,rE),yield wa(Do.updateSubAccountSettings,lE),yield wa(Do.addUsersToAccount,uE),yield wa(Do.deleteUsersFromAccount,sE),yield wa(Do.setUserRolesForSubAccount,cE),yield wa(Do.getAccountUsers,yE),yield wa(Do.setRootAccountData,pE),yield wa(Do.setSelectedSubAccountData,fE),yield wa(Do.loadNumberOfUsersForSelectedSubAccount,gE)}var vE={sagas:function*(){yield Ui([Di(qv),Di(Hm),Di(qm),Di(Mm),Di(fT),Di(uh),Di(Gh),Di(Wh),Di(rg),Di(Tm),Di(QA),Di(Gk),Di(hb),Di(yS),Di(Lb),Di(qg),Di(Mb),Di(Wb),Di(iT),Di(mT),Di(OT),Di(ZT),Di(vk),Di(Ak),Di(kk),Di(SE),Di(ES),Di(hg)])},mockSagas:function*(){yield Ui([Di(Qv),Di(vh),Di(qh),Di(Cm),Di(ub),Di(Rb),Di(lS),Di(kT),Di($b),Di(Hb),Di(CT),Di(ck),Di(rT),Di(Yk),Di(Ig)])},storeName:Ct,initialState:Lo,reducer:Uo,actions:Do};const hE=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),mE={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},AE={setAuditLogsState:hE("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:mE})},bE={exportAuditsCsv:ut("auditLogs/exportAuditsCsv"),loadAuditLogs:ut("auditLogs/loadAuditLogs",(e=>({payload:e})))},TE={loading:!0},kE={setAuditsMetadataState:hE("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:TE})},EE={loadAuditsMetadata:ut("auditLogs/loadAuditsMetadata")},IE={auditLogsState:mE,auditsMetadataState:TE},{reducer:PE,actions:LE}=yt({name:Rt,initialState:IE,reducers:U({resetState:e=>U({},e,IE),setState:(e,{payload:t})=>U({},e,t)},AE,kE)}),OE=U({},LE,bE,EE),_E=e=>"createdAt"!==e.id,wE={total:20,data:Array.from(Array(5).keys()).map((e=>U({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`})))},CE={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}]},UE=()=>Fi((e=>e.auditLogs.auditLogsState)),RE=()=>Fi((e=>e.auditLogs.auditsMetadataState));function*DE(){const e=yield UE(),{columns:t}=yield RE();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield Ci(OE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Gf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield Ci(OE.setAuditLogsState({isDownloadingCsv:!1}))}function*NE({payload:e}){yield Ci(OE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield UE(),{columns:n}=yield RE();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 Ci(OE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield Ci(OE.loadAuditsMetadata()));const{data:p,total:g}=yield Di(Gf.audits.getAudits,U({offset:c,count:s},y,f));yield Ci(OE.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 Ci(OE.setAuditLogsState({loading:!1,error:Hp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*ME(){yield _a(OE.exportAuditsCsv,DE),yield _a(OE.loadAuditLogs,NE)}function*FE({payload:e}){yield Ci(OE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield UE(),{columns:n}=yield RE();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 Ci(OE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield Ci(OE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=wE;let o=n.filter((e=>t=>e.filter(_E).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 Ci(OE.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 Ci(OE.setAuditLogsState({loading:!1,error:Hp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*GE(){yield _a(OE.loadAuditLogs,FE)}function*$E(){yield Ci(OE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Di(Gf.metadata.getAuditsMetadata);yield Ci(OE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Ci(OE.setAuditsMetadataState({error:e,loading:!1}))}}function*xE(){yield _a(OE.loadAuditsMetadata,$E)}function*VE(){yield Ci(OE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=CE;yield Ci(OE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Ci(OE.setAuditsMetadataState({error:e,loading:!1}))}}function*BE(){yield _a(OE.loadAuditsMetadata,VE)}var jE={sagas:function*(){yield Ui([Di(ME),Di(xE)])},mockSagas:function*(){yield Ui([Di(GE),Di(BE)])},storeName:Rt,initialState:IE,reducer:PE,actions:OE};const WE={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:KE,actions:HE,reducer:zE}=yt({name:"audits",initialState:WE,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=U({},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]})))}}}),qE=U({},HE,{initData:ut(`${KE}/initData`),loadAudits:ut(`${KE}/loadAudits`),removeFilter:ut(`${KE}/removeFilter`),filterData:ut(`${KE}/filterData`),exportCSV:ut(`${KE}/exportCSV`),deleteAudits:ut(`${KE}/deleteAudits`)}),YE=()=>Fi((e=>e[KE]));function*JE(){const{sortBy:e,sortDirection:t}=yield YE();try{const n=yield Di(Gf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Ci(qE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Ci(qE.loadItemFailedAction(t))}}function*QE(){try{const e=yield Di(Gf.metadata.getAuditsMetadata);yield Ci(qE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Ci(qE.loadItemFailedAction(t))}}const XE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*ZE({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=XE(t),{data:l,total:d}=yield Di(Gf.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Ci(qE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield Ci(qE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Ci(qE.loadItemFailedAction(t))}}function*eI(){yield Ci(qE.startLoading()),yield Ui([JE(),QE(),ZE({payload:{onlyOneLoad:!1},type:""})]),yield Ci(qE.finishLoading())}function*tI({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 Ci(qE.setFilterData(o))}function*nI({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 Ci(qE.setFilterData(o))}function*oI(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield YE(),a=XE(e);yield Ci(qE.startDownloadingCsv());try{yield Gf.audits.exportAudits(U({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 Ci(qE.stopDownloadingCsv())}}function*iI(){yield wa(qE.initData,eI),yield wa(qE.removeFilter,tI),yield wa(qE.filterData,nI),yield wa([qE.loadAudits,qE.textSearch,qE.onPageChange],ZE),yield wa([qE.setFilterData,qE.setDataSorting,qE.startRefresh],(()=>ZE({payload:{appendMode:!1},type:""}))),yield wa(qE.exportCSV,oI)}const aI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},rI={initData:()=>U({},aI),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},lI={loadSlackActions:ut("connectivity/loadSlackActions"),loadDataAction:ut("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ut("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ut("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ut("connectivity/loadScope"),deleteWebhookConfigAction:ut("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ut("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ut("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},sI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:cI,actions:uI}=yt({name:Ut,initialState:sI,reducers:U({},rI)}),dI=U({},uI,lI),yI={slack:Gf.connectivity.getSlackConfiguration,email:Gf.connectivity.getEmailConfiguration,sms:Gf.connectivity.getSMSConfiguration,webhook:Gf.connectivity.getWebhooksConfigurations,categories:Gf.connectivity.getCategories,channelMap:Gf.connectivity.getChannelMaps},fI={slack:Gf.connectivity.postSlackConfiguration,email:Gf.connectivity.postEmailConfiguration,sms:Gf.connectivity.postSMSConfiguration,webhook:Gf.connectivity.postWebhooksConfiguration},pI=["email","slack","sms","webhook"],gI={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"}},SI=["id"],vI=["id","enabled"],hI=["categories","channelMap"];function*mI(e){return yield Di(bI,{payload:{api:e},type:""})}function*AI({payload:e=pI}){yield Ci(dI.setConnectivityState({isLoading:!0}));try{const t=yield Ui([...e.map(mI),yield bI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ui(e.map((function*(e){return yield bI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield bI({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:gI[e[i]].events(o),active:gI[e[i]].isActive(o),platform:gI[e[i]].title,image:gI[e[i]].image}]}):n:U({},n,{[`${hI[i-e.length]}`]:o})),{list:[],webhook:n});yield Ci(dI.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Ci(dI.setConnectivityState({isLoading:!1}))}}function*bI({payload:{api:e,params:t}}){try{return yield Di(yI[e],t)}catch(e){return}}function*TI(){try{yield Ci(dI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Di(Gf.connectivity.getSlackChannels);yield Ci(dI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Ci(dI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*kI(e,t){const{connectivity:{list:n}}=yield Fi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=gI[e].isActive(t);i!==o.active&&(yield Ci(dI.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*EI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Fi((e=>e.connectivity));try{if(yield Ci(dI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Fi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Ui([...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=zo(e,SI);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield Di(fI.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Di(Gf.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Fi(),{processIds:o}=yield Fi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Ui([...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 Di("email"===t?Gf.connectivity.postEmailConfiguration:Gf.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=zo(i,vI);return yield Ui([yield Di("email"===t?Gf.connectivity.patchEmailConfiguration:Gf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Di("email"===t?Gf.connectivity.putEmailSubscriptions:Gf.connectivity.putSMSSubscriptions,a,o,U({},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 Di("email"===t?Gf.connectivity.deleteEmailSubscriptions:Gf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield bI({payload:{api:t},type:""});yield Ci(dI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield kI(t,e)}else yield Ci(dI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Di(fI[e],t),!["sms","email"].includes(e)){const i=yield bI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield Ci(dI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield kI(e,i),null==n||n(!0)}}catch(e){yield Ci(dI.setConnectivityState({error:Hp(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*II({payload:e}){try{yield Gf.connectivity.postSlackCode(e)}catch{}yield Ci(dI.setConnectivityState({error:void 0,isSaving:!1}))}function*PI(){const{slackChannels:e}=yield Fi((e=>e.connectivity));try{yield Ci(dI.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Di(Gf.connectivity.getSlackScope);yield Ci(dI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Ci(dI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*LI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Fi((e=>e.connectivity));try{yield Ci(dI.setConnectivityState({isSaving:!0})),yield Di(Gf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Hp(e))}const i=yield bI({payload:{api:"webhook"},type:""});i&&(yield Ci(dI.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*OI({payload:e}){try{yield Ci(dI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Di(Gf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Ci(dI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Ci(dI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Ci(dI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*_I({payload:e}){try{const{statusCode:t}=yield Di(Gf.connectivity.postWebhookRetry,e);yield Ci(dI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Ci(dI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*wI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Fi((e=>e.connectivity));try{yield Ci(dI.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Di(Gf.connectivity.getWebhookLog,e,n,t);yield Ci(dI.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield Ci(dI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var CI={sagas:function*(){yield _a(dI.loadDataAction,AI),yield wa(dI.loadSlackActions,TI),yield _a(dI.postDataAction,EI),yield _a(dI.postCodeAction,II),yield _a(dI.loadScope,PI),yield _a(dI.deleteWebhookConfigAction,LI),yield _a(dI.postWebhookTestAction,OI),yield _a(dI.postWebhookRetryAction,_I),yield wa(dI.loadWebhookLogsAction,wI)},storeName:Ut,initialState:sI,reducer:cI,actions:dI};function UI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function RI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function DI(e){return RI(e,((e,t)=>U({},e,{loading:t.payload})))}function NI(e){return RI(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const MI={loading:!1,error:null,fetching:!0,plans:[]},{actions:FI,reducer:GI,name:$I}=yt({name:"subscriptions/plans",initialState:MI,reducers:U({},UI())}),xI=U({loadPlans:ut(`${$I}/loadPlans`)},FI),VI={loading:!1,error:null,fetching:!0,config:null},BI=U({},UI()),{actions:jI,reducer:WI,name:KI}=yt({name:"subscriptions/config",initialState:VI,reducers:BI}),HI=U({loadPaymentConfiguration:ut(`${KI}/loadPaymentConfiguration`)},jI),zI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},qI=U({},UI(),{setCancellationLoading:DI("cancellation"),setCancellationError:NI("cancellation"),setRenewalLoading:DI("renewal"),setRenewalError:NI("renewal")}),{reducer:YI,actions:JI,name:QI}=yt({name:"subscriptions/billing/subscription",initialState:zI,reducers:qI}),XI=U({load:ut(`${QI}/loadSubscription`),cancelSubscription:ut(`${QI}/cancelSubscription`),renewSubscription:ut(`${QI}/renewSubscription`)},JI),ZI={loading:!1,error:null,fetching:!0},eP=U({},UI()),{reducer:tP,actions:nP,name:oP}=yt({name:"subscriptions/billing/information",initialState:ZI,reducers:eP}),iP=U({loadBillingInformation:ut(`${oP}/loadBillingInformation`),cancelSubscription:XI.cancelSubscription,renewSubscription:XI.renewSubscription},nP),aP={loading:!1,error:null,fetching:!0},rP=U({},UI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:lP,actions:sP,name:cP}=yt({name:"subscriptions/billing/payment",initialState:aP,reducers:rP}),uP=U({loadPaymentMethod:ut(`${cP}/loadPaymentMethod`),submitPaymentMethod:ut(`${cP}/submitPaymentMethod`),submitPaymentMethodError:ut(`${cP}/submitPaymentMethodError`),submitPaymentMethodSuccess:ut(`${cP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ut(`${cP}/updateBillingDetails`,(e=>({payload:e})))},sP),dP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},yP=U({},UI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:fP,actions:pP,name:gP}=yt({name:"subscriptions/billing/invoices",initialState:dP,reducers:yP}),SP=U({loadInvoices:ut(`${gP}/loadInvoices`),downloadInvoice:ut(`${gP}/downloadInvoice`,(e=>({payload:e})))},pP),vP={information:ZI,invoices:dP,paymentMethod:aP,subscription:zI},hP={invoices:SP,information:iP,paymentMethod:uP,subscription:XI},mP=We({invoices:fP,information:tP,paymentMethod:lP,subscription:YI}),AP={fetching:!0,loading:!1,error:null,confirmed:!1},bP=U({},UI()),{actions:TP,reducer:kP,name:EP}=yt({name:"subscriptions/checkout",initialState:AP,reducers:bP}),IP=U({loadCheckout:ut(`${EP}/loadCheckout`),resetCheckout:ut(`${EP}/resetCheckout`),submitCheckout:ut(`${EP}/submitCheckout`),confirmCheckout:ut(`${EP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ut(`${EP}/errorCheckout`,(e=>({payload:e})))},TP),PP={loading:!1,error:null,cardSetupIntentSecret:null},LP=U({},UI()),{reducer:OP,actions:_P,name:wP}=yt({name:"subscriptions/stripe",initialState:PP,reducers:LP}),CP=U({loadCustomer:ut(`${wP}/loadCustomer`),createCardSetupIntentSecret:ut(`${wP}/createCardSetupIntentSecret`)},_P),UP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:RP,reducer:DP,name:NP}=yt({name:"subscriptions/vendorPublicConfig",initialState:UP,reducers:U({},UI())}),MP=U({loadVendorPublicConfiguration:ut(`${NP}/loadVendorPublicConfiguration`)},RP),FP={config:VI,plans:MI,checkout:AP,billing:vP,stripe:PP,vendorPublicConfig:UP},GP={config:HI,billing:hP,plans:xI,checkout:IP,stripe:CP,vendorPublicConfig:MP},$P=We({config:WI,billing:mP,plans:GI,checkout:kP,stripe:OP,vendorPublicConfig:DP});let xP,VP,BP;function jP({policy:e}){return{policy:BP.AT_PERIOD_END}}function WP(e){switch(e){case _y.ACTIVE:return VP.ACTIVE;case _y.INCOMPLETE:return VP.INCOMPLETE;case _y.CANCELED:return VP.CANCELED;case _y.EXPIRED:return VP.EXPIRED;case _y.TRIALING:return VP.TRIALING;default:return VP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(xP||(xP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(VP||(VP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(BP||(BP={}));const KP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:_y.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},HP=[{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"}],zP=[{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:""}],qP=[{id:"id",externalId:"externalId",type:wy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],YP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*JP(){yield _a(XI.load,QP),yield _a(XI.cancelSubscription,ZP),yield _a(XI.renewSubscription,eL)}function*QP(){const e=yield Fi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield aL(e)}function*XP(){yield Ci(XI.setLoading(!0));try{const[e]=yield Di(Gf.subscriptions.getManagedSubscriptions);yield Ci(XI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Ci(XI.setError(e))}}function*ZP(){const{subscription:e}=yield Fi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Ci(XI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Ci(XI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===_y.ACTIVE)try{yield Ci(XI.setCancellationLoading(!0)),yield Di(Gf.subscriptions.cancelManagedSubscription,t),yield XP(),yield Ci(XI.setCancellationLoading(!1))}catch(e){yield Ci(XI.setCancellationError(Hp(e)))}}function*eL(){const{subscription:e}=yield Fi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Ci(XI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Ci(XI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Cy.AT_PERIOD_END)try{yield Ci(XI.setRenewalLoading(!0)),yield Di(Gf.subscriptions.renewManagedSubscription,t),yield XP(),yield Ci(XI.setRenewalLoading(!1))}catch(e){yield Ci(XI.setCancellationError(Hp(e)))}}function*tL(){yield Ci(XI.setLoading(!0)),yield Gi(500),yield Ci(XI.setState({subscription:KP,fetching:!1,loading:!1,error:null}))}function*nL(){yield _a(XI.load,tL)}function*oL(){yield _a(iP.loadBillingInformation,iL)}function*iL(){yield function*(e){const t=yield Fi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Fi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield aL(n,!1):yield Ci(iP.setError(t?"Not authorized":"Internal feature failure"))}()}function*aL(e,t){yield Ci(iP.setLoading(!0));try{var n,o;const i=yield Di(Gf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Di(Gf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ui([Di(XP),Di(Gf.subscriptions.getSubscriptionPlan,a)]),s=yield Fi((e=>e.subscriptions.billing.subscription.subscription||null))),yield Ci(iP.setState(U({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?VP.ACTIVE:WP(s.status),cancellation:s.cancellation&&jP(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 Ci(iP.setError(Hp(e)))}}function*rL(){yield function*(){var e,t;yield Ci(iP.setLoading(!0)),yield Gi(500),yield Ci(iP.setState({loading:!1,fetching:!1,summary:{subscriptionId:KP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Uy.Stripe,externallyManaged:!1,currentPlanId:HP[0].id,defaultPlanId:HP[0].id},plan:U({},HP[0],{price:null==(e=HP[0].price)?void 0:e.amount,currency:null==(t=HP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*lL(){yield _a(iP.loadBillingInformation,rL)}function*sL(){yield _a(uP.loadPaymentMethod,cL),yield _a(uP.submitPaymentMethod,dL),yield _a(uP.submitPaymentMethodError,yL),yield _a(uP.submitPaymentMethodSuccess,fL),yield _a(uP.updatePaymentMethodBillingDetails,uL)}function*cL(){yield Ci(uP.setLoading(!0));try{const e=(yield Di(Gf.subscriptions.getPaymentMethods))[0];yield Ci(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Ci(uP.setError(Hp(e)))}}function*uL({payload:e}){yield Ci(uP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Di(Gf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Di(cL),null==i||i(!0)}catch(e){yield Ci(uP.setError(Hp(e))),null==i||i(!1)}yield Ci(uP.setLoading(!1))}function*dL(){yield Ci(uP.setLoading(!0))}function*yL({payload:e}){yield Ci(uP.setError(e))}function*fL(){yield Ci(uP.loadPaymentMethod())}function*pL(){yield Ci(uP.setLoading(!0)),yield Gi(500);const e=qP[0];yield Ci(uP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*gL(){yield _a(uP.loadPaymentMethod,pL)}function*SL(){yield _a(SP.loadInvoices,vL),yield _a(SP.downloadInvoice,hL)}function*vL(){yield Ci(SP.setLoading(!0));try{const e=(yield Di(Gf.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 Ci(SP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Ci(SP.setError(Hp(e)))}}function*hL({payload:e}){yield Ci(SP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Di(Gf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Ci(SP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Ci(SP.setInvoiceDownloadState({loading:!1,error:Hp(e,null)}))}}function*mL(){yield Ci(SP.setLoading(!0)),yield Gi(500),yield Ci(SP.setState({loading:!1,fetching:!1,invoices:zP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Ci(SP.setLoading(!1))}function*AL(){yield _a(SP.loadInvoices,mL)}function*bL(){yield Ui([Di(oL),Di(sL),Di(SL),Di(JP)])}function*TL(){yield Ui([Di(lL),Di(gL),Di(AL),Di(nL)])}function*kL(){yield _a(IP.loadCheckout,EL),yield _a(IP.resetCheckout,IL),yield _a(IP.submitCheckout,PL),yield _a(IP.confirmCheckout,LL),yield _a(IP.errorCheckout,_L)}function*EL(){yield Ci(IP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*IL(){yield Ci(IP.setState({loading:!1,error:null,confirmed:!1}))}function*PL(){yield Ci(IP.setState({loading:!0,error:null}))}function*LL({payload:{paymentMethodId:e,planId:t}}){const n=yield Fi((e=>e.subscriptions.billing.subscription.subscription)),o=yield Fi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===_y.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield Ci(IP.setState({loading:!0,error:null})),i&&a)return yield OL(),void(yield Ci(XI.setState({subscription:U({},n,{status:_y.ACTIVE})})));try{yield Di(Gf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ui([iL(),cL(),vL()]),yield OL()}catch(e){yield Ci(IP.setState({loading:!1,error:Hp(e)}))}}else yield Ci(IP.setState({loading:!1,error:"Subscription not found"}))}function*OL(){yield Ci(IP.setState({loading:!1,error:null,confirmed:!0}))}function*_L({payload:e}){yield Ci(IP.setState({loading:!1,error:e}))}function*wL(){yield _a(IP.resetCheckout,IL)}function*CL(){yield _a(xI.loadPlans,UL)}function*UL(){yield Ci(xI.setLoading(!0));try{const e=(yield Di(Gf.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 Ci(xI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Ci(xI.setError(Hp(e)))}}function*RL(){yield Ci(xI.setLoading(!0)),yield Gi(500),yield Ci(xI.setState({fetching:!1,loading:!1,plans:HP.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*DL(){yield _a(xI.loadPlans,RL)}function*NL(){yield _a(HI.loadPaymentConfiguration,ML)}function*ML(){yield Ci(HI.setLoading(!0));try{(yield Di(Gf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Uy.Stripe))?yield function*(){yield Ci(HI.setLoading(!0));try{const e=yield Di(Gf.subscriptions.getStripePaymentProviderConfiguration);yield Ci(HI.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Ci(HI.setError(Hp(e)))}}():yield Ci(HI.setError("Payment provider not configured"))}catch(e){yield Ci(HI.setError(Hp(e)))}}function*FL(){yield Ci(HI.setLoading(!0)),yield Gi(500),yield Ci(HI.setState({loading:!1,fetching:!1,config:{paymentProvider:xP.STRIPE,apiKey:""}}))}function*GL(){yield _a(HI.loadPaymentConfiguration,FL)}function*$L(){yield _a(CP.createCardSetupIntentSecret,xL)}function*xL({payload:e}){yield Ci(CP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Di(Gf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Ci(CP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Ci(CP.setError(Hp(e)))}}function*VL(){yield _a(MP.loadVendorPublicConfiguration,BL)}function*BL(){yield Ci(MP.setLoading(!0));try{const e=yield Di(Gf.subscriptions.getVendorPublicConfigurations);yield Ci(MP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Ci(MP.setError(Hp(e)))}}function*jL(){yield Ci(MP.setLoading(!0)),yield Gi(500),yield Ci(MP.setState({fetching:!1,loading:!1,vendorPublicConfig:YP}))}function*WL(){yield _a(MP.loadVendorPublicConfiguration,jL)}var KL={sagas:function*(){yield Ui([Di(bL),Di(kL),Di(CL),Di(NL),Di($L),Di(VL)])},mockSagas:function*(){yield Ui([Di(TL),Di(wL),Di(DL),Di(GL),Di(WL)])},reducer:$P,actions:GP,initialState:FP,storeName:"subscriptions"},HL={sagas:function*(){yield _a(hS.loadVendorPublicInfo,mS)},storeName:Dt,initialState:gS,reducer:SS,actions:hS};const{reducer:zL}=yt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Ua.setContext(t),U({},e,{context:t}))}}}),qL=(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||Ua.setContext(e.context);const t=Aa(),l=[...st({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=ct({middleware:l,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[vE.storeName]:U({},vE.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},vE.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[jE.storeName]:U({},jE.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},jE.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},jE.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[KE]:U({},WE,null!=(h=null==i?void 0:i.audits)?h:{}),[CI.storeName]:CI.initialState,[KL.storeName]:KL.initialState,[HL.storeName]:HL.initialState},reducer:We({root:zL,[vE.storeName]:vE.reducer,[jE.storeName]:jE.reducer,[KE]:zE,[CI.storeName]:CI.reducer,[KL.storeName]:KL.reducer,[HL.storeName]:HL.reducer})});const m=function*(){yield Ui([Di(vE.sagas),Di(jE.sagas),Di(iI),Di(CI.sagas),Di(KL.sagas),Di(HL.sagas)])},A=function*(){yield Ui([Di(vE.mockSagas),Di(jE.mockSagas),Di(KL.mockSagas)])};n?(s.store.destroy=t.run(A).cancel,s.store.dispatch(Do.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(!Ua.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 JL=n(714),QL=n.n(JL);function XL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function ZL(e){if(e.type)return e;if("#"===e.charAt(0))return ZL(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 eO(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 tO(e){if(0===e.indexOf("#"))return e;const{values:t}=ZL(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 nO(e,t){return e=ZL(e),t=XL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,eO(e)}function oO(e,t){if(e=ZL(e),t=XL(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 eO(e)}function iO(e,t){if(e=ZL(e),t=XL(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 eO(e)}const aO=e=>{if(e)return{main:e,light:tO(iO(e,.4)),dark:tO(oO(e,.15)),hover:tO(oO(e,.15)),active:tO(oO(e,.2))}},rO=e=>{if(e)return{main:e,light:iO(e,.7),dark:oO(e,.2)}},lO=(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)?U({},t,{palette:{primary:U({},aO(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:U({},aO(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:U({},aO(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},rO(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},rO(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},rO(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},rO(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},sO={},cO={},uO={},dO={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"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}};class yO{constructor(){this._theme=sO,this._themeV2=cO,this._navigation=dO,this._localizations=uO}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new yO;return n.set(e),yO._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=QL().all([null!=(t=dO)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=QL().all([null!=(o=sO)?o:{},lO(null==e?void 0:e.theme,sO)]),this._themeV2=QL().all([null!=(i=cO)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=QL().all([null!=(r=uO)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=dO,this._theme=sO,this._themeV2=cO,this._localizations=uO}}}yO._instances={};var fO=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},pO=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},gO=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)}))},SO=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 vO,hO,mO,AO,bO,TO,kO,EO,IO,PO,LO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(vO||(vO={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(hO||(hO={})),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"}(AO||(AO={})),function(e){e.Invoices="invoices"}(bO||(bO={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(TO||(TO={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(kO||(kO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(EO||(EO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(IO||(IO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(PO||(PO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(LO||(LO={}));const OO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},_O={hidden:"hidden",edit:"edit"};var wO="6.139.0-alpha.1",CO={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"},UO=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];P(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(wO),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=D(M().mark((function e(){var t,n,o,a,r;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Tr,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:yO.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(M().mark((function e(){var t,n,o;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=null==(t=i.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,i.options.builderMode||"nextjs"===i.options.framework||(i.options.hostedLoginBox&&!i.options.customLoginBox&&o?i.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):i.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}_l.set(CO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,wl();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),_l.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.setFeatureFlagsForPreview=function(e){_l.set(U({},CO,e),i.name)},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=fO(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},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=qL({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);C.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),Ua.setAppName(l)}var t,n,o,i;return w(e,[{key:"setEntitlementsOptions",value:function(e){Ua.setEntitlementsOptions(U({},e))}},{key:"initContainers",value:(i=D(M().mark((function e(t){return M().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;yO.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:E,FronteggTypes:I})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(M().mark((function e(){return M().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=D(M().mark((function e(){var t;return M().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ua.setRequestSource(lo.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(),SO(t),Ua.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(M().mark((function e(t){var n;return M().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,U({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],Pl.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],Pl.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}(),RO=function(){function e(){P(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=C.getInstance(o);e&&t?(Ua.setAccessToken(t),Ua.setUser(U({},n,{accessToken:t})),i.store.dispatch(Do.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Do.loadTenants())):(Ua.setAccessToken(null),Ua.setUser(null),i.store.dispatch(Do.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),DO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideAdminPortal()}}]),e}(),NO=function(){function e(){P(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";C.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";C.getInstance(e).hideCheckoutDialog()}}]),e}(),MO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},FO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(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=qL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new UO(this.options,t,!0),yO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,gO(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}(),GO="modern",$O=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[GO]},xO=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(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=qL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new UO(this.options,t,!0,a),yO.set({},t)}var t;return w(e,[{key:"render",value:(t=D(M().mark((function e(t){var n,o,i,a,r=this;return M().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,gO(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 VO(e,t){return VO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},VO(e,t)}function BO(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&&VO(e,t)}function jO(e,t){if(t&&("object"===L(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 WO(e){return WO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},WO(e)}function KO(){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 HO(e,t,n){return HO=KO()?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&&VO(i,n.prototype),i},HO.apply(null,arguments)}function zO(e){var t="function"==typeof Map?new Map:void 0;return zO=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 HO(e,arguments,WO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),VO(n,e)},zO(e)}function qO(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=WO(e);if(t){var i=WO(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return jO(this,n)}}var YO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new UO(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){BO(n,e);var t=qO(n);function n(){var e;P(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 w(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=C.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=pO(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=pO(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=pO(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=pO(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=pO(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=pO(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}(zO(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}()}));
|