@frontegg/js 6.97.0 → 6.98.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FronteggApp/FronteggApp.js +5 -3
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +5 -3
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +1024 -963
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.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,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(e,n,s)}),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,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function P(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)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 o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.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 L(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"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(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=w,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(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,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),E(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 i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return VI},AdminPortalRenderer:function(){return KI},AppHolder:function(){return O},CheckoutDialog:function(){return jI},FronteggApp:function(){return GI},HostedLogin:function(){return xI},LoginBoxRenderer:function(){return qI},createElement:function(){return kI},defaultTheme:function(){return BI},formatName:function(){return AI},getThemeAdminByName:function(){return WI},getThemeByName:function(){return zI},initialize:function(){return nL},mockFlagsList:function(){return $I},waitThemeSetter:function(){return TI}});var e={};n.r(e),n.d(e,{Delete:function(){return ma},Get:function(){return ga},Patch:function(){return va},Post:function(){return Sa},PostDownload:function(){return ba},Put:function(){return ha},extractHeadersFromOptions:function(){return Aa},getBaseUrl:function(){return fa}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return rr},getSubTenants:function(){return or},getSubTenantsAsTree:function(){return ar},getTenants:function(){return ir},getTenantsUsersCount:function(){return sr},switchTenant:function(){return nr}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return _r},MachineToMachineAuthStrategy:function(){return Mr},OAuthLogout:function(){return as},SocialLoginProviders:function(){return Ur},acceptInvitation:function(){return ts},activateAccount:function(){return Qr},bulkCreateIPRestriction:function(){return Or},changePhoneNumber:function(){return Hl},changePhoneNumberWithVerification:function(){return zl},checkIfAllowToRememberMfaDevice:function(){return Al},createDomainRestriction:function(){return kr},createIPRestriction:function(){return Er},createOrUpdateSessionConfigrations:function(){return al},createSSOConfiguration:function(){return Ll},createSSOConfigurationByMetadata:function(){return wl},createSSODomain:function(){return Dl},createSSOGroup:function(){return Nl},createSamlGroup:function(){return Ks},createTenantAccessToken:function(){return fl},createUserAccessToken:function(){return yl},deleteAllSessionsForUser:function(){return sl},deleteDomainRestriction:function(){return Pr},deleteIPRestriction:function(){return Cr},deleteSSOConfiguration:function(){return Ol},deleteSSODomain:function(){return Rl},deleteSSOGroup:function(){return $l},deleteSamlGroup:function(){return zs},deleteSessionForUser:function(){return rl},deleteTenantAccessToken:function(){return ul},deleteTenantApiToken:function(){return hl},deleteUserAccessToken:function(){return dl},deleteUserApiToken:function(){return ml},deleteWebAuthnDevice:function(){return Zl},disableMFAAuthenticatorApp:function(){return ms},disableMFASMS:function(){return As},disableMFAWebAuthn:function(){return Ts},disableMfa:function(){return hs},enrollMFAAuthenticatorApp:function(){return ys},enrollMFAAuthenticatorAppForLogin:function(){return Ls},enrollMFASMS:function(){return ps},enrollMFASMSForLogin:function(){return ws},enrollMFAWebAuthn:function(){return Ss},enrollMFAWebAuthnForLogin:function(){return Us},enrollMfa:function(){return us},exchangeOAuthTokens:function(){return jl},forgotPassword:function(){return rs},generateLoginResponse:function(){return jr},generateLoginResponseFromOAuthResponse:function(){return Kr},generateLoginResponseV2:function(){return Wr},getActivateAccountStrategy:function(){return Xr},getCaptchaPolicy:function(){return gr},getCurrentUserSession:function(){return nl},getCurrentUserSessions:function(){return tl},getCustomSocialLoginProvidersV1:function(){return Qs},getDomainRestrictions:function(){return br},getDomainRestrictionsConfig:function(){return Ar},getGlobalSecurityPolicy:function(){return lr},getIPRestrictions:function(){return Ir},getIPRestrictionsConfig:function(){return Lr},getLockoutPolicy:function(){return yr},getMFADevices:function(){return Ps},getMFAStrategiesConfig:function(){return nc},getMfaPolicy:function(){return cr},getOidcConfiguration:function(){return qs},getPasswordConfigPolicy:function(){return mr},getPasswordHistoryPolicy:function(){return Sr},getSSOConfigurations:function(){return Il},getSSODefaultRoles:function(){return _l},getSSOGroups:function(){return Gl},getSSOPublicConfiguration:function(){return Hs},getSamlConfiguration:function(){return Ns},getSamlRoles:function(){return Vs},getSamlRolesGroups:function(){return js},getSamlVendorConfiguration:function(){return $s},getSessionConfigurations:function(){return ol},getSocialLoginProviders:function(){return Js},getSocialLoginProvidersV2:function(){return Ys},getTenantAccessTokensData:function(){return cl},getTenantApiTokensData:function(){return gl},getUserAccessTokensData:function(){return ll},getUserApiTokensData:function(){return pl},getUserById:function(){return bl},getVendorConfig:function(){return Zs},getVendorLockoutPolicy:function(){return fr},getVendorMfaPolicy:function(){return ur},getVendorPasswordHistoryPolicy:function(){return vr},getVendorPublicAuthStrategiesConfig:function(){return tc},getWebAuthnDevices:function(){return Xl},loadPasswordConfig:function(){return ls},login:function(){return Jr},loginViaSocialLogin:function(){return Xs},loginWithMfa:function(){return Yr},logout:function(){return os},oidcPostLogin:function(){return Hr},oidcPostLoginV2:function(){return Vl},passwordlessPostLogin:function(){return Tl},passwordlessPreLogin:function(){return kl},postLogin:function(){return qr},preDisableMFASMS:function(){return bs},preDisableMFAWebAuthn:function(){return ks},preEnrollMFAAuthenticatorApp:function(){return ds},preEnrollMFAAuthenticatorAppForLogin:function(){return Is},preEnrollMFASMS:function(){return fs},preEnrollMFASMSForLogin:function(){return Os},preEnrollMFAWebAuthn:function(){return gs},preEnrollMFAWebAuthnForLogin:function(){return Rs},preLogin:function(){return Br},preLoginV2:function(){return xl},preLoginWithIdpType:function(){return zr},preVerifyMFASMSForLogin:function(){return Cs},preVerifyMFAWebAuthnForLogin:function(){return _s},recoverMfaToken:function(){return cs},refreshToken:function(){return ns},refreshTokenV2:function(){return is},resendActivationEmail:function(){return Zr},resendInvitationEmail:function(){return es},resetPassword:function(){return ss},resetPhoneNumber:function(){return Kl},revokeSessionsForUser:function(){return il},saveLockoutPolicy:function(){return pr},saveMfaPolicy:function(){return dr},savePasswordHistoryPolicy:function(){return hr},setSSODefaultRoles:function(){return Ml},signUpUser:function(){return el},silentOAuthRefreshToken:function(){return Wl},testCurrentIp:function(){return Dr},testCurrentIpInAllowList:function(){return Rr},updateDomainRestrictionConfig:function(){return Tr},updateIPRestrictionConfig:function(){return wr},updateSSOConfiguration:function(){return El},updateSSOConfigurationByMetadata:function(){return Cl},updateSSOGroup:function(){return Fl},updateSamlConfiguration:function(){return Fs},updateSamlGroup:function(){return Bs},updateSamlRoles:function(){return Ws},updateSamlVendorMetadata:function(){return Gs},updateTenantApiTokensData:function(){return vl},updateUserApiTokensData:function(){return Sl},validateSSODomain:function(){return Ul},validateSamlDomain:function(){return xs},verifyChangePhoneNumber:function(){return ql},verifyInviteToken:function(){return Pl},verifyMFAAuthenticatorAppForLogin:function(){return Es},verifyMFASMSForLogin:function(){return Ds},verifyMFAWebAuthnForLogin:function(){return Ms},verifyMfa:function(){return vs},verifyNewDeviceSession:function(){return ec},verifyResetPhoneNumber:function(){return Bl},webAuthnCreateNewDeviceSession:function(){return Ql},webAuthnPostLogin:function(){return Yl},webAuthnPreLogin:function(){return Jl}});var a={};n.r(a),n.d(a,{addUser:function(){return lc},changePassword:function(){return rc},createInviteUserLink:function(){return dc},deleteInviteUserLink:function(){return fc},deleteUser:function(){return cc},getInviteLinkConfiguration:function(){return gc},getInviteUserLink:function(){return pc},getProfile:function(){return ic},loadAvailablePermissions:function(){return vc},loadAvailableRoles:function(){return Sc},loadStats:function(){return hc},loadUsers:function(){return sc},resendActivationLink:function(){return mc},resendInvitationLink:function(){return bc},resendInvitationLinkToAllTenants:function(){return Ac},updateInviteUserLink:function(){return yc},updateProfile:function(){return oc},updateProfileImage:function(){return ac},updateUser:function(){return uc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Tc},getAuditsMetadata:function(){return Oc},getCurrentUserIpMetadata:function(){return Ic},getIpAdressMetadata:function(){return wc},getNotificationsMetadata:function(){return Lc},getSamlMetadata:function(){return Ec},updateAdminBoxMetadata:function(){return Pc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Fc},getReport:function(){return _c},getReports:function(){return Uc},renderReport:function(){return Mc},scheduleReport:function(){return Nc},sendReport:function(){return $c}});var l={};n.r(l),n.d(l,{getNotifications:function(){return Gc},markAllAsRead:function(){return jc},updateNotificationIsPinned:function(){return Vc},updateNotificationStatus:function(){return xc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return zc},getAudits:function(){return Kc},getAuditsStats:function(){return Bc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return ru},deleteEmailSubscriptions:function(){return ou},deleteSMSConfiguration:function(){return yu},deleteSMSSubscriptions:function(){return uu},deleteSlackConfiguration:function(){return Zc},deleteWebhooksConfiguration:function(){return gu},getCategories:function(){return mu},getChannelMaps:function(){return bu},getEmailConfiguration:function(){return tu},getSMSConfiguration:function(){return su},getSlackChannels:function(){return Qc},getSlackConfiguration:function(){return Jc},getSlackScope:function(){return Yc},getWebhookLog:function(){return Su},getWebhooksConfigurations:function(){return fu},patchEmailConfiguration:function(){return iu},patchSMSConfiguration:function(){return cu},postEmailConfiguration:function(){return nu},postSMSConfiguration:function(){return lu},postSlackCode:function(){return eu},postSlackConfiguration:function(){return Xc},postWebhookRetry:function(){return hu},postWebhookTest:function(){return vu},postWebhooksConfiguration:function(){return pu},putEmailSubscriptions:function(){return au},putSMSSubscriptions:function(){return du}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Tu},getSettings:function(){return ku},updateSettings:function(){return Au}});var y={};n.r(y),n.d(y,{addRole:function(){return Ou},attachPermissionToRoles:function(){return Uu},attachPermissionsToRole:function(){return Du},deleteRole:function(){return wu},getPermissionCategories:function(){return _u},getPermissions:function(){return Ru},getRoles:function(){return Eu},updateRole:function(){return Cu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return yd},ISubscriptionStatus:function(){return ud},PaymentMethodType:function(){return dd},ProviderType:function(){return fd},TenantCreatedAction:function(){return gd},TrialEndAction:function(){return pd},cancelManagedSubscription:function(){return ju},cancelSubscription:function(){return Fu},createStripeCustomer:function(){return nd},createStripePaymentMethodSetupIntentSecret:function(){return od},createSubscription:function(){return ed},createTenantConfiguration:function(){return sd},getManagedSubscription:function(){return xu},getManagedSubscriptions:function(){return Vu},getPaymentMethod:function(){return Xu},getPaymentMethods:function(){return Qu},getPaymentProviders:function(){return ld},getStripeCustomer:function(){return td},getStripePaymentProviderConfiguration:function(){return id},getSubscription:function(){return Nu},getSubscriptionInvoice:function(){return Hu},getSubscriptionInvoicePdf:function(){return Ju},getSubscriptionInvoices:function(){return qu},getSubscriptionPlan:function(){return zu},getSubscriptionPlans:function(){return Bu},getSubscriptionSummaries:function(){return ad},getSubscriptions:function(){return Mu},getTenantConfiguration:function(){return rd},getVendorPublicConfigurations:function(){return cd},renewManagedSubscription:function(){return Wu},renewSubscription:function(){return $u},updateManagedSubscription:function(){return Ku},updatePaymentMethodBillingDetails:function(){return Zu},updateSubscription:function(){return Gu}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return Sd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return bd},addUserToTenantAndSubTenants:function(){return hd},createSubTenant:function(){return Td},deleteSubTenant:function(){return Pd},loadAllUsers:function(){return vd},removeUserFromTenantAndSubTenants:function(){return md},removeUserRolesFromSubTenants:function(){return Ad},setUserRolesForSubTenants:function(){return kd},updateSubAccountAccess:function(){return Id}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return Ed},loadFeatureFlags:function(){return Od}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Ud},createConfiguration:function(){return Dd},deleteConfiguration:function(){return Rd},getConfigs:function(){return wd},updateConfiguration:function(){return Cd}});var h={};n.r(h),n.d(h,{impersonate:function(){return _d}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return jd},addUsersToGroup:function(){return Kd},createGroup:function(){return Gd},deleteGroup:function(){return Vd},deleteRolesFromGroup:function(){return Wd},deleteUsersFromGroup:function(){return Bd},getGroupById:function(){return Nd},getGroupConfiguration:function(){return zd},getGroups:function(){return Fd},getGroupsByIds:function(){return $d},updateGroup:function(){return xd},updateGroupConfiguration:function(){return qd}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return Hd},getUsersV3:function(){return Jd}});var A={};n.r(A),n.d(A,{AuthStrategyEnum:function(){return _r},ContextHolder:function(){return ua},FeatureFlags:function(){return Ed},FronteggApiError:function(){return ya},FronteggContext:function(){return da},GroupManagedByEnum:function(){return ly},GroupRelations:function(){return sy},ISubscriptionCancellationPolicy:function(){return yd},ISubscriptionStatus:function(){return ud},MFAStrategyEnum:function(){return Xd},MachineToMachineAuthStrategy:function(){return Mr},PaginationOrderEnum:function(){return uy},PaymentMethodType:function(){return dd},ProviderType:function(){return fd},RestrictionType:function(){return Gn},ScimConnectionSource:function(){return ry},SecondaryAuthStrategy:function(){return Yd},SocialLoginProviders:function(){return Ur},SortByEnum:function(){return cy},TenantType:function(){return ey},UserManagedByEnum:function(){return Zd},WebAuthnDeviceType:function(){return Qd},api:function(){return dy},countConfigurationUsers:function(){return Ud},createConfiguration:function(){return Dd},default:function(){return yy},deleteConfiguration:function(){return Rd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return ty},fronteggRefreshTokenUrl:function(){return ny},fronteggSilentRefreshTokenUrl:function(){return iy},fronteggTenantsUrl:function(){return ay},fronteggUsersUrl:function(){return oy},getConfigs:function(){return wd},loadFeatureFlags:function(){return Od},updateConfiguration:function(){return Cd}});var k={};function T(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 I(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,I(i.key),i)}}function E(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(k),n.d(k,{AccountDetailsPageTabs:function(){return _I},AccountPageFields:function(){return EI},DomainRestrictionsTabFields:function(){return UI},GeneralSettingsTabFields:function(){return DI},InviteUserModalFields:function(){return LI},IpRestrictionsTabFields:function(){return RI},Metadata:function(){return bI},PrivacyPageFields:function(){return II},ProfilePageFields:function(){return PI},SecurityPageTabs:function(){return wI},SessionManagementTabFields:function(){return CI},SubscriptionsPageFields:function(){return OI},alpha:function(){return uI},fieldAppearance:function(){return MI},tabAppearance:function(){return NI}});var O=function(){function e(){T(this,e)}return E(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 w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},w.apply(this,arguments)}function C(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){C(a,i,o,r,s,"next",e)}function s(e){C(a,i,o,r,s,"throw",e)}r(void 0)}))}}O._apps={};var R=n(841),U=n.n(R);function _(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function M(e){return!!e&&!!e[Ae]}function N(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)===ke}(e)||Array.isArray(e)||!!e[be]||!!e.constructor[be]||j(e)||W(e))}function F(e,t,n){void 0===n&&(n=!1),0===$(e)?(n?Object.keys:Te)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function $(e){var t=e[Ae];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:j(e)?2:W(e)?3:0}function G(e,t){return 2===$(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function x(e,t,n){var i=$(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function V(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function j(e){return Se&&e instanceof Map}function W(e){return ve&&e instanceof Set}function K(e){return e.o||e.t}function B(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Pe(e);delete t[Ae];for(var n=Te(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function z(e,t){return void 0===t&&(t=!1),H(e)||M(e)||!N(e)||($(e)>1&&(e.set=e.add=e.clear=e.delete=q),Object.freeze(e),t&&F(e,(function(e,t){return z(t,!0)}),!0)),e}function q(){_(2)}function H(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function J(e){var t=Ie[e];return t||_(18,e),t}function Y(){return pe}function Q(e,t){t&&(J("Patches"),e.u=[],e.s=[],e.v=t)}function X(e){Z(e),e.p.forEach(te),e.p=null}function Z(e){e===pe&&(pe=e.l)}function ee(e){return pe={p:[],l:pe,h:e,m:!0,_:0}}function te(e){var t=e[Ae];0===t.i||1===t.i?t.j():t.O=!0}function ne(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||J("ES5").S(t,e,i),i?(n[Ae].P&&(X(t),_(4)),N(e)&&(e=ie(t,e),t.l||ae(t,e)),t.u&&J("Patches").M(n[Ae].t,e,t.u,t.s)):e=ie(t,n,[]),X(t),t.u&&t.v(t.u,t.s),e!==me?e:void 0}function ie(e,t,n){if(H(t))return t;var i=t[Ae];if(!i)return F(t,(function(o,a){return oe(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ae(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=B(i.k):i.o;F(3===i.i?new Set(o):o,(function(t,a){return oe(e,i,o,t,a,n)})),ae(e,o,!1),n&&e.u&&J("Patches").R(i,n,e.u,e.s)}return i.o}function oe(e,t,n,i,o,a){if(M(o)){var r=ie(e,o,a&&t&&3!==t.i&&!G(t.D,i)?a.concat(i):void 0);if(x(n,i,r),!M(r))return;e.m=!1}if(N(o)&&!H(o)){if(!e.h.F&&e._<1)return;ie(e,o),t&&t.A.l||ae(e,o)}}function ae(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&z(t,n)}function re(e,t){var n=e[Ae];return(n?K(n):e)[t]}function se(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function le(e){e.P||(e.P=!0,e.l&&le(e.l))}function ce(e){e.o||(e.o=B(e.t))}function ue(e,t,n){var i=j(t)?J("MapSet").N(t,n):W(t)?J("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Y(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Le;n&&(o=[i],a=Ee);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):J("ES5").J(t,n);return(n?n.A:Y()).p.push(i),i}function de(e){return M(e)||_(22,e),function e(t){if(!N(t))return t;var n,i=t[Ae],o=$(t);if(i){if(!i.P&&(i.i<4||!J("ES5").K(i)))return i.t;i.I=!0,n=ye(t,o),i.I=!1}else n=ye(t,o);return F(n,(function(t,o){i&&function(e,t){return 2===$(e)?e.get(t):e[t]}(i.t,t)===o||x(n,t,e(o))})),3===o?new Set(n):n}(e)}function ye(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return B(e)}var fe,pe,ge="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Se="undefined"!=typeof Map,ve="undefined"!=typeof Set,he="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,me=ge?Symbol.for("immer-nothing"):((fe={})["immer-nothing"]=!0,fe),be=ge?Symbol.for("immer-draftable"):"__$immer_draftable",Ae=ge?Symbol.for("immer-state"):"__$immer_state",ke=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Te="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 Te(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ie={},Le={get:function(e,t){if(t===Ae)return e;var n=K(e);if(!G(n,t))return function(e,t,n){var i,o=se(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!N(i)?i:i===re(e.t,t)?(ce(e),e.o[t]=ue(e.A.h,i,e)):i},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var i=se(K(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=re(K(e),t),a=null==o?void 0:o[Ae];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(V(n,o)&&(void 0!==n||G(e.t,t)))return!0;ce(e),le(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!==re(e.t,t)||t in e.t?(e.D[t]=!1,ce(e),le(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){_(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){_(12)}},Ee={};F(Le,(function(e,t){Ee[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ee.deleteProperty=function(e,t){return Ee.set.call(this,e,t,void 0)},Ee.set=function(e,t,n){return Le.set.call(this,e[0],t,n,e[0])};var Oe=function(){function e(e){var t=this;this.g=he,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&_(6),void 0!==i&&"function"!=typeof i&&_(7),N(e)){var s=ee(t),l=ue(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?X(s):Z(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Q(s,i),ne(e,s)}),(function(e){throw X(s),e})):(Q(s,i),ne(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===me&&(r=void 0),t.F&&z(r,!0),i){var u=[],d=[];J("Patches").M(e,r,u,d),i(u,d)}return r}_(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){N(e)||_(8),M(e)&&(e=de(e));var t=ee(this),n=ue(this,e,void 0);return n[Ae].C=!0,Z(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ae]).A;return Q(n,t),ne(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!he&&_(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=J("Patches").$;return M(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),we=new Oe,Ce=we.produce,De=(we.produceWithPatches.bind(we),we.setAutoFreeze.bind(we),we.setUseProxies.bind(we),we.applyPatches.bind(we),we.createDraft.bind(we),we.finishDraft.bind(we),Ce);function Re(e,t,n){return(t=I(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){Re(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Me(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 Ne="function"==typeof Symbol&&Symbol.observable||"@@observable",Fe=function(){return Math.random().toString(36).substring(7).split("").join(".")},$e={INIT:"@@redux/INIT"+Fe(),REPLACE:"@@redux/REPLACE"+Fe(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Fe()}};function Ge(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 xe(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Me(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Me(1));return n(xe)(e,t)}if("function"!=typeof e)throw new Error(Me(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Me(3));return a}function d(e){if("function"!=typeof e)throw new Error(Me(4));if(l)throw new Error(Me(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Me(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!Ge(e))throw new Error(Me(7));if(void 0===e.type)throw new Error(Me(8));if(l)throw new Error(Me(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Me(10));o=e,y({type:$e.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Me(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ne]=function(){return this},e}return y({type:$e.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ne]=p,i}function Ve(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:$e.INIT}))throw new Error(Me(12));if(void 0===n(void 0,{type:$e.PROBE_UNKNOWN_ACTION()}))throw new Error(Me(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Me(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function je(){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 We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Me(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=je.apply(void 0,a)(n.dispatch),_e(_e({},n),{},{dispatch:i})}}}function Ke(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Be=Ke();Be.withExtraArgument=Ke;var ze,qe=Be,He=(ze=function(e,t){return ze=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])},ze(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}ze(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Je=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Ye=Object.defineProperty,Qe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Xe=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,et=function(e,t,n){return t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},tt=function(e,t){for(var n in t||(t={}))Xe.call(t,n)&&et(e,n,t[n]);if(Qe)for(var i=0,o=Qe(t);i<o.length;i++)n=o[i],Ze.call(t,n)&&et(e,n,t[n]);return e},nt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?je:je.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var it=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return He(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,Je([void 0],e[0].concat(this)))):new(t.bind.apply(t,Je([void 0],e.concat(this))))},t}(Array);function ot(e){return N(e)?De(e,(function(){})):e}function at(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new it);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(qe):i.push(qe.withExtraArgument(n.extraArgument))),i}function rt(e){var t,n=function(e){return at(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ve(a)}var p=s;"function"==typeof p&&(p=p(n));var g=We.apply(void 0,p),S=je;c&&(S=nt(tt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Je([g],f):"function"==typeof f&&(v=f(v)),xe(t,d,S.apply(void 0,v))}function st(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return tt(tt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function lt(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ct(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ot(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?lt(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=tt(tt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?lt(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return ot(e())};else{var c=ot(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Je([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(M(e))return void 0===(i=n(e,t))?e:i;if(N(e))return De(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?st(c,i):st(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var ut="listenerMiddleware";st(ut+"/add"),st(ut+"/removeAll"),st(ut+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ae];return Le.get(t,e)},set:function(t){var n=this[Ae];Le.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Ae];if(!o.P)switch(o.i){case 5:i(o)&&le(o);break;case 4:n(o)&&le(o)}}}function n(e){for(var t=e.t,n=e.k,i=Te(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Ae){var r=t[a];if(void 0===r&&!G(t,a))return!0;var s=n[a],l=s&&s[Ae];if(l?l.t!==r:!V(s,r))return!0}}var c=!!t[Ae];return i.length!==Te(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Ie[e]||(Ie[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Pe(n);delete a[Ae];for(var r=Te(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:Y(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Ae,{value:a,writable:!0}),o},S:function(e,n,o){o?M(n)&&n[Ae].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ae];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)F(a,(function(t){t!==Ae&&(void 0!==o[t]||G(o,t)?r[t]||e(a[t]):(r[t]=!0,le(n)))})),F(o,(function(e){void 0!==a[e]||G(a,e)||(r[e]=!1,le(n))}));else if(5===s){if(i(n)&&(le(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const dt=(e,t)=>n=>w({},n,{[e]:t[e]}),yt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>w({},t,{[e]:w({},t[e],n)})}),ft=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return w({},n,{[e]:w({},n[e],{[t]:w({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return w({},t,{[e]:w({},t[e],{loaders:w({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return w({},t,{[e]:w({},t[e],{errors:w({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),St=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return w({},i,{[e]:w({},i[e],{[t]:w({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),vt=(e,t,n)=>i=>{var o;return w({},i,{[e]:w({},i[e],{[t]:w({},null==i||null==(o=i[e])?void 0:o[t],n)})})},ht=(e=500)=>new Promise((t=>setTimeout(t,e))),mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bt=new Uint8Array(256);for(let e=0;e<mt.length;e++)bt[mt.charCodeAt(e)]=e;const At=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=bt[e.charCodeAt(i)],a=bt[e.charCodeAt(i+1)],r=bt[e.charCodeAt(i+2)],s=bt[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},kt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(kt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=mt[t[i]>>2],o+=mt[(3&t[i])<<4|t[i+1]>>4],o+=mt[(15&t[i+1])<<2|t[i+2]>>6],o+=mt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=kt(e[n]);return t}return e};let Tt,Pt,It;!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"}(Tt||(Tt={})),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"}(It||(It={}));const Lt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Et="HOSTED_LOGIN_VERIFIER_KEY",Ot="auth",wt="connectivity",Ct="auditLogs",Dt="vendor",Rt={flow:Pt.Login,step:Tt.preLogin,loading:!1,email:"",tenants:[]},Ut={setLoginState:yt("loginState"),resetLoginState:dt("loginState",{loginState:Rt})},_t={requestAuthorize:st("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:st("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:st("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:st("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:st("auth/afterAuthNavigation"),preLogin:st("auth/preLogin",(e=>({payload:e}))),postLogin:st("auth/postLogin",(e=>({payload:e}))),login:st("auth/login",(e=>({payload:e}))),loginWithMfa:st("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:st("auth/recoverMfa",(e=>({payload:e}))),logout:st("auth/logout",(e=>({payload:e}))),silentLogout:st("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:st("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:st("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:st("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:st("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:st("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:st("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:st("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:st("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:st("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:st("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:st("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:st("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:st("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:st("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:st("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:st("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:st("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:st("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:st("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:st("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:st("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Mt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Mt||(Mt={}));const Nt={step:Mt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Ft={setActivateState:yt("activateState"),resetActivateState:dt("activateState",{activateState:Nt}),setActivateStrategyState:ft("activateState","activationStrategy")},$t={activateAccount:st("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:st("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:st("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:st("auth/resendActivationEmail",(e=>({payload:e})))};let Gt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Gt||(Gt={}));const xt={step:Gt.validate},Vt={setAcceptInvitationState:yt("acceptInvitationState"),resetAcceptInvitationState:dt("acceptInvitationState",{acceptInvitationState:xt})},jt={acceptInvitation:st("auth/acceptInvitation",(e=>({payload:e})))};let Wt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Wt||(Wt={}));const Kt={step:Wt.forgotPassword,loading:!1,email:"",passwordConfig:null},Bt={setForgotPasswordState:yt("forgotPasswordState"),resetForgotPasswordState:dt("forgotPasswordState",{forgotPasswordState:Kt})},zt={forgotPassword:st("auth/forgotPassword",(e=>({payload:e}))),resetPassword:st("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:st("auth/loadPasswordConfig",(e=>({payload:e})))};let qt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(qt||(qt={}));const Ht={step:qt.ResetPhoneNumber,loading:!1},Jt={setResetPhoneNumberState:yt("resetPhoneNumberState"),resetResetPhoneNumberState:dt("resetPhoneNumberState",{resetPhoneNumberState:Ht})},Yt={resetPhoneNumber:st("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:st("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:st("auth/changePhoneNumber",(e=>({payload:e})))},Qt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Xt={setSSOLoader:pt("ssoState"),setSSOError:gt("ssoState"),setSSOState:yt("ssoState"),resetSSOState:dt("ssoState",{ssoState:Qt})},Zt={loadSSOConfigurationsV2:st("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:st("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:st("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:st("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:st("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:st("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:st("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:st("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:st("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:st("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:st("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:st("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:st("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:st("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:st("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:st("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:st("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:st("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:st("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:st("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:st("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:st("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:st("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:st("auth/oidcPostlogin",(e=>({payload:e})))},en={loading:!1,error:null},tn={setProfileState:yt("profileState"),resetProfileState:dt("profileState",{profileState:en})},nn={loadProfile:st("auth/loadProfile"),saveProfile:st("auth/saveProfile",(e=>({payload:e}))),changePassword:st("auth/changePassword",(e=>({payload:e})))};let on;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(on||(on={}));const an={step:on.verify,loading:!1,saving:!1},rn={setMfaState:yt("mfaState"),resetMfaState:dt("mfaState",{mfaState:an})},sn={enrollMfa:st("auth/enrollMfa"),getMFADevices:st("auth/getMFADevices"),getMFAStrategies:st("auth/getMFAStrategies"),verifyMfa:st("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:st("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:st("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:st("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:st("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:st("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:st("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:st("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:st("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:st("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:st("auth/disableMfaWebAuthn",(e=>({payload:e})))},ln={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},cn={setTeamLoader:pt("teamState"),setTeamError:gt("teamState"),setTeamState:yt("teamState"),resetTeamState:dt("teamState",{teamState:ln})},un={loadUsers:st("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:st("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:st("auth/loadRoles",(e=>({payload:e}))),addUser:st("auth/addUser",(e=>({payload:e}))),addUsersBulk:st("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:st("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:st("auth/updateUser",(e=>({payload:e}))),deleteUser:st("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:st("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:st("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:st("auth/lockUser",(e=>({payload:e}))),resendActivationLink:st("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:st("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:st("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:st("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:st("auth/getInvitationLink"),createInvitationLink:st("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:st("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:st("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:st("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:st("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:st("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:st("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:st("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:st("auth/closeLockUserDialog",(e=>({payload:e})))},dn={firstLoad:!0,loading:!1,error:""},yn={setSocialLoginsState:yt("socialLoginState"),resetSocialLoginsState:dt("socialLoginState",{socialLoginState:dn})},fn={loadSocialLoginsConfiguration:st("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:st("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:st("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:st("auth/setSocialLoginError",(e=>({payload:e})))};let pn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(pn||(pn={}));const gn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:pn.SignUp},Sn={setSignUpState:yt("signUpState"),resetSignUpState:dt("signUpState",{signUpState:gn})},vn={signUpUser:st("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:st("auth/resetSignUpStateSoft")},hn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},mn={setApiTokensLoader:pt("apiTokensState"),setApiTokensError:gt("apiTokensState"),setApiTokensState:yt("apiTokensState"),resetApiTokensState:dt("apiTokensState",{apiTokensState:hn})},bn={loadApiTokens:st("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:st("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:st("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:st("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:st("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:st("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:st("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:st("auth/deleteTenantApiToken",(e=>({payload:e})))},An={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}},kn={setSecurityPolicyState:yt("securityPolicyState"),setSecurityPolicyGlobalState:ft("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ft("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ft("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ft("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ft("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ft("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ft("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ft("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ft("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ft("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ft("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:dt("securityPolicyState",{securityPolicyState:An})},Tn={loadSecurityPolicy:st("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:st("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:st("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:st("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:st("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:st("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:st("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:st("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:st("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:st("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:st("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:st("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:st("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:st("auth/loadPublicAuthStrategiesPolicy")},Pn={loading:!1},In={setAccountSettingsState:yt("accountSettingsState"),resetAccountSettingsState:dt("accountSettingsState",{accountSettingsState:Pn})},Ln={loadAccountSettings:st("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:st("auth/saveAccountSettings",(e=>({payload:e})))},En={tenants:[],subTenants:[],loading:!0,tenantTree:null},On={setTenantsState:yt("tenantsState"),resetTenantsState:dt("tenantsState",{tenantsState:En})},wn={switchTenant:st("auth/switchTenant",(e=>({payload:e}))),loadTenants:st("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:st("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:st("auth/loadSubTenantsTree",(e=>({payload:e})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:yt("rolesState"),resetRolesState:dt("rolesState",{rolesState:Cn})},Rn={loadRolesAndPermissions:st("auth/loadRoles",(e=>({payload:e}))),addRole:st("auth/addRole",(e=>({payload:e}))),updateRole:st("auth/updateRole",(e=>({payload:e}))),deleteRole:st("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:st("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:st("auth/attachPermissionToRoles",(e=>({payload:e})))},Un={loading:!1,sessions:[]},_n={setSessionsState:yt("sessionsState"),resetSessionsState:dt("sessionsState",{sessionsState:Un})},Mn={loadUserSessions:st("auth/loadUserSessions"),loadCurrentUserSession:st("auth/loadCurrentUserSession"),deleteUserSession:st("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:st("auth/deleteAllUserSessions"),revokeUserSessions:st("auth/revokeUserSessions",(e=>({payload:e})))},Nn={loading:!1,configurations:{}},Fn={setSessionsPolicyState:yt("sessionsPolicyState"),resetSessionsPolicyState:dt("sessionsPolicyState",{sessionsPolicyState:Nn})},$n={loadSessionsPolicy:st("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:st("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Gn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Gn||(Gn={}));const xn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Gn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Vn={setRestrictionsState:yt("restrictionsState"),setIpRestrictionsState:ft("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ft("restrictionsState","emailDomainRestrictions")},jn={checkIfUserIpValid:st("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:st("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:st("auth/loadIpRestrictions"),saveIpRestriction:st("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:st("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:st("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:st("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:st("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:st("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:st("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Wn={loading:!1},Kn={setProvisioningState:yt("provisioningState"),resetProvisioningState:dt("provisioningState",{provisioningState:Wn})},Bn={loadProvisionConnections:st("auth/loadProvisionConnections"),createProvisionConnection:st("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:st("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:st("auth/updateProvisionConnection",(e=>({payload:e})))},zn={devices:[],loading:!1,error:null},qn={setPasskeysState:yt("passkeysState"),resetPasskeysState:dt("passkeysState",{passkeysState:zn})},Hn={loadWebAuthnDevices:st("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:st("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Jn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Yn={setUsersGroupsLoader:pt("groupsState"),setUsersGroupsError:gt("groupsState"),setGroupsState:yt("groupsState"),resetUsersGroupsState:dt("groupsState",{groupsState:Jn})},Qn={loadGroups:st("auth/loadUsersGroups"),getGroupById:st("auth/getGroupById",(e=>({payload:e}))),createGroup:st("auth/createGroup",(e=>({payload:e}))),updateGroup:st("auth/updateGroup",(e=>({payload:e}))),deleteGroup:st("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:st("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:st("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:st("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:st("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:st("auth/getGroupConfiguration"),updateGroupConfiguration:st("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:st("auth/getUsers",(e=>({payload:e})))},Xn={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}},Zn={setGroupsDialogsState:yt("groupsDialogsState"),resetGroupsDialogsState:dt("groupsState",{groupsDialogsState:Xn}),openAddGroupDialog:vt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:vt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:St("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:St("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:vt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:vt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:St("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ei={loading:!1,error:null},ti={setCustomLoginState:yt("customLoginState"),resetCustomLoginState:dt("customLoginState",{customLoginState:ei})},ni={loadTenantMetadata:st("auth/loadTenantMetadata"),updateTenantMetadata:st("auth/updateTenantMetadata",(e=>({payload:e})))},ii={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:gn,loginState:Rt,activateState:Nt,acceptInvitationState:xt,forgotPasswordState:Kt,ssoState:Qt,profileState:en,customLoginState:ei,mfaState:an,teamState:ln,groupsState:Jn,groupsDialogsState:Xn,socialLoginState:dn,apiTokensState:hn,securityPolicyState:An,accountSettingsState:Pn,tenantsState:En,rolesState:Cn,resetPhoneNumberState:Ht,sessionsState:Un,sessionsPolicyState:Nn,restrictionsState:xn,provisioningState:Wn,passkeysState:zn},oi=w({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:()=>{}},ii);let ai;!function(e){e.impersonating="impersonating",e.success="success"}(ai||(ai={}));const ri={step:ai.impersonating,loading:!1},si={setImpersonateState:yt("impersonateState"),resetImpersonateState:dt("impersonateState",{impersonateState:ri})},li={impersonate:st("impersonation/impersonate",(e=>({payload:e})))},{reducer:ci,actions:ui}=ct({name:Ot,initialState:oi,reducers:w({resetState:e=>w({},e,ii),setState:(e,{payload:t})=>w({},e,t),setUser:("user",(e,{payload:t})=>w({},e,{user:t}))},Ut,yn,Ft,si,Vt,Bt,Jt,Sn,tn,ti,Xt,rn,cn,Yn,Zn,mn,kn,In,On,Dn,_n,Fn,Vn,Kn,qn)});const di=w({},ui,_t,fn,$t,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,{},bn,Tn,Ln,wn,Rn,Mn,$n,jn,Bn,li,Hn);var yi=function(e){return"@@redux-saga/"+e},fi=yi("CANCEL_PROMISE"),pi=yi("CHANNEL_END"),gi=yi("IO"),Si=yi("MATCH"),vi=yi("MULTICAST"),hi=yi("SAGA_ACTION"),mi=yi("SELF_CANCELLATION"),bi=yi("TASK"),Ai=yi("TASK_CANCEL"),ki=yi("TERMINATE"),Ti=yi("LOCATION");function Pi(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Ii=function(e){return null==e},Li=function(e){return null!=e},Ei=function(e){return"function"==typeof e},Oi=function(e){return"string"==typeof e},wi=Array.isArray,Ci=function(e){return e&&Ei(e.then)},Di=function(e){return e&&Ei(e.next)&&Ei(e.throw)},Ri=function e(t){return t&&(Oi(t)||Mi(t)||Ei(t)||wi(t)&&t.every(e))},Ui=function(e){return e&&Ei(e.take)&&Ei(e.close)},_i=function(e){return Ei(e)&&e.hasOwnProperty("toString")},Mi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Ni=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[fi]=function(){clearTimeout(n)},i},Fi=function(e){return function(){return e}},$i=Fi(!0),Gi=function(){},xi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Vi=function(e,t){w(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function ji(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Wi=function(e){throw e},Ki=function(e){return{value:e,done:!0}};function Bi(e,t,n){void 0===t&&(t=Wi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ki,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function zi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var qi=function(e){return Array.apply(null,new Array(e))},Hi=function(e){return function(t){return e(Object.defineProperty(t,hi,{value:!0}))}},Ji=function(e){return e===ki},Yi=function(e){return e===Ai},Qi=function(e){return Ji(e)||Yi(e)};function Xi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=wi(e)?qi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Qi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=Gi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Zi(e){return{name:e.name||"anonymous",location:eo(e)}}function eo(e){return e[Ti]}var to=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},no="TAKE",io="CALL",oo="FORK",ao="SELECT",ro=function(e,t){var n;return(n={})[gi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function so(e,t){return void 0===e&&(e="*"),Ri(e)?(Li(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),ro(no,{pattern:e})):Ui(n=e)&&n[vi]&&Li(t)&&Ri(t)?ro(no,{channel:e,pattern:t}):Ui(e)?(Li(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),ro(no,{channel:e})):void 0;var n}function lo(e,t){return Ii(t)&&(t=e,e=void 0),ro("PUT",{channel:e,action:t})}function co(e){var t=ro("ALL",e);return t.combinator=!0,t}function uo(e,t){var n,i=null;return Ei(e)?n=e:(wi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&Oi(n)&&Ei(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function yo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ro(io,uo(e,n))}function fo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ro(oo,uo(e,n))}function po(e){return void 0===e&&(e=mi),ro("CANCEL",e)}function go(e){void 0===e&&(e=xi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return ro(ao,{selector:e,args:n})}var So=yo.bind(null,Ni);var vo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},ho=[],mo=0;function bo(e){try{To(),e()}finally{Po()}}function Ao(e){ho.push(e),mo||(To(),Io())}function ko(e){try{return To(),e()}finally{Io()}}function To(){mo++}function Po(){mo--}function Io(){var e;for(Po();!mo&&void 0!==(e=ho.shift());)bo(e)}var Lo=function(e){return function(t){return e.some((function(e){return Do(e)(t)}))}},Eo=function(e){return function(t){return e(t)}},Oo=function(e){return function(t){return t.type===String(e)}},wo=function(e){return function(t){return t.type===e}},Co=function(){return $i};function Do(e){var t="*"===e?Co:Oi(e)?Oo:wi(e)?Lo:_i(e)?Oo:Ei(e)?Eo:Mi(e)?wo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Ro={type:pi},Uo=function(e){return e&&e.type===pi};function _o(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Ro)}))},(e={})[vi]=!0,e.put=function(e){if(!t)if(Uo(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Si](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Co),t?e(Ro):(e[Si]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),ji(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[hi]?s(e):Ao((function(){s(e)}))},r}function Mo(e,t){var n=e[fi];Ei(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var No,Fo=0,$o=function(){return++Fo};function Go(e){e.isRunning()&&e.cancel()}var xo=((No={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!Uo(e)||r?n(e):n(ki)};try{o.take(s,Li(a)?Do(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},No.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Ao((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Ci(t)?Mo(t,n):n(t)}))},No.ALL=function(e,t,n,i){var o=i.digestEffect,a=Fo,r=Object.keys(t);if(0!==r.length){var s=Xi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(wi(t)?[]:{})},No.RACE=function(e,t,n,i){var o=i.digestEffect,a=Fo,r=Object.keys(t),s=wi(t)?qi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Qi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=Gi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},No.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(Ci(l))return void Mo(l,n);if(Di(l))return void Yo(e,l,s.context,Fo,Zi(a),!1,n);n(l)}catch(e){n(e,!0)}},No.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Ii(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},No.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(Di(o))return o;var a=!1;return Bi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Ci(o)})}))}catch(e){return Bi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Zi(t)}(c,a);ko((function(){var t=Yo(e,c,l.context,Fo,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},No.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&ji(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(wi(t)){if(0===t.length)return void n([]);var r=Xi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},No.CANCEL=function(e,t,n,i){var o=i.task;t===mi?Go(o):wi(t)?t.forEach(Go):Go(t),n()},No.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},No.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=to());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Ro):e.isEmpty()?(n.push(i),i.cancel=function(){ji(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Ro):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Ro)}}}}(t.buffer),a=Do(i),r=function t(n){Uo(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},No.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},No.FLUSH=function(e,t,n){t.flush(n)},No.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},No.SET_CONTEXT=function(e,t,n,i){var o=i.task;Vi(o.context,t),n()},No);function Vo(e,t){return e+"?"+t}function jo(e){var t=e.name,n=e.location;return n?t+" "+Vo(n.fileName,n.lineNumber):t}function Wo(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var Ko=null,Bo=[],zo=function(e){e.crashedEffect=Ko,Bo.push(e)},qo=function(){Ko=null,Bo.length=0},Ho=function(){var e,t,n=Bo[0],i=Bo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=eo(e))?t.code+" "+Vo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+jo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+jo(e.meta)})),[Wo(Bo)]).join("\n")};function Jo(e,t,n,i,o,a,r){var s;void 0===r&&(r=Gi);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(ji(o,t),t.cont=Gi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=Gi,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,zo({meta:o,cancelledTasks:y}),S.isRoot){var i=Ho();qo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Ai?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[bi]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Ai,!1))},s.cont=r,s.end=g,s.setContext=function(e){Vi(f,e)},s.toPromise=function(){return d||(d=vo(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Yo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Ci(t)?Mo(t,i):Di(t)?Yo(e,t,c.context,n,o,!1,i):t&&t[gi]?(0,xo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Gi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Ai))},status:0},c=Jo(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),qo()):Yi(e)?(l.status=1,d.cancel(),o=Ei(t.return)?t.return(Ai):{done:!0,value:Ai}):o=Ji(e)?Ei(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=$o();function l(n,o){a||(a=!0,i.cancel=Gi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Ko=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=Gi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=Gi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Qo(e,t){for(var n=e.channel,i=void 0===n?_o():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?zi: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=$o();if(l&&(l.rootSagaStarted=l.rootSagaStarted||Gi,l.effectTriggered=l.effectTriggered||Gi,l.effectResolved=l.effectResolved||Gi,l.effectRejected=l.effectRejected||Gi,l.effectCancelled=l.effectCancelled||Gi,l.actionDispatched=l.actionDispatched||Gi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=je.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=xi;var m={channel:i,dispatch:Hi(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return ko((function(){var e=Yo(m,S,s,v,Zi(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Xo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?_o():a,s=n.sagaMonitor,l=Pi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Qo.bind(null,w({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.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){Vi(o,e)},c},Zo=function(e){return{done:!0,value:e}},ea={};function ta(e){return Ui(e)?"channel":_i(e)?String(e):Ei(e)?e.name:String(e)}function na(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ea)return Zo(t);if(n&&!o)throw r=ea,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===ea?Zo(t):a}return Bi(s,(function(e){return s(null,e)}),n)}function ia(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:so(e)},s=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return na({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+ta(e)+", "+t.name+")")}function oa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:so(e)},l=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:po(e)}},u=function(e){return a=e},d=function(e){return r=e};return na({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+ta(e)+", "+t.name+")")}function aa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:so(e)},s=function(e){return{done:!1,value:yo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return na({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+ta(e)+", "+t.name+")")}function ra(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:yo.apply(void 0,[n].concat(a))},l={done:!1,value:So(t)};return na({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ea}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function sa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return fo.apply(void 0,[ia,e,t].concat(i))}function la(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return fo.apply(void 0,[oa,e,t].concat(i))}function ca(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return fo.apply(void 0,[aa,e,t].concat(i))}class ua{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return 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 setOnRedirectTo(e){ua.getInstance().onRedirectTo=e}static setLogout(e,t){ua.getInstance().logout=n=>{n?e(n):ua.onRedirectTo(t)}}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 getUser(){return ua.getInstance().user}static onRedirectTo(e,t){return ua.getInstance().onRedirectTo(e,t)}static logout(e){return ua.getInstance().logout(e)}}ua.instance=void 0;const da={getContext:()=>ua.getContext(),getAccessToken:()=>ua.getAccessToken(),getUser:()=>ua.getUser(),onRedirectTo:(e,t)=>ua.onRedirectTo(e,t),logout:e=>ua.logout(e)};class ya extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function fa(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const pa=async e=>{var t,n,i;const o=ua.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:ua.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);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["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=fa(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=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:w({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new ya("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new ya(e,s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.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 s.text()}try{return await s.json()}catch(e){return{}}},ga=async(e,t,n)=>pa(w({url:e,method:"GET",contentType:"application/json",params:t},n)),Sa=async(e,t,n)=>pa(w({url:e,method:"POST",contentType:"application/json",body:t},n)),va=async(e,t,n)=>pa(w({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ha=async(e,t,n)=>pa(w({url:e,method:"PUT",contentType:"application/json",body:t},n)),ma=async(e,t,n)=>pa(w({url:e,method:"DELETE",contentType:"application/json",body:t},n)),ba=async(e,t,n,i)=>pa(w({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Aa=(e={})=>w({},e.jwt?{Authorization:e.jwt}:{}),ka={v1:"/identity/resources/users/webauthn/v1/devices"},Ta={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Pa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",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"}}},Ia={v1:"/identity/resources/configurations/v1"},La={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ea={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Oa={v1:"/identity/resources/permissions/v1"},wa={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"}},Ca={v1:"/identity/resources/roles/v1"},Da={v1:"/identity/resources/sub-tenants/users/v1"},Ra={v1:"/identity/resources/impersonation/v1"},Ua={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},_a={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Ma={v1:"/team/resources/members/v1"},Na={v1:"/team/resources/roles/v1"},Fa={v1:"/team/resources/stats/v1"},$a={v1:"/team/resources/profile"},Ga={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"}},Va={v1:"/tenants/resources/sub-tenants/resources/v1"},ja={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Wa={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"}}}},Ka={v1:"/subscriptions/resources/payment-providers/v1"},Ba={v1:"/subscriptions/resources/subscriptions/v1"},za={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},qa={v1:"/reports/engine/resources/triggers/v1"},Ha="/notification",Ja="/audits",Ya={v1:"/event/resources/configurations/v1"},Qa="/webhook",Xa="/oauth",Za="/flags",er="/directory/resources/v1/configurations/scim2",tr="/directory/resources/scim/temp";async function nr(e){return ha(`${Pa.v1}/tenant`,e)}async function ir(){return ga(`${Pa.v2}/me/tenants`)}async function or(e){return ga(xa.v1,void 0,{headers:Aa(e)})}async function ar(e){return ga(xa.tree.v1,void 0,{headers:Aa(e)})}async function rr(e){return ga(xa.parents.v1,void 0,{headers:Aa(e)})}async function sr(e){return Sa(`${wa.users.v1}/count`,e)}async function lr(){return ga(Ia.v1)}async function cr(){return ga(`${Ia.v1}/mfa-policy`)}async function ur(){return ga(`${Ia.v1}/mfa-policy/vendor`)}async function dr(e){return e.id?va(`${Ia.v1}/mfa-policy`,e):Sa(`${Ia.v1}/mfa-policy`,e)}async function yr(){return ga(`${Ia.v1}/lockout-policy`)}async function fr(){return ga(`${Ia.v1}/lockout-policy/vendor`)}async function pr(e){return e.id?va(`${Ia.v1}/lockout-policy`,e):Sa(`${Ia.v1}/lockout-policy`,e)}async function gr(){try{return await ga(`${Ia.v1}/captcha-policy/public`)}catch{return null}}async function Sr(){return ga(`${Ia.v1}/password-history-policy`)}async function vr(){return ga(`${Ia.v1}/password-history-policy/vendor`)}async function hr(e){return e.id?va(`${Ia.v1}/password-history-policy`,e):Sa(`${Ia.v1}/password-history-policy`,e)}async function mr(){return ga(`${Ia.v1}/password`)}async function br(){return ga(`${La.emailDomain.v1}`)}async function Ar(){return ga(`${La.emailDomain.v1}/config`)}async function kr(e){return Sa(`${La.emailDomain.v1}`,e)}async function Tr(e){return Sa(`${La.emailDomain.v1}/config`,e)}async function Pr(e){return ma(`${La.emailDomain.v1}/${e}`)}async function Ir(e){return ga(`${La.ip.v1}`,e)}async function Lr(){return ga(`${La.ip.v1}/config`)}async function Er(e){return Sa(`${La.ip.v1}`,e)}async function Or(e){return Sa(`${La.ip.v1}/bulk`,e)}async function wr(e){return Sa(`${La.ip.v1}/config`,e)}async function Cr(e){return ma(`${La.ip.v1}/${e}`)}async function Dr(){return Sa(`${La.ip.v1}/verify`)}async function Rr(){return Sa(`${La.ip.v1}/verify/allow`)}let Ur,_r,Mr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ur||(Ur={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(_r||(_r={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Mr||(Mr={}));class Nr extends Error{constructor(e){super(e)}}const Fr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Nr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class $r extends Error{constructor(e){super(e)}}const Gr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(Fr(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 Fr(t)}})(e.split(".")[n]))}catch(e){throw new $r("Invalid token specified: "+e.message)}},xr=["type"],Vr=["type"];async function jr(e){if(!e.accessToken)return e;ua.setAccessToken(e.accessToken);const t=await ga(`${Pa.v2}/me`),n=w({},e,e.accessToken?Gr(e.accessToken):{},t);return ua.setUser(n),n}async function Wr(e){if(!e.accessToken)return{user:e};ua.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ga(`${Pa.v2}/me`),ir()]),i=w({},e,e.accessToken?Gr(e.accessToken):{},t);return ua.setUser(i),{user:i,tenants:n}}async function Kr(e){ua.setAccessToken(e.id_token);const t=await ga(`${Pa.v2}/me`),n=e.id_token?Gr(e.id_token):{},i=w({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return ua.setUser(i),i}async function Br(e){try{const{address:t}=await Sa(`${Ta.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function zr(e){return Sa(`${Ta.v1}/user/saml/prelogin`,e)}async function qr(e){return jr(await Sa(`${Ta.v1}/user/saml/postlogin`,e))}async function Hr(e){return jr(await Sa(`${Ta.v1}/user/oidc/postlogin`,e))}async function Jr(e){return jr(await Sa(`${Ta.v1}/user`,e))}async function Yr(e){return jr(await Sa(`${Ta.v1}/user/mfa/verify`,e))}async function Qr(e){return Sa(`${Pa.v1}/activate`,e)}async function Xr(e){return ga(`${Pa.v1}/activate/strategy`,e)}async function Zr(e){return Sa(`${Pa.v1}/activate/reset`,e)}async function es(e){return Sa(`${Pa.v1}/invitation/reset`,e)}async function ts(e){return Sa(`${Pa.v1}/invitation/accept`,e)}async function ns(){return jr(await Sa(`${Ta.v1}/user/token/refresh`))}async function is(){return Wr(await Sa(`${Ta.v1}/user/token/refresh`))}async function os(){return Sa(`${Ta.v1}/logout`)}async function as(e){return ga(`${Xa}/logout`,e)}async function rs(e){return Sa(`${Pa.v1}/passwords/reset`,e)}async function ss(e){return Sa(`${Pa.v1}/passwords/reset/verify`,e)}async function ls(e){return ga(`${Pa.v1}/passwords/config`,e)}async function cs(e){return Sa(`${Ta.v1}/user/mfa/recover`,e)}async function us(){return Sa(`${Pa.v1}/mfa/enroll`)}async function ds(){return Sa(`${Pa.v1}/mfa/authenticator/enroll`)}async function ys(e){return Sa(`${Pa.v1}/mfa/authenticator/enroll/verify`,e)}async function fs(e){return Sa(`${Pa.v1}/mfa/sms/enroll`,e)}async function ps(e){return Sa(`${Pa.v1}/mfa/sms/enroll/verify`,e)}async function gs(){return Sa(`${Pa.v1}/mfa/webauthn/enroll`)}async function Ss(e){return Sa(`${Pa.v1}/mfa/webauthn/enroll/verify`,e)}async function vs(e){return Sa(`${Pa.v1}/mfa/enroll/verify`,e)}async function hs(e){return Sa(`${Pa.v1}/mfa/disable`,e)}async function ms(e,t){return Sa(`${Pa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function bs(e){return Sa(`${Pa.v1}/mfa/sms/${e}/disable`)}async function As(e,t){return Sa(`${Pa.v1}/mfa/sms/${e}/disable/verify`,t)}async function ks(e){return Sa(`${Pa.v1}/mfa/webauthn/${e}/disable`)}async function Ts(e,t){return Sa(`${Pa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ps(){return ga(`${Pa.v1}/mfa/devices`)}async function Is(e){return Sa(`${Ta.v1}/user/mfa/authenticator/enroll`,e)}async function Ls(e){return Sa(`${Ta.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Es(e,t){return Sa(`${Ta.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Os(e){return Sa(`${Ta.v1}/user/mfa/sms/enroll`,e)}async function ws(e){return Sa(`${Ta.v1}/user/mfa/sms/enroll/verify`,e)}async function Cs(e,t){return Sa(`${Ta.v1}/user/mfa/sms/${e}`,t)}async function Ds(e,t){return Sa(`${Ta.v1}/user/mfa/sms/${e}/verify`,t)}async function Rs(e){return Sa(`${Ta.v1}/user/mfa/webauthn/enroll`,e)}async function Us(e){return Sa(`${Ta.v1}/user/mfa/webauthn/enroll/verify`,e)}async function _s(e,t){return Sa(`${Ta.v1}/user/mfa/webauthn/${e}`,t)}async function Ms(e,t){return Sa(`${Ta.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Ns(){return ga(`${_a.v1}/saml/configurations`)}async function Fs(e){return Sa(`${_a.v1}/saml/configurations`,e)}async function $s(){return ga(`${_a.v1}/saml/configurations/vendor-config`)}async function Gs(e){return ha(`${_a.v1}/saml/configurations/metadata`,e)}async function xs(){return ha(`${_a.v1}/saml/validations/domain`)}async function Vs(){return ga(`${_a.v1}/saml/configurations/roles/default`)}async function js(){return ga(`${_a.v2}/saml/configurations/groups`)}async function Ws({roleIds:e}){return Sa(`${_a.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ks({roleIds:e,group:t}){return Sa(`${_a.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Bs({roleIds:e,group:t,id:n}){return va(`${_a.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function zs({id:e}){return ma(`${_a.v2}/saml/configurations/groups/${e}`)}async function qs(){return ga(`${_a.v1}/oidc/configurations`)}async function Hs(){return ga(`${_a.v2}/configurations/public`)}async function Js(){return ga(Ea.v1)}async function Ys(){return ga(Ea.v2)}async function Qs(){return ga(Ea.custom.v1)}async function Xs({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),Sa(`${Ta.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Zs(){return ga(`${Ia.v1}/public`)}async function el(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Sa(`${Pa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await jr(n):void 0,userId:i,tenantId:o}}async function tl(){return ga(Pa.sessions.currentUser.v1)}async function nl(){return ga(`${Pa.sessions.currentUser.v1}/current`)}async function il(e){return Sa(`${Pa.sessions.v1}/revoke`,{userId:e})}async function ol(){return ga(Pa.sessions.configurations.v1)}async function al(e){await Sa(Pa.sessions.configurations.v1,e)}async function rl(e){await ma(`${Pa.sessions.currentUser.v1}/${e}`)}async function sl(){await ma(`${Pa.sessions.currentUser.v1}/all`)}async function ll(){return ga(Pa.accessTokens.v1)}async function cl(){return ga(wa.accessTokens.v1)}async function ul({id:e}){return ma(`${wa.accessTokens.v1}/${e}`)}async function dl({id:e}){return ma(`${Pa.accessTokens.v1}/${e}`)}async function yl(e){return Sa(Pa.accessTokens.v1,e)}async function fl(e){return Sa(wa.accessTokens.v1,e)}async function pl(){return ga(Pa.apiTokens.v1)}async function gl(){return ga(wa.apiTokens.v1)}async function Sl(e){return Sa(Pa.apiTokens.v1,e)}async function vl(e){return Sa(wa.apiTokens.v2,e)}async function hl({tokenId:e}){return ma(`${wa.apiTokens.v1}/${e}`)}async function ml({tokenId:e}){return ma(`${Pa.apiTokens.v1}/${e}`)}async function bl({userId:e}){return ga(`${Pa.v1}/${e}`)}async function Al(e){return ga(`${Ia.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function kl(e){let{type:t}=e,n=Pi(e,xr);return Sa(`${Ta.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Tl(e){let{type:t}=e,n=Pi(e,Vr);return Sa(`${Ta.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Pl({token:e}){return Sa(wa.invites.verify.v1,{token:e})}async function Il(){return ga(`${_a.v1}/configurations`)}async function Ll(e){return Sa(`${_a.v1}/configurations`,e)}async function El(e,t){return va(`${_a.v1}/configurations/${e}`,t)}async function Ol(e){return ma(`${_a.v1}/configurations/${e}`)}async function wl(e){return Sa(`${_a.v1}/configurations/metadata`,e)}async function Cl(e,t){return ha(`${_a.v1}/configurations/${e}/metadata`,t)}async function Dl(e,t){return Sa(`${_a.v1}/configurations/${e}/domains`,t)}async function Rl(e,t){return ma(`${_a.v1}/configurations/${e}/domains/${t}`)}async function Ul(e,t){return ha(`${_a.v1}/configurations/${e}/domains/${t}/validate`)}async function _l(e){return ga(`${_a.v1}/configurations/${e}/roles`)}async function Ml(e,t){return ha(`${_a.v1}/configurations/${e}/roles`,t)}async function Nl(e,t){return Sa(`${_a.v1}/configurations/${e}/groups`,t)}async function Fl(e,{roleIds:t,group:n,id:i}){return va(`${_a.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function $l(e,t){return ma(`${_a.v1}/configurations/${e}/groups/${t}`)}async function Gl(e){return ga(`${_a.v1}/configurations/${e}/groups`)}async function xl(e){return Sa(`${Ta.v2}/user/sso/prelogin`,e)}async function Vl(e){return jr(await Sa(`${Ta.v2}/user/oidc/postlogin`,e))}async function jl(e){return Kr(await Sa(`${Xa}/token`,e))}async function Wl(){return Kr(await Sa(`${Xa}/authorize/silent`))}async function Kl(e){return Sa(`${Pa.v1}/phone/reset`,e)}async function Bl(e){return Sa(`${Pa.v1}/phone/reset/verify`,e)}async function zl(e){return Sa(`${Pa.v1}/phone`,e)}async function ql(e){return Sa(`${Pa.v1}/phone/verify`,e)}async function Hl(e){return ha(`${Pa.v1}/phone/change`,e)}async function Jl(e){return Sa(`${Ta.v1}/webauthn/prelogin`,e)}async function Yl(e){return Sa(`${Ta.v1}/webauthn/postlogin`,e)}async function Ql(){return Sa(ka.v1)}async function Xl(){return ga(ka.v1)}async function Zl(e){return ma(`${ka.v1}/${e}`)}async function ec(e){return Sa(`${ka.v1}/verify`,e)}async function tc(){return ga(`${Ia.v1}/auth/strategies/public`)}async function nc(){return ga(`${Ia.v1}/mfa/strategies`)}async function ic(e){return ga(`${Pa.v2}/me`,null!=e?e:{addRoles:!0})}async function oc(e){return ha(`${Pa.v2}/me`,e)}async function ac(e){return ha(`${$a.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function rc(e){return Sa(`${Pa.v1}/passwords/change`,e)}async function sc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>w({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return ga(Ma.v1,w({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function lc(e){return Sa(Pa.v2,w({},e,{provider:"local"}))}async function cc(e){return ma(`${Ma.v1}/${e.userId}`)}async function uc(e){return ha(Ma.v1,e)}async function dc(e){return Sa(wa.invites.user.v1,w({},e))}async function yc(e){return va(wa.invites.user.v1,w({},e))}async function fc(){return ma(wa.invites.user.v1)}async function pc(){return ga(wa.invites.user.v1)}async function gc(){return ga(wa.invites.configuration.v1)}async function Sc(){return ga(Na.v1)}async function vc(){return ga(Oa.v1)}async function hc(){return ga(`${Fa.v1}/members`)}async function mc(e){return Sa(`${Ma.v1}/${e.userId}/resendActivationEmail`,{})}async function bc(e){return Sa(Pa.v2,w({},e,{provider:"local"}))}async function Ac(e){return Sa(Pa.invitation.resendAll.v1,w({},e))}async function kc(e){var t,n;const i=await ga("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Tc(){return ga("/metadata/admin-box")}async function Pc(e){return Sa("/metadata/admin-box",e)}async function Ic(){const e=await ga("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Lc=async()=>kc({entityName:"notifications"}),Ec=async()=>kc({entityName:"saml"}),Oc=async()=>kc({entityName:"audits"}),wc=async e=>async function(e){const t=await ga(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Cc=["dataFilters"],Dc=["templateId","dataFilters"],Rc=["dataFilters"];async function Uc(e){return ga(`${za.v2}/tenant-reports`,e)}async function _c(e){return ga(`${za.v2}/${e.id}/tenant-reports`)}async function Mc(e){let{dataFilters:t}=e,n=Pi(e,Cc);return{html:await ga(`${qa.v1}/preview-report`,w({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Nc(e){let{templateId:t,dataFilters:n}=e,i=Pi(e,Dc);return Sa(`${za.v2}/${t}/tenant-reports`,w({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Fc(e){let{dataFilters:t}=e,n=Pi(e,Rc);const i=await ga(`${qa.v1}/preview-report`,w({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function $c(e){return Sa(`${qa.v1}/tenant-reports`,e)}async function Gc(e){return ga(Ha,{params:e})}async function xc(e){return ha(`${Ha}/status`,{params:e})}async function Vc(e){const{notificationId:t,pinStatus:n}=e;return ha(`${Ha}/${n}`,{notificationId:t})}async function jc(){return Sa(`${Ha}/status/mark-all-read`)}const Wc=["endpoint","headerProps"];async function Kc(e){return ga(Ja,e)}async function Bc(e){return ga(`${Ja}/stats`,e)}async function zc(e){const{endpoint:t,headerProps:n}=e,i=Pi(e,Wc);return ba(`${Ja}/export/${t}`,{properties:n},i)}const qc=["eventKey"],Hc=["eventKey"],Jc=()=>ga(`${ja.v1}/slack`),Yc=()=>ga(`${ja.v1}/slack/applications`),Qc=()=>ga(`${ja.v1}/slack/channels`),Xc=e=>e.id?va(`${ja.v1}/slack/subscription/${e.id}`,e):Sa(`${ja.v1}/slack/subscriptions`,e),Zc=e=>ma(`${ja.v1}/slack/subscriptions/${e.id}`),eu=e=>Sa(`${ja.v1}/slack/applications/registrations`,{code:e}),tu=()=>ga(`${ja.v1}/emails`),nu=e=>{let{eventKey:t}=e,n=Pi(e,qc);return Sa(`${ja.v1}/emails/${t}`,n)},iu=({eventKey:e,enabled:t})=>va(`${ja.v1}/emails/${e}`,{enabled:t}),ou=(e,t)=>ma(`${ja.v1}/emails/${e}/subscriptions/${t}`),au=(e,t,n)=>ha(`${ja.v1}/emails/${t}/subscriptions/${e}`,n),ru=e=>ma(`${ja.v1}/emails/${e}`),su=()=>ga(`${ja.v2}/sms`),lu=e=>{let{eventKey:t}=e,n=Pi(e,Hc);return Sa(`${ja.v2}/sms/${t}`,n)},cu=({eventKey:e,enabled:t})=>va(`${ja.v2}/sms/${e}`,{enabled:t}),uu=(e,t)=>ma(`${ja.v2}/sms/${e}/subscriptions/${t}`),du=(e,t,n)=>ha(`${ja.v2}/sms/${t}/subscriptions/${e}`,n),yu=e=>ma(`${ja.v2}/sms/${e}`),fu=()=>ga(Qa),pu=e=>e._id?va(`${Qa}/${e._id}`,e):Sa(`${Qa}/custom`,e),gu=e=>ma(`${Qa}/${e}`),Su=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ga(`${Qa}/logs/?${i.toString()}`)},vu=e=>Sa(`${Qa}/test`,e),hu=e=>Sa(`${Qa}/logs/${e}/retries`),mu=()=>ga(`${Ya.v1}/categories`),bu=e=>ga(Ya.v1,{channels:e});async function Au(e){return ha(Ga.v1,e)}async function ku(){return ga(Ga.v1)}async function Tu(){return ga(`${Ga.v1}/public`)}const Pu=["roleId"],Iu=["roleId"],Lu=["permissionId"];async function Eu(){return ga(Ca.v1)}async function Ou(e){return Sa(Ca.v1,e)}async function wu({roleId:e}){return ma(`${Ca.v1}/${e}`)}async function Cu(e){let{roleId:t}=e,n=Pi(e,Pu);return va(`${Ca.v1}/${t}`,n)}async function Du(e){let{roleId:t}=e,n=Pi(e,Iu);return ha(`${Ca.v1}/${t}/permissions`,n)}async function Ru(){return ga(Oa.v1)}async function Uu(e){let{permissionId:t}=e,n=Pi(e,Lu);return ha(`${Oa.v1}/${t}/roles`,n)}async function _u(){return ga(`${Oa.v1}/categories`)}async function Mu(){return ga(Wa.subscriptions.v1)}async function Nu(e){return ga(`${Wa.subscriptions.v1}/${e}`)}async function Fu(e){return ha(`${Wa.subscriptions.v1}/${e}/cancellations/`,{})}async function $u(e){return ha(`${Wa.subscriptions.v1}/${e}/renewals/`,{})}async function Gu(e,{paymentMethodId:t,planId:n}){return ha(`${Wa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function xu(e){return ga(`${Ba.v1}/${e}`)}async function Vu(){return ga(`${Ba.v1}`)}async function ju(e){return ha(`${Ba.v1}/${e}/cancellations/`,{})}async function Wu(e){return ha(`${Ba.v1}/${e}/renewals/`,{})}async function Ku(e,{paymentMethodId:t,planId:n}){return ha(`${Ba.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Bu(){return ga(Wa.plans.v1)}async function zu(e){return ga(`${Wa.plans.v1}/${e}`)}async function qu(){return ga(Wa.invoices.v1)}async function Hu(e){return ga(`${Wa.invoices.v1}/${e}`)}async function Ju(e,t){return ga(`${Wa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Yu=["email"];async function Qu(){return ga(Wa.paymentMethods.v1)}async function Xu(e){return ga(`${Wa.paymentMethods.v1}/${e}`)}async function Zu(e,t){let{email:n}=t,i=Pi(t,Yu);return va(`${Wa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function ed(e){return Sa(Wa.paymentProviders.stripe.subscriptions.v1,e)}async function td(e){return ga(`${Wa.paymentProviders.stripe.customers.v1}/${e}`)}async function nd(e){return Sa(`${Wa.paymentProviders.stripe.customers.v1}`,e)}async function id(){return ga(`${Wa.paymentProviders.stripe.publicConfigurations.v1}`)}async function od(e){return Sa(`${Wa.paymentProviders.stripe.setupIntents.v1}`,e)}async function ad(e){return ga(`${Wa.summaries.v1}/${e}`)}async function rd(e){return ga(`${Wa.tenantConfiguration.v1}/${e}`)}async function sd(e){return Sa(`${Wa.tenantConfiguration.v1}`,e)}async function ld(){return ga(Ka.v1)}async function cd(){return ga(`${Wa.configurations.vendorPublicConfigurations.v1}`)}let ud,dd,yd,fd,pd,gd;async function Sd(){return ga("/vendors/public")}async function vd(e){return ga(Da.v1,e)}async function hd(e){return Sa(Da.v1,e)}async function md(e,t){return ma(Da.v1,e,{headers:Aa(t)})}async function bd(e,t){return Sa(`${Da.v1}/${e}/roles`,t)}async function Ad(e,t){return ma(`${Da.v1}/${e}/roles`,t)}async function kd(e,t,n){return va(`${Da.v1}/${e}/roles`,t,{headers:Aa(n)})}async function Td(e,t){return Sa(Va.v1,e,{headers:Aa(t)})}async function Pd(e,t){return ma(`${Va.v1}/${e}`,void 0,{headers:Aa(t)})}async function Id(e,t,n){return ha(`${Da.v1}/${e}/access`,t,{headers:Aa(n)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(ud||(ud={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(dd||(dd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(yd||(yd={})),(fd||(fd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(pd||(pd={})),function(e){e.CREATE="create_customer"}(gd||(gd={}));const Ld={flags:{}};class Ed{constructor(){var e;this._flags={},this._flags=null!=(e=Ld.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Ed;return n.set(e),Ed._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=w({},null!=(t=null==Ld?void 0:Ld.flags)?t:{},null!=e?e:{})}}async function Od(){return ga(Za)}async function wd(){return ga(`${er}`)}async function Cd(e,t){return va(`${er}/${e}`,t)}async function Dd(e){return Sa(`${er}`,e)}async function Rd(e){return ma(`${er}/${e}`)}async function Ud(e){return ga(`${tr}/${e}/Users/count`)}async function _d(e){return Sa(`${Ra.v1}`,e)}Ed._instances={};const Md=["groupId"];async function Nd({groupId:e},t){return ga(`${Ua.v1}/${e}`,w({},t))}async function Fd(e){return ga(`${Ua.v1}`,w({},e))}async function $d(e,t){return Sa(`${Ua.getByIds.v1}`,e,{params:t})}async function Gd(e){return Sa(`${Ua.v1}`,e)}async function xd(e){let{groupId:t}=e,n=Pi(e,Md);return va(`${Ua.v1}/${t}`,n)}async function Vd(e){return ma(`${Ua.v1}/${e}`)}async function jd(e,t){return Sa(`${Ua.v1}/${e}/roles`,t)}async function Wd(e,t){return ma(`${Ua.v1}/${e}/roles`,t)}async function Kd(e,t){return Sa(`${Ua.v1}/${e}/users`,t)}async function Bd(e,t){return ma(`${Ua.v1}/${e}/users`,t)}async function zd(){return ga(`${Ua.configurations.v1}`)}async function qd(e){return Sa(`${Ua.configurations.v1}`,e)}async function Hd(e){return Sa(`${Pa.v3}/me/token`,e)}async function Jd(e,t){return ga(Pa.v3,e,{headers:Aa(t)})}let Yd,Qd,Xd,Zd,ey;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Yd||(Yd={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Qd||(Qd={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Xd||(Xd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Zd||(Zd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(ey||(ey={}));const ty=[/^(.*)\/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],ny=`${Ta.v1}/user/token/refresh`,iy=`${Xa}/authorize/silent`,oy=`${Pa.v2}/me`,ay=`${Pa.v2}/me/tenants`;let ry,sy,ly,cy,uy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(ry||(ry={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(sy||(sy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ly||(ly={})),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"}(cy||(cy={})),function(e){e.ASC="ASC",e.DESC="DESC"}(uy||(uy={}));const dy={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m,users:b};var yy={fetch:e,ContextHolder:ua,FronteggContext:da,api:dy,FronteggApiError:ya,AuthStrategyEnum:_r,MachineToMachineAuthStrategy:Mr,SocialLoginProviders:Ur,ISubscriptionCancellationPolicy:yd,ISubscriptionStatus:ud,PaymentMethodType:dd,ProviderType:fd};let fy,py;!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"}(fy||(fy={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(py||(py={}));const gy="input is invalid type",Sy="undefined"!=typeof ArrayBuffer,vy="0123456789abcdef".split(""),hy=[-2147483648,8388608,32768,128],my=[24,16,8,0],by=[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],Ay=["hex","array","digest","arrayBuffer"],ky=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Sy&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Ty=function(e){return function(t){const n=new Iy(!0).update(t);return null==n?void 0:n[e]()}},Py=function(e){return function(t,n){const i=new Ly(t,!0).update(n);return null==i?void 0:i[e]()}};class Iy{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=()=>Iy.prototype.digest(),e?(ky[0]=ky[16]=ky[1]=ky[2]=ky[3]=ky[4]=ky[5]=ky[6]=ky[7]=ky[8]=ky[9]=ky[10]=ky[11]=ky[12]=ky[13]=ky[14]=ky[15]=0,this.blocks=ky):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(gy);if(null===e)throw new Error(gy);if(Sy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Sy&&ArrayBuffer.isView(e)))throw new Error(gy);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<my[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<my[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<my[3&o++],s[o>>2]|=(128|63&i)<<my[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<my[3&o++],s[o>>2]|=(128|i>>6&63)<<my[3&o++],s[o>>2]|=(128|63&i)<<my[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<my[3&o++],s[o>>2]|=(128|i>>12&63)<<my[3&o++],s[o>>2]|=(128|i>>6&63)<<my[3&o++],s[o>>2]|=(128|63&i)<<my[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}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]|=hy[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,i,o,a,r,s,l,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)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+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),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+by[e]+m[e],a=t+i,h=p+o<<0,p=o+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),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+by[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+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,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+by[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+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,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+by[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+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,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=vy[e>>28&15]+vy[e>>24&15]+vy[e>>20&15]+vy[e>>16&15]+vy[e>>12&15]+vy[e>>8&15]+vy[e>>4&15]+vy[15&e]+vy[t>>28&15]+vy[t>>24&15]+vy[t>>20&15]+vy[t>>16&15]+vy[t>>12&15]+vy[t>>8&15]+vy[t>>4&15]+vy[15&t]+vy[n>>28&15]+vy[n>>24&15]+vy[n>>20&15]+vy[n>>16&15]+vy[n>>12&15]+vy[n>>8&15]+vy[n>>4&15]+vy[15&n]+vy[i>>28&15]+vy[i>>24&15]+vy[i>>20&15]+vy[i>>16&15]+vy[i>>12&15]+vy[i>>8&15]+vy[i>>4&15]+vy[15&i]+vy[o>>28&15]+vy[o>>24&15]+vy[o>>20&15]+vy[o>>16&15]+vy[o>>12&15]+vy[o>>8&15]+vy[o>>4&15]+vy[15&o]+vy[a>>28&15]+vy[a>>24&15]+vy[a>>20&15]+vy[a>>16&15]+vy[a>>12&15]+vy[a>>8&15]+vy[a>>4&15]+vy[15&a]+vy[r>>28&15]+vy[r>>24&15]+vy[r>>20&15]+vy[r>>16&15]+vy[r>>12&15]+vy[r>>8&15]+vy[r>>4&15]+vy[15&r];return l+=vy[s>>28&15]+vy[s>>24&15]+vy[s>>20&15]+vy[s>>16&15]+vy[s>>12&15]+vy[s>>8&15]+vy[s>>4&15]+vy[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[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,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}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 Ly extends Iy{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(gy);if(null===e)throw new Error(gy);if(Sy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Sy&&ArrayBuffer.isView(e)))throw new Error(gy)}var o;e.length>64&&(e=null==(o=new Iy(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Iy.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();Iy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Iy.prototype.finalize.call(this)}}}const Ey=function(){const e=Ty("hex");e.create=function(){return new Iy},e.update=function(t){return e.create().update(t)};for(let t=0;t<Ay.length;++t){const n=Ay[t];e[n]=Ty(n)}return e}();function Oy(e,t){const n=w({},e);return t.forEach((e=>{delete n[e]})),n}async function wy(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=Ey.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Cy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Py("hex");e.create=function(e){return new Ly(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Ay.length;++t){const n=Ay[t];e[n]=Py(n)}}();const Dy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Ry(e){const t=yield go((e=>e.root.appName));return Ed.getFeatureFlags(e,t)}const Uy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},_y=w({},Uy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),My=[{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"}],Ny={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},Fy=w({},Ny,{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}),$y={loading:!1,error:void 0,saving:!0,profile:Ny},Gy={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"},xy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:_r.EmailAndPassword,machineToMachineAuthStrategy:Mr.ClientCredentials},Vy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},jy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Wy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Ky={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},By={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},zy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],qy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Ky,roles:zy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Hy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Jy={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:[My[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[My[0]],managedBy:ly.FRONTEGG}]},Yy={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:[My[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[My[0]],managedBy:ly.FRONTEGG}]},Qy={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Xy=[Yy,Jy],Zy=[Qy],ef=[{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}],tf=[{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"}],nf={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},of={isActive:!0,strategy:Gn.ALLOW},af=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Gn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Gn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Gn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Gn.BLOCK,description:"IP 4"}],rf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(w({},Yy,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},sf=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"}),lf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:rf(6),roles:[sf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:ly.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:rf(44),roles:[sf("Editor")],managedBy:ly.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:rf(8),roles:[sf("Viewer")],managedBy:ly.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:rf(5),roles:[sf("Admin")],managedBy:ly.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:rf(21),description:"BDR, AE, and inside sales",roles:[sf("Viewer")],managedBy:ly.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:rf(23),description:"Dev success and customer success",roles:[sf("Admin")],managedBy:ly.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:rf(10),description:"The marketing department",roles:[sf("Viewer")],managedBy:ly.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:rf(4),description:"Human resources",roles:[sf("Viewer")],managedBy:ly.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:rf(3),roles:[sf("Viewer")],managedBy:ly.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:rf(8),roles:[sf("Editor")],managedBy:ly.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:rf(4),roles:[sf("Viewer")],managedBy:ly.FRONTEGG}];let cf,uf,df;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(cf||(cf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(uf||(uf={})),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"}(df||(df={})),df.profile,df.privacy,df.personalApiTokens,df.account,df.users,df.groups,df.security,df.sso,df.audits,df.webhooks,df.apiTokens,df.roles,df.subscriptions;const yf=["events","url"];function*ff(){yield lo(di.setSignUpState({loading:!0}));try{const e=yield yo(dy.auth.getVendorConfig),[t]=(yield yo(dy.auth.getVendorPublicAuthStrategiesConfig),yield yo(Ry,["admin_portal_login_per_tenant"]));if(t){const t=yield yo(dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield lo(di.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield lo(di.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield lo(di.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*pf(e){let{payload:{events:t,url:n}}=e,i=Pi(e.payload,yf);yield lo(di.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield go((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield yo(dy.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:uf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(ua.setAccessToken(null==s?void 0:s.accessToken),ua.setUser(s),!r&&s&&Op(s)){const t=yield Dp(s);yield lo(di.setState(t)),a(e.loginUrl)}else yield lo(di.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield lo(di.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield lo(di.loadTenants()))}catch(e){ua.setAccessToken(null),ua.setUser(null),yield lo(di.setSignUpState({loading:!1,error:e.message}))}yield lo(di.setSignUpState({loading:!1}))}function*gf(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield go((e=>e.auth.signUpState));yield lo(di.resetSignUpState()),yield lo(di.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Sf(){yield ca(di.signUpUser,pf),yield ca(di.resetSignUpStateSoft,gf)}const vf={setVendorState:(e,{payload:t})=>w({},e,t)},hf={loadVendorPublicInfo:st("vendor/loadVendorPublicInfo")},mf={loading:!1},{reducer:bf,actions:Af}=ct({name:Dt,initialState:mf,reducers:w({},vf)}),kf=w({},Af,hf);function*Tf(){yield lo(kf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield dy.vendor.getVendorPublicInfo();yield lo(kf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield lo(kf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Pf=["callback"],If=["callback"],Lf=["callback"],Ef=["callback"],Of=["callback"],wf=["callback"];function*Cf(){yield lo(di.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getGlobalSecurityPolicy);yield lo(di.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield lo(di.loadSecurityPolicyMfa()),yield lo(di.loadSecurityPolicyVendorMfa()),yield lo(di.loadSecurityPolicyLockout()),yield lo(di.loadSecurityPolicyVendorLockout()),yield lo(di.loadSecurityPolicyVendorPasswordHistory()),yield lo(di.loadSecurityPolicyCaptcha()),yield lo(di.loadPublicAuthStrategiesPolicy())}function*Df(){yield lo(di.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getVendorConfig),[t]=yield yo(Ry,["admin_portal_login_per_tenant"]);if(t){const t=yield yo(dy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield lo(di.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Rf(){yield lo(di.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getVendorPublicAuthStrategiesConfig);yield lo(di.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Uf(){yield lo(di.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getMfaPolicy);yield lo(di.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*_f(){yield lo(di.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getVendorMfaPolicy);yield lo(di.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Mf(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Pf);yield lo(di.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield yo(dy.auth.saveMfaPolicy,n);yield lo(di.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield lo(di.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Nf(){yield lo(di.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getLockoutPolicy);yield lo(di.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Ff(e){let{payload:{callback:t}}=e,n=Pi(e.payload,If);yield lo(di.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield yo(dy.auth.saveLockoutPolicy,n);yield lo(di.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield lo(di.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*$f(){yield lo(di.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getVendorLockoutPolicy);yield lo(di.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Gf(){yield lo(di.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getCaptchaPolicy);yield lo(di.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*xf(){yield lo(di.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getPasswordHistoryPolicy);yield lo(di.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Vf(){yield lo(di.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getVendorPasswordHistoryPolicy);yield lo(di.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*jf(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Lf);yield lo(di.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield yo(dy.auth.savePasswordHistoryPolicy,n);yield lo(di.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield lo(di.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Wf(){yield lo(di.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getPasswordConfigPolicy);yield lo(di.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Kf(){yield ca(di.loadSecurityPolicy,Cf),yield sa(di.saveSecurityPolicyMfa,Mf),yield sa(di.loadSecurityPolicyMfa,Uf),yield sa(di.loadSecurityPolicyVendorMfa,_f),yield sa(di.saveSecurityPolicyLockout,Ff),yield sa(di.loadSecurityPolicyLockout,Nf),yield sa(di.loadSecurityPolicyVendorLockout,$f),yield sa(di.loadSecurityPolicyCaptcha,Gf),yield sa(di.saveSecurityPolicyPasswordHistory,jf),yield sa(di.loadSecurityPolicyPasswordHistory,xf),yield sa(di.loadSecurityPolicyVendorPasswordHistory,Vf),yield sa(di.loadVendorPasswordConfig,Wf),yield sa(di.loadPublicSecurityPolicy,Df),yield sa(di.loadPublicAuthStrategiesPolicy,Rf)}function*Bf(){yield lo(di.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield lo(di.setSecurityPolicyPublicState({policy:xy,loading:!1}))}catch(e){yield lo(di.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*zf(){yield lo(di.setSecurityPolicyGlobalState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyGlobalState({policy:Gy,loading:!1})),yield lo(di.loadSecurityPolicyMfa()),yield lo(di.loadSecurityPolicyVendorMfa()),yield lo(di.loadSecurityPolicyLockout()),yield lo(di.loadSecurityPolicyVendorLockout()),yield lo(di.loadSecurityPolicyPasswordHistory()),yield lo(di.loadSecurityPolicyVendorPasswordHistory()),yield lo(di.loadSecurityPolicyCaptcha())}function*qf(){yield lo(di.setSecurityPolicyMfaState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyMfaState({policy:Vy,loading:!1}))}function*Hf(){yield lo(di.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyVendorMfaState({policy:Vy,loading:!1}))}function*Jf(e){var t;let{payload:{callback:n}}=e,i=Pi(e.payload,Ef);yield lo(di.setSecurityPolicyMfaState({saving:!0,error:null}));const o=w({},jy,{id:null!=(t=i.id)?t:jy.id,enforceMFAType:i.enforceMFAType});yield ht(),yield lo(di.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Yf(){yield lo(di.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyLockoutState({policy:jy,loading:!1}))}function*Qf(){yield lo(di.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyVendorLockoutState({policy:jy,loading:!1}))}function*Xf(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Of);yield lo(di.setSecurityPolicyLockoutState({saving:!0,error:null})),yield ht();const i=w({},jy,n,{id:n.id?n.id:jy.id});null==t||t(i),yield lo(di.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Zf(){yield lo(di.setSecurityPolicyLockoutState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyLockoutState({policy:jy,loading:!1}))}function*ep(){yield lo(di.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyPasswordHistoryState({policy:Wy,loading:!1}))}function*tp(){yield lo(di.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield ht(),yield lo(di.setSecurityPolicyVendorPasswordHistoryState({policy:Wy,loading:!1}))}function*np(e){let{payload:{callback:t}}=e,n=Pi(e.payload,wf);yield lo(di.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield ht();const i=w({},Wy,n,{id:n.id?n.id:Wy.id});null==t||t(i),yield lo(di.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*ip(){yield ca(di.loadSecurityPolicy,zf),yield sa(di.loadPublicSecurityPolicy,Bf),yield sa(di.saveSecurityPolicyMfa,Jf),yield sa(di.loadSecurityPolicyMfa,qf),yield sa(di.loadSecurityPolicyVendorMfa,Hf),yield sa(di.saveSecurityPolicyLockout,Xf),yield sa(di.loadSecurityPolicyLockout,Yf),yield sa(di.loadSecurityPolicyVendorLockout,Qf),yield sa(di.loadSecurityPolicyCaptcha,Zf),yield sa(di.saveSecurityPolicyPasswordHistory,np),yield sa(di.loadSecurityPolicyPasswordHistory,ep),yield sa(di.loadSecurityPolicyVendorPasswordHistory,tp)}const op=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},ap=e=>{const{pathname:t}=new URL(e),n=op(e);return n?t+n:t},rp=["callback"],sp=["callback"],lp=["callback"],cp=["callback"],up=["callback","events"],dp=["callback"],yp=["callback"],fp=["callback"],pp=["callback"],gp=["callback"],Sp=["callback"],vp=["callback"],hp=["callback"],mp=["callback"],bp=["callback","deviceId"],Ap=["callback","deviceId"],kp=["callback","deviceId"],Tp=["callback","deviceId"],Pp={[_r.Code]:Tt.loginWithOtc,[_r.EmailAndPassword]:Tt.loginWithPassword,[_r.MagicLink]:Tt.magicLinkPreLoginSuccess,[_r.SmsCode]:Tt.loginWithSmsOtc};function*Ip(){const e=ua.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield go((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=ua.getContext()).tenantResolver)&&d.call(y)&&(yield yo(xp),u=yield go((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Lt);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Lt),yield ht(200),lo(di.resetLoginState());const p=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=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),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u?ap(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(p,{refresh:p.startsWith("http")})}function*Lp(){let e;try{var t;const n=yield yo(dy.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield lo(di.setState({ssoACS:e}))}function*Ep(){try{const{isActive:e}=yield yo(dy.auth.getSSOPublicConfiguration);yield lo(di.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Op=e=>e.mfaRequired&&e.mfaToken?(ua.setAccessToken(null),ua.setUser(null),!0):(ua.setAccessToken(e.accessToken),ua.setUser(e),!1),wp=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return on.authenticatorApp;if(t)return on.smsVerifyCode}return on.verify},Cp=e=>{if(1===e.length){const[t]=e;if(t===Xd.AuthenticatorApp)return on.authenticatorApp;if(t===Xd.SMS)return on.smsSetPhoneNumber}return on.verify};function*Dp(e){let t=Tt.loginWithTwoFactor,n={};const{loginState:i}=yield go((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield yo(dy.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:wp(e.mfaDevices)}:(n={step:Cp(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Tt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Pt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:w({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Rp(e){var t;const{routes:n,loginState:i}=yield go((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Up(){const{hostedLoginBox:e}=yield go((e=>e.auth));e?yield yo(_p):yield yo(Np)}function*_p(){const{user:e}=yield go((e=>e.auth));if(null==e||!e.refreshToken)return ua.setAccessToken(null),ua.setUser(null),void(yield lo(di.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield yo(dy.auth.exchangeOAuthTokens,t);yield lo(di.setState({user:n,isAuthenticated:!0})),yield lo(di.loadTenants())}catch(e){ua.setAccessToken(null),ua.setUser(null),yield lo(di.setState({user:null,isAuthenticated:!1}))}}function*Mp(){const{user:e}=yield go((e=>e.auth));if(null==e||!e.refreshToken)return ua.setAccessToken(null),ua.setUser(null),void(yield lo(di.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield yo(dy.auth.exchangeOAuthTokens,t);yield lo(di.setState({user:n,isAuthenticated:!0})),yield lo(di.loadTenants())}catch(e){ua.setAccessToken(null),ua.setUser(null),yield lo(di.setState({user:null,isAuthenticated:!1}))}}function*Np(){try{const t=ua.onRedirectTo,{routes:n,loginState:i}=yield go((e=>e.auth)),{user:o,tenants:a}=yield yo(dy.auth.refreshTokenV2);if(Op(o)){const e=yield Dp(o);yield lo(di.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Rp(o);yield lo(di.setTenantsState({tenants:a,loading:!1})),yield lo(di.setState({user:o,isAuthenticated:!0,loginState:w({},i,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login})})),yield $p(n)}}catch(e){ua.setAccessToken(null),ua.setUser(null),yield lo(di.setState({user:void 0,isAuthenticated:!1}))}}function*Fp(){try{const t=ua.onRedirectTo,{routes:n,loginState:i}=yield go((e=>e.auth)),{user:o,tenants:a}=yield yo(dy.auth.refreshTokenV2);if(Op(o)){const e=yield Dp(o);yield lo(di.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield yo(Qp))yield lo(di.setLoginState({step:Tt.promptPasskeys,loading:!1})),yield lo(di.setTenantsState({tenants:a,loading:!1})),yield lo(di.setState({user:o})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Rp(o);yield lo(di.setTenantsState({tenants:a,loading:!1})),yield lo(di.setState({user:o,isAuthenticated:!0,loginState:w({},i,{quickLoginToRegister:t,flow:n?Pt.RegisterQuickLogin:Pt.Login})})),yield $p(n)}}catch(e){ua.setAccessToken(null),ua.setUser(null),yield lo(di.setState({user:void 0,isAuthenticated:!1}))}}function*$p(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=ua.onRedirectTo,{routes:o,loginState:a}=yield go((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield Ip())}function*Gp({payload:{callback:e}}){try{const{ip:t}=yield yo(dy.metadata.getCurrentUserIpMetadata);yield lo(di.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*xp(){try{var e,t;if(null!=(e=ua.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield go((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield yo(Tu);var n;t&&i&&(yield lo(di.setState({customLoginState:{customLoginEnabled:!0},routes:w({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+op(t))?n:""})})))}}catch{}}function*Vp({payload:e}){const t=[];e&&(yield lo(di.setState({isLoading:!0})),yield lo(di.loadSocialLoginsConfigurationV2()),t.push(yo(ff)),t.push(yo(Rf)),t.push(yo(Ep)),t.push(yo(Tf)),t.push(yo(Lp)),t.push(yo(xp))),t.push(yo(Up)),yield co(t),yield lo(di.setState({isLoading:!1}))}function*jp({accessToken:e,user:t}){if(!e)return void(yield lo(di.setState({user:void 0,isAuthenticated:!1})));const n=ua.onRedirectTo,{routes:i}=yield go((e=>e.auth));if(Op(t)){const e=yield Dp(t);yield lo(di.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Wp({payload:e}){const t=[];yield lo(di.loadSocialLoginsConfigurationV2()),t.push(yo(ff)),t.push(yo(Ep)),t.push(yo(Tf)),t.push(yo(Lp)),t.push(yo(jp,e)),t.push(yo(xp)),yield co(t)}function*Kp({payload:e}){const{disableSilentRefresh:t}=yield go((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield yo(dy.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield lo(di.setState({user:e,isAuthenticated:!0})),yield lo(di.loadTenants()),yield lo(di.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield go((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield lo(di.setState({isLoading:!0}));const a=Cy(),r=Cy(),s=yield yo(wy,r);localStorage.setItem(Et,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Bp();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${fa(n,"/oauth/authorize")}/oauth/authorize`,d=w({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,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)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Bp(){try{var e,t;if(null!=(e=ua.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield yo(xp);const e=yield go((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return op(e)}}catch{}}function*zp({payload:e}){const t=localStorage.getItem(Et)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield go((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Bp();a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield yo(dy.auth.exchangeOAuthTokens,r);yield lo(di.setState({user:e,isAuthenticated:!0})),yield lo(di.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ip()}}function*qp(e){let{payload:{callback:t}}=e,n=Pi(e.payload,rp);try{yield lo(di.setLoginState({loading:!0}));const e=yield yo(dy.auth.changePhoneNumberWithVerification,n);yield lo(di.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Tt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({error:e.message,loading:!1}))}}function*Hp(e){let{payload:{callback:t}}=e,n=Pi(e.payload,sp);try{yield lo(di.setLoginState({loading:!0})),yield yo(dy.auth.verifyChangePhoneNumber,n),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({error:e.message,loading:!1}))}}function*Jp(e){let{payload:{callback:t}}=e,n=Pi(e.payload,lp);try{yield lo(di.setLoginState({loading:!0}));const e=yield yo(dy.auth.passwordlessPreLogin,w({},n,{type:_r.SmsCode}));yield lo(di.setLoginState({step:Tt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Yp(e){let{payload:{callback:t}}=e,n=Pi(e.payload,cp);try{const{onRedirectTo:e,routes:i}=yield go((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield lo(di.setLoginState({loading:!0}));const o=yield yo(dy.auth.passwordlessPreLogin,n),a=Pp[n.type];if(a===Tt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield lo(di.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:qt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield lo(di.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield lo(di.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Qp(){const{publicAuthStrategyPolicy:e}=yield go((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===Yd.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield yo(Ry,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield yo(dy.auth.getWebAuthnDevices);return yield lo(di.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Xp(e){let{payload:{callback:t,events:n}}=e,i=Pi(e.payload,up);try{yield lo(di.setLoginState({loading:!0}));const e=yield yo(dy.auth.passwordlessPostLogin,i),a=ua.onRedirectTo,{routes:r}=yield go((e=>e.auth));if(Op(e)){const t=yield Dp(e);yield lo(di.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield go((e=>e.auth)),s=yield yo(dy.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:cf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield lo(di.setState({user:s})),yield lo(di.setLoginState({error:void 0})),yield lo(di.loadTenants()),yield lo(di.setState({isLoading:!1})),i.flow===Pt.Login?(yield yo(Qp))?(yield lo(di.setLoginState({step:Tt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield lo(di.setState({isAuthenticated:!0})),yield Ip()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield lo(di.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield lo(di.setLoginState({loading:!1}))}}function*Zp({payload:e}){try{yield lo(di.setLoginState({loading:!0}));const{name:t}=yield yo(dy.auth.verifyInviteToken,e);yield lo(di.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield lo(di.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield lo(di.setLoginState({loading:!1}))}}function*eg({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield lo(di.setLoginState({loading:!0}));try{const o=yield go((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield yo(dy.auth.preLoginV2,{email:e});if(a){let e=a;if(r===py.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield go((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield lo(di.setLoginState({step:Tt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield tg({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield tg({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*tg(e){let{callback:t}=e,n=Pi(e,dp);const i=yield go((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield lo(di.setLoginState({step:Tt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===_r.EmailAndPassword?(yield lo(di.setLoginState({step:Tt.loginWithPassword,loading:!1})),null==t||t()):[_r.MagicLink,_r.Code,_r.SmsCode].includes(null==i?void 0:i.authStrategy)?yield lo(di.passwordlessPreLogin(w({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield lo(di.setLoginState({step:Tt.loginWithPassword,loading:!1})),null==t||t())}function*ng({payload:{callback:e}}){try{yield lo(di.setLoginState({loading:!0}));const{options:t}=yield yo(dy.auth.webAuthnCreateNewDeviceSession);t.user.id=At(t.user.id),t.challenge=At(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield lo(di.setLoginState({error:t.message})),null==e||e(null)}finally{yield lo(di.setLoginState({loading:!1}))}}function*ig(e){let{payload:{callback:t}}=e,n=Pi(e.payload,yp);try{yield lo(di.setLoginState({loading:!0}));const e=kt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Qd.Platform:Qd.CrossPlatform;yield yo(dy.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield lo(di.setLoginState({error:e.message})),null==t||t(null)}finally{yield lo(di.setLoginState({loading:!1}))}}function*og(e){let{payload:{callback:t}}=e,n=Pi(e.payload,fp);try{var i;yield lo(di.setPasskeysState({loading:!0})),yield lo(di.setLoginState({loading:!0}));const{options:e}=yield yo(dy.auth.webAuthnPreLogin,n);e.challenge=At(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>w({},e,{id:At(e.id)}))),yield lo(di.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield lo(di.setLoginState({error:e.message})),null==t||t(null)}finally{yield lo(di.setPasskeysState({loading:!1})),yield lo(di.setLoginState({loading:!1}))}}function*ag(e){let{payload:{callback:t}}=e,n=Pi(e.payload,pp);try{var i;yield lo(di.setPasskeysState({loading:!0})),yield lo(di.setLoginState({loading:!0}));const e=kt(n.publicKey),o=yield yo(dy.auth.webAuthnPostLogin,w({},e,{response:w({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Op(o)){const e=ua.onRedirectTo,{routes:t}=yield go((e=>e.auth)),n=yield Dp(o);yield lo(di.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield yo(dy.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield lo(di.loadTenants()),yield lo(di.setState({user:e,isAuthenticated:!0})),yield lo(di.setLoginState({error:void 0})),yield Ip(),null==t||t(!0)}}catch(e){yield lo(di.setLoginState({error:e.message})),null==t||t(null)}finally{yield lo(di.setPasskeysState({loading:!1})),yield lo(di.setLoginState({loading:!1}))}}function*rg({payload:e}){const{onRedirectTo:t,routes:n}=yield go((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield lo(di.setLoginState({loading:!0}));try{const t=yield yo(dy.auth.postLogin,e);ua.setAccessToken(t.accessToken),ua.setUser(t),yield lo(di.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ip()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield lo(di.setLoginState({step:Tt.loginWithSSOFailed,loading:!1}))}}function*sg({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield lo(di.setLoginState({loading:!0}));try{const a=yield yo(dy.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});ua.setAccessToken(a.accessToken),ua.setUser(a);const r=ua.onRedirectTo,{routes:s}=yield go((e=>e.auth));if(Op(a)){const e=yield Dp(a);yield lo(di.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield go((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield lo(di.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Pt.Login?Tt.success:t.step,tenants:[],tenantsLoading:!0}})),yield lo(di.loadTenants()),n&&t.flow===Pt.Login&&((yield yo(Qp))?(yield lo(di.setLoginState({step:Tt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Ip())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){ua.setAccessToken(null),ua.setUser(null),null==o||o(!1,t),yield lo(di.setLoginState({email:e,error:t.message,loading:!1}))}}function*lg({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield lo(di.setLoginState({loading:!0}));try{const o=yield yo(dy.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield go((e=>e.auth)),r=a.flow===Pt.Login?Tt.success:a.step;yield lo(di.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield lo(di.loadTenants()),yield lo(di.setLoginState({error:void 0,loading:!1})),a.flow===Pt.Login&&((yield yo(Qp))?yield lo(di.setLoginState({step:Tt.promptPasskeys,loading:!1})):yield Ip()),null==i||i(!0)}catch(e){yield lo(di.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*cg({payload:e}){yield lo(di.setLoginState({loading:!0}));try{var t;yield yo(dy.auth.recoverMfaToken,e),yield lo(di.setLoginState({loading:!1,error:void 0,step:Tt.preLogin})),yield lo(di.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*ug({payload:e}){const{hostedLoginBox:t}=yield go((e=>e.auth));yield lo(di.setState({isLoading:!0}));try{t?yield yo(dy.auth.OAuthLogout):yield yo(dy.auth.logout)}catch{}yield lo(di.resetState()),yield lo(di.requestAuthorize(!0)),null==e||e()}function*dg({payload:e}){var t;try{yield yo(dy.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*yg({user:e,tenants:t}){const n={step:on.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield lo(di.setMfaState(n)),yield lo(di.setUser(e)),yield lo(di.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*fg({user:e,tenants:t}){const{loginState:n}=yield go((e=>e.auth));yield lo(di.setUser(e)),yield lo(di.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield go((e=>e.auth.mfaState));if(n.flow===Pt.Login){const e=yield yo(Qp);i===on.smsVerifyCode&&e?yield lo(di.setLoginState({step:Tt.promptPasskeys,loading:!1})):yield Ip()}yield lo(di.setState({isAuthenticated:!0}))}function*pg(e){let{payload:{callback:t}}=e,n=Pi(e.payload,gp);yield lo(di.setLoginState({loading:!0}));try{const e=yield yo(dy.auth.preEnrollMFASMSForLogin,n);yield lo(di.setMfaState({otcToken:e.otcToken,step:on.smsVerifyCode,phoneNumber:e.phoneNumber})),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*gg(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Sp);yield lo(di.setLoginState({loading:!0}));try{const e=yield yo(dy.auth.enrollMFASMSForLogin,n),i=yield yo(dy.auth.generateLoginResponseV2,e);yield yg(i),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Sg(e){let{payload:{callback:t}}=e,n=Pi(e.payload,vp);yield lo(di.setLoginState({loading:!0}));try{var i;const e=yield yo(dy.auth.preEnrollMFAWebAuthnForLogin,n),o=w({},e.options,{challenge:At(e.options.challenge),user:w({},e.options.user,{id:At(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>w({},e,{id:At(e.id)})))});yield lo(di.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*vg(e){let{payload:{callback:t}}=e,n=Pi(e.payload,hp);yield lo(di.setLoginState({loading:!0}));try{const e=kt(n.publicKey),i=yield yo(dy.auth.enrollMFAWebAuthnForLogin,w({},n,{options:e})),o=yield yo(dy.auth.generateLoginResponseV2,i);yield yg(o),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*hg(e){let{payload:{callback:t}}=e,n=Pi(e.payload,mp);yield lo(di.setLoginState({loading:!0}));try{const e=yield yo(dy.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield yo(dy.auth.generateLoginResponseV2,e);yield yg(i),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*mg(e){let{payload:{callback:t,deviceId:n}}=e,i=Pi(e.payload,bp);yield lo(di.setLoginState({loading:!0}));try{const e=yield yo(dy.auth.preVerifyMFASMSForLogin,n,i);yield lo(di.setMfaState({otcToken:e.otcToken,step:on.smsVerifyCode,phoneNumber:e.phoneNumber})),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*bg(e){let{payload:{callback:t,deviceId:n}}=e,i=Pi(e.payload,Ap);yield lo(di.setLoginState({loading:!0}));try{const e=yield yo(dy.auth.verifyMFASMSForLogin,n,i),o=yield yo(dy.auth.generateLoginResponseV2,e);yield fg(o),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ag(e){let{payload:{callback:t,deviceId:n}}=e,i=Pi(e.payload,kp);yield lo(di.setLoginState({loading:!0}));try{var o;const e=yield yo(dy.auth.preVerifyMFAWebAuthnForLogin,n,i),a=w({},e.options,{challenge:At(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>w({},e,{id:At(e.id)})))});yield lo(di.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*kg(e){let{payload:{callback:t,deviceId:n}}=e,i=Pi(e.payload,Tp);yield lo(di.setLoginState({loading:!0}));try{const e=kt(i.publicKey),o=yield yo(dy.auth.verifyMFAWebAuthnForLogin,n,w({},i,{options:e})),a=yield yo(dy.auth.generateLoginResponseV2,o);yield fg(a),yield lo(di.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tg(){yield ca(di.requestAuthorize,Vp),yield ca(di.requestAuthorizeSSR,Wp),yield ca(di.requestHostedLoginAuthorize,Kp),yield ca(di.handleHostedLoginCallback,zp),yield ca(di.preLogin,eg),yield ca(di.postLogin,rg),yield ca(di.login,sg),yield ca(di.logout,ug),yield ca(di.silentLogout,dg),yield ca(di.loginWithMfa,lg),yield ca(di.recoverMfa,cg),yield ca(di.quickSmsPasswordlessPreLogin,Jp),yield ca(di.changePhoneNumberWithVerification,qp),yield ca(di.verifyChangePhoneNumber,Hp),yield ca(di.passwordlessPreLogin,Yp),yield ca(di.passwordlessPostLogin,Xp),yield ca(di.verifyInviteToken,Zp),yield ca(di.webAuthnPrelogin,og),yield ca(di.webAuthnPostLogin,ag),yield ca(di.webAuthnCreateNewDeviceSession,ng),yield ca(di.webAuthnVerifyNewDeviceSession,ig),yield ca(di.afterAuthNavigation,Ip),yield ca(di.getUserIP,Gp),yield ca(di.preEnrollMFASMSForLogin,pg),yield ca(di.enrollMFASMSForLogin,gg),yield ca(di.preEnrollMFAWebAuthnForLogin,Sg),yield ca(di.enrollMFAWebAuthnForLogin,vg),yield ca(di.enrollMFAAuthenticatorAppForLogin,hg),yield ca(di.preVerifyMFASMSForLogin,mg),yield ca(di.verifyMFASMSForLogin,bg),yield ca(di.preVerifyMFAWebAuthnForLogin,Ag),yield ca(di.verifyMFAWebAuthnForLogin,kg)}function*Pg({payload:e}){e&&(yield lo(di.setState({isLoading:!0})));const t=Fy;yield lo(di.loadTenants()),yield lo(di.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Ig({payload:{callback:e}}){try{const{ip:t}=af[0];yield lo(di.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Lg(){yield ca(di.requestAuthorize,Pg),yield ca(di.afterAuthNavigation,Ip),yield ca(di.getUserIP,Ig)}const Eg=["callback","samlVendor"],Og=["callback","samlVendor"];function*wg(){try{var e,t;yield lo(di.setSSOState({loading:!0}));const n=yield yo(dy.auth.getSamlConfiguration),i=yield yo(dy.auth.getOidcConfiguration),o=yield yo(dy.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield lo(di.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield lo(di.setSSOState({error:e.message,loading:!1}))}}function*Cg({payload:e}){const t=yield go((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield lo(di.setSSOState({error:void 0,[n]:!0}));try{const i=yield Dy(e[0]),o=yield yo(dy.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield lo(di.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield lo(di.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Dg({payload:e}){const{configFile:t,callback:n}=e,i=yield go((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield lo(di.setSSOState({error:void 0,[o]:!0}));try{const e=yield Dy(t),a=yield yo(dy.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield lo(di.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield lo(di.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Rg({payload:e}){const{callback:t,samlVendor:n}=e,i=Pi(e,Eg),o=yield go((e=>e.auth.ssoState.samlConfiguration)),a=w({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield lo(di.setSSOState({samlConfiguration:w({},o,a)})));if(yield lo(di.setSSOState({error:void 0,[r]:!0})),e.type===py.Saml){var s,l;const e=yield yo(dy.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Oy(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield yo(dy.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield lo(di.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield lo(di.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Ug({payload:{callback:e}={}}){const t=yield go((e=>e.auth.ssoState.samlConfiguration));try{yield lo(di.setSSOState({error:void 0,saving:!0})),yield yo(dy.auth.validateSamlDomain),yield lo(di.setSSOState({samlConfiguration:w({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield lo(di.setSSOState({samlConfiguration:w({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*_g(){try{const e=yield yo(dy.auth.getSamlRoles),t=yield yo(dy.auth.getSamlRolesGroups);yield lo(di.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield lo(di.setSSOState({error:e.message}))}}function*Mg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield lo(di.setSSOState({error:void 0,saving:!0})),yield yo(dy.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield co(e.map((e=>yo(dy.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield lo(di.setSSOState({error:e.message}))}}(n)),yield _g(),yield lo(di.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield lo(di.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Ng({payload:{callback:e,id:t}}){try{yield lo(di.setSSOState({error:void 0,saving:!0})),yield yo(dy.auth.deleteSamlGroup,{id:t}),yield _g(),yield lo(di.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield lo(di.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Fg({payload:{group:e,roleIds:t,callback:n}}){try{yield lo(di.setSSOState({error:void 0,saving:!0})),yield yo(dy.auth.createSamlGroup,{group:e,roleIds:t}),yield _g(),yield lo(di.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield lo(di.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*$g({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield lo(di.setSSOState({loading:!0})),yield yo(dy.auth.oidcPostLoginV2,t),yield yo(Up),yield lo(di.setSSOState({loading:!1}))}catch(e){var n;yield lo(di.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Gg(){yield sa(di.loadSSOConfigurations,wg),yield sa(di.saveSSOConfigurations,Rg),yield sa(di.saveSSOConfigurationsFile,Cg),yield sa(di.saveSSOConfigurationsFileWithCallback,Dg),yield sa(di.validateSSODomain,Ug),yield sa(di.loadSSOAuthorizationRoles,_g),yield sa(di.updateSSOAuthorizationRoles,Mg),yield sa(di.deleteSamlGroup,Ng),yield sa(di.createSamlGroup,Fg),yield sa(di.oidcPostlogin,$g)}function*xg(){yield lo(di.setSSOState({loading:!0})),yield ht(),yield lo(di.setSSOState({samlConfiguration:Ky,loading:!1,firstLoad:!1}))}function*Vg({payload:e}){const t="saving";yield lo(di.setSSOState({error:void 0,[t]:!0}));const n=w({},yield go((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield lo(di.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*jg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Pi(e,Og),r=qy.samlConfiguration,s=w({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield lo(di.setSSOState({samlConfiguration:w({},r,s)})));yield lo(di.setSSOState({error:void 0,[l]:!0})),yield ht(),s.acsUrl=null==By||null==(t=By.configuration)?void 0:t.acsUrl,s.spEntityId=null==By||null==(n=By.configuration)?void 0:n.spEntityId;const c=Oy(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield ht(),yield lo(di.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Wg({payload:{callback:e}={}}){const t=qy.samlConfiguration;yield lo(di.setSSOState({error:void 0,saving:!0})),yield ht(),yield lo(di.setSSOState({samlConfiguration:w({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Kg(){yield ht(),yield lo(di.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Bg({payload:{callback:e,authorizationRoles:t}}){yield lo(di.setSSOState({error:void 0,saving:!0})),yield ht(),yield lo(di.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*zg(){yield sa(di.loadSSOConfigurations,xg),yield sa(di.saveSSOConfigurations,jg),yield sa(di.saveSSOConfigurationsFile,Vg),yield sa(di.validateSSODomain,Wg),yield sa(di.loadSSOAuthorizationRoles,Kg),yield sa(di.updateSSOAuthorizationRoles,Bg)}const qg=["callback"],Hg=["callback","ssoConfigId"],Jg=["callback","ssoConfigId"],Yg=["callback","ssoConfigId"];function*Qg(){try{return yield yo(dy.auth.getOidcConfiguration)}catch(e){return null}}function*Xg(){try{return yield yo(dy.metadata.getSamlMetadata)}catch(e){return null}}function*Zg(){try{yield lo(di.setSSOLoader({key:fy.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield co([yo(Qg),yo(Xg)]),n=yield yo(dy.auth.getSSOConfigurations);yield lo(di.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield lo(di.setSSOError({key:fy.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield lo(di.setSSOLoader({key:fy.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*eS({payload:e}){yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Pi(e,qg),i=yield go((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield yo(dy.auth.createSSOConfiguration,w({},n,{enabled:null!=(o=n.enabled)&&o}));yield lo(di.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield lo(di.setSSOError({key:fy.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION,value:!1}))}}function*tS({payload:e}){yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield go((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Dy(t),o=yield yo(dy.auth.createSSOConfigurationByMetadata,{metadata:e});yield lo(di.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield lo(di.setSSOError({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*nS({payload:e}){yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Pi(e,Hg),o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield yo(dy.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield lo(di.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield lo(di.setSSOError({key:fy.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*iS({payload:e}){yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Dy(i),a=yield yo(dy.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield lo(di.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield lo(di.setSSOError({key:fy.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*oS({payload:e}){yield lo(di.setSSOLoader({key:fy.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield go((e=>e.auth.ssoState.ssoConfigurations));try{yield yo(dy.auth.deleteSSOConfiguration,t),yield lo(di.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield lo(di.setSSOError({key:fy.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield lo(di.setSSOLoader({key:fy.DELETE_SSO_CONFIGURATION,value:!1}))}}function*aS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Pi(e,Jg);yield lo(di.setSSOLoader({key:fy.SAVE_SSO_DOMAIN,value:!0}));const o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield yo(dy.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?w({},t,{domains:[...t.domains,e]}):t));yield lo(di.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield lo(di.setSSOError({key:fy.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_DOMAIN,value:!1}))}}function*rS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield lo(di.setSSOLoader({key:fy.DELETE_SSO_DOMAIN,value:!0}));const o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{yield yo(dy.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?w({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield lo(di.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield lo(di.setSSOError({key:fy.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield lo(di.setSSOLoader({key:fy.DELETE_SSO_DOMAIN,value:!1}))}}function*sS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield lo(di.setSSOLoader({key:fy.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{yield yo(dy.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?w({},e,{domains:e.domains.map((e=>e.id===n?w({},e,{validated:!0}):e))}):e));yield lo(di.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield lo(di.setSSOError({key:fy.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.VALIDATE_SSO_DOMAIN,value:!1}))}}function*lS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield go((e=>e.auth.ssoState.ssoConfigurations));try{yield yo(dy.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?w({},e,{roleIds:n}):e));yield lo(di.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield lo(di.setSSOError({key:fy.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield lo(di.setSSOLoader({key:fy.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*cS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield lo(di.setSSOLoader({key:fy.SAVE_SSO_GROUPS,value:!0}));const o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{yield co(t.map((e=>yo(dy.auth.deleteSSOGroup,n,e)))),yield co(e.map((e=>yo(dy.auth.createSSOGroup,n,e))));const a=yield yo(dy.auth.getSSOGroups,n),r=o.map((e=>e.id===n?w({},e,{groups:a}):e));yield lo(di.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield lo(di.setSSOError({key:fy.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_GROUPS,value:!1}))}}function*uS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield co(t.map((t=>yo(dy.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield lo(di.setSSOError({key:fy.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_GROUPS,value:!1}))}}function*dS({payload:e}){yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield go((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield yo(ga,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield yo(dy.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield yo(dy.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield lo(di.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*yS({payload:e}){yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Pi(e,Yg),o=yield go((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield yo(dy.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield yo(dy.auth.createSSOConfiguration,i),a=[e,...o]),yield lo(di.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield lo(di.setSSOLoader({key:fy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*fS(){yield sa(di.loadSSOConfigurationsV2,Zg),yield sa(di.saveSSOConfigurationV2,eS),yield sa(di.saveSSODomain,aS),yield sa(di.deleteSSODomain,rS),yield sa(di.validateSSODomainV2,sS),yield sa(di.updateSSOConfiguration,nS),yield sa(di.deleteSSOConfiguration,oS),yield sa(di.setSSOGroups,cS),yield sa(di.updateSSOGroups,uS),yield sa(di.setSSODefaultRoles,lS),yield sa(di.saveSSOConfigurationByMetadata,tS),yield sa(di.updateSSOConfigurationByMetadata,iS),yield sa(di.saveSSOConfigurationByUrl,dS),yield sa(di.saveSSOConfigurationByData,yS)}const pS=["callback","profilePictureUrl"],gS=["callback","profilePictureUrl"];function*SS(){yield lo(di.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return yo.apply(void 0,[ra,e,t,n].concat(o))}(3,2e3,dy.teams.getProfile),t=yield go((e=>e.auth.user));di.setUser(w({},t,e)),yield lo(di.setProfileState({profile:e,loading:!1}))}catch(e){yield lo(di.setProfileState({loading:!1,error:e.message}))}}function*vS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Pi(e.payload,pS);yield lo(di.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield go((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield yo(dy.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=w({},e,i,{profilePictureUrl:o}),r=yield yo(dy.teams.updateProfile,a),s=yield go((e=>e.auth.user));yield lo(di.setUser(w({},s,r))),yield lo(di.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield lo(di.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*hS({payload:e}){yield lo(di.setProfileState({loading:!0}));try{var t;yield yo(dy.teams.changePassword,e),yield lo(di.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*mS(){yield ca(di.loadProfile,SS),yield sa(di.saveProfile,vS),yield sa(di.changePassword,hS)}function*bS(){yield lo(di.setProfileState({loading:!0})),yield ht(),yield lo(di.setUser(w({},Fy,Ny))),yield lo(di.setProfileState({loading:!1,profile:Ny}))}function*AS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Pi(e.payload,gS);yield lo(di.setProfileState({saving:!0,error:null}));const o=$y;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=w({},o.profile,i,{profilePictureUrl:a}),s=Fy;yield ht(),yield lo(di.setUser(w({},s,r))),yield lo(di.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*kS({payload:e}){var t;yield lo(di.setProfileState({loading:!0})),yield ht(),yield lo(di.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*TS(){yield ca(di.loadProfile,bS),yield sa(di.saveProfile,AS),yield sa(di.changePassword,kS)}const PS=["callback"],IS=["callback"],LS=["callback"],ES=["deviceId","callback"],OS=["deviceId","callback"],wS=["callback"],CS=["deviceId"],DS=["deviceId"],RS=["callback"],US=["deviceId"],_S=["callback"];function*MS(e){const{step:t}=yield go((e=>e.auth.mfaState));return{step:e.recoveryCode?on.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*NS(){yield lo(di.setMfaState({saving:!0}));try{const{qrCode:e}=yield yo(dy.auth.enrollMfa);yield lo(di.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message}))}}function*FS(e){let{payload:{callback:t}}=e,n=Pi(e.payload,PS);yield lo(di.setMfaState({saving:!0}));try{const e=yield go((e=>e.auth.user)),i=yield yo(dy.auth.verifyMfa,n),o=yield yo(dy.auth.getMFADevices),a=yield MS(i);yield lo(di.setMfaState(w({},a,{mfaDevices:o}))),yield lo(di.setUser(w({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*$S(e){let{payload:{callback:t}}=e,n=Pi(e.payload,IS);yield lo(di.setMfaState({loading:!0}));try{const e=yield yo(dy.auth.loginWithMfa,n),i={step:on.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield lo(di.setMfaState(i)),yield lo(di.setState({user:e})),yield lo(di.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield lo(di.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*GS({payload:e}){yield lo(di.setMfaState({saving:!0}));try{var t;yield yo(dy.auth.disableMfa,e);const n=yield yo(dy.auth.getMFADevices);yield lo(di.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*xS({payload:e}){yield lo(di.setMfaState({saving:!0}));try{var t,n;const i=yield yo(dy.auth.preEnrollMFAWebAuthn),o=w({},i.options,{challenge:At(i.options.challenge),user:w({},i.options.user,{id:At(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>w({},e,{id:At(e.id)})))});yield lo(di.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield lo(di.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*VS(e){let{payload:{callback:t}}=e,n=Pi(e.payload,LS);yield lo(di.setMfaState({saving:!0}));try{const e=kt(n.publicKey),i=yield yo(dy.auth.enrollMFAWebAuthn,w({},n,{options:e})),o=yield yo(dy.auth.getMFADevices),a=yield MS(i);yield lo(di.setMfaState(w({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*jS(e){let{payload:{deviceId:t,callback:n}}=e;Pi(e.payload,ES),yield lo(di.setMfaState({saving:!0}));try{var i;const e=yield yo(dy.auth.preDisableMFAWebAuthn,t),o=w({},e.options,{challenge:At(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>w({},e,{id:At(e.id)})))});yield lo(di.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*WS(e){let{payload:{deviceId:t,callback:n}}=e,i=Pi(e.payload,OS);yield lo(di.setMfaState({saving:!0}));try{const e=kt(i.publicKey);yield yo(dy.auth.disableMFAWebAuthn,t,w({},i,{options:e}));const o=yield yo(dy.auth.getMFADevices);yield lo(di.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*KS({payload:e}){yield lo(di.setMfaState({saving:!0}));try{var t;const n=yield yo(dy.auth.preEnrollMFASMS,e);yield lo(di.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 lo(di.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*BS(e){let{payload:{callback:t}}=e,n=Pi(e.payload,wS);yield lo(di.setMfaState({saving:!0}));try{const e=yield yo(dy.auth.enrollMFASMS,n),i=yield yo(dy.auth.getMFADevices),o=yield MS(e);yield lo(di.setMfaState(w({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield lo(di.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zS(e){let{payload:{deviceId:t}}=e,n=Pi(e.payload,CS);yield lo(di.setMfaState({saving:!0}));try{var i;const e=yield yo(dy.auth.preDisableMFASMS,t);yield lo(di.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield lo(di.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*qS(e){let{payload:{deviceId:t}}=e,n=Pi(e.payload,DS);yield lo(di.setMfaState({saving:!0}));try{var i;yield yo(dy.auth.disableMFASMS,t,n);const e=yield yo(dy.auth.getMFADevices);yield lo(di.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield lo(di.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*HS(){yield lo(di.setMfaState({loading:!0}));try{yield go((e=>e.auth.user));const e=yield yo(dy.auth.getMFADevices);yield lo(di.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield lo(di.setMfaState({loading:!1,error:e.message}))}}function*JS(){yield lo(di.setMfaState({loading:!0}));try{const e=(yield yo(dy.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield lo(di.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield lo(di.setMfaState({loading:!1,error:e.message}))}}function*YS(){yield sa(di.enrollMfa,NS),yield sa(di.getMFADevices,HS),yield sa(di.getMFAStrategies,JS),yield sa(di.verifyMfa,FS),yield sa(di.disableMfa,GS),yield sa(di.verifyMfaAfterForce,$S),yield sa(di.preDisableMfaSms,zS),yield sa(di.disableMfaSms,qS),yield sa(di.preEnrollMfaSms,KS),yield sa(di.enrollMfaSms,BS),yield sa(di.preEnrollMfaWebAuthn,xS),yield sa(di.enrollMfaWebAuthn,VS),yield sa(di.preDisableMfaWebAuthn,jS),yield sa(di.disableMfaWebAuthn,WS)}function*QS(){yield lo(di.setMfaState({saving:!0})),yield lo(di.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*XS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield go((e=>e.auth.mfaState));yield lo(di.setMfaState({saving:!0})),yield ht();const n={token:"token",recoveryCode:"recoveryCode"},i={step:on.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:w({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield lo(di.setMfaState(i)),yield lo(di.setUser(w({},Fy,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*ZS(e){let{payload:{callback:t}}=e,n=Pi(e.payload,RS);yield lo(di.setMfaState({loading:!0})),yield ht();const i=w({},n,{recoveryCode:"recoveryCode"}),o={step:on.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield lo(di.setMfaState(o)),yield ht(),yield lo(di.setUser(w({},Fy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*ev({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield go((e=>e.auth.mfaState));yield lo(di.setMfaState({saving:!0})),yield ht(),yield lo(di.setMfaState({saving:!1,error:void 0,mfaDevices:w({},n,{authenticators:[]})})),yield lo(di.setUser(w({},Fy))),null==(t=e.callback)||t.call(e,!0)}function*tv(e){let{}=e,t=Pi(e.payload,US);yield lo(di.setMfaState({saving:!0}));try{var n;yield lo(di.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield lo(di.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*nv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield go((e=>e.auth.mfaState));yield lo(di.setMfaState({saving:!0})),yield ht(),yield lo(di.setMfaState({loading:!1,error:void 0,mfaDevices:w({},n,{phones:[]})})),yield lo(di.setUser(w({},Fy))),null==(t=e.callback)||t.call(e,!0)}function*iv({payload:e}){var t;yield lo(di.setMfaState({saving:!0})),yield ht(),yield lo(di.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*ov(e){let{payload:{callback:t}}=e;Pi(e.payload,_S);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield go((e=>e.auth.mfaState));yield lo(di.setMfaState({saving:!0})),yield ht();const i={token:"token",recoveryCode:"recoveryCode"},o={step:on.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:w({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield lo(di.setMfaState(o)),yield lo(di.setUser(w({},Fy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*av(){yield sa(di.enrollMfa,QS),yield sa(di.verifyMfa,XS),yield sa(di.disableMfa,ev),yield sa(di.verifyMfaAfterForce,ZS),yield sa(di.preDisableMfaSms,tv),yield sa(di.disableMfaSms,nv),yield sa(di.preEnrollMfaSms,iv),yield sa(di.enrollMfaSms,ov)}const rv=["callback"];function*sv({payload:e}){yield lo(di.setForgotPasswordState({loading:!0}));try{var t;yield yo(dy.auth.forgotPassword,e),yield lo(di.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*lv(e){let{payload:{callback:t}}=e,n=Pi(e.payload,rv);yield lo(di.setForgotPasswordState({loading:!0}));try{yield yo(dy.auth.resetPassword,n),yield lo(di.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==t||t(!0)}catch(e){yield lo(di.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*cv({payload:e}){yield lo(di.setForgotPasswordState({loading:!0}));try{const t=yield yo(dy.auth.loadPasswordConfig,e);yield lo(di.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield lo(di.setForgotPasswordState({loading:!1,error:e.message}))}}function*uv(){yield ca(di.forgotPassword,sv),yield ca(di.resetPassword,lv),yield ca(di.loadPasswordConfig,cv)}let dv;!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"}(dv||(dv={}));const yv=["callback","events"],fv=["callback"],pv=["callback"];function*gv({payload:{userId:e,token:t}}){yield lo(di.setActivateState({loading:!0,step:Mt.activating}));try{const{isAuthenticated:n}=yield go((e=>e.auth));n&&(yield lo(di.silentLogout()));const i=yield yo(dy.auth.getActivateAccountStrategy,{userId:e,token:t});yield lo(di.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield lo(di.setActivateState({loading:!1,step:Mt.activatingForm})))}catch(e){yield lo(di.setActivateState({loading:!1,error:e.message}))}}function*Sv(e){let{payload:{callback:t,events:n}}=e,i=Pi(e.payload,yv);yield lo(di.setActivateState({loading:!0}));try{const e=ua.onRedirectTo,{routes:a}=yield go((e=>e.auth)),r=yield yo(dy.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Op(r)){yield lo(di.setActivateState({step:Mt.success}));const t=yield Dp(r);yield lo(di.setState(t)),yield So(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield lo(di.setActivateState({step:Mt.success}));const{user:e,tenants:t}=yield yo(dy.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:cf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield lo(di.setTenantsState({tenants:t,loading:!1})),yield lo(di.setState({user:e,isAuthenticated:!0})),yield So(1e3),yield Ip(),yield lo(di.resetActivateState())}null==t||t(!0)}catch(e){yield lo(di.setActivateState({loading:!1,error:e.message}))}}function*vv({payload:e}){const{callback:t}=e,n=Pi(e,fv);yield lo(di.setActivateStrategyState({loading:!0}));try{const e=yield yo(dy.auth.getActivateAccountStrategy,n);yield lo(di.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield lo(di.setActivateStrategyState({loading:!1,error:e.message}))}}function*hv({payload:e}){const{callback:t}=e,n=Pi(e,pv);yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:n.email})),yield lo(di.setActivateState({loading:!0}));try{yield yo(dy.auth.resendActivationEmail,n),yield lo(di.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield lo(di.setActivateState({loading:!1,error:e.message})),yield lo(di.setTeamError({key:dv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:!1}))}function*mv(){yield ca(di.activateAccount,Sv),yield ca(di.preActivateAccount,gv),yield ca(di.getActivateAccountStrategy,vv),yield ca(di.resendActivationEmail,hv)}function*bv({payload:e}){if(e.token&&e.userId)try{yield lo(di.setAcceptInvitationState({error:void 0,step:Gt.pending})),yield yo(dy.auth.acceptInvitation,e),yield lo(di.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Gt.success}}))}catch(e){yield lo(di.setAcceptInvitationState({step:Gt.failed,error:e.message}))}else yield lo(di.setAcceptInvitationState({error:void 0,step:Gt.invalid}))}function*Av(){yield ca(di.acceptInvitation,bv)}var kv,Tv=new Uint8Array(16);function Pv(){if(!kv&&!(kv="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 kv(Tv)}for(var Iv=/^(?:[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,Lv=function(e){return"string"==typeof e&&Iv.test(e)},Ev=[],Ov=0;Ov<256;++Ov)Ev.push((Ov+256).toString(16).substr(1));var wv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Pv)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Ev[e[t+0]]+Ev[e[t+1]]+Ev[e[t+2]]+Ev[e[t+3]]+"-"+Ev[e[t+4]]+Ev[e[t+5]]+"-"+Ev[e[t+6]]+Ev[e[t+7]]+"-"+Ev[e[t+8]]+Ev[e[t+9]]+"-"+Ev[e[t+10]]+Ev[e[t+11]]+Ev[e[t+12]]+Ev[e[t+13]]+Ev[e[t+14]]+Ev[e[t+15]]).toLowerCase();if(!Lv(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let Cv,Dv;!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"}(Cv||(Cv={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Dv||(Dv={}));const Rv=["callback"],Uv=["roles"],_v=["callback"],Mv=["callback","profileImage"],Nv=["callback"],Fv=["callback","userId"],$v=["callback"],Gv=["callback"],xv=["callback"],Vv=["callback"],jv=["callback"],Wv=["callback"],Kv=["callback"],Bv=["callback","profileImage"],zv=["callback"],qv=["callback"],Hv=["callback"],Jv=["callback"],Yv=["callback"],Qv=["callback"],Xv=()=>go((e=>e.auth.teamState));function*Zv(){try{const{groups:e}=yield yo(dy.groups.getGroups,{_groupsRelations:Dv.roles});return e}catch(e){return[]}}function*eh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Xv(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield lo(di.setTeamLoader({key:dv.USERS,value:!a})),yield lo(di.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield co([yo(dy.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),yo(dy.teams.loadAvailableRoles),yo(dy.teams.loadAvailablePermissions),yo(Zv)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return w({},e,{groups:n})}));yield lo(di.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield lo(di.setTeamError({key:dv.USERS,value:e.message})),yield lo(di.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield lo(di.setTeamLoader({key:dv.USERS,value:!1}))}function*th({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Xv(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield lo(di.setTeamLoader({key:dv.USERS,value:!r})),yield lo(di.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield co([yo(dy.subTenants.loadAllUsers,w({},c)),yo(dy.teams.loadAvailableRoles),yo(dy.teams.loadAvailablePermissions)]);yield lo(di.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield lo(di.setTeamError({key:dv.USERS,value:e.message})),yield lo(di.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield lo(di.setTeamLoader({key:dv.USERS,value:!1}))}function*nh({payload:e}){yield lo(di.setTeamLoader({key:dv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield co([yo(dy.teams.loadAvailableRoles),yo(dy.teams.loadAvailablePermissions)]);yield lo(di.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield lo(di.setTeamError({key:dv.ROLES_AND_PERMISSIONS,value:t.message}))}yield lo(di.setTeamLoader({key:dv.ROLES_AND_PERMISSIONS,value:!0}))}function*ih({payload:e}){const{callback:t}=e,n=Pi(e,Rv),i=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield yo(dy.teams.addUser,n),{roles:a}=e,r=w({},Pi(e,Uv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield lo(di.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*oh({payload:e}){const{callback:t}=e,n=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield lo(di.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield yo(dy.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield lo(di.loadUsers(r)),yield lo(di.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*ah({payload:e}){const{callback:t}=e,n=Pi(e,_v),i=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})}));try{yield yo(dy.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield yo(dy.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield lo(di.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*rh({payload:e}){const{callback:t}=e,n=Pi(e,Mv),{id:i}=n,o=yield Xv(),a=o.users.find((e=>e.id===n.id));yield lo(di.setTeamLoader({key:dv.UPDATE_USER,value:i||""})),yield lo(di.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0})})),yield lo(di.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?w({},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 yo(dy.teams.updateUser,n);null==t||t(e),yield lo(di.setTeamState({users:o.users.map((t=>t.id===e.id?w({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield lo(di.setTeamLoader({key:dv.UPDATE_USER,value:!1}))}catch(e){yield lo(di.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?w({},e,a):e))})),yield lo(di.setTeamLoader({key:dv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*sh({payload:e}){const{callback:t}=e,n=Pi(e,Nv),i=yield Xv();yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})}));try{yield yo(dy.teams.deleteUser,n),null==t||t(!0),yield lo(di.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*lh({payload:e}){const{callback:t,userId:n}=e,i=Pi(e,Fv),o=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0})}));try{yield yo(dy.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return w({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield lo(di.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[w({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield lo(di.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*ch({payload:e}){const{callback:t}=e,n=Pi(e,$v),i=yield Xv();yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})}));try{yield yo(dy.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield lo(di.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*uh({payload:e}){const{callback:t}=e,n=Pi(e,Gv);yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield yo(dy.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield lo(di.setTeamError({key:dv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:!1}))}function*dh({payload:e}){const{callback:t}=e,n=Pi(e,xv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email}));try{yield yo(dy.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield lo(di.setTeamError({key:dv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*yh({payload:e}){const{callback:t}=e,n=Pi(e,Vv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email}));try{yield yo(dy.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield lo(di.setTeamError({key:dv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*fh({payload:e}){const{callback:t}=e,n=Pi(e,jv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email}));try{yield yo(dy.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield lo(di.setTeamError({key:dv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*ph(){yield lo(di.setTeamError({key:dv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield yo(dy.teams.getInviteLinkConfiguration);yield lo(di.setTeamState({inviteTokenState:w({},e)}))}catch(e){yield lo(di.setTeamError({key:dv.CONFIG_TOKEN_LINK,value:e.message}))}}function*gh(){yield lo(di.setTeamError({key:dv.GET_TOKEN_LINK,value:!1}));try{yield yo(ph);const e=yield yo(dy.teams.getInviteUserLink),{inviteTokenState:t}=yield Xv();yield lo(di.setTeamState({inviteTokenState:w({},t,e)}))}catch(e){yield lo(di.setTeamError({key:dv.GET_TOKEN_LINK,value:e.message}))}}function*Sh({payload:{callback:e}}){yield lo(di.setTeamError({key:dv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Xv();try{const n=yield yo(dy.teams.createInviteUserLink,{expiresInMinutes:43200});yield lo(di.setTeamState({inviteTokenState:w({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield lo(di.setTeamError({key:dv.CREATE_TOKEN_LINK,value:t.message}))}}function*vh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Xv();yield lo(di.setTeamError({key:dv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield yo(dy.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield lo(di.setTeamState({inviteTokenState:w({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield lo(di.setTeamError({key:dv.UPDATE_TOKEN_LINK,value:t.message}))}}function*hh({payload:e}){const{callback:t}=null!=e?e:{};yield lo(di.setTeamError({key:dv.DELETE_TOKEN_LINK,value:!1}));try{yield yo(dy.teams.deleteInviteUserLink),yield lo(di.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield lo(di.setTeamError({key:dv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*mh({payload:e}){yield lo(di.setTeamState({addUserDialogState:w({open:!0,loading:!1,error:!1},e)}))}function*bh({payload:e}){const t=yield Xv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield lo(di.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Ah({payload:e}){yield lo(di.setTeamState({deleteUserDialogState:w({open:!0,loading:!1,error:!1},e)}))}function*kh({payload:e}){const t=yield Xv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield lo(di.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Th(){yield la(di.loadUsers,eh),yield la(di.loadAllSubTenantsUsers,th),yield la(di.loadRoles,nh),yield sa(di.addUser,ih),yield sa(di.addUsersBulk,oh),yield sa(di.addUserToSubTenants,ah),yield sa(di.updateUser,rh),yield sa(di.setUserRolesForSubTenants,lh),yield sa(di.deleteUser,sh),yield sa(di.deleteUserFromSubTenants,ch),yield sa(di.resendActivationLink,uh),yield sa(di.resendInvitationLink,dh),yield sa(di.resendInvitationEmail,yh),yield sa(di.resendInvitationLinkToAllSubTenants,fh),yield sa(di.getInvitationLink,gh),yield sa(di.createInvitationLink,Sh),yield sa(di.updateInvitationLink,vh),yield sa(di.deleteInvitationLink,hh),yield sa(di.openAddUserDialog,mh),yield sa(di.closeAddUserDialog,bh),yield sa(di.openDeleteUserDialog,Ah),yield sa(di.closeDeleteUserDialog,kh)}function*Ph({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Xv(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield lo(di.setTeamLoader({key:dv.USERS,value:!a})),yield lo(di.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield ht(),yield lo(di.setTeamState({users:Xy,totalPages:2,totalItems:10,roles:zy,permissions:Hy})),yield lo(di.setTeamLoader({key:dv.USERS,value:!1})),null==r||r(Xy)}function*Ih({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Xv(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield lo(di.setTeamLoader({key:dv.USERS,value:!r})),yield lo(di.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield ht(),yield lo(di.setTeamState({allUsers:Zy,totalPages:2,totalItems:10,roles:zy,permissions:Hy})),yield lo(di.setTeamLoader({key:dv.USERS,value:!1})),null==s||s(Zy)}function*Lh({payload:e}){var t;yield lo(di.setTeamLoader({key:dv.ROLES_AND_PERMISSIONS,value:!0})),yield ht(),yield lo(di.setTeamState({roles:zy,permissions:Hy})),yield lo(di.setTeamLoader({key:dv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:zy,permissions:Hy})}function*Eh({payload:e}){const{callback:t}=e,n=Pi(e,Wv),i=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})})),yield ht();const o=w({},Yy,{groups:[]},n,{id:`${wv()}`});null==t||t(o),yield lo(di.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Oh({payload:e}){const{callback:t}=e,n=Pi(e,Kv),i=yield Xv();yield lo(di.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})})),yield ht();const o=w({},Yy,n,{id:`${wv()}`});yield lo(di.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*wh({payload:e}){var t;const{callback:n}=e,i=Pi(e,Bv),{id:o}=i,a=yield Xv(),r=a.users.find((e=>e.id===i.id));yield lo(di.setTeamLoader({key:dv.UPDATE_USER,value:o||""})),yield lo(di.setTeamState({addUserDialogState:w({},a.addUserDialogState,{loading:!0})})),yield lo(di.setTeamState({addUserDialogState:w({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?w({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield ht();const s=w({},r,i);null==n||n(s),yield lo(di.setTeamState({users:a.users.map((e=>e.id===s.id?w({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield lo(di.setTeamLoader({key:dv.UPDATE_USER,value:!1}))}function*Ch({payload:e}){const{callback:t}=e,n=Pi(e,zv),i=yield Xv();yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})})),yield ht(),null==t||t(!0),yield lo(di.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Dh({payload:e}){const{callback:t}=e,n=Pi(e,qv),i=yield Xv();yield lo(di.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})})),yield ht(),null==t||t(!0),yield lo(di.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Rh({payload:e}){const{callback:t}=e,n=Pi(e,Hv);yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:n.userId})),yield ht(),null==t||t(!0),yield lo(di.setTeamLoader({key:dv.RESEND_ACTIVATE_LINK,value:!1}))}function*Uh({payload:e}){const{callback:t}=e,n=Pi(e,Jv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email})),yield ht(),null==t||t(!0),yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*_h({payload:e}){const{callback:t}=e,n=Pi(e,Yv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email})),yield ht(),null==t||t(!0),yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*Mh({payload:e}){const{callback:t}=e,n=Pi(e,Qv);yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:n.email})),yield ht(),null==t||t(!0),yield lo(di.setTeamLoader({key:dv.RESEND_INVITATION_LINK,value:!1}))}function*Nh(){yield la(di.loadUsers,Ph),yield la(di.loadAllSubTenantsUsers,Ih),yield la(di.loadRoles,Lh),yield sa(di.addUser,Eh),yield sa(di.addUserToSubTenants,Oh),yield sa(di.updateUser,wh),yield sa(di.deleteUser,Ch),yield sa(di.deleteUserFromSubTenants,Dh),yield sa(di.resendActivationLink,Rh),yield sa(di.resendInvitationLink,Uh),yield sa(di.resendInvitationEmail,_h),yield sa(di.resendInvitationLinkToAllSubTenants,Mh),yield sa(di.openAddUserDialog,mh),yield sa(di.closeAddUserDialog,bh),yield sa(di.openDeleteUserDialog,Ah),yield sa(di.closeDeleteUserDialog,kh)}const Fh=["authorizationUrl"],$h=["events","url"];function*Gh(){try{yield lo(di.setSocialLoginsState({loading:!0}));const e=yield yo(dy.auth.getSocialLoginProviders);yield lo(di.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield lo(di.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*xh(){try{const e=yield go((e=>e.root.context));yield lo(di.setSocialLoginsState({loading:!0}));const t=yield yo(dy.auth.getSocialLoginProvidersV2),{providers:n}=yield yo(dy.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Pi(t,Fh);const o=fa(e,null!=n?n:"");return w({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield lo(di.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield lo(di.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Vh(e){let{payload:{events:t,url:n}}=e,i=Pi(e.payload,$h);try{yield lo(di.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield yo(dy.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:uf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:cf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield lo(di.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield go((e=>e.auth));e?yield yo(Mp):yield yo(Fp)}(),localStorage.removeItem("register-quick-login"),yield lo(di.setSocialLoginsState({loading:!1}))}catch(e){var r;yield lo(di.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*jh({payload:e}){yield lo(di.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Wh(){yield ca(di.loadSocialLoginsConfiguration,Gh),yield ca(di.loadSocialLoginsConfigurationV2,xh),yield ca(di.loginViaSocialLogin,Vh),yield la(di.setSocialLoginError,jh)}let Kh;function*Bh({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield go((e=>e.auth.apiTokensState));try{let e,a;yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield yo(dy.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield yo(dy.auth.updateUserApiTokensData,{description:t}),yield lo(di.setApiTokensState({showAddTokenDialog:!1})),yield So(200),yield lo(di.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield lo(di.setApiTokensError({key:Kh.ADD_API_TOKEN,value:e.message})),yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*zh({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield go((e=>e.auth.apiTokensState));try{let e,r;yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield yo(dy.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield yo(dy.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield lo(di.setApiTokensState({showAddTokenDialog:!1})),yield So(200),yield lo(di.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield lo(di.setApiTokensError({key:Kh.ADD_API_TOKEN,value:e.message})),yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*qh({payload:e}){const{apiTokensDataUser:t}=yield go((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!0})),n?(yield yo(dy.auth.deleteUserAccessToken,{id:e}),yield lo(di.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield yo(dy.auth.deleteUserApiToken,{tokenId:e}),yield lo(di.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!1}))}catch(e){yield lo(di.setApiTokensError({key:Kh.DELETE_API_TOKEN,value:e.message})),yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!1}))}}function*Hh({payload:e}){const{apiTokensDataTenant:t}=yield go((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!0})),n?(yield yo(dy.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield yo(dy.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield lo(di.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!1}))}catch(e){yield lo(di.setApiTokensError({key:Kh.DELETE_API_TOKEN,value:e.message})),yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!1}))}}function*Jh({payload:e}){null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield co([yo(dy.auth.getUserApiTokensData),yo(dy.auth.getTenantApiTokensData)]);yield lo(di.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setApiTokensError({key:Kh.LOAD_API_TOKENS,value:t.message})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Yh({payload:e}){null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=yo(dy.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=yo(dy.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield lo(di.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield lo(di.setApiTokensError({key:Kh.LOAD_API_TOKENS,value:t.message})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Qh({payload:e}){null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=yo(dy.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=yo(dy.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield lo(di.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield lo(di.setApiTokensError({key:Kh.LOAD_API_TOKENS,value:t.message})),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Xh(){yield ca(di.loadApiTokens,Jh),yield ca(di.loadUserApiTokens,Yh),yield ca(di.loadTenantApiTokens,Qh),yield sa(di.addUserApiToken,Bh),yield sa(di.addTenantApiToken,zh),yield la(di.deleteTenantApiToken,Hh),yield la(di.deleteUserApiToken,qh)}function*Zh({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield go((e=>e.auth.apiTokensState)),a=w({},_y,{description:t,roleIds:n,clientId:`CLIENT_ID_${wv()}`});yield lo(di.setApiTokensState({showAddTokenDialog:!1})),yield So(200),yield lo(di.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield So(200),yield lo(di.setApiTokensLoader({key:Kh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*em({payload:e}){yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!0})),yield So(200);const t=[_y];yield lo(di.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield lo(di.setApiTokensLoader({key:Kh.DELETE_API_TOKEN,value:!1}))}function*tm({payload:e}){var t;null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));const n=[Uy],i=[_y];yield lo(di.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield So(200),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*nm({payload:e}){var t;null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));const n=[Uy];yield lo(di.setApiTokensState({apiTokensDataUser:n})),yield So(200),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*im({payload:e}){var t;null!=e&&e.silentLoading||(yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!0})));const n=[_y];yield lo(di.setApiTokensState({apiTokensDataTenant:n})),yield So(200),yield lo(di.setApiTokensLoader({key:Kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*om(){yield ca(di.loadApiTokens,tm),yield ca(di.loadUserApiTokens,nm),yield ca(di.loadTenantApiTokens,im),yield sa(di.addTenantApiToken,Zh),yield la(di.deleteTenantApiToken,em)}function*am({payload:e}){try{var t;yield lo(di.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield go((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield yo(dy.accountSettings.updateSettings,w({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield lo(di.setAccountSettingsState(w({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield lo(di.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*rm({payload:e}){yield lo(di.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield yo(dy.accountSettings.getSettings);yield lo(di.setAccountSettingsState(w({},e,{loading:!1})))}catch(e){yield lo(di.setAccountSettingsState({loading:!1,error:e.message}))}}function*sm(){yield ca(di.saveAccountSettings,am),yield ca(di.loadAccountSettings,rm)}function*lm({payload:e}){var t;yield lo(di.setAccountSettingsState({loading:!0})),yield ht();const{accountSettingsState:n}=yield go((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=w({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield lo(di.setAccountSettingsState(w({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*cm({payload:e}){yield lo(di.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield ht(),yield lo(di.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*um(){yield ca(di.saveAccountSettings,lm),yield ca(di.loadAccountSettings,cm)}function*dm({payload:{tenantId:e,callback:t}}){yield lo(di.setState({isLoading:!0}));try{yield yo(dy.tenants.switchTenant,{tenantId:e}),yield yo(Up),(null==t?void 0:t(!0))||(yield lo(di.setState({isLoading:!1})))}catch(e){yield lo(di.setState({isLoading:!1})),null==t||t(!1,e)}}function*ym({payload:e}){yield lo(di.setTenantsState({loading:!0}));try{var t;const n=yield yo(dy.tenants.getTenants);yield lo(di.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield lo(di.setTenantsState({loading:!1}))}}function*fm({payload:e}){yield lo(di.setTenantsState({loading:!0}));try{var t;const n=yield yo(dy.tenants.getSubTenants);yield lo(di.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*pm({payload:e}){yield lo(di.setTenantsState({loading:!0}));try{var t;const n=yield yo(dy.tenants.getSubTenantsAsTree);yield lo(di.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield lo(di.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*gm(){yield sa(di.loadTenants,ym),yield sa(di.loadSubTenants,fm),yield sa(di.switchTenant,dm),yield sa(di.loadSubTenantsTree,pm)}function*Sm(){yield lo(di.setTenantsState({loading:!0})),yield ht(),yield lo(di.setTenantsState({tenants:ef,loading:!1}))}function*vm(){yield sa(di.loadTenants,Sm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Kh||(Kh={}));const hm=["callback"],mm=["callback"],bm=["callback"],Am=["callback"],km=["callback"];function*Tm({payload:e}){var t;yield lo(di.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield co([yo(dy.roles.getRoles),yo(dy.roles.getPermissions),yo(dy.roles.getPermissionCategories)]),[t,n,i]=e;yield lo(di.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield lo(di.setRolesState({error:e.message,loading:!1}))}}function*Pm(e){let{payload:{callback:t}}=e,n=Pi(e.payload,hm);yield lo(di.setRolesState({saving:!0}));try{const e=yield yo(dy.roles.addRole,n),i=yield yo(dy.roles.getRoles);yield lo(di.loadRolesAndPermissions({silentLoading:!0})),yield lo(di.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield lo(di.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Im(e){let{payload:{callback:t}}=e,n=Pi(e.payload,mm);yield lo(di.setRolesState({saving:!0}));try{yield yo(dy.roles.deleteRole,n),yield lo(di.loadRolesAndPermissions({silentLoading:!0})),yield lo(di.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Lm(e){let{payload:{callback:t}}=e,n=Pi(e.payload,bm);yield lo(di.setRolesState({saving:!0}));try{const e=yield yo(dy.roles.updateRole,n);yield lo(di.loadRolesAndPermissions({silentLoading:!0})),yield lo(di.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield lo(di.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Em(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Am);yield lo(di.setRolesState({saving:!0}));try{const e=yield yo(dy.roles.attachPermissionsToRole,n);yield lo(di.loadRolesAndPermissions({silentLoading:!0})),yield lo(di.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield lo(di.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Om(e){let{payload:{callback:t}}=e,n=Pi(e.payload,km);yield lo(di.setRolesState({saving:!0}));try{const e=yield yo(dy.roles.attachPermissionToRoles,n);yield lo(di.loadRolesAndPermissions({silentLoading:!0})),yield lo(di.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield lo(di.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*wm(){yield ca(di.loadRolesAndPermissions,Tm),yield sa(di.addRole,Pm),yield sa(di.deleteRole,Im),yield sa(di.updateRole,Lm),yield sa(di.attachPermissionsToRole,Em),yield sa(di.attachPermissionToRoles,Om)}function*Cm({payload:e}){var t;yield lo(di.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield lo(di.setRolesState({roles:My,loading:!1}))}catch(e){yield lo(di.setRolesState({error:e.message,loading:!1}))}}function*Dm(){yield ca(di.loadRolesAndPermissions,Cm)}const Rm=["callback"],Um=["callback"],_m=["callback"];function*Mm(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Rm);yield lo(di.setResetPhoneNumberState({loading:!0}));try{const e=yield yo(dy.auth.resetPhoneNumber,n);yield lo(di.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:qt.VerifyResetPhoneNumber})),yield lo(di.setLoginState({email:n.email}))}catch(e){yield lo(di.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Nm(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Um);yield lo(di.setResetPhoneNumberState({loading:!0}));try{const e=yield yo(dy.auth.verifyResetPhoneNumber,n);yield lo(di.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:qt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield lo(di.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Fm(e){let{payload:{callback:t}}=e,n=Pi(e.payload,_m);yield lo(di.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield go((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield yo(dy.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield lo(di.setLoginState({step:Tt.loginWithSmsOtc})),yield lo(di.passwordlessPreLogin({type:_r.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield lo(di.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*$m(){yield ca(di.resetPhoneNumber,Mm),yield ca(di.verifyResetPhoneNumber,Nm),yield ca(di.changePhoneNumber,Fm)}function*Gm(){yield lo(di.setSessionsState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getCurrentUserSessions);yield lo(di.setSessionsState({sessions:e,loading:!1}))}catch(e){yield lo(di.setSessionsState({error:e,loading:!1}))}}function*xm(){yield lo(di.setSessionsState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getCurrentUserSession);yield lo(di.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield lo(di.setSessionsState({error:e,loading:!1}))}}function*Vm({payload:{id:e}}){yield lo(di.setSessionsState({loading:!0,error:null}));try{yield yo(dy.auth.deleteSessionForUser,e),yield lo(di.loadUserSessions())}catch(e){yield lo(di.setSessionsState({error:e,loading:!1}))}}function*jm({payload:{callback:e,userId:t}}){yield lo(di.setSessionsState({loading:!0,error:null}));try{yield yo(dy.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield lo(di.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Wm(){yield lo(di.setSessionsState({loading:!0,error:null}));try{yield yo(dy.auth.deleteAllSessionsForUser),yield lo(di.loadUserSessions())}catch(e){yield lo(di.setSessionsState({error:e,loading:!1}))}}function*Km(){yield la(di.loadUserSessions,Gm),yield la(di.deleteUserSession,Vm),yield la(di.deleteAllUserSessions,Wm),yield la(di.loadCurrentUserSession,xm),yield sa(di.revokeUserSessions,jm)}function*Bm(){yield lo(di.setSessionsState({loading:!0,error:null})),yield lo(di.setSessionsState({sessions:tf,loading:!1}))}function*zm({payload:{id:e}}){yield lo(di.setSessionsState({loading:!0,error:null}));const t=(yield go((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield lo(di.setSessionsState({sessions:t,loading:!1}))}function*qm(){yield lo(di.setSessionsState({loading:!0,error:null}));const e=tf.filter((e=>e.current));yield lo(di.setSessionsState({sessions:e,loading:!1}))}function*Hm(){yield la(di.loadUserSessions,Bm),yield la(di.deleteUserSession,zm),yield la(di.deleteAllUserSessions,qm)}const Jm=["callback"],Ym=["callback"];function*Qm(){yield lo(di.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getSessionConfigurations);yield lo(di.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield lo(di.setSessionsState({error:e,loading:!1}))}}function*Xm({payload:e}){yield lo(di.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Pi(e,Jm);yield yo(dy.auth.createOrUpdateSessionConfigrations,n),yield lo(di.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield lo(di.setSessionsPolicyState({error:e,loading:!1}))}}function*Zm(){yield ca(di.loadSessionsPolicy,Qm),yield la(di.createOrUpdateSessionsPolicy,Xm)}function*eb(){yield lo(di.setSessionsPolicyState({loading:!0,error:null}));const e=yield go((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:nf}));yield lo(di.setSessionsPolicyState(w({},e,{loading:!1})))}function*tb({payload:e}){yield lo(di.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Pi(e,Ym);null==t||t(!0),yield lo(di.setSessionsPolicyState({configurations:n,loading:!1}))}function*nb(){yield ca(di.loadSessionsPolicy,eb),yield la(di.createOrUpdateSessionsPolicy,tb)}const ib=["callback"],ob=["callback"],ab=["callback"],rb=["callback"],sb=["callback"],lb=["callback"],cb=["callback"],ub=["callback"],db=()=>go((e=>e.auth.restrictionsState.ipRestrictions)),yb=()=>go((e=>e.auth.restrictionsState.emailDomainRestrictions));function*fb(){yield lo(di.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield yo(dy.auth.getDomainRestrictionsConfig),t=(yield yo(dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield lo(di.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield lo(di.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*pb(e){let{payload:{callback:t}}=e,n=Pi(e.payload,ib);yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield yb();try{var o;yield yo(dy.auth.createDomainRestriction,n);const e=(yield yo(dy.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield lo(di.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*gb(e){let{payload:{callback:t}}=e,n=Pi(e.payload,ob);yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield yo(dy.auth.updateDomainRestrictionConfig,n),i=(yield yo(dy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield lo(di.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Sb({payload:{id:e}}){yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield yb();try{var n;yield yo(dy.auth.deleteDomainRestriction,e);const i=(yield yo(dy.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield lo(di.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Gn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield lo(di.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const vb=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Gn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*hb(){yield lo(di.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield db(),t=yield yo(dy.auth.getIPRestrictionsConfig),n=vb({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield yo(dy.auth.getIPRestrictions,n);yield lo(di.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield lo(di.setIpRestrictionsState({error:e.message,loading:!1}))}}function*mb(){try{const{valid:e}=yield yo(dy.auth.testCurrentIpInAllowList);yield lo(di.setIpRestrictionsState({userIpValid:e}))}catch(e){yield lo(di.setIpRestrictionsState({error:e.message}))}}function*bb({payload:{callback:e}}){yield lo(di.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield go((e=>e.auth.userIp));yield co([yo(dy.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Gn.ALLOW}),yo(dy.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield db(),i=vb(n.pagination),{items:o,_metadata:{totalPages:a}}=yield yo(dy.auth.getIPRestrictions,i);yield lo(di.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Gn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield lo(di.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Ab(e){let{payload:{callback:t}}=e,n=Pi(e.payload,ab);yield lo(di.setIpRestrictionsState({saving:!0,error:null}));const i=yield db();try{var o,a;yield yo(dy.auth.createIPRestriction,n);const e=yield db(),r=vb(e.pagination),{items:s,_metadata:{totalPages:l}}=yield yo(dy.auth.getIPRestrictions,r);yield mb(),yield lo(di.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Gn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*kb(e){let{payload:{callback:t}}=e,n=Pi(e.payload,rb);yield lo(di.setIpRestrictionsState({saving:!0,error:null}));try{yield yo(dy.auth.updateIPRestrictionConfig,n);const e=yield db(),i=yield yo(dy.auth.getIPRestrictionsConfig),o=vb(w({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield yo(dy.auth.getIPRestrictions,o);yield mb(),yield lo(di.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tb({payload:{id:e,callback:t}}){yield lo(di.setIpRestrictionsState({saving:!0,error:null}));const n=yield db();try{var i;yield yo(dy.auth.deleteIPRestriction,e);const o=yield db(),a=vb(o.pagination),{items:r,_metadata:{totalPages:s}}=yield yo(dy.auth.getIPRestrictions,a);yield mb(),yield lo(di.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Gn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Pb(){yield ca(di.loadIpRestrictions,hb),yield ca(di.loadEmailDomainRestrictions,fb),yield sa(di.saveIpRestriction,Ab),yield sa(di.saveIpRestrictionsConfig,kb),yield sa(di.deleteIpRestriction,Tb),yield sa(di.checkIfUserIpValid,mb),yield sa(di.addCurrentUserIpAndActivate,bb),yield sa(di.saveEmailDomainRestriction,pb),yield sa(di.saveEmailDomainRestrictionsConfig,gb),yield sa(di.deleteEmailDomainRestriction,Sb)}function*Ib(){yield lo(di.setIpRestrictionsState({loading:!0,error:null})),yield lo(di.setIpRestrictionsState({data:{restrictions:af.filter((e=>e.strategy===of.strategy)),config:of},totalPages:1,pagination:{_filter:Gn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Lb(){yield lo(di.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield db(),t=af[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield lo(di.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield lo(di.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Eb(e){var t,n,i;let{payload:{callback:o}}=e,a=Pi(e.payload,sb);yield lo(di.setIpRestrictionsState({saving:!0,error:null}));const r=yield db(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield lo(di.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Gn.ALLOW},restrictions:[...s,w({},a,{createdAt:new Date,updatedAt:new Date,id:wv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Gn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Ob(e){var t,n,i;let{payload:{callback:o}}=e,a=Pi(e.payload,lb);const r=yield db();yield lo(di.setIpRestrictionsState({saving:!0,error:null})),yield lo(di.setIpRestrictionsState({data:{config:w({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Gn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield lo(di.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*wb({payload:{id:e,callback:t}}){var n;yield lo(di.setIpRestrictionsState({saving:!0,error:null}));const i=yield db();yield lo(di.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Gn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Gn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Cb(){yield lo(di.setEmailDomainRestrictionsState({loading:!0,error:null})),yield lo(di.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Gn.ALLOW}],config:{active:!0,listType:Gn.ALLOW,blockPublicDomains:!1}}}))}function*Db(e){var t,n;let{payload:{callback:i}}=e,o=Pi(e.payload,cb);const a=yield yb();yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ht(),null==i||i(!0),yield lo(di.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],w({},o,{id:Date.now().toString()})]},saving:!1}))}function*Rb(e){var t;let{payload:{callback:n}}=e,i=Pi(e.payload,ub);const o=yield yb();yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ht(),null==n||n(!0),yield lo(di.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Gn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Ub({payload:{id:e}}){var t,n;const i=yield yb();yield lo(di.setEmailDomainRestrictionsState({saving:!0,error:null})),yield ht(),yield lo(di.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Gn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*_b(){yield ca(di.loadIpRestrictions,Ib),yield ca(di.loadEmailDomainRestrictions,Cb),yield sa(di.saveIpRestriction,Eb),yield sa(di.saveIpRestrictionsConfig,Ob),yield sa(di.deleteIpRestriction,wb),yield sa(di.checkIfUserIpValid,Lb),yield sa(di.saveEmailDomainRestriction,Db),yield sa(di.saveEmailDomainRestrictionsConfig,Rb),yield sa(di.deleteEmailDomainRestriction,Ub)}const Mb=["callback"],Nb=["id"];function*Fb(e){const{count:t}=yield yo(dy.directory.countConfigurationUsers,e.id);return w({},e,{count:t})}function*$b(){yield lo(di.setProvisioningState({loading:!0,error:null}));try{const e=yield yo(dy.directory.getConfigs),t=yield co(e.map((e=>Fb(e))));yield lo(di.setProvisioningState({connections:t,loading:!1}))}catch(e){yield lo(di.setProvisioningState({error:e.message,loading:!1}))}}function*Gb(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Mb);yield lo(di.setProvisioningState({loading:!0,error:null}));try{const e=yield yo(dy.directory.createConfiguration,n),i=yield yo(dy.directory.getConfigs),o=yield co(i.map((e=>Fb(e))));yield lo(di.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield lo(di.setProvisioningState({error:e.message,loading:!1}))}}function*xb(e){let{payload:{id:t}}=e,n=Pi(e.payload,Nb);yield lo(di.setProvisioningState({loading:!0,error:null}));try{yield yo(dy.directory.updateConfiguration,t,n);const e=yield yo(dy.directory.getConfigs),i=yield co(e.map((e=>Fb(e))));yield lo(di.setProvisioningState({connections:i,loading:!1}))}catch(e){yield lo(di.setProvisioningState({error:e.message,loading:!1}))}}function*Vb({payload:{id:e,callback:t}}){yield lo(di.setProvisioningState({loading:!0,error:null}));try{yield yo(dy.directory.deleteConfiguration,e);const n=yield yo(dy.directory.getConfigs),i=yield co(n.map((e=>Fb(e))));yield lo(di.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*jb(){yield ca(di.loadProvisionConnections,$b),yield sa(di.createProvisionConnection,Gb),yield sa(di.deleteProvisionConnection,Vb),yield sa(di.updateProvisionConnection,xb)}const Wb=["callback","events"];function*Kb(e){let{payload:{callback:t}}=e,n=Pi(e.payload,Wb);yield lo(di.setImpersonateState({loading:!0}));try{yield yo(dy.impersonate.impersonate,n),yield lo(di.setImpersonateState({step:ai.success})),yield So(1e3),yield Ip(),yield lo(di.resetImpersonateState()),null==t||t(!0)}catch(e){yield lo(di.setImpersonateState({loading:!1,error:e.message}))}}function*Bb(){yield ca(di.impersonate,Kb)}function*zb({payload:e}){const{callback:t,deviceId:n}=e;yield lo(di.setPasskeysState({loading:!0}));try{yield yo(dy.auth.deleteWebAuthnDevice,n);const{devices:e}=yield go((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield lo(di.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield lo(di.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*qb(){yield lo(di.setPasskeysState({loading:!0}));try{const{devices:e}=yield yo(dy.auth.getWebAuthnDevices);yield lo(di.setPasskeysState({devices:e,loading:!1}))}catch(e){yield lo(di.setPasskeysState({loading:!1,error:e.message||null}))}}function*Hb(){yield sa(di.loadWebAuthnDevices,qb),yield sa(di.deleteWebAuthnDevice,zb)}const Jb=["roleIds","userIds"],Yb=()=>go((e=>e.auth.groupsState));function*Qb({payload:e}){const t=Cv.GET_TEAM_USERS;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield yo(dy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield lo(di.setGroupsState({teamUsers:n}))}catch(e){yield lo(di.setUsersGroupsError({key:t,value:e.message}))}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*Xb({payload:e}){const t=Cv.GET_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield yo(dy.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Dv.rolesAndUsers});yield lo(di.setGroupsState({selectedGroup:n}))}catch(e){yield lo(di.setUsersGroupsError({key:t,value:e.message}))}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*Zb(){const e=Cv.GET_GROUPS,t=yield Yb();yield lo(di.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield yo(dy.groups.getGroups,{_groupsRelations:Dv.rolesAndUsers});yield lo(di.setGroupsState(w({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield lo(di.setUsersGroupsError({key:e,value:t.message}))}finally{yield lo(di.setUsersGroupsLoader({key:e,value:!1}))}}function*eA({payload:e}){const t=Cv.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Pi(e,Jb);yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield yo(dy.groups.createGroup,w({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield lo(di.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield lo(di.addRolesToGroup({groupId:r.id,roleIds:n}))),yield lo(di.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*tA({payload:e}){const t=Cv.UPDATE_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.updateGroup,e),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*nA({payload:e}){const t=Cv.DELETE_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.deleteGroup,e.groupId),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*iA({payload:e}){const t=Cv.ADD_ROLES_TO_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*oA({payload:e}){const t=Cv.DELETE_ROLES_FROM_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*aA({payload:e}){const t=Cv.ADD_USERS_TO_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield lo(di.setUsersGroupsError({key:t,value:n.message}))}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*rA({payload:e}){const t=Cv.DELETE_USERS_FROM_GROUP;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield yo(dy.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield lo(di.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield lo(di.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*sA(){const e=Cv.GET_GROUP_CONFIGURATION;yield lo(di.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield yo(dy.groups.getGroupConfiguration);yield lo(di.setGroupsState({groupsConfiguration:t}))}catch(t){yield lo(di.setUsersGroupsError({key:e,value:t.message}))}finally{yield lo(di.setUsersGroupsLoader({key:e,value:!1}))}}function*lA({payload:e}){const t=Cv.UPDATE_GROUP_CONFIGURATION;yield lo(di.setUsersGroupsLoader({key:t,value:!0}));try{yield yo(dy.groups.updateGroupConfiguration,e),yield lo(di.getGroupConfiguration())}catch(e){yield lo(di.setUsersGroupsError({key:t,value:e.message}))}finally{yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}}function*cA(){yield la(di.loadGroups,Zb),yield la(di.getGroupById,Xb),yield la(di.createGroup,eA),yield la(di.updateGroup,tA),yield la(di.deleteGroup,nA),yield la(di.addRolesToGroup,iA),yield la(di.deleteRolesFromGroup,oA),yield la(di.addUsersToGroup,aA),yield la(di.deleteUsersFromGroup,rA),yield la(di.getGroupConfiguration,sA),yield la(di.updateGroupConfiguration,lA),yield la(di.getTeamUsers,Qb)}function*uA(){const e=Cv.GET_GROUPS;yield lo(di.setUsersGroupsLoader({key:e,value:!0}));const t=lf;yield lo(di.setGroupsState({groups:t})),yield lo(di.setUsersGroupsLoader({key:e,value:!1}))}function*dA({payload:e}){var t;const n=Cv.CREATE_GROUP,{groups:i}=yield Yb();yield lo(di.setUsersGroupsLoader({key:n,value:!0})),yield lo(di.setGroupsState({groups:[w({},e,{id:`${e.name}ID`,managedBy:ly.FRONTEGG}),...null!=i?i:[]]})),yield So(500),null==e||null==(t=e.callback)||t.call(e,!0),yield lo(di.setUsersGroupsLoader({key:n,value:!1}))}function*yA({payload:e}){var t,n,i,o,a;const r=Cv.UPDATE_GROUP,s=yield Yb();yield lo(di.setUsersGroupsLoader({key:r,value:!0})),yield lo(di.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?w({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:ly.FRONTEGG}):t})),selectedGroup:w({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield So(500),null==e||null==(a=e.callback)||a.call(e,!0),yield lo(di.setUsersGroupsLoader({key:r,value:!1}))}function*fA({payload:e}){var t,n;const i=Cv.DELETE_GROUP,o=yield Yb();yield lo(di.setUsersGroupsLoader({key:i,value:!0})),yield lo(di.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield So(500),null==e||null==(n=e.callback)||n.call(e,!0),yield lo(di.setUsersGroupsLoader({key:i,value:!1}))}function*pA({payload:e}){var t,n;const i=Cv.ADD_ROLES_TO_GROUP,o=yield Yb();yield lo(di.setUsersGroupsLoader({key:i,value:!0})),yield lo(di.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?w({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield So(500),null==e||null==(n=e.callback)||n.call(e,!0),yield lo(di.setUsersGroupsLoader({key:i,value:!1}))}function*gA({payload:e}){var t,n;const i=Cv.DELETE_ROLES_FROM_GROUP,o=yield Yb();yield lo(di.setUsersGroupsLoader({key:i,value:!0})),yield lo(di.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?w({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield So(500),null==e||null==(n=e.callback)||n.call(e,!0),yield lo(di.setUsersGroupsLoader({key:i,value:!1}))}function*SA({payload:e}){var t,n;const i=Cv.ADD_USERS_TO_GROUP,o=yield Yb();yield lo(di.setUsersGroupsLoader({key:i,value:!0})),yield lo(di.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?w({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield So(500),null==e||null==(n=e.callback)||n.call(e,!0),yield lo(di.setUsersGroupsLoader({key:i,value:!1}))}function*vA({payload:e}){var t,n;const i=Cv.DELETE_USERS_FROM_GROUP,o=yield Yb();yield lo(di.setUsersGroupsLoader({key:i,value:!0})),yield lo(di.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?w({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield So(500),null==e||null==(n=e.callback)||n.call(e,!0),yield lo(di.setUsersGroupsLoader({key:i,value:!1}))}function*hA(){const e=Cv.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Yb();yield lo(di.setUsersGroupsLoader({key:e,value:!0})),t&&(yield lo(di.setGroupsState({groupsConfiguration:w({},t)}))),yield lo(di.setUsersGroupsLoader({key:e,value:!1}))}function*mA({payload:e}){const t=Cv.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Yb();yield lo(di.setUsersGroupsLoader({key:t,value:!0})),n&&(yield lo(di.setGroupsState({groupsConfiguration:w({},n,e)}))),yield lo(di.setUsersGroupsLoader({key:t,value:!1}))}function*bA(){yield la(di.loadGroups,uA),yield la(di.createGroup,dA),yield la(di.updateGroup,yA),yield la(di.deleteGroup,fA),yield la(di.addRolesToGroup,pA),yield la(di.deleteRolesFromGroup,gA),yield la(di.addUsersToGroup,SA),yield la(di.deleteUsersFromGroup,vA),yield la(di.getGroupConfiguration,hA),yield la(di.updateGroupConfiguration,mA)}const AA=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...AA(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),kA=["callback"];function*TA(){yield lo(di.setCustomLoginState({loading:!0}));try{const e=yield yo(Tc);yield lo(di.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield lo(di.setCustomLoginState({loading:!1,error:e.message}))}}function*PA(e){let{payload:{callback:t}}=e,n=Pi(e.payload,kA);try{if(yield lo(di.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=AA(n);if(0===e.length)throw new Error("no changes to update");yield yo(Pc,{actions:e});const i=yield yo(Tc);yield lo(di.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield lo(di.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*IA(){yield ca(di.loadTenantMetadata,TA),yield ca(di.updateTenantMetadata,PA)}var LA={sagas:function*(){yield co([yo(Tg),yo(mv),yo(Av),yo(uv),yo($m),yo(Gg),yo(fS),yo(mS),yo(IA),yo(YS),yo(Th),yo(cA),yo(Wh),yo(Sf),yo(Xh),yo(Kf),yo(sm),yo(gm),yo(wm),yo(Km),yo(Zm),yo(Pb),yo(jb),yo(Bb),yo(Hb)])},mockSagas:function*(){yield co([yo(Lg),yo(zg),yo(TS),yo(av),yo(Nh),yo(om),yo(ip),yo(Hm),yo(um),yo(vm),yo(nb),yo(_b),yo(Dm),yo(bA)])},storeName:Ot,initialState:oi,reducer:ci,actions:di};const EA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>w({},t,{[e]:w({},t[e],n)})}),OA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},wA={setAuditLogsState:EA("auditLogsState"),resetAuditLogsState:e=>w({},e,{auditLogsState:OA})},CA={exportAuditsCsv:st("auditLogs/exportAuditsCsv"),loadAuditLogs:st("auditLogs/loadAuditLogs",(e=>({payload:e})))},DA={loading:!0},RA={setAuditsMetadataState:EA("auditsMetadataState"),resetAuditsMetadataState:e=>w({},e,{auditsMetadataState:DA})},UA={loadAuditsMetadata:st("auditLogs/loadAuditsMetadata")},_A={auditLogsState:OA,auditsMetadataState:DA},{reducer:MA,actions:NA}=ct({name:Ct,initialState:_A,reducers:w({resetState:e=>w({},e,_A),setState:(e,{payload:t})=>w({},e,t)},wA,RA)}),FA=w({},NA,CA,UA),$A=e=>"createdAt"!==e.id,GA={total:20,data:Array.from(Array(5).keys()).map((e=>w({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`})))},xA={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}]},VA=()=>go((e=>e.auditLogs.auditLogsState)),jA=()=>go((e=>e.auditLogs.auditsMetadataState));function*WA(){const e=yield VA(),{columns:t}=yield jA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>w({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>w({},e,{[t.id]:t.value})),{});yield lo(FA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield dy.audits.exportAudits(w({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield lo(FA.setAuditLogsState({isDownloadingCsv:!1}))}function*KA({payload:e}){yield lo(FA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield VA(),{columns:n}=yield jA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield lo(FA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>w({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>w({},e,{[t.id]:t.value})),{});n||(yield lo(FA.loadAuditsMetadata()));const{data:p,total:g}=yield yo(dy.audits.getAudits,w({offset:c,count:l},y,f));yield lo(FA.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield lo(FA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*BA(){yield sa(FA.exportAuditsCsv,WA),yield sa(FA.loadAuditLogs,KA)}function*zA({payload:e}){yield lo(FA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield VA(),{columns:n}=yield jA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield lo(FA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield lo(FA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=GA;let i=n.filter((e=>t=>e.filter($A).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield lo(FA.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield lo(FA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*qA(){yield sa(FA.loadAuditLogs,zA)}function*HA(){yield lo(FA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield yo(dy.metadata.getAuditsMetadata);yield lo(FA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield lo(FA.setAuditsMetadataState({error:e,loading:!1}))}}function*JA(){yield sa(FA.loadAuditsMetadata,HA)}function*YA(){yield lo(FA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=xA;yield lo(FA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield lo(FA.setAuditsMetadataState({error:e,loading:!1}))}}function*QA(){yield sa(FA.loadAuditsMetadata,YA)}var XA={sagas:function*(){yield co([yo(BA),yo(JA)])},mockSagas:function*(){yield co([yo(qA),yo(QA)])},storeName:Ct,initialState:_A,reducer:MA,actions:FA};const ZA={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:ek,actions:tk,reducer:nk}=ct({name:"audits",initialState:ZA,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=w({},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]})))}}}),ik=w({},tk,{initData:st(`${ek}/initData`),loadAudits:st(`${ek}/loadAudits`),removeFilter:st(`${ek}/removeFilter`),filterData:st(`${ek}/filterData`),exportCSV:st(`${ek}/exportCSV`),deleteAudits:st(`${ek}/deleteAudits`)}),ok=()=>go((e=>e[ek]));function*ak(){const{sortBy:e,sortDirection:t}=yield ok();try{const n=yield yo(dy.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield lo(ik.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield lo(ik.loadItemFailedAction(t))}}function*rk(){try{const e=yield yo(dy.metadata.getAuditsMetadata);yield lo(ik.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield lo(ik.loadItemFailedAction(t))}}const sk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*lk({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield ok(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield ok():{rowsData:[]};try{const e=sk(t),{data:s,total:d}=yield yo(dy.audits.getAudits,w({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield lo(ik.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield lo(ik.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield lo(ik.loadItemFailedAction(t))}}function*ck(){yield lo(ik.startLoading()),yield co([ak(),rk(),lk({payload:{onlyOneLoad:!1},type:""})]),yield lo(ik.finishLoading())}function*uk({payload:e}){const{filters:t}=yield ok(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield lo(ik.setFilterData(i))}function*dk({payload:e}){const{filters:t}=yield ok();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield lo(ik.setFilterData(i))}function*yk(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield ok(),a=sk(e);yield lo(ik.startDownloadingCsv());try{yield dy.audits.exportAudits(w({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield lo(ik.stopDownloadingCsv())}}function*fk(){yield la(ik.initData,ck),yield la(ik.removeFilter,uk),yield la(ik.filterData,dk),yield la([ik.loadAudits,ik.textSearch,ik.onPageChange],lk),yield la([ik.setFilterData,ik.setDataSorting,ik.startRefresh],(()=>lk({payload:{appendMode:!1},type:""}))),yield la(ik.exportCSV,yk)}const pk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},gk={initData:()=>w({},pk),setConnectivityState:(e,{payload:t})=>w({},e,t),cleanWebhookTestData:e=>w({},e,{testResult:void 0}),cleanWebhookLogsData:e=>w({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return w({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>w({},e,{error:void 0}),cleanSlackData:e=>w({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>w({},e,{retryResult:w({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>w({},e,{retryResult:w({},e.retryResult,t)})}},Sk={loadSlackActions:st("connectivity/loadSlackActions"),loadDataAction:st("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:st("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:st("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:st("connectivity/loadScope"),deleteWebhookConfigAction:st("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:st("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:st("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},vk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:hk,actions:mk}=ct({name:wt,initialState:vk,reducers:w({},gk)}),bk=w({},mk,Sk),Ak={slack:dy.connectivity.getSlackConfiguration,email:dy.connectivity.getEmailConfiguration,sms:dy.connectivity.getSMSConfiguration,webhook:dy.connectivity.getWebhooksConfigurations,categories:dy.connectivity.getCategories,channelMap:dy.connectivity.getChannelMaps},kk={slack:dy.connectivity.postSlackConfiguration,email:dy.connectivity.postEmailConfiguration,sms:dy.connectivity.postSMSConfiguration,webhook:dy.connectivity.postWebhooksConfiguration},Tk=["email","slack","sms","webhook"],Pk={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"}},Ik=["id"],Lk=["id","enabled"],Ek=["categories","channelMap"];function*Ok(e){return yield yo(Ck,{payload:{api:e},type:""})}function*wk({payload:e=Tk}){yield lo(bk.setConnectivityState({isLoading:!0}));try{const t=yield co([...e.map(Ok),yield Ck({payload:{api:"categories"},type:""}),yield function*(){return(yield co(e.map((function*(e){return yield Ck({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>w({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Ck({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?w({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Pk[e[o]].events(i),active:Pk[e[o]].isActive(i),platform:Pk[e[o]].title,image:Pk[e[o]].image}]}):n:w({},n,{[`${Ek[o-e.length]}`]:i})),{list:[],webhook:n});yield lo(bk.setConnectivityState(w({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield lo(bk.setConnectivityState({isLoading:!1}))}}function*Ck({payload:{api:e,params:t}}){try{return yield yo(Ak[e],t)}catch(e){return}}function*Dk(){try{yield lo(bk.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield yo(dy.connectivity.getSlackChannels);yield lo(bk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield lo(bk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Rk(e,t){const{connectivity:{list:n}}=yield go(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Pk[e].isActive(t);o!==i.active&&(yield lo(bk.setConnectivityState({list:n.map((t=>t.key===e?w({},t,{active:o}):t))})))}function*Uk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield go((e=>e.connectivity));try{if(yield lo(bk.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield go();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield co([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Pi(e,Ik);return n===t.id&&JSON.stringify(w({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield yo(kk.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield yo(dy.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield go(),{processIds:i}=yield go((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield co([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield yo("email"===t?dy.connectivity.postEmailConfiguration:dy.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=Pi(o,Lk);return yield co([yield yo("email"===t?dy.connectivity.patchEmailConfiguration:dy.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield yo("email"===t?dy.connectivity.putEmailSubscriptions:dy.connectivity.putSMSSubscriptions,a,i,w({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return yo("email"===t?dy.connectivity.deleteEmailSubscriptions:dy.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Ck({payload:{api:t},type:""});yield lo(bk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Rk(t,e)}else yield lo(bk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield yo(kk[e],t),!["sms","email"].includes(e)){const o=yield Ck({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield lo(bk.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Rk(e,o),null==n||n(!0)}}catch(e){var o;yield lo(bk.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*_k({payload:e}){try{yield dy.connectivity.postSlackCode(e)}catch{}yield lo(bk.setConnectivityState({error:void 0,isSaving:!1}))}function*Mk(){const{slackChannels:e}=yield go((e=>e.connectivity));try{yield lo(bk.setConnectivityState({slackChannels:w({},e,{isLoadingScope:!0})}));const{clientId:t}=yield yo(dy.connectivity.getSlackScope);yield lo(bk.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield lo(bk.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Nk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield go((e=>e.connectivity));try{yield lo(bk.setConnectivityState({isSaving:!0})),yield yo(dy.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Ck({payload:{api:"webhook"},type:""});o&&(yield lo(bk.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Fk({payload:e}){try{yield lo(bk.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield yo(dy.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield lo(bk.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield lo(bk.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield lo(bk.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*$k({payload:e}){try{const{statusCode:t}=yield yo(dy.connectivity.postWebhookRetry,e);yield lo(bk.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield lo(bk.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Gk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield go((e=>e.connectivity));try{yield lo(bk.setConnectivityState({webhookLogs:w({},i,{isLoading:!0})}));const o=yield yo(dy.connectivity.getWebhookLog,e,n,t);yield lo(bk.setConnectivityState({error:void 0,webhookLogs:w({isLoading:!1},o)}))}catch(e){yield lo(bk.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var xk={sagas:function*(){yield sa(bk.loadDataAction,wk),yield la(bk.loadSlackActions,Dk),yield sa(bk.postDataAction,Uk),yield sa(bk.postCodeAction,_k),yield sa(bk.loadScope,Mk),yield sa(bk.deleteWebhookConfigAction,Nk),yield sa(bk.postWebhookTestAction,Fk),yield sa(bk.postWebhookRetryAction,$k),yield la(bk.loadWebhookLogsAction,Gk)},storeName:wt,initialState:vk,reducer:hk,actions:bk};function Vk(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,t.payload)}}}function jk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>w({},n,{[e]:t(n[e],i)})}}function Wk(e){return jk(e,((e,t)=>w({},e,{loading:t.payload})))}function Kk(e){return jk(e,((e,t)=>w({},e,{error:t.payload,loading:!1})))}const Bk={loading:!1,error:null,fetching:!0,plans:[]},{actions:zk,reducer:qk,name:Hk}=ct({name:"subscriptions/plans",initialState:Bk,reducers:w({},Vk())}),Jk=w({loadPlans:st(`${Hk}/loadPlans`)},zk),Yk={loading:!1,error:null,fetching:!0,config:null},Qk=w({},Vk()),{actions:Xk,reducer:Zk,name:eT}=ct({name:"subscriptions/config",initialState:Yk,reducers:Qk}),tT=w({loadPaymentConfiguration:st(`${eT}/loadPaymentConfiguration`)},Xk),nT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},iT=w({},Vk(),{setCancellationLoading:Wk("cancellation"),setCancellationError:Kk("cancellation"),setRenewalLoading:Wk("renewal"),setRenewalError:Kk("renewal")}),{reducer:oT,actions:aT,name:rT}=ct({name:"subscriptions/billing/subscription",initialState:nT,reducers:iT}),sT=w({load:st(`${rT}/loadSubscription`),cancelSubscription:st(`${rT}/cancelSubscription`),renewSubscription:st(`${rT}/renewSubscription`)},aT),lT={loading:!1,error:null,fetching:!0},cT=w({},Vk()),{reducer:uT,actions:dT,name:yT}=ct({name:"subscriptions/billing/information",initialState:lT,reducers:cT}),fT=w({loadBillingInformation:st(`${yT}/loadBillingInformation`),cancelSubscription:sT.cancelSubscription,renewSubscription:sT.renewSubscription},dT),pT={loading:!1,error:null,fetching:!0},gT=w({},Vk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,t.payload)}}),{reducer:ST,actions:vT,name:hT}=ct({name:"subscriptions/billing/payment",initialState:pT,reducers:gT}),mT=w({loadPaymentMethod:st(`${hT}/loadPaymentMethod`),submitPaymentMethod:st(`${hT}/submitPaymentMethod`),submitPaymentMethodError:st(`${hT}/submitPaymentMethodError`),submitPaymentMethodSuccess:st(`${hT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:st(`${hT}/updateBillingDetails`,(e=>({payload:e})))},vT),bT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},AT=w({},Vk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{invoiceDownload:w({},e.invoiceDownload,t.payload)})}}),{reducer:kT,actions:TT,name:PT}=ct({name:"subscriptions/billing/invoices",initialState:bT,reducers:AT}),IT=w({loadInvoices:st(`${PT}/loadInvoices`),downloadInvoice:st(`${PT}/downloadInvoice`,(e=>({payload:e})))},TT),LT={information:lT,invoices:bT,paymentMethod:pT,subscription:nT},ET={invoices:IT,information:fT,paymentMethod:mT,subscription:sT},OT=Ve({invoices:kT,information:uT,paymentMethod:ST,subscription:oT}),wT={fetching:!0,loading:!1,error:null,confirmed:!1},CT=w({},Vk()),{actions:DT,reducer:RT,name:UT}=ct({name:"subscriptions/checkout",initialState:wT,reducers:CT}),_T=w({loadCheckout:st(`${UT}/loadCheckout`),resetCheckout:st(`${UT}/resetCheckout`),submitCheckout:st(`${UT}/submitCheckout`),confirmCheckout:st(`${UT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:st(`${UT}/errorCheckout`,(e=>({payload:e})))},DT),MT={loading:!1,error:null,cardSetupIntentSecret:null},NT=w({},Vk()),{reducer:FT,actions:$T,name:GT}=ct({name:"subscriptions/stripe",initialState:MT,reducers:NT}),xT=w({loadCustomer:st(`${GT}/loadCustomer`),createCardSetupIntentSecret:st(`${GT}/createCardSetupIntentSecret`)},$T),VT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:jT,reducer:WT,name:KT}=ct({name:"subscriptions/vendorPublicConfig",initialState:VT,reducers:w({},Vk())}),BT=w({loadVendorPublicConfiguration:st(`${KT}/loadVendorPublicConfiguration`)},jT),zT={config:Yk,plans:Bk,checkout:wT,billing:LT,stripe:MT,vendorPublicConfig:VT},qT={config:tT,billing:ET,plans:Jk,checkout:_T,stripe:xT,vendorPublicConfig:BT},HT=Ve({config:Zk,billing:OT,plans:qk,checkout:RT,stripe:FT,vendorPublicConfig:WT});let JT,YT,QT;function XT({policy:e}){return{policy:QT.AT_PERIOD_END}}function ZT(e){switch(e){case ud.ACTIVE:return YT.ACTIVE;case ud.INCOMPLETE:return YT.INCOMPLETE;case ud.CANCELED:return YT.CANCELED;case ud.EXPIRED:return YT.EXPIRED;case ud.TRIALING:return YT.TRIALING;default:return YT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(JT||(JT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(YT||(YT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(QT||(QT={}));const eP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:ud.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},tP=[{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"}],nP=[{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:""}],iP=[{id:"id",externalId:"externalId",type:dd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],oP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*aP(){yield sa(sT.load,rP),yield sa(sT.cancelSubscription,lP),yield sa(sT.renewSubscription,cP)}function*rP(){const e=yield go((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield pP(e)}function*sP(){yield lo(sT.setLoading(!0));try{const[e]=yield yo(dy.subscriptions.getManagedSubscriptions);yield lo(sT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield lo(sT.setError(e))}}function*lP(){const{subscription:e}=yield go((e=>e.subscriptions.billing.subscription));if(!e)return void(yield lo(sT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield lo(sT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===ud.ACTIVE)try{yield lo(sT.setCancellationLoading(!0)),yield yo(dy.subscriptions.cancelManagedSubscription,t),yield sP(),yield lo(sT.setCancellationLoading(!1))}catch(e){yield lo(sT.setCancellationError(e.message))}}function*cP(){const{subscription:e}=yield go((e=>e.subscriptions.billing.subscription));if(!e)return void(yield lo(sT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield lo(sT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===yd.AT_PERIOD_END)try{yield lo(sT.setRenewalLoading(!0)),yield yo(dy.subscriptions.renewManagedSubscription,t),yield sP(),yield lo(sT.setRenewalLoading(!1))}catch(e){yield lo(sT.setCancellationError(e.message))}}function*uP(){yield lo(sT.setLoading(!0)),yield So(500),yield lo(sT.setState({subscription:eP,fetching:!1,loading:!1,error:null}))}function*dP(){yield sa(sT.load,uP)}function*yP(){yield sa(fT.loadBillingInformation,fP)}function*fP(){yield function*(e){const t=yield go((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield go((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield pP(n,!1):yield lo(fT.setError(t?"Not authorized":"Internal feature failure"))}()}function*pP(e,t){yield lo(fT.setLoading(!0));try{var n,i;const o=yield yo(dy.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield yo(dy.subscriptions.getSubscriptionPlan,a):([,s]=yield co([yo(sP),yo(dy.subscriptions.getSubscriptionPlan,a)]),l=yield go((e=>e.subscriptions.billing.subscription.subscription||null))),yield lo(fT.setState(w({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?YT.ACTIVE:ZT(l.status),cancellation:l.cancellation&&XT(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield lo(fT.setError(e.message))}}function*gP(){yield function*(){var e,t;yield lo(fT.setLoading(!0)),yield So(500),yield lo(fT.setState({loading:!1,fetching:!1,summary:{subscriptionId:eP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:fd.Stripe,externallyManaged:!1,currentPlanId:tP[0].id,defaultPlanId:tP[0].id},plan:w({},tP[0],{price:null==(e=tP[0].price)?void 0:e.amount,currency:null==(t=tP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*SP(){yield sa(fT.loadBillingInformation,gP)}function*vP(){yield sa(mT.loadPaymentMethod,hP),yield sa(mT.submitPaymentMethod,bP),yield sa(mT.submitPaymentMethodError,AP),yield sa(mT.submitPaymentMethodSuccess,kP),yield sa(mT.updatePaymentMethodBillingDetails,mP)}function*hP(){yield lo(mT.setLoading(!0));try{const e=(yield yo(dy.subscriptions.getPaymentMethods))[0];yield lo(mT.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield lo(mT.setError(e.message))}}function*mP({payload:e}){yield lo(mT.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield yo(dy.subscriptions.updatePaymentMethodBillingDetails,t,w({email:n},i)),yield yo(hP),null==o||o(!0)}catch(e){yield lo(mT.setError(e.message)),null==o||o(!1)}yield lo(mT.setLoading(!1))}function*bP(){yield lo(mT.setLoading(!0))}function*AP({payload:e}){yield lo(mT.setError(e))}function*kP(){yield lo(mT.loadPaymentMethod())}function*TP(){yield lo(mT.setLoading(!0)),yield So(500);const e=iP[0];yield lo(mT.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*PP(){yield sa(mT.loadPaymentMethod,TP)}function*IP(){yield sa(IT.loadInvoices,LP),yield sa(IT.downloadInvoice,EP)}function*LP(){yield lo(IT.setLoading(!0));try{const e=(yield yo(dy.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 lo(IT.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield lo(IT.setError(e.message))}}function*EP({payload:e}){yield lo(IT.setInvoiceDownloadState({loading:!0,error:null}));try{yield yo(dy.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield lo(IT.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield lo(IT.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*OP(){yield lo(IT.setLoading(!0)),yield So(500),yield lo(IT.setState({loading:!1,fetching:!1,invoices:nP.map((e=>w({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield lo(IT.setLoading(!1))}function*wP(){yield sa(IT.loadInvoices,OP)}function*CP(){yield co([yo(yP),yo(vP),yo(IP),yo(aP)])}function*DP(){yield co([yo(SP),yo(PP),yo(wP),yo(dP)])}function*RP(){yield sa(_T.loadCheckout,UP),yield sa(_T.resetCheckout,_P),yield sa(_T.submitCheckout,MP),yield sa(_T.confirmCheckout,NP),yield sa(_T.errorCheckout,$P)}function*UP(){yield lo(_T.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*_P(){yield lo(_T.setState({loading:!1,error:null,confirmed:!1}))}function*MP(){yield lo(_T.setState({loading:!0,error:null}))}function*NP({payload:{paymentMethodId:e,planId:t}}){const n=yield go((e=>e.subscriptions.billing.subscription.subscription)),i=yield go((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===ud.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield lo(_T.setState({loading:!0,error:null})),o&&a)return yield FP(),void(yield lo(sT.setState({subscription:w({},n,{status:ud.ACTIVE})})));try{yield yo(dy.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield co([fP(),hP(),LP()]),yield FP()}catch(e){yield lo(_T.setState({loading:!1,error:e.message}))}}else yield lo(_T.setState({loading:!1,error:"Subscription not found"}))}function*FP(){yield lo(_T.setState({loading:!1,error:null,confirmed:!0}))}function*$P({payload:e}){yield lo(_T.setState({loading:!1,error:e}))}function*GP(){yield sa(_T.resetCheckout,_P)}function*xP(){yield sa(Jk.loadPlans,VP)}function*VP(){yield lo(Jk.setLoading(!0));try{const e=(yield yo(dy.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 lo(Jk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield lo(Jk.setError(e.message))}}function*jP(){yield lo(Jk.setLoading(!0)),yield So(500),yield lo(Jk.setState({fetching:!1,loading:!1,plans:tP.map((e=>{var t,n;return w({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*WP(){yield sa(Jk.loadPlans,jP)}function*KP(){yield sa(tT.loadPaymentConfiguration,BP)}function*BP(){yield lo(tT.setLoading(!0));try{(yield yo(dy.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===fd.Stripe))?yield function*(){yield lo(tT.setLoading(!0));try{const e=yield yo(dy.subscriptions.getStripePaymentProviderConfiguration);yield lo(tT.setState({loading:!1,fetching:!1,config:{paymentProvider:JT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield lo(tT.setError(e.message))}}():yield lo(tT.setError("Payment provider not configured"))}catch(e){yield lo(tT.setError(e.message))}}function*zP(){yield lo(tT.setLoading(!0)),yield So(500),yield lo(tT.setState({loading:!1,fetching:!1,config:{paymentProvider:JT.STRIPE,apiKey:""}}))}function*qP(){yield sa(tT.loadPaymentConfiguration,zP)}function*HP(){yield sa(xT.createCardSetupIntentSecret,JP)}function*JP({payload:e}){yield lo(xT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield yo(dy.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield lo(xT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield lo(xT.setError(e.message))}}function*YP(){yield sa(BT.loadVendorPublicConfiguration,QP)}function*QP(){yield lo(BT.setLoading(!0));try{const e=yield yo(dy.subscriptions.getVendorPublicConfigurations);yield lo(BT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield lo(BT.setError(e.message))}}function*XP(){yield lo(BT.setLoading(!0)),yield So(500),yield lo(BT.setState({fetching:!1,loading:!1,vendorPublicConfig:oP}))}function*ZP(){yield sa(BT.loadVendorPublicConfiguration,XP)}var eI={sagas:function*(){yield co([yo(CP),yo(RP),yo(xP),yo(KP),yo(HP),yo(YP)])},mockSagas:function*(){yield co([yo(DP),yo(GP),yo(WP),yo(qP),yo(ZP)])},reducer:HT,actions:qT,initialState:zT,storeName:"subscriptions"},tI={sagas:function*(){yield sa(kf.loadVendorPublicInfo,Tf)},storeName:Dt,initialState:mf,reducer:bf,actions:kf};const{reducer:nI}=ct({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),w({},e,{context:t}))}}}),iI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,p,g,S,v;n||a||ua.setContext(e.context);const t=Xo(),h=[...at({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=rt({middleware:h,preloadedState:{root:w({},e,{previewMode:n,urlStrategy:r}),[LA.storeName]:w({},LA.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:w({},LA.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[XA.storeName]:w({},XA.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:w({},XA.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:w({},XA.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[ek]:w({},ZA,null!=(v=null==o?void 0:o.audits)?v:{}),[xk.storeName]:xk.initialState,[eI.storeName]:eI.initialState,[tI.storeName]:tI.initialState},reducer:Ve({root:nI,[LA.storeName]:LA.reducer,[XA.storeName]:XA.reducer,[ek]:nk,[xk.storeName]:xk.reducer,[eI.storeName]:eI.reducer,[tI.storeName]:tI.reducer})});const m=function*(){yield co([yo(LA.sagas),yo(XA.sagas),yo(fk),yo(xk.sagas),yo(eI.sagas),yo(tI.sagas)])},b=function*(){yield co([yo(LA.mockSagas),yo(XA.mockSagas),yo(eI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(di.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var oI=n(714),aI=n.n(oI);function rI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function sI(e){if(e.type)return e;if("#"===e.charAt(0))return sI(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function lI(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function cI(e){if(0===e.indexOf("#"))return e;const{values:t}=sI(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 uI(e,t){return e=sI(e),t=rI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,lI(e)}function dI(e,t){if(e=sI(e),t=rI(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 lI(e)}function yI(e,t){if(e=sI(e),t=rI(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 lI(e)}const fI=e=>{if(e)return{main:e,light:cI(yI(e,.4)),dark:cI(dI(e,.15)),hover:cI(dI(e,.15)),active:cI(dI(e,.2))}},pI=e=>{if(e)return{main:e,light:yI(e,.7),dark:dI(e,.2)}},gI=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?w({},t,{palette:{primary:w({},fI(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:w({},fI(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:w({},fI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:w({},pI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:w({},pI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:w({},pI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:w({},pI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},SI={},vI={},hI={},mI={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.*"]}};class bI{constructor(){this._theme=SI,this._themeV2=vI,this._navigation=mI,this._localizations=hI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new bI;return n.set(e),bI._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=aI().all([null!=(t=mI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=aI().all([null!=(i=SI)?i:{},gI(null==e?void 0:e.theme,SI)]),this._themeV2=aI().all([null!=(o=vI)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=aI().all([null!=(r=hI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=mI,this._theme=SI,this._themeV2=vI,this._localizations=hI}}}bI._instances={};var AI=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},kI=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},TI=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let PI,II,LI,EI,OI,wI,CI,DI,RI,UI,_I;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(PI||(PI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(II||(II={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(LI||(LI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(EI||(EI={})),function(e){e.Invoices="invoices"}(OI||(OI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(wI||(wI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(CI||(CI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(DI||(DI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(RI||(RI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(UI||(UI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(_I||(_I={}));const MI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},NI={hidden:"hidden",edit:"edit"};var FI="6.97.0",$I={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":"on"},GI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];T(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(FI),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(U().mark((function e(){var t,n,i,a,r;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ga,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[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:bI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(U().mark((function e(){return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(U().mark((function e(){var t;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Ed.set($I,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Od();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Ed.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=AI(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=w({},t,{contextOptions:w({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?w({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.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=iI({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);O.setInstance(s,this)}var t,n,i,o;return E(e,[{key:"initContainers",value:(o=D(U().mark((function e(t){return U().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,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;bI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:A,FronteggTypes:k})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=D(U().mark((function e(){return U().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 i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(U().mark((function e(){var t;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(U().mark((function e(t){var n;return U().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,w({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),xI=function(){function e(){T(this,e)}return E(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=O.getInstance(i);e&&t?(ua.setAccessToken(t),ua.setUser(w({},n,{accessToken:t})),o.store.dispatch(di.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(di.loadTenants())):(ua.setAccessToken(null),ua.setUser(null),o.store.dispatch(di.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),VI=function(){function e(){T(this,e)}return E(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";O.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";O.getInstance(e).hideAdminPortal()}}]),e}(),jI=function(){function e(){T(this,e)}return E(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";O.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";O.getInstance(e).hideCheckoutDialog()}}]),e}(),WI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},KI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];T(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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=iI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=w({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new GI(this.options,t,!0),bI.set({},t)}var t;return E(e,[{key:"render",value:(t=D(U().mark((function e(t){var n,i,o,a,r=this;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,TI(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}(),BI="modern",zI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[BI]},qI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];T(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(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=iI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=w({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new GI(this.options,t,!0,a),bI.set({},t)}var t;return E(e,[{key:"render",value:(t=D(U().mark((function e(t){var n,i,o,a,r=this;return U().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,TI(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 HI(e,t){return HI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},HI(e,t)}function JI(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&&HI(e,t)}function YI(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 QI(e){return QI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},QI(e)}function XI(){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 ZI(e,t,n){return ZI=XI()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&HI(o,n.prototype),o},ZI.apply(null,arguments)}function eL(e){var t="function"==typeof Map?new Map:void 0;return eL=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 ZI(e,arguments,QI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),HI(n,e)},eL(e)}function tL(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=QI(e);if(t){var o=QI(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return YI(this,n)}}var nL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new GI(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){JI(n,e);var t=tL(n);function n(){var e;T(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return E(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=O.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=kI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=kI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=kI(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=kI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=kI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=kI(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(eL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.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,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(e,n,s)}),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,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function P(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)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 o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.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 L(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 E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"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(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=w,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(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,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),E(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 i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return BI},AdminPortalRenderer:function(){return HI},AppHolder:function(){return w},CheckoutDialog:function(){return zI},FronteggApp:function(){return WI},HostedLogin:function(){return KI},LoginBoxRenderer:function(){return QI},createElement:function(){return LI},defaultTheme:function(){return JI},formatName:function(){return II},getThemeAdminByName:function(){return qI},getThemeByName:function(){return YI},initialize:function(){return rL},mockFlagsList:function(){return jI},waitThemeSetter:function(){return EI}});var e={};n.r(e),n.d(e,{Delete:function(){return ba},Get:function(){return Sa},Patch:function(){return ha},Post:function(){return va},PostDownload:function(){return Aa},Put:function(){return ma},extractHeadersFromOptions:function(){return ka},getBaseUrl:function(){return pa}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return lr},getSubTenants:function(){return rr},getSubTenantsAsTree:function(){return sr},getTenants:function(){return ar},getTenantsUsersCount:function(){return cr},switchTenant:function(){return or}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return Nr},MachineToMachineAuthStrategy:function(){return Fr},OAuthLogout:function(){return ss},SocialLoginProviders:function(){return Mr},acceptInvitation:function(){return is},activateAccount:function(){return Zr},bulkCreateIPRestriction:function(){return Cr},changePhoneNumber:function(){return Yl},changePhoneNumberWithVerification:function(){return Hl},checkIfAllowToRememberMfaDevice:function(){return Tl},createDomainRestriction:function(){return Pr},createIPRestriction:function(){return wr},createOrUpdateSessionConfigrations:function(){return sl},createSSOConfiguration:function(){return Ol},createSSOConfigurationByMetadata:function(){return Dl},createSSODomain:function(){return Ul},createSSOGroup:function(){return $l},createSamlGroup:function(){return zs},createTenantAccessToken:function(){return gl},createUserAccessToken:function(){return pl},deleteAllSessionsForUser:function(){return cl},deleteDomainRestriction:function(){return Lr},deleteIPRestriction:function(){return Rr},deleteSSOConfiguration:function(){return Cl},deleteSSODomain:function(){return _l},deleteSSOGroup:function(){return xl},deleteSamlGroup:function(){return Hs},deleteSessionForUser:function(){return ll},deleteTenantAccessToken:function(){return yl},deleteTenantApiToken:function(){return bl},deleteUserAccessToken:function(){return fl},deleteUserApiToken:function(){return Al},deleteWebAuthnDevice:function(){return tc},disableMFAAuthenticatorApp:function(){return As},disableMFASMS:function(){return Ts},disableMFAWebAuthn:function(){return Is},disableMfa:function(){return bs},enrollMFAAuthenticatorApp:function(){return ps},enrollMFAAuthenticatorAppForLogin:function(){return Os},enrollMFASMS:function(){return Ss},enrollMFASMSForLogin:function(){return Ds},enrollMFAWebAuthn:function(){return hs},enrollMFAWebAuthnForLogin:function(){return Ms},enrollMfa:function(){return ys},exchangeOAuthTokens:function(){return Kl},forgotPassword:function(){return ls},generateLoginResponse:function(){return Kr},generateLoginResponseFromOAuthResponse:function(){return zr},generateLoginResponseV2:function(){return Br},getActivateAccountStrategy:function(){return es},getCaptchaPolicy:function(){return vr},getCurrentUserSession:function(){return ol},getCurrentUserSessions:function(){return il},getCustomSocialLoginProvidersV1:function(){return Zs},getDomainRestrictions:function(){return kr},getDomainRestrictionsConfig:function(){return Tr},getGlobalSecurityPolicy:function(){return ur},getIPRestrictions:function(){return Er},getIPRestrictionsConfig:function(){return Or},getLockoutPolicy:function(){return pr},getMFADevices:function(){return Ls},getMFAStrategiesConfig:function(){return oc},getMfaPolicy:function(){return dr},getOidcConfiguration:function(){return Js},getPasswordConfigPolicy:function(){return Ar},getPasswordHistoryPolicy:function(){return hr},getSSOConfigurations:function(){return El},getSSODefaultRoles:function(){return Nl},getSSOGroups:function(){return Vl},getSSOPublicConfiguration:function(){return Ys},getSamlConfiguration:function(){return $s},getSamlRoles:function(){return Ws},getSamlRolesGroups:function(){return Ks},getSamlVendorConfiguration:function(){return xs},getSessionConfigurations:function(){return rl},getSocialLoginProviders:function(){return Qs},getSocialLoginProvidersV2:function(){return Xs},getTenantAccessTokensData:function(){return dl},getTenantApiTokensData:function(){return vl},getUserAccessTokensData:function(){return ul},getUserApiTokensData:function(){return Sl},getUserById:function(){return kl},getVendorConfig:function(){return tl},getVendorLockoutPolicy:function(){return gr},getVendorMfaPolicy:function(){return yr},getVendorPasswordHistoryPolicy:function(){return mr},getVendorPublicAuthStrategiesConfig:function(){return ic},getWebAuthnDevices:function(){return ec},loadPasswordConfig:function(){return us},login:function(){return Qr},loginViaSocialLogin:function(){return el},loginWithMfa:function(){return Xr},logout:function(){return rs},oidcPostLogin:function(){return Yr},oidcPostLoginV2:function(){return Wl},passwordlessPostLogin:function(){return Il},passwordlessPreLogin:function(){return Pl},postLogin:function(){return Jr},preDisableMFASMS:function(){return ks},preDisableMFAWebAuthn:function(){return Ps},preEnrollMFAAuthenticatorApp:function(){return fs},preEnrollMFAAuthenticatorAppForLogin:function(){return Es},preEnrollMFASMS:function(){return gs},preEnrollMFASMSForLogin:function(){return Cs},preEnrollMFAWebAuthn:function(){return vs},preEnrollMFAWebAuthnForLogin:function(){return _s},preLogin:function(){return qr},preLoginV2:function(){return jl},preLoginWithIdpType:function(){return Hr},preVerifyMFASMSForLogin:function(){return Rs},preVerifyMFAWebAuthnForLogin:function(){return Ns},recoverMfaToken:function(){return ds},refreshToken:function(){return os},refreshTokenV2:function(){return as},resendActivationEmail:function(){return ts},resendInvitationEmail:function(){return ns},resetPassword:function(){return cs},resetPhoneNumber:function(){return zl},revokeSessionsForUser:function(){return al},saveLockoutPolicy:function(){return Sr},saveMfaPolicy:function(){return fr},savePasswordHistoryPolicy:function(){return br},setSSODefaultRoles:function(){return Fl},signUpUser:function(){return nl},silentOAuthRefreshToken:function(){return Bl},testCurrentIp:function(){return Ur},testCurrentIpInAllowList:function(){return _r},updateDomainRestrictionConfig:function(){return Ir},updateIPRestrictionConfig:function(){return Dr},updateSSOConfiguration:function(){return wl},updateSSOConfigurationByMetadata:function(){return Rl},updateSSOGroup:function(){return Gl},updateSamlConfiguration:function(){return Gs},updateSamlGroup:function(){return qs},updateSamlRoles:function(){return Bs},updateSamlVendorMetadata:function(){return Vs},updateTenantApiTokensData:function(){return ml},updateUserApiTokensData:function(){return hl},validateSSODomain:function(){return Ml},validateSamlDomain:function(){return js},verifyChangePhoneNumber:function(){return Jl},verifyInviteToken:function(){return Ll},verifyMFAAuthenticatorAppForLogin:function(){return ws},verifyMFASMSForLogin:function(){return Us},verifyMFAWebAuthnForLogin:function(){return Fs},verifyMfa:function(){return ms},verifyNewDeviceSession:function(){return nc},verifyResetPhoneNumber:function(){return ql},webAuthnCreateNewDeviceSession:function(){return Zl},webAuthnPostLogin:function(){return Xl},webAuthnPreLogin:function(){return Ql}});var a={};n.r(a),n.d(a,{addUser:function(){return uc},changePassword:function(){return lc},createInviteUserLink:function(){return fc},deleteInviteUserLink:function(){return gc},deleteUser:function(){return dc},getInviteLinkConfiguration:function(){return vc},getInviteUserLink:function(){return Sc},getProfile:function(){return ac},loadAvailablePermissions:function(){return mc},loadAvailableRoles:function(){return hc},loadStats:function(){return bc},loadUsers:function(){return cc},resendActivationLink:function(){return Ac},resendInvitationLink:function(){return kc},resendInvitationLinkToAllTenants:function(){return Tc},updateInviteUserLink:function(){return pc},updateProfile:function(){return rc},updateProfileImage:function(){return sc},updateUser:function(){return yc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Ic},getAuditsMetadata:function(){return Cc},getCurrentUserIpMetadata:function(){return Ec},getIpAdressMetadata:function(){return Dc},getNotificationsMetadata:function(){return Oc},getSamlMetadata:function(){return wc},updateAdminBoxMetadata:function(){return Lc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Gc},getReport:function(){return Nc},getReports:function(){return Mc},renderReport:function(){return Fc},scheduleReport:function(){return $c},sendReport:function(){return xc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return Vc},markAllAsRead:function(){return Kc},updateNotificationIsPinned:function(){return Wc},updateNotificationStatus:function(){return jc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Hc},getAudits:function(){return zc},getAuditsStats:function(){return qc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return lu},deleteEmailSubscriptions:function(){return ru},deleteSMSConfiguration:function(){return pu},deleteSMSSubscriptions:function(){return yu},deleteSlackConfiguration:function(){return tu},deleteWebhooksConfiguration:function(){return vu},getCategories:function(){return Au},getChannelMaps:function(){return ku},getEmailConfiguration:function(){return iu},getSMSConfiguration:function(){return cu},getSlackChannels:function(){return Zc},getSlackConfiguration:function(){return Qc},getSlackScope:function(){return Xc},getWebhookLog:function(){return hu},getWebhooksConfigurations:function(){return gu},patchEmailConfiguration:function(){return au},patchSMSConfiguration:function(){return du},postEmailConfiguration:function(){return ou},postSMSConfiguration:function(){return uu},postSlackCode:function(){return nu},postSlackConfiguration:function(){return eu},postWebhookRetry:function(){return bu},postWebhookTest:function(){return mu},postWebhooksConfiguration:function(){return Su},putEmailSubscriptions:function(){return su},putSMSSubscriptions:function(){return fu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Iu},getSettings:function(){return Pu},updateSettings:function(){return Tu}});var y={};n.r(y),n.d(y,{addRole:function(){return Cu},attachPermissionToRoles:function(){return Mu},attachPermissionsToRole:function(){return Uu},deleteRole:function(){return Du},getPermissionCategories:function(){return Nu},getPermissions:function(){return _u},getRoles:function(){return wu},updateRole:function(){return Ru}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return pd},ISubscriptionStatus:function(){return yd},PaymentMethodType:function(){return fd},ProviderType:function(){return gd},TenantCreatedAction:function(){return vd},TrialEndAction:function(){return Sd},cancelManagedSubscription:function(){return Ku},cancelSubscription:function(){return Gu},createStripeCustomer:function(){return od},createStripePaymentMethodSetupIntentSecret:function(){return rd},createSubscription:function(){return nd},createTenantConfiguration:function(){return cd},getManagedSubscription:function(){return ju},getManagedSubscriptions:function(){return Wu},getPaymentMethod:function(){return ed},getPaymentMethods:function(){return Zu},getPaymentProviders:function(){return ud},getStripeCustomer:function(){return id},getStripePaymentProviderConfiguration:function(){return ad},getSubscription:function(){return $u},getSubscriptionInvoice:function(){return Yu},getSubscriptionInvoicePdf:function(){return Qu},getSubscriptionInvoices:function(){return Ju},getSubscriptionPlan:function(){return Hu},getSubscriptionPlans:function(){return qu},getSubscriptionSummaries:function(){return sd},getSubscriptions:function(){return Fu},getTenantConfiguration:function(){return ld},getVendorPublicConfigurations:function(){return dd},renewManagedSubscription:function(){return Bu},renewSubscription:function(){return xu},updateManagedSubscription:function(){return zu},updatePaymentMethodBillingDetails:function(){return td},updateSubscription:function(){return Vu}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return hd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return kd},addUserToTenantAndSubTenants:function(){return bd},addUsersToSubTenant:function(){return Od},createSubTenant:function(){return Id},deleteSubTenant:function(){return Ld},loadAllUsers:function(){return md},removeUserFromTenantAndSubTenants:function(){return Ad},removeUserRolesFromSubTenants:function(){return Td},setUserRolesForSubTenants:function(){return Pd},updateSubAccountAccess:function(){return Ed}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return Cd},loadFeatureFlags:function(){return Dd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Nd},createConfiguration:function(){return _d},deleteConfiguration:function(){return Md},getConfigs:function(){return Rd},updateConfiguration:function(){return Ud}});var h={};n.r(h),n.d(h,{impersonate:function(){return Fd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Bd},addUsersToGroup:function(){return qd},createGroup:function(){return jd},deleteGroup:function(){return Kd},deleteRolesFromGroup:function(){return zd},deleteUsersFromGroup:function(){return Hd},getGroupById:function(){return Gd},getGroupConfiguration:function(){return Jd},getGroups:function(){return xd},getGroupsByIds:function(){return Vd},updateGroup:function(){return Wd},updateGroupConfiguration:function(){return Yd}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return Qd},getUsersV3:function(){return Xd}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return Zd}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return Nr},ContextHolder:function(){return da},FeatureFlags:function(){return Cd},FronteggApiError:function(){return fa},FronteggContext:function(){return ya},GroupManagedByEnum:function(){return yy},GroupRelations:function(){return dy},ISubscriptionCancellationPolicy:function(){return pd},ISubscriptionStatus:function(){return yd},MFAStrategyEnum:function(){return ny},MachineToMachineAuthStrategy:function(){return Fr},PaginationOrderEnum:function(){return py},PaymentMethodType:function(){return fd},ProviderType:function(){return gd},RestrictionType:function(){return xn},ScimConnectionSource:function(){return uy},SecondaryAuthStrategy:function(){return ey},SocialLoginProviders:function(){return Mr},SortByEnum:function(){return fy},TenantType:function(){return oy},UserManagedByEnum:function(){return iy},WebAuthnDeviceType:function(){return ty},api:function(){return gy},countConfigurationUsers:function(){return Nd},createConfiguration:function(){return _d},default:function(){return Sy},deleteConfiguration:function(){return Md},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return ay},fronteggRefreshTokenUrl:function(){return ry},fronteggSilentRefreshTokenUrl:function(){return sy},fronteggTenantsUrl:function(){return cy},fronteggUsersUrl:function(){return ly},getConfigs:function(){return Rd},loadFeatureFlags:function(){return Dd},updateConfiguration:function(){return Ud}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="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},I(e)}function L(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==I(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function E(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,L(i.key),i)}}function O(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return $I},AccountPageFields:function(){return DI},DomainRestrictionsTabFields:function(){return FI},GeneralSettingsTabFields:function(){return MI},InviteUserModalFields:function(){return CI},IpRestrictionsTabFields:function(){return NI},Metadata:function(){return PI},PrivacyPageFields:function(){return wI},ProfilePageFields:function(){return OI},SecurityPageTabs:function(){return UI},SessionManagementTabFields:function(){return _I},SubscriptionsPageFields:function(){return RI},alpha:function(){return pI},fieldAppearance:function(){return GI},tabAppearance:function(){return xI}});var w=function(){function e(){P(this,e)}return O(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},C.apply(this,arguments)}function D(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){D(a,i,o,r,s,"next",e)}function s(e){D(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var U=n(841),_=n.n(U);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function N(e){return!!e&&!!e[ke]}function F(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)===Te}(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor[Ae]||W(e)||K(e))}function $(e,t,n){void 0===n&&(n=!1),0===G(e)?(n?Object.keys:Pe)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function G(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 x(e,t){return 2===G(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var i=G(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function K(e){return he&&e instanceof Set}function B(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||N(e)||!F(e)||(G(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Le[e];return t||M(18,e),t}function Q(){return ge}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===ge&&(ge=e.l)}function te(e){return ge={p:[],l:ge,h:e,m:!0,_:0}}function ne(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],i=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,i),i?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=oe(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=oe(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function oe(e,t,n){if(J(t))return t;var i=t[ke];if(!i)return $(t,(function(o,a){return ae(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return re(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=z(i.k):i.o;$(3===i.i?new Set(o):o,(function(t,a){return ae(e,i,o,t,a,n)})),re(e,o,!1),n&&e.u&&Y("Patches").R(i,n,e.u,e.s)}return i.o}function ae(e,t,n,i,o,a){if(N(o)){var r=oe(e,o,a&&t&&3!==t.i&&!x(t.D,i)?a.concat(i):void 0);if(V(n,i,r),!N(r))return;e.m=!1}if(F(o)&&!J(o)){if(!e.h.F&&e._<1)return;oe(e,o),t&&t.A.l||re(e,o)}}function re(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?B(n):e)[t]}function le(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var i=W(t)?Y("MapSet").N(t,n):K(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ee;n&&(o=[i],a=Oe);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(i),i}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,i=t[ke],o=G(t);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=fe(t,o),i.I=!1}else n=fe(t,o);return $(n,(function(t,o){i&&function(e,t){return 2===G(e)?e.get(t):e[t]}(i.t,t)===o||V(n,t,e(o))})),3===o?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var pe,ge,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=Se?Symbol.for("immer-nothing"):((pe={})["immer-nothing"]=!0,pe),Ae=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Ee={get:function(e,t){if(t===ke)return e;var n=B(e);if(!x(n,t))return function(e,t,n){var i,o=le(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!F(i)?i:i===se(e.t,t)?(ue(e),e.o[t]=de(e.A.h,i,e)):i},has:function(e,t){return t in B(e)},ownKeys:function(e){return Reflect.ownKeys(B(e))},set:function(e,t,n){var i=le(B(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=se(B(e),t),a=null==o?void 0:o[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,o)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(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,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=B(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};$(Ee,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==i&&"function"!=typeof i&&M(7),F(e)){var s=te(t),l=de(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Z(s):ee(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(s,i),ie(e,s)}),(function(e){throw Z(s),e})):(X(s,i),ie(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),i){var u=[],d=[];Y("Patches").M(e,r,u,d),i(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=Y("Patches").$;return N(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ce=new we,De=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),De);function Ue(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 _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(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 Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function xe(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 Ve(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(l)throw new Error(Ne(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ne(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(l)throw new Error(Ne(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ne(10));o=e,y({type:Ge.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:Ge.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=p,i}function je(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ge.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ne(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o: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),i=function(){throw new Error(Ne(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:i})}}}function Be(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var ze=Be();ze.withExtraArgument=Be;var qe,He=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)}),Ye=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Qe=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var i=0,o=Xe(t);i<o.length;i++)n=o[i],et.call(t,n)&&tt(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 ot=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return 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,Ye([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ye([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?Re(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new ot);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(He):i.push(He.withExtraArgument(n.extraArgument))),i}function st(e){var t,n=function(e){return rt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=je(a)}var p=s;"function"==typeof p&&(p=p(n));var g=Ke.apply(void 0,p),S=We;c&&(S=it(nt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Ye([g],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function lt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return nt(nt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ct(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ut(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:at(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ct(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=nt(nt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ct(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return at(e())};else{var c=at(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ye([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(N(e))return void 0===(i=n(e,t))?e:i;if(F(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?lt(c,i):lt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var dt="listenerMiddleware";lt(dt+"/add"),lt(dt+"/removeAll"),lt(dt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Ee.get(t,e)},set:function(t){var n=this[ke];Ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ke];if(!o.P)switch(o.i){case 5:i(o)&&ce(o);break;case 4:n(o)&&ce(o)}}}function n(e){for(var t=e.t,n=e.k,i=Pe(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var s=n[a],l=s&&s[ke];if(l?l.t!==r:!j(s,r))return!0}}var c=!!t[ke];return i.length!==Pe(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Ie(n);delete a[ke];for(var r=Pe(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:Q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ke,{value:a,writable:!0}),o},S:function(e,n,o){o?N(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 o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)$(a,(function(t){t!==ke&&(void 0!==o[t]||x(o,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),$(o,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===s){if(i(n)&&(ce(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const yt=(e,t)=>n=>C({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),pt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{loaders:C({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),ht=(e,t,n)=>i=>{var o;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(o=i[e])?void 0:o[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",At=new Uint8Array(256);for(let e=0;e<bt.length;e++)At[bt.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=At[e.charCodeAt(i)],a=At[e.charCodeAt(i+1)],r=At[e.charCodeAt(i+2)],s=At[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=bt[t[i]>>2],o+=bt[(3&t[i])<<4|t[i+1]>>4],o+=bt[(15&t[i+1])<<2|t[i+2]>>6],o+=bt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Tt(e[n]);return t}return e};let Pt,It,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"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Et="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Dt="auditLogs",Rt="vendor",Ut={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},_t={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:Ut})},Mt={requestAuthorize:lt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:lt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:lt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:lt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:lt("auth/afterAuthNavigation"),preLogin:lt("auth/preLogin",(e=>({payload:e}))),postLogin:lt("auth/postLogin",(e=>({payload:e}))),login:lt("auth/login",(e=>({payload:e}))),loginWithMfa:lt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:lt("auth/recoverMfa",(e=>({payload:e}))),logout:lt("auth/logout",(e=>({payload:e}))),silentLogout:lt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:lt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:lt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:lt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:lt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:lt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:lt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:lt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:lt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:lt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:lt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:lt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:lt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:lt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:lt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:lt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:lt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:lt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:lt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:lt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:lt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:lt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:pt("activateState","activationStrategy")},Gt={activateAccount:lt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:lt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:lt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:lt("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:lt("auth/acceptInvitation",(e=>({payload:e})))};let Kt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Kt||(Kt={}));const Bt={step:Kt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Bt})},qt={forgotPassword:lt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:lt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:lt("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Yt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Qt={resetPhoneNumber:lt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:lt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:lt("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:gt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:lt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:lt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:lt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:lt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:lt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:lt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:lt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:lt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:lt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:lt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:lt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:lt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:lt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:lt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:lt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:lt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:lt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:lt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:lt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:lt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:lt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:lt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:lt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:lt("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:lt("auth/loadProfile"),saveProfile:lt("auth/saveProfile",(e=>({payload:e}))),changePassword:lt("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},sn={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},ln={enrollMfa:lt("auth/enrollMfa"),getMFADevices:lt("auth/getMFADevices"),getMFAStrategies:lt("auth/getMFAStrategies"),verifyMfa:lt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:lt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:lt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:lt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:lt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:lt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:lt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:lt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:lt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:lt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:lt("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:gt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:lt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:lt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:lt("auth/loadRoles",(e=>({payload:e}))),addUser:lt("auth/addUser",(e=>({payload:e}))),addUsersBulk:lt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:lt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:lt("auth/updateUser",(e=>({payload:e}))),deleteUser:lt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:lt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:lt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:lt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:lt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:lt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:lt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:lt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:lt("auth/getInvitationLink"),createInvitationLink:lt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:lt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:lt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:lt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:lt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:lt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:lt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:lt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:lt("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},pn={loadSocialLoginsConfiguration:lt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:lt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:lt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:lt("auth/setSocialLoginError",(e=>({payload:e})))};let gn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(gn||(gn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:gn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:lt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:lt("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:gt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},An={loadApiTokens:lt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:lt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:lt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:lt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:lt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:lt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:lt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:lt("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}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:pt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:pt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:pt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:pt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:pt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:pt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:pt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:pt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:pt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:pt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:pt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:lt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:lt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:lt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:lt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:lt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:lt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:lt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:lt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:lt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:lt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:lt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:lt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:lt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:lt("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},Ln={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},En={loadAccountSettings:lt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:lt("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Cn={switchTenant:lt("auth/switchTenant",(e=>({payload:e}))),loadTenants:lt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:lt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:lt("auth/loadSubTenantsTree",(e=>({payload:e})))},Dn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Dn})},Un={loadRolesAndPermissions:lt("auth/loadRoles",(e=>({payload:e}))),addRole:lt("auth/addRole",(e=>({payload:e}))),updateRole:lt("auth/updateRole",(e=>({payload:e}))),deleteRole:lt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:lt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:lt("auth/attachPermissionToRoles",(e=>({payload:e})))},_n={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:_n})},Nn={loadUserSessions:lt("auth/loadUserSessions"),loadCurrentUserSession:lt("auth/loadCurrentUserSession"),deleteUserSession:lt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:lt("auth/deleteAllUserSessions"),revokeUserSessions:lt("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},$n={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},Gn={loadSessionsPolicy:lt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:lt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:pt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:pt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:lt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:lt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:lt("auth/loadIpRestrictions"),saveIpRestriction:lt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:lt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:lt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:lt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:lt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:lt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:lt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Kn={loading:!1},Bn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Kn})},zn={loadProvisionConnections:lt("auth/loadProvisionConnections"),createProvisionConnection:lt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:lt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:lt("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:lt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:lt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:gt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:lt("auth/loadUsersGroups"),getGroupById:lt("auth/getGroupById",(e=>({payload:e}))),createGroup:lt("auth/createGroup",(e=>({payload:e}))),updateGroup:lt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:lt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:lt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:lt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:lt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:lt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:lt("auth/getGroupConfiguration"),updateGroupConfiguration:lt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:lt("auth/getUsers",(e=>({payload:e})))},Zn={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}},ei={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ti={loading:!0,error:null},ni={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:ti})},ii={loadTenantMetadata:lt("auth/loadTenantMetadata"),updateTenantMetadata:lt("auth/updateTenantMetadata",(e=>({payload:e})))},oi={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:Ut,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Bt,ssoState:Xt,profileState:tn,customLoginState:ti,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Dn,resetPhoneNumberState:Jt,sessionsState:_n,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Kn,passkeysState:qn},ai=C({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},oi);let ri;!function(e){e.impersonating="impersonating",e.success="success"}(ri||(ri={}));const si={step:ri.impersonating,loading:!1},li={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:si})},ci={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ui,actions:di}=ut({name:wt,initialState:ai,reducers:C({resetState:e=>C({},e,oi),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,li,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Bn,Hn)});const yi=C({},di,Mt,pn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ci,Jn);var fi=function(e){return"@@redux-saga/"+e},pi=fi("CANCEL_PROMISE"),gi=fi("CHANNEL_END"),Si=fi("IO"),vi=fi("MATCH"),hi=fi("MULTICAST"),mi=fi("SAGA_ACTION"),bi=fi("SELF_CANCELLATION"),Ai=fi("TASK"),ki=fi("TASK_CANCEL"),Ti=fi("TERMINATE"),Pi=fi("LOCATION");function Ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Li=function(e){return null==e},Ei=function(e){return null!=e},Oi=function(e){return"function"==typeof e},wi=function(e){return"string"==typeof e},Ci=Array.isArray,Di=function(e){return e&&Oi(e.then)},Ri=function(e){return e&&Oi(e.next)&&Oi(e.throw)},Ui=function e(t){return t&&(wi(t)||Ni(t)||Oi(t)||Ci(t)&&t.every(e))},_i=function(e){return e&&Oi(e.take)&&Oi(e.close)},Mi=function(e){return Oi(e)&&e.hasOwnProperty("toString")},Ni=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Fi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[pi]=function(){clearTimeout(n)},i},$i=function(e){return function(){return e}},Gi=$i(!0),xi=function(){},Vi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ji=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Wi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ki=function(e){throw e},Bi=function(e){return{value:e,done:!0}};function zi(e,t,n){void 0===t&&(t=Ki),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Bi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function qi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Hi=function(e){return Array.apply(null,new Array(e))},Ji=function(e){return function(t){return e(Object.defineProperty(t,mi,{value:!0}))}},Yi=function(e){return e===Ti},Qi=function(e){return e===ki},Xi=function(e){return Yi(e)||Qi(e)};function Zi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ci(e)?Hi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Xi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=xi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function eo(e){return{name:e.name||"anonymous",location:to(e)}}function to(e){return e[Pi]}var no=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},io="TAKE",oo="CALL",ao="FORK",ro="SELECT",so=function(e,t){var n;return(n={})[Si]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function lo(e,t){return void 0===e&&(e="*"),Ui(e)?(Ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),so(io,{pattern:e})):_i(n=e)&&n[hi]&&Ei(t)&&Ui(t)?so(io,{channel:e,pattern:t}):_i(e)?(Ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),so(io,{channel:e})):void 0;var n}function co(e,t){return Li(t)&&(t=e,e=void 0),so("PUT",{channel:e,action:t})}function uo(e){var t=so("ALL",e);return t.combinator=!0,t}function yo(e,t){var n,i=null;return Oi(e)?n=e:(Ci(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&wi(n)&&Oi(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function fo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(oo,yo(e,n))}function po(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ao,yo(e,n))}function go(e){return void 0===e&&(e=bi),so("CANCEL",e)}function So(e){void 0===e&&(e=Vi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ro,{selector:e,args:n})}var vo=fo.bind(null,Fi);var ho=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},mo=[],bo=0;function Ao(e){try{Po(),e()}finally{Io()}}function ko(e){mo.push(e),bo||(Po(),Lo())}function To(e){try{return Po(),e()}finally{Lo()}}function Po(){bo++}function Io(){bo--}function Lo(){var e;for(Io();!bo&&void 0!==(e=mo.shift());)Ao(e)}var Eo=function(e){return function(t){return e.some((function(e){return Ro(e)(t)}))}},Oo=function(e){return function(t){return e(t)}},wo=function(e){return function(t){return t.type===String(e)}},Co=function(e){return function(t){return t.type===e}},Do=function(){return Gi};function Ro(e){var t="*"===e?Do:wi(e)?wo:Ci(e)?Eo:Mi(e)?wo:Oi(e)?Oo:Ni(e)?Co:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Uo={type:gi},_o=function(e){return e&&e.type===gi};function Mo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Uo)}))},(e={})[hi]=!0,e.put=function(e){if(!t)if(_o(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[vi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Do),t?e(Uo):(e[vi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Wi(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[mi]?s(e):ko((function(){s(e)}))},r}function No(e,t){var n=e[pi];Oi(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Fo,$o=0,Go=function(){return++$o};function xo(e){e.isRunning()&&e.cancel()}var Vo=((Fo={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!_o(e)||r?n(e):n(Ti)};try{o.take(s,Ei(a)?Ro(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Fo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;ko((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Di(t)?No(t,n):n(t)}))},Fo.ALL=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t);if(0!==r.length){var s=Zi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ci(t)?[]:{})},Fo.RACE=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t),s=Ci(t)?Hi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Xi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=xi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},Fo.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(Di(l))return void No(l,n);if(Ri(l))return void Qo(e,l,s.context,$o,eo(a),!1,n);n(l)}catch(e){n(e,!0)}},Fo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Li(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Fo.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(Ri(o))return o;var a=!1;return zi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Di(o)})}))}catch(e){return zi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:eo(t)}(c,a);To((function(){var t=Qo(e,c,l.context,$o,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Fo.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Wi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ci(t)){if(0===t.length)return void n([]);var r=Zi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Fo.CANCEL=function(e,t,n,i){var o=i.task;t===bi?xo(o):Ci(t)?t.forEach(xo):xo(t),n()},Fo.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},Fo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=no());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Uo):e.isEmpty()?(n.push(i),i.cancel=function(){Wi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Uo)}}}}(t.buffer),a=Ro(i),r=function t(n){_o(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},Fo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Fo.FLUSH=function(e,t,n){t.flush(n)},Fo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Fo.SET_CONTEXT=function(e,t,n,i){var o=i.task;ji(o.context,t),n()},Fo);function jo(e,t){return e+"?"+t}function Wo(e){var t=e.name,n=e.location;return n?t+" "+jo(n.fileName,n.lineNumber):t}function Ko(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var Bo=null,zo=[],qo=function(e){e.crashedEffect=Bo,zo.push(e)},Ho=function(){Bo=null,zo.length=0},Jo=function(){var e,t,n=zo[0],i=zo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=to(e))?t.code+" "+jo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Wo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Wo(e.meta)})),[Ko(zo)]).join("\n")};function Yo(e,t,n,i,o,a,r){var s;void 0===r&&(r=xi);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Wi(o,t),t.cont=xi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=xi,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,qo({meta:o,cancelledTasks:y}),S.isRoot){var i=Jo();Ho(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ki?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Ai]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(ki,!1))},s.cont=r,s.end=g,s.setContext=function(e){ji(f,e)},s.toPromise=function(){return d||(d=ho(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Qo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Di(t)?No(t,i):Ri(t)?Qo(e,t,c.context,n,o,!1,i):t&&t[Si]?(0,Vo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=xi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(ki))},status:0},c=Yo(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Ho()):Qi(e)?(l.status=1,d.cancel(),o=Oi(t.return)?t.return(ki):{done:!0,value:ki}):o=Yi(e)?Oi(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=Go();function l(n,o){a||(a=!0,i.cancel=xi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Bo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=xi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=xi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Xo(e,t){for(var n=e.channel,i=void 0===n?Mo():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?qi: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=Go();if(l&&(l.rootSagaStarted=l.rootSagaStarted||xi,l.effectTriggered=l.effectTriggered||xi,l.effectResolved=l.effectResolved||xi,l.effectRejected=l.effectRejected||xi,l.effectCancelled=l.effectCancelled||xi,l.actionDispatched=l.actionDispatched||xi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=Vi;var m={channel:i,dispatch:Ji(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return To((function(){var e=Qo(m,S,s,v,eo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Zo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Mo():a,s=n.sagaMonitor,l=Ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Xo.bind(null,C({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.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){ji(o,e)},c},ea=function(e){return{done:!0,value:e}},ta={};function na(e){return _i(e)?"channel":Mi(e)?String(e):Oi(e)?e.name:String(e)}function ia(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ta)return ea(t);if(n&&!o)throw r=ta,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===ta?ea(t):a}return zi(s,(function(e){return s(null,e)}),n)}function oa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:po.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+na(e)+", "+t.name+")")}function aa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:lo(e)},l=function(e){return{done:!1,value:po.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:go(e)}},u=function(e){return a=e},d=function(e){return r=e};return ia({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+na(e)+", "+t.name+")")}function ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+na(e)+", "+t.name+")")}function sa(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:fo.apply(void 0,[n].concat(a))},l={done:!1,value:vo(t)};return ia({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ta}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function la(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return po.apply(void 0,[oa,e,t].concat(i))}function ca(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return po.apply(void 0,[aa,e,t].concat(i))}function ua(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return po.apply(void 0,[ra,e,t].concat(i))}class da{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"}static getInstance(){return da.instance||(da.instance=new da),da.instance}static setContext(e){da.getInstance().context=e}static setAccessToken(e){da.getInstance().accessToken=e}static setUser(e){da.getInstance().user=e}static setRequestSource(e){da.getInstance().requestSource=e}static setOnRedirectTo(e){da.getInstance().onRedirectTo=e}static setLogout(e,t){da.getInstance().logout=n=>{n?e(n):da.onRedirectTo(t)}}static getContext(){var e;return null!=(e=da.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return da.getInstance().accessToken}static getRequestSource(){return da.getInstance().requestSource}static getUser(){return da.getInstance().user}static onRedirectTo(e,t){return da.getInstance().onRedirectTo(e,t)}static logout(e){return da.getInstance().logout(e)}}da.instance=void 0;const ya={getContext:()=>da.getContext(),getAccessToken:()=>da.getAccessToken(),getUser:()=>da.getUser(),onRedirectTo:(e,t)=>da.onRedirectTo(e,t),logout:e=>da.logout(e)};class fa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function pa(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const ga=async e=>{var t,n,i;const o=da.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:da.getAccessToken)(),o=da.getRequestSource(),a={};i&&(a.Authorization=`Bearer ${i}`),t&&(a["Content-Type"]=t),o&&(a["frontegg-source"]=o);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))a[`${t.key}`]=`${t.value}`;return a}(o,e.contentType),r=await async function(e,t,n){const i=pa(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:C({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new fa("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new fa(e,s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.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 s.text()}try{return await s.json()}catch(e){return{}}},Sa=async(e,t,n)=>ga(C({url:e,method:"GET",contentType:"application/json",params:t},n)),va=async(e,t,n)=>ga(C({url:e,method:"POST",contentType:"application/json",body:t},n)),ha=async(e,t,n)=>ga(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ma=async(e,t,n)=>ga(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),ba=async(e,t,n)=>ga(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Aa=async(e,t,n,i)=>ga(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ka=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),Ta={v1:"/identity/resources/users/webauthn/v1/devices"},Pa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ia={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",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"}}},La={v1:"/identity/resources/configurations/v1"},Ea={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Oa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},wa={v1:"/identity/resources/permissions/v1"},Ca={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"}},Da={v1:"/identity/resources/roles/v1"},Ra={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ua={v1:"/identity/resources/impersonation/v1"},_a={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ma={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Na={v1:"/team/resources/members/v1"},Fa={v1:"/team/resources/roles/v1"},$a={v1:"/team/resources/stats/v1"},Ga={v1:"/team/resources/profile"},xa={v1:"/tenants/resources/account-settings/v1"},Va={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},ja={v1:"/tenants/resources/sub-tenants/v1"},Wa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ka={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},Ba={v1:"/subscriptions/resources/payment-providers/v1"},za={v1:"/subscriptions/resources/subscriptions/v1"},qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ha={v1:"/reports/engine/resources/triggers/v1"},Ja="/notification",Ya="/audits",Qa={v1:"/event/resources/configurations/v1"},Xa="/webhook",Za="/oauth",er="/flags",tr="/directory/resources/v1/configurations/scim2",nr="/directory/resources/scim/temp",ir="/entitlements";async function or(e){return ma(`${Ia.v1}/tenant`,e)}async function ar(){return Sa(`${Ia.v2}/me/tenants`)}async function rr(e){return Sa(Va.v1,void 0,{headers:ka(e)})}async function sr(e){return Sa(Va.tree.v1,void 0,{headers:ka(e)})}async function lr(e){return Sa(Va.parents.v1,void 0,{headers:ka(e)})}async function cr(e,t){return va(`${Ca.users.v1}/count`,e,{headers:ka(t)})}async function ur(){return Sa(La.v1)}async function dr(){return Sa(`${La.v1}/mfa-policy`)}async function yr(){return Sa(`${La.v1}/mfa-policy/vendor`)}async function fr(e){return e.id?ha(`${La.v1}/mfa-policy`,e):va(`${La.v1}/mfa-policy`,e)}async function pr(){return Sa(`${La.v1}/lockout-policy`)}async function gr(){return Sa(`${La.v1}/lockout-policy/vendor`)}async function Sr(e){return e.id?ha(`${La.v1}/lockout-policy`,e):va(`${La.v1}/lockout-policy`,e)}async function vr(){try{return await Sa(`${La.v1}/captcha-policy/public`)}catch{return null}}async function hr(){return Sa(`${La.v1}/password-history-policy`)}async function mr(){return Sa(`${La.v1}/password-history-policy/vendor`)}async function br(e){return e.id?ha(`${La.v1}/password-history-policy`,e):va(`${La.v1}/password-history-policy`,e)}async function Ar(){return Sa(`${La.v1}/password`)}async function kr(){return Sa(`${Ea.emailDomain.v1}`)}async function Tr(){return Sa(`${Ea.emailDomain.v1}/config`)}async function Pr(e){return va(`${Ea.emailDomain.v1}`,e)}async function Ir(e){return va(`${Ea.emailDomain.v1}/config`,e)}async function Lr(e){return ba(`${Ea.emailDomain.v1}/${e}`)}async function Er(e){return Sa(`${Ea.ip.v1}`,e)}async function Or(){return Sa(`${Ea.ip.v1}/config`)}async function wr(e){return va(`${Ea.ip.v1}`,e)}async function Cr(e){return va(`${Ea.ip.v1}/bulk`,e)}async function Dr(e){return va(`${Ea.ip.v1}/config`,e)}async function Rr(e){return ba(`${Ea.ip.v1}/${e}`)}async function Ur(){return va(`${Ea.ip.v1}/verify`)}async function _r(){return va(`${Ea.ip.v1}/verify/allow`)}let Mr,Nr,Fr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Mr||(Mr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Nr||(Nr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Fr||(Fr={}));class $r extends Error{constructor(e){super(e)}}const Gr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new $r("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class xr extends Error{constructor(e){super(e)}}const Vr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(Gr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Gr(t)}})(e.split(".")[n]))}catch(e){throw new xr("Invalid token specified: "+e.message)}},jr=["type"],Wr=["type"];async function Kr(e){if(!e.accessToken)return e;da.setAccessToken(e.accessToken);const t=await Sa(`${Ia.v2}/me`),n=C({},e,e.accessToken?Vr(e.accessToken):{},t);return da.setUser(n),n}async function Br(e){if(!e.accessToken)return{user:e};da.setAccessToken(e.accessToken);const[t,n]=await Promise.all([Sa(`${Ia.v2}/me`),ar()]),i=C({},e,e.accessToken?Vr(e.accessToken):{},t);return da.setUser(i),{user:i,tenants:n}}async function zr(e){da.setAccessToken(e.id_token);const t=await Sa(`${Ia.v2}/me`),n=e.id_token?Vr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return da.setUser(i),i}async function qr(e){try{const{address:t}=await va(`${Pa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Hr(e){return va(`${Pa.v1}/user/saml/prelogin`,e)}async function Jr(e){return Kr(await va(`${Pa.v1}/user/saml/postlogin`,e))}async function Yr(e){return Kr(await va(`${Pa.v1}/user/oidc/postlogin`,e))}async function Qr(e){return Kr(await va(`${Pa.v1}/user`,e))}async function Xr(e){return Kr(await va(`${Pa.v1}/user/mfa/verify`,e))}async function Zr(e){return va(`${Ia.v1}/activate`,e)}async function es(e){return Sa(`${Ia.v1}/activate/strategy`,e)}async function ts(e){return va(`${Ia.v1}/activate/reset`,e)}async function ns(e){return va(`${Ia.v1}/invitation/reset`,e)}async function is(e){return va(`${Ia.v1}/invitation/accept`,e)}async function os(){return Kr(await va(`${Pa.v1}/user/token/refresh`))}async function as(){return Br(await va(`${Pa.v1}/user/token/refresh`))}async function rs(){return va(`${Pa.v1}/logout`)}async function ss(e){return Sa(`${Za}/logout`,e)}async function ls(e){return va(`${Ia.v1}/passwords/reset`,e)}async function cs(e){return va(`${Ia.v1}/passwords/reset/verify`,e)}async function us(e){return Sa(`${Ia.v1}/passwords/config`,e)}async function ds(e){return va(`${Pa.v1}/user/mfa/recover`,e)}async function ys(){return va(`${Ia.v1}/mfa/enroll`)}async function fs(){return va(`${Ia.v1}/mfa/authenticator/enroll`)}async function ps(e){return va(`${Ia.v1}/mfa/authenticator/enroll/verify`,e)}async function gs(e){return va(`${Ia.v1}/mfa/sms/enroll`,e)}async function Ss(e){return va(`${Ia.v1}/mfa/sms/enroll/verify`,e)}async function vs(){return va(`${Ia.v1}/mfa/webauthn/enroll`)}async function hs(e){return va(`${Ia.v1}/mfa/webauthn/enroll/verify`,e)}async function ms(e){return va(`${Ia.v1}/mfa/enroll/verify`,e)}async function bs(e){return va(`${Ia.v1}/mfa/disable`,e)}async function As(e,t){return va(`${Ia.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ks(e){return va(`${Ia.v1}/mfa/sms/${e}/disable`)}async function Ts(e,t){return va(`${Ia.v1}/mfa/sms/${e}/disable/verify`,t)}async function Ps(e){return va(`${Ia.v1}/mfa/webauthn/${e}/disable`)}async function Is(e,t){return va(`${Ia.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ls(){return Sa(`${Ia.v1}/mfa/devices`)}async function Es(e){return va(`${Pa.v1}/user/mfa/authenticator/enroll`,e)}async function Os(e){return va(`${Pa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ws(e,t){return va(`${Pa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Cs(e){return va(`${Pa.v1}/user/mfa/sms/enroll`,e)}async function Ds(e){return va(`${Pa.v1}/user/mfa/sms/enroll/verify`,e)}async function Rs(e,t){return va(`${Pa.v1}/user/mfa/sms/${e}`,t)}async function Us(e,t){return va(`${Pa.v1}/user/mfa/sms/${e}/verify`,t)}async function _s(e){return va(`${Pa.v1}/user/mfa/webauthn/enroll`,e)}async function Ms(e){return va(`${Pa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Ns(e,t){return va(`${Pa.v1}/user/mfa/webauthn/${e}`,t)}async function Fs(e,t){return va(`${Pa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function $s(){return Sa(`${Ma.v1}/saml/configurations`)}async function Gs(e){return va(`${Ma.v1}/saml/configurations`,e)}async function xs(){return Sa(`${Ma.v1}/saml/configurations/vendor-config`)}async function Vs(e){return ma(`${Ma.v1}/saml/configurations/metadata`,e)}async function js(){return ma(`${Ma.v1}/saml/validations/domain`)}async function Ws(){return Sa(`${Ma.v1}/saml/configurations/roles/default`)}async function Ks(){return Sa(`${Ma.v2}/saml/configurations/groups`)}async function Bs({roleIds:e}){return va(`${Ma.v1}/saml/configurations/roles/default`,{roleIds:e})}async function zs({roleIds:e,group:t}){return va(`${Ma.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function qs({roleIds:e,group:t,id:n}){return ha(`${Ma.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Hs({id:e}){return ba(`${Ma.v2}/saml/configurations/groups/${e}`)}async function Js(){return Sa(`${Ma.v1}/oidc/configurations`)}async function Ys(){return Sa(`${Ma.v2}/configurations/public`)}async function Qs(){return Sa(Oa.v1)}async function Xs(){return Sa(Oa.v2)}async function Zs(){return Sa(Oa.custom.v1)}async function el({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),va(`${Pa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function tl(){return Sa(`${La.v1}/public`)}async function nl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await va(`${Ia.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Kr(n):void 0,userId:i,tenantId:o}}async function il(){return Sa(Ia.sessions.currentUser.v1)}async function ol(){return Sa(`${Ia.sessions.currentUser.v1}/current`)}async function al(e){return va(`${Ia.sessions.v1}/revoke`,{userId:e})}async function rl(){return Sa(Ia.sessions.configurations.v1)}async function sl(e){await va(Ia.sessions.configurations.v1,e)}async function ll(e){await ba(`${Ia.sessions.currentUser.v1}/${e}`)}async function cl(){await ba(`${Ia.sessions.currentUser.v1}/all`)}async function ul(){return Sa(Ia.accessTokens.v1)}async function dl(){return Sa(Ca.accessTokens.v1)}async function yl({id:e}){return ba(`${Ca.accessTokens.v1}/${e}`)}async function fl({id:e}){return ba(`${Ia.accessTokens.v1}/${e}`)}async function pl(e){return va(Ia.accessTokens.v1,e)}async function gl(e){return va(Ca.accessTokens.v1,e)}async function Sl(){return Sa(Ia.apiTokens.v1)}async function vl(){return Sa(Ca.apiTokens.v1)}async function hl(e){return va(Ia.apiTokens.v1,e)}async function ml(e){return va(Ca.apiTokens.v2,e)}async function bl({tokenId:e}){return ba(`${Ca.apiTokens.v1}/${e}`)}async function Al({tokenId:e}){return ba(`${Ia.apiTokens.v1}/${e}`)}async function kl({userId:e}){return Sa(`${Ia.v1}/${e}`)}async function Tl(e){return Sa(`${La.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Pl(e){let{type:t}=e,n=Ii(e,jr);return va(`${Pa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Il(e){let{type:t}=e,n=Ii(e,Wr);return va(`${Pa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ll({token:e}){return va(Ca.invites.verify.v1,{token:e})}async function El(){return Sa(`${Ma.v1}/configurations`)}async function Ol(e){return va(`${Ma.v1}/configurations`,e)}async function wl(e,t){return ha(`${Ma.v1}/configurations/${e}`,t)}async function Cl(e){return ba(`${Ma.v1}/configurations/${e}`)}async function Dl(e){return va(`${Ma.v1}/configurations/metadata`,e)}async function Rl(e,t){return ma(`${Ma.v1}/configurations/${e}/metadata`,t)}async function Ul(e,t){return va(`${Ma.v1}/configurations/${e}/domains`,t)}async function _l(e,t){return ba(`${Ma.v1}/configurations/${e}/domains/${t}`)}async function Ml(e,t){return ma(`${Ma.v1}/configurations/${e}/domains/${t}/validate`)}async function Nl(e){return Sa(`${Ma.v1}/configurations/${e}/roles`)}async function Fl(e,t){return ma(`${Ma.v1}/configurations/${e}/roles`,t)}async function $l(e,t){return va(`${Ma.v1}/configurations/${e}/groups`,t)}async function Gl(e,{roleIds:t,group:n,id:i}){return ha(`${Ma.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function xl(e,t){return ba(`${Ma.v1}/configurations/${e}/groups/${t}`)}async function Vl(e){return Sa(`${Ma.v1}/configurations/${e}/groups`)}async function jl(e){return va(`${Pa.v2}/user/sso/prelogin`,e)}async function Wl(e){return Kr(await va(`${Pa.v2}/user/oidc/postlogin`,e))}async function Kl(e){return zr(await va(`${Za}/token`,e))}async function Bl(){return zr(await va(`${Za}/authorize/silent`))}async function zl(e){return va(`${Ia.v1}/phone/reset`,e)}async function ql(e){return va(`${Ia.v1}/phone/reset/verify`,e)}async function Hl(e){return va(`${Ia.v1}/phone`,e)}async function Jl(e){return va(`${Ia.v1}/phone/verify`,e)}async function Yl(e){return ma(`${Ia.v1}/phone/change`,e)}async function Ql(e){return va(`${Pa.v1}/webauthn/prelogin`,e)}async function Xl(e){return va(`${Pa.v1}/webauthn/postlogin`,e)}async function Zl(){return va(Ta.v1)}async function ec(){return Sa(Ta.v1)}async function tc(e){return ba(`${Ta.v1}/${e}`)}async function nc(e){return va(`${Ta.v1}/verify`,e)}async function ic(){return Sa(`${La.v1}/auth/strategies/public`)}async function oc(){return Sa(`${La.v1}/mfa/strategies`)}async function ac(e){return Sa(`${Ia.v2}/me`,null!=e?e:{addRoles:!0})}async function rc(e){return ma(`${Ia.v2}/me`,e)}async function sc(e){return ma(`${Ga.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function lc(e){return va(`${Ia.v1}/passwords/change`,e)}async function cc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>C({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Sa(Na.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function uc(e){return va(Ia.v2,C({},e,{provider:"local"}))}async function dc(e){return ba(`${Na.v1}/${e.userId}`)}async function yc(e){return ma(Na.v1,e)}async function fc(e){return va(Ca.invites.user.v1,C({},e))}async function pc(e){return ha(Ca.invites.user.v1,C({},e))}async function gc(){return ba(Ca.invites.user.v1)}async function Sc(){return Sa(Ca.invites.user.v1)}async function vc(){return Sa(Ca.invites.configuration.v1)}async function hc(){return Sa(Fa.v1)}async function mc(){return Sa(wa.v1)}async function bc(){return Sa(`${$a.v1}/members`)}async function Ac(e){return va(`${Na.v1}/${e.userId}/resendActivationEmail`,{})}async function kc(e){return va(Ia.v2,C({},e,{provider:"local"}))}async function Tc(e){return va(Ia.invitation.resendAll.v1,C({},e))}async function Pc(e){var t,n;const i=await Sa("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Ic(){return Sa("/metadata/admin-box")}async function Lc(e){return va("/metadata/admin-box",e)}async function Ec(){const e=await Sa("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Oc=async()=>Pc({entityName:"notifications"}),wc=async()=>Pc({entityName:"saml"}),Cc=async()=>Pc({entityName:"audits"}),Dc=async e=>async function(e){const t=await Sa(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Rc=["dataFilters"],Uc=["templateId","dataFilters"],_c=["dataFilters"];async function Mc(e){return Sa(`${qa.v2}/tenant-reports`,e)}async function Nc(e){return Sa(`${qa.v2}/${e.id}/tenant-reports`)}async function Fc(e){let{dataFilters:t}=e,n=Ii(e,Rc);return{html:await Sa(`${Ha.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function $c(e){let{templateId:t,dataFilters:n}=e,i=Ii(e,Uc);return va(`${qa.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Gc(e){let{dataFilters:t}=e,n=Ii(e,_c);const i=await Sa(`${Ha.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function xc(e){return va(`${Ha.v1}/tenant-reports`,e)}async function Vc(e){return Sa(Ja,{params:e})}async function jc(e){return ma(`${Ja}/status`,{params:e})}async function Wc(e){const{notificationId:t,pinStatus:n}=e;return ma(`${Ja}/${n}`,{notificationId:t})}async function Kc(){return va(`${Ja}/status/mark-all-read`)}const Bc=["endpoint","headerProps"];async function zc(e){return Sa(Ya,e)}async function qc(e){return Sa(`${Ya}/stats`,e)}async function Hc(e){const{endpoint:t,headerProps:n}=e,i=Ii(e,Bc);return Aa(`${Ya}/export/${t}`,{properties:n},i)}const Jc=["eventKey"],Yc=["eventKey"],Qc=()=>Sa(`${Wa.v1}/slack`),Xc=()=>Sa(`${Wa.v1}/slack/applications`),Zc=()=>Sa(`${Wa.v1}/slack/channels`),eu=e=>e.id?ha(`${Wa.v1}/slack/subscription/${e.id}`,e):va(`${Wa.v1}/slack/subscriptions`,e),tu=e=>ba(`${Wa.v1}/slack/subscriptions/${e.id}`),nu=e=>va(`${Wa.v1}/slack/applications/registrations`,{code:e}),iu=()=>Sa(`${Wa.v1}/emails`),ou=e=>{let{eventKey:t}=e,n=Ii(e,Jc);return va(`${Wa.v1}/emails/${t}`,n)},au=({eventKey:e,enabled:t})=>ha(`${Wa.v1}/emails/${e}`,{enabled:t}),ru=(e,t)=>ba(`${Wa.v1}/emails/${e}/subscriptions/${t}`),su=(e,t,n)=>ma(`${Wa.v1}/emails/${t}/subscriptions/${e}`,n),lu=e=>ba(`${Wa.v1}/emails/${e}`),cu=()=>Sa(`${Wa.v2}/sms`),uu=e=>{let{eventKey:t}=e,n=Ii(e,Yc);return va(`${Wa.v2}/sms/${t}`,n)},du=({eventKey:e,enabled:t})=>ha(`${Wa.v2}/sms/${e}`,{enabled:t}),yu=(e,t)=>ba(`${Wa.v2}/sms/${e}/subscriptions/${t}`),fu=(e,t,n)=>ma(`${Wa.v2}/sms/${t}/subscriptions/${e}`,n),pu=e=>ba(`${Wa.v2}/sms/${e}`),gu=()=>Sa(Xa),Su=e=>e._id?ha(`${Xa}/${e._id}`,e):va(`${Xa}/custom`,e),vu=e=>ba(`${Xa}/${e}`),hu=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Sa(`${Xa}/logs/?${i.toString()}`)},mu=e=>va(`${Xa}/test`,e),bu=e=>va(`${Xa}/logs/${e}/retries`),Au=()=>Sa(`${Qa.v1}/categories`),ku=e=>Sa(Qa.v1,{channels:e});async function Tu(e,t){return ma(xa.v1,e,{headers:ka(t)})}async function Pu(e){return Sa(xa.v1,void 0,{headers:ka(e)})}async function Iu(){return Sa(`${xa.v1}/public`)}const Lu=["roleId"],Eu=["roleId"],Ou=["permissionId"];async function wu(){return Sa(Da.v1)}async function Cu(e){return va(Da.v1,e)}async function Du({roleId:e}){return ba(`${Da.v1}/${e}`)}async function Ru(e){let{roleId:t}=e,n=Ii(e,Lu);return ha(`${Da.v1}/${t}`,n)}async function Uu(e){let{roleId:t}=e,n=Ii(e,Eu);return ma(`${Da.v1}/${t}/permissions`,n)}async function _u(){return Sa(wa.v1)}async function Mu(e){let{permissionId:t}=e,n=Ii(e,Ou);return ma(`${wa.v1}/${t}/roles`,n)}async function Nu(){return Sa(`${wa.v1}/categories`)}async function Fu(){return Sa(Ka.subscriptions.v1)}async function $u(e){return Sa(`${Ka.subscriptions.v1}/${e}`)}async function Gu(e){return ma(`${Ka.subscriptions.v1}/${e}/cancellations/`,{})}async function xu(e){return ma(`${Ka.subscriptions.v1}/${e}/renewals/`,{})}async function Vu(e,{paymentMethodId:t,planId:n}){return ma(`${Ka.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function ju(e){return Sa(`${za.v1}/${e}`)}async function Wu(){return Sa(`${za.v1}`)}async function Ku(e){return ma(`${za.v1}/${e}/cancellations/`,{})}async function Bu(e){return ma(`${za.v1}/${e}/renewals/`,{})}async function zu(e,{paymentMethodId:t,planId:n}){return ma(`${za.v1}/${e}`,{paymentMethodId:t,planId:n})}async function qu(){return Sa(Ka.plans.v1)}async function Hu(e){return Sa(`${Ka.plans.v1}/${e}`)}async function Ju(){return Sa(Ka.invoices.v1)}async function Yu(e){return Sa(`${Ka.invoices.v1}/${e}`)}async function Qu(e,t){return Sa(`${Ka.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Xu=["email"];async function Zu(){return Sa(Ka.paymentMethods.v1)}async function ed(e){return Sa(`${Ka.paymentMethods.v1}/${e}`)}async function td(e,t){let{email:n}=t,i=Ii(t,Xu);return ha(`${Ka.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function nd(e){return va(Ka.paymentProviders.stripe.subscriptions.v1,e)}async function id(e){return Sa(`${Ka.paymentProviders.stripe.customers.v1}/${e}`)}async function od(e){return va(`${Ka.paymentProviders.stripe.customers.v1}`,e)}async function ad(){return Sa(`${Ka.paymentProviders.stripe.publicConfigurations.v1}`)}async function rd(e){return va(`${Ka.paymentProviders.stripe.setupIntents.v1}`,e)}async function sd(e){return Sa(`${Ka.summaries.v1}/${e}`)}async function ld(e){return Sa(`${Ka.tenantConfiguration.v1}/${e}`)}async function cd(e){return va(`${Ka.tenantConfiguration.v1}`,e)}async function ud(){return Sa(Ba.v1)}async function dd(){return Sa(`${Ka.configurations.vendorPublicConfigurations.v1}`)}let yd,fd,pd,gd,Sd,vd;async function hd(){return Sa("/vendors/public")}async function md(e){return Sa(Ra.v1,e)}async function bd(e){return va(Ra.v1,e)}async function Ad(e,t){return ba(Ra.v1,e,{headers:ka(t)})}async function kd(e,t,n){return va(`${Ra.v1}/${e}/roles`,t,{headers:ka(n)})}async function Td(e,t,n){return ba(`${Ra.v1}/${e}/roles`,t,{headers:ka(n)})}async function Pd(e,t,n){return ha(`${Ra.v1}/${e}/roles`,t,{headers:ka(n)})}async function Id(e,t){return va(ja.v1,e,{headers:ka(t)})}async function Ld(e,t){return ba(`${ja.v1}/${e}`,void 0,{headers:ka(t)})}async function Ed(e,t,n){return ma(`${Ra.v1}/${e}/access`,t,{headers:ka(n)})}async function Od(e,t){return va(`${Ra.v2}/`,e,{headers:ka(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(yd||(yd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(fd||(fd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(pd||(pd={})),(gd||(gd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Sd||(Sd={})),function(e){e.CREATE="create_customer"}(vd||(vd={}));const wd={flags:{}};class Cd{constructor(){var e;this._flags={},this._flags=null!=(e=wd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Cd;return n.set(e),Cd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=C({},null!=(t=null==wd?void 0:wd.flags)?t:{},null!=e?e:{})}}async function Dd(){return Sa(er)}async function Rd(){return Sa(`${tr}`)}async function Ud(e,t){return ha(`${tr}/${e}`,t)}async function _d(e){return va(`${tr}`,e)}async function Md(e){return ba(`${tr}/${e}`)}async function Nd(e){return Sa(`${nr}/${e}/Users/count`)}async function Fd(e){return va(`${Ua.v1}`,e)}Cd._instances={};const $d=["groupId"];async function Gd({groupId:e},t){return Sa(`${_a.v1}/${e}`,C({},t))}async function xd(e){return Sa(`${_a.v1}`,C({},e))}async function Vd(e,t){return va(`${_a.getByIds.v1}`,e,{params:t})}async function jd(e){return va(`${_a.v1}`,e)}async function Wd(e){let{groupId:t}=e,n=Ii(e,$d);return ha(`${_a.v1}/${t}`,n)}async function Kd(e){return ba(`${_a.v1}/${e}`)}async function Bd(e,t){return va(`${_a.v1}/${e}/roles`,t)}async function zd(e,t){return ba(`${_a.v1}/${e}/roles`,t)}async function qd(e,t){return va(`${_a.v1}/${e}/users`,t)}async function Hd(e,t){return ba(`${_a.v1}/${e}/users`,t)}async function Jd(){return Sa(`${_a.configurations.v1}`)}async function Yd(e){return va(`${_a.configurations.v1}`,e)}async function Qd(e){return va(`${Ia.v3}/me/token`,e)}async function Xd(e,t){return Sa(Ia.v3,e,{headers:ka(t)})}async function Zd(){return Sa(ir)}let ey,ty,ny,iy,oy;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(ey||(ey={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(ty||(ty={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ny||(ny={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(iy||(iy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(oy||(oy={}));const ay=[/^(.*)\/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],ry=`${Pa.v1}/user/token/refresh`,sy=`${Za}/authorize/silent`,ly=`${Ia.v2}/me`,cy=`${Ia.v2}/me/tenants`;let uy,dy,yy,fy,py;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(uy||(uy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(dy||(dy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(yy||(yy={})),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"}(fy||(fy={})),function(e){e.ASC="ASC",e.DESC="DESC"}(py||(py={}));const gy={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m,users:b,entitlements:A};var Sy={fetch:e,ContextHolder:da,FronteggContext:ya,api:gy,FronteggApiError:fa,AuthStrategyEnum:Nr,MachineToMachineAuthStrategy:Fr,SocialLoginProviders:Mr,ISubscriptionCancellationPolicy:pd,ISubscriptionStatus:yd,PaymentMethodType:fd,ProviderType:gd};let vy,hy;!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"}(vy||(vy={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(hy||(hy={}));const my="input is invalid type",by="undefined"!=typeof ArrayBuffer,Ay="0123456789abcdef".split(""),ky=[-2147483648,8388608,32768,128],Ty=[24,16,8,0],Py=[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],Iy=["hex","array","digest","arrayBuffer"],Ly=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),by&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Ey=function(e){return function(t){const n=new wy(!0).update(t);return null==n?void 0:n[e]()}},Oy=function(e){return function(t,n){const i=new Cy(t,!0).update(n);return null==i?void 0:i[e]()}};class wy{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=()=>wy.prototype.digest(),e?(Ly[0]=Ly[16]=Ly[1]=Ly[2]=Ly[3]=Ly[4]=Ly[5]=Ly[6]=Ly[7]=Ly[8]=Ly[9]=Ly[10]=Ly[11]=Ly[12]=Ly[13]=Ly[14]=Ly[15]=0,this.blocks=Ly):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(my);if(null===e)throw new Error(my);if(by&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||by&&ArrayBuffer.isView(e)))throw new Error(my);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<Ty[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<Ty[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<Ty[3&o++],s[o>>2]|=(128|63&i)<<Ty[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<Ty[3&o++],s[o>>2]|=(128|i>>6&63)<<Ty[3&o++],s[o>>2]|=(128|63&i)<<Ty[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<Ty[3&o++],s[o>>2]|=(128|i>>12&63)<<Ty[3&o++],s[o>>2]|=(128|i>>6&63)<<Ty[3&o++],s[o>>2]|=(128|63&i)<<Ty[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}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]|=ky[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,i,o,a,r,s,l,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)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+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),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+Py[e]+m[e],a=t+i,h=p+o<<0,p=o+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),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+Py[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+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,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+Py[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+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,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+Py[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+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,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=Ay[e>>28&15]+Ay[e>>24&15]+Ay[e>>20&15]+Ay[e>>16&15]+Ay[e>>12&15]+Ay[e>>8&15]+Ay[e>>4&15]+Ay[15&e]+Ay[t>>28&15]+Ay[t>>24&15]+Ay[t>>20&15]+Ay[t>>16&15]+Ay[t>>12&15]+Ay[t>>8&15]+Ay[t>>4&15]+Ay[15&t]+Ay[n>>28&15]+Ay[n>>24&15]+Ay[n>>20&15]+Ay[n>>16&15]+Ay[n>>12&15]+Ay[n>>8&15]+Ay[n>>4&15]+Ay[15&n]+Ay[i>>28&15]+Ay[i>>24&15]+Ay[i>>20&15]+Ay[i>>16&15]+Ay[i>>12&15]+Ay[i>>8&15]+Ay[i>>4&15]+Ay[15&i]+Ay[o>>28&15]+Ay[o>>24&15]+Ay[o>>20&15]+Ay[o>>16&15]+Ay[o>>12&15]+Ay[o>>8&15]+Ay[o>>4&15]+Ay[15&o]+Ay[a>>28&15]+Ay[a>>24&15]+Ay[a>>20&15]+Ay[a>>16&15]+Ay[a>>12&15]+Ay[a>>8&15]+Ay[a>>4&15]+Ay[15&a]+Ay[r>>28&15]+Ay[r>>24&15]+Ay[r>>20&15]+Ay[r>>16&15]+Ay[r>>12&15]+Ay[r>>8&15]+Ay[r>>4&15]+Ay[15&r];return l+=Ay[s>>28&15]+Ay[s>>24&15]+Ay[s>>20&15]+Ay[s>>16&15]+Ay[s>>12&15]+Ay[s>>8&15]+Ay[s>>4&15]+Ay[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[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,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}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 Cy extends wy{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(my);if(null===e)throw new Error(my);if(by&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||by&&ArrayBuffer.isView(e)))throw new Error(my)}var o;e.length>64&&(e=null==(o=new wy(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}wy.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();wy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),wy.prototype.finalize.call(this)}}}const Dy=function(){const e=Ey("hex");e.create=function(){return new wy},e.update=function(t){return e.create().update(t)};for(let t=0;t<Iy.length;++t){const n=Iy[t];e[n]=Ey(n)}return e}();function Ry(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Uy(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=Dy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function _y(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Oy("hex");e.create=function(e){return new Cy(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Iy.length;++t){const n=Iy[t];e[n]=Oy(n)}}();const My=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Ny(e){const t=yield So((e=>e.root.appName));return Cd.getFeatureFlags(e,t)}const Fy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},$y=C({},Fy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Gy=[{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"}],xy={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},Vy=C({},xy,{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}),jy={loading:!1,error:void 0,saving:!0,profile:xy},Wy={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"},Ky={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Nr.EmailAndPassword,machineToMachineAuthStrategy:Fr.ClientCredentials},By={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},zy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},qy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Hy={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},Jy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Yy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Qy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Hy,roles:Yy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Xy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Zy={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:[Gy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Gy[0]],managedBy:yy.FRONTEGG}]},ef={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:[Gy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Gy[0]],managedBy:yy.FRONTEGG}]},tf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},nf=[ef,Zy],of=[tf],af=[{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}],rf=[{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"}],sf={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},lf={isActive:!0,strategy:xn.ALLOW},cf=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],uf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},ef,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},df=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"}),yf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:uf(6),roles:[df("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:yy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:uf(44),roles:[df("Editor")],managedBy:yy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:uf(8),roles:[df("Viewer")],managedBy:yy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:uf(5),roles:[df("Admin")],managedBy:yy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:uf(21),description:"BDR, AE, and inside sales",roles:[df("Viewer")],managedBy:yy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:uf(23),description:"Dev success and customer success",roles:[df("Admin")],managedBy:yy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:uf(10),description:"The marketing department",roles:[df("Viewer")],managedBy:yy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:uf(4),description:"Human resources",roles:[df("Viewer")],managedBy:yy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:uf(3),roles:[df("Viewer")],managedBy:yy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:uf(8),roles:[df("Editor")],managedBy:yy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:uf(4),roles:[df("Viewer")],managedBy:yy.FRONTEGG}];let ff,pf,gf;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(ff||(ff={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(pf||(pf={})),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"}(gf||(gf={})),gf.profile,gf.privacy,gf.personalApiTokens,gf.account,gf.users,gf.groups,gf.security,gf.sso,gf.audits,gf.webhooks,gf.apiTokens,gf.roles,gf.subscriptions;const Sf=["events","url"];function*vf(){yield co(yi.setSignUpState({loading:!0}));try{const e=yield fo(gy.auth.getVendorConfig),[t]=(yield fo(gy.auth.getVendorPublicAuthStrategiesConfig),yield fo(Ny,["admin_portal_login_per_tenant"]));if(t){const t=yield fo(gy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield co(yi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*hf(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,Sf);yield co(yi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield So((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield fo(gy.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:pf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(da.setAccessToken(null==s?void 0:s.accessToken),da.setUser(s),!r&&s&&Rp(s)){const t=yield Mp(s);yield co(yi.setState(t)),a(e.loginUrl)}else yield co(yi.setSignUpState({loading:!1,shouldActivate:r,stage:gn.SignUpSuccess})),yield co(yi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield co(yi.loadTenants()))}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setSignUpState({loading:!1,error:e.message}))}yield co(yi.setSignUpState({loading:!1}))}function*mf(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield So((e=>e.auth.signUpState));yield co(yi.resetSignUpState()),yield co(yi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*bf(){yield ua(yi.signUpUser,hf),yield ua(yi.resetSignUpStateSoft,mf)}const Af={setVendorState:(e,{payload:t})=>C({},e,t)},kf={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},Tf={loading:!1},{reducer:Pf,actions:If}=ut({name:Rt,initialState:Tf,reducers:C({},Af)}),Lf=C({},If,kf);function*Ef(){yield co(Lf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield gy.vendor.getVendorPublicInfo();yield co(Lf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield co(Lf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Of=["callback"],wf=["callback"],Cf=["callback"],Df=["callback"],Rf=["callback"],Uf=["callback"];function*_f(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getGlobalSecurityPolicy);yield co(yi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha()),yield co(yi.loadPublicAuthStrategiesPolicy())}function*Mf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getVendorConfig),[t]=yield fo(Ny,["admin_portal_login_per_tenant"]);if(t){const t=yield fo(gy.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Nf(){yield co(yi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getVendorPublicAuthStrategiesConfig);yield co(yi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Ff(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getMfaPolicy);yield co(yi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*$f(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getVendorMfaPolicy);yield co(yi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Gf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Of);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield fo(gy.auth.saveMfaPolicy,n);yield co(yi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getLockoutPolicy);yield co(yi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Vf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,wf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield fo(gy.auth.saveLockoutPolicy,n);yield co(yi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*jf(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getVendorLockoutPolicy);yield co(yi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Wf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getCaptchaPolicy);yield co(yi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Kf(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getPasswordHistoryPolicy);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Bf(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getVendorPasswordHistoryPolicy);yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*zf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Cf);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield fo(gy.auth.savePasswordHistoryPolicy,n);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qf(){yield co(yi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getPasswordConfigPolicy);yield co(yi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Hf(){yield ua(yi.loadSecurityPolicy,_f),yield la(yi.saveSecurityPolicyMfa,Gf),yield la(yi.loadSecurityPolicyMfa,Ff),yield la(yi.loadSecurityPolicyVendorMfa,$f),yield la(yi.saveSecurityPolicyLockout,Vf),yield la(yi.loadSecurityPolicyLockout,xf),yield la(yi.loadSecurityPolicyVendorLockout,jf),yield la(yi.loadSecurityPolicyCaptcha,Wf),yield la(yi.saveSecurityPolicyPasswordHistory,zf),yield la(yi.loadSecurityPolicyPasswordHistory,Kf),yield la(yi.loadSecurityPolicyVendorPasswordHistory,Bf),yield la(yi.loadVendorPasswordConfig,qf),yield la(yi.loadPublicSecurityPolicy,Mf),yield la(yi.loadPublicAuthStrategiesPolicy,Nf)}function*Jf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield co(yi.setSecurityPolicyPublicState({policy:Ky,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Yf(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyGlobalState({policy:Wy,loading:!1})),yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyPasswordHistory()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha())}function*Qf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:By,loading:!1}))}function*Xf(){yield co(yi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorMfaState({policy:By,loading:!1}))}function*Zf(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,Df);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},zy,{id:null!=(t=i.id)?t:zy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*ep(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:zy,loading:!1}))}function*tp(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorLockoutState({policy:zy,loading:!1}))}function*np(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Rf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},zy,n,{id:n.id?n.id:zy.id});null==t||t(i),yield co(yi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*ip(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:zy,loading:!1}))}function*op(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:qy,loading:!1}))}function*ap(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:qy,loading:!1}))}function*rp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Uf);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},qy,n,{id:n.id?n.id:qy.id});null==t||t(i),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*sp(){yield ua(yi.loadSecurityPolicy,Yf),yield la(yi.loadPublicSecurityPolicy,Jf),yield la(yi.saveSecurityPolicyMfa,Zf),yield la(yi.loadSecurityPolicyMfa,Qf),yield la(yi.loadSecurityPolicyVendorMfa,Xf),yield la(yi.saveSecurityPolicyLockout,np),yield la(yi.loadSecurityPolicyLockout,ep),yield la(yi.loadSecurityPolicyVendorLockout,tp),yield la(yi.loadSecurityPolicyCaptcha,ip),yield la(yi.saveSecurityPolicyPasswordHistory,rp),yield la(yi.loadSecurityPolicyPasswordHistory,op),yield la(yi.loadSecurityPolicyVendorPasswordHistory,ap)}const lp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},cp=e=>{const{pathname:t}=new URL(e),n=lp(e);return n?t+n:t},up=["callback"],dp=["callback"],yp=["callback"],fp=["callback"],pp=["callback","events"],gp=["callback"],Sp=["callback"],vp=["callback"],hp=["callback"],mp=["callback"],bp=["callback"],Ap=["callback"],kp=["callback"],Tp=["callback"],Pp=["callback","deviceId"],Ip=["callback","deviceId"],Lp=["callback","deviceId"],Ep=["callback","deviceId"],Op={[Nr.Code]:Pt.loginWithOtc,[Nr.EmailAndPassword]:Pt.loginWithPassword,[Nr.MagicLink]:Pt.magicLinkPreLoginSuccess,[Nr.SmsCode]:Pt.loginWithSmsOtc};function*wp(){const e=da.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield So((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=da.getContext()).tenantResolver)&&d.call(y)&&(yield fo(Kp),u=yield So((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),co(yi.resetLoginState());const p=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=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),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u?cp(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(p,{refresh:p.startsWith("http")})}function*Cp(){let e;try{var t;const n=yield fo(gy.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield co(yi.setState({ssoACS:e}))}function*Dp(){try{const{isActive:e}=yield fo(gy.auth.getSSOPublicConfiguration);yield co(yi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Rp=e=>e.mfaRequired&&e.mfaToken?(da.setAccessToken(null),da.setUser(null),!0):(da.setAccessToken(e.accessToken),da.setUser(e),!1),Up=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},_p=e=>{if(1===e.length){const[t]=e;if(t===ny.AuthenticatorApp)return an.authenticatorApp;if(t===ny.SMS)return an.smsSetPhoneNumber}return an.verify};function*Mp(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield So((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield fo(gy.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Up(e.mfaDevices)}:(n={step:_p(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Np(e){var t;const{routes:n,loginState:i}=yield So((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Fp(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo($p):yield fo(xp)}function*$p(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(gy.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Gp(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(gy.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*xp(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(gy.auth.refreshTokenV2);if(Rp(o)){const e=yield Mp(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Np(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield jp(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*Vp(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(gy.auth.refreshTokenV2);if(Rp(o)){const e=yield Mp(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield fo(tg))yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Np(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield jp(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*jp(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=da.onRedirectTo,{routes:o,loginState:a}=yield So((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield wp())}function*Wp({payload:{callback:e}}){try{const{ip:t}=yield fo(gy.metadata.getCurrentUserIpMetadata);yield co(yi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Kp(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield So((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield fo(Iu);var n;t&&i&&(yield co(yi.setState({customLoginState:{customLoginEnabled:!0},routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+lp(t))?n:""})})))}}catch{}}function*Bp({payload:e}){const t=[];e&&(yield co(yi.setState({isLoading:!0})),yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(vf)),t.push(fo(Nf)),t.push(fo(Dp)),t.push(fo(Ef)),t.push(fo(Cp)),t.push(fo(Kp))),t.push(fo(Fp)),yield uo(t),yield co(yi.setState({isLoading:!1}))}function*zp({accessToken:e,user:t}){if(!e)return void(yield co(yi.setState({user:void 0,isAuthenticated:!1})));const n=da.onRedirectTo,{routes:i}=yield So((e=>e.auth));if(Rp(t)){const e=yield Mp(t);yield co(yi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*qp({payload:e}){const t=[];yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(vf)),t.push(fo(Dp)),t.push(fo(Ef)),t.push(fo(Cp)),t.push(fo(zp,e)),t.push(fo(Kp)),yield uo(t)}function*Hp({payload:e}){const{disableSilentRefresh:t}=yield So((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield fo(gy.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield So((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield co(yi.setState({isLoading:!0}));const a=_y(),r=_y(),s=yield fo(Uy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Jp();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${pa(n,"/oauth/authorize")}/oauth/authorize`,d=C({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,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)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*Jp(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield fo(Kp);const e=yield So((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return lp(e)}}catch{}}function*Yp({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield So((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Jp();a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield fo(gy.auth.exchangeOAuthTokens,r);yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield wp()}}function*Qp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,up);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(gy.auth.changePhoneNumberWithVerification,n);yield co(yi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*Xp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,dp);try{yield co(yi.setLoginState({loading:!0})),yield fo(gy.auth.verifyChangePhoneNumber,n),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*Zp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,yp);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(gy.auth.passwordlessPreLogin,C({},n,{type:Nr.SmsCode}));yield co(yi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*eg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,fp);try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));const o=yield fo(gy.auth.passwordlessPreLogin,n),a=Op[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield co(yi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield co(yi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*tg(){const{publicAuthStrategyPolicy:e}=yield So((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===ey.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield fo(Ny,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield fo(gy.auth.getWebAuthnDevices);return yield co(yi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ng(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,pp);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(gy.auth.passwordlessPostLogin,i),a=da.onRedirectTo,{routes:r}=yield So((e=>e.auth));if(Rp(e)){const t=yield Mp(e);yield co(yi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield So((e=>e.auth)),s=yield fo(gy.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:ff.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield co(yi.setState({user:s})),yield co(yi.setLoginState({error:void 0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1})),i.flow===It.Login?(yield fo(tg))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield co(yi.setState({isAuthenticated:!0})),yield wp()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield co(yi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*ig({payload:e}){try{yield co(yi.setLoginState({loading:!0}));const{name:t}=yield fo(gy.auth.verifyInviteToken,e);yield co(yi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield co(yi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*og({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield So((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield fo(gy.auth.preLoginV2,{email:e});if(a){let e=a;if(r===hy.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield So((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield co(yi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield ag({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield ag({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*ag(e){let{callback:t}=e,n=Ii(e,gp);const i=yield So((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Nr.EmailAndPassword?(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[Nr.MagicLink,Nr.Code,Nr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield co(yi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*rg({payload:{callback:e}}){try{yield co(yi.setLoginState({loading:!0}));const{options:t}=yield fo(gy.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield co(yi.setLoginState({error:t.message})),null==e||e(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*sg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Sp);try{yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?ty.Platform:ty.CrossPlatform;yield fo(gy.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*lg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,vp);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const{options:e}=yield fo(gy.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield co(yi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*cg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,hp);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield fo(gy.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Rp(o)){const e=da.onRedirectTo,{routes:t}=yield So((e=>e.auth)),n=yield Mp(o);yield co(yi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield fo(gy.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield co(yi.loadTenants()),yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.setLoginState({error:void 0})),yield wp(),null==t||t(!0)}}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*ug({payload:e}){const{onRedirectTo:t,routes:n}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));try{const t=yield fo(gy.auth.postLogin,e);da.setAccessToken(t.accessToken),da.setUser(t),yield co(yi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield wp()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield co(yi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*dg({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield co(yi.setLoginState({loading:!0}));try{const a=yield fo(gy.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});da.setAccessToken(a.accessToken),da.setUser(a);const r=da.onRedirectTo,{routes:s}=yield So((e=>e.auth));if(Rp(a)){const e=yield Mp(a);yield co(yi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield So((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield co(yi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield co(yi.loadTenants()),n&&t.flow===It.Login&&((yield fo(tg))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield wp())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){da.setAccessToken(null),da.setUser(null),null==o||o(!1,t),yield co(yi.setLoginState({email:e,error:t.message,loading:!1}))}}function*yg({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield fo(gy.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield So((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield co(yi.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield co(yi.loadTenants()),yield co(yi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield fo(tg))?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield wp()),null==i||i(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*fg({payload:e}){yield co(yi.setLoginState({loading:!0}));try{var t;yield fo(gy.auth.recoverMfaToken,e),yield co(yi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield co(yi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*pg({payload:e}){const{hostedLoginBox:t}=yield So((e=>e.auth));yield co(yi.setState({isLoading:!0}));try{t?yield fo(gy.auth.OAuthLogout):yield fo(gy.auth.logout)}catch{}yield co(yi.resetState()),yield co(yi.requestAuthorize(!0)),null==e||e()}function*gg({payload:e}){var t;try{yield fo(gy.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*Sg({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(n)),yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*vg({user:e,tenants:t}){const{loginState:n}=yield So((e=>e.auth));yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield So((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield fo(tg);i===an.smsVerifyCode&&e?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield wp()}yield co(yi.setState({isAuthenticated:!0}))}function*hg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,mp);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(gy.auth.preEnrollMFASMSForLogin,n);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*mg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,bp);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(gy.auth.enrollMFASMSForLogin,n),i=yield fo(gy.auth.generateLoginResponseV2,e);yield Sg(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*bg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ap);yield co(yi.setLoginState({loading:!0}));try{var i;const e=yield fo(gy.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ag(e){let{payload:{callback:t}}=e,n=Ii(e.payload,kp);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield fo(gy.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield fo(gy.auth.generateLoginResponseV2,i);yield Sg(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*kg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Tp);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(gy.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield fo(gy.auth.generateLoginResponseV2,e);yield Sg(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tg(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Pp);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(gy.auth.preVerifyMFASMSForLogin,n,i);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pg(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Ip);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(gy.auth.verifyMFASMSForLogin,n,i),o=yield fo(gy.auth.generateLoginResponseV2,e);yield vg(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ig(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Lp);yield co(yi.setLoginState({loading:!0}));try{var o;const e=yield fo(gy.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lg(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Ep);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield fo(gy.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield fo(gy.auth.generateLoginResponseV2,o);yield vg(a),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Eg(){yield ua(yi.requestAuthorize,Bp),yield ua(yi.requestAuthorizeSSR,qp),yield ua(yi.requestHostedLoginAuthorize,Hp),yield ua(yi.handleHostedLoginCallback,Yp),yield ua(yi.preLogin,og),yield ua(yi.postLogin,ug),yield ua(yi.login,dg),yield ua(yi.logout,pg),yield ua(yi.silentLogout,gg),yield ua(yi.loginWithMfa,yg),yield ua(yi.recoverMfa,fg),yield ua(yi.quickSmsPasswordlessPreLogin,Zp),yield ua(yi.changePhoneNumberWithVerification,Qp),yield ua(yi.verifyChangePhoneNumber,Xp),yield ua(yi.passwordlessPreLogin,eg),yield ua(yi.passwordlessPostLogin,ng),yield ua(yi.verifyInviteToken,ig),yield ua(yi.webAuthnPrelogin,lg),yield ua(yi.webAuthnPostLogin,cg),yield ua(yi.webAuthnCreateNewDeviceSession,rg),yield ua(yi.webAuthnVerifyNewDeviceSession,sg),yield ua(yi.afterAuthNavigation,wp),yield ua(yi.getUserIP,Wp),yield ua(yi.preEnrollMFASMSForLogin,hg),yield ua(yi.enrollMFASMSForLogin,mg),yield ua(yi.preEnrollMFAWebAuthnForLogin,bg),yield ua(yi.enrollMFAWebAuthnForLogin,Ag),yield ua(yi.enrollMFAAuthenticatorAppForLogin,kg),yield ua(yi.preVerifyMFASMSForLogin,Tg),yield ua(yi.verifyMFASMSForLogin,Pg),yield ua(yi.preVerifyMFAWebAuthnForLogin,Ig),yield ua(yi.verifyMFAWebAuthnForLogin,Lg)}function*Og({payload:e}){e&&(yield co(yi.setState({isLoading:!0})));const t=Vy;yield co(yi.loadTenants()),yield co(yi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*wg({payload:{callback:e}}){try{const{ip:t}=cf[0];yield co(yi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Cg(){yield ua(yi.requestAuthorize,Og),yield ua(yi.afterAuthNavigation,wp),yield ua(yi.getUserIP,wg)}const Dg=["callback","samlVendor"],Rg=["callback","samlVendor"];function*Ug(){try{var e,t;yield co(yi.setSSOState({loading:!0}));const n=yield fo(gy.auth.getSamlConfiguration),i=yield fo(gy.auth.getOidcConfiguration),o=yield fo(gy.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield co(yi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSSOState({error:e.message,loading:!1}))}}function*_g({payload:e}){const t=yield So((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield co(yi.setSSOState({error:void 0,[n]:!0}));try{const i=yield My(e[0]),o=yield fo(gy.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield co(yi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield co(yi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Mg({payload:e}){const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield co(yi.setSSOState({error:void 0,[o]:!0}));try{const e=yield My(t),a=yield fo(gy.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield co(yi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Ng({payload:e}){const{callback:t,samlVendor:n}=e,i=Ii(e,Dg),o=yield So((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},o,a)})));if(yield co(yi.setSSOState({error:void 0,[r]:!0})),e.type===hy.Saml){var s,l;const e=yield fo(gy.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Ry(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield fo(gy.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Fg({payload:{callback:e}={}}){const t=yield So((e=>e.auth.ssoState.samlConfiguration));try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(gy.auth.validateSamlDomain),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*$g(){try{const e=yield fo(gy.auth.getSamlRoles),t=yield fo(gy.auth.getSamlRolesGroups);yield co(yi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield co(yi.setSSOState({error:e.message}))}}function*Gg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(gy.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield uo(e.map((e=>fo(gy.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield co(yi.setSSOState({error:e.message}))}}(n)),yield $g(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*xg({payload:{callback:e,id:t}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(gy.auth.deleteSamlGroup,{id:t}),yield $g(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Vg({payload:{group:e,roleIds:t,callback:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(gy.auth.createSamlGroup,{group:e,roleIds:t}),yield $g(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*jg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield co(yi.setSSOState({loading:!0})),yield fo(gy.auth.oidcPostLoginV2,t),yield fo(Fp),yield co(yi.setSSOState({loading:!1}))}catch(e){var n;yield co(yi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Wg(){yield la(yi.loadSSOConfigurations,Ug),yield la(yi.saveSSOConfigurations,Ng),yield la(yi.saveSSOConfigurationsFile,_g),yield la(yi.saveSSOConfigurationsFileWithCallback,Mg),yield la(yi.validateSSODomain,Fg),yield la(yi.loadSSOAuthorizationRoles,$g),yield la(yi.updateSSOAuthorizationRoles,Gg),yield la(yi.deleteSamlGroup,xg),yield la(yi.createSamlGroup,Vg),yield la(yi.oidcPostlogin,jg)}function*Kg(){yield co(yi.setSSOState({loading:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:Hy,loading:!1,firstLoad:!1}))}function*Bg({payload:e}){const t="saving";yield co(yi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield So((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield co(yi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*zg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ii(e,Rg),r=Qy.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},r,s)})));yield co(yi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==Jy||null==(t=Jy.configuration)?void 0:t.acsUrl,s.spEntityId=null==Jy||null==(n=Jy.configuration)?void 0:n.spEntityId;const c=Ry(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield mt(),yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*qg({payload:{callback:e}={}}){const t=Qy.samlConfiguration;yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Hg(){yield mt(),yield co(yi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Jg({payload:{callback:e,authorizationRoles:t}}){yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Yg(){yield la(yi.loadSSOConfigurations,Kg),yield la(yi.saveSSOConfigurations,zg),yield la(yi.saveSSOConfigurationsFile,Bg),yield la(yi.validateSSODomain,qg),yield la(yi.loadSSOAuthorizationRoles,Hg),yield la(yi.updateSSOAuthorizationRoles,Jg)}const Qg=["callback"],Xg=["callback","ssoConfigId"],Zg=["callback","ssoConfigId"],eS=["callback","ssoConfigId"];function*tS(){try{return yield fo(gy.auth.getOidcConfiguration)}catch(e){return null}}function*nS(){try{return yield fo(gy.metadata.getSamlMetadata)}catch(e){return null}}function*iS(){try{yield co(yi.setSSOLoader({key:vy.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield uo([fo(tS),fo(nS)]),n=yield fo(gy.auth.getSSOConfigurations);yield co(yi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield co(yi.setSSOError({key:vy.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield co(yi.setSSOLoader({key:vy.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*oS({payload:e}){yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ii(e,Qg),i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield fo(gy.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield co(yi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:vy.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION,value:!1}))}}function*aS({payload:e}){yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield My(t),o=yield fo(gy.auth.createSSOConfigurationByMetadata,{metadata:e});yield co(yi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield co(yi.setSSOError({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*rS({payload:e}){yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,Xg),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(gy.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:vy.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*sS({payload:e}){yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield My(i),a=yield fo(gy.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield co(yi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield co(yi.setSSOError({key:vy.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*lS({payload:e}){yield co(yi.setSSOLoader({key:vy.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(gy.auth.deleteSSOConfiguration,t),yield co(yi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:vy.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:vy.DELETE_SSO_CONFIGURATION,value:!1}))}}function*cS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ii(e,Zg);yield co(yi.setSSOLoader({key:vy.SAVE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(gy.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:vy.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_DOMAIN,value:!1}))}}function*uS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield co(yi.setSSOLoader({key:vy.DELETE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(gy.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:vy.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:vy.DELETE_SSO_DOMAIN,value:!1}))}}function*dS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield co(yi.setSSOLoader({key:vy.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(gy.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield co(yi.setSSOError({key:vy.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.VALIDATE_SSO_DOMAIN,value:!1}))}}function*yS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(gy.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield co(yi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield co(yi.setSSOError({key:vy.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield co(yi.setSSOLoader({key:vy.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*fS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield co(yi.setSSOLoader({key:vy.SAVE_SSO_GROUPS,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield uo(t.map((e=>fo(gy.auth.deleteSSOGroup,n,e)))),yield uo(e.map((e=>fo(gy.auth.createSSOGroup,n,e))));const a=yield fo(gy.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield co(yi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:vy.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_GROUPS,value:!1}))}}function*pS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield uo(t.map((t=>fo(gy.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:vy.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_GROUPS,value:!1}))}}function*gS({payload:e}){yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield fo(Sa,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield fo(gy.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield fo(gy.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield co(yi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*SS({payload:e}){yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,eS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield fo(gy.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield fo(gy.auth.createSSOConfiguration,i),a=[e,...o]),yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:vy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*vS(){yield la(yi.loadSSOConfigurationsV2,iS),yield la(yi.saveSSOConfigurationV2,oS),yield la(yi.saveSSODomain,cS),yield la(yi.deleteSSODomain,uS),yield la(yi.validateSSODomainV2,dS),yield la(yi.updateSSOConfiguration,rS),yield la(yi.deleteSSOConfiguration,lS),yield la(yi.setSSOGroups,fS),yield la(yi.updateSSOGroups,pS),yield la(yi.setSSODefaultRoles,yS),yield la(yi.saveSSOConfigurationByMetadata,aS),yield la(yi.updateSSOConfigurationByMetadata,sS),yield la(yi.saveSSOConfigurationByUrl,gS),yield la(yi.saveSSOConfigurationByData,SS)}const hS=["callback","profilePictureUrl"],mS=["callback","profilePictureUrl"];function*bS(){yield co(yi.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return fo.apply(void 0,[sa,e,t,n].concat(o))}(3,2e3,gy.teams.getProfile),t=yield So((e=>e.auth.user));yi.setUser(C({},t,e)),yield co(yi.setProfileState({profile:e,loading:!1}))}catch(e){yield co(yi.setProfileState({loading:!1,error:e.message}))}}function*AS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,hS);yield co(yi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield So((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield fo(gy.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield fo(gy.teams.updateProfile,a),s=yield So((e=>e.auth.user));yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield co(yi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*kS({payload:e}){yield co(yi.setProfileState({loading:!0}));try{var t;yield fo(gy.teams.changePassword,e),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*TS(){yield ua(yi.loadProfile,bS),yield la(yi.saveProfile,AS),yield la(yi.changePassword,kS)}function*PS(){yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setUser(C({},Vy,xy))),yield co(yi.setProfileState({loading:!1,profile:xy}))}function*IS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,mS);yield co(yi.setProfileState({saving:!0,error:null}));const o=jy;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},o.profile,i,{profilePictureUrl:a}),s=Vy;yield mt(),yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*LS({payload:e}){var t;yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*ES(){yield ua(yi.loadProfile,PS),yield la(yi.saveProfile,IS),yield la(yi.changePassword,LS)}const OS=["callback"],wS=["callback"],CS=["callback"],DS=["deviceId","callback"],RS=["deviceId","callback"],US=["callback"],_S=["deviceId"],MS=["deviceId"],NS=["callback"],FS=["deviceId"],$S=["callback"];function*GS(e){const{step:t}=yield So((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*xS(){yield co(yi.setMfaState({saving:!0}));try{const{qrCode:e}=yield fo(gy.auth.enrollMfa);yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message}))}}function*VS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,OS);yield co(yi.setMfaState({saving:!0}));try{const e=yield So((e=>e.auth.user)),i=yield fo(gy.auth.verifyMfa,n),o=yield fo(gy.auth.getMFADevices),a=yield GS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),yield co(yi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*jS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,wS);yield co(yi.setMfaState({loading:!0}));try{const e=yield fo(gy.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setState({user:e})),yield co(yi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*WS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;yield fo(gy.auth.disableMfa,e);const n=yield fo(gy.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*KS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t,n;const i=yield fo(gy.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*BS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,CS);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield fo(gy.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield fo(gy.auth.getMFADevices),a=yield GS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zS(e){let{payload:{deviceId:t,callback:n}}=e;Ii(e.payload,DS),yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(gy.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*qS(e){let{payload:{deviceId:t,callback:n}}=e,i=Ii(e.payload,RS);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield fo(gy.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield fo(gy.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*HS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;const n=yield fo(gy.auth.preEnrollMFASMS,e);yield co(yi.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 co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*JS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,US);yield co(yi.setMfaState({saving:!0}));try{const e=yield fo(gy.auth.enrollMFASMS,n),i=yield fo(gy.auth.getMFADevices),o=yield GS(e);yield co(yi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*YS(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,_S);yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(gy.auth.preDisableMFASMS,t);yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*QS(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,MS);yield co(yi.setMfaState({saving:!0}));try{var i;yield fo(gy.auth.disableMFASMS,t,n);const e=yield fo(gy.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*XS(){yield co(yi.setMfaState({loading:!0}));try{yield So((e=>e.auth.user));const e=yield fo(gy.auth.getMFADevices);yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*ZS(){yield co(yi.setMfaState({loading:!0}));try{const e=(yield fo(gy.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield co(yi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*ev(){yield la(yi.enrollMfa,xS),yield la(yi.getMFADevices,XS),yield la(yi.getMFAStrategies,ZS),yield la(yi.verifyMfa,VS),yield la(yi.disableMfa,WS),yield la(yi.verifyMfaAfterForce,jS),yield la(yi.preDisableMfaSms,YS),yield la(yi.disableMfaSms,QS),yield la(yi.preEnrollMfaSms,HS),yield la(yi.enrollMfaSms,JS),yield la(yi.preEnrollMfaWebAuthn,KS),yield la(yi.enrollMfaWebAuthn,BS),yield la(yi.preDisableMfaWebAuthn,zS),yield la(yi.disableMfaWebAuthn,qS)}function*tv(){yield co(yi.setMfaState({saving:!0})),yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*nv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setUser(C({},Vy,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*iv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,NS);yield co(yi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield mt(),yield co(yi.setUser(C({},Vy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*ov({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield co(yi.setUser(C({},Vy))),null==(t=e.callback)||t.call(e,!0)}function*av(e){let{}=e,t=Ii(e.payload,FS);yield co(yi.setMfaState({saving:!0}));try{var n;yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*rv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield co(yi.setUser(C({},Vy))),null==(t=e.callback)||t.call(e,!0)}function*sv({payload:e}){var t;yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*lv(e){let{payload:{callback:t}}=e;Ii(e.payload,$S);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield co(yi.setUser(C({},Vy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*cv(){yield la(yi.enrollMfa,tv),yield la(yi.verifyMfa,nv),yield la(yi.disableMfa,ov),yield la(yi.verifyMfaAfterForce,iv),yield la(yi.preDisableMfaSms,av),yield la(yi.disableMfaSms,rv),yield la(yi.preEnrollMfaSms,sv),yield la(yi.enrollMfaSms,lv)}const uv=["callback"];function*dv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{var t;yield fo(gy.auth.forgotPassword,e),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*yv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,uv);yield co(yi.setForgotPasswordState({loading:!0}));try{yield fo(gy.auth.resetPassword,n),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Kt.success})),null==t||t(!0)}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*fv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{const t=yield fo(gy.auth.loadPasswordConfig,e);yield co(yi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message}))}}function*pv(){yield ua(yi.forgotPassword,dv),yield ua(yi.resetPassword,yv),yield ua(yi.loadPasswordConfig,fv)}let gv;!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"}(gv||(gv={}));const Sv=["callback","events"],vv=["callback"],hv=["callback"];function*mv({payload:{userId:e,token:t}}){yield co(yi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield So((e=>e.auth));n&&(yield co(yi.silentLogout()));const i=yield fo(gy.auth.getActivateAccountStrategy,{userId:e,token:t});yield co(yi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield co(yi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*bv(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,Sv);yield co(yi.setActivateState({loading:!0}));try{const e=da.onRedirectTo,{routes:a}=yield So((e=>e.auth)),r=yield fo(gy.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Rp(r)){yield co(yi.setActivateState({step:Nt.success}));const t=yield Mp(r);yield co(yi.setState(t)),yield vo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield co(yi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield fo(gy.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:ff.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield co(yi.setTenantsState({tenants:t,loading:!1})),yield co(yi.setState({user:e,isAuthenticated:!0})),yield vo(1e3),yield wp(),yield co(yi.resetActivateState())}null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Av({payload:e}){const{callback:t}=e,n=Ii(e,vv);yield co(yi.setActivateStrategyState({loading:!0}));try{const e=yield fo(gy.auth.getActivateAccountStrategy,n);yield co(yi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield co(yi.setActivateStrategyState({loading:!1,error:e.message}))}}function*kv({payload:e}){const{callback:t}=e,n=Ii(e,hv);yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:n.email})),yield co(yi.setActivateState({loading:!0}));try{yield fo(gy.auth.resendActivationEmail,n),yield co(yi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message})),yield co(yi.setTeamError({key:gv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:!1}))}function*Tv(){yield ua(yi.activateAccount,bv),yield ua(yi.preActivateAccount,mv),yield ua(yi.getActivateAccountStrategy,Av),yield ua(yi.resendActivationEmail,kv)}function*Pv({payload:e}){if(e.token&&e.userId)try{yield co(yi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield fo(gy.auth.acceptInvitation,e),yield co(yi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield co(yi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield co(yi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*Iv(){yield ua(yi.acceptInvitation,Pv)}var Lv,Ev=new Uint8Array(16);function Ov(){if(!Lv&&!(Lv="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 Lv(Ev)}for(var wv=/^(?:[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,Cv=function(e){return"string"==typeof e&&wv.test(e)},Dv=[],Rv=0;Rv<256;++Rv)Dv.push((Rv+256).toString(16).substr(1));var Uv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Ov)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Dv[e[t+0]]+Dv[e[t+1]]+Dv[e[t+2]]+Dv[e[t+3]]+"-"+Dv[e[t+4]]+Dv[e[t+5]]+"-"+Dv[e[t+6]]+Dv[e[t+7]]+"-"+Dv[e[t+8]]+Dv[e[t+9]]+"-"+Dv[e[t+10]]+Dv[e[t+11]]+Dv[e[t+12]]+Dv[e[t+13]]+Dv[e[t+14]]+Dv[e[t+15]]).toLowerCase();if(!Cv(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let _v,Mv;!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"}(_v||(_v={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Mv||(Mv={}));const Nv=["callback"],Fv=["roles"],$v=["callback"],Gv=["callback","profileImage"],xv=["callback"],Vv=["callback","userId"],jv=["callback"],Wv=["callback"],Kv=["callback"],Bv=["callback"],zv=["callback"],qv=["callback"],Hv=["callback"],Jv=["callback","profileImage"],Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback"],eh=["callback"],th=["callback"],nh=()=>So((e=>e.auth.teamState));function*ih(){try{const{groups:e}=yield fo(gy.groups.getGroups,{_groupsRelations:Mv.roles});return e}catch(e){return[]}}function*oh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield nh(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield co(yi.setTeamLoader({key:gv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield uo([fo(gy.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),fo(gy.teams.loadAvailableRoles),fo(gy.teams.loadAvailablePermissions),fo(ih)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield co(yi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield co(yi.setTeamError({key:gv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield co(yi.setTeamLoader({key:gv.USERS,value:!1}))}function*ah({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield nh(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield co(yi.setTeamLoader({key:gv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield uo([fo(gy.subTenants.loadAllUsers,C({},c)),fo(gy.teams.loadAvailableRoles),fo(gy.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield co(yi.setTeamError({key:gv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield co(yi.setTeamLoader({key:gv.USERS,value:!1}))}function*rh({payload:e}){yield co(yi.setTeamLoader({key:gv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield uo([fo(gy.teams.loadAvailableRoles),fo(gy.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield co(yi.setTeamError({key:gv.ROLES_AND_PERMISSIONS,value:t.message}))}yield co(yi.setTeamLoader({key:gv.ROLES_AND_PERMISSIONS,value:!0}))}function*sh({payload:e}){const{callback:t}=e,n=Ii(e,Nv),i=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield fo(gy.teams.addUser,n),{roles:a}=e,r=C({},Ii(e,Fv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield co(yi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*lh({payload:e}){const{callback:t}=e,n=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield co(yi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield fo(gy.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield co(yi.loadUsers(r)),yield co(yi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*ch({payload:e}){const{callback:t}=e,n=Ii(e,$v),i=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield fo(gy.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield fo(gy.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield co(yi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*uh({payload:e}){const{callback:t}=e,n=Ii(e,Gv),{id:i}=n,o=yield nh(),a=o.users.find((e=>e.id===n.id));yield co(yi.setTeamLoader({key:gv.UPDATE_USER,value:i||""})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield fo(gy.teams.updateUser,n);null==t||t(e),yield co(yi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield co(yi.setTeamLoader({key:gv.UPDATE_USER,value:!1}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield co(yi.setTeamLoader({key:gv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*dh({payload:e}){const{callback:t}=e,n=Ii(e,xv),i=yield nh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(gy.teams.deleteUser,n),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yh({payload:e}){const{callback:t,userId:n}=e,i=Ii(e,Vv),o=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield fo(gy.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield co(yi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*fh({payload:e}){const{callback:t}=e,n=Ii(e,jv),i=yield nh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(gy.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*ph({payload:e}){const{callback:t}=e,n=Ii(e,Wv);yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield fo(gy.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:gv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:!1}))}function*gh({payload:e}){const{callback:t}=e,n=Ii(e,Kv);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(gy.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:gv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*Sh({payload:e}){const{callback:t}=e,n=Ii(e,Bv);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(gy.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:gv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*vh({payload:e}){const{callback:t}=e,n=Ii(e,zv);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(gy.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:gv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*hh(){yield co(yi.setTeamError({key:gv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield fo(gy.teams.getInviteLinkConfiguration);yield co(yi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield co(yi.setTeamError({key:gv.CONFIG_TOKEN_LINK,value:e.message}))}}function*mh(){yield co(yi.setTeamError({key:gv.GET_TOKEN_LINK,value:!1}));try{yield fo(hh);const e=yield fo(gy.teams.getInviteUserLink),{inviteTokenState:t}=yield nh();yield co(yi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield co(yi.setTeamError({key:gv.GET_TOKEN_LINK,value:e.message}))}}function*bh({payload:{callback:e}}){yield co(yi.setTeamError({key:gv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield nh();try{const n=yield fo(gy.teams.createInviteUserLink,{expiresInMinutes:43200});yield co(yi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:gv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ah({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield nh();yield co(yi.setTeamError({key:gv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield fo(gy.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield co(yi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:gv.UPDATE_TOKEN_LINK,value:t.message}))}}function*kh({payload:e}){const{callback:t}=null!=e?e:{};yield co(yi.setTeamError({key:gv.DELETE_TOKEN_LINK,value:!1}));try{yield fo(gy.teams.deleteInviteUserLink),yield co(yi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:gv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Th({payload:e}){yield co(yi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Ph({payload:e}){const t=yield nh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Ih({payload:e}){yield co(yi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Lh({payload:e}){const t=yield nh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Eh(){yield ca(yi.loadUsers,oh),yield ca(yi.loadAllSubTenantsUsers,ah),yield ca(yi.loadRoles,rh),yield la(yi.addUser,sh),yield la(yi.addUsersBulk,lh),yield la(yi.addUserToSubTenants,ch),yield la(yi.updateUser,uh),yield la(yi.setUserRolesForSubTenants,yh),yield la(yi.deleteUser,dh),yield la(yi.deleteUserFromSubTenants,fh),yield la(yi.resendActivationLink,ph),yield la(yi.resendInvitationLink,gh),yield la(yi.resendInvitationEmail,Sh),yield la(yi.resendInvitationLinkToAllSubTenants,vh),yield la(yi.getInvitationLink,mh),yield la(yi.createInvitationLink,bh),yield la(yi.updateInvitationLink,Ah),yield la(yi.deleteInvitationLink,kh),yield la(yi.openAddUserDialog,Th),yield la(yi.closeAddUserDialog,Ph),yield la(yi.openDeleteUserDialog,Ih),yield la(yi.closeDeleteUserDialog,Lh)}function*Oh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield nh(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield co(yi.setTeamLoader({key:gv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield co(yi.setTeamState({users:nf,totalPages:2,totalItems:10,roles:Yy,permissions:Xy})),yield co(yi.setTeamLoader({key:gv.USERS,value:!1})),null==r||r(nf)}function*wh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield nh(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield co(yi.setTeamLoader({key:gv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield co(yi.setTeamState({allUsers:of,totalPages:2,totalItems:10,roles:Yy,permissions:Xy})),yield co(yi.setTeamLoader({key:gv.USERS,value:!1})),null==s||s(of)}function*Ch({payload:e}){var t;yield co(yi.setTeamLoader({key:gv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield co(yi.setTeamState({roles:Yy,permissions:Xy})),yield co(yi.setTeamLoader({key:gv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Yy,permissions:Xy})}function*Dh({payload:e}){const{callback:t}=e,n=Ii(e,qv),i=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},ef,{groups:[]},n,{id:`${Uv()}`});null==t||t(o),yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Rh({payload:e}){const{callback:t}=e,n=Ii(e,Hv),i=yield nh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},ef,n,{id:`${Uv()}`});yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Uh({payload:e}){var t;const{callback:n}=e,i=Ii(e,Jv),{id:o}=i,a=yield nh(),r=a.users.find((e=>e.id===i.id));yield co(yi.setTeamLoader({key:gv.UPDATE_USER,value:o||""})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield co(yi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield co(yi.setTeamLoader({key:gv.UPDATE_USER,value:!1}))}function*_h({payload:e}){const{callback:t}=e,n=Ii(e,Yv),i=yield nh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Mh({payload:e}){const{callback:t}=e,n=Ii(e,Qv),i=yield nh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Nh({payload:e}){const{callback:t}=e,n=Ii(e,Xv);yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:gv.RESEND_ACTIVATE_LINK,value:!1}))}function*Fh({payload:e}){const{callback:t}=e,n=Ii(e,Zv);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*$h({payload:e}){const{callback:t}=e,n=Ii(e,eh);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*Gh({payload:e}){const{callback:t}=e,n=Ii(e,th);yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:gv.RESEND_INVITATION_LINK,value:!1}))}function*xh(){yield ca(yi.loadUsers,Oh),yield ca(yi.loadAllSubTenantsUsers,wh),yield ca(yi.loadRoles,Ch),yield la(yi.addUser,Dh),yield la(yi.addUserToSubTenants,Rh),yield la(yi.updateUser,Uh),yield la(yi.deleteUser,_h),yield la(yi.deleteUserFromSubTenants,Mh),yield la(yi.resendActivationLink,Nh),yield la(yi.resendInvitationLink,Fh),yield la(yi.resendInvitationEmail,$h),yield la(yi.resendInvitationLinkToAllSubTenants,Gh),yield la(yi.openAddUserDialog,Th),yield la(yi.closeAddUserDialog,Ph),yield la(yi.openDeleteUserDialog,Ih),yield la(yi.closeDeleteUserDialog,Lh)}const Vh=["authorizationUrl"],jh=["events","url"];function*Wh(){try{yield co(yi.setSocialLoginsState({loading:!0}));const e=yield fo(gy.auth.getSocialLoginProviders);yield co(yi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Kh(){try{const e=yield So((e=>e.root.context));yield co(yi.setSocialLoginsState({loading:!0}));const t=yield fo(gy.auth.getSocialLoginProvidersV2),{providers:n}=yield fo(gy.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ii(t,Vh);const o=pa(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield co(yi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Bh(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,jh);try{yield co(yi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield fo(gy.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:pf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:ff.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield co(yi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(Gp):yield fo(Vp)}(),localStorage.removeItem("register-quick-login"),yield co(yi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield co(yi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*zh({payload:e}){yield co(yi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*qh(){yield ua(yi.loadSocialLoginsConfiguration,Wh),yield ua(yi.loadSocialLoginsConfigurationV2,Kh),yield ua(yi.loginViaSocialLogin,Bh),yield ca(yi.setSocialLoginError,zh)}let Hh;function*Jh({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield So((e=>e.auth.apiTokensState));try{let e,a;yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield fo(gy.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield fo(gy.auth.updateUserApiTokensData,{description:t}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield co(yi.setApiTokensError({key:Hh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Yh({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield So((e=>e.auth.apiTokensState));try{let e,r;yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield fo(gy.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield fo(gy.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield co(yi.setApiTokensError({key:Hh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*Qh({payload:e}){const{apiTokensDataUser:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!0})),n?(yield fo(gy.auth.deleteUserAccessToken,{id:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield fo(gy.auth.deleteUserApiToken,{tokenId:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Hh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!1}))}}function*Xh({payload:e}){const{apiTokensDataTenant:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!0})),n?(yield fo(gy.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield fo(gy.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield co(yi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Hh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!1}))}}function*Zh({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield uo([fo(gy.auth.getUserApiTokensData),fo(gy.auth.getTenantApiTokensData)]);yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setApiTokensError({key:Hh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*em({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(gy.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=fo(gy.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Hh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*tm({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(gy.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=fo(gy.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Hh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*nm(){yield ua(yi.loadApiTokens,Zh),yield ua(yi.loadUserApiTokens,em),yield ua(yi.loadTenantApiTokens,tm),yield la(yi.addUserApiToken,Jh),yield la(yi.addTenantApiToken,Yh),yield ca(yi.deleteTenantApiToken,Xh),yield ca(yi.deleteUserApiToken,Qh)}function*im({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield So((e=>e.auth.apiTokensState)),a=C({},$y,{description:t,roleIds:n,clientId:`CLIENT_ID_${Uv()}`});yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield vo(200),yield co(yi.setApiTokensLoader({key:Hh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*om({payload:e}){yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!0})),yield vo(200);const t=[$y];yield co(yi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield co(yi.setApiTokensLoader({key:Hh.DELETE_API_TOKEN,value:!1}))}function*am({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));const n=[Fy],i=[$y];yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield vo(200),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*rm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));const n=[Fy];yield co(yi.setApiTokensState({apiTokensDataUser:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*sm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!0})));const n=[$y];yield co(yi.setApiTokensState({apiTokensDataTenant:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Hh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*lm(){yield ua(yi.loadApiTokens,am),yield ua(yi.loadUserApiTokens,rm),yield ua(yi.loadTenantApiTokens,sm),yield la(yi.addTenantApiToken,im),yield ca(yi.deleteTenantApiToken,om)}function*cm({payload:e}){try{var t;yield co(yi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield fo(gy.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield co(yi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*um({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield fo(gy.accountSettings.getSettings);yield co(yi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield co(yi.setAccountSettingsState({loading:!1,error:e.message}))}}function*dm(){yield ua(yi.saveAccountSettings,cm),yield ua(yi.loadAccountSettings,um)}function*ym({payload:e}){var t;yield co(yi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*fm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield co(yi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*pm(){yield ua(yi.saveAccountSettings,ym),yield ua(yi.loadAccountSettings,fm)}function*gm({payload:{tenantId:e,callback:t}}){yield co(yi.setState({isLoading:!0}));try{yield fo(gy.tenants.switchTenant,{tenantId:e}),yield fo(Fp),(null==t?void 0:t(!0))||(yield co(yi.setState({isLoading:!1})))}catch(e){yield co(yi.setState({isLoading:!1})),null==t||t(!1,e)}}function*Sm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(gy.tenants.getTenants);yield co(yi.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield co(yi.setTenantsState({loading:!1}))}}function*vm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(gy.tenants.getSubTenants);yield co(yi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*hm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(gy.tenants.getSubTenantsAsTree);yield co(yi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*mm(){yield la(yi.loadTenants,Sm),yield la(yi.loadSubTenants,vm),yield la(yi.switchTenant,gm),yield la(yi.loadSubTenantsTree,hm)}function*bm(){yield co(yi.setTenantsState({loading:!0})),yield mt(),yield co(yi.setTenantsState({tenants:af,loading:!1}))}function*Am(){yield la(yi.loadTenants,bm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Hh||(Hh={}));const km=["callback"],Tm=["callback"],Pm=["callback"],Im=["callback"],Lm=["callback"];function*Em({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield uo([fo(gy.roles.getRoles),fo(gy.roles.getPermissions),fo(gy.roles.getPermissionCategories)]),[t,n,i]=e;yield co(yi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Om(e){let{payload:{callback:t}}=e,n=Ii(e.payload,km);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(gy.roles.addRole,n),i=yield fo(gy.roles.getRoles);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*wm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Tm);yield co(yi.setRolesState({saving:!0}));try{yield fo(gy.roles.deleteRole,n),yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Cm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Pm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(gy.roles.updateRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Dm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Im);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(gy.roles.attachPermissionsToRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Rm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(gy.roles.attachPermissionToRoles,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Um(){yield ua(yi.loadRolesAndPermissions,Em),yield la(yi.addRole,Om),yield la(yi.deleteRole,wm),yield la(yi.updateRole,Cm),yield la(yi.attachPermissionsToRole,Dm),yield la(yi.attachPermissionToRoles,Rm)}function*_m({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield co(yi.setRolesState({roles:Gy,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Mm(){yield ua(yi.loadRolesAndPermissions,_m)}const Nm=["callback"],Fm=["callback"],$m=["callback"];function*Gm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Nm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(gy.auth.resetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield co(yi.setLoginState({email:n.email}))}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*xm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Fm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(gy.auth.verifyResetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Vm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,$m);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield fo(gy.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield co(yi.setLoginState({step:Pt.loginWithSmsOtc})),yield co(yi.passwordlessPreLogin({type:Nr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield co(yi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*jm(){yield ua(yi.resetPhoneNumber,Gm),yield ua(yi.verifyResetPhoneNumber,xm),yield ua(yi.changePhoneNumber,Vm)}function*Wm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getCurrentUserSessions);yield co(yi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Km(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getCurrentUserSession);yield co(yi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Bm({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(gy.auth.deleteSessionForUser,e),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*zm({payload:{callback:e,userId:t}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(gy.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield co(yi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(gy.auth.deleteAllSessionsForUser),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Hm(){yield ca(yi.loadUserSessions,Wm),yield ca(yi.deleteUserSession,Bm),yield ca(yi.deleteAllUserSessions,qm),yield ca(yi.loadCurrentUserSession,Km),yield la(yi.revokeUserSessions,zm)}function*Jm(){yield co(yi.setSessionsState({loading:!0,error:null})),yield co(yi.setSessionsState({sessions:rf,loading:!1}))}function*Ym({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));const t=(yield So((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield co(yi.setSessionsState({sessions:t,loading:!1}))}function*Qm(){yield co(yi.setSessionsState({loading:!0,error:null}));const e=rf.filter((e=>e.current));yield co(yi.setSessionsState({sessions:e,loading:!1}))}function*Xm(){yield ca(yi.loadUserSessions,Jm),yield ca(yi.deleteUserSession,Ym),yield ca(yi.deleteAllUserSessions,Qm)}const Zm=["callback"],eb=["callback"];function*tb(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getSessionConfigurations);yield co(yi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*nb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ii(e,Zm);yield fo(gy.auth.createOrUpdateSessionConfigrations,n),yield co(yi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield co(yi.setSessionsPolicyState({error:e,loading:!1}))}}function*ib(){yield ua(yi.loadSessionsPolicy,tb),yield ca(yi.createOrUpdateSessionsPolicy,nb)}function*ob(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const e=yield So((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:sf}));yield co(yi.setSessionsPolicyState(C({},e,{loading:!1})))}function*ab({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ii(e,eb);null==t||t(!0),yield co(yi.setSessionsPolicyState({configurations:n,loading:!1}))}function*rb(){yield ua(yi.loadSessionsPolicy,ob),yield ca(yi.createOrUpdateSessionsPolicy,ab)}const sb=["callback"],lb=["callback"],cb=["callback"],ub=["callback"],db=["callback"],yb=["callback"],fb=["callback"],pb=["callback"],gb=()=>So((e=>e.auth.restrictionsState.ipRestrictions)),Sb=()=>So((e=>e.auth.restrictionsState.emailDomainRestrictions));function*vb(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield fo(gy.auth.getDomainRestrictionsConfig),t=(yield fo(gy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*hb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,sb);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Sb();try{var o;yield fo(gy.auth.createDomainRestriction,n);const e=(yield fo(gy.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,lb);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield fo(gy.auth.updateDomainRestrictionConfig,n),i=(yield fo(gy.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*bb({payload:{id:e}}){yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Sb();try{var n;yield fo(gy.auth.deleteDomainRestriction,e);const i=(yield fo(gy.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Ab=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*kb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield gb(),t=yield fo(gy.auth.getIPRestrictionsConfig),n=Ab({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield fo(gy.auth.getIPRestrictions,n);yield co(yi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Tb(){try{const{valid:e}=yield fo(gy.auth.testCurrentIpInAllowList);yield co(yi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message}))}}function*Pb({payload:{callback:e}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield So((e=>e.auth.userIp));yield uo([fo(gy.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),fo(gy.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield gb(),i=Ab(n.pagination),{items:o,_metadata:{totalPages:a}}=yield fo(gy.auth.getIPRestrictions,i);yield co(yi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Ib(e){let{payload:{callback:t}}=e,n=Ii(e.payload,cb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield gb();try{var o,a;yield fo(gy.auth.createIPRestriction,n);const e=yield gb(),r=Ab(e.pagination),{items:s,_metadata:{totalPages:l}}=yield fo(gy.auth.getIPRestrictions,r);yield Tb(),yield co(yi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Lb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,ub);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{yield fo(gy.auth.updateIPRestrictionConfig,n);const e=yield gb(),i=yield fo(gy.auth.getIPRestrictionsConfig),o=Ab(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield fo(gy.auth.getIPRestrictions,o);yield Tb(),yield co(yi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Eb({payload:{id:e,callback:t}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const n=yield gb();try{var i;yield fo(gy.auth.deleteIPRestriction,e);const o=yield gb(),a=Ab(o.pagination),{items:r,_metadata:{totalPages:s}}=yield fo(gy.auth.getIPRestrictions,a);yield Tb(),yield co(yi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ob(){yield ua(yi.loadIpRestrictions,kb),yield ua(yi.loadEmailDomainRestrictions,vb),yield la(yi.saveIpRestriction,Ib),yield la(yi.saveIpRestrictionsConfig,Lb),yield la(yi.deleteIpRestriction,Eb),yield la(yi.checkIfUserIpValid,Tb),yield la(yi.addCurrentUserIpAndActivate,Pb),yield la(yi.saveEmailDomainRestriction,hb),yield la(yi.saveEmailDomainRestrictionsConfig,mb),yield la(yi.deleteEmailDomainRestriction,bb)}function*wb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{restrictions:cf.filter((e=>e.strategy===lf.strategy)),config:lf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Cb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield gb(),t=cf[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield co(yi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Db(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,db);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const r=yield gb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield co(yi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:Uv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Rb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,yb);const r=yield gb();yield co(yi.setIpRestrictionsState({saving:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield co(yi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Ub({payload:{id:e,callback:t}}){var n;yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield gb();yield co(yi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*_b(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield co(yi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Mb(e){var t,n;let{payload:{callback:i}}=e,o=Ii(e.payload,fb);const a=yield Sb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*Nb(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,pb);const o=yield Sb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Fb({payload:{id:e}}){var t,n;const i=yield Sb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*$b(){yield ua(yi.loadIpRestrictions,wb),yield ua(yi.loadEmailDomainRestrictions,_b),yield la(yi.saveIpRestriction,Db),yield la(yi.saveIpRestrictionsConfig,Rb),yield la(yi.deleteIpRestriction,Ub),yield la(yi.checkIfUserIpValid,Cb),yield la(yi.saveEmailDomainRestriction,Mb),yield la(yi.saveEmailDomainRestrictionsConfig,Nb),yield la(yi.deleteEmailDomainRestriction,Fb)}const Gb=["callback"],xb=["id"];function*Vb(e){const{count:t}=yield fo(gy.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*jb(){yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(gy.directory.getConfigs),t=yield uo(e.map((e=>Vb(e))));yield co(yi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Wb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Gb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(gy.directory.createConfiguration,n),i=yield fo(gy.directory.getConfigs),o=yield uo(i.map((e=>Vb(e))));yield co(yi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Kb(e){let{payload:{id:t}}=e,n=Ii(e.payload,xb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(gy.directory.updateConfiguration,t,n);const e=yield fo(gy.directory.getConfigs),i=yield uo(e.map((e=>Vb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Bb({payload:{id:e,callback:t}}){yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(gy.directory.deleteConfiguration,e);const n=yield fo(gy.directory.getConfigs),i=yield uo(n.map((e=>Vb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*zb(){yield ua(yi.loadProvisionConnections,jb),yield la(yi.createProvisionConnection,Wb),yield la(yi.deleteProvisionConnection,Bb),yield la(yi.updateProvisionConnection,Kb)}const qb=["callback","events"];function*Hb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,qb);yield co(yi.setImpersonateState({loading:!0}));try{yield fo(gy.impersonate.impersonate,n),yield co(yi.setImpersonateState({step:ri.success})),yield vo(1e3),yield wp(),yield co(yi.resetImpersonateState()),null==t||t(!0)}catch(e){yield co(yi.setImpersonateState({loading:!1,error:e.message}))}}function*Jb(){yield ua(yi.impersonate,Hb)}function*Yb({payload:e}){const{callback:t,deviceId:n}=e;yield co(yi.setPasskeysState({loading:!0}));try{yield fo(gy.auth.deleteWebAuthnDevice,n);const{devices:e}=yield So((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield co(yi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*Qb(){yield co(yi.setPasskeysState({loading:!0}));try{const{devices:e}=yield fo(gy.auth.getWebAuthnDevices);yield co(yi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null}))}}function*Xb(){yield la(yi.loadWebAuthnDevices,Qb),yield la(yi.deleteWebAuthnDevice,Yb)}const Zb=["roleIds","userIds"],eA=()=>So((e=>e.auth.groupsState));function*tA({payload:e}){const t=_v.GET_TEAM_USERS;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield fo(gy.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield co(yi.setGroupsState({teamUsers:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*nA({payload:e}){const t=_v.GET_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield fo(gy.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Mv.rolesAndUsers});yield co(yi.setGroupsState({selectedGroup:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*iA(){const e=_v.GET_GROUPS,t=yield eA();yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield fo(gy.groups.getGroups,{_groupsRelations:Mv.rolesAndUsers});yield co(yi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*oA({payload:e}){const t=_v.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ii(e,Zb);yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield fo(gy.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield co(yi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield co(yi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield co(yi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*aA({payload:e}){const t=_v.UPDATE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.updateGroup,e),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*rA({payload:e}){const t=_v.DELETE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.deleteGroup,e.groupId),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*sA({payload:e}){const t=_v.ADD_ROLES_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*lA({payload:e}){const t=_v.DELETE_ROLES_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*cA({payload:e}){const t=_v.ADD_USERS_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield co(yi.setUsersGroupsError({key:t,value:n.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*uA({payload:e}){const t=_v.DELETE_USERS_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(gy.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA(){const e=_v.GET_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield fo(gy.groups.getGroupConfiguration);yield co(yi.setGroupsState({groupsConfiguration:t}))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*yA({payload:e}){const t=_v.UPDATE_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{yield fo(gy.groups.updateGroupConfiguration,e),yield co(yi.getGroupConfiguration())}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*fA(){yield ca(yi.loadGroups,iA),yield ca(yi.getGroupById,nA),yield ca(yi.createGroup,oA),yield ca(yi.updateGroup,aA),yield ca(yi.deleteGroup,rA),yield ca(yi.addRolesToGroup,sA),yield ca(yi.deleteRolesFromGroup,lA),yield ca(yi.addUsersToGroup,cA),yield ca(yi.deleteUsersFromGroup,uA),yield ca(yi.getGroupConfiguration,dA),yield ca(yi.updateGroupConfiguration,yA),yield ca(yi.getTeamUsers,tA)}function*pA(){const e=_v.GET_GROUPS;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));const t=yf;yield co(yi.setGroupsState({groups:t})),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*gA({payload:e}){var t;const n=_v.CREATE_GROUP,{groups:i}=yield eA();yield co(yi.setUsersGroupsLoader({key:n,value:!0})),yield co(yi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:yy.FRONTEGG}),...null!=i?i:[]]})),yield vo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield co(yi.setUsersGroupsLoader({key:n,value:!1}))}function*SA({payload:e}){var t,n,i,o,a;const r=_v.UPDATE_GROUP,s=yield eA();yield co(yi.setUsersGroupsLoader({key:r,value:!0})),yield co(yi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:yy.FRONTEGG}):t})),selectedGroup:C({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield vo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield co(yi.setUsersGroupsLoader({key:r,value:!1}))}function*vA({payload:e}){var t,n;const i=_v.DELETE_GROUP,o=yield eA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*hA({payload:e}){var t,n;const i=_v.ADD_ROLES_TO_GROUP,o=yield eA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*mA({payload:e}){var t,n;const i=_v.DELETE_ROLES_FROM_GROUP,o=yield eA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*bA({payload:e}){var t,n;const i=_v.ADD_USERS_TO_GROUP,o=yield eA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*AA({payload:e}){var t,n;const i=_v.DELETE_USERS_FROM_GROUP,o=yield eA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*kA(){const e=_v.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield eA();yield co(yi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield co(yi.setGroupsState({groupsConfiguration:C({},t)}))),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*TA({payload:e}){const t=_v.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield eA();yield co(yi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield co(yi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}function*PA(){yield ca(yi.loadGroups,pA),yield ca(yi.createGroup,gA),yield ca(yi.updateGroup,SA),yield ca(yi.deleteGroup,vA),yield ca(yi.addRolesToGroup,hA),yield ca(yi.deleteRolesFromGroup,mA),yield ca(yi.addUsersToGroup,bA),yield ca(yi.deleteUsersFromGroup,AA),yield ca(yi.getGroupConfiguration,kA),yield ca(yi.updateGroupConfiguration,TA)}const IA=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...IA(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),LA=["callback"];function*EA(){yield co(yi.setCustomLoginState({loading:!0}));try{const e=yield fo(Ic);yield co(yi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield co(yi.setCustomLoginState({loading:!1,error:e.message}))}}function*OA(e){let{payload:{callback:t}}=e,n=Ii(e.payload,LA);try{if(yield co(yi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=IA(n);if(0===e.length)throw new Error("no changes to update");yield fo(Lc,{actions:e});const i=yield fo(Ic);yield co(yi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*wA(){yield ua(yi.loadTenantMetadata,EA),yield ua(yi.updateTenantMetadata,OA)}var CA={sagas:function*(){yield uo([fo(Eg),fo(Tv),fo(Iv),fo(pv),fo(jm),fo(Wg),fo(vS),fo(TS),fo(wA),fo(ev),fo(Eh),fo(fA),fo(qh),fo(bf),fo(nm),fo(Hf),fo(dm),fo(mm),fo(Um),fo(Hm),fo(ib),fo(Ob),fo(zb),fo(Jb),fo(Xb)])},mockSagas:function*(){yield uo([fo(Cg),fo(Yg),fo(ES),fo(cv),fo(xh),fo(lm),fo(sp),fo(Xm),fo(pm),fo(Am),fo(rb),fo($b),fo(Mm),fo(PA)])},storeName:wt,initialState:ai,reducer:ui,actions:yi};const DA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),RA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},UA={setAuditLogsState:DA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:RA})},_A={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},MA={loading:!0},NA={setAuditsMetadataState:DA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:MA})},FA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},$A={auditLogsState:RA,auditsMetadataState:MA},{reducer:GA,actions:xA}=ut({name:Dt,initialState:$A,reducers:C({resetState:e=>C({},e,$A),setState:(e,{payload:t})=>C({},e,t)},UA,NA)}),VA=C({},xA,_A,FA),jA=e=>"createdAt"!==e.id,WA={total:20,data:Array.from(Array(5).keys()).map((e=>C({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},KA={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}]},BA=()=>So((e=>e.auditLogs.auditLogsState)),zA=()=>So((e=>e.auditLogs.auditsMetadataState));function*qA(){const e=yield BA(),{columns:t}=yield zA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield co(VA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield gy.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield co(VA.setAuditLogsState({isDownloadingCsv:!1}))}function*HA({payload:e}){yield co(VA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield BA(),{columns:n}=yield zA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield co(VA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield co(VA.loadAuditsMetadata()));const{data:p,total:g}=yield fo(gy.audits.getAudits,C({offset:c,count:l},y,f));yield co(VA.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield co(VA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*JA(){yield la(VA.exportAuditsCsv,qA),yield la(VA.loadAuditLogs,HA)}function*YA({payload:e}){yield co(VA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield BA(),{columns:n}=yield zA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield co(VA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield co(VA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=WA;let i=n.filter((e=>t=>e.filter(jA).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield co(VA.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield co(VA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*QA(){yield la(VA.loadAuditLogs,YA)}function*XA(){yield co(VA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield fo(gy.metadata.getAuditsMetadata);yield co(VA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(VA.setAuditsMetadataState({error:e,loading:!1}))}}function*ZA(){yield la(VA.loadAuditsMetadata,XA)}function*ek(){yield co(VA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=KA;yield co(VA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(VA.setAuditsMetadataState({error:e,loading:!1}))}}function*tk(){yield la(VA.loadAuditsMetadata,ek)}var nk={sagas:function*(){yield uo([fo(JA),fo(ZA)])},mockSagas:function*(){yield uo([fo(QA),fo(tk)])},storeName:Dt,initialState:$A,reducer:GA,actions:VA};const ik={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:ok,actions:ak,reducer:rk}=ut({name:"audits",initialState:ik,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=C({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),sk=C({},ak,{initData:lt(`${ok}/initData`),loadAudits:lt(`${ok}/loadAudits`),removeFilter:lt(`${ok}/removeFilter`),filterData:lt(`${ok}/filterData`),exportCSV:lt(`${ok}/exportCSV`),deleteAudits:lt(`${ok}/deleteAudits`)}),lk=()=>So((e=>e[ok]));function*ck(){const{sortBy:e,sortDirection:t}=yield lk();try{const n=yield fo(gy.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield co(sk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield co(sk.loadItemFailedAction(t))}}function*uk(){try{const e=yield fo(gy.metadata.getAuditsMetadata);yield co(sk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield co(sk.loadItemFailedAction(t))}}const dk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*yk({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield lk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield lk():{rowsData:[]};try{const e=dk(t),{data:s,total:d}=yield fo(gy.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield co(sk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield co(sk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield co(sk.loadItemFailedAction(t))}}function*fk(){yield co(sk.startLoading()),yield uo([ck(),uk(),yk({payload:{onlyOneLoad:!1},type:""})]),yield co(sk.finishLoading())}function*pk({payload:e}){const{filters:t}=yield lk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield co(sk.setFilterData(i))}function*gk({payload:e}){const{filters:t}=yield lk();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield co(sk.setFilterData(i))}function*Sk(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield lk(),a=dk(e);yield co(sk.startDownloadingCsv());try{yield gy.audits.exportAudits(C({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield co(sk.stopDownloadingCsv())}}function*vk(){yield ca(sk.initData,fk),yield ca(sk.removeFilter,pk),yield ca(sk.filterData,gk),yield ca([sk.loadAudits,sk.textSearch,sk.onPageChange],yk),yield ca([sk.setFilterData,sk.setDataSorting,sk.startRefresh],(()=>yk({payload:{appendMode:!1},type:""}))),yield ca(sk.exportCSV,Sk)}const hk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},mk={initData:()=>C({},hk),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},bk={loadSlackActions:lt("connectivity/loadSlackActions"),loadDataAction:lt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:lt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:lt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:lt("connectivity/loadScope"),deleteWebhookConfigAction:lt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:lt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:lt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ak={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:kk,actions:Tk}=ut({name:Ct,initialState:Ak,reducers:C({},mk)}),Pk=C({},Tk,bk),Ik={slack:gy.connectivity.getSlackConfiguration,email:gy.connectivity.getEmailConfiguration,sms:gy.connectivity.getSMSConfiguration,webhook:gy.connectivity.getWebhooksConfigurations,categories:gy.connectivity.getCategories,channelMap:gy.connectivity.getChannelMaps},Lk={slack:gy.connectivity.postSlackConfiguration,email:gy.connectivity.postEmailConfiguration,sms:gy.connectivity.postSMSConfiguration,webhook:gy.connectivity.postWebhooksConfiguration},Ek=["email","slack","sms","webhook"],Ok={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"}},wk=["id"],Ck=["id","enabled"],Dk=["categories","channelMap"];function*Rk(e){return yield fo(_k,{payload:{api:e},type:""})}function*Uk({payload:e=Ek}){yield co(Pk.setConnectivityState({isLoading:!0}));try{const t=yield uo([...e.map(Rk),yield _k({payload:{api:"categories"},type:""}),yield function*(){return(yield uo(e.map((function*(e){return yield _k({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield _k({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Ok[e[o]].events(i),active:Ok[e[o]].isActive(i),platform:Ok[e[o]].title,image:Ok[e[o]].image}]}):n:C({},n,{[`${Dk[o-e.length]}`]:i})),{list:[],webhook:n});yield co(Pk.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield co(Pk.setConnectivityState({isLoading:!1}))}}function*_k({payload:{api:e,params:t}}){try{return yield fo(Ik[e],t)}catch(e){return}}function*Mk(){try{yield co(Pk.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield fo(gy.connectivity.getSlackChannels);yield co(Pk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield co(Pk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Nk(e,t){const{connectivity:{list:n}}=yield So(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Ok[e].isActive(t);o!==i.active&&(yield co(Pk.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*Fk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield So((e=>e.connectivity));try{if(yield co(Pk.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield So();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield uo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Ii(e,wk);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield fo(Lk.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield fo(gy.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield So(),{processIds:i}=yield So((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield uo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield fo("email"===t?gy.connectivity.postEmailConfiguration:gy.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=Ii(o,Ck);return yield uo([yield fo("email"===t?gy.connectivity.patchEmailConfiguration:gy.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield fo("email"===t?gy.connectivity.putEmailSubscriptions:gy.connectivity.putSMSSubscriptions,a,i,C({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return fo("email"===t?gy.connectivity.deleteEmailSubscriptions:gy.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield _k({payload:{api:t},type:""});yield co(Pk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Nk(t,e)}else yield co(Pk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield fo(Lk[e],t),!["sms","email"].includes(e)){const o=yield _k({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield co(Pk.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Nk(e,o),null==n||n(!0)}}catch(e){var o;yield co(Pk.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*$k({payload:e}){try{yield gy.connectivity.postSlackCode(e)}catch{}yield co(Pk.setConnectivityState({error:void 0,isSaving:!1}))}function*Gk(){const{slackChannels:e}=yield So((e=>e.connectivity));try{yield co(Pk.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield fo(gy.connectivity.getSlackScope);yield co(Pk.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield co(Pk.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*xk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield So((e=>e.connectivity));try{yield co(Pk.setConnectivityState({isSaving:!0})),yield fo(gy.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield _k({payload:{api:"webhook"},type:""});o&&(yield co(Pk.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Vk({payload:e}){try{yield co(Pk.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield fo(gy.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield co(Pk.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield co(Pk.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield co(Pk.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*jk({payload:e}){try{const{statusCode:t}=yield fo(gy.connectivity.postWebhookRetry,e);yield co(Pk.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield co(Pk.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Wk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield So((e=>e.connectivity));try{yield co(Pk.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield fo(gy.connectivity.getWebhookLog,e,n,t);yield co(Pk.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield co(Pk.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Kk={sagas:function*(){yield la(Pk.loadDataAction,Uk),yield ca(Pk.loadSlackActions,Mk),yield la(Pk.postDataAction,Fk),yield la(Pk.postCodeAction,$k),yield la(Pk.loadScope,Gk),yield la(Pk.deleteWebhookConfigAction,xk),yield la(Pk.postWebhookTestAction,Vk),yield la(Pk.postWebhookRetryAction,jk),yield ca(Pk.loadWebhookLogsAction,Wk)},storeName:Ct,initialState:Ak,reducer:kk,actions:Pk};function Bk(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function zk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function qk(e){return zk(e,((e,t)=>C({},e,{loading:t.payload})))}function Hk(e){return zk(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const Jk={loading:!1,error:null,fetching:!0,plans:[]},{actions:Yk,reducer:Qk,name:Xk}=ut({name:"subscriptions/plans",initialState:Jk,reducers:C({},Bk())}),Zk=C({loadPlans:lt(`${Xk}/loadPlans`)},Yk),eT={loading:!1,error:null,fetching:!0,config:null},tT=C({},Bk()),{actions:nT,reducer:iT,name:oT}=ut({name:"subscriptions/config",initialState:eT,reducers:tT}),aT=C({loadPaymentConfiguration:lt(`${oT}/loadPaymentConfiguration`)},nT),rT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},sT=C({},Bk(),{setCancellationLoading:qk("cancellation"),setCancellationError:Hk("cancellation"),setRenewalLoading:qk("renewal"),setRenewalError:Hk("renewal")}),{reducer:lT,actions:cT,name:uT}=ut({name:"subscriptions/billing/subscription",initialState:rT,reducers:sT}),dT=C({load:lt(`${uT}/loadSubscription`),cancelSubscription:lt(`${uT}/cancelSubscription`),renewSubscription:lt(`${uT}/renewSubscription`)},cT),yT={loading:!1,error:null,fetching:!0},fT=C({},Bk()),{reducer:pT,actions:gT,name:ST}=ut({name:"subscriptions/billing/information",initialState:yT,reducers:fT}),vT=C({loadBillingInformation:lt(`${ST}/loadBillingInformation`),cancelSubscription:dT.cancelSubscription,renewSubscription:dT.renewSubscription},gT),hT={loading:!1,error:null,fetching:!0},mT=C({},Bk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:bT,actions:AT,name:kT}=ut({name:"subscriptions/billing/payment",initialState:hT,reducers:mT}),TT=C({loadPaymentMethod:lt(`${kT}/loadPaymentMethod`),submitPaymentMethod:lt(`${kT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${kT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${kT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${kT}/updateBillingDetails`,(e=>({payload:e})))},AT),PT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},IT=C({},Bk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:LT,actions:ET,name:OT}=ut({name:"subscriptions/billing/invoices",initialState:PT,reducers:IT}),wT=C({loadInvoices:lt(`${OT}/loadInvoices`),downloadInvoice:lt(`${OT}/downloadInvoice`,(e=>({payload:e})))},ET),CT={information:yT,invoices:PT,paymentMethod:hT,subscription:rT},DT={invoices:wT,information:vT,paymentMethod:TT,subscription:dT},RT=je({invoices:LT,information:pT,paymentMethod:bT,subscription:lT}),UT={fetching:!0,loading:!1,error:null,confirmed:!1},_T=C({},Bk()),{actions:MT,reducer:NT,name:FT}=ut({name:"subscriptions/checkout",initialState:UT,reducers:_T}),$T=C({loadCheckout:lt(`${FT}/loadCheckout`),resetCheckout:lt(`${FT}/resetCheckout`),submitCheckout:lt(`${FT}/submitCheckout`),confirmCheckout:lt(`${FT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${FT}/errorCheckout`,(e=>({payload:e})))},MT),GT={loading:!1,error:null,cardSetupIntentSecret:null},xT=C({},Bk()),{reducer:VT,actions:jT,name:WT}=ut({name:"subscriptions/stripe",initialState:GT,reducers:xT}),KT=C({loadCustomer:lt(`${WT}/loadCustomer`),createCardSetupIntentSecret:lt(`${WT}/createCardSetupIntentSecret`)},jT),BT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:zT,reducer:qT,name:HT}=ut({name:"subscriptions/vendorPublicConfig",initialState:BT,reducers:C({},Bk())}),JT=C({loadVendorPublicConfiguration:lt(`${HT}/loadVendorPublicConfiguration`)},zT),YT={config:eT,plans:Jk,checkout:UT,billing:CT,stripe:GT,vendorPublicConfig:BT},QT={config:aT,billing:DT,plans:Zk,checkout:$T,stripe:KT,vendorPublicConfig:JT},XT=je({config:iT,billing:RT,plans:Qk,checkout:NT,stripe:VT,vendorPublicConfig:qT});let ZT,eP,tP;function nP({policy:e}){return{policy:tP.AT_PERIOD_END}}function iP(e){switch(e){case yd.ACTIVE:return eP.ACTIVE;case yd.INCOMPLETE:return eP.INCOMPLETE;case yd.CANCELED:return eP.CANCELED;case yd.EXPIRED:return eP.EXPIRED;case yd.TRIALING:return eP.TRIALING;default:return eP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(ZT||(ZT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(eP||(eP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(tP||(tP={}));const oP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:yd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},aP=[{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"}],rP=[{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:""}],sP=[{id:"id",externalId:"externalId",type:fd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],lP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*cP(){yield la(dT.load,uP),yield la(dT.cancelSubscription,yP),yield la(dT.renewSubscription,fP)}function*uP(){const e=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield hP(e)}function*dP(){yield co(dT.setLoading(!0));try{const[e]=yield fo(gy.subscriptions.getManagedSubscriptions);yield co(dT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield co(dT.setError(e))}}function*yP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(dT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(dT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===yd.ACTIVE)try{yield co(dT.setCancellationLoading(!0)),yield fo(gy.subscriptions.cancelManagedSubscription,t),yield dP(),yield co(dT.setCancellationLoading(!1))}catch(e){yield co(dT.setCancellationError(e.message))}}function*fP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(dT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(dT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===pd.AT_PERIOD_END)try{yield co(dT.setRenewalLoading(!0)),yield fo(gy.subscriptions.renewManagedSubscription,t),yield dP(),yield co(dT.setRenewalLoading(!1))}catch(e){yield co(dT.setCancellationError(e.message))}}function*pP(){yield co(dT.setLoading(!0)),yield vo(500),yield co(dT.setState({subscription:oP,fetching:!1,loading:!1,error:null}))}function*gP(){yield la(dT.load,pP)}function*SP(){yield la(vT.loadBillingInformation,vP)}function*vP(){yield function*(e){const t=yield So((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield hP(n,!1):yield co(vT.setError(t?"Not authorized":"Internal feature failure"))}()}function*hP(e,t){yield co(vT.setLoading(!0));try{var n,i;const o=yield fo(gy.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield fo(gy.subscriptions.getSubscriptionPlan,a):([,s]=yield uo([fo(dP),fo(gy.subscriptions.getSubscriptionPlan,a)]),l=yield So((e=>e.subscriptions.billing.subscription.subscription||null))),yield co(vT.setState(C({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?eP.ACTIVE:iP(l.status),cancellation:l.cancellation&&nP(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield co(vT.setError(e.message))}}function*mP(){yield function*(){var e,t;yield co(vT.setLoading(!0)),yield vo(500),yield co(vT.setState({loading:!1,fetching:!1,summary:{subscriptionId:oP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:gd.Stripe,externallyManaged:!1,currentPlanId:aP[0].id,defaultPlanId:aP[0].id},plan:C({},aP[0],{price:null==(e=aP[0].price)?void 0:e.amount,currency:null==(t=aP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*bP(){yield la(vT.loadBillingInformation,mP)}function*AP(){yield la(TT.loadPaymentMethod,kP),yield la(TT.submitPaymentMethod,PP),yield la(TT.submitPaymentMethodError,IP),yield la(TT.submitPaymentMethodSuccess,LP),yield la(TT.updatePaymentMethodBillingDetails,TP)}function*kP(){yield co(TT.setLoading(!0));try{const e=(yield fo(gy.subscriptions.getPaymentMethods))[0];yield co(TT.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield co(TT.setError(e.message))}}function*TP({payload:e}){yield co(TT.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield fo(gy.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield fo(kP),null==o||o(!0)}catch(e){yield co(TT.setError(e.message)),null==o||o(!1)}yield co(TT.setLoading(!1))}function*PP(){yield co(TT.setLoading(!0))}function*IP({payload:e}){yield co(TT.setError(e))}function*LP(){yield co(TT.loadPaymentMethod())}function*EP(){yield co(TT.setLoading(!0)),yield vo(500);const e=sP[0];yield co(TT.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*OP(){yield la(TT.loadPaymentMethod,EP)}function*wP(){yield la(wT.loadInvoices,CP),yield la(wT.downloadInvoice,DP)}function*CP(){yield co(wT.setLoading(!0));try{const e=(yield fo(gy.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 co(wT.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield co(wT.setError(e.message))}}function*DP({payload:e}){yield co(wT.setInvoiceDownloadState({loading:!0,error:null}));try{yield fo(gy.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield co(wT.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield co(wT.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*RP(){yield co(wT.setLoading(!0)),yield vo(500),yield co(wT.setState({loading:!1,fetching:!1,invoices:rP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield co(wT.setLoading(!1))}function*UP(){yield la(wT.loadInvoices,RP)}function*_P(){yield uo([fo(SP),fo(AP),fo(wP),fo(cP)])}function*MP(){yield uo([fo(bP),fo(OP),fo(UP),fo(gP)])}function*NP(){yield la($T.loadCheckout,FP),yield la($T.resetCheckout,$P),yield la($T.submitCheckout,GP),yield la($T.confirmCheckout,xP),yield la($T.errorCheckout,jP)}function*FP(){yield co($T.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*$P(){yield co($T.setState({loading:!1,error:null,confirmed:!1}))}function*GP(){yield co($T.setState({loading:!0,error:null}))}function*xP({payload:{paymentMethodId:e,planId:t}}){const n=yield So((e=>e.subscriptions.billing.subscription.subscription)),i=yield So((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===yd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield co($T.setState({loading:!0,error:null})),o&&a)return yield VP(),void(yield co(dT.setState({subscription:C({},n,{status:yd.ACTIVE})})));try{yield fo(gy.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield uo([vP(),kP(),CP()]),yield VP()}catch(e){yield co($T.setState({loading:!1,error:e.message}))}}else yield co($T.setState({loading:!1,error:"Subscription not found"}))}function*VP(){yield co($T.setState({loading:!1,error:null,confirmed:!0}))}function*jP({payload:e}){yield co($T.setState({loading:!1,error:e}))}function*WP(){yield la($T.resetCheckout,$P)}function*KP(){yield la(Zk.loadPlans,BP)}function*BP(){yield co(Zk.setLoading(!0));try{const e=(yield fo(gy.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 co(Zk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield co(Zk.setError(e.message))}}function*zP(){yield co(Zk.setLoading(!0)),yield vo(500),yield co(Zk.setState({fetching:!1,loading:!1,plans:aP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*qP(){yield la(Zk.loadPlans,zP)}function*HP(){yield la(aT.loadPaymentConfiguration,JP)}function*JP(){yield co(aT.setLoading(!0));try{(yield fo(gy.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===gd.Stripe))?yield function*(){yield co(aT.setLoading(!0));try{const e=yield fo(gy.subscriptions.getStripePaymentProviderConfiguration);yield co(aT.setState({loading:!1,fetching:!1,config:{paymentProvider:ZT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield co(aT.setError(e.message))}}():yield co(aT.setError("Payment provider not configured"))}catch(e){yield co(aT.setError(e.message))}}function*YP(){yield co(aT.setLoading(!0)),yield vo(500),yield co(aT.setState({loading:!1,fetching:!1,config:{paymentProvider:ZT.STRIPE,apiKey:""}}))}function*QP(){yield la(aT.loadPaymentConfiguration,YP)}function*XP(){yield la(KT.createCardSetupIntentSecret,ZP)}function*ZP({payload:e}){yield co(KT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield fo(gy.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield co(KT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield co(KT.setError(e.message))}}function*eI(){yield la(JT.loadVendorPublicConfiguration,tI)}function*tI(){yield co(JT.setLoading(!0));try{const e=yield fo(gy.subscriptions.getVendorPublicConfigurations);yield co(JT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield co(JT.setError(e.message))}}function*nI(){yield co(JT.setLoading(!0)),yield vo(500),yield co(JT.setState({fetching:!1,loading:!1,vendorPublicConfig:lP}))}function*iI(){yield la(JT.loadVendorPublicConfiguration,nI)}var oI={sagas:function*(){yield uo([fo(_P),fo(NP),fo(KP),fo(HP),fo(XP),fo(eI)])},mockSagas:function*(){yield uo([fo(MP),fo(WP),fo(qP),fo(QP),fo(iI)])},reducer:XT,actions:QT,initialState:YT,storeName:"subscriptions"},aI={sagas:function*(){yield la(Lf.loadVendorPublicInfo,Ef)},storeName:Rt,initialState:Tf,reducer:Pf,actions:Lf};const{reducer:rI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(da.setContext(t),C({},e,{context:t}))}}}),sI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,p,g,S,v;n||a||da.setContext(e.context);const t=Zo(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[CA.storeName]:C({},CA.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},CA.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[nk.storeName]:C({},nk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},nk.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:C({},nk.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[ok]:C({},ik,null!=(v=null==o?void 0:o.audits)?v:{}),[Kk.storeName]:Kk.initialState,[oI.storeName]:oI.initialState,[aI.storeName]:aI.initialState},reducer:je({root:rI,[CA.storeName]:CA.reducer,[nk.storeName]:nk.reducer,[ok]:rk,[Kk.storeName]:Kk.reducer,[oI.storeName]:oI.reducer,[aI.storeName]:aI.reducer})});const m=function*(){yield uo([fo(CA.sagas),fo(nk.sagas),fo(vk),fo(Kk.sagas),fo(oI.sagas),fo(aI.sagas)])},b=function*(){yield uo([fo(CA.mockSagas),fo(nk.mockSagas),fo(oI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(yi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var lI=n(714),cI=n.n(lI);function uI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function dI(e){if(e.type)return e;if("#"===e.charAt(0))return dI(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function yI(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function fI(e){if(0===e.indexOf("#"))return e;const{values:t}=dI(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 pI(e,t){return e=dI(e),t=uI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,yI(e)}function gI(e,t){if(e=dI(e),t=uI(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 yI(e)}function SI(e,t){if(e=dI(e),t=uI(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 yI(e)}const vI=e=>{if(e)return{main:e,light:fI(SI(e,.4)),dark:fI(gI(e,.15)),hover:fI(gI(e,.15)),active:fI(gI(e,.2))}},hI=e=>{if(e)return{main:e,light:SI(e,.7),dark:gI(e,.2)}},mI=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?C({},t,{palette:{primary:C({},vI(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:C({},vI(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:C({},vI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},hI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},hI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},hI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},hI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},bI={},AI={},kI={},TI={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.*"]}};class PI{constructor(){this._theme=bI,this._themeV2=AI,this._navigation=TI,this._localizations=kI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new PI;return n.set(e),PI._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=cI().all([null!=(t=TI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=cI().all([null!=(i=bI)?i:{},mI(null==e?void 0:e.theme,bI)]),this._themeV2=cI().all([null!=(o=AI)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=cI().all([null!=(r=kI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=TI,this._theme=bI,this._themeV2=AI,this._localizations=kI}}}PI._instances={};var II=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},LI=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},EI=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let OI,wI,CI,DI,RI,UI,_I,MI,NI,FI,$I;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(OI||(OI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(wI||(wI={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(CI||(CI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(DI||(DI={})),function(e){e.Invoices="invoices"}(RI||(RI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(UI||(UI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(_I||(_I={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(MI||(MI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(NI||(NI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(FI||(FI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}($I||($I={}));const GI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},xI={hidden:"hidden",edit:"edit"};var VI="6.98.0-alpha.1",jI={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":"on"},WI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(VI),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(_().mark((function e(){var t,n,i,a,r;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Sa,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[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:PI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Cd.set(jI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Dd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Cd.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=II(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.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=sI({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(s,this)}var t,n,i,o;return O(e,[{key:"initContainers",value:(o=R(_().mark((function e(t){return _().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,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;PI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().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 i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return da.setRequestSource("admin-portal"),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;null==(e=this.adminPortalRenderer)||e.unmount(),da.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),KI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(da.setAccessToken(t),da.setUser(C({},n,{accessToken:t})),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(yi.loadTenants())):(da.setAccessToken(null),da.setUser(null),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),BI=function(){function e(){P(this,e)}return O(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}(),zI=function(){function e(){P(this,e)}return O(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}(),qI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},HI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=sI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new WI(this.options,t,!0),PI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,EI(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}(),JI="modern",YI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[JI]},QI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=sI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new WI(this.options,t,!0,a),PI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,EI(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 XI(e,t){return XI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},XI(e,t)}function ZI(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&&XI(e,t)}function eL(e,t){if(t&&("object"===I(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 tL(e){return tL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},tL(e)}function nL(){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 iL(e,t,n){return iL=nL()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&XI(o,n.prototype),o},iL.apply(null,arguments)}function oL(e){var t="function"==typeof Map?new Map:void 0;return oL=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 iL(e,arguments,tL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),XI(n,e)},oL(e)}function aL(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=tL(e);if(t){var o=tL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return eL(this,n)}}var rL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new WI(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){ZI(n,e);var t=aL(n);function n(){var e;P(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return O(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 i=LI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=LI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=LI(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=LI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=LI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=LI(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(oL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
|