@frontegg/js 6.136.0 → 6.137.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.
@@ -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 fO},AdminPortalRenderer:function(){return SO},AppHolder:function(){return w},CheckoutDialog:function(){return pO},FronteggApp:function(){return dO},HostedLogin:function(){return yO},LoginBoxRenderer:function(){return mO},createElement:function(){return zL},defaultTheme:function(){return vO},formatName:function(){return HL},getThemeAdminByName:function(){return gO},getThemeByName:function(){return hO},initialize:function(){return OO},mockFlagsList:function(){return uO},restoreSearchParams:function(){return YL},waitThemeSetter:function(){return qL}});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 Ur},getParentTenantsById:function(){return Cr},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 gl},getCurrentUserTenantsV3:function(){return Al},getUsersGroups:function(){return ml},getUsersRoles:function(){return hl},getUsersV2:function(){return Sl},getUsersV3:function(){return vl},sendResetBreachedPasswordEmails:function(){return bl},updateUserProfileV2:function(){return Tl}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return kl}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Ll},loadFeatureFlags:function(){return Ol}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return To},MachineToMachineAuthStrategy:function(){return ko},OAuthLogout:function(){return os},SocialLoginProviders:function(){return bo},acceptInvitation:function(){return Xl},activateAccount:function(){return zl},activateAccountV2:function(){return ql},bulkCreateIPRestriction:function(){return nl},changePhoneNumber:function(){return ru},changePhoneNumberWithVerification:function(){return iu},checkIfAllowToRememberMfaDevice:function(){return Oc},createDomainRestriction:function(){return Jr},createIPRestriction:function(){return tl},createOrUpdateSessionConfigrations:function(){return yc},createSSOConfiguration:function(){return Dc},createSSOConfigurationByMetadata:function(){return Fc},createSSOConfigurationByMetadataUrl:function(){return $c},createSSODomain:function(){return Vc},createSSOGroup:function(){return Hc},createSamlGroup:function(){return Js},createTenantAccessToken:function(){return Ac},createUserAccessToken:function(){return mc},deleteAllSessionsForUser:function(){return pc},deleteDomainRestriction:function(){return Xr},deleteIPRestriction:function(){return il},deleteSSOConfiguration:function(){return Mc},deleteSSODomain:function(){return jc},deleteSSOGroup:function(){return qc},deleteSamlGroup:function(){return Xs},deleteSessionForUser:function(){return fc},deleteTenantAccessToken:function(){return vc},deleteTenantApiToken:function(){return Ic},deleteUserAccessToken:function(){return hc},deleteUserApiToken:function(){return Pc},deleteWebAuthnDevice:function(){return yu},disableMFAAuthenticatorApp:function(){return vs},disableMFASMS:function(){return ms},disableMFAWebAuthn:function(){return bs},disableMfa:function(){return Ss},enrollMFAAuthenticatorApp:function(){return us},enrollMFAAuthenticatorAppForLogin:function(){return Es},enrollMFAAuthenticatorAppForLoginV2:function(){return Is},enrollMFASMS:function(){return ys},enrollMFASMSForLogin:function(){return Us},enrollMFASMSForLoginV2:function(){return Cs},enrollMFAWebAuthn:function(){return ps},enrollMFAWebAuthnForLogin:function(){return Fs},enrollMFAWebAuthnForLoginV2:function(){return Gs},enrollMfa:function(){return ss},exchangeOAuthTokens:function(){return eu},exchangeOAuthTokensV2:function(){return Xc},forgotPassword:function(){return is},generateLoginResponse:function(){return Cl},generateLoginResponseFromOAuthResponse:function(){return Fl},generateLoginResponseFromOAuthResponseV2:function(){return Gl},generateLoginResponseV2:function(){return Rl},generateLoginResponseV3:function(){return Ml},getActivateAccountStrategy:function(){return Yl},getCaptchaPolicy:function(){return Br},getCurrentUserSession:function(){return cc},getCurrentUserSessions:function(){return sc},getCustomSocialLoginProvidersV1:function(){return ic},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 Ts},getMFAStrategiesConfig:function(){return Su},getMeAndEntitlements:function(){return mu},getMeV2:function(){return hu},getMfaPolicy:function(){return Fr},getOidcConfiguration:function(){return Zs},getPasswordConfigPolicy:function(){return zr},getPasswordHistoryPolicy:function(){return Wr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return gu},getSSOConfigurations:function(){return Rc},getSSODefaultRoles:function(){return Wc},getSSOGroups:function(){return Yc},getSSOPublicConfiguration:function(){return ec},getSamlConfiguration:function(){return js},getSamlRoles:function(){return zs},getSamlRolesGroups:function(){return qs},getSamlVendorConfiguration:function(){return Ws},getSessionConfigurations:function(){return dc},getSocialLoginProviders:function(){return tc},getSocialLoginProvidersV2:function(){return nc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return oc},getTenantAccessTokensData:function(){return Sc},getTenantApiTokensData:function(){return Tc},getUserAccessTokensData:function(){return gc},getUserApiTokensData:function(){return bc},getUserAuthorization:function(){return vu},getUserById:function(){return Lc},getVendorConfig:function(){return rc},getVendorLockoutPolicy:function(){return Vr},getVendorMfaPolicy:function(){return Gr},getVendorPasswordHistoryPolicy:function(){return Kr},getVendorPublicAuthStrategiesConfig:function(){return pu},getWebAuthnDevices:function(){return du},loadPasswordConfig:function(){return rs},login:function(){return Bl},loginViaSocialLogin:function(){return ac},loginWithMfa:function(){return Kl},loginWithMfaV2:function(){return Hl},loginv2:function(){return Wl},logout:function(){return ns},oidcPostLogin:function(){return jl},oidcPostLoginV2:function(){return Qc},passwordlessPostLogin:function(){return Uc},passwordlessPostLoginV2:function(){return wc},passwordlessPreLogin:function(){return _c},postLogin:function(){return Vl},preDisableMFASMS:function(){return hs},preDisableMFAWebAuthn:function(){return As},preEnrollMFAAuthenticatorApp:function(){return cs},preEnrollMFAAuthenticatorAppForLogin:function(){return ks},preEnrollMFASMS:function(){return ds},preEnrollMFASMSForLogin:function(){return ws},preEnrollMFAWebAuthn:function(){return fs},preEnrollMFAWebAuthnForLogin:function(){return Ms},preLogin:function(){return $l},preLoginV2:function(){return Jc},preLoginWithIdpType:function(){return xl},preVerifyMFAEmailCode:function(){return Ls},preVerifyMFASMSForLogin:function(){return Rs},preVerifyMFAWebAuthnForLogin:function(){return $s},recoverMfaToken:function(){return ls},refreshToken:function(){return Zl},refreshTokenV2:function(){return es},refreshTokenV3:function(){return ts},resendActivationEmail:function(){return Jl},resendInvitationEmail:function(){return Ql},resetPassword:function(){return as},resetPhoneNumber:function(){return nu},revokeSessionsForUser:function(){return uc},saveLockoutPolicy:function(){return jr},saveMfaPolicy:function(){return $r},savePasswordHistoryPolicy:function(){return Hr},setSSODefaultRoles:function(){return Kc},signUpUser:function(){return lc},silentOAuthRefreshToken:function(){return tu},silentOAuthRefreshTokenV2:function(){return Zc},testCurrentIp:function(){return al},testCurrentIpInAllowList:function(){return rl},updateDomainRestrictionConfig:function(){return Qr},updateIPRestrictionConfig:function(){return ol},updateSSOConfiguration:function(){return Nc},updateSSOConfigurationByMetadata:function(){return Gc},updateSSOConfigurationByMetadataUrl:function(){return xc},updateSSOGroup:function(){return zc},updateSamlConfiguration:function(){return Bs},updateSamlGroup:function(){return Qs},updateSamlRoles:function(){return Ys},updateSamlVendorMetadata:function(){return Ks},updateTenantApiTokensData:function(){return Ec},updateUserApiTokensData:function(){return kc},validateSSODomain:function(){return Bc},validateSamlDomain:function(){return Hs},verifyChangePhoneNumber:function(){return au},verifyInviteToken:function(){return Cc},verifyMFAAuthenticatorAppForLogin:function(){return Ps},verifyMFAEmailCode:function(){return Os},verifyMFAEmailCodeV2:function(){return _s},verifyMFASMSForLogin:function(){return Ds},verifyMFASMSForLoginV2:function(){return Ns},verifyMFAWebAuthnForLogin:function(){return xs},verifyMFAWebAuthnForLoginV2:function(){return Vs},verifyMfa:function(){return gs},verifyNewDeviceSession:function(){return fu},verifyResetPhoneNumber:function(){return ou},webAuthnCreateNewDeviceSession:function(){return uu},webAuthnPostLogin:function(){return su},webAuthnPostLoginV2:function(){return cu},webAuthnPreLogin:function(){return lu}});var s={};n.r(s),n.d(s,{addUser:function(){return Iu},changePassword:function(){return ku},createInviteUserLink:function(){return Ou},deleteInviteUserLink:function(){return wu},deleteUser:function(){return Pu},getInviteLinkConfiguration:function(){return Cu},getInviteUserLink:function(){return Uu},getProfile:function(){return Au},loadAvailablePermissions:function(){return Du},loadAvailableRoles:function(){return Ru},loadStats:function(){return Nu},loadUsers:function(){return Eu},resendActivationLink:function(){return Mu},resendInvitationLink:function(){return Fu},resendInvitationLinkToAllTenants:function(){return Gu},updateInviteUserLink:function(){return _u},updateProfile:function(){return bu},updateProfileImage:function(){return Tu},updateUser:function(){return Lu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return xu},getAuditsMetadata:function(){return Ku},getCurrentUserIpMetadata:function(){return ju},getIpAdressMetadata:function(){return Hu},getNotificationsMetadata:function(){return Bu},getSamlMetadata:function(){return Wu},updateAdminBoxMetadata:function(){return Vu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return ed},getReport:function(){return Qu},getReports:function(){return Ju},renderReport:function(){return Xu},scheduleReport:function(){return Zu},sendReport:function(){return td}});var d={};n.r(d),n.d(d,{getNotifications:function(){return nd},markAllAsRead:function(){return ad},updateNotificationIsPinned:function(){return id},updateNotificationStatus:function(){return od}});var y={};n.r(y),n.d(y,{exportAudits:function(){return cd},getAudits:function(){return ld},getAuditsStats:function(){return sd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return kd},deleteEmailSubscriptions:function(){return bd},deleteSMSConfiguration:function(){return _d},deleteSMSSubscriptions:function(){return Ld},deleteSlackConfiguration:function(){return Sd},deleteWebhooksConfiguration:function(){return Cd},getCategories:function(){return Md},getChannelMaps:function(){return Fd},getEmailConfiguration:function(){return hd},getSMSConfiguration:function(){return Ed},getSlackChannels:function(){return pd},getSlackConfiguration:function(){return yd},getSlackScope:function(){return fd},getWebhookLog:function(){return Rd},getWebhooksConfigurations:function(){return wd},patchEmailConfiguration:function(){return Ad},patchSMSConfiguration:function(){return Pd},postEmailConfiguration:function(){return md},postSMSConfiguration:function(){return Id},postSlackCode:function(){return vd},postSlackConfiguration:function(){return gd},postWebhookRetry:function(){return Nd},postWebhookTest:function(){return Dd},postWebhooksConfiguration:function(){return Ud},putEmailSubscriptions:function(){return Td},putSMSSubscriptions:function(){return Od}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return xd},getSettings:function(){return $d},updateSettings:function(){return Gd}});var g={};n.r(g),n.d(g,{addRole:function(){return Kd},attachPermissionToRoles:function(){return Jd},attachPermissionsToRole:function(){return qd},deleteRole:function(){return Hd},getPermissionCategories:function(){return Qd},getPermissions:function(){return Yd},getRoles:function(){return Wd},updateRole:function(){return zd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return _y},ISubscriptionStatus:function(){return Ly},PaymentMethodType:function(){return Oy},ProviderType:function(){return wy},TenantCreatedAction:function(){return Cy},TrialEndAction:function(){return Uy},cancelManagedSubscription:function(){return ay},cancelSubscription:function(){return ey},createStripeCustomer:function(){return my},createStripePaymentMethodSetupIntentSecret:function(){return by},createSubscription:function(){return vy},createTenantConfiguration:function(){return Ey},getManagedSubscription:function(){return oy},getManagedSubscriptions:function(){return iy},getPaymentMethod:function(){return gy},getPaymentMethods:function(){return py},getPaymentProviders:function(){return Iy},getStripeCustomer:function(){return hy},getStripePaymentProviderConfiguration:function(){return Ay},getSubscription:function(){return Zd},getSubscriptionInvoice:function(){return dy},getSubscriptionInvoicePdf:function(){return yy},getSubscriptionInvoices:function(){return uy},getSubscriptionPlan:function(){return cy},getSubscriptionPlans:function(){return sy},getSubscriptionSummaries:function(){return Ty},getSubscriptions:function(){return Xd},getTenantConfiguration:function(){return ky},getVendorPublicConfigurations:function(){return Py},renewManagedSubscription:function(){return ry},renewSubscription:function(){return ty},updateManagedSubscription:function(){return ly},updatePaymentMethodBillingDetails:function(){return Sy},updateSubscription:function(){return ny}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Ry}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Fy},addUserToTenantAndSubTenants:function(){return Ny},addUsersToSubTenant:function(){return Wy},createSubTenant:function(){return xy},deleteSubTenant:function(){return Vy},loadAllUsers:function(){return Dy},removeUserFromTenantAndSubTenants:function(){return My},removeUserRolesFromSubTenants:function(){return Gy},setUserRolesForSubTenants:function(){return $y},updateSubAccountAccess:function(){return By},updateSubTenant:function(){return jy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Yy},createConfiguration:function(){return zy},deleteConfiguration:function(){return qy},getConfigs:function(){return Ky},updateConfiguration:function(){return Hy}});var A={};n.r(A),n.d(A,{impersonate:function(){return Jy}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return af},addUsersToGroup:function(){return lf},createGroup:function(){return tf},deleteGroup:function(){return of},deleteRolesFromGroup:function(){return rf},deleteUsersFromGroup:function(){return sf},getGroupById:function(){return Xy},getGroupConfiguration:function(){return cf},getGroups:function(){return Zy},getGroupsByIds:function(){return ef},updateGroup:function(){return nf},updateGroupConfiguration:function(){return uf}});var T={};n.r(T),n.d(T,{getInsights:function(){return yf},getRecommendations:function(){return df}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Il},AuthStrategyEnum:function(){return To},ContextHolder:function(){return Ua},FeatureFlags:function(){return Ll},FronteggApiError:function(){return Ra},FronteggContext:function(){return Ca},FronteggFrameworks:function(){return lo},GetUsersFilterPreset:function(){return uo},GroupManagedByEnum:function(){return Ef},GroupRelations:function(){return kf},ISubscriptionCancellationPolicy:function(){return _y},ISubscriptionStatus:function(){return Ly},InsightCode:function(){return Pf},LOAD_AUTHORIZATION_FF:function(){return pl},MFAStrategyEnum:function(){return fl},MachineToMachineAuthStrategy:function(){return ko},NotEntitledJustification:function(){return El},PaginationOrderEnum:function(){return so},PaymentMethodType:function(){return Oy},ProviderType:function(){return wy},RecommendationActionKey:function(){return Lf},RecommendationCode:function(){return If},RecommendationSeverity:function(){return Of},RequestSource:function(){return ro},RestrictionType:function(){return Vn},ScimConnectionSource:function(){return Tf},SecondaryAuthStrategy:function(){return dl},SecurityCategory:function(){return _f},SocialLoginProviders:function(){return bo},SortByEnum:function(){return co},TenantSortByEnum:function(){return pf},TenantType:function(){return gf},UserManagedByEnum:function(){return ff},WebAuthnDeviceType:function(){return yl},api:function(){return wf},countConfigurationUsers:function(){return Yy},createConfiguration:function(){return zy},default:function(){return Uf},deleteConfiguration:function(){return qy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Sf},fronteggHeaders:function(){return ao},fronteggRefreshTokenUrl:function(){return vf},fronteggSilentRefreshTokenUrl:function(){return hf},fronteggTenantsUrl:function(){return Af},fronteggTenantsV3Url:function(){return bf},fronteggUsersUrl:function(){return mf},getConfigs:function(){return Ky},loadFeatureFlags:function(){return Ol},providersArray:function(){return yo},updateConfiguration:function(){return Hy}});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 rO},AccountPageFields:function(){return ZL},DomainRestrictionsTabFields:function(){return aO},GeneralSettingsTabFields:function(){return oO},InviteUserModalFields:function(){return XL},IpRestrictionsTabFields:function(){return iO},Metadata:function(){return KL},PrivacyPageFields:function(){return QL},ProfilePageFields:function(){return JL},SecurityPageTabs:function(){return tO},SessionManagementTabFields:function(){return nO},SubscriptionsPageFields:function(){return eO},alpha:function(){return NL},fieldAppearance:function(){return lO},tabAppearance:function(){return sO}});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 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 C(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){C(a,o,i,r,l,"next",e)}function l(e){C(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var D=n(841),N=n.n(D);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function F(e){return!!e&&!!e[ke]}function G(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ee}(e)||Array.isArray(e)||!!e[Te]||!!e.constructor[Te]||W(e)||K(e))}function $(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Ie)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:K(e)?3:0}function V(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return he&&e instanceof Map}function K(e){return me&&e instanceof Set}function H(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Pe(e);delete t[ke];for(var n=Ie(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||F(e)||!G(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=Y),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function Y(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Le[e];return t||M(18,e),t}function X(){return Se}function Z(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function ee(e){te(e),e.p.forEach(oe),e.p=null}function te(e){e===Se&&(Se=e.l)}function ne(e){return Se={p:[],l:Se,h:e,m:!0,_:0}}function oe(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(ee(t),M(4)),G(e)&&(e=ae(t,e),t.l||le(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ae(t,n,[]),ee(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function ae(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return $(t,(function(i,a){return re(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return le(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;$(3===o.i?new Set(i):i,(function(t,a){return re(e,o,i,t,a,n)})),le(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function re(e,t,n,o,i,a){if(F(i)){var r=ae(e,i,a&&t&&3!==t.i&&!V(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!F(r))return;e.m=!1}if(G(i)&&!J(i)){if(!e.h.F&&e._<1)return;ae(e,i),t&&t.A.l||le(e,i)}}function le(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?H(n):e)[t]}function ce(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function ue(e){e.P||(e.P=!0,e.l&&ue(e.l))}function de(e){e.o||(e.o=z(e.t))}function ye(e,t,n){var o=W(t)?Q("MapSet").N(t,n):K(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:X(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Oe;n&&(i=[o],a=_e);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:X()).p.push(o),o}function fe(e){return F(e)||M(22,e),function e(t){if(!G(t))return t;var n,o=t[ke],i=x(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=pe(t,i),o.I=!1}else n=pe(t,i);return $(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function pe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,Se,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),he="undefined"!=typeof Map,me="undefined"!=typeof Set,Ae="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=ve?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Te=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ke=ve?Symbol.for("immer-state"):"__$immer_state",Ee=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Pe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ie(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Oe={get:function(e,t){if(t===ke)return e;var n=H(e);if(!V(n,t))return function(e,t,n){var o,i=ce(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!G(o)?o:o===se(e.t,t)?(de(e),e.o[t]=ye(e.A.h,o,e)):o},has:function(e,t){return t in H(e)},ownKeys:function(e){return Reflect.ownKeys(H(e))},set:function(e,t,n){var o=ce(H(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=se(H(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(B(n,i)&&(void 0!==n||V(e.t,t)))return!0;de(e),ue(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==se(e.t,t)||t in e.t?(e.D[t]=!1,de(e),ue(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=H(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},_e={};$(Oe,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Oe.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=Ae,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==o&&"function"!=typeof o&&M(7),G(e)){var l=ne(t),s=ye(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?ee(l):te(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Z(l,o),ie(e,l)}),(function(e){throw ee(l),e})):(Z(l,o),ie(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){G(e)||M(8),F(e)&&(e=fe(e));var t=ne(this),n=ye(this,e,void 0);return n[ke].C=!0,te(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return Z(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ae&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return F(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new we,Ce=Ue.produce,Re=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Ce);function De(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){De(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ge="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function Ve(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Fe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Fe(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Fe(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Fe(3));return a}function d(e){if("function"!=typeof e)throw new Error(Fe(4));if(s)throw new Error(Fe(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Fe(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ve(e))throw new Error(Fe(7));if(void 0===e.type)throw new Error(Fe(8));if(s)throw new Error(Fe(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Fe(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Fe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ge]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ge]=p,o}function Be(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:xe.INIT}))throw new Error(Fe(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Fe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Fe(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Ke(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(Fe(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function He(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var ze=He();ze.withExtraArgument=He;var qe,Ye=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Xe=Object.defineProperty,Ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,nt=function(e,t,n){return t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ot=function(e,t){for(var n in t||(t={}))et.call(t,n)&&nt(e,n,t[n]);if(Ze)for(var o=0,i=Ze(t);o<i.length;o++)n=i[o],tt.call(t,n)&&nt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var at=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function rt(e){return G(e)?Re(e,(function(){})):e}function lt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new at);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Ye):o.push(Ye.withExtraArgument(n.extraArgument))),o}function st(e){var t,n=function(e){return lt(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Be(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Ke.apply(void 0,p),S=We;c&&(S=it(ot({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ct(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ot(ot({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ut(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function dt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:rt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ut(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=ot(ot({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ut(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return rt(e())};else{var c=rt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(F(e))return void 0===(o=n(e,t))?e:o;if(G(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ct(c,o):ct(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var yt="listenerMiddleware";ct(yt+"/add"),ct(yt+"/removeAll"),ct(yt+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Oe.get(t,e)},set:function(t){var n=this[ke];Oe.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ue(i);break;case 4:n(i)&&ue(i)}}}function n(e){for(var t=e.t,n=e.k,o=Ie(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!V(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!B(l,r))return!0}}var c=!!t[ke];return o.length!==Ie(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Pe(n);delete a[ke];for(var r=Ie(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:X(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?F(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)$(a,(function(t){t!==ke&&(void 0!==i[t]||V(i,t)?r[t]||e(a[t]):(r[t]=!0,ue(n)))})),$(i,(function(e){void 0!==a[e]||V(a,e)||(r[e]=!1,ue(n))}));else if(5===l){if(o(n)&&(ue(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const ft=(e,t)=>n=>U({},n,{[e]:t[e]}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),gt=(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)})})}}),St=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})})})}}),vt=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})})})}}),ht=(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)})})}}),mt=(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)})})},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",Ut="connectivity",Ct="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 jt={step:Vt.validate},Bt={setAcceptInvitationState:pt("acceptInvitationState"),resetAcceptInvitationState:ft("acceptInvitationState",{acceptInvitationState:jt})},Wt={acceptInvitation:ct("auth/acceptInvitation",(e=>({payload:e})))};let Kt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Kt||(Kt={}));const Ht={step:Kt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:pt("forgotPasswordState"),resetForgotPasswordState:ft("forgotPasswordState",{forgotPasswordState:Ht})},qt={forgotPassword:ct("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ct("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ct("auth/loadPasswordConfig",(e=>({payload:e})))};let Yt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Yt||(Yt={}));const Jt={step:Yt.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:pt("resetPhoneNumberState"),resetResetPhoneNumberState:ft("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Xt={resetPhoneNumber:ct("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ct("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ct("auth/changePhoneNumber",(e=>({payload:e})))},Zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},en={setSSOLoader:St("ssoState"),setSSOError:vt("ssoState"),setSSOState:pt("ssoState"),resetSSOState:ft("ssoState",{ssoState:Zt})},tn={loadSSOConfigurationsV2:ct("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ct("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ct("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ct("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ct("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ct("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ct("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ct("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ct("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ct("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ct("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ct("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ct("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ct("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ct("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ct("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ct("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ct("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ct("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ct("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ct("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ct("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ct("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ct("auth/oidcPostlogin",(e=>({payload:e})))},nn={loading:!1,error:null},on={setProfileState:pt("profileState"),resetProfileState:ft("profileState",{profileState:nn})},an={loadProfile:ct("auth/loadProfile"),saveProfile:ct("auth/saveProfile",(e=>({payload:e}))),changePassword:ct("auth/changePassword",(e=>({payload:e})))};let rn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(rn||(rn={}));const ln={step:rn.verify,loading:!1,saving:!1},sn={setMfaState:pt("mfaState"),resetMfaState:ft("mfaState",{mfaState:ln})},cn={enrollMfa:ct("auth/enrollMfa"),getMFADevices:ct("auth/getMFADevices"),getMFAStrategies:ct("auth/getMFAStrategies"),verifyMfa:ct("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ct("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ct("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ct("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ct("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ct("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ct("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ct("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ct("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ct("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ct("auth/disableMfaWebAuthn",(e=>({payload:e})))},un={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},dn={setTeamLoader:St("teamState"),setTeamError:vt("teamState"),setTeamState:pt("teamState"),resetTeamState:ft("teamState",{teamState:un})},yn={loadUsersV2:ct("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ct("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ct("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ct("auth/loadRoles",(e=>({payload:e}))),addUser:ct("auth/addUser",(e=>({payload:e}))),addUsersBulk:ct("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ct("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ct("auth/updateUser",(e=>({payload:e}))),deleteUser:ct("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ct("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ct("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ct("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ct("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ct("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ct("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ct("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ct("auth/getInvitationLink"),createInvitationLink:ct("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ct("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ct("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ct("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ct("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ct("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ct("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ct("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ct("auth/closeLockUserDialog",(e=>({payload:e})))},fn={firstLoad:!0,loading:!1,error:""},pn={setSocialLoginsState:pt("socialLoginState"),resetSocialLoginsState:ft("socialLoginState",{socialLoginState:fn})},gn={loadSocialLoginsConfiguration:ct("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ct("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ct("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ct("auth/setSocialLoginError",(e=>({payload:e})))};let Sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(Sn||(Sn={}));const vn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:Sn.SignUp},hn={setSignUpState:pt("signUpState"),resetSignUpState:ft("signUpState",{signUpState:vn})},mn={signUpUser:ct("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ct("auth/resetSignUpStateSoft")},An={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:St("apiTokensState"),setApiTokensError:vt("apiTokensState"),setApiTokensState:pt("apiTokensState"),resetApiTokensState:ft("apiTokensState",{apiTokensState:An})},Tn={loadApiTokens:ct("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ct("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ct("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ct("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ct("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ct("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ct("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ct("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},En={setSecurityPolicyState:pt("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ft("securityPolicyState",{securityPolicyState:kn})},In={loadSecurityPolicy:ct("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ct("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ct("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ct("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ct("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ct("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ct("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ct("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ct("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ct("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ct("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ct("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ct("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ct("auth/loadPublicAuthStrategiesPolicy")},Pn={loading:!1},Ln={setAccountSettingsState:pt("accountSettingsState"),resetAccountSettingsState:ft("accountSettingsState",{accountSettingsState:Pn})},On={loadAccountSettings:ct("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ct("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:pt("tenantsState"),resetTenantsState:ft("tenantsState",{tenantsState:_n})},Un={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})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:pt("rolesState"),resetRolesState:ft("rolesState",{rolesState:Cn})},Dn={loadRolesAndPermissions:ct("auth/loadRoles",(e=>({payload:e}))),addRole:ct("auth/addRole",(e=>({payload:e}))),updateRole:ct("auth/updateRole",(e=>({payload:e}))),deleteRole:ct("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ct("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ct("auth/attachPermissionToRoles",(e=>({payload:e})))},Nn={loading:!1,sessions:[]},Mn={setSessionsState:pt("sessionsState"),resetSessionsState:ft("sessionsState",{sessionsState:Nn})},Fn={loadUserSessions:ct("auth/loadUserSessions"),loadCurrentUserSession:ct("auth/loadCurrentUserSession"),deleteUserSession:ct("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ct("auth/deleteAllUserSessions"),revokeUserSessions:ct("auth/revokeUserSessions",(e=>({payload:e})))},Gn={loading:!1,configurations:{}},$n={setSessionsPolicyState:pt("sessionsPolicyState"),resetSessionsPolicyState:ft("sessionsPolicyState",{sessionsPolicyState:Gn})},xn={loadSessionsPolicy:ct("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ct("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Vn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Vn||(Vn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Vn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Bn={setRestrictionsState:pt("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:ct("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ct("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ct("auth/loadIpRestrictions"),saveIpRestriction:ct("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ct("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ct("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ct("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ct("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ct("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ct("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Kn={loading:!1},Hn={setProvisioningState:pt("provisioningState"),resetProvisioningState:ft("provisioningState",{provisioningState:Kn})},zn={loadProvisionConnections:ct("auth/loadProvisionConnections"),createProvisionConnection:ct("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ct("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ct("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Yn={setPasskeysState:pt("passkeysState"),resetPasskeysState:ft("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:ct("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ct("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Xn={setUsersGroupsLoader:St("groupsState"),setUsersGroupsError:vt("groupsState"),setGroupsState:pt("groupsState"),resetUsersGroupsState:ft("groupsState",{groupsState:Qn})},Zn={loadGroups:ct("auth/loadUsersGroups"),getGroupById:ct("auth/getGroupById",(e=>({payload:e}))),createGroup:ct("auth/createGroup",(e=>({payload:e}))),updateGroup:ct("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ct("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ct("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ct("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ct("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ct("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ct("auth/getGroupConfiguration"),updateGroupConfiguration:ct("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ct("auth/getUsers",(e=>({payload:e})))},eo={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},to={setGroupsDialogsState:pt("groupsDialogsState"),resetGroupsDialogsState:ft("groupsState",{groupsDialogsState:eo}),openAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},no={loading:!0,error:null},oo={setCustomLoginState:pt("customLoginState"),resetCustomLoginState:ft("customLoginState",{customLoginState:no})},io={loadTenantMetadata:ct("auth/loadTenantMetadata"),updateTenantMetadata:ct("auth/updateTenantMetadata",(e=>({payload:e})))},ao={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ro,lo,so,co,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"}(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:[],topAccount:{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}))),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}}},mo={setSecurityCenterState:pt("securityCenterState"),resetSecurityCenterState:ft("securityCenterState",{securityCenterState:ho}),setSecurityCenterStateLoader:St("securityCenterState"),setSecurityCenterStateError:vt("securityCenterState")},Ao={loadRecommendations:ct("auth/loadRecommendations"),loadInsights:ct("auth/loadInsights"),sendResetBreachedPasswordEmails:ct("auth/sendResetBreachedPasswordEmails",(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:jt,forgotPasswordState:Ht,ssoState:Zt,profileState:nn,customLoginState:no,mfaState:ln,teamState:un,groupsState:Qn,groupsDialogsState:eo,socialLoginState:fn,apiTokensState:An,securityPolicyState:kn,accountSettingsState:Pn,tenantsState:_n,rolesState:Cn,resetPhoneNumberState:Jt,sessionsState:Nn,sessionsPolicyState:Gn,restrictionsState:jn,provisioningState:Kn,passkeysState:qn,allAccountsState:fo,allAccountsDialogsState:So,securityCenterState:ho},Po=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:()=>{}},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:Uo,actions:Co}=dt({name:wt,initialState:Po,reducers:U({resetState:e=>U({},e,Io),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t})),setEntitlements:gt("user","entitlements")},Nt,pn,$t,_o,Bt,zt,Qt,hn,on,oo,en,sn,dn,Xn,to,bn,En,Ln,wn,Rn,Mn,$n,Bn,Hn,Yn,po,vo,mo)});const Ro=U({loadEntitlements:ct("auth/loadEntitlements",(e=>({payload:e})))},Co,Mt,gn,xt,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,{},Tn,In,On,Un,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"),jo=Do("TASK"),Bo=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){U(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===Bo},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 Ui(e){var t=Oi("ALL",e);return t.combinator=!0,t}function Ci(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,Ci(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,Ci(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 ji(e){$i.push(e),xi||(Wi(),Hi())}function Bi(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):ji((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;ji((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);Bi((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===Bo?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(Bo,!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(Bo))},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(Bo):{done:!0,value:Bo}):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 Bi((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,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){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 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 Ca={getContext:()=>Ua.getContext(),getAccessToken:()=>Ua.getAccessToken(),getUser:()=>Ua.getUser(),onRedirectTo:(e,t)=>Ua.onRedirectTo(e,t),logout:e=>Ua.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"}},ja={v1:"/identity/resources/roles/v1"},Ba={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=Ua.getContext(),a=await async function(e,t){var n;const o=hr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ua.getAccessToken)(),a=Ua.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: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 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(U({url:e,method:"GET",contentType:"application/json",params:t},n)),br=async(e,t,n)=>mr(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Tr=async(e,t,n)=>mr(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),kr=async(e,t,n)=>mr(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),Er=async(e,t,n)=>mr(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ir=async(e,t,n,o)=>mr(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Pr=(e={})=>U({},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 Ur(e){return Ar(Xa.parents.v1,void 0,{headers:Pr(e)})}async function Cr(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,U({},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 jr(e){return e.id?Tr(`${Fa.v1}/lockout-policy`,e):br(`${Fa.v1}/lockout-policy`,e)}async function Br(){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";async function gl(e){return br(`${Ma.v3}/me/token`,e)}async function Sl(e,t){return Ar(Ma.v2,e,{headers:Pr(t)})}async function vl(e,t){return Ar(Ma.v3,e,{headers:Pr(t)})}async function hl(e,t){return Ar(Ma.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function ml(e,t){return Ar(Ma.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function Al(e){return Ar(Ma.tenants.me.v3,void 0,{headers:Pr(e)})}async function bl(){return br(Ma.passwords.resetBreachedPasswords.v1)}async function Tl(e){return kr(`${Ma.v2}/me`,e)}async function kl(){return Ar(pr)}let El;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(El||(El={}));const Il="admin_portal_entitlements",Pl={flags:{}};class Ll{constructor(){var e;this._flags={},this._flags=null!=(e=Pl.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ll;return n.set(e),Ll._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==Pl?void 0:Pl.flags)?t:{},null!=e?e:{})}}async function Ol(){return Ar(dr)}Ll._instances={};const _l=["type"],wl=["type"],Ul=["type"];async function Cl(e){if(!e.accessToken)return e;Ua.setAccessToken(e.accessToken);const t=await mu(),n=U({},e,e.accessToken?ul(e.accessToken):{},t);return Ua.setUser(n),n}async function Rl(e){if(!e.accessToken)return{user:e};Ua.setAccessToken(e.accessToken);const[t,n]=await Promise.all([mu(),Or()]),o=U({},e,e.accessToken?ul(e.accessToken):{},t);return Ua.setUser(o),{user:o,tenants:n}}function Dl(){if(!Ua.shouldLoadEntitlements())return!1;const[e]=Ll.getFeatureFlags([Il],Ua.getAppName()||"");return e}function Nl(){const[e]=Ll.getFeatureFlags([pl],Ua.getAppName()||"");return e}async function Ml(e){const{accessToken:t}=e;if(!t)return{user:e};Ua.setAccessToken(t);const[n,o]=await Promise.all([mu(),Al()]),i=U({},e,t?ul(t):{},n);return Ua.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Fl(e){Ua.setAccessToken(e.id_token);const t=await mu(),n=e.id_token?ul(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 Gl(e){Ua.setAccessToken(e.id_token);const[t,n]=await Promise.all([mu(),Al()]),o=e.id_token?ul(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 $l(e){try{const{address:t}=await br(`${Na.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function xl(e){return br(`${Na.v1}/user/saml/prelogin`,e)}async function Vl(e){return Cl(await br(`${Na.v1}/user/saml/postlogin`,e))}async function jl(e){return Cl(await br(`${Na.v1}/user/oidc/postlogin`,e))}async function Bl(e){return Cl(await br(`${Na.v1}/user`,e))}async function Wl(e){return Ml(await br(`${Na.v1}/user`,e))}async function Kl(e){return Cl(await br(`${Na.v1}/user/mfa/verify`,e))}async function Hl(e){return Ml(await br(`${Na.v1}/user/mfa/verify`,e))}async function zl(e){return br(`${Ma.v1}/activate`,e)}async function ql(e){return Ml(await br(`${Ma.v1}/activate`,e))}async function Yl(e){return Ar(`${Ma.v1}/activate/strategy`,e)}async function Jl(e){return br(`${Ma.v1}/activate/reset`,e)}async function Ql(e){return br(`${Ma.v1}/invitation/reset`,e)}async function Xl(e){return br(`${Ma.v1}/invitation/accept`,e)}async function Zl(){return Cl(await br(`${Na.v1}/user/token/refresh`))}async function es(){return Rl(await br(`${Na.v1}/user/token/refresh`))}async function ts(){return Ml(await br(`${Na.v1}/user/token/refresh`))}async function ns(){return br(`${Na.v1}/logout`)}async function os(e){return Ar(`${ur}/logout`,e)}async function is(e){return br(`${Ma.v1}/passwords/reset`,e)}async function as(e){return br(`${Ma.v1}/passwords/reset/verify`,e)}async function rs(e){return Ar(`${Ma.v1}/passwords/config`,e)}async function ls(e){return br(`${Na.v1}/user/mfa/recover`,e)}async function ss(){return br(`${Ma.v1}/mfa/enroll`)}async function cs(){return br(`${Ma.v1}/mfa/authenticator/enroll`)}async function us(e){return br(`${Ma.v1}/mfa/authenticator/enroll/verify`,e)}async function ds(e){return br(`${Ma.v1}/mfa/sms/enroll`,e)}async function ys(e){return br(`${Ma.v1}/mfa/sms/enroll/verify`,e)}async function fs(){return br(`${Ma.v1}/mfa/webauthn/enroll`)}async function ps(e){return br(`${Ma.v1}/mfa/webauthn/enroll/verify`,e)}async function gs(e){return br(`${Ma.v1}/mfa/enroll/verify`,e)}async function Ss(e){return br(`${Ma.v1}/mfa/disable`,e)}async function vs(e,t){return br(`${Ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function hs(e){return br(`${Ma.v1}/mfa/sms/${e}/disable`)}async function ms(e,t){return br(`${Ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function As(e){return br(`${Ma.v1}/mfa/webauthn/${e}/disable`)}async function bs(e,t){return br(`${Ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ts(){return Ar(`${Ma.v1}/mfa/devices`)}async function ks(e){return br(`${Na.v1}/user/mfa/authenticator/enroll`,e)}async function Es(e){return br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Is(e){return Ml(await br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Ps(e,t){return br(`${Na.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Ls(e){return br(`${Na.v1}/user/mfa/emailcode`,e)}async function Os(e){return br(`${Na.v1}/user/mfa/emailcode/verify`,e)}async function _s(e){return Ml(await br(`${Na.v1}/user/mfa/emailcode/verify`,e))}async function ws(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 Cs(e){return Ml(await br(`${Na.v1}/user/mfa/sms/enroll/verify`,e))}async function Rs(e,t){return br(`${Na.v1}/user/mfa/sms/${e}`,t)}async function Ds(e,t){return br(`${Na.v1}/user/mfa/sms/${e}/verify`,t)}async function Ns(e,t){return Ml(await br(`${Na.v1}/user/mfa/sms/${e}/verify`,t))}async function Ms(e){return br(`${Na.v1}/user/mfa/webauthn/enroll`,e)}async function Fs(e){return br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Gs(e){return Ml(await br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e))}async function $s(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}`,t)}async function xs(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Vs(e,t){return Ml(await br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t))}async function js(){return Ar(`${Ha.v1}/saml/configurations`)}async function Bs(e){return br(`${Ha.v1}/saml/configurations`,e)}async function Ws(){return Ar(`${Ha.v1}/saml/configurations/vendor-config`)}async function Ks(e){return kr(`${Ha.v1}/saml/configurations/metadata`,e)}async function Hs(){return kr(`${Ha.v1}/saml/validations/domain`)}async function zs(){return Ar(`${Ha.v1}/saml/configurations/roles/default`)}async function qs(){return Ar(`${Ha.v2}/saml/configurations/groups`)}async function Ys({roleIds:e}){return br(`${Ha.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Js({roleIds:e,group:t}){return br(`${Ha.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Qs({roleIds:e,group:t,id:n}){return Tr(`${Ha.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Xs({id:e}){return Er(`${Ha.v2}/saml/configurations/groups/${e}`)}async function Zs(){return Ar(`${Ha.v1}/oidc/configurations`)}async function ec(){return Ar(`${Ha.v2}/configurations/public`)}async function tc(){return Ar($a.v1)}async function nc(){return Ar($a.v2)}async function oc(){return Ar(`${$a.v2}/authenticated`)}async function ic(){return Ar($a.custom.v1)}async function ac({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 rc(){return Ar(`${Fa.v1}/public`)}async function lc(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 Ml(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function sc(){return Ar(Ma.sessions.currentUser.v1)}async function cc(){return Ar(`${Ma.sessions.currentUser.v1}/current`)}async function uc(e){return br(`${Ma.sessions.v1}/revoke`,{userId:e})}async function dc(){return Ar(Ma.sessions.configurations.v1)}async function yc(e){await br(Ma.sessions.configurations.v1,e)}async function fc(e){await Er(`${Ma.sessions.currentUser.v1}/${e}`)}async function pc(){await Er(`${Ma.sessions.currentUser.v1}/all`)}async function gc(){return Ar(Ma.accessTokens.v1)}async function Sc(){return Ar(Va.accessTokens.v1)}async function vc({id:e}){return Er(`${Va.accessTokens.v1}/${e}`)}async function hc({id:e}){return Er(`${Ma.accessTokens.v1}/${e}`)}async function mc(e){return br(Ma.accessTokens.v1,e)}async function Ac(e){return br(Va.accessTokens.v1,e)}async function bc(){return Ar(Ma.apiTokens.v1)}async function Tc(){return Ar(Va.apiTokens.v1)}async function kc(e){return br(Ma.apiTokens.v1,e)}async function Ec(e){return br(Va.apiTokens.v2,e)}async function Ic({tokenId:e}){return Er(`${Va.apiTokens.v1}/${e}`)}async function Pc({tokenId:e}){return Er(`${Ma.apiTokens.v1}/${e}`)}async function Lc({userId:e}){return Ar(`${Ma.v1}/${e}`)}async function Oc(e){return Ar(`${Fa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function _c(e){let{type:t}=e,n=Ho(e,_l);return br(`${Na.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function wc(e){let{type:t}=e,n=Ho(e,wl);return Ml(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 Cc({token:e}){return br(Va.invites.verify.v1,{token:e})}async function Rc(){return Ar(`${Ha.v1}/configurations`)}async function Dc(e){return br(`${Ha.v1}/configurations`,e)}async function Nc(e,t){return Tr(`${Ha.v1}/configurations/${e}`,t)}async function Mc(e){return Er(`${Ha.v1}/configurations/${e}`)}async function Fc(e){return br(`${Ha.v1}/configurations/metadata`,e)}async function Gc(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata`,t)}async function $c(e){return br(`${Ha.v1}/configurations/metadata-url`,e)}async function xc(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata-url`,t)}async function Vc(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 Bc(e,t){return kr(`${Ha.v1}/configurations/${e}/domains/${t}/validate`)}async function Wc(e){return Ar(`${Ha.v1}/configurations/${e}/roles`)}async function Kc(e,t){return kr(`${Ha.v1}/configurations/${e}/roles`,t)}async function Hc(e,t){return br(`${Ha.v1}/configurations/${e}/groups`,t)}async function zc(e,{roleIds:t,group:n,id:o}){return Tr(`${Ha.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function qc(e,t){return Er(`${Ha.v1}/configurations/${e}/groups/${t}`)}async function Yc(e){return Ar(`${Ha.v1}/configurations/${e}/groups`)}async function Jc(e){return br(`${Na.v2}/user/sso/prelogin`,e)}async function Qc(e){return Cl(await br(`${Na.v2}/user/oidc/postlogin`,e))}async function Xc(e){return Gl(await br(`${ur}/token`,e))}async function Zc(){return Gl(await br(`${ur}/authorize/silent`))}async function eu(e){return Fl(await br(`${ur}/token`,e))}async function tu(){return Fl(await br(`${ur}/authorize/silent`))}async function nu(e){return br(`${Ma.v1}/phone/reset`,e)}async function ou(e){return br(`${Ma.v1}/phone/reset/verify`,e)}async function iu(e){return br(`${Ma.v1}/phone`,e)}async function au(e){return br(`${Ma.v1}/phone/verify`,e)}async function ru(e){return kr(`${Ma.v1}/phone/change`,e)}async function lu(e){return br(`${Na.v1}/webauthn/prelogin`,e)}async function su(e){return br(`${Na.v1}/webauthn/postlogin`,e)}async function cu(e){return Ml(await br(`${Na.v1}/webauthn/postlogin`,e))}async function uu(){return br(Da.v1)}async function du(){return Ar(Da.v1)}async function yu(e){return Er(`${Da.v1}/${e}`)}async function fu(e){return br(`${Da.v1}/verify`,e)}async function pu(){return Ar(`${Fa.v1}/auth/strategies/public`)}async function gu(){return Ar(`${Fa.v1}/auth/strategies`)}async function Su(){return Ar(`${Fa.v1}/mfa/strategies`)}async function vu(){return Ar(`${Ma.authorization.v1}`)}async function hu(){return Ar(`${Ma.v2}/me`)}async function mu(){const e=[{action:hu,shouldLoad:!0},{action:kl,shouldLoad:Dl()},{action:vu,shouldLoad:Nl()}].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 Au(e){return Ar(`${Ma.v2}/me`,null!=e?e:{addRoles:!0})}async function bu(e){return kr(`${Ma.v2}/me`,e)}async function Tu(e){return kr(`${Ja.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ku(e){return br(`${Ma.v1}/passwords/change`,e)}async function Eu(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 Ar(za.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Iu(e){return br(Ma.v2,U({},e,{provider:"local"}))}async function Pu(e){return Er(`${za.v1}/${e.userId}`)}async function Lu(e){return kr(za.v1,e)}async function Ou(e){return br(Va.invites.user.v1,U({},e))}async function _u(e){return Tr(Va.invites.user.v1,U({},e))}async function wu(){return Er(Va.invites.user.v1)}async function Uu(){return Ar(Va.invites.user.v1)}async function Cu(){return Ar(Va.invites.configuration.v1)}async function Ru(){return Ar(qa.v1)}async function Du(){return Ar(xa.v1)}async function Nu(){return Ar(`${Ya.v1}/members`)}async function Mu(e){return br(`${za.v1}/${e.userId}/resendActivationEmail`,{})}async function Fu(e){return br(Ma.v2,U({},e,{provider:"local"}))}async function Gu(e){return br(Ma.invitation.resendAll.v1,U({},e))}async function $u(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 xu(){return Ar("/metadata/admin-box")}async function Vu(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 Bu=async()=>$u({entityName:"notifications"}),Wu=async()=>$u({entityName:"saml"}),Ku=async()=>$u({entityName:"audits"}),Hu=async e=>async function(e){const t=await Ar(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),zu=["dataFilters"],qu=["templateId","dataFilters"],Yu=["dataFilters"];async function Ju(e){return Ar(`${ir.v2}/tenant-reports`,e)}async function Qu(e){return Ar(`${ir.v2}/${e.id}/tenant-reports`)}async function Xu(e){let{dataFilters:t}=e,n=Ho(e,zu);return{html:await Ar(`${ar.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Zu(e){let{templateId:t,dataFilters:n}=e,o=Ho(e,qu);return br(`${ir.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ed(e){let{dataFilters:t}=e,n=Ho(e,Yu);const o=await Ar(`${ar.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 td(e){return br(`${ar.v1}/tenant-reports`,e)}async function nd(e){return Ar(rr,{params:e})}async function od(e){return kr(`${rr}/status`,{params:e})}async function id(e){const{notificationId:t,pinStatus:n}=e;return kr(`${rr}/${n}`,{notificationId:t})}async function ad(){return br(`${rr}/status/mark-all-read`)}const rd=["endpoint","headerProps"];async function ld(e){return Ar(lr,e)}async function sd(e){return Ar(`${lr}/stats`,e)}async function cd(e){const{endpoint:t,headerProps:n}=e,o=Ho(e,rd);return Ir(`${lr}/export/${t}`,{properties:n},o)}const ud=["eventKey"],dd=["eventKey"],yd=()=>Ar(`${er.v1}/slack`),fd=()=>Ar(`${er.v1}/slack/applications`),pd=()=>Ar(`${er.v1}/slack/channels`),gd=e=>e.id?Tr(`${er.v1}/slack/subscription/${e.id}`,e):br(`${er.v1}/slack/subscriptions`,e),Sd=e=>Er(`${er.v1}/slack/subscriptions/${e.id}`),vd=e=>br(`${er.v1}/slack/applications/registrations`,{code:e}),hd=()=>Ar(`${er.v1}/emails`),md=e=>{let{eventKey:t}=e,n=Ho(e,ud);return br(`${er.v1}/emails/${t}`,n)},Ad=({eventKey:e,enabled:t})=>Tr(`${er.v1}/emails/${e}`,{enabled:t}),bd=(e,t)=>Er(`${er.v1}/emails/${e}/subscriptions/${t}`),Td=(e,t,n)=>kr(`${er.v1}/emails/${t}/subscriptions/${e}`,n),kd=e=>Er(`${er.v1}/emails/${e}`),Ed=()=>Ar(`${er.v2}/sms`),Id=e=>{let{eventKey:t}=e,n=Ho(e,dd);return br(`${er.v2}/sms/${t}`,n)},Pd=({eventKey:e,enabled:t})=>Tr(`${er.v2}/sms/${e}`,{enabled:t}),Ld=(e,t)=>Er(`${er.v2}/sms/${e}/subscriptions/${t}`),Od=(e,t,n)=>kr(`${er.v2}/sms/${t}/subscriptions/${e}`,n),_d=e=>Er(`${er.v2}/sms/${e}`),wd=()=>Ar(cr),Ud=e=>e._id?Tr(`${cr}/${e._id}`,e):br(`${cr}/custom`,e),Cd=e=>Er(`${cr}/${e}`),Rd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ar(`${cr}/logs/?${o.toString()}`)},Dd=e=>br(`${cr}/test`,e),Nd=e=>br(`${cr}/logs/${e}/retries`),Md=()=>Ar(`${sr.v1}/categories`),Fd=e=>Ar(sr.v1,{channels:e});async function Gd(e,t){return kr(Qa.v1,e,{headers:Pr(t)})}async function $d(e){return Ar(Qa.v1,void 0,{headers:Pr(e)})}async function xd(){return Ar(`${Qa.v1}/public`)}const Vd=["roleId"],jd=["roleId"],Bd=["permissionId"];async function Wd(){return Ar(ja.v1)}async function Kd(e){return br(ja.v1,e)}async function Hd({roleId:e}){return Er(`${ja.v1}/${e}`)}async function zd(e){let{roleId:t}=e,n=Ho(e,Vd);return Tr(`${ja.v1}/${t}`,n)}async function qd(e){let{roleId:t}=e,n=Ho(e,jd);return kr(`${ja.v1}/${t}/permissions`,n)}async function Yd(){return Ar(xa.v1)}async function Jd(e){let{permissionId:t}=e,n=Ho(e,Bd);return kr(`${xa.v1}/${t}/roles`,n)}async function Qd(){return Ar(`${xa.v1}/categories`)}async function Xd(){return Ar(tr.subscriptions.v1)}async function Zd(e){return Ar(`${tr.subscriptions.v1}/${e}`)}async function ey(e){return kr(`${tr.subscriptions.v1}/${e}/cancellations/`,{})}async function ty(e){return kr(`${tr.subscriptions.v1}/${e}/renewals/`,{})}async function ny(e,{paymentMethodId:t,planId:n}){return kr(`${tr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function oy(e){return Ar(`${or.v1}/${e}`)}async function iy(){return Ar(`${or.v1}`)}async function ay(e){return kr(`${or.v1}/${e}/cancellations/`,{})}async function ry(e){return kr(`${or.v1}/${e}/renewals/`,{})}async function ly(e,{paymentMethodId:t,planId:n}){return kr(`${or.v1}/${e}`,{paymentMethodId:t,planId:n})}async function sy(){return Ar(tr.plans.v1)}async function cy(e){return Ar(`${tr.plans.v1}/${e}`)}async function uy(){return Ar(tr.invoices.v1)}async function dy(e){return Ar(`${tr.invoices.v1}/${e}`)}async function yy(e,t){return Ar(`${tr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const fy=["email"];async function py(){return Ar(tr.paymentMethods.v1)}async function gy(e){return Ar(`${tr.paymentMethods.v1}/${e}`)}async function Sy(e,t){let{email:n}=t,o=Ho(t,fy);return Tr(`${tr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function vy(e){return br(tr.paymentProviders.stripe.subscriptions.v1,e)}async function hy(e){return Ar(`${tr.paymentProviders.stripe.customers.v1}/${e}`)}async function my(e){return br(`${tr.paymentProviders.stripe.customers.v1}`,e)}async function Ay(){return Ar(`${tr.paymentProviders.stripe.publicConfigurations.v1}`)}async function by(e){return br(`${tr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ty(e){return Ar(`${tr.summaries.v1}/${e}`)}async function ky(e){return Ar(`${tr.tenantConfiguration.v1}/${e}`)}async function Ey(e){return br(`${tr.tenantConfiguration.v1}`,e)}async function Iy(){return Ar(nr.v1)}async function Py(){return Ar(`${tr.configurations.vendorPublicConfigurations.v1}`)}let Ly,Oy,_y,wy,Uy,Cy;async function Ry(){return Ar("/vendors/public")}async function Dy(e){return Ar(Ba.v1,e)}async function Ny(e){return br(Ba.v1,e)}async function My(e,t){return Er(Ba.v1,e,{headers:Pr(t)})}async function Fy(e,t,n){return br(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function Gy(e,t,n){return Er(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function $y(e,t,n){return Tr(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function xy(e,t){return br(Za.v1,e,{headers:Pr(t)})}async function Vy(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 By(e,t,n){return kr(`${Ba.v1}/${e}/access`,t,{headers:Pr(n)})}async function Wy(e,t){return br(`${Ba.v2}/`,e,{headers:Pr(t)})}async function Ky(){return Ar(`${yr}`)}async function Hy(e,t){return Tr(`${yr}/${e}`,t)}async function zy(e){return br(`${yr}`,e)}async function qy(e){return Er(`${yr}/${e}`)}async function Yy(e){return Ar(`${fr}/${e}/Users/count`)}async function Jy(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"}(Ly||(Ly={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Oy||(Oy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(_y||(_y={})),(wy||(wy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Uy||(Uy={})),function(e){e.CREATE="create_customer"}(Cy||(Cy={}));const Qy=["groupId"];async function Xy({groupId:e},t){return Ar(`${Ka.v1}/${e}`,U({},t))}async function Zy(e){return Ar(`${Ka.v1}`,U({},e))}async function ef(e,t){return br(`${Ka.getByIds.v1}`,e,{params:t})}async function tf(e){return br(`${Ka.v1}`,e)}async function nf(e){let{groupId:t}=e,n=Ho(e,Qy);return Tr(`${Ka.v1}/${t}`,n)}async function of(e){return Er(`${Ka.v1}/${e}`)}async function af(e,t){return br(`${Ka.v1}/${e}/roles`,t)}async function rf(e,t){return Er(`${Ka.v1}/${e}/roles`,t)}async function lf(e,t){return br(`${Ka.v1}/${e}/users`,t)}async function sf(e,t){return Er(`${Ka.v1}/${e}/users`,t)}async function cf(){return Ar(`${Ka.configurations.v1}`)}async function uf(e){return br(`${Ka.configurations.v1}`,e)}async function df(){return Ar(gr.v1)}async function yf(){return Ar(Sr.v1)}let ff,pf,gf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ff||(ff={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(pf||(pf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(gf||(gf={}));const Sf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],vf=`${Na.v1}/user/token/refresh`,hf=`${ur}/authorize/silent`,mf=`${Ma.v2}/me`,Af=`${Ma.v2}/me/tenants`,bf=`${Ma.v3}/me/tenants`;let Tf,kf,Ef,If,Pf,Lf,Of,_f;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Tf||(Tf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(kf||(kf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ef||(Ef={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS",e.CONFIGURE_SSO="CONFIGURE_SSO"}(If||(If={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.STALE_USERS_EXIST="STALE_USERS_EXIST",e.NO_STALE_USERS_EXIST="NO_STALE_USERS_EXIST",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Pf||(Pf={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS"}(Lf||(Lf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Of||(Of={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(_f||(_f={}));const wf={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:Ua,FronteggContext:Ca,api:wf,FronteggApiError:Ra,AuthStrategyEnum:To,MachineToMachineAuthStrategy:ko,SocialLoginProviders:bo,ISubscriptionCancellationPolicy:_y,ISubscriptionStatus:Ly,PaymentMethodType:Oy,ProviderType:wy};let Cf,Rf;!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"}(Cf||(Cf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Rf||(Rf={}));const Df="input is invalid type",Nf="undefined"!=typeof ArrayBuffer,Mf="0123456789abcdef".split(""),Ff=[-2147483648,8388608,32768,128],Gf=[24,16,8,0],$f=[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],xf=["hex","array","digest","arrayBuffer"],Vf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Nf&&!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 Wf(!0).update(t);return null==n?void 0:n[e]()}},Bf=function(e){return function(t,n){const o=new Kf(t,!0).update(n);return null==o?void 0:o[e]()}};class Wf{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=()=>Wf.prototype.digest(),e?(Vf[0]=Vf[16]=Vf[1]=Vf[2]=Vf[3]=Vf[4]=Vf[5]=Vf[6]=Vf[7]=Vf[8]=Vf[9]=Vf[10]=Vf[11]=Vf[12]=Vf[13]=Vf[14]=Vf[15]=0,this.blocks=Vf):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(Df);if(null===e)throw new Error(Df);if(Nf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Nf&&ArrayBuffer.isView(e)))throw new Error(Df);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]<<Gf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Gf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Gf[3&i++],l[i>>2]|=(128|o>>6&63)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Gf[3&i++],l[i>>2]|=(128|o>>12&63)<<Gf[3&i++],l[i>>2]|=(128|o>>6&63)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[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]|=Ff[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+$f[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+$f[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+$f[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+$f[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=Mf[e>>28&15]+Mf[e>>24&15]+Mf[e>>20&15]+Mf[e>>16&15]+Mf[e>>12&15]+Mf[e>>8&15]+Mf[e>>4&15]+Mf[15&e]+Mf[t>>28&15]+Mf[t>>24&15]+Mf[t>>20&15]+Mf[t>>16&15]+Mf[t>>12&15]+Mf[t>>8&15]+Mf[t>>4&15]+Mf[15&t]+Mf[n>>28&15]+Mf[n>>24&15]+Mf[n>>20&15]+Mf[n>>16&15]+Mf[n>>12&15]+Mf[n>>8&15]+Mf[n>>4&15]+Mf[15&n]+Mf[o>>28&15]+Mf[o>>24&15]+Mf[o>>20&15]+Mf[o>>16&15]+Mf[o>>12&15]+Mf[o>>8&15]+Mf[o>>4&15]+Mf[15&o]+Mf[i>>28&15]+Mf[i>>24&15]+Mf[i>>20&15]+Mf[i>>16&15]+Mf[i>>12&15]+Mf[i>>8&15]+Mf[i>>4&15]+Mf[15&i]+Mf[a>>28&15]+Mf[a>>24&15]+Mf[a>>20&15]+Mf[a>>16&15]+Mf[a>>12&15]+Mf[a>>8&15]+Mf[a>>4&15]+Mf[15&a]+Mf[r>>28&15]+Mf[r>>24&15]+Mf[r>>20&15]+Mf[r>>16&15]+Mf[r>>12&15]+Mf[r>>8&15]+Mf[r>>4&15]+Mf[15&r];return s+=Mf[l>>28&15]+Mf[l>>24&15]+Mf[l>>20&15]+Mf[l>>16&15]+Mf[l>>12&15]+Mf[l>>8&15]+Mf[l>>4&15]+Mf[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 Kf extends Wf{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(Df);if(null===e)throw new Error(Df);if(Nf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Nf&&ArrayBuffer.isView(e)))throw new Error(Df)}var i;e.length>64&&(e=null==(i=new Wf(!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}Wf.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();Wf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Wf.prototype.finalize.call(this)}}}const Hf=function(){const e=jf("hex");e.create=function(){return new Wf},e.update=function(t){return e.create().update(t)};for(let t=0;t<xf.length;++t){const n=xf[t];e[n]=jf(n)}return e}();function zf(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function qf(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=Hf.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Yf(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=Bf("hex");e.create=function(e){return new Kf(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<xf.length;++t){const n=xf[t];e[n]=Bf(n)}}();const Jf=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Qf(e){const t=yield Mi((e=>e.root.appName));return Ll.getFeatureFlags(e,t)}const Xf={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Zf=U({},Xf,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ep=[{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"}],tp={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},np=U({},tp,{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}),op={loading:!1,error:void 0,saving:!0,profile:tp},ip={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"},ap={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:To.EmailAndPassword,machineToMachineAuthStrategy:ko.ClientCredentials},rp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},lp={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},cp={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},up={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},dp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],yp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:cp,roles:dp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},fp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],pp={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:[ep[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[ep[0]],managedBy:Ef.FRONTEGG}]},gp={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:[ep[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[ep[0]],managedBy:Ef.FRONTEGG}]},Sp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},vp=[gp,pp],hp=[Sp],mp=[{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}],Ap=[{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"}],bp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Tp={isActive:!0,strategy:Vn.ALLOW},kp=[{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"}],Ep=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},gp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ip=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"}),Pp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ep(6),roles:[Ip("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Ef.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ep(44),roles:[Ip("Editor")],managedBy:Ef.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ep(8),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ep(5),roles:[Ip("Admin")],managedBy:Ef.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ep(21),description:"BDR, AE, and inside sales",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Ep(23),description:"Dev success and customer success",roles:[Ip("Admin")],managedBy:Ef.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Ep(10),description:"The marketing department",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Ep(4),description:"Human resources",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Ep(3),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ep(8),roles:[Ip("Editor")],managedBy:Ef.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Ep(4),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG}],Lp={scoring:{score:79},recommendations:{items:[{code:If.FORCE_MFA,severity:Of.WARNING,category:_f.MFA},{code:If.ENABLE_FORCE_RELOGIN,severity:Of.WARNING,category:_f.SESSIONS}]}},Op={insights:{items:[{category:_f.MFA,code:Pf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:_f.SESSIONS,code:Pf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:_f.PASSWORD,code:Pf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:_f.DOMAIN,code:Pf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}};let _p,wp,Up;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(_p||(_p={})),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"}(Up||(Up={})),Up.profile,Up.privacy,Up.personalApiTokens,Up.account,Up.users,Up.groups,Up.security,Up.sso,Up.audits,Up.webhooks,Up.apiTokens,Up.roles,Up.subscriptions,Up.allAccounts;const Cp=(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,Rp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Dp=e=>{const{pathname:t}=new URL(e),n=Rp(e);return n?t+n:t},Np=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Mp="tenantId",Fp=e=>e.mfaRequired&&e.mfaToken?(Ua.setAccessToken(null),Ua.setUser(null),!0):(Ua.setAccessToken(e.accessToken),Ua.setUser(e),!1),Gp=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},$p=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},xp=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...xp(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),Vp=["callback"];function*jp(){yield wi(Ro.setCustomLoginState({loading:!0}));try{const e=yield Ri(wf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield wi(Ro.setCustomLoginState({loading:!1,error:Cp(e)}))}}function*Bp(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Vp);try{yield wi(Ro.setCustomLoginState({error:null,saving:!0}));const e=xp(n);if(0===e.length)throw new Error("No changes to update");yield Ri(wf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Ri(wf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setCustomLoginState({error:Cp(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Wp(){var e;const[t]=yield Ri(Qf,["admin_portal_login_per_tenant"]),n=!(null==(e=Ua.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*Kp(){try{var e;if(!(yield Ri(Wp)))return;const t=yield Mi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=wf.accountSettings,{applicationUrl:i}=yield Ri(t?n:o);if(!i)return;const{routes:a}=yield Mi((e=>e.auth)),r=null!=(e=Rp(i))?e:"";yield wi(Ro.setState({routes:U({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield wi(Ro.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Hp(){yield wa(Ro.loadTenantMetadata,jp),yield wa(Ro.updateTenantMetadata,Bp)}let zp;function qp(e){return function*(t){const[n]=yield Ri(Qf,["admin-portal-new-security-center-page"]);yield e(t),n&&(yield Yp(),yield Jp())}}function*Yp(){const e=zp.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Ri(wf.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:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Jp(){const e=zp.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Ri(wf.securityCenter.getInsights);yield wi(Ro.setSecurityCenterState({insights:t.items}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Qp({payload:{callback:e}}){const t=zp.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(wf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield wi(Ro.setSecurityCenterStateError({key:t,value:Cp(n)})),null==e||e(!1)}finally{yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Xp({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r}){var l,s,c,u;yield wi(Ro.setSecurityCenterStateError({key:e,value:!1})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));const d=null!=(l=null!=o?o:null==t||null==(s=t.queryParams)?void 0:s._offset)?l:0,y=null!=(c=null!=i?i:null==t||null==(u=t.queryParams)?void 0:u._limit)?c:10,f=U({_offset:d,_limit:y,_includeSubTenants:!1,_preset:a},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Ri(wf.users.getUsersV3,f),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:d,queryParams:U({_offset:d,_limit:y},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Ri(wf.roles.getRoles),o=yield Ri(wf.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 wi(Ro.setSecurityCenterState({[n]:U({users:e},a)}))}else yield wi(Ro.setSecurityCenterState({[n]:U({users:[]},a)}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Zp({payload:e}){var t;const n=zp.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:uo.BREACHED_PASSWORDS,tableState:o},e))}function*eg({payload:e}){var t;const n=zp.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:uo.MFA_UNENROLLED,tableState:o},e))}function*tg({payload:e}){var t;const n=zp.INACTIVE_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"inactiveUsersTable",tableState:o},e))}function*ng(){yield Oa(Ro.loadRecommendations,Yp),yield Oa(Ro.loadInsights,Jp),yield Oa(Ro.sendResetBreachedPasswordEmails,Qp),yield Oa(Ro.loadBreachedPasswordUsers,Zp),yield Oa(Ro.loadUnenrolledMfaUsers,eg),yield Oa(Ro.loadInactiveUsers,tg)}function*og(){const e=zp.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({recommendations:Lp.recommendations.items,score:Lp.scoring.score})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*ig(){const e=zp.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({insights:Op.insights.items})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*ag(){yield Oa(Ro.loadRecommendations,og),yield Oa(Ro.loadInsights,ig)}!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(zp||(zp={}));const rg=["callback"],lg=["callback"],sg=["callback"],cg=["callback"],ug=["callback"],dg=["callback"];function*yg(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getGlobalSecurityPolicy);yield wi(Ro.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyGlobalState({error:Cp(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*fg(e){var t,n;if(!(yield Ri(Wp)))return e;const o=yield Ri(gg);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*pg(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorConfig),t=yield fg(e);yield wi(Ro.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:Cp(e),loading:!1}))}}function*gg(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(wf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Ri(wf.auth.getVendorPublicAuthStrategiesConfig),t}function*Sg(){yield wi(Ro.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Ri(gg);yield function*(e){const t=yield Ri(Wp);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:U({},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:Cp(e),loading:!1}))}}function*vg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getMfaPolicy);yield wi(Ro.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyMfaState({error:Cp(e),loading:!1}))}}function*hg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorMfaPolicy);yield wi(Ro.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorMfaState({error:Cp(e),loading:!1}))}}function*mg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,rg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.saveMfaPolicy,n);yield wi(Ro.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Ag(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getLockoutPolicy);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({error:Cp(e),loading:!1}))}}function*bg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,lg);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.saveLockoutPolicy,n);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Tg(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorLockoutPolicy);yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorLockoutState({error:Cp(e),loading:!1}))}}function*kg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCaptchaPolicy);yield wi(Ro.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyCaptchaState({error:Cp(e),loading:!1}))}}function*Eg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({error:Cp(e),loading:!1}))}}function*Ig(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({error:Cp(e),loading:!1}))}}function*Pg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,sg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.savePasswordHistoryPolicy,n);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Lg(){yield wi(Ro.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getPasswordConfigPolicy);yield wi(Ro.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordState({error:Cp(e),loading:!1}))}}function*Og(){yield wa(Ro.loadSecurityPolicy,yg),yield Oa(Ro.saveSecurityPolicyMfa,qp(mg)),yield Oa(Ro.loadSecurityPolicyMfa,vg),yield Oa(Ro.loadSecurityPolicyVendorMfa,hg),yield Oa(Ro.saveSecurityPolicyLockout,qp(bg)),yield Oa(Ro.loadSecurityPolicyLockout,Ag),yield Oa(Ro.loadSecurityPolicyVendorLockout,Tg),yield Oa(Ro.loadSecurityPolicyCaptcha,kg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,qp(Pg)),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Eg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,Ig),yield Oa(Ro.loadVendorPasswordConfig,Lg),yield Oa(Ro.loadPublicSecurityPolicy,pg),yield Oa(Ro.loadPublicAuthStrategiesPolicy,Sg)}function*_g(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield wi(Ro.setSecurityPolicyPublicState({policy:ap,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:Cp(e),loading:!1}))}}function*wg(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyGlobalState({policy:ip,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*Ug(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:rp,loading:!1}))}function*Cg(){yield wi(Ro.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorMfaState({policy:rp,loading:!1}))}function*Rg(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,cg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},lp,{id:null!=(t=o.id)?t:lp.id,enforceMFAType:o.enforceMFAType});yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*Dg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:lp,loading:!1}))}function*Ng(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:lp,loading:!1}))}function*Mg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ug);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null})),yield At();const o=U({},lp,n,{id:n.id?n.id:lp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Fg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:lp,loading:!1}))}function*Gg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:sp,loading:!1}))}function*$g(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:sp,loading:!1}))}function*xg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,dg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield At();const o=U({},sp,n,{id:n.id?n.id:sp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Vg(){yield wa(Ro.loadSecurityPolicy,wg),yield Oa(Ro.loadPublicSecurityPolicy,_g),yield Oa(Ro.saveSecurityPolicyMfa,Rg),yield Oa(Ro.loadSecurityPolicyMfa,Ug),yield Oa(Ro.loadSecurityPolicyVendorMfa,Cg),yield Oa(Ro.saveSecurityPolicyLockout,Mg),yield Oa(Ro.loadSecurityPolicyLockout,Dg),yield Oa(Ro.loadSecurityPolicyVendorLockout,Ng),yield Oa(Ro.loadSecurityPolicyCaptcha,Fg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,xg),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Gg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,$g)}const jg=["events","url"];function*Bg(){yield wi(Ro.setSignUpState({loading:!0}));try{const e=yield Ri(wf.auth.getVendorConfig),t=yield fg(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:Cp(e),firstLoad:!1}))}}function*Wg(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,jg);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(wf.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&&Fp(l)){const t=yield US(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:U({},e,{tenants:u,activeTenant:d})}))}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setSignUpState({loading:!1,error:Cp(e)}))}yield wi(Ro.setSignUpState({loading:!1}))}function*Kg(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Mi((e=>e.auth.signUpState));yield wi(Ro.resetSignUpState()),yield wi(Ro.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Hg(){yield wa(Ro.signUpUser,Wg),yield wa(Ro.resetSignUpStateSoft,Kg)}const zg={setVendorState:(e,{payload:t})=>U({},e,t)},qg={loadVendorPublicInfo:ct("vendor/loadVendorPublicInfo")},Yg={loading:!1},{reducer:Jg,actions:Qg}=dt({name:Rt,initialState:Yg,reducers:U({},zg)}),Xg=U({},Qg,qg);function*Zg(){yield wi(Xg.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield wf.vendor.getVendorPublicInfo();yield wi(Xg.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield wi(Xg.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var eS=n(378),tS=n.n(eS);function nS(e,t){return tS()(e,t)}function*oS({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Ri(wf.entitlements.loadEntitlements);yield function*(e){nS(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*iS(){yield wa(Ro.loadEntitlements,oS)}const aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback"],cS=["callback","events"],uS=["callback"],dS=["callback"],yS=["callback"],fS=["callback"],pS=["user"],gS=["callback"],SS=["callback"],vS=["callback"],hS=["callback"],mS=["callback"],AS=["callback","deviceId"],bS=["callback"],TS=["callback"],kS=["callback","deviceId"],ES=["callback","deviceId"],IS=["callback","deviceId"];function*PS(e){const t=yield Mi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return nS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*LS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Mi((e=>e.auth));yield wi(Ro.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*OS(){const e=Ua.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(Kp),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?Dp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*_S(){let e;try{var t;const n=yield Ri(wf.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*wS(){try{const{isActive:e}=yield Ri(wf.auth.getSSOPublicConfiguration);yield wi(Ro.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*US(e){let t=It.loginWithTwoFactor,n={};const{loginState:o}=yield Mi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ri(wf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Gp(e.mfaDevices)}:(n={step:$p(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: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*CS(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*RS(){const{hostedLoginBox:e}=yield Mi((e=>e.auth));e?yield Ri(DS):yield Ri(MS)}function*DS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.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(wf.auth.exchangeOAuthTokensV2,t),o=yield Ri(PS,n.user);yield Ri(LS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*NS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.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(wf.auth.exchangeOAuthTokensV2,t),o=yield Ri(PS,n.user);yield Ri(LS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*MS(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.refreshTokenV3);if(Fp(i)){const e=yield US(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 CS(i),l=yield Ri(PS,i);yield Ri(LS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield GS(n)}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*FS(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.refreshTokenV3);if(Fp(i)){const e=yield US(i);yield wi(Ro.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Ri(PS,i);if(yield Ri(ZS))yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),yield Ri(LS,{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 CS(i);yield Ri(LS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield GS(n)}}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*GS(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ua.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 OS())}function*$S({payload:{callback:e}}){try{const{ip:t}=yield Ri(wf.metadata.getCurrentUserIpMetadata);yield wi(Ro.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*xS({payload:e}){const t=[];(yield Ri(Wp))?yield Ri(RS):t.push(Ri(RS)),e&&(yield wi(Ro.setState({isLoading:!0})),yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(Bg)),t.push(Ri(Sg)),t.push(Ri(wS)),t.push(Ri(Zg)),t.push(Ri(_S)),t.push(Ri(Kp))),yield Ui(t),yield wi(Ro.setState({isLoading:!1}))}function*VS({accessToken:e,user:t}){if(!e)return void(yield wi(Ro.setState({user:void 0,isAuthenticated:!1})));const n=Ua.onRedirectTo,{routes:o}=yield Mi((e=>e.auth));if(Fp(t)){const e=yield US(t);yield wi(Ro.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*jS({payload:e}){const t=[];yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(Bg)),t.push(Ri(wS)),t.push(Ri(Zg)),t.push(Ri(_S)),t.push(Ri(VS,e)),t.push(Ri(Kp)),yield Ui(t)}const BS=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*WS(){const e=yield Ri(wf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Ri(LS,e,{isAuthenticated:!0,isLoading:!1})}function*KS({payload:e}){const{disableSilentRefresh:t}=yield Mi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield WS()}catch(t){yield zS(e)}}function*HS({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Mi((e=>({urlStrategy:e.root.urlStrategy}))),t=BS(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 WS()}catch(n){if(!t)return void(yield wi(Ro.setState({isLoading:!1})));yield zS(e)}}function*zS(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(BS(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield wi(Ro.setState({isLoading:!0}));const a=Yf(),r=Yf(),l=yield Ri(qf,r);localStorage.setItem(_t,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Ri(Kp);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=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=Np(Mp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*qS({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(Kp);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(wf.auth.exchangeOAuthTokensV2,r);yield Ri(LS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield wi(Ro.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield OS()}}function*YS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,aS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(wf.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:Cp(e),loading:!1}))}}function*JS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,rS);try{yield wi(Ro.setLoginState({loading:!0})),yield Ri(wf.auth.verifyChangePhoneNumber,n),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e),loading:!1}))}}function*QS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,lS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(wf.auth.passwordlessPreLogin,U({},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:Cp(e),loading:!1})),null==t||t(e)}}function*XS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,sS);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(wf.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:Cp(e),loading:!1})),null==t||t()}}function*ZS(){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(Qf,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ri(wf.auth.getWebAuthnDevices);return yield wi(Ro.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ev(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,cS);try{yield wi(Ro.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.passwordlessPostLoginV2,o),l=Ua.onRedirectTo,{routes:s}=yield Mi((e=>e.auth));if(Fp(e)){const t=yield US(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:_p.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Ri(LS,{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(ZS))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield wi(Ro.setState({isAuthenticated:!0})),yield OS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield wi(Ro.setLoginState({error:Cp(e,"Failed to authenticate")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*tv({payload:e}){try{yield wi(Ro.setLoginState({loading:!0}));const{name:t}=yield Ri(wf.auth.verifyInviteToken,e);yield wi(Ro.setLoginState({inviteTokenTenantName:t}))}catch(e){yield wi(Ro.setLoginState({inviteTokenError:Cp(e,"We couldn't verify your invitation")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*nv({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=Np(Mp),{address:r,idpType:l}=yield Ri(wf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Rf.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 ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*ov(e){let{callback:t}=e,n=Ho(e,uS);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(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield wi(Ro.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t())}function*iv({payload:{callback:e}}){try{yield wi(Ro.setLoginState({loading:!0}));const{options:t}=yield Ri(wf.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:Cp(t)})),null==e||e(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*av(e){let{payload:{callback:t}}=e,n=Ho(e.payload,dS);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(wf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*rv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,yS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const{options:e}=yield Ri(wf.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)}))),yield wi(Ro.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*lv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,fS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const e=Et(n.publicKey),i=yield Ri(wf.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=Ho(i,pS);if(Fp(a)){const e=Ua.onRedirectTo,{routes:t}=yield Mi((e=>e.auth)),n=yield US(a);yield wi(Ro.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Ri(LS,U({user:a},r),{isAuthenticated:!0}),yield wi(Ro.setLoginState({error:void 0})),yield OS(),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*sv({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(wf.auth.postLogin,e);yield wi(Ro.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield OS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield wi(Ro.setLoginState({step:It.loginWithSSOFailed,loading:!1}))}}function*cv({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(wf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Ua.onRedirectTo,{routes:c}=yield Mi((e=>e.auth));if(Fp(a)){const e=yield US(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(LS,{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(Qf,["security-center-login-flows"]);t.flow===Pt.Login&&(o&&a.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):n&&((yield Ri(ZS))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield OS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ua.setAccessToken(null),Ua.setUser(null),null==i||i(!1,t),yield wi(Ro.setLoginState({email:e,error:Cp(t),loading:!1}))}}function*uv({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(wf.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(LS,{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(Qf,["security-center-login-flows"]);l.flow===Pt.Login&&(u&&l.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):(yield Ri(ZS))?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield OS()),null==o||o(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e),loading:!1})),null==o||o(!1,e)}}function*dv({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*yv({payload:e}){const{hostedLoginBox:t}=yield Mi((e=>e.auth));yield wi(Ro.setState({isLoading:!0}));try{t?yield Ri(wf.auth.OAuthLogout):yield Ri(wf.auth.logout)}catch{}yield wi(Ro.resetState()),yield wi(Ro.requestAuthorize(!0)),null==e||e()}function*fv({payload:e}){var t;try{yield Ri(wf.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*pv({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*gv({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(Qf,["security-center-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(ZS);i===rn.smsVerifyCode&&e?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield OS()}yield wi(Ro.setState({isAuthenticated:!!e.accessToken}))}function*Sv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,gS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null)}}function*vv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,SS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.enrollMFASMSForLoginV2,n);yield pv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*hv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,vS);yield wi(Ro.setLoginState({loading:!0}));try{var o;const e=yield Ri(wf.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:kt(e.options.challenge),user:U({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},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:Cp(e)})),null==t||t(null)}}function*mv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,hS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(n.publicKey),o=yield Ri(wf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield pv(o),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Av(e){let{payload:{callback:t}}=e,n=Ho(e.payload,mS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield pv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*bv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,AS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null)}}function*Tv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,bS);try{const e=yield Ri(wf.auth.preVerifyMFAEmailCode,n);yield wi(Ro.setMfaState({otcToken:e.otcToken,step:rn.emailVerifyCode})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}}function*kv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,TS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.verifyMFAEmailCodeV2,n);yield gv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Ev(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,kS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.verifyMFASMSForLoginV2,n,o);yield gv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Iv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,ES);yield wi(Ro.setLoginState({loading:!0}));try{var i;const e=yield Ri(wf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},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:Cp(e)})),null==t||t(null)}}function*Pv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,IS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(o.publicKey),i=yield Ri(wf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield gv(i),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Lv({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{yield Ri(wf.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:Cp(e)}))}}function*Ov(){yield wa(Ro.requestAuthorize,xS),yield wa(Ro.requestAuthorizeSSR,jS),yield wa(Ro.requestHostedLoginAuthorize,KS),yield wa(Ro.requestHostedLoginAuthorizeV2,HS),yield wa(Ro.handleHostedLoginCallback,qS),yield wa(Ro.preLogin,nv),yield wa(Ro.postLogin,sv),yield wa(Ro.login,cv),yield wa(Ro.logout,yv),yield wa(Ro.silentLogout,fv),yield wa(Ro.loginWithMfa,uv),yield wa(Ro.recoverMfa,dv),yield wa(Ro.quickSmsPasswordlessPreLogin,QS),yield wa(Ro.changePhoneNumberWithVerification,YS),yield wa(Ro.verifyChangePhoneNumber,JS),yield wa(Ro.passwordlessPreLogin,XS),yield wa(Ro.passwordlessPostLogin,ev),yield wa(Ro.verifyInviteToken,tv),yield wa(Ro.webAuthnPrelogin,rv),yield wa(Ro.webAuthnPostLogin,lv),yield wa(Ro.webAuthnCreateNewDeviceSession,iv),yield wa(Ro.webAuthnVerifyNewDeviceSession,av),yield wa(Ro.afterAuthNavigation,OS),yield wa(Ro.getUserIP,$S),yield wa(Ro.preEnrollMFASMSForLogin,Sv),yield wa(Ro.enrollMFASMSForLogin,vv),yield wa(Ro.preEnrollMFAWebAuthnForLogin,hv),yield wa(Ro.enrollMFAWebAuthnForLogin,mv),yield wa(Ro.enrollMFAAuthenticatorAppForLogin,Av),yield wa(Ro.preVerifyMFASMSForLogin,bv),yield wa(Ro.verifyMFASMSForLogin,Ev),yield wa(Ro.preVerifyMFAWebAuthnForLogin,Iv),yield wa(Ro.verifyMFAWebAuthnForLogin,Pv),yield wa(Ro.preVerifyMFAEmailCode,Tv),yield wa(Ro.verifyMFAEmailCode,kv),yield wa(Ro.resetBreachedPassword,Lv)}function*_v({payload:e}){e&&(yield wi(Ro.setState({isLoading:!0})));const t=np;yield wi(Ro.loadTenants()),yield wi(Ro.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*wv({payload:{callback:e}}){try{const{ip:t}=kp[0];yield wi(Ro.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Uv(){yield wa(Ro.requestAuthorize,_v),yield wa(Ro.afterAuthNavigation,OS),yield wa(Ro.getUserIP,wv)}const Cv=["callback","samlVendor"],Rv=["callback","samlVendor"];function*Dv(){try{var e,t;yield wi(Ro.setSSOState({loading:!0}));const n=yield Ri(wf.auth.getSamlConfiguration),o=yield Ri(wf.auth.getOidcConfiguration),i=yield Ri(wf.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:Cp(e),loading:!1}))}}function*Nv({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 Jf(e[0]),i=yield Ri(wf.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:Cp(e),[n]:!1}))}}function*Mv({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 Jf(t),a=yield Ri(wf.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:Cp(e),[i]:!1})),null==n||n(null,e)}}function*Fv({payload:e}){const{callback:t,samlVendor:n}=e,o=Ho(e,Cv),i=yield Mi((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 wi(Ro.setSSOState({samlConfiguration:U({},i,a)})));if(yield wi(Ro.setSSOState({error:void 0,[r]:!0})),e.type===Rf.Saml){var l,s;const e=yield Ri(wf.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=zf(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(wf.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:Cp(e),[r]:!1})),null==t||t(null,e)}}function*Gv({payload:{callback:e}={}}){const t=yield Mi((e=>e.auth.ssoState.samlConfiguration));try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.validateSamlDomain),yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:Cp(n),saving:!1})),null==e||e(null,n)}}function*$v(){try{const e=yield Ri(wf.auth.getSamlRoles),t=yield Ri(wf.auth.getSamlRolesGroups);yield wi(Ro.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield wi(Ro.setSSOState({error:Cp(e)}))}}function*xv({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ui(e.map((e=>Ri(wf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield wi(Ro.setSSOState({error:Cp(e)}))}}(n)),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:Cp(t),saving:!1})),null==e||e(null,t)}}function*Vv({payload:{callback:e,id:t}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.deleteSamlGroup,{id:t}),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:Cp(t),saving:!1})),null==e||e(null,t)}}function*jv({payload:{group:e,roleIds:t,callback:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.createSamlGroup,{group:e,roleIds:t}),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield wi(Ro.setSSOState({error:Cp(e),saving:!1})),null==n||n(null,e)}}function*Bv({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield wi(Ro.setSSOState({loading:!0})),yield Ri(wf.auth.oidcPostLoginV2,t),yield Ri(RS),yield wi(Ro.setSSOState({loading:!1}))}catch(e){yield wi(Ro.setSSOState({loading:!1,error:Cp(e,"Failed to authenticate"),firstLoad:!1}))}}function*Wv(){yield Oa(Ro.loadSSOConfigurations,Dv),yield Oa(Ro.saveSSOConfigurations,Fv),yield Oa(Ro.saveSSOConfigurationsFile,Nv),yield Oa(Ro.saveSSOConfigurationsFileWithCallback,Mv),yield Oa(Ro.validateSSODomain,Gv),yield Oa(Ro.loadSSOAuthorizationRoles,$v),yield Oa(Ro.updateSSOAuthorizationRoles,xv),yield Oa(Ro.deleteSamlGroup,Vv),yield Oa(Ro.createSamlGroup,jv),yield Oa(Ro.oidcPostlogin,Bv)}function*Kv(){yield wi(Ro.setSSOState({loading:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:cp,loading:!1,firstLoad:!1}))}function*Hv({payload:e}){const t="saving";yield wi(Ro.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Mi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield wi(Ro.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*zv({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ho(e,Rv),r=yp.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 wi(Ro.setSSOState({samlConfiguration:U({},r,l)})));yield wi(Ro.setSSOState({error:void 0,[s]:!0})),yield At(),l.acsUrl=null==up||null==(t=up.configuration)?void 0:t.acsUrl,l.spEntityId=null==up||null==(n=up.configuration)?void 0:n.spEntityId;const c=zf(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*qv({payload:{callback:e}={}}){const t=yp.samlConfiguration;yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Yv(){yield At(),yield wi(Ro.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Jv({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*Qv(){yield Oa(Ro.loadSSOConfigurations,Kv),yield Oa(Ro.saveSSOConfigurations,zv),yield Oa(Ro.saveSSOConfigurationsFile,Hv),yield Oa(Ro.validateSSODomain,qv),yield Oa(Ro.loadSSOAuthorizationRoles,Yv),yield Oa(Ro.updateSSOAuthorizationRoles,Jv)}const Xv=["callback"],Zv=["callback","ssoConfigId"],eh=["callback","ssoConfigId"],th=["callback","ssoConfigId"];function*nh(){try{return yield Ri(wf.auth.getOidcConfiguration)}catch(e){return null}}function*oh(){try{return yield Ri(wf.metadata.getSamlMetadata)}catch(e){return null}}function*ih(){try{yield wi(Ro.setSSOLoader({key:Cf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ui([Ri(nh),Ri(oh)]),n=yield Ri(wf.auth.getSSOConfigurations);yield wi(Ro.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield wi(Ro.setSSOError({key:Cf.LOAD_SSO_CONFIGURATIONS,value:Cp(e)}))}finally{yield wi(Ro.setSSOLoader({key:Cf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*ah({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ho(e,Xv),o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ri(wf.auth.createSSOConfiguration,U({},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:Cf.SAVE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*rh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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 Jf(t),i=yield Ri(wf.auth.createSSOConfigurationByMetadata,{metadata:e});yield wi(Ro.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*lh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,Zv),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(wf.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:Cf.UPDATE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*sh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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 Jf(o),a=yield Ri(wf.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:Cf.UPDATE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ch({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.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:Cf.DELETE_SSO_CONFIGURATION,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*uh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ho(e,eh);yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(wf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield wi(Ro.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_DOMAIN,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_DOMAIN,value:!1}))}}function*dh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},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:Cf.DELETE_SSO_DOMAIN,value:Cp(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_DOMAIN,value:!1}))}}function*yh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield wi(Ro.setSSOLoader({key:Cf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.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 wi(Ro.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.VALIDATE_SSO_DOMAIN,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*fh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield wi(Ro.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOError({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:Cp(t)})),null==e||e(null,t)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*ph({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(t.map((e=>Ri(wf.auth.deleteSSOGroup,n,e)))),yield Ui(e.map((e=>Ri(wf.auth.createSSOGroup,n,e))));const a=yield Ri(wf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield wi(Ro.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_GROUPS,value:Cp(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!1}))}}function*gh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ui(t.map((t=>Ri(wf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_GROUPS,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!1}))}}function*Sh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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(wf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ri(wf.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:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*vh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,th),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ri(wf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ri(wf.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:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*hh(){yield Oa(Ro.loadSSOConfigurationsV2,ih),yield Oa(Ro.saveSSOConfigurationV2,ah),yield Oa(Ro.saveSSODomain,uh),yield Oa(Ro.deleteSSODomain,dh),yield Oa(Ro.validateSSODomainV2,yh),yield Oa(Ro.updateSSOConfiguration,lh),yield Oa(Ro.deleteSSOConfiguration,ch),yield Oa(Ro.setSSOGroups,ph),yield Oa(Ro.updateSSOGroups,gh),yield Oa(Ro.setSSODefaultRoles,fh),yield Oa(Ro.saveSSOConfigurationByMetadata,rh),yield Oa(Ro.updateSSOConfigurationByMetadata,sh),yield Oa(Ro.saveSSOConfigurationByUrl,Sh),yield Oa(Ro.saveSSOConfigurationByData,vh)}const mh=["callback","profilePictureUrl"],Ah=["callback","profilePictureUrl"];function*bh(){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,wf.teams.getProfile),t=yield Mi((e=>e.auth.user));Ro.setUser(U({},t,e)),yield wi(Ro.setProfileState({profile:e,loading:!1}))}catch(e){yield wi(Ro.setProfileState({loading:!1,error:Cp(e)}))}}function*Th(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,mh);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(wf.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 Ri(wf.users.updateUserProfileV2,a),l=yield Mi((e=>e.auth.user));yield wi(Ro.setUser(U({},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:Cp(e),loading:!1})),null==t||t(null,e)}}function*kh({payload:e}){yield wi(Ro.setProfileState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Eh(){yield wa(Ro.loadProfile,bh),yield Oa(Ro.saveProfile,Th),yield Oa(Ro.changePassword,kh)}function*Ih(){yield wi(Ro.setProfileState({loading:!0})),yield At(),yield wi(Ro.setUser(U({},np,tp))),yield wi(Ro.setProfileState({loading:!1,profile:tp}))}function*Ph(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,Ah);yield wi(Ro.setProfileState({saving:!0,error:null}));const i=op;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=np;yield At(),yield wi(Ro.setUser(U({},l,r))),yield wi(Ro.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Lh({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*Oh(){yield wa(Ro.loadProfile,Ih),yield Oa(Ro.saveProfile,Ph),yield Oa(Ro.changePassword,Lh)}const _h=["callback"],wh=["callback"],Uh=["user"],Ch=["callback"],Rh=["deviceId","callback"],Dh=["deviceId","callback"],Nh=["callback"],Mh=["deviceId"],Fh=["deviceId"],Gh=["callback"],$h=["deviceId"],xh=["callback"];function*Vh(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*jh(){yield wi(Ro.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ri(wf.auth.enrollMfa);yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)}))}}function*Bh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,_h);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Mi((e=>e.auth.user)),o=yield Ri(wf.auth.verifyMfa,n),i=yield Ri(wf.auth.getMFADevices),a=yield Vh(o);yield wi(Ro.setMfaState(U({},a,{mfaDevices:i}))),yield wi(Ro.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Wh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,wh);yield wi(Ro.setMfaState({loading:!0}));try{const e=yield Ri(wf.auth.loginWithMfaV2,n),{user:o}=e,i=Ho(e,Uh),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 LS(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({loading:!1,error:Cp(e)})),null==t||t(null,e)}}function*Kh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;yield Ri(wf.auth.disableMfa,e);const n=yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Hh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t,n;const o=yield Ri(wf.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:kt(o.options.challenge),user:U({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},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:Cp(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*zh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ch);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(n.publicKey),o=yield Ri(wf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Ri(wf.auth.getMFADevices),a=yield Vh(o);yield wi(Ro.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*qh(e){let{payload:{deviceId:t,callback:n}}=e;Ho(e.payload,Rh),yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(wf.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},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:Cp(e)})),null==n||n(null,e)}}function*Yh(e){let{payload:{deviceId:t,callback:n}}=e,o=Ho(e.payload,Dh);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(o.publicKey);yield Ri(wf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Ri(wf.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:Cp(e)})),null==n||n(!1,e)}}function*Jh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;const n=yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Qh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Nh);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Ri(wf.auth.enrollMFASMS,n),o=yield Ri(wf.auth.getMFADevices),i=yield Vh(e);yield wi(Ro.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Xh(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Mh);yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(wf.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:Cp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Zh(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Fh);yield wi(Ro.setMfaState({saving:!0}));try{var o;yield Ri(wf.auth.disableMFASMS,t,n);const e=yield Ri(wf.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:Cp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*em(){yield wi(Ro.setMfaState({loading:!0}));try{yield Mi((e=>e.auth.user));const e=yield Ri(wf.auth.getMFADevices);yield wi(Ro.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield wi(Ro.setMfaState({loading:!1,error:Cp(e)}))}}function*tm(){yield wi(Ro.setMfaState({loading:!0}));try{const e=(yield Ri(wf.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:Cp(e)}))}}function*nm(){yield Oa(Ro.enrollMfa,jh),yield Oa(Ro.getMFADevices,em),yield Oa(Ro.getMFAStrategies,tm),yield Oa(Ro.verifyMfa,Bh),yield Oa(Ro.disableMfa,Kh),yield Oa(Ro.verifyMfaAfterForce,Wh),yield Oa(Ro.preDisableMfaSms,Xh),yield Oa(Ro.disableMfaSms,Zh),yield Oa(Ro.preEnrollMfaSms,Jh),yield Oa(Ro.enrollMfaSms,Qh),yield Oa(Ro.preEnrollMfaWebAuthn,Hh),yield Oa(Ro.enrollMfaWebAuthn,zh),yield Oa(Ro.preDisableMfaWebAuthn,qh),yield Oa(Ro.disableMfaWebAuthn,Yh)}function*om(){yield wi(Ro.setMfaState({saving:!0})),yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*im({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:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield wi(Ro.setMfaState(o)),yield wi(Ro.setUser(U({},np,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*am(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Gh);yield wi(Ro.setMfaState({loading:!0})),yield At();const o=U({},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(U({},np,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*rm({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:U({},n,{authenticators:[]})})),yield wi(Ro.setUser(U({},np))),null==(t=e.callback)||t.call(e,!0)}function*lm(e){let{}=e,t=Ho(e.payload,$h);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:Cp(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*sm({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:U({},n,{phones:[]})})),yield wi(Ro.setUser(U({},np))),null==(t=e.callback)||t.call(e,!0)}function*cm({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*um(e){let{payload:{callback:t}}=e;Ho(e.payload,xh);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:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield wi(Ro.setMfaState(i)),yield wi(Ro.setUser(U({},np,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*dm(){yield Oa(Ro.enrollMfa,om),yield Oa(Ro.verifyMfa,im),yield Oa(Ro.disableMfa,rm),yield Oa(Ro.verifyMfaAfterForce,am),yield Oa(Ro.preDisableMfaSms,lm),yield Oa(Ro.disableMfaSms,sm),yield Oa(Ro.preEnrollMfaSms,cm),yield Oa(Ro.enrollMfaSms,um)}const ym=["callback"];function*fm({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*pm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ym);yield wi(Ro.setForgotPasswordState({loading:!0}));try{yield Ri(wf.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:Cp(e)})),null==t||t(!1,e)}}function*gm({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{const t=yield Ri(wf.auth.loadPasswordConfig,e);yield wi(Ro.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield wi(Ro.setForgotPasswordState({loading:!1,error:Cp(e)}))}}function*Sm(){yield wa(Ro.forgotPassword,fm),yield wa(Ro.resetPassword,pm),yield wa(Ro.loadPasswordConfig,gm)}let vm;!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"}(vm||(vm={}));const hm=["callback","events"],mm=["user"],Am=["callback"],bm=["callback"];function*Tm({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(wf.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:Cp(e)}))}}function*km(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,hm);yield wi(Ro.setActivateState({loading:!0}));try{const e=Ua.onRedirectTo,{routes:a}=yield Mi((e=>e.auth)),r=yield Ri(wf.auth.activateAccountV2,o),{user:l}=r,s=Ho(r,mm);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Fp(l)){yield wi(Ro.setActivateState({step:Ft.success}));const t=yield US(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:_p.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Ri(LS,U({user:l},s),{isAuthenticated:!0}),yield Fi(1e3),yield OS(),yield wi(Ro.resetActivateState())}null==t||t(!0)}catch(e){yield wi(Ro.setActivateState({loading:!1,error:Cp(e)}))}}function*Em({payload:e}){const{callback:t}=e,n=Ho(e,Am);yield wi(Ro.setActivateStrategyState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)}))}}function*Im({payload:e}){const{callback:t}=e,n=Ho(e,bm);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.email})),yield wi(Ro.setActivateState({loading:!0}));try{yield Ri(wf.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:Cp(e)})),yield wi(Ro.setTeamError({key:vm.RESEND_ACTIVATE_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*Pm(){yield wa(Ro.activateAccount,km),yield wa(Ro.preActivateAccount,Tm),yield wa(Ro.getActivateAccountStrategy,Em),yield wa(Ro.resendActivationEmail,Im)}function*Lm({payload:e}){if(e.token&&e.userId)try{yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.pending})),yield Ri(wf.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:Cp(e)}))}else yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.invalid}))}function*Om(){yield wa(Ro.acceptInvitation,Lm)}var _m,wm=new Uint8Array(16);function Um(){if(!_m&&!(_m="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 _m(wm)}for(var Cm=/^(?:[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,Rm=function(e){return"string"==typeof e&&Cm.test(e)},Dm=[],Nm=0;Nm<256;++Nm)Dm.push((Nm+256).toString(16).substr(1));var Mm=function(e,t,n){var o=(e=e||{}).random||(e.rng||Um)();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=(Dm[e[t+0]]+Dm[e[t+1]]+Dm[e[t+2]]+Dm[e[t+3]]+"-"+Dm[e[t+4]]+Dm[e[t+5]]+"-"+Dm[e[t+6]]+Dm[e[t+7]]+"-"+Dm[e[t+8]]+Dm[e[t+9]]+"-"+Dm[e[t+10]]+Dm[e[t+11]]+Dm[e[t+12]]+Dm[e[t+13]]+Dm[e[t+14]]+Dm[e[t+15]]).toLowerCase();if(!Rm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let Fm,Gm;!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"}(Fm||(Fm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Gm||(Gm={}));const $m=["callback"],xm=["roles"],Vm=["callback"],jm=["callback","profileImage"],Bm=["callback"],Wm=["callback","userId"],Km=["callback"],Hm=["callback"],zm=["callback"],qm=["callback"],Ym=["callback"],Jm=["callback"],Qm=["callback"],Xm=["callback","profileImage"],Zm=["callback"],eA=["callback"],tA=["callback"],nA=["callback"],oA=["callback"],iA=["callback"],aA=()=>Mi((e=>e.auth.teamState));function*rA(){try{const{groups:e}=yield Ri(wf.groups.getGroups,{_groupsRelations:Gm.roles});return e}catch(e){return[]}}function*lA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.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 Ui([Ri(wf.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})),Ri(wf.teams.loadAvailableRoles),Ri(wf.teams.loadAvailablePermissions),Ri(rA)]),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 wi(Ro.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 wi(Ro.setTeamError({key:vm.USERS,value:Cp(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*sA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield aA(),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:vm.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 Ui([Ri(wf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.USERS,value:e.message})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*cA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.USERS,value:!r})),yield wi(Ro.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ui([Ri(wf.subTenants.loadAllUsers,U({},c)),Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.USERS,value:Cp(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*uA({payload:e}){yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ui([Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.ROLES_AND_PERMISSIONS,value:Cp(t)}))}yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0}))}function*dA({payload:e}){const{callback:t}=e,n=Ho(e,$m),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ri(wf.teams.addUser,n),{roles:a}=e,r=U({},Ho(e,xm),{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:U({},o.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*yA({payload:e}){const{callback:t}=e,n=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},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(wf.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*fA({payload:e}){const{callback:t}=e,n=Ho(e,Vm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Ri(wf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ri(wf.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:U({},o.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*pA({payload:e}){const{callback:t}=e,n=Ho(e,jm),{id:o}=n,i=yield aA(),a=i.users.find((e=>e.id===n.id));yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:o||""})),yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield wi(Ro.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 Ri(wf.teams.updateUser,n);null==t||t(e),yield wi(Ro.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 wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1}))}catch(e){yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Cp(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*gA({payload:e}){const{callback:t}=e,n=Ho(e,Bm),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(wf.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:U({},o.deleteUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*SA({payload:e}){const{callback:t,userId:n}=e,o=Ho(e,Wm),i=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Ri(wf.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 wi(Ro.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 wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*vA({payload:e}){const{callback:t}=e,n=Ho(e,Km),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(wf.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:U({},o.deleteUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*hA({payload:e}){const{callback:t}=e,n=Ho(e,Hm);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ri(wf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_ACTIVATE_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*mA({payload:e}){const{callback:t}=e,n=Ho(e,zm);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*AA({payload:e}){const{callback:t}=e,n=Ho(e,qm);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*bA({payload:e}){const{callback:t}=e,n=Ho(e,Ym);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*TA(){yield wi(Ro.setTeamError({key:vm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ri(wf.teams.getInviteLinkConfiguration);yield wi(Ro.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield wi(Ro.setTeamError({key:vm.CONFIG_TOKEN_LINK,value:Cp(e)}))}}function*kA(){yield wi(Ro.setTeamError({key:vm.GET_TOKEN_LINK,value:!1}));try{yield Ri(TA);const e=yield Ri(wf.teams.getInviteUserLink),{inviteTokenState:t}=yield aA();yield wi(Ro.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield wi(Ro.setTeamError({key:vm.GET_TOKEN_LINK,value:Cp(e)}))}}function*EA({payload:{callback:e}}){yield wi(Ro.setTeamError({key:vm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield aA();try{const n=yield Ri(wf.teams.createInviteUserLink,{expiresInMinutes:43200});yield wi(Ro.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:vm.CREATE_TOKEN_LINK,value:Cp(t)}))}}function*IA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield aA();yield wi(Ro.setTeamError({key:vm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ri(wf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield wi(Ro.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:vm.UPDATE_TOKEN_LINK,value:Cp(t)}))}}function*PA({payload:e}){const{callback:t}=null!=e?e:{};yield wi(Ro.setTeamError({key:vm.DELETE_TOKEN_LINK,value:!1}));try{yield Ri(wf.teams.deleteInviteUserLink),yield wi(Ro.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.DELETE_TOKEN_LINK,value:Cp(e)})),null==t||t(!1,e)}}function*LA({payload:e}){yield wi(Ro.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*OA({payload:e}){const t=yield aA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_A({payload:e}){yield wi(Ro.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*wA({payload:e}){const t=yield aA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*UA(){yield _a(Ro.loadUsers,sA),yield _a(Ro.loadUsersV2,lA),yield _a(Ro.loadAllSubTenantsUsers,cA),yield _a(Ro.loadRoles,uA),yield Oa(Ro.addUser,dA),yield Oa(Ro.addUsersBulk,yA),yield Oa(Ro.addUserToSubTenants,fA),yield Oa(Ro.updateUser,pA),yield Oa(Ro.setUserRolesForSubTenants,SA),yield Oa(Ro.deleteUser,gA),yield Oa(Ro.deleteUserFromSubTenants,vA),yield Oa(Ro.resendActivationLink,hA),yield Oa(Ro.resendInvitationLink,mA),yield Oa(Ro.resendInvitationEmail,AA),yield Oa(Ro.resendInvitationLinkToAllSubTenants,bA),yield Oa(Ro.getInvitationLink,kA),yield Oa(Ro.createInvitationLink,EA),yield Oa(Ro.updateInvitationLink,IA),yield Oa(Ro.deleteInvitationLink,PA),yield Oa(Ro.openAddUserDialog,LA),yield Oa(Ro.closeAddUserDialog,OA),yield Oa(Ro.openDeleteUserDialog,_A),yield Oa(Ro.closeDeleteUserDialog,wA)}function*CA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield aA(),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:vm.USERS,value:!a})),yield wi(Ro.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield At(),yield wi(Ro.setTeamState({users:vp,totalPages:2,totalItems:10,roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1})),null==r||r(vp)}function*RA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.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:hp,totalPages:2,totalItems:10,roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1})),null==l||l(hp)}function*DA({payload:e}){var t;yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0})),yield At(),yield wi(Ro.setTeamState({roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:dp,permissions:fp})}function*NA({payload:e}){const{callback:t}=e,n=Ho(e,Jm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield At();const i=U({},gp,{groups:[]},n,{id:`${Mm()}`});null==t||t(i),yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*MA({payload:e}){const{callback:t}=e,n=Ho(e,Qm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield At();const i=U({},gp,n,{id:`${Mm()}`});yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*FA({payload:e}){var t;const{callback:n}=e,o=Ho(e,Xm),{id:i}=o,a=yield aA(),r=a.users.find((e=>e.id===o.id));yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:i||""})),yield wi(Ro.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield wi(Ro.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 At();const l=U({},r,o);null==n||n(l),yield wi(Ro.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1}))}function*GA({payload:e}){const{callback:t}=e,n=Ho(e,Zm),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},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*$A({payload:e}){const{callback:t}=e,n=Ho(e,eA),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},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*xA({payload:e}){const{callback:t}=e,n=Ho(e,tA);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.userId})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*VA({payload:e}){const{callback:t}=e,n=Ho(e,nA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*jA({payload:e}){const{callback:t}=e,n=Ho(e,oA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*BA({payload:e}){const{callback:t}=e,n=Ho(e,iA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*WA(){yield _a(Ro.loadUsersV2,CA),yield _a(Ro.loadAllSubTenantsUsers,RA),yield _a(Ro.loadRoles,DA),yield Oa(Ro.addUser,NA),yield Oa(Ro.addUserToSubTenants,MA),yield Oa(Ro.updateUser,FA),yield Oa(Ro.deleteUser,GA),yield Oa(Ro.deleteUserFromSubTenants,$A),yield Oa(Ro.resendActivationLink,xA),yield Oa(Ro.resendInvitationLink,VA),yield Oa(Ro.resendInvitationEmail,jA),yield Oa(Ro.resendInvitationLinkToAllSubTenants,BA),yield Oa(Ro.openAddUserDialog,LA),yield Oa(Ro.closeAddUserDialog,OA),yield Oa(Ro.openDeleteUserDialog,_A),yield Oa(Ro.closeDeleteUserDialog,wA)}const KA=["authorizationUrl"],HA=["events","url"];function*zA(){try{yield wi(Ro.setSocialLoginsState({loading:!0}));const e=yield Ri(wf.auth.getSocialLoginProviders);yield wi(Ro.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({error:Cp(e),loading:!1,firstLoad:!1}))}}function*qA(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(wf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Ri(wf.auth.getSocialLoginProvidersV2),t}function*YA(){try{const e=yield Mi((e=>e.root.context));yield wi(Ro.setSocialLoginsState({loading:!0}));const t=yield Ri(qA),{providers:n}=yield Ri(wf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ho(t,KA);const i=vr(e,null!=n?n:"");return U({},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:Cp(e),loading:!1,firstLoad:!1}))}}function*JA(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,HA);try{yield wi(Ro.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ri(wf.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:_p.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(NS):yield Ri(FS)}(),localStorage.removeItem("register-quick-login"),yield wi(Ro.setSocialLoginsState({loading:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({loading:!1,error:Cp(e,"Failed to authenticate"),firstLoad:!1}))}}function*QA({payload:e}){yield wi(Ro.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*XA(){yield wa(Ro.loadSocialLoginsConfiguration,zA),yield wa(Ro.loadSocialLoginsConfigurationV2,YA),yield wa(Ro.loginViaSocialLogin,JA),yield _a(Ro.setSocialLoginError,QA)}let ZA;function*eb({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:ZA.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ri(wf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ri(wf.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:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield wi(Ro.setApiTokensError({key:ZA.ADD_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*tb({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:ZA.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ri(wf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ri(wf.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:ZA.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield wi(Ro.setApiTokensError({key:ZA.ADD_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*nb({payload:e}){const{apiTokensDataUser:t}=yield Mi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!0})),n?(yield Ri(wf.auth.deleteUserAccessToken,{id:e}),yield wi(Ro.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ri(wf.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:ZA.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:ZA.DELETE_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}}function*ob({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:ZA.DELETE_API_TOKEN,value:!0})),n?(yield Ri(wf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ri(wf.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:ZA.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:ZA.DELETE_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}}function*ib({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ui([Ri(wf.auth.getUserApiTokensData),Ri(wf.auth.getTenantApiTokensData)]);yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*ab({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(wf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ri(wf.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:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*rb({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(wf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ri(wf.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:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*lb(){yield wa(Ro.loadApiTokens,ib),yield wa(Ro.loadUserApiTokens,ab),yield wa(Ro.loadTenantApiTokens,rb),yield Oa(Ro.addUserApiToken,eb),yield Oa(Ro.addTenantApiToken,tb),yield _a(Ro.deleteTenantApiToken,ob),yield _a(Ro.deleteUserApiToken,nb)}function*sb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Mi((e=>e.auth.apiTokensState)),a=U({},Zf,{description:t,roleIds:n,clientId:`CLIENT_ID_${Mm()}`});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:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*cb({payload:e}){yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!0})),yield Fi(200);const t=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}function*ub({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Xf],o=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*db({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Xf];yield wi(Ro.setApiTokensState({apiTokensDataUser:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yb({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataTenant:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fb(){yield wa(Ro.loadApiTokens,ub),yield wa(Ro.loadUserApiTokens,db),yield wa(Ro.loadTenantApiTokens,yb),yield Oa(Ro.addTenantApiToken,sb),yield _a(Ro.deleteTenantApiToken,cb)}function*pb({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(wf.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield wi(Ro.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield wi(Ro.setAccountSettingsState({loading:!1,error:Cp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*gb({payload:e}){yield wi(Ro.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ri(wf.accountSettings.getSettings);yield wi(Ro.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield wi(Ro.setAccountSettingsState({loading:!1,error:Cp(e)}))}}function*Sb(){yield wa(Ro.saveAccountSettings,pb),yield wa(Ro.loadAccountSettings,gb)}function*vb({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=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield wi(Ro.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*hb({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*mb(){yield wa(Ro.saveAccountSettings,vb),yield wa(Ro.loadAccountSettings,hb)}function*Ab({payload:{tenantId:e,callback:t}}){yield wi(Ro.setState({isLoading:!0}));try{yield Ri(wf.tenants.switchTenant,{tenantId:e}),yield Ri(RS),(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*bb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*Tb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*kb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*Eb(){yield Oa(Ro.loadTenants,bb),yield Oa(Ro.loadSubTenants,Tb),yield Oa(Ro.switchTenant,Ab),yield Oa(Ro.loadSubTenantsTree,kb)}function*Ib(){yield wi(Ro.setTenantsState({loading:!0})),yield At(),yield wi(Ro.setTenantsState({tenants:mp,activeTenant:mp[0],loading:!1}))}function*Pb(){yield Oa(Ro.loadTenants,Ib)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(ZA||(ZA={}));const Lb=["callback"],Ob=["callback"],_b=["callback"],wb=["callback"],Ub=["callback"];function*Cb({payload:e}){var t;yield wi(Ro.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ui([Ri(wf.roles.getRoles),Ri(wf.roles.getPermissions),Ri(wf.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:Cp(e),loading:!1}))}}function*Rb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Lb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.roles.addRole,n),o=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Db(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ob);yield wi(Ro.setRolesState({saving:!0}));try{yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(!1,e)}}function*Nb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,_b);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Mb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,wb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Fb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ub);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Gb(){yield wa(Ro.loadRolesAndPermissions,Cb),yield Oa(Ro.addRole,Rb),yield Oa(Ro.deleteRole,Db),yield Oa(Ro.updateRole,Nb),yield Oa(Ro.attachPermissionsToRole,Mb),yield Oa(Ro.attachPermissionToRoles,Fb)}function*$b({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:ep,loading:!1}))}catch(e){yield wi(Ro.setRolesState({error:Cp(e),loading:!1}))}}function*xb(){yield wa(Ro.loadRolesAndPermissions,$b)}const Vb=["callback"],jb=["callback"],Bb=["callback"];function*Wb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Vb);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*Kb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,jb);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*Hb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Bb);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(wf.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:Cp(e)})),null==t||t(null,e)}}function*zb(){yield wa(Ro.resetPhoneNumber,Wb),yield wa(Ro.verifyResetPhoneNumber,Kb),yield wa(Ro.changePhoneNumber,Hb)}function*qb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCurrentUserSessions);yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Yb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCurrentUserSession);yield wi(Ro.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Jb({payload:{id:e}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.deleteSessionForUser,e),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Qb({payload:{callback:e,userId:t}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield wi(Ro.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Xb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.deleteAllSessionsForUser),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Zb(){yield _a(Ro.loadUserSessions,qb),yield _a(Ro.deleteUserSession,Jb),yield _a(Ro.deleteAllUserSessions,Xb),yield _a(Ro.loadCurrentUserSession,Yb),yield Oa(Ro.revokeUserSessions,Qb)}function*eT(){yield wi(Ro.setSessionsState({loading:!0,error:null})),yield wi(Ro.setSessionsState({sessions:Ap,loading:!1}))}function*tT({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*nT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));const e=Ap.filter((e=>e.current));yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}function*oT(){yield _a(Ro.loadUserSessions,eT),yield _a(Ro.deleteUserSession,tT),yield _a(Ro.deleteAllUserSessions,nT)}const iT=["callback"],aT=["callback"];function*rT(){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getSessionConfigurations);yield wi(Ro.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*lT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ho(e,iT);yield Ri(wf.auth.createOrUpdateSessionConfigrations,n),yield wi(Ro.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield wi(Ro.setSessionsPolicyState({error:e,loading:!1}))}}function*sT(){yield wa(Ro.loadSessionsPolicy,rT),yield _a(Ro.createOrUpdateSessionsPolicy,qp(lT))}function*cT(){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:bp}));yield wi(Ro.setSessionsPolicyState(U({},e,{loading:!1})))}function*uT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ho(e,aT);null==t||t(!0),yield wi(Ro.setSessionsPolicyState({configurations:n,loading:!1}))}function*dT(){yield wa(Ro.loadSessionsPolicy,cT),yield _a(Ro.createOrUpdateSessionsPolicy,uT)}const yT=["callback"],fT=["callback"],pT=["callback"],gT=["callback"],ST=["callback"],vT=["callback"],hT=["callback"],mT=["callback"],AT=()=>Mi((e=>e.auth.restrictionsState.ipRestrictions)),bT=()=>Mi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*TT(){yield wi(Ro.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getDomainRestrictionsConfig),t=(yield Ri(wf.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:Cp(e),loading:!1}))}}function*kT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,yT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield bT();try{var i;yield Ri(wf.auth.createDomainRestriction,n);const e=(yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*ET(e){let{payload:{callback:t}}=e,n=Ho(e.payload,fT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.updateDomainRestrictionConfig,n),o=(yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*IT({payload:{id:e}}){yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield bT();try{var n;yield Ri(wf.auth.deleteDomainRestriction,e);const o=(yield Ri(wf.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:Cp(e)}))}}const PT=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*LT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield AT(),t=yield Ri(wf.auth.getIPRestrictionsConfig),n=PT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ri(wf.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:Cp(e),loading:!1}))}}function*OT(){try{const{valid:e}=yield Ri(wf.auth.testCurrentIpInAllowList);yield wi(Ro.setIpRestrictionsState({userIpValid:e}))}catch(e){yield wi(Ro.setIpRestrictionsState({error:Cp(e)}))}}function*_T({payload:{callback:e}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Mi((e=>e.auth.userIp));yield Ui([Ri(wf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Vn.ALLOW}),Ri(wf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield AT(),o=PT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ri(wf.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*wT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,pT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield AT();try{var i,a;yield Ri(wf.auth.createIPRestriction,n);const e=yield AT(),r=PT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ri(wf.auth.getIPRestrictions,r);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*UT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,gT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{yield Ri(wf.auth.updateIPRestrictionConfig,n);const e=yield AT(),o=yield Ri(wf.auth.getIPRestrictionsConfig),i=PT(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ri(wf.auth.getIPRestrictions,i);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*CT({payload:{id:e,callback:t}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const n=yield AT();try{var o;yield Ri(wf.auth.deleteIPRestriction,e);const i=yield AT(),a=PT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ri(wf.auth.getIPRestrictions,a);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*RT(){yield wa(Ro.loadIpRestrictions,qp(LT)),yield wa(Ro.loadEmailDomainRestrictions,qp(TT)),yield Oa(Ro.saveIpRestriction,qp(wT)),yield Oa(Ro.saveIpRestrictionsConfig,qp(UT)),yield Oa(Ro.deleteIpRestriction,qp(CT)),yield Oa(Ro.checkIfUserIpValid,qp(OT)),yield Oa(Ro.addCurrentUserIpAndActivate,qp(_T)),yield Oa(Ro.saveEmailDomainRestriction,qp(kT)),yield Oa(Ro.saveEmailDomainRestrictionsConfig,qp(ET)),yield Oa(Ro.deleteEmailDomainRestriction,qp(IT))}function*DT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null})),yield wi(Ro.setIpRestrictionsState({data:{restrictions:kp.filter((e=>e.strategy===Tp.strategy)),config:Tp},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*NT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield AT(),t=kp[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:Cp(e),loading:!1}))}}function*MT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,ST);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const r=yield AT(),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,U({},a,{createdAt:new Date,updatedAt:new Date,id:Mm(),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*FT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,vT);const r=yield AT();yield wi(Ro.setIpRestrictionsState({saving:!0,error:null})),yield wi(Ro.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:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield wi(Ro.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*GT({payload:{id:e,callback:t}}){var n;yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield AT();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*$T(){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*xT(e){var t,n;let{payload:{callback:o}}=e,i=Ho(e.payload,hT);const a=yield bT();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)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*VT(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,mT);const i=yield bT();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*jT({payload:{id:e}}){var t,n;const o=yield bT();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*BT(){yield wa(Ro.loadIpRestrictions,DT),yield wa(Ro.loadEmailDomainRestrictions,$T),yield Oa(Ro.saveIpRestriction,MT),yield Oa(Ro.saveIpRestrictionsConfig,FT),yield Oa(Ro.deleteIpRestriction,GT),yield Oa(Ro.checkIfUserIpValid,NT),yield Oa(Ro.saveEmailDomainRestriction,xT),yield Oa(Ro.saveEmailDomainRestrictionsConfig,VT),yield Oa(Ro.deleteEmailDomainRestriction,jT)}const WT=["callback"],KT=["id"];function*HT(e){const{count:t}=yield Ri(wf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*zT(){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(wf.directory.getConfigs),t=yield Ui(e.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:t,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*qT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,WT);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(wf.directory.createConfiguration,n),o=yield Ri(wf.directory.getConfigs),i=yield Ui(o.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*YT(e){let{payload:{id:t}}=e,n=Ho(e.payload,KT);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(wf.directory.updateConfiguration,t,n);const e=yield Ri(wf.directory.getConfigs),o=yield Ui(e.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*JT({payload:{id:e,callback:t}}){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(wf.directory.deleteConfiguration,e);const n=yield Ri(wf.directory.getConfigs),o=yield Ui(n.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1})),null==t||t(!1,e)}}function*QT(){yield wa(Ro.loadProvisionConnections,zT),yield Oa(Ro.createProvisionConnection,qT),yield Oa(Ro.deleteProvisionConnection,JT),yield Oa(Ro.updateProvisionConnection,YT)}const XT=["callback","events"];function*ZT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,XT);yield wi(Ro.setImpersonateState({loading:!0}));try{yield Ri(wf.impersonate.impersonate,n),yield wi(Ro.setImpersonateState({step:Lo.success})),yield Fi(1e3),yield OS(),yield wi(Ro.resetImpersonateState()),null==t||t(!0)}catch(e){yield wi(Ro.setImpersonateState({loading:!1,error:Cp(e)}))}}function*ek(){yield wa(Ro.impersonate,ZT)}function*tk({payload:e}){const{callback:t,deviceId:n}=e;yield wi(Ro.setPasskeysState({loading:!0}));try{yield Ri(wf.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:Cp(e,null)})),null==t||t(null,e)}}function*nk(){yield wi(Ro.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ri(wf.auth.getWebAuthnDevices);yield wi(Ro.setPasskeysState({devices:e,loading:!1}))}catch(e){yield wi(Ro.setPasskeysState({loading:!1,error:Cp(e,null)}))}}function*ok(){yield Oa(Ro.loadWebAuthnDevices,nk),yield Oa(Ro.deleteWebAuthnDevice,tk)}const ik=["roleIds","userIds"],ak=()=>Mi((e=>e.auth.groupsState));function*rk({payload:e}){const t=Fm.GET_TEAM_USERS;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*lk({payload:e}){const t=Fm.GET_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ri(wf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Gm.rolesAndUsers});yield wi(Ro.setGroupsState({selectedGroup:n}))}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*sk(){const e=Fm.GET_GROUPS,t=yield ak();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ri(wf.groups.getGroups,{_groupsRelations:Gm.rolesAndUsers});yield wi(Ro.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 wi(Ro.setUsersGroupsError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*ck({payload:e}){const t=Fm.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ho(e,ik);yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ri(wf.groups.createGroup,U({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:Cp(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=Fm.UPDATE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=Fm.DELETE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=Fm.ADD_ROLES_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=Fm.DELETE_ROLES_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(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=Fm.ADD_USERS_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=Fm.DELETE_USERS_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk(){const e=Fm.GET_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ri(wf.groups.getGroupConfiguration);yield wi(Ro.setGroupsState({groupsConfiguration:t}))}catch(t){yield wi(Ro.setUsersGroupsError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*vk({payload:e}){const t=Fm.UPDATE_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{yield Ri(wf.groups.updateGroupConfiguration,e),yield wi(Ro.getGroupConfiguration())}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){yield _a(Ro.loadGroups,sk),yield _a(Ro.getGroupById,lk),yield _a(Ro.createGroup,ck),yield _a(Ro.updateGroup,uk),yield _a(Ro.deleteGroup,dk),yield _a(Ro.addRolesToGroup,yk),yield _a(Ro.deleteRolesFromGroup,fk),yield _a(Ro.addUsersToGroup,pk),yield _a(Ro.deleteUsersFromGroup,gk),yield _a(Ro.getGroupConfiguration,Sk),yield _a(Ro.updateGroupConfiguration,vk),yield _a(Ro.getTeamUsers,rk)}function*mk(){const e=Fm.GET_GROUPS;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));const t=Pp;yield wi(Ro.setGroupsState({groups:t})),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Ak({payload:e}){var t;const n=Fm.CREATE_GROUP,{groups:o}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:n,value:!0})),yield wi(Ro.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Ef.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*bk({payload:e}){var t,n,o,i,a;const r=Fm.UPDATE_GROUP,l=yield ak();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?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Ef.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 Fi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:r,value:!1}))}function*Tk({payload:e}){var t,n;const o=Fm.DELETE_GROUP,i=yield ak();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*kk({payload:e}){var t,n;const o=Fm.ADD_ROLES_TO_GROUP,i=yield ak();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?U({},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*Ek({payload:e}){var t,n;const o=Fm.DELETE_ROLES_FROM_GROUP,i=yield ak();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?U({},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*Ik({payload:e}){var t,n;const o=Fm.ADD_USERS_TO_GROUP,i=yield ak();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?U({},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*Pk({payload:e}){var t,n;const o=Fm.DELETE_USERS_FROM_GROUP,i=yield ak();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?U({},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*Lk(){const e=Fm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0})),t&&(yield wi(Ro.setGroupsState({groupsConfiguration:U({},t)}))),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Ok({payload:e}){const t=Fm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:t,value:!0})),n&&(yield wi(Ro.setGroupsState({groupsConfiguration:U({},n,e)}))),yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}function*_k(){yield _a(Ro.loadGroups,mk),yield _a(Ro.createGroup,Ak),yield _a(Ro.updateGroup,bk),yield _a(Ro.deleteGroup,Tk),yield _a(Ro.addRolesToGroup,kk),yield _a(Ro.deleteRolesFromGroup,Ek),yield _a(Ro.addUsersToGroup,Ik),yield _a(Ro.deleteUsersFromGroup,Pk),yield _a(Ro.getGroupConfiguration,Lk),yield _a(Ro.updateGroupConfiguration,Ok)}let wk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(wk||(wk={}));const Uk=(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=>Uk(e,t,n))))?o:[]})};function Ck(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Ck(e,t))):[]})}function Rk(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=>Rk(e,t,n))))?o:[]})}const Dk=({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}})),Nk=()=>Mi((e=>e.auth.allAccountsState));function*Mk({payload:e}){const t=wk.GET_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Nk(),{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 Nk(),{items:n,_links:i}=yield Ri(wf.tenants.searchSubTenants,r,{jwt:o}),a=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=Dk({items:n},a),c=Rk(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 Nk(),{items:n,_links:o}=yield Ri(wf.tenants.searchSubTenants,r),i=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Dk({items:n},i),l=Rk(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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=wk.SEARCH_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield Nk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=wk.GET_USER_JWT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ri(wf.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:Cp(e)})),yield wi(Ro.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=wk.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 Nk(),{selectedAccount:t}=yield Nk(),r=yield Ri(wf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=Rk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=Rk(U({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 Nk(),t=yield Ri(wf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=Rk(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:Cp(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=wk.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 Nk();yield Ri(wf.subTenants.deleteSubTenant,o,{jwt:n});const i=Ck(t,o),a=Ck(null==e?void 0:e.accounts,o);yield wi(Ro.setAllAccountsState({accounts:i})),yield wi(Ro.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield Nk();yield Ri(wf.subTenants.deleteSubTenant,o);const t=Ck(e,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=wk.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 Nk();yield Ri(wf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Uk(e.accounts,a,o);yield wi(Ro.setSelectedAccountState({name:o,accounts:i}));const r=Uk(t,a,o);yield wi(Ro.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Nk();yield Ri(wf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Uk(e,a,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=wk.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(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=wk.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 Nk();try{yield Ri(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=wk.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(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Nk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ri(wf.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?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){var t,n,o,i,a,r,l,s;const c=wk.GET_ACCOUNT_USERS;yield wi(Ro.setAllAccountsLoader({key:c,value:!0}));const u=yield Nk(),{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 Ri(wf.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 Ri(wf.roles.getRoles),i=yield Ri(wf.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 wi(Ro.setSelectedAccountState(U({users:a},o)))}else yield wi(Ro.setSelectedAccountState(U({users:[]},o)))}catch(e){yield wi(Ro.setAllAccountsError({key:c,value:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:c,value:!1}))}}function*zk({payload:e}){const t=wk.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(wf.accountSettings.getSettings,{jwt:n}),u=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ri(wf.tenants.getParentTenants,{jwt:n}),y=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=wk.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(wf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield wi(Ro.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Yk(){yield _a(Ro.loadAccounts,Mk),yield _a(Ro.searchAccounts,Fk),yield _a(Ro.updateSubAccountAccessForUser,Kk),yield _a(Ro.getUserJwtForSubAccount,Gk),yield _a(Ro.createSubAccount,$k),yield _a(Ro.deleteSubAccount,xk),yield _a(Ro.updateSubAccountSettings,Vk),yield _a(Ro.addUsersToAccount,Wk),yield _a(Ro.deleteUsersFromAccount,jk),yield _a(Ro.setUserRolesForSubAccount,Bk),yield _a(Ro.getAccountUsers,Hk),yield _a(Ro.setSelectedSubAccountData,zk),yield _a(Ro.loadNumberOfUsersForSelectedSubAccount,qk)}var Jk={sagas:function*(){yield Ui([Ri(Ov),Ri(Pm),Ri(Om),Ri(Sm),Ri(zb),Ri(Wv),Ri(hh),Ri(Eh),Ri(Hp),Ri(nm),Ri(UA),Ri(hk),Ri(XA),Ri(Hg),Ri(lb),Ri(Og),Ri(Sb),Ri(Eb),Ri(Gb),Ri(Zb),Ri(sT),Ri(RT),Ri(QT),Ri(ek),Ri(ok),Ri(Yk),Ri(iS),Ri(ng)])},mockSagas:function*(){yield Ui([Ri(Uv),Ri(Qv),Ri(Oh),Ri(dm),Ri(WA),Ri(fb),Ri(Vg),Ri(oT),Ri(mb),Ri(Pb),Ri(dT),Ri(BT),Ri(xb),Ri(_k),Ri(ag)])},storeName:wt,initialState:Po,reducer:Uo,actions:Ro};const Qk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),Xk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Zk={setAuditLogsState:Qk("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:Xk})},eE={exportAuditsCsv:ct("auditLogs/exportAuditsCsv"),loadAuditLogs:ct("auditLogs/loadAuditLogs",(e=>({payload:e})))},tE={loading:!0},nE={setAuditsMetadataState:Qk("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:tE})},oE={loadAuditsMetadata:ct("auditLogs/loadAuditsMetadata")},iE={auditLogsState:Xk,auditsMetadataState:tE},{reducer:aE,actions:rE}=dt({name:Ct,initialState:iE,reducers:U({resetState:e=>U({},e,iE),setState:(e,{payload:t})=>U({},e,t)},Zk,nE)}),lE=U({},rE,eE,oE),sE=e=>"createdAt"!==e.id,cE={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`})))},uE={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}]},dE=()=>Mi((e=>e.auditLogs.auditLogsState)),yE=()=>Mi((e=>e.auditLogs.auditsMetadataState));function*fE(){const e=yield dE(),{columns:t}=yield yE();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 wi(lE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield wf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield wi(lE.setAuditLogsState({isDownloadingCsv:!1}))}function*pE({payload:e}){yield wi(lE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield dE(),{columns:n}=yield yE();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(lE.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 wi(lE.loadAuditsMetadata()));const{data:p,total:g}=yield Ri(wf.audits.getAudits,U({offset:c,count:s},y,f));yield wi(lE.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(lE.setAuditLogsState({loading:!1,error:Cp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*gE(){yield Oa(lE.exportAuditsCsv,fE),yield Oa(lE.loadAuditLogs,pE)}function*SE({payload:e}){yield wi(lE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield dE(),{columns:n}=yield yE();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(lE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield wi(lE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=cE;let o=n.filter((e=>t=>e.filter(sE).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(lE.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(lE.setAuditLogsState({loading:!1,error:Cp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*vE(){yield Oa(lE.loadAuditLogs,SE)}function*hE(){yield wi(lE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ri(wf.metadata.getAuditsMetadata);yield wi(lE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(lE.setAuditsMetadataState({error:e,loading:!1}))}}function*mE(){yield Oa(lE.loadAuditsMetadata,hE)}function*AE(){yield wi(lE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=uE;yield wi(lE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(lE.setAuditsMetadataState({error:e,loading:!1}))}}function*bE(){yield Oa(lE.loadAuditsMetadata,AE)}var TE={sagas:function*(){yield Ui([Ri(gE),Ri(mE)])},mockSagas:function*(){yield Ui([Ri(vE),Ri(bE)])},storeName:Ct,initialState:iE,reducer:aE,actions:lE};const kE={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:EE,actions:IE,reducer:PE}=dt({name:"audits",initialState:kE,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]})))}}}),LE=U({},IE,{initData:ct(`${EE}/initData`),loadAudits:ct(`${EE}/loadAudits`),removeFilter:ct(`${EE}/removeFilter`),filterData:ct(`${EE}/filterData`),exportCSV:ct(`${EE}/exportCSV`),deleteAudits:ct(`${EE}/deleteAudits`)}),OE=()=>Mi((e=>e[EE]));function*_E(){const{sortBy:e,sortDirection:t}=yield OE();try{const n=yield Ri(wf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield wi(LE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield wi(LE.loadItemFailedAction(t))}}function*wE(){try{const e=yield Ri(wf.metadata.getAuditsMetadata);yield wi(LE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield wi(LE.loadItemFailedAction(t))}}const UE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*CE({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield OE(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield OE():{rowsData:[]};try{const e=UE(t),{data:l,total:d}=yield Ri(wf.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 wi(LE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield wi(LE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield wi(LE.loadItemFailedAction(t))}}function*RE(){yield wi(LE.startLoading()),yield Ui([_E(),wE(),CE({payload:{onlyOneLoad:!1},type:""})]),yield wi(LE.finishLoading())}function*DE({payload:e}){const{filters:t}=yield OE(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield wi(LE.setFilterData(o))}function*NE({payload:e}){const{filters:t}=yield OE();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(LE.setFilterData(o))}function*ME(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield OE(),a=UE(e);yield wi(LE.startDownloadingCsv());try{yield wf.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 wi(LE.stopDownloadingCsv())}}function*FE(){yield _a(LE.initData,RE),yield _a(LE.removeFilter,DE),yield _a(LE.filterData,NE),yield _a([LE.loadAudits,LE.textSearch,LE.onPageChange],CE),yield _a([LE.setFilterData,LE.setDataSorting,LE.startRefresh],(()=>CE({payload:{appendMode:!1},type:""}))),yield _a(LE.exportCSV,ME)}const GE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},$E={initData:()=>U({},GE),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)})}},xE={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}})))},VE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:jE,actions:BE}=dt({name:Ut,initialState:VE,reducers:U({},$E)}),WE=U({},BE,xE),KE={slack:wf.connectivity.getSlackConfiguration,email:wf.connectivity.getEmailConfiguration,sms:wf.connectivity.getSMSConfiguration,webhook:wf.connectivity.getWebhooksConfigurations,categories:wf.connectivity.getCategories,channelMap:wf.connectivity.getChannelMaps},HE={slack:wf.connectivity.postSlackConfiguration,email:wf.connectivity.postEmailConfiguration,sms:wf.connectivity.postSMSConfiguration,webhook:wf.connectivity.postWebhooksConfiguration},zE=["email","slack","sms","webhook"],qE={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"}},YE=["id"],JE=["id","enabled"],QE=["categories","channelMap"];function*XE(e){return yield Ri(eI,{payload:{api:e},type:""})}function*ZE({payload:e=zE}){yield wi(WE.setConnectivityState({isLoading:!0}));try{const t=yield Ui([...e.map(XE),yield eI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ui(e.map((function*(e){return yield eI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield eI({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:qE[e[i]].events(o),active:qE[e[i]].isActive(o),platform:qE[e[i]].title,image:qE[e[i]].image}]}):n:U({},n,{[`${QE[i-e.length]}`]:o})),{list:[],webhook:n});yield wi(WE.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield wi(WE.setConnectivityState({isLoading:!1}))}}function*eI({payload:{api:e,params:t}}){try{return yield Ri(KE[e],t)}catch(e){return}}function*tI(){try{yield wi(WE.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ri(wf.connectivity.getSlackChannels);yield wi(WE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield wi(WE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*nI(e,t){const{connectivity:{list:n}}=yield Mi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=qE[e].isActive(t);i!==o.active&&(yield wi(WE.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*oI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Mi((e=>e.connectivity));try{if(yield wi(WE.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 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=Ho(e,YE);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 Ri(HE.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ri(wf.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 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 Ri("email"===t?wf.connectivity.postEmailConfiguration:wf.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,JE);return yield Ui([yield Ri("email"===t?wf.connectivity.patchEmailConfiguration:wf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ri("email"===t?wf.connectivity.putEmailSubscriptions:wf.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 Ri("email"===t?wf.connectivity.deleteEmailSubscriptions:wf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield eI({payload:{api:t},type:""});yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield nI(t,e)}else yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ri(HE[e],t),!["sms","email"].includes(e)){const i=yield eI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield nI(e,i),null==n||n(!0)}}catch(e){yield wi(WE.setConnectivityState({error:Cp(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*iI({payload:e}){try{yield wf.connectivity.postSlackCode(e)}catch{}yield wi(WE.setConnectivityState({error:void 0,isSaving:!1}))}function*aI(){const{slackChannels:e}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ri(wf.connectivity.getSlackScope);yield wi(WE.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield wi(WE.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*rI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({isSaving:!0})),yield Ri(wf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Cp(e))}const i=yield eI({payload:{api:"webhook"},type:""});i&&(yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*lI({payload:e}){try{yield wi(WE.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ri(wf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*sI({payload:e}){try{const{statusCode:t}=yield Ri(wf.connectivity.postWebhookRetry,e);yield wi(WE.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield wi(WE.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*cI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Ri(wf.connectivity.getWebhookLog,e,n,t);yield wi(WE.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield wi(WE.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var uI={sagas:function*(){yield Oa(WE.loadDataAction,ZE),yield _a(WE.loadSlackActions,tI),yield Oa(WE.postDataAction,oI),yield Oa(WE.postCodeAction,iI),yield Oa(WE.loadScope,aI),yield Oa(WE.deleteWebhookConfigAction,rI),yield Oa(WE.postWebhookTestAction,lI),yield Oa(WE.postWebhookRetryAction,sI),yield _a(WE.loadWebhookLogsAction,cI)},storeName:Ut,initialState:VE,reducer:jE,actions:WE};function dI(){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 yI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function fI(e){return yI(e,((e,t)=>U({},e,{loading:t.payload})))}function pI(e){return yI(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const gI={loading:!1,error:null,fetching:!0,plans:[]},{actions:SI,reducer:vI,name:hI}=dt({name:"subscriptions/plans",initialState:gI,reducers:U({},dI())}),mI=U({loadPlans:ct(`${hI}/loadPlans`)},SI),AI={loading:!1,error:null,fetching:!0,config:null},bI=U({},dI()),{actions:TI,reducer:kI,name:EI}=dt({name:"subscriptions/config",initialState:AI,reducers:bI}),II=U({loadPaymentConfiguration:ct(`${EI}/loadPaymentConfiguration`)},TI),PI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},LI=U({},dI(),{setCancellationLoading:fI("cancellation"),setCancellationError:pI("cancellation"),setRenewalLoading:fI("renewal"),setRenewalError:pI("renewal")}),{reducer:OI,actions:_I,name:wI}=dt({name:"subscriptions/billing/subscription",initialState:PI,reducers:LI}),UI=U({load:ct(`${wI}/loadSubscription`),cancelSubscription:ct(`${wI}/cancelSubscription`),renewSubscription:ct(`${wI}/renewSubscription`)},_I),CI={loading:!1,error:null,fetching:!0},RI=U({},dI()),{reducer:DI,actions:NI,name:MI}=dt({name:"subscriptions/billing/information",initialState:CI,reducers:RI}),FI=U({loadBillingInformation:ct(`${MI}/loadBillingInformation`),cancelSubscription:UI.cancelSubscription,renewSubscription:UI.renewSubscription},NI),GI={loading:!1,error:null,fetching:!0},$I=U({},dI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:xI,actions:VI,name:jI}=dt({name:"subscriptions/billing/payment",initialState:GI,reducers:$I}),BI=U({loadPaymentMethod:ct(`${jI}/loadPaymentMethod`),submitPaymentMethod:ct(`${jI}/submitPaymentMethod`),submitPaymentMethodError:ct(`${jI}/submitPaymentMethodError`),submitPaymentMethodSuccess:ct(`${jI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ct(`${jI}/updateBillingDetails`,(e=>({payload:e})))},VI),WI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},KI=U({},dI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:HI,actions:zI,name:qI}=dt({name:"subscriptions/billing/invoices",initialState:WI,reducers:KI}),YI=U({loadInvoices:ct(`${qI}/loadInvoices`),downloadInvoice:ct(`${qI}/downloadInvoice`,(e=>({payload:e})))},zI),JI={information:CI,invoices:WI,paymentMethod:GI,subscription:PI},QI={invoices:YI,information:FI,paymentMethod:BI,subscription:UI},XI=Be({invoices:HI,information:DI,paymentMethod:xI,subscription:OI}),ZI={fetching:!0,loading:!1,error:null,confirmed:!1},eP=U({},dI()),{actions:tP,reducer:nP,name:oP}=dt({name:"subscriptions/checkout",initialState:ZI,reducers:eP}),iP=U({loadCheckout:ct(`${oP}/loadCheckout`),resetCheckout:ct(`${oP}/resetCheckout`),submitCheckout:ct(`${oP}/submitCheckout`),confirmCheckout:ct(`${oP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ct(`${oP}/errorCheckout`,(e=>({payload:e})))},tP),aP={loading:!1,error:null,cardSetupIntentSecret:null},rP=U({},dI()),{reducer:lP,actions:sP,name:cP}=dt({name:"subscriptions/stripe",initialState:aP,reducers:rP}),uP=U({loadCustomer:ct(`${cP}/loadCustomer`),createCardSetupIntentSecret:ct(`${cP}/createCardSetupIntentSecret`)},sP),dP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:yP,reducer:fP,name:pP}=dt({name:"subscriptions/vendorPublicConfig",initialState:dP,reducers:U({},dI())}),gP=U({loadVendorPublicConfiguration:ct(`${pP}/loadVendorPublicConfiguration`)},yP),SP={config:AI,plans:gI,checkout:ZI,billing:JI,stripe:aP,vendorPublicConfig:dP},vP={config:II,billing:QI,plans:mI,checkout:iP,stripe:uP,vendorPublicConfig:gP},hP=Be({config:kI,billing:XI,plans:vI,checkout:nP,stripe:lP,vendorPublicConfig:fP});let mP,AP,bP;function TP({policy:e}){return{policy:bP.AT_PERIOD_END}}function kP(e){switch(e){case Ly.ACTIVE:return AP.ACTIVE;case Ly.INCOMPLETE:return AP.INCOMPLETE;case Ly.CANCELED:return AP.CANCELED;case Ly.EXPIRED:return AP.EXPIRED;case Ly.TRIALING:return AP.TRIALING;default:return AP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(mP||(mP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(AP||(AP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bP||(bP={}));const EP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Ly.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},IP=[{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"}],PP=[{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:""}],LP=[{id:"id",externalId:"externalId",type:Oy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],OP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*_P(){yield Oa(UI.load,wP),yield Oa(UI.cancelSubscription,CP),yield Oa(UI.renewSubscription,RP)}function*wP(){const e=yield Mi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield GP(e)}function*UP(){yield wi(UI.setLoading(!0));try{const[e]=yield Ri(wf.subscriptions.getManagedSubscriptions);yield wi(UI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield wi(UI.setError(e))}}function*CP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(UI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(UI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Ly.ACTIVE)try{yield wi(UI.setCancellationLoading(!0)),yield Ri(wf.subscriptions.cancelManagedSubscription,t),yield UP(),yield wi(UI.setCancellationLoading(!1))}catch(e){yield wi(UI.setCancellationError(Cp(e)))}}function*RP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(UI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(UI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===_y.AT_PERIOD_END)try{yield wi(UI.setRenewalLoading(!0)),yield Ri(wf.subscriptions.renewManagedSubscription,t),yield UP(),yield wi(UI.setRenewalLoading(!1))}catch(e){yield wi(UI.setCancellationError(Cp(e)))}}function*DP(){yield wi(UI.setLoading(!0)),yield Fi(500),yield wi(UI.setState({subscription:EP,fetching:!1,loading:!1,error:null}))}function*NP(){yield Oa(UI.load,DP)}function*MP(){yield Oa(FI.loadBillingInformation,FP)}function*FP(){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 GP(n,!1):yield wi(FI.setError(t?"Not authorized":"Internal feature failure"))}()}function*GP(e,t){yield wi(FI.setLoading(!0));try{var n,o;const i=yield Ri(wf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ri(wf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ui([Ri(UP),Ri(wf.subscriptions.getSubscriptionPlan,a)]),s=yield Mi((e=>e.subscriptions.billing.subscription.subscription||null))),yield wi(FI.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?AP.ACTIVE:kP(s.status),cancellation:s.cancellation&&TP(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(FI.setError(Cp(e)))}}function*$P(){yield function*(){var e,t;yield wi(FI.setLoading(!0)),yield Fi(500),yield wi(FI.setState({loading:!1,fetching:!1,summary:{subscriptionId:EP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:wy.Stripe,externallyManaged:!1,currentPlanId:IP[0].id,defaultPlanId:IP[0].id},plan:U({},IP[0],{price:null==(e=IP[0].price)?void 0:e.amount,currency:null==(t=IP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*xP(){yield Oa(FI.loadBillingInformation,$P)}function*VP(){yield Oa(BI.loadPaymentMethod,jP),yield Oa(BI.submitPaymentMethod,WP),yield Oa(BI.submitPaymentMethodError,KP),yield Oa(BI.submitPaymentMethodSuccess,HP),yield Oa(BI.updatePaymentMethodBillingDetails,BP)}function*jP(){yield wi(BI.setLoading(!0));try{const e=(yield Ri(wf.subscriptions.getPaymentMethods))[0];yield wi(BI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield wi(BI.setError(Cp(e)))}}function*BP({payload:e}){yield wi(BI.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ri(wf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Ri(jP),null==i||i(!0)}catch(e){yield wi(BI.setError(Cp(e))),null==i||i(!1)}yield wi(BI.setLoading(!1))}function*WP(){yield wi(BI.setLoading(!0))}function*KP({payload:e}){yield wi(BI.setError(e))}function*HP(){yield wi(BI.loadPaymentMethod())}function*zP(){yield wi(BI.setLoading(!0)),yield Fi(500);const e=LP[0];yield wi(BI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*qP(){yield Oa(BI.loadPaymentMethod,zP)}function*YP(){yield Oa(YI.loadInvoices,JP),yield Oa(YI.downloadInvoice,QP)}function*JP(){yield wi(YI.setLoading(!0));try{const e=(yield Ri(wf.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(YI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield wi(YI.setError(Cp(e)))}}function*QP({payload:e}){yield wi(YI.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ri(wf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield wi(YI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield wi(YI.setInvoiceDownloadState({loading:!1,error:Cp(e,null)}))}}function*XP(){yield wi(YI.setLoading(!0)),yield Fi(500),yield wi(YI.setState({loading:!1,fetching:!1,invoices:PP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield wi(YI.setLoading(!1))}function*ZP(){yield Oa(YI.loadInvoices,XP)}function*eL(){yield Ui([Ri(MP),Ri(VP),Ri(YP),Ri(_P)])}function*tL(){yield Ui([Ri(xP),Ri(qP),Ri(ZP),Ri(NP)])}function*nL(){yield Oa(iP.loadCheckout,oL),yield Oa(iP.resetCheckout,iL),yield Oa(iP.submitCheckout,aL),yield Oa(iP.confirmCheckout,rL),yield Oa(iP.errorCheckout,sL)}function*oL(){yield wi(iP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*iL(){yield wi(iP.setState({loading:!1,error:null,confirmed:!1}))}function*aL(){yield wi(iP.setState({loading:!0,error:null}))}function*rL({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)===Ly.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield wi(iP.setState({loading:!0,error:null})),i&&a)return yield lL(),void(yield wi(UI.setState({subscription:U({},n,{status:Ly.ACTIVE})})));try{yield Ri(wf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ui([FP(),jP(),JP()]),yield lL()}catch(e){yield wi(iP.setState({loading:!1,error:Cp(e)}))}}else yield wi(iP.setState({loading:!1,error:"Subscription not found"}))}function*lL(){yield wi(iP.setState({loading:!1,error:null,confirmed:!0}))}function*sL({payload:e}){yield wi(iP.setState({loading:!1,error:e}))}function*cL(){yield Oa(iP.resetCheckout,iL)}function*uL(){yield Oa(mI.loadPlans,dL)}function*dL(){yield wi(mI.setLoading(!0));try{const e=(yield Ri(wf.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(mI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield wi(mI.setError(Cp(e)))}}function*yL(){yield wi(mI.setLoading(!0)),yield Fi(500),yield wi(mI.setState({fetching:!1,loading:!1,plans:IP.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*fL(){yield Oa(mI.loadPlans,yL)}function*pL(){yield Oa(II.loadPaymentConfiguration,gL)}function*gL(){yield wi(II.setLoading(!0));try{(yield Ri(wf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===wy.Stripe))?yield function*(){yield wi(II.setLoading(!0));try{const e=yield Ri(wf.subscriptions.getStripePaymentProviderConfiguration);yield wi(II.setState({loading:!1,fetching:!1,config:{paymentProvider:mP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield wi(II.setError(Cp(e)))}}():yield wi(II.setError("Payment provider not configured"))}catch(e){yield wi(II.setError(Cp(e)))}}function*SL(){yield wi(II.setLoading(!0)),yield Fi(500),yield wi(II.setState({loading:!1,fetching:!1,config:{paymentProvider:mP.STRIPE,apiKey:""}}))}function*vL(){yield Oa(II.loadPaymentConfiguration,SL)}function*hL(){yield Oa(uP.createCardSetupIntentSecret,mL)}function*mL({payload:e}){yield wi(uP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ri(wf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield wi(uP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield wi(uP.setError(Cp(e)))}}function*AL(){yield Oa(gP.loadVendorPublicConfiguration,bL)}function*bL(){yield wi(gP.setLoading(!0));try{const e=yield Ri(wf.subscriptions.getVendorPublicConfigurations);yield wi(gP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield wi(gP.setError(Cp(e)))}}function*TL(){yield wi(gP.setLoading(!0)),yield Fi(500),yield wi(gP.setState({fetching:!1,loading:!1,vendorPublicConfig:OP}))}function*kL(){yield Oa(gP.loadVendorPublicConfiguration,TL)}var EL={sagas:function*(){yield Ui([Ri(eL),Ri(nL),Ri(uL),Ri(pL),Ri(hL),Ri(AL)])},mockSagas:function*(){yield Ui([Ri(tL),Ri(cL),Ri(fL),Ri(vL),Ri(kL)])},reducer:hP,actions:vP,initialState:SP,storeName:"subscriptions"},IL={sagas:function*(){yield Oa(Xg.loadVendorPublicInfo,Zg)},storeName:Rt,initialState:Yg,reducer:Jg,actions:Xg};const{reducer:PL}=dt({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}))}}}),LL=(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=ma(),l=[...lt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:l,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[Jk.storeName]:U({},Jk.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},Jk.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[TE.storeName]:U({},TE.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},TE.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},TE.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[EE]:U({},kE,null!=(h=null==i?void 0:i.audits)?h:{}),[uI.storeName]:uI.initialState,[EL.storeName]:EL.initialState,[IL.storeName]:IL.initialState},reducer:Be({root:PL,[Jk.storeName]:Jk.reducer,[TE.storeName]:TE.reducer,[EE]:PE,[uI.storeName]:uI.reducer,[EL.storeName]:EL.reducer,[IL.storeName]:IL.reducer})});const m=function*(){yield Ui([Ri(Jk.sagas),Ri(TE.sagas),Ri(FE),Ri(uI.sagas),Ri(EL.sagas),Ri(IL.sagas)])},A=function*(){yield Ui([Ri(Jk.mockSagas),Ri(TE.mockSagas),Ri(EL.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},OL=(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 _L=n(714),wL=n.n(_L);function UL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function CL(e){if(e.type)return e;if("#"===e.charAt(0))return CL(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 RL(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 DL(e){if(0===e.indexOf("#"))return e;const{values:t}=CL(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 NL(e,t){return e=CL(e),t=UL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,RL(e)}function ML(e,t){if(e=CL(e),t=UL(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 RL(e)}function FL(e,t){if(e=CL(e),t=UL(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 RL(e)}const GL=e=>{if(e)return{main:e,light:DL(FL(e,.4)),dark:DL(ML(e,.15)),hover:DL(ML(e,.15)),active:DL(ML(e,.2))}},$L=e=>{if(e)return{main:e,light:FL(e,.7),dark:ML(e,.2)}},xL=(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({},GL(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({},GL(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({},GL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},$L(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},$L(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},$L(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},$L(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},VL={},jL={},BL={},WL={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 KL{constructor(){this._theme=VL,this._themeV2=jL,this._navigation=WL,this._localizations=BL}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new KL;return n.set(e),KL._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=WL)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=wL().all([null!=(o=VL)?o:{},xL(null==e?void 0:e.theme,VL)]),this._themeV2=wL().all([null!=(i=jL)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=wL().all([null!=(r=BL)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=WL,this._theme=VL,this._themeV2=jL,this._localizations=BL}}}KL._instances={};var HL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},zL=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},qL=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)}))},YL=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 JL,QL,XL,ZL,eO,tO,nO,oO,iO,aO,rO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(JL||(JL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(QL||(QL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(XL||(XL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(ZL||(ZL={})),function(e){e.Invoices="invoices"}(eO||(eO={})),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"}(nO||(nO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(oO||(oO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(iO||(iO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(aO||(aO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(rO||(rO={}));const lO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},sO={hidden:"hidden",edit:"edit"};var cO="6.136.0",uO={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","admin-portal-new-security-center-page":"off"},dO=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(cO),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:KL.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}Ll.set(uO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Ol();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Ll.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){Ll.set(U({},uO,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=HL(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=LL({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),Ua.setAppName(l)}var t,n,o,i;return _(e,[{key:"setEntitlementsOptions",value:function(e){Ua.setEntitlementsOptions(U({},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;KL.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 Ua.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(),YL(t),Ua.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,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 OL(null==e||null==(n=e.features)?void 0:n[t],El.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return OL(null==e||null==(n=e.permissions)?void 0:n[t],El.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}(),yO=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?(Ua.setAccessToken(t),Ua.setUser(U({},n,{accessToken:t})),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Ro.loadTenants())):(Ua.setAccessToken(null),Ua.setUser(null),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),fO=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}(),pO=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}(),gO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},SO=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=LL({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 dO(this.options,t,!0),KL.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,qL(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}(),vO="modern",hO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[vO]},mO=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=LL({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 dO(this.options,t,!0,a),KL.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,qL(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 AO(e,t){return AO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},AO(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&&AO(e,t)}function TO(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 kO(e){return kO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kO(e)}function EO(){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 IO(e,t,n){return IO=EO()?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&&AO(i,n.prototype),i},IO.apply(null,arguments)}function PO(e){var t="function"==typeof Map?new Map:void 0;return PO=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 IO(e,arguments,kO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),AO(n,e)},PO(e)}function LO(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=kO(e);if(t){var i=kO(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return TO(this,n)}}var OO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new dO(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=LO(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=zL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=zL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=zL(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=zL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=zL(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=zL(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}(PO(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 fO},AdminPortalRenderer:function(){return SO},AppHolder:function(){return w},CheckoutDialog:function(){return pO},FronteggApp:function(){return dO},HostedLogin:function(){return yO},LoginBoxRenderer:function(){return mO},createElement:function(){return zL},defaultTheme:function(){return vO},formatName:function(){return HL},getThemeAdminByName:function(){return gO},getThemeByName:function(){return hO},initialize:function(){return OO},mockFlagsList:function(){return uO},restoreSearchParams:function(){return YL},waitThemeSetter:function(){return qL}});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 Ur},getParentTenantsById:function(){return Cr},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 gl},getCurrentUserTenantsV3:function(){return Al},getUsersGroups:function(){return ml},getUsersRoles:function(){return hl},getUsersV2:function(){return Sl},getUsersV3:function(){return vl},sendResetBreachedPasswordEmails:function(){return bl},updateUserProfileV2:function(){return Tl}});var a={};n.r(a),n.d(a,{loadEntitlements:function(){return kl}});var r={};n.r(r),n.d(r,{FeatureFlags:function(){return Ll},loadFeatureFlags:function(){return Ol}});var l={};n.r(l),n.d(l,{AuthStrategyEnum:function(){return To},MachineToMachineAuthStrategy:function(){return ko},OAuthLogout:function(){return os},SocialLoginProviders:function(){return bo},acceptInvitation:function(){return Xl},activateAccount:function(){return zl},activateAccountV2:function(){return ql},bulkCreateIPRestriction:function(){return nl},changePhoneNumber:function(){return ru},changePhoneNumberWithVerification:function(){return iu},checkIfAllowToRememberMfaDevice:function(){return Oc},createDomainRestriction:function(){return Jr},createIPRestriction:function(){return tl},createOrUpdateSessionConfigrations:function(){return yc},createSSOConfiguration:function(){return Dc},createSSOConfigurationByMetadata:function(){return Fc},createSSOConfigurationByMetadataUrl:function(){return $c},createSSODomain:function(){return Vc},createSSOGroup:function(){return Hc},createSamlGroup:function(){return Js},createTenantAccessToken:function(){return Ac},createUserAccessToken:function(){return mc},deleteAllSessionsForUser:function(){return pc},deleteDomainRestriction:function(){return Xr},deleteIPRestriction:function(){return il},deleteSSOConfiguration:function(){return Mc},deleteSSODomain:function(){return jc},deleteSSOGroup:function(){return qc},deleteSamlGroup:function(){return Xs},deleteSessionForUser:function(){return fc},deleteTenantAccessToken:function(){return vc},deleteTenantApiToken:function(){return Ic},deleteUserAccessToken:function(){return hc},deleteUserApiToken:function(){return Pc},deleteWebAuthnDevice:function(){return yu},disableMFAAuthenticatorApp:function(){return vs},disableMFASMS:function(){return ms},disableMFAWebAuthn:function(){return bs},disableMfa:function(){return Ss},enrollMFAAuthenticatorApp:function(){return us},enrollMFAAuthenticatorAppForLogin:function(){return Es},enrollMFAAuthenticatorAppForLoginV2:function(){return Is},enrollMFASMS:function(){return ys},enrollMFASMSForLogin:function(){return Us},enrollMFASMSForLoginV2:function(){return Cs},enrollMFAWebAuthn:function(){return ps},enrollMFAWebAuthnForLogin:function(){return Fs},enrollMFAWebAuthnForLoginV2:function(){return Gs},enrollMfa:function(){return ss},exchangeOAuthTokens:function(){return eu},exchangeOAuthTokensV2:function(){return Xc},forgotPassword:function(){return is},generateLoginResponse:function(){return Cl},generateLoginResponseFromOAuthResponse:function(){return Fl},generateLoginResponseFromOAuthResponseV2:function(){return Gl},generateLoginResponseV2:function(){return Rl},generateLoginResponseV3:function(){return Ml},getActivateAccountStrategy:function(){return Yl},getCaptchaPolicy:function(){return Br},getCurrentUserSession:function(){return cc},getCurrentUserSessions:function(){return sc},getCustomSocialLoginProvidersV1:function(){return ic},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 Ts},getMFAStrategiesConfig:function(){return Su},getMeAndEntitlements:function(){return mu},getMeV2:function(){return hu},getMfaPolicy:function(){return Fr},getOidcConfiguration:function(){return Zs},getPasswordConfigPolicy:function(){return zr},getPasswordHistoryPolicy:function(){return Wr},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return gu},getSSOConfigurations:function(){return Rc},getSSODefaultRoles:function(){return Wc},getSSOGroups:function(){return Yc},getSSOPublicConfiguration:function(){return ec},getSamlConfiguration:function(){return js},getSamlRoles:function(){return zs},getSamlRolesGroups:function(){return qs},getSamlVendorConfiguration:function(){return Ws},getSessionConfigurations:function(){return dc},getSocialLoginProviders:function(){return tc},getSocialLoginProvidersV2:function(){return nc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return oc},getTenantAccessTokensData:function(){return Sc},getTenantApiTokensData:function(){return Tc},getUserAccessTokensData:function(){return gc},getUserApiTokensData:function(){return bc},getUserAuthorization:function(){return vu},getUserById:function(){return Lc},getVendorConfig:function(){return rc},getVendorLockoutPolicy:function(){return Vr},getVendorMfaPolicy:function(){return Gr},getVendorPasswordHistoryPolicy:function(){return Kr},getVendorPublicAuthStrategiesConfig:function(){return pu},getWebAuthnDevices:function(){return du},loadPasswordConfig:function(){return rs},login:function(){return Bl},loginViaSocialLogin:function(){return ac},loginWithMfa:function(){return Kl},loginWithMfaV2:function(){return Hl},loginv2:function(){return Wl},logout:function(){return ns},oidcPostLogin:function(){return jl},oidcPostLoginV2:function(){return Qc},passwordlessPostLogin:function(){return Uc},passwordlessPostLoginV2:function(){return wc},passwordlessPreLogin:function(){return _c},postLogin:function(){return Vl},preDisableMFASMS:function(){return hs},preDisableMFAWebAuthn:function(){return As},preEnrollMFAAuthenticatorApp:function(){return cs},preEnrollMFAAuthenticatorAppForLogin:function(){return ks},preEnrollMFASMS:function(){return ds},preEnrollMFASMSForLogin:function(){return ws},preEnrollMFAWebAuthn:function(){return fs},preEnrollMFAWebAuthnForLogin:function(){return Ms},preLogin:function(){return $l},preLoginV2:function(){return Jc},preLoginWithIdpType:function(){return xl},preVerifyMFAEmailCode:function(){return Ls},preVerifyMFASMSForLogin:function(){return Rs},preVerifyMFAWebAuthnForLogin:function(){return $s},recoverMfaToken:function(){return ls},refreshToken:function(){return Zl},refreshTokenV2:function(){return es},refreshTokenV3:function(){return ts},resendActivationEmail:function(){return Jl},resendInvitationEmail:function(){return Ql},resetPassword:function(){return as},resetPhoneNumber:function(){return nu},revokeSessionsForUser:function(){return uc},saveLockoutPolicy:function(){return jr},saveMfaPolicy:function(){return $r},savePasswordHistoryPolicy:function(){return Hr},setSSODefaultRoles:function(){return Kc},signUpUser:function(){return lc},silentOAuthRefreshToken:function(){return tu},silentOAuthRefreshTokenV2:function(){return Zc},testCurrentIp:function(){return al},testCurrentIpInAllowList:function(){return rl},updateDomainRestrictionConfig:function(){return Qr},updateIPRestrictionConfig:function(){return ol},updateSSOConfiguration:function(){return Nc},updateSSOConfigurationByMetadata:function(){return Gc},updateSSOConfigurationByMetadataUrl:function(){return xc},updateSSOGroup:function(){return zc},updateSamlConfiguration:function(){return Bs},updateSamlGroup:function(){return Qs},updateSamlRoles:function(){return Ys},updateSamlVendorMetadata:function(){return Ks},updateTenantApiTokensData:function(){return Ec},updateUserApiTokensData:function(){return kc},validateSSODomain:function(){return Bc},validateSamlDomain:function(){return Hs},verifyChangePhoneNumber:function(){return au},verifyInviteToken:function(){return Cc},verifyMFAAuthenticatorAppForLogin:function(){return Ps},verifyMFAEmailCode:function(){return Os},verifyMFAEmailCodeV2:function(){return _s},verifyMFASMSForLogin:function(){return Ds},verifyMFASMSForLoginV2:function(){return Ns},verifyMFAWebAuthnForLogin:function(){return xs},verifyMFAWebAuthnForLoginV2:function(){return Vs},verifyMfa:function(){return gs},verifyNewDeviceSession:function(){return fu},verifyResetPhoneNumber:function(){return ou},webAuthnCreateNewDeviceSession:function(){return uu},webAuthnPostLogin:function(){return su},webAuthnPostLoginV2:function(){return cu},webAuthnPreLogin:function(){return lu}});var s={};n.r(s),n.d(s,{addUser:function(){return Iu},changePassword:function(){return ku},createInviteUserLink:function(){return Ou},deleteInviteUserLink:function(){return wu},deleteUser:function(){return Pu},getInviteLinkConfiguration:function(){return Cu},getInviteUserLink:function(){return Uu},getProfile:function(){return Au},loadAvailablePermissions:function(){return Du},loadAvailableRoles:function(){return Ru},loadStats:function(){return Nu},loadUsers:function(){return Eu},resendActivationLink:function(){return Mu},resendInvitationLink:function(){return Fu},resendInvitationLinkToAllTenants:function(){return Gu},updateInviteUserLink:function(){return _u},updateProfile:function(){return bu},updateProfileImage:function(){return Tu},updateUser:function(){return Lu}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return xu},getAuditsMetadata:function(){return Ku},getCurrentUserIpMetadata:function(){return ju},getIpAdressMetadata:function(){return Hu},getNotificationsMetadata:function(){return Bu},getSamlMetadata:function(){return Wu},updateAdminBoxMetadata:function(){return Vu}});var u={};n.r(u),n.d(u,{downloadReport:function(){return ed},getReport:function(){return Qu},getReports:function(){return Ju},renderReport:function(){return Xu},scheduleReport:function(){return Zu},sendReport:function(){return td}});var d={};n.r(d),n.d(d,{getNotifications:function(){return nd},markAllAsRead:function(){return ad},updateNotificationIsPinned:function(){return id},updateNotificationStatus:function(){return od}});var y={};n.r(y),n.d(y,{exportAudits:function(){return cd},getAudits:function(){return ld},getAuditsStats:function(){return sd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return kd},deleteEmailSubscriptions:function(){return bd},deleteSMSConfiguration:function(){return _d},deleteSMSSubscriptions:function(){return Ld},deleteSlackConfiguration:function(){return Sd},deleteWebhooksConfiguration:function(){return Cd},getCategories:function(){return Md},getChannelMaps:function(){return Fd},getEmailConfiguration:function(){return hd},getSMSConfiguration:function(){return Ed},getSlackChannels:function(){return pd},getSlackConfiguration:function(){return yd},getSlackScope:function(){return fd},getWebhookLog:function(){return Rd},getWebhooksConfigurations:function(){return wd},patchEmailConfiguration:function(){return Ad},patchSMSConfiguration:function(){return Pd},postEmailConfiguration:function(){return md},postSMSConfiguration:function(){return Id},postSlackCode:function(){return vd},postSlackConfiguration:function(){return gd},postWebhookRetry:function(){return Nd},postWebhookTest:function(){return Dd},postWebhooksConfiguration:function(){return Ud},putEmailSubscriptions:function(){return Td},putSMSSubscriptions:function(){return Od}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return xd},getSettings:function(){return $d},updateSettings:function(){return Gd}});var g={};n.r(g),n.d(g,{addRole:function(){return Kd},attachPermissionToRoles:function(){return Jd},attachPermissionsToRole:function(){return qd},deleteRole:function(){return Hd},getPermissionCategories:function(){return Qd},getPermissions:function(){return Yd},getRoles:function(){return Wd},updateRole:function(){return zd}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return _y},ISubscriptionStatus:function(){return Ly},PaymentMethodType:function(){return Oy},ProviderType:function(){return wy},TenantCreatedAction:function(){return Cy},TrialEndAction:function(){return Uy},cancelManagedSubscription:function(){return ay},cancelSubscription:function(){return ey},createStripeCustomer:function(){return my},createStripePaymentMethodSetupIntentSecret:function(){return by},createSubscription:function(){return vy},createTenantConfiguration:function(){return Ey},getManagedSubscription:function(){return oy},getManagedSubscriptions:function(){return iy},getPaymentMethod:function(){return gy},getPaymentMethods:function(){return py},getPaymentProviders:function(){return Iy},getStripeCustomer:function(){return hy},getStripePaymentProviderConfiguration:function(){return Ay},getSubscription:function(){return Zd},getSubscriptionInvoice:function(){return dy},getSubscriptionInvoicePdf:function(){return yy},getSubscriptionInvoices:function(){return uy},getSubscriptionPlan:function(){return cy},getSubscriptionPlans:function(){return sy},getSubscriptionSummaries:function(){return Ty},getSubscriptions:function(){return Xd},getTenantConfiguration:function(){return ky},getVendorPublicConfigurations:function(){return Py},renewManagedSubscription:function(){return ry},renewSubscription:function(){return ty},updateManagedSubscription:function(){return ly},updatePaymentMethodBillingDetails:function(){return Sy},updateSubscription:function(){return ny}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return Ry}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return Fy},addUserToTenantAndSubTenants:function(){return Ny},addUsersToSubTenant:function(){return Wy},createSubTenant:function(){return xy},deleteSubTenant:function(){return Vy},loadAllUsers:function(){return Dy},removeUserFromTenantAndSubTenants:function(){return My},removeUserRolesFromSubTenants:function(){return Gy},setUserRolesForSubTenants:function(){return $y},updateSubAccountAccess:function(){return By},updateSubTenant:function(){return jy}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Yy},createConfiguration:function(){return zy},deleteConfiguration:function(){return qy},getConfigs:function(){return Ky},updateConfiguration:function(){return Hy}});var A={};n.r(A),n.d(A,{impersonate:function(){return Jy}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return af},addUsersToGroup:function(){return lf},createGroup:function(){return tf},deleteGroup:function(){return of},deleteRolesFromGroup:function(){return rf},deleteUsersFromGroup:function(){return sf},getGroupById:function(){return Xy},getGroupConfiguration:function(){return cf},getGroups:function(){return Zy},getGroupsByIds:function(){return ef},updateGroup:function(){return nf},updateGroupConfiguration:function(){return uf}});var T={};n.r(T),n.d(T,{getInsights:function(){return yf},getRecommendations:function(){return df}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return Il},AuthStrategyEnum:function(){return To},ContextHolder:function(){return Ua},FeatureFlags:function(){return Ll},FronteggApiError:function(){return Ra},FronteggContext:function(){return Ca},FronteggFrameworks:function(){return lo},GetUsersFilterPreset:function(){return uo},GroupManagedByEnum:function(){return Ef},GroupRelations:function(){return kf},ISubscriptionCancellationPolicy:function(){return _y},ISubscriptionStatus:function(){return Ly},InsightCode:function(){return Pf},LOAD_AUTHORIZATION_FF:function(){return pl},MFAStrategyEnum:function(){return fl},MachineToMachineAuthStrategy:function(){return ko},NotEntitledJustification:function(){return El},PaginationOrderEnum:function(){return so},PaymentMethodType:function(){return Oy},ProviderType:function(){return wy},RecommendationActionKey:function(){return Lf},RecommendationCode:function(){return If},RecommendationSeverity:function(){return Of},RequestSource:function(){return ro},RestrictionType:function(){return Vn},ScimConnectionSource:function(){return Tf},SecondaryAuthStrategy:function(){return dl},SecurityCategory:function(){return _f},SocialLoginProviders:function(){return bo},SortByEnum:function(){return co},TenantSortByEnum:function(){return pf},TenantType:function(){return gf},UserManagedByEnum:function(){return ff},WebAuthnDeviceType:function(){return yl},api:function(){return wf},countConfigurationUsers:function(){return Yy},createConfiguration:function(){return zy},default:function(){return Uf},deleteConfiguration:function(){return qy},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Sf},fronteggHeaders:function(){return ao},fronteggRefreshTokenUrl:function(){return vf},fronteggSilentRefreshTokenUrl:function(){return hf},fronteggTenantsUrl:function(){return Af},fronteggTenantsV3Url:function(){return bf},fronteggUsersUrl:function(){return mf},getConfigs:function(){return Ky},loadFeatureFlags:function(){return Ol},providersArray:function(){return yo},updateConfiguration:function(){return Hy}});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 rO},AccountPageFields:function(){return ZL},DomainRestrictionsTabFields:function(){return aO},GeneralSettingsTabFields:function(){return oO},InviteUserModalFields:function(){return XL},IpRestrictionsTabFields:function(){return iO},Metadata:function(){return KL},PrivacyPageFields:function(){return QL},ProfilePageFields:function(){return JL},SecurityPageTabs:function(){return tO},SessionManagementTabFields:function(){return nO},SubscriptionsPageFields:function(){return eO},alpha:function(){return NL},fieldAppearance:function(){return lO},tabAppearance:function(){return sO}});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 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 C(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){C(a,o,i,r,l,"next",e)}function l(e){C(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var D=n(841),N=n.n(D);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function F(e){return!!e&&!!e[ke]}function G(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Ee}(e)||Array.isArray(e)||!!e[Te]||!!e.constructor[Te]||W(e)||K(e))}function $(e,t,n){void 0===n&&(n=!1),0===x(e)?(n?Object.keys:Ie)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function x(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:K(e)?3:0}function V(e,t){return 2===x(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function j(e,t,n){var o=x(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function B(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return he&&e instanceof Map}function K(e){return me&&e instanceof Set}function H(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Pe(e);delete t[ke];for(var n=Ie(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||F(e)||!G(e)||(x(e)>1&&(e.set=e.add=e.clear=e.delete=Y),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function Y(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Q(e){var t=Le[e];return t||M(18,e),t}function X(){return Se}function Z(e,t){t&&(Q("Patches"),e.u=[],e.s=[],e.v=t)}function ee(e){te(e),e.p.forEach(oe),e.p=null}function te(e){e===Se&&(Se=e.l)}function ne(e){return Se={p:[],l:Se,h:e,m:!0,_:0}}function oe(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Q("ES5").S(t,e,o),o?(n[ke].P&&(ee(t),M(4)),G(e)&&(e=ae(t,e),t.l||le(t,e)),t.u&&Q("Patches").M(n[ke].t,e,t.u,t.s)):e=ae(t,n,[]),ee(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function ae(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return $(t,(function(i,a){return re(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return le(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;$(3===o.i?new Set(i):i,(function(t,a){return re(e,o,i,t,a,n)})),le(e,i,!1),n&&e.u&&Q("Patches").R(o,n,e.u,e.s)}return o.o}function re(e,t,n,o,i,a){if(F(i)){var r=ae(e,i,a&&t&&3!==t.i&&!V(t.D,o)?a.concat(o):void 0);if(j(n,o,r),!F(r))return;e.m=!1}if(G(i)&&!J(i)){if(!e.h.F&&e._<1)return;ae(e,i),t&&t.A.l||le(e,i)}}function le(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?H(n):e)[t]}function ce(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function ue(e){e.P||(e.P=!0,e.l&&ue(e.l))}function de(e){e.o||(e.o=z(e.t))}function ye(e,t,n){var o=W(t)?Q("MapSet").N(t,n):K(t)?Q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:X(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Oe;n&&(i=[o],a=_e);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Q("ES5").J(t,n);return(n?n.A:X()).p.push(o),o}function fe(e){return F(e)||M(22,e),function e(t){if(!G(t))return t;var n,o=t[ke],i=x(t);if(o){if(!o.P&&(o.i<4||!Q("ES5").K(o)))return o.t;o.I=!0,n=pe(t,i),o.I=!1}else n=pe(t,i);return $(n,(function(t,i){o&&function(e,t){return 2===x(e)?e.get(t):e[t]}(o.t,t)===i||j(n,t,e(i))})),3===i?new Set(n):n}(e)}function pe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,Se,ve="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),he="undefined"!=typeof Map,me="undefined"!=typeof Set,Ae="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=ve?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Te=ve?Symbol.for("immer-draftable"):"__$immer_draftable",ke=ve?Symbol.for("immer-state"):"__$immer_state",Ee=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Pe=Object.getOwnPropertyDescriptors||function(e){var t={};return Ie(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Oe={get:function(e,t){if(t===ke)return e;var n=H(e);if(!V(n,t))return function(e,t,n){var o,i=ce(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!G(o)?o:o===se(e.t,t)?(de(e),e.o[t]=ye(e.A.h,o,e)):o},has:function(e,t){return t in H(e)},ownKeys:function(e){return Reflect.ownKeys(H(e))},set:function(e,t,n){var o=ce(H(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=se(H(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(B(n,i)&&(void 0!==n||V(e.t,t)))return!0;de(e),ue(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==se(e.t,t)||t in e.t?(e.D[t]=!1,de(e),ue(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=H(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},_e={};$(Oe,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Oe.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=Ae,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==o&&"function"!=typeof o&&M(7),G(e)){var l=ne(t),s=ye(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?ee(l):te(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Z(l,o),ie(e,l)}),(function(e){throw ee(l),e})):(Z(l,o),ie(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Q("Patches").M(e,r,u,d),o(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){G(e)||M(8),F(e)&&(e=fe(e));var t=ne(this),n=ye(this,e,void 0);return n[ke].C=!0,te(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return Z(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ae&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Q("Patches").$;return F(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new we,Ce=Ue.produce,Re=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Ce);function De(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ne(Object(n),!0).forEach((function(t){De(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ne(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Fe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ge="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},xe={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function Ve(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function je(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Fe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Fe(1));return n(je)(e,t)}if("function"!=typeof e)throw new Error(Fe(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Fe(3));return a}function d(e){if("function"!=typeof e)throw new Error(Fe(4));if(s)throw new Error(Fe(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Fe(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Ve(e))throw new Error(Fe(7));if(void 0===e.type)throw new Error(Fe(8));if(s)throw new Error(Fe(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Fe(10));i=e,y({type:xe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Fe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ge]=function(){return this},e}return y({type:xe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ge]=p,o}function Be(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:xe.INIT}))throw new Error(Fe(12));if(void 0===n(void 0,{type:xe.PROBE_UNKNOWN_ACTION()}))throw new Error(Fe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Fe(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Ke(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),o=function(){throw new Error(Fe(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:o})}}}function He(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var ze=He();ze.withExtraArgument=He;var qe,Ye=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Qe=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Xe=Object.defineProperty,Ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),et=Object.prototype.hasOwnProperty,tt=Object.prototype.propertyIsEnumerable,nt=function(e,t,n){return t in e?Xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},ot=function(e,t){for(var n in t||(t={}))et.call(t,n)&&nt(e,n,t[n]);if(Ze)for(var o=0,i=Ze(t);o<i.length;o++)n=i[o],tt.call(t,n)&&nt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var at=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,Qe([void 0],e.concat(this))))},t}(Array);function rt(e){return G(e)?Re(e,(function(){})):e}function lt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new at);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(Ye):o.push(Ye.withExtraArgument(n.extraArgument))),o}function st(e){var t,n=function(e){return lt(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Be(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Ke.apply(void 0,p),S=We;c&&(S=it(ot({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Qe([g],f):"function"==typeof f&&(v=f(v)),je(t,d,S.apply(void 0,v))}function ct(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return ot(ot({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ut(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function dt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:rt(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ut(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=ot(ot({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ut(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return rt(e())};else{var c=rt(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Qe([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(F(e))return void 0===(o=n(e,t))?e:o;if(G(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?ct(c,o):ct(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var yt="listenerMiddleware";ct(yt+"/add"),ct(yt+"/removeAll"),ct(yt+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Oe.get(t,e)},set:function(t){var n=this[ke];Oe.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ue(i);break;case 4:n(i)&&ue(i)}}}function n(e){for(var t=e.t,n=e.k,o=Ie(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!V(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!B(l,r))return!0}}var c=!!t[ke];return o.length!==Ie(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Pe(n);delete a[ke];for(var r=Ie(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:X(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?F(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)$(a,(function(t){t!==ke&&(void 0!==i[t]||V(i,t)?r[t]||e(a[t]):(r[t]=!0,ue(n)))})),$(i,(function(e){void 0!==a[e]||V(a,e)||(r[e]=!1,ue(n))}));else if(5===l){if(o(n)&&(ue(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const ft=(e,t)=>n=>U({},n,{[e]:t[e]}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),gt=(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)})})}}),St=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})})})}}),vt=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})})})}}),ht=(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)})})}}),mt=(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)})})},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",Ut="connectivity",Ct="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 jt={step:Vt.validate},Bt={setAcceptInvitationState:pt("acceptInvitationState"),resetAcceptInvitationState:ft("acceptInvitationState",{acceptInvitationState:jt})},Wt={acceptInvitation:ct("auth/acceptInvitation",(e=>({payload:e})))};let Kt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Kt||(Kt={}));const Ht={step:Kt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:pt("forgotPasswordState"),resetForgotPasswordState:ft("forgotPasswordState",{forgotPasswordState:Ht})},qt={forgotPassword:ct("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ct("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ct("auth/loadPasswordConfig",(e=>({payload:e})))};let Yt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Yt||(Yt={}));const Jt={step:Yt.ResetPhoneNumber,loading:!1},Qt={setResetPhoneNumberState:pt("resetPhoneNumberState"),resetResetPhoneNumberState:ft("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Xt={resetPhoneNumber:ct("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ct("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ct("auth/changePhoneNumber",(e=>({payload:e})))},Zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},en={setSSOLoader:St("ssoState"),setSSOError:vt("ssoState"),setSSOState:pt("ssoState"),resetSSOState:ft("ssoState",{ssoState:Zt})},tn={loadSSOConfigurationsV2:ct("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ct("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ct("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ct("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ct("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ct("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ct("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ct("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ct("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ct("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ct("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ct("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ct("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ct("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ct("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ct("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ct("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ct("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ct("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ct("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ct("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ct("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ct("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ct("auth/oidcPostlogin",(e=>({payload:e})))},nn={loading:!1,error:null},on={setProfileState:pt("profileState"),resetProfileState:ft("profileState",{profileState:nn})},an={loadProfile:ct("auth/loadProfile"),saveProfile:ct("auth/saveProfile",(e=>({payload:e}))),changePassword:ct("auth/changePassword",(e=>({payload:e})))};let rn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode"}(rn||(rn={}));const ln={step:rn.verify,loading:!1,saving:!1},sn={setMfaState:pt("mfaState"),resetMfaState:ft("mfaState",{mfaState:ln})},cn={enrollMfa:ct("auth/enrollMfa"),getMFADevices:ct("auth/getMFADevices"),getMFAStrategies:ct("auth/getMFAStrategies"),verifyMfa:ct("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ct("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ct("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ct("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ct("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ct("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ct("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ct("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ct("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ct("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ct("auth/disableMfaWebAuthn",(e=>({payload:e})))},un={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},dn={setTeamLoader:St("teamState"),setTeamError:vt("teamState"),setTeamState:pt("teamState"),resetTeamState:ft("teamState",{teamState:un})},yn={loadUsersV2:ct("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ct("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ct("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ct("auth/loadRoles",(e=>({payload:e}))),addUser:ct("auth/addUser",(e=>({payload:e}))),addUsersBulk:ct("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ct("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ct("auth/updateUser",(e=>({payload:e}))),deleteUser:ct("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ct("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ct("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ct("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ct("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ct("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ct("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ct("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ct("auth/getInvitationLink"),createInvitationLink:ct("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ct("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ct("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ct("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ct("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ct("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ct("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ct("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ct("auth/closeLockUserDialog",(e=>({payload:e})))},fn={firstLoad:!0,loading:!1,error:""},pn={setSocialLoginsState:pt("socialLoginState"),resetSocialLoginsState:ft("socialLoginState",{socialLoginState:fn})},gn={loadSocialLoginsConfiguration:ct("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ct("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ct("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ct("auth/setSocialLoginError",(e=>({payload:e})))};let Sn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(Sn||(Sn={}));const vn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:Sn.SignUp},hn={setSignUpState:pt("signUpState"),resetSignUpState:ft("signUpState",{signUpState:vn})},mn={signUpUser:ct("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ct("auth/resetSignUpStateSoft")},An={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:St("apiTokensState"),setApiTokensError:vt("apiTokensState"),setApiTokensState:pt("apiTokensState"),resetApiTokensState:ft("apiTokensState",{apiTokensState:An})},Tn={loadApiTokens:ct("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ct("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ct("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ct("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ct("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ct("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ct("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ct("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},En={setSecurityPolicyState:pt("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ft("securityPolicyState",{securityPolicyState:kn})},In={loadSecurityPolicy:ct("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ct("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ct("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ct("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ct("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ct("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ct("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ct("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ct("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ct("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ct("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ct("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ct("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ct("auth/loadPublicAuthStrategiesPolicy")},Pn={loading:!1},Ln={setAccountSettingsState:pt("accountSettingsState"),resetAccountSettingsState:ft("accountSettingsState",{accountSettingsState:Pn})},On={loadAccountSettings:ct("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ct("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:pt("tenantsState"),resetTenantsState:ft("tenantsState",{tenantsState:_n})},Un={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})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:pt("rolesState"),resetRolesState:ft("rolesState",{rolesState:Cn})},Dn={loadRolesAndPermissions:ct("auth/loadRoles",(e=>({payload:e}))),addRole:ct("auth/addRole",(e=>({payload:e}))),updateRole:ct("auth/updateRole",(e=>({payload:e}))),deleteRole:ct("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ct("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ct("auth/attachPermissionToRoles",(e=>({payload:e})))},Nn={loading:!1,sessions:[]},Mn={setSessionsState:pt("sessionsState"),resetSessionsState:ft("sessionsState",{sessionsState:Nn})},Fn={loadUserSessions:ct("auth/loadUserSessions"),loadCurrentUserSession:ct("auth/loadCurrentUserSession"),deleteUserSession:ct("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ct("auth/deleteAllUserSessions"),revokeUserSessions:ct("auth/revokeUserSessions",(e=>({payload:e})))},Gn={loading:!1,configurations:{}},$n={setSessionsPolicyState:pt("sessionsPolicyState"),resetSessionsPolicyState:ft("sessionsPolicyState",{sessionsPolicyState:Gn})},xn={loadSessionsPolicy:ct("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ct("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Vn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Vn||(Vn={}));const jn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Vn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Bn={setRestrictionsState:pt("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:ct("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ct("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ct("auth/loadIpRestrictions"),saveIpRestriction:ct("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ct("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ct("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ct("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ct("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ct("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ct("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Kn={loading:!1},Hn={setProvisioningState:pt("provisioningState"),resetProvisioningState:ft("provisioningState",{provisioningState:Kn})},zn={loadProvisionConnections:ct("auth/loadProvisionConnections"),createProvisionConnection:ct("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ct("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ct("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Yn={setPasskeysState:pt("passkeysState"),resetPasskeysState:ft("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:ct("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ct("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Qn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Xn={setUsersGroupsLoader:St("groupsState"),setUsersGroupsError:vt("groupsState"),setGroupsState:pt("groupsState"),resetUsersGroupsState:ft("groupsState",{groupsState:Qn})},Zn={loadGroups:ct("auth/loadUsersGroups"),getGroupById:ct("auth/getGroupById",(e=>({payload:e}))),createGroup:ct("auth/createGroup",(e=>({payload:e}))),updateGroup:ct("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ct("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ct("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ct("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ct("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ct("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ct("auth/getGroupConfiguration"),updateGroupConfiguration:ct("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ct("auth/getUsers",(e=>({payload:e})))},eo={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},to={setGroupsDialogsState:pt("groupsDialogsState"),resetGroupsDialogsState:ft("groupsState",{groupsDialogsState:eo}),openAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:mt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:mt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:mt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:mt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:mt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},no={loading:!0,error:null},oo={setCustomLoginState:pt("customLoginState"),resetCustomLoginState:ft("customLoginState",{customLoginState:no})},io={loadTenantMetadata:ct("auth/loadTenantMetadata"),updateTenantMetadata:ct("auth/updateTenantMetadata",(e=>({payload:e})))},ao={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ro,lo,so,co,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"}(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:[],topAccount:{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}))),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}}},mo={setSecurityCenterState:pt("securityCenterState"),resetSecurityCenterState:ft("securityCenterState",{securityCenterState:ho}),setSecurityCenterStateLoader:St("securityCenterState"),setSecurityCenterStateError:vt("securityCenterState")},Ao={loadRecommendations:ct("auth/loadRecommendations"),loadInsights:ct("auth/loadInsights"),sendResetBreachedPasswordEmails:ct("auth/sendResetBreachedPasswordEmails",(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:jt,forgotPasswordState:Ht,ssoState:Zt,profileState:nn,customLoginState:no,mfaState:ln,teamState:un,groupsState:Qn,groupsDialogsState:eo,socialLoginState:fn,apiTokensState:An,securityPolicyState:kn,accountSettingsState:Pn,tenantsState:_n,rolesState:Cn,resetPhoneNumberState:Jt,sessionsState:Nn,sessionsPolicyState:Gn,restrictionsState:jn,provisioningState:Kn,passkeysState:qn,allAccountsState:fo,allAccountsDialogsState:So,securityCenterState:ho},Po=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:()=>{}},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:Uo,actions:Co}=dt({name:wt,initialState:Po,reducers:U({resetState:e=>U({},e,Io),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t})),setEntitlements:gt("user","entitlements")},Nt,pn,$t,_o,Bt,zt,Qt,hn,on,oo,en,sn,dn,Xn,to,bn,En,Ln,wn,Rn,Mn,$n,Bn,Hn,Yn,po,vo,mo)});const Ro=U({loadEntitlements:ct("auth/loadEntitlements",(e=>({payload:e})))},Co,Mt,gn,xt,Wt,qt,Xt,mn,an,io,tn,cn,yn,Zn,{},Tn,In,On,Un,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"),jo=Do("TASK"),Bo=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){U(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===Bo},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 Ui(e){var t=Oi("ALL",e);return t.combinator=!0,t}function Ci(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,Ci(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,Ci(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 ji(e){$i.push(e),xi||(Wi(),Hi())}function Bi(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):ji((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;ji((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);Bi((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===Bo?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(Bo,!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(Bo))},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(Bo):{done:!0,value:Bo}):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 Bi((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,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){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 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 Ca={getContext:()=>Ua.getContext(),getAccessToken:()=>Ua.getAccessToken(),getUser:()=>Ua.getUser(),onRedirectTo:(e,t)=>Ua.onRedirectTo(e,t),logout:e=>Ua.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"}},ja={v1:"/identity/resources/roles/v1"},Ba={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=Ua.getContext(),a=await async function(e,t){var n;const o=hr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Ua.getAccessToken)(),a=Ua.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: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 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(U({url:e,method:"GET",contentType:"application/json",params:t},n)),br=async(e,t,n)=>mr(U({url:e,method:"POST",contentType:"application/json",body:t},n)),Tr=async(e,t,n)=>mr(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),kr=async(e,t,n)=>mr(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),Er=async(e,t,n)=>mr(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ir=async(e,t,n,o)=>mr(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),Pr=(e={})=>U({},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 Ur(e){return Ar(Xa.parents.v1,void 0,{headers:Pr(e)})}async function Cr(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,U({},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 jr(e){return e.id?Tr(`${Fa.v1}/lockout-policy`,e):br(`${Fa.v1}/lockout-policy`,e)}async function Br(){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";async function gl(e){return br(`${Ma.v3}/me/token`,e)}async function Sl(e,t){return Ar(Ma.v2,e,{headers:Pr(t)})}async function vl(e,t){return Ar(Ma.v3,e,{headers:Pr(t)})}async function hl(e,t){return Ar(Ma.roles.v3,U({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function ml(e,t){return Ar(Ma.groups.v3,U({},e,{ids:e.ids.join(",")}),{headers:Pr(t)})}async function Al(e){return Ar(Ma.tenants.me.v3,void 0,{headers:Pr(e)})}async function bl(){return br(Ma.passwords.resetBreachedPasswords.v1)}async function Tl(e){return kr(`${Ma.v2}/me`,e)}async function kl(){return Ar(pr)}let El;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(El||(El={}));const Il="admin_portal_entitlements",Pl={flags:{}};class Ll{constructor(){var e;this._flags={},this._flags=null!=(e=Pl.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ll;return n.set(e),Ll._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==Pl?void 0:Pl.flags)?t:{},null!=e?e:{})}}async function Ol(){return Ar(dr)}Ll._instances={};const _l=["type"],wl=["type"],Ul=["type"];async function Cl(e){if(!e.accessToken)return e;Ua.setAccessToken(e.accessToken);const t=await mu(),n=U({},e,e.accessToken?ul(e.accessToken):{},t);return Ua.setUser(n),n}async function Rl(e){if(!e.accessToken)return{user:e};Ua.setAccessToken(e.accessToken);const[t,n]=await Promise.all([mu(),Or()]),o=U({},e,e.accessToken?ul(e.accessToken):{},t);return Ua.setUser(o),{user:o,tenants:n}}function Dl(){if(!Ua.shouldLoadEntitlements())return!1;const[e]=Ll.getFeatureFlags([Il],Ua.getAppName()||"");return e}function Nl(){const[e]=Ll.getFeatureFlags([pl],Ua.getAppName()||"");return e}async function Ml(e){const{accessToken:t}=e;if(!t)return{user:e};Ua.setAccessToken(t);const[n,o]=await Promise.all([mu(),Al()]),i=U({},e,t?ul(t):{},n);return Ua.setUser(i),{user:i,tenants:o.tenants,activeTenant:o.activeTenant}}async function Fl(e){Ua.setAccessToken(e.id_token);const t=await mu(),n=e.id_token?ul(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 Gl(e){Ua.setAccessToken(e.id_token);const[t,n]=await Promise.all([mu(),Al()]),o=e.id_token?ul(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 $l(e){try{const{address:t}=await br(`${Na.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function xl(e){return br(`${Na.v1}/user/saml/prelogin`,e)}async function Vl(e){return Cl(await br(`${Na.v1}/user/saml/postlogin`,e))}async function jl(e){return Cl(await br(`${Na.v1}/user/oidc/postlogin`,e))}async function Bl(e){return Cl(await br(`${Na.v1}/user`,e))}async function Wl(e){return Ml(await br(`${Na.v1}/user`,e))}async function Kl(e){return Cl(await br(`${Na.v1}/user/mfa/verify`,e))}async function Hl(e){return Ml(await br(`${Na.v1}/user/mfa/verify`,e))}async function zl(e){return br(`${Ma.v1}/activate`,e)}async function ql(e){return Ml(await br(`${Ma.v1}/activate`,e))}async function Yl(e){return Ar(`${Ma.v1}/activate/strategy`,e)}async function Jl(e){return br(`${Ma.v1}/activate/reset`,e)}async function Ql(e){return br(`${Ma.v1}/invitation/reset`,e)}async function Xl(e){return br(`${Ma.v1}/invitation/accept`,e)}async function Zl(){return Cl(await br(`${Na.v1}/user/token/refresh`))}async function es(){return Rl(await br(`${Na.v1}/user/token/refresh`))}async function ts(){return Ml(await br(`${Na.v1}/user/token/refresh`))}async function ns(){return br(`${Na.v1}/logout`)}async function os(e){return Ar(`${ur}/logout`,e)}async function is(e){return br(`${Ma.v1}/passwords/reset`,e)}async function as(e){return br(`${Ma.v1}/passwords/reset/verify`,e)}async function rs(e){return Ar(`${Ma.v1}/passwords/config`,e)}async function ls(e){return br(`${Na.v1}/user/mfa/recover`,e)}async function ss(){return br(`${Ma.v1}/mfa/enroll`)}async function cs(){return br(`${Ma.v1}/mfa/authenticator/enroll`)}async function us(e){return br(`${Ma.v1}/mfa/authenticator/enroll/verify`,e)}async function ds(e){return br(`${Ma.v1}/mfa/sms/enroll`,e)}async function ys(e){return br(`${Ma.v1}/mfa/sms/enroll/verify`,e)}async function fs(){return br(`${Ma.v1}/mfa/webauthn/enroll`)}async function ps(e){return br(`${Ma.v1}/mfa/webauthn/enroll/verify`,e)}async function gs(e){return br(`${Ma.v1}/mfa/enroll/verify`,e)}async function Ss(e){return br(`${Ma.v1}/mfa/disable`,e)}async function vs(e,t){return br(`${Ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function hs(e){return br(`${Ma.v1}/mfa/sms/${e}/disable`)}async function ms(e,t){return br(`${Ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function As(e){return br(`${Ma.v1}/mfa/webauthn/${e}/disable`)}async function bs(e,t){return br(`${Ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ts(){return Ar(`${Ma.v1}/mfa/devices`)}async function ks(e){return br(`${Na.v1}/user/mfa/authenticator/enroll`,e)}async function Es(e){return br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Is(e){return Ml(await br(`${Na.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Ps(e,t){return br(`${Na.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Ls(e){return br(`${Na.v1}/user/mfa/emailcode`,e)}async function Os(e){return br(`${Na.v1}/user/mfa/emailcode/verify`,e)}async function _s(e){return Ml(await br(`${Na.v1}/user/mfa/emailcode/verify`,e))}async function ws(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 Cs(e){return Ml(await br(`${Na.v1}/user/mfa/sms/enroll/verify`,e))}async function Rs(e,t){return br(`${Na.v1}/user/mfa/sms/${e}`,t)}async function Ds(e,t){return br(`${Na.v1}/user/mfa/sms/${e}/verify`,t)}async function Ns(e,t){return Ml(await br(`${Na.v1}/user/mfa/sms/${e}/verify`,t))}async function Ms(e){return br(`${Na.v1}/user/mfa/webauthn/enroll`,e)}async function Fs(e){return br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Gs(e){return Ml(await br(`${Na.v1}/user/mfa/webauthn/enroll/verify`,e))}async function $s(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}`,t)}async function xs(e,t){return br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Vs(e,t){return Ml(await br(`${Na.v1}/user/mfa/webauthn/${e}/verify`,t))}async function js(){return Ar(`${Ha.v1}/saml/configurations`)}async function Bs(e){return br(`${Ha.v1}/saml/configurations`,e)}async function Ws(){return Ar(`${Ha.v1}/saml/configurations/vendor-config`)}async function Ks(e){return kr(`${Ha.v1}/saml/configurations/metadata`,e)}async function Hs(){return kr(`${Ha.v1}/saml/validations/domain`)}async function zs(){return Ar(`${Ha.v1}/saml/configurations/roles/default`)}async function qs(){return Ar(`${Ha.v2}/saml/configurations/groups`)}async function Ys({roleIds:e}){return br(`${Ha.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Js({roleIds:e,group:t}){return br(`${Ha.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Qs({roleIds:e,group:t,id:n}){return Tr(`${Ha.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Xs({id:e}){return Er(`${Ha.v2}/saml/configurations/groups/${e}`)}async function Zs(){return Ar(`${Ha.v1}/oidc/configurations`)}async function ec(){return Ar(`${Ha.v2}/configurations/public`)}async function tc(){return Ar($a.v1)}async function nc(){return Ar($a.v2)}async function oc(){return Ar(`${$a.v2}/authenticated`)}async function ic(){return Ar($a.custom.v1)}async function ac({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 rc(){return Ar(`${Fa.v1}/public`)}async function lc(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 Ml(n);return U({},a,{user:e,tenants:t,activeTenant:o})}return a}async function sc(){return Ar(Ma.sessions.currentUser.v1)}async function cc(){return Ar(`${Ma.sessions.currentUser.v1}/current`)}async function uc(e){return br(`${Ma.sessions.v1}/revoke`,{userId:e})}async function dc(){return Ar(Ma.sessions.configurations.v1)}async function yc(e){await br(Ma.sessions.configurations.v1,e)}async function fc(e){await Er(`${Ma.sessions.currentUser.v1}/${e}`)}async function pc(){await Er(`${Ma.sessions.currentUser.v1}/all`)}async function gc(){return Ar(Ma.accessTokens.v1)}async function Sc(){return Ar(Va.accessTokens.v1)}async function vc({id:e}){return Er(`${Va.accessTokens.v1}/${e}`)}async function hc({id:e}){return Er(`${Ma.accessTokens.v1}/${e}`)}async function mc(e){return br(Ma.accessTokens.v1,e)}async function Ac(e){return br(Va.accessTokens.v1,e)}async function bc(){return Ar(Ma.apiTokens.v1)}async function Tc(){return Ar(Va.apiTokens.v1)}async function kc(e){return br(Ma.apiTokens.v1,e)}async function Ec(e){return br(Va.apiTokens.v2,e)}async function Ic({tokenId:e}){return Er(`${Va.apiTokens.v1}/${e}`)}async function Pc({tokenId:e}){return Er(`${Ma.apiTokens.v1}/${e}`)}async function Lc({userId:e}){return Ar(`${Ma.v1}/${e}`)}async function Oc(e){return Ar(`${Fa.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function _c(e){let{type:t}=e,n=Ho(e,_l);return br(`${Na.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function wc(e){let{type:t}=e,n=Ho(e,wl);return Ml(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 Cc({token:e}){return br(Va.invites.verify.v1,{token:e})}async function Rc(){return Ar(`${Ha.v1}/configurations`)}async function Dc(e){return br(`${Ha.v1}/configurations`,e)}async function Nc(e,t){return Tr(`${Ha.v1}/configurations/${e}`,t)}async function Mc(e){return Er(`${Ha.v1}/configurations/${e}`)}async function Fc(e){return br(`${Ha.v1}/configurations/metadata`,e)}async function Gc(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata`,t)}async function $c(e){return br(`${Ha.v1}/configurations/metadata-url`,e)}async function xc(e,t){return kr(`${Ha.v1}/configurations/${e}/metadata-url`,t)}async function Vc(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 Bc(e,t){return kr(`${Ha.v1}/configurations/${e}/domains/${t}/validate`)}async function Wc(e){return Ar(`${Ha.v1}/configurations/${e}/roles`)}async function Kc(e,t){return kr(`${Ha.v1}/configurations/${e}/roles`,t)}async function Hc(e,t){return br(`${Ha.v1}/configurations/${e}/groups`,t)}async function zc(e,{roleIds:t,group:n,id:o}){return Tr(`${Ha.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function qc(e,t){return Er(`${Ha.v1}/configurations/${e}/groups/${t}`)}async function Yc(e){return Ar(`${Ha.v1}/configurations/${e}/groups`)}async function Jc(e){return br(`${Na.v2}/user/sso/prelogin`,e)}async function Qc(e){return Cl(await br(`${Na.v2}/user/oidc/postlogin`,e))}async function Xc(e){return Gl(await br(`${ur}/token`,e))}async function Zc(){return Gl(await br(`${ur}/authorize/silent`))}async function eu(e){return Fl(await br(`${ur}/token`,e))}async function tu(){return Fl(await br(`${ur}/authorize/silent`))}async function nu(e){return br(`${Ma.v1}/phone/reset`,e)}async function ou(e){return br(`${Ma.v1}/phone/reset/verify`,e)}async function iu(e){return br(`${Ma.v1}/phone`,e)}async function au(e){return br(`${Ma.v1}/phone/verify`,e)}async function ru(e){return kr(`${Ma.v1}/phone/change`,e)}async function lu(e){return br(`${Na.v1}/webauthn/prelogin`,e)}async function su(e){return br(`${Na.v1}/webauthn/postlogin`,e)}async function cu(e){return Ml(await br(`${Na.v1}/webauthn/postlogin`,e))}async function uu(){return br(Da.v1)}async function du(){return Ar(Da.v1)}async function yu(e){return Er(`${Da.v1}/${e}`)}async function fu(e){return br(`${Da.v1}/verify`,e)}async function pu(){return Ar(`${Fa.v1}/auth/strategies/public`)}async function gu(){return Ar(`${Fa.v1}/auth/strategies`)}async function Su(){return Ar(`${Fa.v1}/mfa/strategies`)}async function vu(){return Ar(`${Ma.authorization.v1}`)}async function hu(){return Ar(`${Ma.v2}/me`)}async function mu(){const e=[{action:hu,shouldLoad:!0},{action:kl,shouldLoad:Dl()},{action:vu,shouldLoad:Nl()}].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 Au(e){return Ar(`${Ma.v2}/me`,null!=e?e:{addRoles:!0})}async function bu(e){return kr(`${Ma.v2}/me`,e)}async function Tu(e){return kr(`${Ja.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function ku(e){return br(`${Ma.v1}/passwords/change`,e)}async function Eu(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 Ar(za.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Iu(e){return br(Ma.v2,U({},e,{provider:"local"}))}async function Pu(e){return Er(`${za.v1}/${e.userId}`)}async function Lu(e){return kr(za.v1,e)}async function Ou(e){return br(Va.invites.user.v1,U({},e))}async function _u(e){return Tr(Va.invites.user.v1,U({},e))}async function wu(){return Er(Va.invites.user.v1)}async function Uu(){return Ar(Va.invites.user.v1)}async function Cu(){return Ar(Va.invites.configuration.v1)}async function Ru(){return Ar(qa.v1)}async function Du(){return Ar(xa.v1)}async function Nu(){return Ar(`${Ya.v1}/members`)}async function Mu(e){return br(`${za.v1}/${e.userId}/resendActivationEmail`,{})}async function Fu(e){return br(Ma.v2,U({},e,{provider:"local"}))}async function Gu(e){return br(Ma.invitation.resendAll.v1,U({},e))}async function $u(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 xu(){return Ar("/metadata/admin-box")}async function Vu(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 Bu=async()=>$u({entityName:"notifications"}),Wu=async()=>$u({entityName:"saml"}),Ku=async()=>$u({entityName:"audits"}),Hu=async e=>async function(e){const t=await Ar(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),zu=["dataFilters"],qu=["templateId","dataFilters"],Yu=["dataFilters"];async function Ju(e){return Ar(`${ir.v2}/tenant-reports`,e)}async function Qu(e){return Ar(`${ir.v2}/${e.id}/tenant-reports`)}async function Xu(e){let{dataFilters:t}=e,n=Ho(e,zu);return{html:await Ar(`${ar.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Zu(e){let{templateId:t,dataFilters:n}=e,o=Ho(e,qu);return br(`${ir.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function ed(e){let{dataFilters:t}=e,n=Ho(e,Yu);const o=await Ar(`${ar.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 td(e){return br(`${ar.v1}/tenant-reports`,e)}async function nd(e){return Ar(rr,{params:e})}async function od(e){return kr(`${rr}/status`,{params:e})}async function id(e){const{notificationId:t,pinStatus:n}=e;return kr(`${rr}/${n}`,{notificationId:t})}async function ad(){return br(`${rr}/status/mark-all-read`)}const rd=["endpoint","headerProps"];async function ld(e){return Ar(lr,e)}async function sd(e){return Ar(`${lr}/stats`,e)}async function cd(e){const{endpoint:t,headerProps:n}=e,o=Ho(e,rd);return Ir(`${lr}/export/${t}`,{properties:n},o)}const ud=["eventKey"],dd=["eventKey"],yd=()=>Ar(`${er.v1}/slack`),fd=()=>Ar(`${er.v1}/slack/applications`),pd=()=>Ar(`${er.v1}/slack/channels`),gd=e=>e.id?Tr(`${er.v1}/slack/subscription/${e.id}`,e):br(`${er.v1}/slack/subscriptions`,e),Sd=e=>Er(`${er.v1}/slack/subscriptions/${e.id}`),vd=e=>br(`${er.v1}/slack/applications/registrations`,{code:e}),hd=()=>Ar(`${er.v1}/emails`),md=e=>{let{eventKey:t}=e,n=Ho(e,ud);return br(`${er.v1}/emails/${t}`,n)},Ad=({eventKey:e,enabled:t})=>Tr(`${er.v1}/emails/${e}`,{enabled:t}),bd=(e,t)=>Er(`${er.v1}/emails/${e}/subscriptions/${t}`),Td=(e,t,n)=>kr(`${er.v1}/emails/${t}/subscriptions/${e}`,n),kd=e=>Er(`${er.v1}/emails/${e}`),Ed=()=>Ar(`${er.v2}/sms`),Id=e=>{let{eventKey:t}=e,n=Ho(e,dd);return br(`${er.v2}/sms/${t}`,n)},Pd=({eventKey:e,enabled:t})=>Tr(`${er.v2}/sms/${e}`,{enabled:t}),Ld=(e,t)=>Er(`${er.v2}/sms/${e}/subscriptions/${t}`),Od=(e,t,n)=>kr(`${er.v2}/sms/${t}/subscriptions/${e}`,n),_d=e=>Er(`${er.v2}/sms/${e}`),wd=()=>Ar(cr),Ud=e=>e._id?Tr(`${cr}/${e._id}`,e):br(`${cr}/custom`,e),Cd=e=>Er(`${cr}/${e}`),Rd=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Ar(`${cr}/logs/?${o.toString()}`)},Dd=e=>br(`${cr}/test`,e),Nd=e=>br(`${cr}/logs/${e}/retries`),Md=()=>Ar(`${sr.v1}/categories`),Fd=e=>Ar(sr.v1,{channels:e});async function Gd(e,t){return kr(Qa.v1,e,{headers:Pr(t)})}async function $d(e){return Ar(Qa.v1,void 0,{headers:Pr(e)})}async function xd(){return Ar(`${Qa.v1}/public`)}const Vd=["roleId"],jd=["roleId"],Bd=["permissionId"];async function Wd(){return Ar(ja.v1)}async function Kd(e){return br(ja.v1,e)}async function Hd({roleId:e}){return Er(`${ja.v1}/${e}`)}async function zd(e){let{roleId:t}=e,n=Ho(e,Vd);return Tr(`${ja.v1}/${t}`,n)}async function qd(e){let{roleId:t}=e,n=Ho(e,jd);return kr(`${ja.v1}/${t}/permissions`,n)}async function Yd(){return Ar(xa.v1)}async function Jd(e){let{permissionId:t}=e,n=Ho(e,Bd);return kr(`${xa.v1}/${t}/roles`,n)}async function Qd(){return Ar(`${xa.v1}/categories`)}async function Xd(){return Ar(tr.subscriptions.v1)}async function Zd(e){return Ar(`${tr.subscriptions.v1}/${e}`)}async function ey(e){return kr(`${tr.subscriptions.v1}/${e}/cancellations/`,{})}async function ty(e){return kr(`${tr.subscriptions.v1}/${e}/renewals/`,{})}async function ny(e,{paymentMethodId:t,planId:n}){return kr(`${tr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function oy(e){return Ar(`${or.v1}/${e}`)}async function iy(){return Ar(`${or.v1}`)}async function ay(e){return kr(`${or.v1}/${e}/cancellations/`,{})}async function ry(e){return kr(`${or.v1}/${e}/renewals/`,{})}async function ly(e,{paymentMethodId:t,planId:n}){return kr(`${or.v1}/${e}`,{paymentMethodId:t,planId:n})}async function sy(){return Ar(tr.plans.v1)}async function cy(e){return Ar(`${tr.plans.v1}/${e}`)}async function uy(){return Ar(tr.invoices.v1)}async function dy(e){return Ar(`${tr.invoices.v1}/${e}`)}async function yy(e,t){return Ar(`${tr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const fy=["email"];async function py(){return Ar(tr.paymentMethods.v1)}async function gy(e){return Ar(`${tr.paymentMethods.v1}/${e}`)}async function Sy(e,t){let{email:n}=t,o=Ho(t,fy);return Tr(`${tr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function vy(e){return br(tr.paymentProviders.stripe.subscriptions.v1,e)}async function hy(e){return Ar(`${tr.paymentProviders.stripe.customers.v1}/${e}`)}async function my(e){return br(`${tr.paymentProviders.stripe.customers.v1}`,e)}async function Ay(){return Ar(`${tr.paymentProviders.stripe.publicConfigurations.v1}`)}async function by(e){return br(`${tr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ty(e){return Ar(`${tr.summaries.v1}/${e}`)}async function ky(e){return Ar(`${tr.tenantConfiguration.v1}/${e}`)}async function Ey(e){return br(`${tr.tenantConfiguration.v1}`,e)}async function Iy(){return Ar(nr.v1)}async function Py(){return Ar(`${tr.configurations.vendorPublicConfigurations.v1}`)}let Ly,Oy,_y,wy,Uy,Cy;async function Ry(){return Ar("/vendors/public")}async function Dy(e){return Ar(Ba.v1,e)}async function Ny(e){return br(Ba.v1,e)}async function My(e,t){return Er(Ba.v1,e,{headers:Pr(t)})}async function Fy(e,t,n){return br(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function Gy(e,t,n){return Er(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function $y(e,t,n){return Tr(`${Ba.v1}/${e}/roles`,t,{headers:Pr(n)})}async function xy(e,t){return br(Za.v1,e,{headers:Pr(t)})}async function Vy(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 By(e,t,n){return kr(`${Ba.v1}/${e}/access`,t,{headers:Pr(n)})}async function Wy(e,t){return br(`${Ba.v2}/`,e,{headers:Pr(t)})}async function Ky(){return Ar(`${yr}`)}async function Hy(e,t){return Tr(`${yr}/${e}`,t)}async function zy(e){return br(`${yr}`,e)}async function qy(e){return Er(`${yr}/${e}`)}async function Yy(e){return Ar(`${fr}/${e}/Users/count`)}async function Jy(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"}(Ly||(Ly={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Oy||(Oy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(_y||(_y={})),(wy||(wy={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Uy||(Uy={})),function(e){e.CREATE="create_customer"}(Cy||(Cy={}));const Qy=["groupId"];async function Xy({groupId:e},t){return Ar(`${Ka.v1}/${e}`,U({},t))}async function Zy(e){return Ar(`${Ka.v1}`,U({},e))}async function ef(e,t){return br(`${Ka.getByIds.v1}`,e,{params:t})}async function tf(e){return br(`${Ka.v1}`,e)}async function nf(e){let{groupId:t}=e,n=Ho(e,Qy);return Tr(`${Ka.v1}/${t}`,n)}async function of(e){return Er(`${Ka.v1}/${e}`)}async function af(e,t){return br(`${Ka.v1}/${e}/roles`,t)}async function rf(e,t){return Er(`${Ka.v1}/${e}/roles`,t)}async function lf(e,t){return br(`${Ka.v1}/${e}/users`,t)}async function sf(e,t){return Er(`${Ka.v1}/${e}/users`,t)}async function cf(){return Ar(`${Ka.configurations.v1}`)}async function uf(e){return br(`${Ka.configurations.v1}`,e)}async function df(){return Ar(gr.v1)}async function yf(){return Ar(Sr.v1)}let ff,pf,gf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ff||(ff={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(pf||(pf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(gf||(gf={}));const Sf=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],vf=`${Na.v1}/user/token/refresh`,hf=`${ur}/authorize/silent`,mf=`${Ma.v2}/me`,Af=`${Ma.v2}/me/tenants`,bf=`${Ma.v3}/me/tenants`;let Tf,kf,Ef,If,Pf,Lf,Of,_f;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Tf||(Tf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(kf||(kf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ef||(Ef={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS",e.CONFIGURE_SSO="CONFIGURE_SSO"}(If||(If={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.STALE_USERS_EXIST="STALE_USERS_EXIST",e.NO_STALE_USERS_EXIST="NO_STALE_USERS_EXIST",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(Pf||(Pf={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT",e.REMOVE_STALE_USERS="REMOVE_STALE_USERS"}(Lf||(Lf={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Of||(Of={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(_f||(_f={}));const wf={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:Ua,FronteggContext:Ca,api:wf,FronteggApiError:Ra,AuthStrategyEnum:To,MachineToMachineAuthStrategy:ko,SocialLoginProviders:bo,ISubscriptionCancellationPolicy:_y,ISubscriptionStatus:Ly,PaymentMethodType:Oy,ProviderType:wy};let Cf,Rf;!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"}(Cf||(Cf={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Rf||(Rf={}));const Df="input is invalid type",Nf="undefined"!=typeof ArrayBuffer,Mf="0123456789abcdef".split(""),Ff=[-2147483648,8388608,32768,128],Gf=[24,16,8,0],$f=[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],xf=["hex","array","digest","arrayBuffer"],Vf=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Nf&&!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 Wf(!0).update(t);return null==n?void 0:n[e]()}},Bf=function(e){return function(t,n){const o=new Kf(t,!0).update(n);return null==o?void 0:o[e]()}};class Wf{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=()=>Wf.prototype.digest(),e?(Vf[0]=Vf[16]=Vf[1]=Vf[2]=Vf[3]=Vf[4]=Vf[5]=Vf[6]=Vf[7]=Vf[8]=Vf[9]=Vf[10]=Vf[11]=Vf[12]=Vf[13]=Vf[14]=Vf[15]=0,this.blocks=Vf):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(Df);if(null===e)throw new Error(Df);if(Nf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Nf&&ArrayBuffer.isView(e)))throw new Error(Df);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]<<Gf[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Gf[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Gf[3&i++],l[i>>2]|=(128|o>>6&63)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Gf[3&i++],l[i>>2]|=(128|o>>12&63)<<Gf[3&i++],l[i>>2]|=(128|o>>6&63)<<Gf[3&i++],l[i>>2]|=(128|63&o)<<Gf[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]|=Ff[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+$f[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+$f[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+$f[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+$f[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=Mf[e>>28&15]+Mf[e>>24&15]+Mf[e>>20&15]+Mf[e>>16&15]+Mf[e>>12&15]+Mf[e>>8&15]+Mf[e>>4&15]+Mf[15&e]+Mf[t>>28&15]+Mf[t>>24&15]+Mf[t>>20&15]+Mf[t>>16&15]+Mf[t>>12&15]+Mf[t>>8&15]+Mf[t>>4&15]+Mf[15&t]+Mf[n>>28&15]+Mf[n>>24&15]+Mf[n>>20&15]+Mf[n>>16&15]+Mf[n>>12&15]+Mf[n>>8&15]+Mf[n>>4&15]+Mf[15&n]+Mf[o>>28&15]+Mf[o>>24&15]+Mf[o>>20&15]+Mf[o>>16&15]+Mf[o>>12&15]+Mf[o>>8&15]+Mf[o>>4&15]+Mf[15&o]+Mf[i>>28&15]+Mf[i>>24&15]+Mf[i>>20&15]+Mf[i>>16&15]+Mf[i>>12&15]+Mf[i>>8&15]+Mf[i>>4&15]+Mf[15&i]+Mf[a>>28&15]+Mf[a>>24&15]+Mf[a>>20&15]+Mf[a>>16&15]+Mf[a>>12&15]+Mf[a>>8&15]+Mf[a>>4&15]+Mf[15&a]+Mf[r>>28&15]+Mf[r>>24&15]+Mf[r>>20&15]+Mf[r>>16&15]+Mf[r>>12&15]+Mf[r>>8&15]+Mf[r>>4&15]+Mf[15&r];return s+=Mf[l>>28&15]+Mf[l>>24&15]+Mf[l>>20&15]+Mf[l>>16&15]+Mf[l>>12&15]+Mf[l>>8&15]+Mf[l>>4&15]+Mf[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 Kf extends Wf{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(Df);if(null===e)throw new Error(Df);if(Nf&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Nf&&ArrayBuffer.isView(e)))throw new Error(Df)}var i;e.length>64&&(e=null==(i=new Wf(!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}Wf.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();Wf.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Wf.prototype.finalize.call(this)}}}const Hf=function(){const e=jf("hex");e.create=function(){return new Wf},e.update=function(t){return e.create().update(t)};for(let t=0;t<xf.length;++t){const n=xf[t];e[n]=jf(n)}return e}();function zf(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function qf(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=Hf.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Yf(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=Bf("hex");e.create=function(e){return new Kf(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<xf.length;++t){const n=xf[t];e[n]=Bf(n)}}();const Jf=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Qf(e){const t=yield Mi((e=>e.root.appName));return Ll.getFeatureFlags(e,t)}const Xf={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Zf=U({},Xf,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),ep=[{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"}],tp={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},np=U({},tp,{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}),op={loading:!1,error:void 0,saving:!0,profile:tp},ip={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"},ap={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:To.EmailAndPassword,machineToMachineAuthStrategy:ko.ClientCredentials},rp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},lp={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},cp={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},up={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},dp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],yp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:cp,roles:dp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},fp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],pp={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:[ep[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[ep[0]],managedBy:Ef.FRONTEGG}]},gp={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:[ep[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[ep[0]],managedBy:Ef.FRONTEGG}]},Sp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},vp=[gp,pp],hp=[Sp],mp=[{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}],Ap=[{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"}],bp={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Tp={isActive:!0,strategy:Vn.ALLOW},kp=[{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"}],Ep=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},gp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ip=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"}),Pp=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ep(6),roles:[Ip("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Ef.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ep(44),roles:[Ip("Editor")],managedBy:Ef.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ep(8),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ep(5),roles:[Ip("Admin")],managedBy:Ef.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ep(21),description:"BDR, AE, and inside sales",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Ep(23),description:"Dev success and customer success",roles:[Ip("Admin")],managedBy:Ef.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Ep(10),description:"The marketing department",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Ep(4),description:"Human resources",roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Ep(3),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ep(8),roles:[Ip("Editor")],managedBy:Ef.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Ep(4),roles:[Ip("Viewer")],managedBy:Ef.FRONTEGG}],Lp={scoring:{score:79},recommendations:{items:[{code:If.FORCE_MFA,severity:Of.WARNING,category:_f.MFA},{code:If.ENABLE_FORCE_RELOGIN,severity:Of.WARNING,category:_f.SESSIONS}]}},Op={insights:{items:[{category:_f.MFA,code:Pf.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:_f.SESSIONS,code:Pf.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:_f.PASSWORD,code:Pf.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:_f.DOMAIN,code:Pf.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}};let _p,wp,Up;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(_p||(_p={})),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"}(Up||(Up={})),Up.profile,Up.privacy,Up.personalApiTokens,Up.account,Up.users,Up.groups,Up.security,Up.sso,Up.audits,Up.webhooks,Up.apiTokens,Up.roles,Up.subscriptions,Up.allAccounts;const Cp=(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,Rp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Dp=e=>{const{pathname:t}=new URL(e),n=Rp(e);return n?t+n:t},Np=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Mp="tenantId",Fp=e=>e.mfaRequired&&e.mfaToken?(Ua.setAccessToken(null),Ua.setUser(null),!0):(Ua.setAccessToken(e.accessToken),Ua.setUser(e),!1),Gp=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},$p=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},xp=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...xp(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),Vp=["callback"];function*jp(){yield wi(Ro.setCustomLoginState({loading:!0}));try{const e=yield Ri(wf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield wi(Ro.setCustomLoginState({loading:!1,error:Cp(e)}))}}function*Bp(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Vp);try{yield wi(Ro.setCustomLoginState({error:null,saving:!0}));const e=xp(n);if(0===e.length)throw new Error("No changes to update");yield Ri(wf.metadata.updateAdminBoxMetadata,{actions:e});const o=yield Ri(wf.metadata.getAdminBoxMetadata);yield wi(Ro.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setCustomLoginState({error:Cp(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Wp(){var e;const[t]=yield Ri(Qf,["admin_portal_login_per_tenant"]),n=!(null==(e=Ua.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*Kp(){try{var e;if(!(yield Ri(Wp)))return;const t=yield Mi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:o}=wf.accountSettings,{applicationUrl:i}=yield Ri(t?n:o);if(!i)return;const{routes:a}=yield Mi((e=>e.auth)),r=null!=(e=Rp(i))?e:"";yield wi(Ro.setState({routes:U({},a,{customLoginAuthenticatedUrl:i,customLoginUrl:a.loginUrl+r})})),yield wi(Ro.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Hp(){yield wa(Ro.loadTenantMetadata,jp),yield wa(Ro.updateTenantMetadata,Bp)}let zp;function qp(e){return function*(t){const[n]=yield Ri(Qf,["admin-portal-new-security-center-page"]);yield e(t),n&&(yield Yp(),yield Jp())}}function*Yp(){const e=zp.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:o}=yield Ri(wf.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:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Jp(){const e=zp.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Ri(wf.securityCenter.getInsights);yield wi(Ro.setSecurityCenterState({insights:t.items}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Qp({payload:{callback:e}}){const t=zp.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(wf.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield wi(Ro.setSecurityCenterStateError({key:t,value:Cp(n)})),null==e||e(!1)}finally{yield wi(Ro.setSecurityCenterStateLoader({key:t,value:!1}))}}function*Xp({key:e,tableState:t,updateStateKey:n,_offset:o,_limit:i,_preset:a,_email:r}){var l,s,c,u;yield wi(Ro.setSecurityCenterStateError({key:e,value:!1})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0}));const d=null!=(l=null!=o?o:null==t||null==(s=t.queryParams)?void 0:s._offset)?l:0,y=null!=(c=null!=i?i:null==t||null==(u=t.queryParams)?void 0:u._limit)?c:10,f=U({_offset:d,_limit:y,_includeSubTenants:!1,_preset:a},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:o,totalPages:i}}=yield Ri(wf.users.getUsersV3,f),a={totalUsersItems:o,totalUsersPages:i,usersPageOffset:d,queryParams:U({_offset:d,_limit:y},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield Ri(wf.roles.getRoles),o=yield Ri(wf.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 wi(Ro.setSecurityCenterState({[n]:U({users:e},a)}))}else yield wi(Ro.setSecurityCenterState({[n]:U({users:[]},a)}))}catch(t){yield wi(Ro.setSecurityCenterStateError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Zp({payload:e}){var t;const n=zp.BREACHED_PASSWORD_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:uo.BREACHED_PASSWORDS,tableState:o},e))}function*eg({payload:e}){var t;const n=zp.UNENROLLED_MFA_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:uo.MFA_UNENROLLED,tableState:o},e))}function*tg({payload:e}){var t;const n=zp.INACTIVE_USERS_TABLE,o=yield null!=(t=Mi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield Xp(U({key:n,updateStateKey:"inactiveUsersTable",tableState:o},e))}function*ng(){yield Oa(Ro.loadRecommendations,Yp),yield Oa(Ro.loadInsights,Jp),yield Oa(Ro.sendResetBreachedPasswordEmails,Qp),yield Oa(Ro.loadBreachedPasswordUsers,Zp),yield Oa(Ro.loadUnenrolledMfaUsers,eg),yield Oa(Ro.loadInactiveUsers,tg)}function*og(){const e=zp.RECOMMENDATIONS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({recommendations:Lp.recommendations.items,score:Lp.scoring.score})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*ig(){const e=zp.INSIGHTS;yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!0})),yield Fi(500),yield wi(Ro.setSecurityCenterState({insights:Op.insights.items})),yield wi(Ro.setSecurityCenterStateLoader({key:e,value:!1}))}function*ag(){yield Oa(Ro.loadRecommendations,og),yield Oa(Ro.loadInsights,ig)}!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(zp||(zp={}));const rg=["callback"],lg=["callback"],sg=["callback"],cg=["callback"],ug=["callback"],dg=["callback"];function*yg(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getGlobalSecurityPolicy);yield wi(Ro.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyGlobalState({error:Cp(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*fg(e){var t,n;if(!(yield Ri(Wp)))return e;const o=yield Ri(gg);return null!=o&&null!=(t=o.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?U({},e,{authStrategy:o.mainAuthStrategies[0].strategy}):e}function*pg(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorConfig),t=yield fg(e);yield wi(Ro.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:Cp(e),loading:!1}))}}function*gg(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(wf.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Ri(wf.auth.getVendorPublicAuthStrategiesConfig),t}function*Sg(){yield wi(Ro.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Ri(gg);yield function*(e){const t=yield Ri(Wp);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:U({},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:Cp(e),loading:!1}))}}function*vg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getMfaPolicy);yield wi(Ro.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyMfaState({error:Cp(e),loading:!1}))}}function*hg(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorMfaPolicy);yield wi(Ro.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorMfaState({error:Cp(e),loading:!1}))}}function*mg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,rg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.saveMfaPolicy,n);yield wi(Ro.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Ag(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getLockoutPolicy);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({error:Cp(e),loading:!1}))}}function*bg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,lg);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.saveLockoutPolicy,n);yield wi(Ro.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyLockoutState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Tg(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorLockoutPolicy);yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorLockoutState({error:Cp(e),loading:!1}))}}function*kg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCaptchaPolicy);yield wi(Ro.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyCaptchaState({error:Cp(e),loading:!1}))}}function*Eg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({error:Cp(e),loading:!1}))}}function*Ig(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getVendorPasswordHistoryPolicy);yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({error:Cp(e),loading:!1}))}}function*Pg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,sg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.savePasswordHistoryPolicy,n);yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Lg(){yield wi(Ro.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getPasswordConfigPolicy);yield wi(Ro.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPasswordState({error:Cp(e),loading:!1}))}}function*Og(){yield wa(Ro.loadSecurityPolicy,yg),yield Oa(Ro.saveSecurityPolicyMfa,qp(mg)),yield Oa(Ro.loadSecurityPolicyMfa,vg),yield Oa(Ro.loadSecurityPolicyVendorMfa,hg),yield Oa(Ro.saveSecurityPolicyLockout,qp(bg)),yield Oa(Ro.loadSecurityPolicyLockout,Ag),yield Oa(Ro.loadSecurityPolicyVendorLockout,Tg),yield Oa(Ro.loadSecurityPolicyCaptcha,kg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,qp(Pg)),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Eg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,Ig),yield Oa(Ro.loadVendorPasswordConfig,Lg),yield Oa(Ro.loadPublicSecurityPolicy,pg),yield Oa(Ro.loadPublicAuthStrategiesPolicy,Sg)}function*_g(){yield wi(Ro.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield wi(Ro.setSecurityPolicyPublicState({policy:ap,loading:!1}))}catch(e){yield wi(Ro.setSecurityPolicyPublicState({error:Cp(e),loading:!1}))}}function*wg(){yield wi(Ro.setSecurityPolicyGlobalState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyGlobalState({policy:ip,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*Ug(){yield wi(Ro.setSecurityPolicyMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:rp,loading:!1}))}function*Cg(){yield wi(Ro.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorMfaState({policy:rp,loading:!1}))}function*Rg(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,cg);yield wi(Ro.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},lp,{id:null!=(t=o.id)?t:lp.id,enforceMFAType:o.enforceMFAType});yield At(),yield wi(Ro.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*Dg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:lp,loading:!1}))}function*Ng(){yield wi(Ro.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorLockoutState({policy:lp,loading:!1}))}function*Mg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ug);yield wi(Ro.setSecurityPolicyLockoutState({saving:!0,error:null})),yield At();const o=U({},lp,n,{id:n.id?n.id:lp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Fg(){yield wi(Ro.setSecurityPolicyLockoutState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyLockoutState({policy:lp,loading:!1}))}function*Gg(){yield wi(Ro.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:sp,loading:!1}))}function*$g(){yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield At(),yield wi(Ro.setSecurityPolicyVendorPasswordHistoryState({policy:sp,loading:!1}))}function*xg(e){let{payload:{callback:t}}=e,n=Ho(e.payload,dg);yield wi(Ro.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield At();const o=U({},sp,n,{id:n.id?n.id:sp.id});null==t||t(o),yield wi(Ro.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Vg(){yield wa(Ro.loadSecurityPolicy,wg),yield Oa(Ro.loadPublicSecurityPolicy,_g),yield Oa(Ro.saveSecurityPolicyMfa,Rg),yield Oa(Ro.loadSecurityPolicyMfa,Ug),yield Oa(Ro.loadSecurityPolicyVendorMfa,Cg),yield Oa(Ro.saveSecurityPolicyLockout,Mg),yield Oa(Ro.loadSecurityPolicyLockout,Dg),yield Oa(Ro.loadSecurityPolicyVendorLockout,Ng),yield Oa(Ro.loadSecurityPolicyCaptcha,Fg),yield Oa(Ro.saveSecurityPolicyPasswordHistory,xg),yield Oa(Ro.loadSecurityPolicyPasswordHistory,Gg),yield Oa(Ro.loadSecurityPolicyVendorPasswordHistory,$g)}const jg=["events","url"];function*Bg(){yield wi(Ro.setSignUpState({loading:!0}));try{const e=yield Ri(wf.auth.getVendorConfig),t=yield fg(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:Cp(e),firstLoad:!1}))}}function*Wg(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,jg);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(wf.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&&Fp(l)){const t=yield US(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:U({},e,{tenants:u,activeTenant:d})}))}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setSignUpState({loading:!1,error:Cp(e)}))}yield wi(Ro.setSignUpState({loading:!1}))}function*Kg(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Mi((e=>e.auth.signUpState));yield wi(Ro.resetSignUpState()),yield wi(Ro.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Hg(){yield wa(Ro.signUpUser,Wg),yield wa(Ro.resetSignUpStateSoft,Kg)}const zg={setVendorState:(e,{payload:t})=>U({},e,t)},qg={loadVendorPublicInfo:ct("vendor/loadVendorPublicInfo")},Yg={loading:!1},{reducer:Jg,actions:Qg}=dt({name:Rt,initialState:Yg,reducers:U({},zg)}),Xg=U({},Qg,qg);function*Zg(){yield wi(Xg.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield wf.vendor.getVendorPublicInfo();yield wi(Xg.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield wi(Xg.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var eS=n(378),tS=n.n(eS);function nS(e,t){return tS()(e,t)}function*oS({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield Ri(wf.entitlements.loadEntitlements);yield function*(e){nS(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*iS(){yield wa(Ro.loadEntitlements,oS)}const aS=["callback"],rS=["callback"],lS=["callback"],sS=["callback"],cS=["callback","events"],uS=["callback"],dS=["callback"],yS=["callback"],fS=["callback"],pS=["user"],gS=["callback"],SS=["callback"],vS=["callback"],hS=["callback"],mS=["callback"],AS=["callback","deviceId"],bS=["callback"],TS=["callback"],kS=["callback","deviceId"],ES=["callback","deviceId"],IS=["callback","deviceId"];function*PS(e){const t=yield Mi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return nS(t,null==e?void 0:e.entitlements)?U({},e,{entitlements:t}):e}function*LS({user:e,tenants:t=[],activeTenant:n},o={}){const{tenantsState:i}=yield Mi((e=>e.auth));yield wi(Ro.setState(U({user:e,tenantsState:U({},i,{tenants:t,activeTenant:n,loading:!1})},o)))}function*OS(){const e=Ua.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(Kp),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?Dp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(y,{refresh:y.startsWith("http")})}function*_S(){let e;try{var t;const n=yield Ri(wf.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*wS(){try{const{isActive:e}=yield Ri(wf.auth.getSSOPublicConfiguration);yield wi(Ro.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*US(e){let t=It.loginWithTwoFactor,n={};const{loginState:o}=yield Mi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield Ri(wf.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Gp(e.mfaDevices)}:(n={step:$p(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: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*CS(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*RS(){const{hostedLoginBox:e}=yield Mi((e=>e.auth));e?yield Ri(DS):yield Ri(MS)}function*DS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.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(wf.auth.exchangeOAuthTokensV2,t),o=yield Ri(PS,n.user);yield Ri(LS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*NS(){const{user:e}=yield Mi((e=>e.auth));if(null==e||!e.refreshToken)return Ua.setAccessToken(null),Ua.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(wf.auth.exchangeOAuthTokensV2,t),o=yield Ri(PS,n.user);yield Ri(LS,U({},n,{user:o}),{isAuthenticated:!0})}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:null,isAuthenticated:!1}))}}function*MS(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.refreshTokenV3);if(Fp(i)){const e=yield US(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 CS(i),l=yield Ri(PS,i);yield Ri(LS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield GS(n)}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*FS(){try{const t=Ua.onRedirectTo,{routes:n,loginState:o}=yield Mi((e=>e.auth)),{user:i,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.refreshTokenV3);if(Fp(i)){const e=yield US(i);yield wi(Ro.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const l=yield Ri(PS,i);if(yield Ri(ZS))yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),yield Ri(LS,{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 CS(i);yield Ri(LS,{user:l,tenants:a,activeTenant:r},{loginState:U({},o,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login}),isAuthenticated:!0}),yield GS(n)}}}catch(e){Ua.setAccessToken(null),Ua.setUser(null),yield wi(Ro.setState({user:void 0,isAuthenticated:!1}))}}function*GS(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Ua.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 OS())}function*$S({payload:{callback:e}}){try{const{ip:t}=yield Ri(wf.metadata.getCurrentUserIpMetadata);yield wi(Ro.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*xS({payload:e}){const t=[];(yield Ri(Wp))?yield Ri(RS):t.push(Ri(RS)),e&&(yield wi(Ro.setState({isLoading:!0})),yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(Bg)),t.push(Ri(Sg)),t.push(Ri(wS)),t.push(Ri(Zg)),t.push(Ri(_S)),t.push(Ri(Kp))),yield Ui(t),yield wi(Ro.setState({isLoading:!1}))}function*VS({accessToken:e,user:t}){if(!e)return void(yield wi(Ro.setState({user:void 0,isAuthenticated:!1})));const n=Ua.onRedirectTo,{routes:o}=yield Mi((e=>e.auth));if(Fp(t)){const e=yield US(t);yield wi(Ro.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*jS({payload:e}){const t=[];yield wi(Ro.loadSocialLoginsConfigurationV2()),t.push(Ri(Bg)),t.push(Ri(wS)),t.push(Ri(Zg)),t.push(Ri(_S)),t.push(Ri(VS,e)),t.push(Ri(Kp)),yield Ui(t)}const BS=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*WS(){const e=yield Ri(wf.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Ri(LS,e,{isAuthenticated:!0,isLoading:!1})}function*KS({payload:e}){const{disableSilentRefresh:t}=yield Mi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield WS()}catch(t){yield zS(e)}}function*HS({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n}}){if(n){const{urlStrategy:e}=yield Mi((e=>({urlStrategy:e.root.urlStrategy}))),t=BS(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 WS()}catch(n){if(!t)return void(yield wi(Ro.setState({isLoading:!1})));yield zS(e)}}function*zS(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(BS(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield wi(Ro.setState({isLoading:!0}));const a=Yf(),r=Yf(),l=yield Ri(qf,r);localStorage.setItem(_t,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield Ri(Kp);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=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=Np(Mp);f&&(d.tenantId=f),o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*qS({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(Kp);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(wf.auth.exchangeOAuthTokensV2,r);yield Ri(LS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield wi(Ro.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield OS()}}function*YS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,aS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(wf.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:Cp(e),loading:!1}))}}function*JS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,rS);try{yield wi(Ro.setLoginState({loading:!0})),yield Ri(wf.auth.verifyChangePhoneNumber,n),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e),loading:!1}))}}function*QS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,lS);try{yield wi(Ro.setLoginState({loading:!0}));const e=yield Ri(wf.auth.passwordlessPreLogin,U({},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:Cp(e),loading:!1})),null==t||t(e)}}function*XS(e){let{payload:{callback:t}}=e,n=Ho(e.payload,sS);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(wf.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:Cp(e),loading:!1})),null==t||t()}}function*ZS(){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(Qf,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield Ri(wf.auth.getWebAuthnDevices);return yield wi(Ro.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ev(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,cS);try{yield wi(Ro.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Ri(wf.auth.passwordlessPostLoginV2,o),l=Ua.onRedirectTo,{routes:s}=yield Mi((e=>e.auth));if(Fp(e)){const t=yield US(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:_p.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name})),e.id&&localStorage.setItem("userId",e.id),yield Ri(LS,{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(ZS))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),l(s.loginUrl,{preserveQueryParams:!0})):(yield wi(Ro.setState({isAuthenticated:!0})),yield OS()):l(s.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield wi(Ro.setLoginState({error:Cp(e,"Failed to authenticate")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*tv({payload:e}){try{yield wi(Ro.setLoginState({loading:!0}));const{name:t}=yield Ri(wf.auth.verifyInviteToken,e);yield wi(Ro.setLoginState({inviteTokenTenantName:t}))}catch(e){yield wi(Ro.setLoginState({inviteTokenError:Cp(e,"We couldn't verify your invitation")}))}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*nv({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=Np(Mp),{address:r,idpType:l}=yield Ri(wf.auth.preLoginV2,{email:e,tenantId:a});if(r){let e=r;if(l===Rf.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 ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield ov({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*ov(e){let{callback:t}=e,n=Ho(e,uS);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(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield wi(Ro.setLoginState({step:It.loginWithPassword,loading:!1})),null==t||t())}function*iv({payload:{callback:e}}){try{yield wi(Ro.setLoginState({loading:!0}));const{options:t}=yield Ri(wf.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:Cp(t)})),null==e||e(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*av(e){let{payload:{callback:t}}=e,n=Ho(e.payload,dS);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(wf.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setLoginState({loading:!1}))}}function*rv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,yS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const{options:e}=yield Ri(wf.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)}))),yield wi(Ro.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*lv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,fS);try{var o;yield wi(Ro.setPasskeysState({loading:!0})),yield wi(Ro.setLoginState({loading:!0}));const e=Et(n.publicKey),i=yield Ri(wf.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=Ho(i,pS);if(Fp(a)){const e=Ua.onRedirectTo,{routes:t}=yield Mi((e=>e.auth)),n=yield US(a);yield wi(Ro.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Ri(LS,U({user:a},r),{isAuthenticated:!0}),yield wi(Ro.setLoginState({error:void 0})),yield OS(),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}finally{yield wi(Ro.setPasskeysState({loading:!1})),yield wi(Ro.setLoginState({loading:!1}))}}function*sv({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(wf.auth.postLogin,e);yield wi(Ro.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield OS()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield wi(Ro.setLoginState({step:It.loginWithSSOFailed,loading:!1}))}}function*cv({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(wf.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:o}),s=Ua.onRedirectTo,{routes:c}=yield Mi((e=>e.auth));if(Fp(a)){const e=yield US(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(LS,{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(Qf,["security-center-login-flows"]);t.flow===Pt.Login&&(o&&a.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):n&&((yield Ri(ZS))?(yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})),s(c.loginUrl,{preserveQueryParams:!0})):yield OS()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Ua.setAccessToken(null),Ua.setUser(null),null==i||i(!1,t),yield wi(Ro.setLoginState({email:e,error:Cp(t),loading:!1}))}}function*uv({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(wf.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(LS,{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(Qf,["security-center-login-flows"]);l.flow===Pt.Login&&(u&&l.isBreachedPassword?yield wi(Ro.setLoginState({step:It.breachedPassword,loading:!1})):(yield Ri(ZS))?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield OS()),null==o||o(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e),loading:!1})),null==o||o(!1,e)}}function*dv({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*yv({payload:e}){const{hostedLoginBox:t}=yield Mi((e=>e.auth));yield wi(Ro.setState({isLoading:!0}));try{t?yield Ri(wf.auth.OAuthLogout):yield Ri(wf.auth.logout)}catch{}yield wi(Ro.resetState()),yield wi(Ro.requestAuthorize(!0)),null==e||e()}function*fv({payload:e}){var t;try{yield Ri(wf.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*pv({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*gv({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(Qf,["security-center-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(ZS);i===rn.smsVerifyCode&&e?yield wi(Ro.setLoginState({step:It.promptPasskeys,loading:!1})):yield OS()}yield wi(Ro.setState({isAuthenticated:!!e.accessToken}))}function*Sv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,gS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null)}}function*vv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,SS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.enrollMFASMSForLoginV2,n);yield pv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*hv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,vS);yield wi(Ro.setLoginState({loading:!0}));try{var o;const e=yield Ri(wf.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:kt(e.options.challenge),user:U({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},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:Cp(e)})),null==t||t(null)}}function*mv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,hS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(n.publicKey),o=yield Ri(wf.auth.enrollMFAWebAuthnForLoginV2,U({},n,{options:e}));yield pv(o),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Av(e){let{payload:{callback:t}}=e,n=Ho(e.payload,mS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield pv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*bv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,AS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null)}}function*Tv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,bS);try{const e=yield Ri(wf.auth.preVerifyMFAEmailCode,n);yield wi(Ro.setMfaState({otcToken:e.otcToken,step:rn.emailVerifyCode})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({error:Cp(e)})),null==t||t(null)}}function*kv(e){let{payload:{callback:t}}=e,n=Ho(e.payload,TS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.verifyMFAEmailCodeV2,n);yield gv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Ev(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,kS);yield wi(Ro.setLoginState({loading:!0}));try{const e=yield Ri(wf.auth.verifyMFASMSForLoginV2,n,o);yield gv(e),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Iv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,ES);yield wi(Ro.setLoginState({loading:!0}));try{var i;const e=yield Ri(wf.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},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:Cp(e)})),null==t||t(null)}}function*Pv(e){let{payload:{callback:t,deviceId:n}}=e,o=Ho(e.payload,IS);yield wi(Ro.setLoginState({loading:!0}));try{const e=Et(o.publicKey),i=yield Ri(wf.auth.verifyMFAWebAuthnForLoginV2,n,U({},o,{options:e}));yield gv(i),yield wi(Ro.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setLoginState({loading:!1,error:Cp(e)})),null==t||t(null)}}function*Lv({payload:e}){yield wi(Ro.setLoginState({loading:!0}));try{yield Ri(wf.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:Cp(e)}))}}function*Ov(){yield wa(Ro.requestAuthorize,xS),yield wa(Ro.requestAuthorizeSSR,jS),yield wa(Ro.requestHostedLoginAuthorize,KS),yield wa(Ro.requestHostedLoginAuthorizeV2,HS),yield wa(Ro.handleHostedLoginCallback,qS),yield wa(Ro.preLogin,nv),yield wa(Ro.postLogin,sv),yield wa(Ro.login,cv),yield wa(Ro.logout,yv),yield wa(Ro.silentLogout,fv),yield wa(Ro.loginWithMfa,uv),yield wa(Ro.recoverMfa,dv),yield wa(Ro.quickSmsPasswordlessPreLogin,QS),yield wa(Ro.changePhoneNumberWithVerification,YS),yield wa(Ro.verifyChangePhoneNumber,JS),yield wa(Ro.passwordlessPreLogin,XS),yield wa(Ro.passwordlessPostLogin,ev),yield wa(Ro.verifyInviteToken,tv),yield wa(Ro.webAuthnPrelogin,rv),yield wa(Ro.webAuthnPostLogin,lv),yield wa(Ro.webAuthnCreateNewDeviceSession,iv),yield wa(Ro.webAuthnVerifyNewDeviceSession,av),yield wa(Ro.afterAuthNavigation,OS),yield wa(Ro.getUserIP,$S),yield wa(Ro.preEnrollMFASMSForLogin,Sv),yield wa(Ro.enrollMFASMSForLogin,vv),yield wa(Ro.preEnrollMFAWebAuthnForLogin,hv),yield wa(Ro.enrollMFAWebAuthnForLogin,mv),yield wa(Ro.enrollMFAAuthenticatorAppForLogin,Av),yield wa(Ro.preVerifyMFASMSForLogin,bv),yield wa(Ro.verifyMFASMSForLogin,Ev),yield wa(Ro.preVerifyMFAWebAuthnForLogin,Iv),yield wa(Ro.verifyMFAWebAuthnForLogin,Pv),yield wa(Ro.preVerifyMFAEmailCode,Tv),yield wa(Ro.verifyMFAEmailCode,kv),yield wa(Ro.resetBreachedPassword,Lv)}function*_v({payload:e}){e&&(yield wi(Ro.setState({isLoading:!0})));const t=np;yield wi(Ro.loadTenants()),yield wi(Ro.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*wv({payload:{callback:e}}){try{const{ip:t}=kp[0];yield wi(Ro.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Uv(){yield wa(Ro.requestAuthorize,_v),yield wa(Ro.afterAuthNavigation,OS),yield wa(Ro.getUserIP,wv)}const Cv=["callback","samlVendor"],Rv=["callback","samlVendor"];function*Dv(){try{var e,t;yield wi(Ro.setSSOState({loading:!0}));const n=yield Ri(wf.auth.getSamlConfiguration),o=yield Ri(wf.auth.getOidcConfiguration),i=yield Ri(wf.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:Cp(e),loading:!1}))}}function*Nv({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 Jf(e[0]),i=yield Ri(wf.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:Cp(e),[n]:!1}))}}function*Mv({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 Jf(t),a=yield Ri(wf.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:Cp(e),[i]:!1})),null==n||n(null,e)}}function*Fv({payload:e}){const{callback:t,samlVendor:n}=e,o=Ho(e,Cv),i=yield Mi((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 wi(Ro.setSSOState({samlConfiguration:U({},i,a)})));if(yield wi(Ro.setSSOState({error:void 0,[r]:!0})),e.type===Rf.Saml){var l,s;const e=yield Ri(wf.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=zf(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(wf.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:Cp(e),[r]:!1})),null==t||t(null,e)}}function*Gv({payload:{callback:e}={}}){const t=yield Mi((e=>e.auth.ssoState.samlConfiguration));try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.validateSamlDomain),yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:Cp(n),saving:!1})),null==e||e(null,n)}}function*$v(){try{const e=yield Ri(wf.auth.getSamlRoles),t=yield Ri(wf.auth.getSamlRolesGroups);yield wi(Ro.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield wi(Ro.setSSOState({error:Cp(e)}))}}function*xv({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Ui(e.map((e=>Ri(wf.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield wi(Ro.setSSOState({error:Cp(e)}))}}(n)),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:Cp(t),saving:!1})),null==e||e(null,t)}}function*Vv({payload:{callback:e,id:t}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.deleteSamlGroup,{id:t}),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOState({error:Cp(t),saving:!1})),null==e||e(null,t)}}function*jv({payload:{group:e,roleIds:t,callback:n}}){try{yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield Ri(wf.auth.createSamlGroup,{group:e,roleIds:t}),yield $v(),yield wi(Ro.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield wi(Ro.setSSOState({error:Cp(e),saving:!1})),null==n||n(null,e)}}function*Bv({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield wi(Ro.setSSOState({loading:!0})),yield Ri(wf.auth.oidcPostLoginV2,t),yield Ri(RS),yield wi(Ro.setSSOState({loading:!1}))}catch(e){yield wi(Ro.setSSOState({loading:!1,error:Cp(e,"Failed to authenticate"),firstLoad:!1}))}}function*Wv(){yield Oa(Ro.loadSSOConfigurations,Dv),yield Oa(Ro.saveSSOConfigurations,Fv),yield Oa(Ro.saveSSOConfigurationsFile,Nv),yield Oa(Ro.saveSSOConfigurationsFileWithCallback,Mv),yield Oa(Ro.validateSSODomain,Gv),yield Oa(Ro.loadSSOAuthorizationRoles,$v),yield Oa(Ro.updateSSOAuthorizationRoles,xv),yield Oa(Ro.deleteSamlGroup,Vv),yield Oa(Ro.createSamlGroup,jv),yield Oa(Ro.oidcPostlogin,Bv)}function*Kv(){yield wi(Ro.setSSOState({loading:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:cp,loading:!1,firstLoad:!1}))}function*Hv({payload:e}){const t="saving";yield wi(Ro.setSSOState({error:void 0,[t]:!0}));const n=U({},yield Mi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield wi(Ro.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*zv({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ho(e,Rv),r=yp.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 wi(Ro.setSSOState({samlConfiguration:U({},r,l)})));yield wi(Ro.setSSOState({error:void 0,[s]:!0})),yield At(),l.acsUrl=null==up||null==(t=up.configuration)?void 0:t.acsUrl,l.spEntityId=null==up||null==(n=up.configuration)?void 0:n.spEntityId;const c=zf(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*qv({payload:{callback:e}={}}){const t=yp.samlConfiguration;yield wi(Ro.setSSOState({error:void 0,saving:!0})),yield At(),yield wi(Ro.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Yv(){yield At(),yield wi(Ro.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Jv({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*Qv(){yield Oa(Ro.loadSSOConfigurations,Kv),yield Oa(Ro.saveSSOConfigurations,zv),yield Oa(Ro.saveSSOConfigurationsFile,Hv),yield Oa(Ro.validateSSODomain,qv),yield Oa(Ro.loadSSOAuthorizationRoles,Yv),yield Oa(Ro.updateSSOAuthorizationRoles,Jv)}const Xv=["callback"],Zv=["callback","ssoConfigId"],eh=["callback","ssoConfigId"],th=["callback","ssoConfigId"];function*nh(){try{return yield Ri(wf.auth.getOidcConfiguration)}catch(e){return null}}function*oh(){try{return yield Ri(wf.metadata.getSamlMetadata)}catch(e){return null}}function*ih(){try{yield wi(Ro.setSSOLoader({key:Cf.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Ui([Ri(nh),Ri(oh)]),n=yield Ri(wf.auth.getSSOConfigurations);yield wi(Ro.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield wi(Ro.setSSOError({key:Cf.LOAD_SSO_CONFIGURATIONS,value:Cp(e)}))}finally{yield wi(Ro.setSSOLoader({key:Cf.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*ah({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ho(e,Xv),o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield Ri(wf.auth.createSSOConfiguration,U({},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:Cf.SAVE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!1}))}}function*rh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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 Jf(t),i=yield Ri(wf.auth.createSSOConfigurationByMetadata,{metadata:e});yield wi(Ro.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*lh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,Zv),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(wf.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:Cf.UPDATE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*sh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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 Jf(o),a=yield Ri(wf.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:Cf.UPDATE_SSO_CONFIGURATION,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ch({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.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:Cf.DELETE_SSO_CONFIGURATION,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_CONFIGURATION,value:!1}))}}function*uh({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ho(e,eh);yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ri(wf.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield wi(Ro.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_DOMAIN,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_DOMAIN,value:!1}))}}function*dh({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},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:Cf.DELETE_SSO_DOMAIN,value:Cp(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.DELETE_SSO_DOMAIN,value:!1}))}}function*yh({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield wi(Ro.setSSOLoader({key:Cf.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.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 wi(Ro.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.VALIDATE_SSO_DOMAIN,value:Cp(e)})),null==t||t(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.VALIDATE_SSO_DOMAIN,value:!1}))}}function*fh({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ri(wf.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield wi(Ro.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield wi(Ro.setSSOError({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:Cp(t)})),null==e||e(null,t)}finally{yield wi(Ro.setSSOLoader({key:Cf.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*ph({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!0}));const i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{yield Ui(t.map((e=>Ri(wf.auth.deleteSSOGroup,n,e)))),yield Ui(e.map((e=>Ri(wf.auth.createSSOGroup,n,e))));const a=yield Ri(wf.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield wi(Ro.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_GROUPS,value:Cp(e)})),null==o||o(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!1}))}}function*gh({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Ui(t.map((t=>Ri(wf.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield wi(Ro.setSSOError({key:Cf.SAVE_SSO_GROUPS,value:Cp(e)})),null==n||n(null,e)}finally{yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_GROUPS,value:!1}))}}function*Sh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.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(wf.auth.updateSSOConfigurationByMetadataUrl,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield Ri(wf.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:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*vh({payload:e}){yield wi(Ro.setSSOLoader({key:Cf.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ho(e,th),i=yield Mi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Ri(wf.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield Ri(wf.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:Cf.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*hh(){yield Oa(Ro.loadSSOConfigurationsV2,ih),yield Oa(Ro.saveSSOConfigurationV2,ah),yield Oa(Ro.saveSSODomain,uh),yield Oa(Ro.deleteSSODomain,dh),yield Oa(Ro.validateSSODomainV2,yh),yield Oa(Ro.updateSSOConfiguration,lh),yield Oa(Ro.deleteSSOConfiguration,ch),yield Oa(Ro.setSSOGroups,ph),yield Oa(Ro.updateSSOGroups,gh),yield Oa(Ro.setSSODefaultRoles,fh),yield Oa(Ro.saveSSOConfigurationByMetadata,rh),yield Oa(Ro.updateSSOConfigurationByMetadata,sh),yield Oa(Ro.saveSSOConfigurationByUrl,Sh),yield Oa(Ro.saveSSOConfigurationByData,vh)}const mh=["callback","profilePictureUrl"],Ah=["callback","profilePictureUrl"];function*bh(){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,wf.teams.getProfile),t=yield Mi((e=>e.auth.user));Ro.setUser(U({},t,e)),yield wi(Ro.setProfileState({profile:e,loading:!1}))}catch(e){yield wi(Ro.setProfileState({loading:!1,error:Cp(e)}))}}function*Th(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,mh);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(wf.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 Ri(wf.users.updateUserProfileV2,a),l=yield Mi((e=>e.auth.user));yield wi(Ro.setUser(U({},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:Cp(e),loading:!1})),null==t||t(null,e)}}function*kh({payload:e}){yield wi(Ro.setProfileState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Eh(){yield wa(Ro.loadProfile,bh),yield Oa(Ro.saveProfile,Th),yield Oa(Ro.changePassword,kh)}function*Ih(){yield wi(Ro.setProfileState({loading:!0})),yield At(),yield wi(Ro.setUser(U({},np,tp))),yield wi(Ro.setProfileState({loading:!1,profile:tp}))}function*Ph(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ho(e.payload,Ah);yield wi(Ro.setProfileState({saving:!0,error:null}));const i=op;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=np;yield At(),yield wi(Ro.setUser(U({},l,r))),yield wi(Ro.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Lh({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*Oh(){yield wa(Ro.loadProfile,Ih),yield Oa(Ro.saveProfile,Ph),yield Oa(Ro.changePassword,Lh)}const _h=["callback"],wh=["callback"],Uh=["user"],Ch=["callback"],Rh=["deviceId","callback"],Dh=["deviceId","callback"],Nh=["callback"],Mh=["deviceId"],Fh=["deviceId"],Gh=["callback"],$h=["deviceId"],xh=["callback"];function*Vh(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*jh(){yield wi(Ro.setMfaState({saving:!0}));try{const{qrCode:e}=yield Ri(wf.auth.enrollMfa);yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)}))}}function*Bh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,_h);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Mi((e=>e.auth.user)),o=yield Ri(wf.auth.verifyMfa,n),i=yield Ri(wf.auth.getMFADevices),a=yield Vh(o);yield wi(Ro.setMfaState(U({},a,{mfaDevices:i}))),yield wi(Ro.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Wh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,wh);yield wi(Ro.setMfaState({loading:!0}));try{const e=yield Ri(wf.auth.loginWithMfaV2,n),{user:o}=e,i=Ho(e,Uh),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 LS(U({user:o},i)),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({loading:!1,error:Cp(e)})),null==t||t(null,e)}}function*Kh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;yield Ri(wf.auth.disableMfa,e);const n=yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Hh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t,n;const o=yield Ri(wf.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:kt(o.options.challenge),user:U({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},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:Cp(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*zh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ch);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(n.publicKey),o=yield Ri(wf.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield Ri(wf.auth.getMFADevices),a=yield Vh(o);yield wi(Ro.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*qh(e){let{payload:{deviceId:t,callback:n}}=e;Ho(e.payload,Rh),yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(wf.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},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:Cp(e)})),null==n||n(null,e)}}function*Yh(e){let{payload:{deviceId:t,callback:n}}=e,o=Ho(e.payload,Dh);yield wi(Ro.setMfaState({saving:!0}));try{const e=Et(o.publicKey);yield Ri(wf.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield Ri(wf.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:Cp(e)})),null==n||n(!1,e)}}function*Jh({payload:e}){yield wi(Ro.setMfaState({saving:!0}));try{var t;const n=yield Ri(wf.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:Cp(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Qh(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Nh);yield wi(Ro.setMfaState({saving:!0}));try{const e=yield Ri(wf.auth.enrollMFASMS,n),o=yield Ri(wf.auth.getMFADevices),i=yield Vh(e);yield wi(Ro.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield wi(Ro.setMfaState({saving:!1,error:Cp(e)})),null==t||t(null,e)}}function*Xh(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Mh);yield wi(Ro.setMfaState({saving:!0}));try{var o;const e=yield Ri(wf.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:Cp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Zh(e){let{payload:{deviceId:t}}=e,n=Ho(e.payload,Fh);yield wi(Ro.setMfaState({saving:!0}));try{var o;yield Ri(wf.auth.disableMFASMS,t,n);const e=yield Ri(wf.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:Cp(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*em(){yield wi(Ro.setMfaState({loading:!0}));try{yield Mi((e=>e.auth.user));const e=yield Ri(wf.auth.getMFADevices);yield wi(Ro.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield wi(Ro.setMfaState({loading:!1,error:Cp(e)}))}}function*tm(){yield wi(Ro.setMfaState({loading:!0}));try{const e=(yield Ri(wf.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:Cp(e)}))}}function*nm(){yield Oa(Ro.enrollMfa,jh),yield Oa(Ro.getMFADevices,em),yield Oa(Ro.getMFAStrategies,tm),yield Oa(Ro.verifyMfa,Bh),yield Oa(Ro.disableMfa,Kh),yield Oa(Ro.verifyMfaAfterForce,Wh),yield Oa(Ro.preDisableMfaSms,Xh),yield Oa(Ro.disableMfaSms,Zh),yield Oa(Ro.preEnrollMfaSms,Jh),yield Oa(Ro.enrollMfaSms,Qh),yield Oa(Ro.preEnrollMfaWebAuthn,Hh),yield Oa(Ro.enrollMfaWebAuthn,zh),yield Oa(Ro.preDisableMfaWebAuthn,qh),yield Oa(Ro.disableMfaWebAuthn,Yh)}function*om(){yield wi(Ro.setMfaState({saving:!0})),yield wi(Ro.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*im({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:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield wi(Ro.setMfaState(o)),yield wi(Ro.setUser(U({},np,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*am(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Gh);yield wi(Ro.setMfaState({loading:!0})),yield At();const o=U({},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(U({},np,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*rm({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:U({},n,{authenticators:[]})})),yield wi(Ro.setUser(U({},np))),null==(t=e.callback)||t.call(e,!0)}function*lm(e){let{}=e,t=Ho(e.payload,$h);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:Cp(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*sm({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:U({},n,{phones:[]})})),yield wi(Ro.setUser(U({},np))),null==(t=e.callback)||t.call(e,!0)}function*cm({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*um(e){let{payload:{callback:t}}=e;Ho(e.payload,xh);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:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield wi(Ro.setMfaState(i)),yield wi(Ro.setUser(U({},np,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*dm(){yield Oa(Ro.enrollMfa,om),yield Oa(Ro.verifyMfa,im),yield Oa(Ro.disableMfa,rm),yield Oa(Ro.verifyMfaAfterForce,am),yield Oa(Ro.preDisableMfaSms,lm),yield Oa(Ro.disableMfaSms,sm),yield Oa(Ro.preEnrollMfaSms,cm),yield Oa(Ro.enrollMfaSms,um)}const ym=["callback"];function*fm({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{var t;yield Ri(wf.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:Cp(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*pm(e){let{payload:{callback:t}}=e,n=Ho(e.payload,ym);yield wi(Ro.setForgotPasswordState({loading:!0}));try{yield Ri(wf.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:Cp(e)})),null==t||t(!1,e)}}function*gm({payload:e}){yield wi(Ro.setForgotPasswordState({loading:!0}));try{const t=yield Ri(wf.auth.loadPasswordConfig,e);yield wi(Ro.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield wi(Ro.setForgotPasswordState({loading:!1,error:Cp(e)}))}}function*Sm(){yield wa(Ro.forgotPassword,fm),yield wa(Ro.resetPassword,pm),yield wa(Ro.loadPasswordConfig,gm)}let vm;!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"}(vm||(vm={}));const hm=["callback","events"],mm=["user"],Am=["callback"],bm=["callback"];function*Tm({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(wf.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:Cp(e)}))}}function*km(e){let{payload:{callback:t,events:n}}=e,o=Ho(e.payload,hm);yield wi(Ro.setActivateState({loading:!0}));try{const e=Ua.onRedirectTo,{routes:a}=yield Mi((e=>e.auth)),r=yield Ri(wf.auth.activateAccountV2,o),{user:l}=r,s=Ho(r,mm);if(l.redirectLocation)return void(window.location.href=l.redirectLocation);if(Fp(l)){yield wi(Ro.setActivateState({step:Ft.success}));const t=yield US(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:_p.ACTIVATION_LINK,id:l.id,tenantId:l.tenantId,name:l.name,createdAt:new Date}),yield Ri(LS,U({user:l},s),{isAuthenticated:!0}),yield Fi(1e3),yield OS(),yield wi(Ro.resetActivateState())}null==t||t(!0)}catch(e){yield wi(Ro.setActivateState({loading:!1,error:Cp(e)}))}}function*Em({payload:e}){const{callback:t}=e,n=Ho(e,Am);yield wi(Ro.setActivateStrategyState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)}))}}function*Im({payload:e}){const{callback:t}=e,n=Ho(e,bm);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.email})),yield wi(Ro.setActivateState({loading:!0}));try{yield Ri(wf.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:Cp(e)})),yield wi(Ro.setTeamError({key:vm.RESEND_ACTIVATE_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*Pm(){yield wa(Ro.activateAccount,km),yield wa(Ro.preActivateAccount,Tm),yield wa(Ro.getActivateAccountStrategy,Em),yield wa(Ro.resendActivationEmail,Im)}function*Lm({payload:e}){if(e.token&&e.userId)try{yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.pending})),yield Ri(wf.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:Cp(e)}))}else yield wi(Ro.setAcceptInvitationState({error:void 0,step:Vt.invalid}))}function*Om(){yield wa(Ro.acceptInvitation,Lm)}var _m,wm=new Uint8Array(16);function Um(){if(!_m&&!(_m="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 _m(wm)}for(var Cm=/^(?:[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,Rm=function(e){return"string"==typeof e&&Cm.test(e)},Dm=[],Nm=0;Nm<256;++Nm)Dm.push((Nm+256).toString(16).substr(1));var Mm=function(e,t,n){var o=(e=e||{}).random||(e.rng||Um)();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=(Dm[e[t+0]]+Dm[e[t+1]]+Dm[e[t+2]]+Dm[e[t+3]]+"-"+Dm[e[t+4]]+Dm[e[t+5]]+"-"+Dm[e[t+6]]+Dm[e[t+7]]+"-"+Dm[e[t+8]]+Dm[e[t+9]]+"-"+Dm[e[t+10]]+Dm[e[t+11]]+Dm[e[t+12]]+Dm[e[t+13]]+Dm[e[t+14]]+Dm[e[t+15]]).toLowerCase();if(!Rm(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let Fm,Gm;!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"}(Fm||(Fm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Gm||(Gm={}));const $m=["callback"],xm=["roles"],Vm=["callback"],jm=["callback","profileImage"],Bm=["callback"],Wm=["callback","userId"],Km=["callback"],Hm=["callback"],zm=["callback"],qm=["callback"],Ym=["callback"],Jm=["callback"],Qm=["callback"],Xm=["callback","profileImage"],Zm=["callback"],eA=["callback"],tA=["callback"],nA=["callback"],oA=["callback"],iA=["callback"],aA=()=>Mi((e=>e.auth.teamState));function*rA(){try{const{groups:e}=yield Ri(wf.groups.getGroups,{_groupsRelations:Gm.roles});return e}catch(e){return[]}}function*lA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.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 Ui([Ri(wf.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})),Ri(wf.teams.loadAvailableRoles),Ri(wf.teams.loadAvailablePermissions),Ri(rA)]),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 wi(Ro.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 wi(Ro.setTeamError({key:vm.USERS,value:Cp(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*sA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield aA(),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:vm.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 Ui([Ri(wf.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.USERS,value:e.message})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*cA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.USERS,value:!r})),yield wi(Ro.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Ui([Ri(wf.subTenants.loadAllUsers,U({},c)),Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.USERS,value:Cp(e)})),yield wi(Ro.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1}))}function*uA({payload:e}){yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Ui([Ri(wf.teams.loadAvailableRoles),Ri(wf.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:vm.ROLES_AND_PERMISSIONS,value:Cp(t)}))}yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0}))}function*dA({payload:e}){const{callback:t}=e,n=Ho(e,$m),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield Ri(wf.teams.addUser,n),{roles:a}=e,r=U({},Ho(e,xm),{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:U({},o.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*yA({payload:e}){const{callback:t}=e,n=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},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(wf.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*fA({payload:e}){const{callback:t}=e,n=Ho(e,Vm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield Ri(wf.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield Ri(wf.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:U({},o.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*pA({payload:e}){const{callback:t}=e,n=Ho(e,jm),{id:o}=n,i=yield aA(),a=i.users.find((e=>e.id===n.id));yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:o||""})),yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield wi(Ro.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 Ri(wf.teams.updateUser,n);null==t||t(e),yield wi(Ro.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 wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1}))}catch(e){yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Cp(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*gA({payload:e}){const{callback:t}=e,n=Ho(e,Bm),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(wf.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:U({},o.deleteUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*SA({payload:e}){const{callback:t,userId:n}=e,o=Ho(e,Wm),i=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield Ri(wf.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 wi(Ro.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 wi(Ro.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*vA({payload:e}){const{callback:t}=e,n=Ho(e,Km),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield Ri(wf.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:U({},o.deleteUserDialogState,{loading:!1,error:Cp(e)})})),null==t||t(null,e)}}function*hA({payload:e}){const{callback:t}=e,n=Ho(e,Hm);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Ri(wf.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_ACTIVATE_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*mA({payload:e}){const{callback:t}=e,n=Ho(e,zm);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*AA({payload:e}){const{callback:t}=e,n=Ho(e,qm);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*bA({payload:e}){const{callback:t}=e,n=Ho(e,Ym);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email}));try{yield Ri(wf.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.RESEND_INVITATION_LINK,value:Cp(e)})),null==t||t(null,e)}yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*TA(){yield wi(Ro.setTeamError({key:vm.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Ri(wf.teams.getInviteLinkConfiguration);yield wi(Ro.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield wi(Ro.setTeamError({key:vm.CONFIG_TOKEN_LINK,value:Cp(e)}))}}function*kA(){yield wi(Ro.setTeamError({key:vm.GET_TOKEN_LINK,value:!1}));try{yield Ri(TA);const e=yield Ri(wf.teams.getInviteUserLink),{inviteTokenState:t}=yield aA();yield wi(Ro.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield wi(Ro.setTeamError({key:vm.GET_TOKEN_LINK,value:Cp(e)}))}}function*EA({payload:{callback:e}}){yield wi(Ro.setTeamError({key:vm.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield aA();try{const n=yield Ri(wf.teams.createInviteUserLink,{expiresInMinutes:43200});yield wi(Ro.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:vm.CREATE_TOKEN_LINK,value:Cp(t)}))}}function*IA({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield aA();yield wi(Ro.setTeamError({key:vm.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield Ri(wf.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield wi(Ro.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield wi(Ro.setTeamError({key:vm.UPDATE_TOKEN_LINK,value:Cp(t)}))}}function*PA({payload:e}){const{callback:t}=null!=e?e:{};yield wi(Ro.setTeamError({key:vm.DELETE_TOKEN_LINK,value:!1}));try{yield Ri(wf.teams.deleteInviteUserLink),yield wi(Ro.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield wi(Ro.setTeamError({key:vm.DELETE_TOKEN_LINK,value:Cp(e)})),null==t||t(!1,e)}}function*LA({payload:e}){yield wi(Ro.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*OA({payload:e}){const t=yield aA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_A({payload:e}){yield wi(Ro.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*wA({payload:e}){const t=yield aA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield wi(Ro.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*UA(){yield _a(Ro.loadUsers,sA),yield _a(Ro.loadUsersV2,lA),yield _a(Ro.loadAllSubTenantsUsers,cA),yield _a(Ro.loadRoles,uA),yield Oa(Ro.addUser,dA),yield Oa(Ro.addUsersBulk,yA),yield Oa(Ro.addUserToSubTenants,fA),yield Oa(Ro.updateUser,pA),yield Oa(Ro.setUserRolesForSubTenants,SA),yield Oa(Ro.deleteUser,gA),yield Oa(Ro.deleteUserFromSubTenants,vA),yield Oa(Ro.resendActivationLink,hA),yield Oa(Ro.resendInvitationLink,mA),yield Oa(Ro.resendInvitationEmail,AA),yield Oa(Ro.resendInvitationLinkToAllSubTenants,bA),yield Oa(Ro.getInvitationLink,kA),yield Oa(Ro.createInvitationLink,EA),yield Oa(Ro.updateInvitationLink,IA),yield Oa(Ro.deleteInvitationLink,PA),yield Oa(Ro.openAddUserDialog,LA),yield Oa(Ro.closeAddUserDialog,OA),yield Oa(Ro.openDeleteUserDialog,_A),yield Oa(Ro.closeDeleteUserDialog,wA)}function*CA({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield aA(),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:vm.USERS,value:!a})),yield wi(Ro.setTeamState({pageSize:s,pageOffset:c,filterV2:u,sortV2:d})),yield At(),yield wi(Ro.setTeamState({users:vp,totalPages:2,totalItems:10,roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1})),null==r||r(vp)}function*RA({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield aA(),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:vm.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:hp,totalPages:2,totalItems:10,roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.USERS,value:!1})),null==l||l(hp)}function*DA({payload:e}){var t;yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0})),yield At(),yield wi(Ro.setTeamState({roles:dp,permissions:fp})),yield wi(Ro.setTeamLoader({key:vm.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:dp,permissions:fp})}function*NA({payload:e}){const{callback:t}=e,n=Ho(e,Jm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield At();const i=U({},gp,{groups:[]},n,{id:`${Mm()}`});null==t||t(i),yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*MA({payload:e}){const{callback:t}=e,n=Ho(e,Qm),o=yield aA();yield wi(Ro.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield At();const i=U({},gp,n,{id:`${Mm()}`});yield wi(Ro.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*FA({payload:e}){var t;const{callback:n}=e,o=Ho(e,Xm),{id:i}=o,a=yield aA(),r=a.users.find((e=>e.id===o.id));yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:i||""})),yield wi(Ro.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield wi(Ro.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 At();const l=U({},r,o);null==n||n(l),yield wi(Ro.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield wi(Ro.setTeamLoader({key:vm.UPDATE_USER,value:!1}))}function*GA({payload:e}){const{callback:t}=e,n=Ho(e,Zm),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},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*$A({payload:e}){const{callback:t}=e,n=Ho(e,eA),o=yield aA();yield wi(Ro.setTeamState({deleteUserDialogState:U({},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*xA({payload:e}){const{callback:t}=e,n=Ho(e,tA);yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:n.userId})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_ACTIVATE_LINK,value:!1}))}function*VA({payload:e}){const{callback:t}=e,n=Ho(e,nA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*jA({payload:e}){const{callback:t}=e,n=Ho(e,oA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*BA({payload:e}){const{callback:t}=e,n=Ho(e,iA);yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:n.email})),yield At(),null==t||t(!0),yield wi(Ro.setTeamLoader({key:vm.RESEND_INVITATION_LINK,value:!1}))}function*WA(){yield _a(Ro.loadUsersV2,CA),yield _a(Ro.loadAllSubTenantsUsers,RA),yield _a(Ro.loadRoles,DA),yield Oa(Ro.addUser,NA),yield Oa(Ro.addUserToSubTenants,MA),yield Oa(Ro.updateUser,FA),yield Oa(Ro.deleteUser,GA),yield Oa(Ro.deleteUserFromSubTenants,$A),yield Oa(Ro.resendActivationLink,xA),yield Oa(Ro.resendInvitationLink,VA),yield Oa(Ro.resendInvitationEmail,jA),yield Oa(Ro.resendInvitationLinkToAllSubTenants,BA),yield Oa(Ro.openAddUserDialog,LA),yield Oa(Ro.closeAddUserDialog,OA),yield Oa(Ro.openDeleteUserDialog,_A),yield Oa(Ro.closeDeleteUserDialog,wA)}const KA=["authorizationUrl"],HA=["events","url"];function*zA(){try{yield wi(Ro.setSocialLoginsState({loading:!0}));const e=yield Ri(wf.auth.getSocialLoginProviders);yield wi(Ro.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({error:Cp(e),loading:!1,firstLoad:!1}))}}function*qA(){const e=yield Mi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Ri(wf.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Ri(wf.auth.getSocialLoginProvidersV2),t}function*YA(){try{const e=yield Mi((e=>e.root.context));yield wi(Ro.setSocialLoginsState({loading:!0}));const t=yield Ri(qA),{providers:n}=yield Ri(wf.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ho(t,KA);const i=vr(e,null!=n?n:"");return U({},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:Cp(e),loading:!1,firstLoad:!1}))}}function*JA(e){let{payload:{events:t,url:n}}=e,o=Ho(e.payload,HA);try{yield wi(Ro.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Ri(wf.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:_p.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(NS):yield Ri(FS)}(),localStorage.removeItem("register-quick-login"),yield wi(Ro.setSocialLoginsState({loading:!1}))}catch(e){yield wi(Ro.setSocialLoginsState({loading:!1,error:Cp(e,"Failed to authenticate"),firstLoad:!1}))}}function*QA({payload:e}){yield wi(Ro.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*XA(){yield wa(Ro.loadSocialLoginsConfiguration,zA),yield wa(Ro.loadSocialLoginsConfigurationV2,YA),yield wa(Ro.loginViaSocialLogin,JA),yield _a(Ro.setSocialLoginError,QA)}let ZA;function*eb({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:ZA.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Ri(wf.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Ri(wf.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:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield wi(Ro.setApiTokensError({key:ZA.ADD_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*tb({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:ZA.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield Ri(wf.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Ri(wf.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:ZA.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield wi(Ro.setApiTokensError({key:ZA.ADD_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*nb({payload:e}){const{apiTokensDataUser:t}=yield Mi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!0})),n?(yield Ri(wf.auth.deleteUserAccessToken,{id:e}),yield wi(Ro.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Ri(wf.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:ZA.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:ZA.DELETE_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}}function*ob({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:ZA.DELETE_API_TOKEN,value:!0})),n?(yield Ri(wf.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield Ri(wf.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:ZA.DELETE_API_TOKEN,value:!1}))}catch(e){yield wi(Ro.setApiTokensError({key:ZA.DELETE_API_TOKEN,value:Cp(e)})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}}function*ib({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Ui([Ri(wf.auth.getUserApiTokensData),Ri(wf.auth.getTenantApiTokensData)]);yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*ab({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(wf.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=Ri(wf.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:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*rb({payload:e}){null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=Ri(wf.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Ri(wf.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:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield wi(Ro.setApiTokensError({key:ZA.LOAD_API_TOKENS,value:Cp(t)})),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*lb(){yield wa(Ro.loadApiTokens,ib),yield wa(Ro.loadUserApiTokens,ab),yield wa(Ro.loadTenantApiTokens,rb),yield Oa(Ro.addUserApiToken,eb),yield Oa(Ro.addTenantApiToken,tb),yield _a(Ro.deleteTenantApiToken,ob),yield _a(Ro.deleteUserApiToken,nb)}function*sb({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield wi(Ro.setApiTokensLoader({key:ZA.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield Mi((e=>e.auth.apiTokensState)),a=U({},Zf,{description:t,roleIds:n,clientId:`CLIENT_ID_${Mm()}`});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:ZA.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*cb({payload:e}){yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!0})),yield Fi(200);const t=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield wi(Ro.setApiTokensLoader({key:ZA.DELETE_API_TOKEN,value:!1}))}function*ub({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Xf],o=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*db({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Xf];yield wi(Ro.setApiTokensState({apiTokensDataUser:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yb({payload:e}){var t;null!=e&&e.silentLoading||(yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!0})));const n=[Zf];yield wi(Ro.setApiTokensState({apiTokensDataTenant:n})),yield Fi(200),yield wi(Ro.setApiTokensLoader({key:ZA.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fb(){yield wa(Ro.loadApiTokens,ub),yield wa(Ro.loadUserApiTokens,db),yield wa(Ro.loadTenantApiTokens,yb),yield Oa(Ro.addTenantApiToken,sb),yield _a(Ro.deleteTenantApiToken,cb)}function*pb({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(wf.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield wi(Ro.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield wi(Ro.setAccountSettingsState({loading:!1,error:Cp(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*gb({payload:e}){yield wi(Ro.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Ri(wf.accountSettings.getSettings);yield wi(Ro.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield wi(Ro.setAccountSettingsState({loading:!1,error:Cp(e)}))}}function*Sb(){yield wa(Ro.saveAccountSettings,pb),yield wa(Ro.loadAccountSettings,gb)}function*vb({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=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield wi(Ro.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*hb({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*mb(){yield wa(Ro.saveAccountSettings,vb),yield wa(Ro.loadAccountSettings,hb)}function*Ab({payload:{tenantId:e,callback:t}}){yield wi(Ro.setState({isLoading:!0}));try{yield Ri(wf.tenants.switchTenant,{tenantId:e}),yield Ri(RS),(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*bb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*Tb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*kb({payload:e}){yield wi(Ro.setTenantsState({loading:!0}));try{var t;const n=yield Ri(wf.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*Eb(){yield Oa(Ro.loadTenants,bb),yield Oa(Ro.loadSubTenants,Tb),yield Oa(Ro.switchTenant,Ab),yield Oa(Ro.loadSubTenantsTree,kb)}function*Ib(){yield wi(Ro.setTenantsState({loading:!0})),yield At(),yield wi(Ro.setTenantsState({tenants:mp,activeTenant:mp[0],loading:!1}))}function*Pb(){yield Oa(Ro.loadTenants,Ib)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(ZA||(ZA={}));const Lb=["callback"],Ob=["callback"],_b=["callback"],wb=["callback"],Ub=["callback"];function*Cb({payload:e}){var t;yield wi(Ro.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Ui([Ri(wf.roles.getRoles),Ri(wf.roles.getPermissions),Ri(wf.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:Cp(e),loading:!1}))}}function*Rb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Lb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.roles.addRole,n),o=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Db(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ob);yield wi(Ro.setRolesState({saving:!0}));try{yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(!1,e)}}function*Nb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,_b);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Mb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,wb);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Fb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Ub);yield wi(Ro.setRolesState({saving:!0}));try{const e=yield Ri(wf.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:Cp(e),saving:!1})),null==t||t(null,e)}}function*Gb(){yield wa(Ro.loadRolesAndPermissions,Cb),yield Oa(Ro.addRole,Rb),yield Oa(Ro.deleteRole,Db),yield Oa(Ro.updateRole,Nb),yield Oa(Ro.attachPermissionsToRole,Mb),yield Oa(Ro.attachPermissionToRoles,Fb)}function*$b({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:ep,loading:!1}))}catch(e){yield wi(Ro.setRolesState({error:Cp(e),loading:!1}))}}function*xb(){yield wa(Ro.loadRolesAndPermissions,$b)}const Vb=["callback"],jb=["callback"],Bb=["callback"];function*Wb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Vb);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*Kb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,jb);yield wi(Ro.setResetPhoneNumberState({loading:!0}));try{const e=yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*Hb(e){let{payload:{callback:t}}=e,n=Ho(e.payload,Bb);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(wf.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:Cp(e)})),null==t||t(null,e)}}function*zb(){yield wa(Ro.resetPhoneNumber,Wb),yield wa(Ro.verifyResetPhoneNumber,Kb),yield wa(Ro.changePhoneNumber,Hb)}function*qb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCurrentUserSessions);yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Yb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getCurrentUserSession);yield wi(Ro.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Jb({payload:{id:e}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.deleteSessionForUser,e),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Qb({payload:{callback:e,userId:t}}){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield wi(Ro.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Xb(){yield wi(Ro.setSessionsState({loading:!0,error:null}));try{yield Ri(wf.auth.deleteAllSessionsForUser),yield wi(Ro.loadUserSessions())}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*Zb(){yield _a(Ro.loadUserSessions,qb),yield _a(Ro.deleteUserSession,Jb),yield _a(Ro.deleteAllUserSessions,Xb),yield _a(Ro.loadCurrentUserSession,Yb),yield Oa(Ro.revokeUserSessions,Qb)}function*eT(){yield wi(Ro.setSessionsState({loading:!0,error:null})),yield wi(Ro.setSessionsState({sessions:Ap,loading:!1}))}function*tT({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*nT(){yield wi(Ro.setSessionsState({loading:!0,error:null}));const e=Ap.filter((e=>e.current));yield wi(Ro.setSessionsState({sessions:e,loading:!1}))}function*oT(){yield _a(Ro.loadUserSessions,eT),yield _a(Ro.deleteUserSession,tT),yield _a(Ro.deleteAllUserSessions,nT)}const iT=["callback"],aT=["callback"];function*rT(){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getSessionConfigurations);yield wi(Ro.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield wi(Ro.setSessionsState({error:e,loading:!1}))}}function*lT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ho(e,iT);yield Ri(wf.auth.createOrUpdateSessionConfigrations,n),yield wi(Ro.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield wi(Ro.setSessionsPolicyState({error:e,loading:!1}))}}function*sT(){yield wa(Ro.loadSessionsPolicy,rT),yield _a(Ro.createOrUpdateSessionsPolicy,qp(lT))}function*cT(){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:bp}));yield wi(Ro.setSessionsPolicyState(U({},e,{loading:!1})))}function*uT({payload:e}){yield wi(Ro.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ho(e,aT);null==t||t(!0),yield wi(Ro.setSessionsPolicyState({configurations:n,loading:!1}))}function*dT(){yield wa(Ro.loadSessionsPolicy,cT),yield _a(Ro.createOrUpdateSessionsPolicy,uT)}const yT=["callback"],fT=["callback"],pT=["callback"],gT=["callback"],ST=["callback"],vT=["callback"],hT=["callback"],mT=["callback"],AT=()=>Mi((e=>e.auth.restrictionsState.ipRestrictions)),bT=()=>Mi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*TT(){yield wi(Ro.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Ri(wf.auth.getDomainRestrictionsConfig),t=(yield Ri(wf.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:Cp(e),loading:!1}))}}function*kT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,yT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield bT();try{var i;yield Ri(wf.auth.createDomainRestriction,n);const e=(yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*ET(e){let{payload:{callback:t}}=e,n=Ho(e.payload,fT);yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Ri(wf.auth.updateDomainRestrictionConfig,n),o=(yield Ri(wf.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:Cp(e)})),null==t||t(null,e)}}function*IT({payload:{id:e}}){yield wi(Ro.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield bT();try{var n;yield Ri(wf.auth.deleteDomainRestriction,e);const o=(yield Ri(wf.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:Cp(e)}))}}const PT=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*LT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield AT(),t=yield Ri(wf.auth.getIPRestrictionsConfig),n=PT({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield Ri(wf.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:Cp(e),loading:!1}))}}function*OT(){try{const{valid:e}=yield Ri(wf.auth.testCurrentIpInAllowList);yield wi(Ro.setIpRestrictionsState({userIpValid:e}))}catch(e){yield wi(Ro.setIpRestrictionsState({error:Cp(e)}))}}function*_T({payload:{callback:e}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Mi((e=>e.auth.userIp));yield Ui([Ri(wf.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Vn.ALLOW}),Ri(wf.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield AT(),o=PT(n.pagination),{items:i,_metadata:{totalPages:a}}=yield Ri(wf.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*wT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,pT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield AT();try{var i,a;yield Ri(wf.auth.createIPRestriction,n);const e=yield AT(),r=PT(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Ri(wf.auth.getIPRestrictions,r);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*UT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,gT);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));try{yield Ri(wf.auth.updateIPRestrictionConfig,n);const e=yield AT(),o=yield Ri(wf.auth.getIPRestrictionsConfig),i=PT(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield Ri(wf.auth.getIPRestrictions,i);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*CT({payload:{id:e,callback:t}}){yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const n=yield AT();try{var o;yield Ri(wf.auth.deleteIPRestriction,e);const i=yield AT(),a=PT(i.pagination),{items:r,_metadata:{totalPages:l}}=yield Ri(wf.auth.getIPRestrictions,a);yield OT(),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:Cp(e)})),null==t||t(null,e)}}function*RT(){yield wa(Ro.loadIpRestrictions,qp(LT)),yield wa(Ro.loadEmailDomainRestrictions,qp(TT)),yield Oa(Ro.saveIpRestriction,qp(wT)),yield Oa(Ro.saveIpRestrictionsConfig,qp(UT)),yield Oa(Ro.deleteIpRestriction,qp(CT)),yield Oa(Ro.checkIfUserIpValid,qp(OT)),yield Oa(Ro.addCurrentUserIpAndActivate,qp(_T)),yield Oa(Ro.saveEmailDomainRestriction,qp(kT)),yield Oa(Ro.saveEmailDomainRestrictionsConfig,qp(ET)),yield Oa(Ro.deleteEmailDomainRestriction,qp(IT))}function*DT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null})),yield wi(Ro.setIpRestrictionsState({data:{restrictions:kp.filter((e=>e.strategy===Tp.strategy)),config:Tp},totalPages:1,pagination:{_filter:Vn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*NT(){yield wi(Ro.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield AT(),t=kp[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:Cp(e),loading:!1}))}}function*MT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,ST);yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const r=yield AT(),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,U({},a,{createdAt:new Date,updatedAt:new Date,id:Mm(),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*FT(e){var t,n,o;let{payload:{callback:i}}=e,a=Ho(e.payload,vT);const r=yield AT();yield wi(Ro.setIpRestrictionsState({saving:!0,error:null})),yield wi(Ro.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:Vn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield wi(Ro.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*GT({payload:{id:e,callback:t}}){var n;yield wi(Ro.setIpRestrictionsState({saving:!0,error:null}));const o=yield AT();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*$T(){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*xT(e){var t,n;let{payload:{callback:o}}=e,i=Ho(e.payload,hT);const a=yield bT();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)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*VT(e){var t;let{payload:{callback:n}}=e,o=Ho(e.payload,mT);const i=yield bT();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*jT({payload:{id:e}}){var t,n;const o=yield bT();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*BT(){yield wa(Ro.loadIpRestrictions,DT),yield wa(Ro.loadEmailDomainRestrictions,$T),yield Oa(Ro.saveIpRestriction,MT),yield Oa(Ro.saveIpRestrictionsConfig,FT),yield Oa(Ro.deleteIpRestriction,GT),yield Oa(Ro.checkIfUserIpValid,NT),yield Oa(Ro.saveEmailDomainRestriction,xT),yield Oa(Ro.saveEmailDomainRestrictionsConfig,VT),yield Oa(Ro.deleteEmailDomainRestriction,jT)}const WT=["callback"],KT=["id"];function*HT(e){const{count:t}=yield Ri(wf.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*zT(){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(wf.directory.getConfigs),t=yield Ui(e.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:t,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*qT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,WT);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{const e=yield Ri(wf.directory.createConfiguration,n),o=yield Ri(wf.directory.getConfigs),i=yield Ui(o.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*YT(e){let{payload:{id:t}}=e,n=Ho(e.payload,KT);yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(wf.directory.updateConfiguration,t,n);const e=yield Ri(wf.directory.getConfigs),o=yield Ui(e.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1}))}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1}))}}function*JT({payload:{id:e,callback:t}}){yield wi(Ro.setProvisioningState({loading:!0,error:null}));try{yield Ri(wf.directory.deleteConfiguration,e);const n=yield Ri(wf.directory.getConfigs),o=yield Ui(n.map((e=>HT(e))));yield wi(Ro.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield wi(Ro.setProvisioningState({error:Cp(e),loading:!1})),null==t||t(!1,e)}}function*QT(){yield wa(Ro.loadProvisionConnections,zT),yield Oa(Ro.createProvisionConnection,qT),yield Oa(Ro.deleteProvisionConnection,JT),yield Oa(Ro.updateProvisionConnection,YT)}const XT=["callback","events"];function*ZT(e){let{payload:{callback:t}}=e,n=Ho(e.payload,XT);yield wi(Ro.setImpersonateState({loading:!0}));try{yield Ri(wf.impersonate.impersonate,n),yield wi(Ro.setImpersonateState({step:Lo.success})),yield Fi(1e3),yield OS(),yield wi(Ro.resetImpersonateState()),null==t||t(!0)}catch(e){yield wi(Ro.setImpersonateState({loading:!1,error:Cp(e)}))}}function*ek(){yield wa(Ro.impersonate,ZT)}function*tk({payload:e}){const{callback:t,deviceId:n}=e;yield wi(Ro.setPasskeysState({loading:!0}));try{yield Ri(wf.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:Cp(e,null)})),null==t||t(null,e)}}function*nk(){yield wi(Ro.setPasskeysState({loading:!0}));try{const{devices:e}=yield Ri(wf.auth.getWebAuthnDevices);yield wi(Ro.setPasskeysState({devices:e,loading:!1}))}catch(e){yield wi(Ro.setPasskeysState({loading:!1,error:Cp(e,null)}))}}function*ok(){yield Oa(Ro.loadWebAuthnDevices,nk),yield Oa(Ro.deleteWebAuthnDevice,tk)}const ik=["roleIds","userIds"],ak=()=>Mi((e=>e.auth.groupsState));function*rk({payload:e}){const t=Fm.GET_TEAM_USERS;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*lk({payload:e}){const t=Fm.GET_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Ri(wf.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Gm.rolesAndUsers});yield wi(Ro.setGroupsState({selectedGroup:n}))}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*sk(){const e=Fm.GET_GROUPS,t=yield ak();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Ri(wf.groups.getGroups,{_groupsRelations:Gm.rolesAndUsers});yield wi(Ro.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 wi(Ro.setUsersGroupsError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*ck({payload:e}){const t=Fm.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ho(e,ik);yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Ri(wf.groups.createGroup,U({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:Cp(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=Fm.UPDATE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=Fm.DELETE_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=Fm.ADD_ROLES_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=Fm.DELETE_ROLES_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(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=Fm.ADD_USERS_TO_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=Fm.DELETE_USERS_FROM_GROUP;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Ri(wf.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:Cp(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk(){const e=Fm.GET_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Ri(wf.groups.getGroupConfiguration);yield wi(Ro.setGroupsState({groupsConfiguration:t}))}catch(t){yield wi(Ro.setUsersGroupsError({key:e,value:Cp(t)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}}function*vk({payload:e}){const t=Fm.UPDATE_GROUP_CONFIGURATION;yield wi(Ro.setUsersGroupsLoader({key:t,value:!0}));try{yield Ri(wf.groups.updateGroupConfiguration,e),yield wi(Ro.getGroupConfiguration())}catch(e){yield wi(Ro.setUsersGroupsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){yield _a(Ro.loadGroups,sk),yield _a(Ro.getGroupById,lk),yield _a(Ro.createGroup,ck),yield _a(Ro.updateGroup,uk),yield _a(Ro.deleteGroup,dk),yield _a(Ro.addRolesToGroup,yk),yield _a(Ro.deleteRolesFromGroup,fk),yield _a(Ro.addUsersToGroup,pk),yield _a(Ro.deleteUsersFromGroup,gk),yield _a(Ro.getGroupConfiguration,Sk),yield _a(Ro.updateGroupConfiguration,vk),yield _a(Ro.getTeamUsers,rk)}function*mk(){const e=Fm.GET_GROUPS;yield wi(Ro.setUsersGroupsLoader({key:e,value:!0}));const t=Pp;yield wi(Ro.setGroupsState({groups:t})),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Ak({payload:e}){var t;const n=Fm.CREATE_GROUP,{groups:o}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:n,value:!0})),yield wi(Ro.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Ef.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*bk({payload:e}){var t,n,o,i,a;const r=Fm.UPDATE_GROUP,l=yield ak();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?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Ef.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 Fi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield wi(Ro.setUsersGroupsLoader({key:r,value:!1}))}function*Tk({payload:e}){var t,n;const o=Fm.DELETE_GROUP,i=yield ak();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*kk({payload:e}){var t,n;const o=Fm.ADD_ROLES_TO_GROUP,i=yield ak();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?U({},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*Ek({payload:e}){var t,n;const o=Fm.DELETE_ROLES_FROM_GROUP,i=yield ak();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?U({},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*Ik({payload:e}){var t,n;const o=Fm.ADD_USERS_TO_GROUP,i=yield ak();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?U({},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*Pk({payload:e}){var t,n;const o=Fm.DELETE_USERS_FROM_GROUP,i=yield ak();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?U({},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*Lk(){const e=Fm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:e,value:!0})),t&&(yield wi(Ro.setGroupsState({groupsConfiguration:U({},t)}))),yield wi(Ro.setUsersGroupsLoader({key:e,value:!1}))}function*Ok({payload:e}){const t=Fm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield ak();yield wi(Ro.setUsersGroupsLoader({key:t,value:!0})),n&&(yield wi(Ro.setGroupsState({groupsConfiguration:U({},n,e)}))),yield wi(Ro.setUsersGroupsLoader({key:t,value:!1}))}function*_k(){yield _a(Ro.loadGroups,mk),yield _a(Ro.createGroup,Ak),yield _a(Ro.updateGroup,bk),yield _a(Ro.deleteGroup,Tk),yield _a(Ro.addRolesToGroup,kk),yield _a(Ro.deleteRolesFromGroup,Ek),yield _a(Ro.addUsersToGroup,Ik),yield _a(Ro.deleteUsersFromGroup,Pk),yield _a(Ro.getGroupConfiguration,Lk),yield _a(Ro.updateGroupConfiguration,Ok)}let wk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(wk||(wk={}));const Uk=(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=>Uk(e,t,n))))?o:[]})};function Ck(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Ck(e,t))):[]})}function Rk(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=>Rk(e,t,n))))?o:[]})}const Dk=({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}})),Nk=()=>Mi((e=>e.auth.allAccountsState));function*Mk({payload:e}){const t=wk.GET_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Nk(),{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 Nk(),{items:n,_links:i}=yield Ri(wf.tenants.searchSubTenants,r,{jwt:o}),a=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:o}),s=Dk({items:n},a),c=Rk(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 Nk(),{items:n,_links:o}=yield Ri(wf.tenants.searchSubTenants,r),i=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Dk({items:n},i),l=Rk(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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Fk({payload:e}){const t=wk.SEARCH_ACCOUNTS;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield Nk(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=wk.GET_USER_JWT;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e;try{const e=yield Ri(wf.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:Cp(e)})),yield wi(Ro.setSelectedAccountState({accessPermission:!1})),null==o||o(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=wk.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 Nk(),{selectedAccount:t}=yield Nk(),r=yield Ri(wf.subTenants.createSubTenant,{name:n,parentTenantId:o,tenantId:i},{jwt:a}),l=Rk(e,null!=o?o:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),s=Rk(U({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 Nk(),t=yield Ri(wf.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:o}),a=Rk(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:Cp(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=wk.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 Nk();yield Ri(wf.subTenants.deleteSubTenant,o,{jwt:n});const i=Ck(t,o),a=Ck(null==e?void 0:e.accounts,o);yield wi(Ro.setAllAccountsState({accounts:i})),yield wi(Ro.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield Nk();yield Ri(wf.subTenants.deleteSubTenant,o);const t=Ck(e,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=wk.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 Nk();yield Ri(wf.subTenants.updateSubTenant,{tenantId:a},{name:o},{jwt:n});const i=Uk(e.accounts,a,o);yield wi(Ro.setSelectedAccountState({name:o,accounts:i}));const r=Uk(t,a,o);yield wi(Ro.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Nk();yield Ri(wf.subTenants.updateSubTenant,{tenantId:a},{name:o});const t=Uk(e,a,o);yield wi(Ro.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==i||i(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=wk.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(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=wk.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 Nk();try{yield Ri(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=wk.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(wf.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:Cp(e)})),null==a||a(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield wi(Ro.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Nk(),{userId:o,allowAccess:i,jwt:a,callback:r}=e;try{var l;yield Ri(wf.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?U({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)})),null==r||r(!1)}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){var t,n,o,i,a,r,l,s;const c=wk.GET_ACCOUNT_USERS;yield wi(Ro.setAllAccountsLoader({key:c,value:!0}));const u=yield Nk(),{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 Ri(wf.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 Ri(wf.roles.getRoles),i=yield Ri(wf.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 wi(Ro.setSelectedAccountState(U({users:a},o)))}else yield wi(Ro.setSelectedAccountState(U({users:[]},o)))}catch(e){yield wi(Ro.setAllAccountsError({key:c,value:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:c,value:!1}))}}function*zk({payload:e}){const t=wk.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(wf.accountSettings.getSettings,{jwt:n}),u=yield Ri(wf.tenants.getTenantsUsersCount,{tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n}),d=yield Ri(wf.tenants.getParentTenants,{jwt:n}),y=yield Ri(wf.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:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=wk.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(wf.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:o});yield wi(Ro.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield wi(Ro.setAllAccountsError({key:t,value:Cp(e)}))}finally{yield wi(Ro.setAllAccountsLoader({key:t,value:!1}))}}function*Yk(){yield _a(Ro.loadAccounts,Mk),yield _a(Ro.searchAccounts,Fk),yield _a(Ro.updateSubAccountAccessForUser,Kk),yield _a(Ro.getUserJwtForSubAccount,Gk),yield _a(Ro.createSubAccount,$k),yield _a(Ro.deleteSubAccount,xk),yield _a(Ro.updateSubAccountSettings,Vk),yield _a(Ro.addUsersToAccount,Wk),yield _a(Ro.deleteUsersFromAccount,jk),yield _a(Ro.setUserRolesForSubAccount,Bk),yield _a(Ro.getAccountUsers,Hk),yield _a(Ro.setSelectedSubAccountData,zk),yield _a(Ro.loadNumberOfUsersForSelectedSubAccount,qk)}var Jk={sagas:function*(){yield Ui([Ri(Ov),Ri(Pm),Ri(Om),Ri(Sm),Ri(zb),Ri(Wv),Ri(hh),Ri(Eh),Ri(Hp),Ri(nm),Ri(UA),Ri(hk),Ri(XA),Ri(Hg),Ri(lb),Ri(Og),Ri(Sb),Ri(Eb),Ri(Gb),Ri(Zb),Ri(sT),Ri(RT),Ri(QT),Ri(ek),Ri(ok),Ri(Yk),Ri(iS),Ri(ng)])},mockSagas:function*(){yield Ui([Ri(Uv),Ri(Qv),Ri(Oh),Ri(dm),Ri(WA),Ri(fb),Ri(Vg),Ri(oT),Ri(mb),Ri(Pb),Ri(dT),Ri(BT),Ri(xb),Ri(_k),Ri(ag)])},storeName:wt,initialState:Po,reducer:Uo,actions:Ro};const Qk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),Xk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Zk={setAuditLogsState:Qk("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:Xk})},eE={exportAuditsCsv:ct("auditLogs/exportAuditsCsv"),loadAuditLogs:ct("auditLogs/loadAuditLogs",(e=>({payload:e})))},tE={loading:!0},nE={setAuditsMetadataState:Qk("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:tE})},oE={loadAuditsMetadata:ct("auditLogs/loadAuditsMetadata")},iE={auditLogsState:Xk,auditsMetadataState:tE},{reducer:aE,actions:rE}=dt({name:Ct,initialState:iE,reducers:U({resetState:e=>U({},e,iE),setState:(e,{payload:t})=>U({},e,t)},Zk,nE)}),lE=U({},rE,eE,oE),sE=e=>"createdAt"!==e.id,cE={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`})))},uE={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}]},dE=()=>Mi((e=>e.auditLogs.auditLogsState)),yE=()=>Mi((e=>e.auditLogs.auditsMetadataState));function*fE(){const e=yield dE(),{columns:t}=yield yE();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 wi(lE.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield wf.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield wi(lE.setAuditLogsState({isDownloadingCsv:!1}))}function*pE({payload:e}){yield wi(lE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield dE(),{columns:n}=yield yE();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(lE.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 wi(lE.loadAuditsMetadata()));const{data:p,total:g}=yield Ri(wf.audits.getAudits,U({offset:c,count:s},y,f));yield wi(lE.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(lE.setAuditLogsState({loading:!1,error:Cp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*gE(){yield Oa(lE.exportAuditsCsv,fE),yield Oa(lE.loadAuditLogs,pE)}function*SE({payload:e}){yield wi(lE.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield dE(),{columns:n}=yield yE();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(lE.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield wi(lE.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=cE;let o=n.filter((e=>t=>e.filter(sE).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(lE.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(lE.setAuditLogsState({loading:!1,error:Cp(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*vE(){yield Oa(lE.loadAuditLogs,SE)}function*hE(){yield wi(lE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Ri(wf.metadata.getAuditsMetadata);yield wi(lE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(lE.setAuditsMetadataState({error:e,loading:!1}))}}function*mE(){yield Oa(lE.loadAuditsMetadata,hE)}function*AE(){yield wi(lE.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=uE;yield wi(lE.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield wi(lE.setAuditsMetadataState({error:e,loading:!1}))}}function*bE(){yield Oa(lE.loadAuditsMetadata,AE)}var TE={sagas:function*(){yield Ui([Ri(gE),Ri(mE)])},mockSagas:function*(){yield Ui([Ri(vE),Ri(bE)])},storeName:Ct,initialState:iE,reducer:aE,actions:lE};const kE={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:EE,actions:IE,reducer:PE}=dt({name:"audits",initialState:kE,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]})))}}}),LE=U({},IE,{initData:ct(`${EE}/initData`),loadAudits:ct(`${EE}/loadAudits`),removeFilter:ct(`${EE}/removeFilter`),filterData:ct(`${EE}/filterData`),exportCSV:ct(`${EE}/exportCSV`),deleteAudits:ct(`${EE}/deleteAudits`)}),OE=()=>Mi((e=>e[EE]));function*_E(){const{sortBy:e,sortDirection:t}=yield OE();try{const n=yield Ri(wf.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield wi(LE.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield wi(LE.loadItemFailedAction(t))}}function*wE(){try{const e=yield Ri(wf.metadata.getAuditsMetadata);yield wi(LE.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield wi(LE.loadItemFailedAction(t))}}const UE=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*CE({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield OE(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield OE():{rowsData:[]};try{const e=UE(t),{data:l,total:d}=yield Ri(wf.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 wi(LE.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield wi(LE.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield wi(LE.loadItemFailedAction(t))}}function*RE(){yield wi(LE.startLoading()),yield Ui([_E(),wE(),CE({payload:{onlyOneLoad:!1},type:""})]),yield wi(LE.finishLoading())}function*DE({payload:e}){const{filters:t}=yield OE(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield wi(LE.setFilterData(o))}function*NE({payload:e}){const{filters:t}=yield OE();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(LE.setFilterData(o))}function*ME(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield OE(),a=UE(e);yield wi(LE.startDownloadingCsv());try{yield wf.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 wi(LE.stopDownloadingCsv())}}function*FE(){yield _a(LE.initData,RE),yield _a(LE.removeFilter,DE),yield _a(LE.filterData,NE),yield _a([LE.loadAudits,LE.textSearch,LE.onPageChange],CE),yield _a([LE.setFilterData,LE.setDataSorting,LE.startRefresh],(()=>CE({payload:{appendMode:!1},type:""}))),yield _a(LE.exportCSV,ME)}const GE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},$E={initData:()=>U({},GE),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)})}},xE={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}})))},VE={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:jE,actions:BE}=dt({name:Ut,initialState:VE,reducers:U({},$E)}),WE=U({},BE,xE),KE={slack:wf.connectivity.getSlackConfiguration,email:wf.connectivity.getEmailConfiguration,sms:wf.connectivity.getSMSConfiguration,webhook:wf.connectivity.getWebhooksConfigurations,categories:wf.connectivity.getCategories,channelMap:wf.connectivity.getChannelMaps},HE={slack:wf.connectivity.postSlackConfiguration,email:wf.connectivity.postEmailConfiguration,sms:wf.connectivity.postSMSConfiguration,webhook:wf.connectivity.postWebhooksConfiguration},zE=["email","slack","sms","webhook"],qE={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"}},YE=["id"],JE=["id","enabled"],QE=["categories","channelMap"];function*XE(e){return yield Ri(eI,{payload:{api:e},type:""})}function*ZE({payload:e=zE}){yield wi(WE.setConnectivityState({isLoading:!0}));try{const t=yield Ui([...e.map(XE),yield eI({payload:{api:"categories"},type:""}),yield function*(){return(yield Ui(e.map((function*(e){return yield eI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield eI({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:qE[e[i]].events(o),active:qE[e[i]].isActive(o),platform:qE[e[i]].title,image:qE[e[i]].image}]}):n:U({},n,{[`${QE[i-e.length]}`]:o})),{list:[],webhook:n});yield wi(WE.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield wi(WE.setConnectivityState({isLoading:!1}))}}function*eI({payload:{api:e,params:t}}){try{return yield Ri(KE[e],t)}catch(e){return}}function*tI(){try{yield wi(WE.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Ri(wf.connectivity.getSlackChannels);yield wi(WE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield wi(WE.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*nI(e,t){const{connectivity:{list:n}}=yield Mi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=qE[e].isActive(t);i!==o.active&&(yield wi(WE.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*oI({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield Mi((e=>e.connectivity));try{if(yield wi(WE.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 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=Ho(e,YE);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 Ri(HE.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Ri(wf.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 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 Ri("email"===t?wf.connectivity.postEmailConfiguration:wf.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,JE);return yield Ui([yield Ri("email"===t?wf.connectivity.patchEmailConfiguration:wf.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield Ri("email"===t?wf.connectivity.putEmailSubscriptions:wf.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 Ri("email"===t?wf.connectivity.deleteEmailSubscriptions:wf.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield eI({payload:{api:t},type:""});yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield nI(t,e)}else yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield Ri(HE[e],t),!["sms","email"].includes(e)){const i=yield eI({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield nI(e,i),null==n||n(!0)}}catch(e){yield wi(WE.setConnectivityState({error:Cp(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*iI({payload:e}){try{yield wf.connectivity.postSlackCode(e)}catch{}yield wi(WE.setConnectivityState({error:void 0,isSaving:!1}))}function*aI(){const{slackChannels:e}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Ri(wf.connectivity.getSlackScope);yield wi(WE.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield wi(WE.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*rI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({isSaving:!0})),yield Ri(wf.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Cp(e))}const i=yield eI({payload:{api:"webhook"},type:""});i&&(yield wi(WE.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*lI({payload:e}){try{yield wi(WE.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Ri(wf.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield wi(WE.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*sI({payload:e}){try{const{statusCode:t}=yield Ri(wf.connectivity.postWebhookRetry,e);yield wi(WE.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield wi(WE.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*cI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield Mi((e=>e.connectivity));try{yield wi(WE.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield Ri(wf.connectivity.getWebhookLog,e,n,t);yield wi(WE.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield wi(WE.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var uI={sagas:function*(){yield Oa(WE.loadDataAction,ZE),yield _a(WE.loadSlackActions,tI),yield Oa(WE.postDataAction,oI),yield Oa(WE.postCodeAction,iI),yield Oa(WE.loadScope,aI),yield Oa(WE.deleteWebhookConfigAction,rI),yield Oa(WE.postWebhookTestAction,lI),yield Oa(WE.postWebhookRetryAction,sI),yield _a(WE.loadWebhookLogsAction,cI)},storeName:Ut,initialState:VE,reducer:jE,actions:WE};function dI(){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 yI(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function fI(e){return yI(e,((e,t)=>U({},e,{loading:t.payload})))}function pI(e){return yI(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const gI={loading:!1,error:null,fetching:!0,plans:[]},{actions:SI,reducer:vI,name:hI}=dt({name:"subscriptions/plans",initialState:gI,reducers:U({},dI())}),mI=U({loadPlans:ct(`${hI}/loadPlans`)},SI),AI={loading:!1,error:null,fetching:!0,config:null},bI=U({},dI()),{actions:TI,reducer:kI,name:EI}=dt({name:"subscriptions/config",initialState:AI,reducers:bI}),II=U({loadPaymentConfiguration:ct(`${EI}/loadPaymentConfiguration`)},TI),PI={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},LI=U({},dI(),{setCancellationLoading:fI("cancellation"),setCancellationError:pI("cancellation"),setRenewalLoading:fI("renewal"),setRenewalError:pI("renewal")}),{reducer:OI,actions:_I,name:wI}=dt({name:"subscriptions/billing/subscription",initialState:PI,reducers:LI}),UI=U({load:ct(`${wI}/loadSubscription`),cancelSubscription:ct(`${wI}/cancelSubscription`),renewSubscription:ct(`${wI}/renewSubscription`)},_I),CI={loading:!1,error:null,fetching:!0},RI=U({},dI()),{reducer:DI,actions:NI,name:MI}=dt({name:"subscriptions/billing/information",initialState:CI,reducers:RI}),FI=U({loadBillingInformation:ct(`${MI}/loadBillingInformation`),cancelSubscription:UI.cancelSubscription,renewSubscription:UI.renewSubscription},NI),GI={loading:!1,error:null,fetching:!0},$I=U({},dI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:xI,actions:VI,name:jI}=dt({name:"subscriptions/billing/payment",initialState:GI,reducers:$I}),BI=U({loadPaymentMethod:ct(`${jI}/loadPaymentMethod`),submitPaymentMethod:ct(`${jI}/submitPaymentMethod`),submitPaymentMethodError:ct(`${jI}/submitPaymentMethodError`),submitPaymentMethodSuccess:ct(`${jI}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ct(`${jI}/updateBillingDetails`,(e=>({payload:e})))},VI),WI={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},KI=U({},dI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:HI,actions:zI,name:qI}=dt({name:"subscriptions/billing/invoices",initialState:WI,reducers:KI}),YI=U({loadInvoices:ct(`${qI}/loadInvoices`),downloadInvoice:ct(`${qI}/downloadInvoice`,(e=>({payload:e})))},zI),JI={information:CI,invoices:WI,paymentMethod:GI,subscription:PI},QI={invoices:YI,information:FI,paymentMethod:BI,subscription:UI},XI=Be({invoices:HI,information:DI,paymentMethod:xI,subscription:OI}),ZI={fetching:!0,loading:!1,error:null,confirmed:!1},eP=U({},dI()),{actions:tP,reducer:nP,name:oP}=dt({name:"subscriptions/checkout",initialState:ZI,reducers:eP}),iP=U({loadCheckout:ct(`${oP}/loadCheckout`),resetCheckout:ct(`${oP}/resetCheckout`),submitCheckout:ct(`${oP}/submitCheckout`),confirmCheckout:ct(`${oP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ct(`${oP}/errorCheckout`,(e=>({payload:e})))},tP),aP={loading:!1,error:null,cardSetupIntentSecret:null},rP=U({},dI()),{reducer:lP,actions:sP,name:cP}=dt({name:"subscriptions/stripe",initialState:aP,reducers:rP}),uP=U({loadCustomer:ct(`${cP}/loadCustomer`),createCardSetupIntentSecret:ct(`${cP}/createCardSetupIntentSecret`)},sP),dP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:yP,reducer:fP,name:pP}=dt({name:"subscriptions/vendorPublicConfig",initialState:dP,reducers:U({},dI())}),gP=U({loadVendorPublicConfiguration:ct(`${pP}/loadVendorPublicConfiguration`)},yP),SP={config:AI,plans:gI,checkout:ZI,billing:JI,stripe:aP,vendorPublicConfig:dP},vP={config:II,billing:QI,plans:mI,checkout:iP,stripe:uP,vendorPublicConfig:gP},hP=Be({config:kI,billing:XI,plans:vI,checkout:nP,stripe:lP,vendorPublicConfig:fP});let mP,AP,bP;function TP({policy:e}){return{policy:bP.AT_PERIOD_END}}function kP(e){switch(e){case Ly.ACTIVE:return AP.ACTIVE;case Ly.INCOMPLETE:return AP.INCOMPLETE;case Ly.CANCELED:return AP.CANCELED;case Ly.EXPIRED:return AP.EXPIRED;case Ly.TRIALING:return AP.TRIALING;default:return AP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(mP||(mP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(AP||(AP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bP||(bP={}));const EP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Ly.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},IP=[{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"}],PP=[{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:""}],LP=[{id:"id",externalId:"externalId",type:Oy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],OP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*_P(){yield Oa(UI.load,wP),yield Oa(UI.cancelSubscription,CP),yield Oa(UI.renewSubscription,RP)}function*wP(){const e=yield Mi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield GP(e)}function*UP(){yield wi(UI.setLoading(!0));try{const[e]=yield Ri(wf.subscriptions.getManagedSubscriptions);yield wi(UI.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield wi(UI.setError(e))}}function*CP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(UI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(UI.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Ly.ACTIVE)try{yield wi(UI.setCancellationLoading(!0)),yield Ri(wf.subscriptions.cancelManagedSubscription,t),yield UP(),yield wi(UI.setCancellationLoading(!1))}catch(e){yield wi(UI.setCancellationError(Cp(e)))}}function*RP(){const{subscription:e}=yield Mi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield wi(UI.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield wi(UI.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===_y.AT_PERIOD_END)try{yield wi(UI.setRenewalLoading(!0)),yield Ri(wf.subscriptions.renewManagedSubscription,t),yield UP(),yield wi(UI.setRenewalLoading(!1))}catch(e){yield wi(UI.setCancellationError(Cp(e)))}}function*DP(){yield wi(UI.setLoading(!0)),yield Fi(500),yield wi(UI.setState({subscription:EP,fetching:!1,loading:!1,error:null}))}function*NP(){yield Oa(UI.load,DP)}function*MP(){yield Oa(FI.loadBillingInformation,FP)}function*FP(){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 GP(n,!1):yield wi(FI.setError(t?"Not authorized":"Internal feature failure"))}()}function*GP(e,t){yield wi(FI.setLoading(!0));try{var n,o;const i=yield Ri(wf.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield Ri(wf.subscriptions.getSubscriptionPlan,a):([,l]=yield Ui([Ri(UP),Ri(wf.subscriptions.getSubscriptionPlan,a)]),s=yield Mi((e=>e.subscriptions.billing.subscription.subscription||null))),yield wi(FI.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?AP.ACTIVE:kP(s.status),cancellation:s.cancellation&&TP(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(FI.setError(Cp(e)))}}function*$P(){yield function*(){var e,t;yield wi(FI.setLoading(!0)),yield Fi(500),yield wi(FI.setState({loading:!1,fetching:!1,summary:{subscriptionId:EP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:wy.Stripe,externallyManaged:!1,currentPlanId:IP[0].id,defaultPlanId:IP[0].id},plan:U({},IP[0],{price:null==(e=IP[0].price)?void 0:e.amount,currency:null==(t=IP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*xP(){yield Oa(FI.loadBillingInformation,$P)}function*VP(){yield Oa(BI.loadPaymentMethod,jP),yield Oa(BI.submitPaymentMethod,WP),yield Oa(BI.submitPaymentMethodError,KP),yield Oa(BI.submitPaymentMethodSuccess,HP),yield Oa(BI.updatePaymentMethodBillingDetails,BP)}function*jP(){yield wi(BI.setLoading(!0));try{const e=(yield Ri(wf.subscriptions.getPaymentMethods))[0];yield wi(BI.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield wi(BI.setError(Cp(e)))}}function*BP({payload:e}){yield wi(BI.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield Ri(wf.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield Ri(jP),null==i||i(!0)}catch(e){yield wi(BI.setError(Cp(e))),null==i||i(!1)}yield wi(BI.setLoading(!1))}function*WP(){yield wi(BI.setLoading(!0))}function*KP({payload:e}){yield wi(BI.setError(e))}function*HP(){yield wi(BI.loadPaymentMethod())}function*zP(){yield wi(BI.setLoading(!0)),yield Fi(500);const e=LP[0];yield wi(BI.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*qP(){yield Oa(BI.loadPaymentMethod,zP)}function*YP(){yield Oa(YI.loadInvoices,JP),yield Oa(YI.downloadInvoice,QP)}function*JP(){yield wi(YI.setLoading(!0));try{const e=(yield Ri(wf.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(YI.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield wi(YI.setError(Cp(e)))}}function*QP({payload:e}){yield wi(YI.setInvoiceDownloadState({loading:!0,error:null}));try{yield Ri(wf.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield wi(YI.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield wi(YI.setInvoiceDownloadState({loading:!1,error:Cp(e,null)}))}}function*XP(){yield wi(YI.setLoading(!0)),yield Fi(500),yield wi(YI.setState({loading:!1,fetching:!1,invoices:PP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield wi(YI.setLoading(!1))}function*ZP(){yield Oa(YI.loadInvoices,XP)}function*eL(){yield Ui([Ri(MP),Ri(VP),Ri(YP),Ri(_P)])}function*tL(){yield Ui([Ri(xP),Ri(qP),Ri(ZP),Ri(NP)])}function*nL(){yield Oa(iP.loadCheckout,oL),yield Oa(iP.resetCheckout,iL),yield Oa(iP.submitCheckout,aL),yield Oa(iP.confirmCheckout,rL),yield Oa(iP.errorCheckout,sL)}function*oL(){yield wi(iP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*iL(){yield wi(iP.setState({loading:!1,error:null,confirmed:!1}))}function*aL(){yield wi(iP.setState({loading:!0,error:null}))}function*rL({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)===Ly.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield wi(iP.setState({loading:!0,error:null})),i&&a)return yield lL(),void(yield wi(UI.setState({subscription:U({},n,{status:Ly.ACTIVE})})));try{yield Ri(wf.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Ui([FP(),jP(),JP()]),yield lL()}catch(e){yield wi(iP.setState({loading:!1,error:Cp(e)}))}}else yield wi(iP.setState({loading:!1,error:"Subscription not found"}))}function*lL(){yield wi(iP.setState({loading:!1,error:null,confirmed:!0}))}function*sL({payload:e}){yield wi(iP.setState({loading:!1,error:e}))}function*cL(){yield Oa(iP.resetCheckout,iL)}function*uL(){yield Oa(mI.loadPlans,dL)}function*dL(){yield wi(mI.setLoading(!0));try{const e=(yield Ri(wf.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(mI.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield wi(mI.setError(Cp(e)))}}function*yL(){yield wi(mI.setLoading(!0)),yield Fi(500),yield wi(mI.setState({fetching:!1,loading:!1,plans:IP.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*fL(){yield Oa(mI.loadPlans,yL)}function*pL(){yield Oa(II.loadPaymentConfiguration,gL)}function*gL(){yield wi(II.setLoading(!0));try{(yield Ri(wf.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===wy.Stripe))?yield function*(){yield wi(II.setLoading(!0));try{const e=yield Ri(wf.subscriptions.getStripePaymentProviderConfiguration);yield wi(II.setState({loading:!1,fetching:!1,config:{paymentProvider:mP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield wi(II.setError(Cp(e)))}}():yield wi(II.setError("Payment provider not configured"))}catch(e){yield wi(II.setError(Cp(e)))}}function*SL(){yield wi(II.setLoading(!0)),yield Fi(500),yield wi(II.setState({loading:!1,fetching:!1,config:{paymentProvider:mP.STRIPE,apiKey:""}}))}function*vL(){yield Oa(II.loadPaymentConfiguration,SL)}function*hL(){yield Oa(uP.createCardSetupIntentSecret,mL)}function*mL({payload:e}){yield wi(uP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Ri(wf.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield wi(uP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield wi(uP.setError(Cp(e)))}}function*AL(){yield Oa(gP.loadVendorPublicConfiguration,bL)}function*bL(){yield wi(gP.setLoading(!0));try{const e=yield Ri(wf.subscriptions.getVendorPublicConfigurations);yield wi(gP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield wi(gP.setError(Cp(e)))}}function*TL(){yield wi(gP.setLoading(!0)),yield Fi(500),yield wi(gP.setState({fetching:!1,loading:!1,vendorPublicConfig:OP}))}function*kL(){yield Oa(gP.loadVendorPublicConfiguration,TL)}var EL={sagas:function*(){yield Ui([Ri(eL),Ri(nL),Ri(uL),Ri(pL),Ri(hL),Ri(AL)])},mockSagas:function*(){yield Ui([Ri(tL),Ri(cL),Ri(fL),Ri(vL),Ri(kL)])},reducer:hP,actions:vP,initialState:SP,storeName:"subscriptions"},IL={sagas:function*(){yield Oa(Xg.loadVendorPublicInfo,Zg)},storeName:Rt,initialState:Yg,reducer:Jg,actions:Xg};const{reducer:PL}=dt({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}))}}}),LL=(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=ma(),l=[...lt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:l,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[Jk.storeName]:U({},Jk.initialState,o,null!=(c=null==i?void 0:i.auth)?c:{},{routes:U({},Jk.initialState.routes,null!=(u=null==o?void 0:o.routes)?u:{},null!=(d=null==i||null==(y=i.auth)?void 0:y.routes)?d:{})}),[TE.storeName]:U({},TE.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:U({},TE.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:U({},TE.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[EE]:U({},kE,null!=(h=null==i?void 0:i.audits)?h:{}),[uI.storeName]:uI.initialState,[EL.storeName]:EL.initialState,[IL.storeName]:IL.initialState},reducer:Be({root:PL,[Jk.storeName]:Jk.reducer,[TE.storeName]:TE.reducer,[EE]:PE,[uI.storeName]:uI.reducer,[EL.storeName]:EL.reducer,[IL.storeName]:IL.reducer})});const m=function*(){yield Ui([Ri(Jk.sagas),Ri(TE.sagas),Ri(FE),Ri(uI.sagas),Ri(EL.sagas),Ri(IL.sagas)])},A=function*(){yield Ui([Ri(Jk.mockSagas),Ri(TE.mockSagas),Ri(EL.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},OL=(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 _L=n(714),wL=n.n(_L);function UL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function CL(e){if(e.type)return e;if("#"===e.charAt(0))return CL(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 RL(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 DL(e){if(0===e.indexOf("#"))return e;const{values:t}=CL(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 NL(e,t){return e=CL(e),t=UL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,RL(e)}function ML(e,t){if(e=CL(e),t=UL(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 RL(e)}function FL(e,t){if(e=CL(e),t=UL(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 RL(e)}const GL=e=>{if(e)return{main:e,light:DL(FL(e,.4)),dark:DL(ML(e,.15)),hover:DL(ML(e,.15)),active:DL(ML(e,.2))}},$L=e=>{if(e)return{main:e,light:FL(e,.7),dark:ML(e,.2)}},xL=(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({},GL(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({},GL(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({},GL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},$L(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},$L(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},$L(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},$L(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},VL={},jL={},BL={},WL={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 KL{constructor(){this._theme=VL,this._themeV2=jL,this._navigation=WL,this._localizations=BL}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new KL;return n.set(e),KL._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=WL)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=wL().all([null!=(o=VL)?o:{},xL(null==e?void 0:e.theme,VL)]),this._themeV2=wL().all([null!=(i=jL)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=wL().all([null!=(r=BL)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=WL,this._theme=VL,this._themeV2=jL,this._localizations=BL}}}KL._instances={};var HL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},zL=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},qL=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)}))},YL=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 JL,QL,XL,ZL,eO,tO,nO,oO,iO,aO,rO;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(JL||(JL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(QL||(QL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(XL||(XL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(ZL||(ZL={})),function(e){e.Invoices="invoices"}(eO||(eO={})),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"}(nO||(nO={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(oO||(oO={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(iO||(iO={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(aO||(aO={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(rO||(rO={}));const lO={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},sO={hidden:"hidden",edit:"edit"};var cO="6.137.0-alpha.1",uO={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","admin-portal-new-security-center-page":"off"},dO=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(cO),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:KL.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}Ll.set(uO,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Ol();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),Ll.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){Ll.set(U({},uO,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=HL(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=LL({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),Ua.setAppName(l)}var t,n,o,i;return _(e,[{key:"setEntitlementsOptions",value:function(e){Ua.setEntitlementsOptions(U({},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;KL.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 Ua.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(),YL(t),Ua.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,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 OL(null==e||null==(n=e.features)?void 0:n[t],El.MISSING_FEATURE)})(this.getEntitlementsFromStore(),e)}},{key:"getPermissionEntitlements",value:function(e){return((e,t)=>{var n;return OL(null==e||null==(n=e.permissions)?void 0:n[t],El.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}(),yO=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?(Ua.setAccessToken(t),Ua.setUser(U({},n,{accessToken:t})),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(Ro.loadTenants())):(Ua.setAccessToken(null),Ua.setUser(null),i.store.dispatch(Ro.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),fO=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}(),pO=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}(),gO=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},SO=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=LL({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 dO(this.options,t,!0),KL.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,qL(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}(),vO="modern",hO=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[vO]},mO=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=LL({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 dO(this.options,t,!0,a),KL.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,qL(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 AO(e,t){return AO=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},AO(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&&AO(e,t)}function TO(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 kO(e){return kO=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},kO(e)}function EO(){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 IO(e,t,n){return IO=EO()?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&&AO(i,n.prototype),i},IO.apply(null,arguments)}function PO(e){var t="function"==typeof Map?new Map:void 0;return PO=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 IO(e,arguments,kO(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),AO(n,e)},PO(e)}function LO(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=kO(e);if(t){var i=kO(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return TO(this,n)}}var OO=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new dO(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=LO(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=zL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=zL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=zL(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=zL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=zL(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=zL(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}(PO(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}()}));