@frontegg/js 6.85.0 → 6.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FronteggApp/FronteggApp.js +9 -6
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +9 -6
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +677 -18
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +9 -0
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?i[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):i[a]=o(t[a],n))})),i}(e,n,s):o(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,s)&&(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(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function P(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function 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[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:D}}function D(){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,o,i,a){void 0===a&&(a=Promise);var r=new T(y(e,n,o,i),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,s,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),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 o=n.completion;if("throw"===o.type){var i=o.arg;E(n)}return i}}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=i,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return XP},AdminPortalRenderer:function(){return tI},AppHolder:function(){return E},CheckoutDialog:function(){return ZP},FronteggApp:function(){return YP},HostedLogin:function(){return QP},LoginBoxRenderer:function(){return iI},createElement:function(){return UP},defaultTheme:function(){return nI},formatName:function(){return RP},getThemeAdminByName:function(){return eI},getThemeByName:function(){return oI},initialize:function(){return fI},mockFlagsList:function(){return JP},waitThemeSetter:function(){return _P}});var e={};n.r(e),n.d(e,{Delete:function(){return ga},Get:function(){return da},Patch:function(){return fa},Post:function(){return ya},PostDownload:function(){return Sa},Put:function(){return pa},getBaseUrl:function(){return ca}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Xa},getSubTenantsAsTree:function(){return Za},getTenants:function(){return Qa},switchTenant:function(){return Ya}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return Lr},MachineToMachineAuthStrategy:function(){return Er},OAuthLogout:function(){return Qr},SocialLoginProviders:function(){return Ir},acceptInvitation:function(){return qr},activateAccount:function(){return jr},bulkCreateIPRestriction:function(){return br},changePhoneNumber:function(){return xs},changePhoneNumberWithVerification:function(){return $s},checkIfAllowToRememberMfaDevice:function(){return fs},createDomainRestriction:function(){return pr},createIPRestriction:function(){return mr},createOrUpdateSessionConfigrations:function(){return Ql},createSSOConfiguration:function(){return hs},createSSOConfigurationByMetadata:function(){return As},createSSODomain:function(){return Ts},createSSOGroup:function(){return Os},createSamlGroup:function(){return Nl},createTenantAccessToken:function(){return as},createUserAccessToken:function(){return is},deleteAllSessionsForUser:function(){return Zl},deleteDomainRestriction:function(){return Sr},deleteIPRestriction:function(){return kr},deleteSSOConfiguration:function(){return bs},deleteSSODomain:function(){return Ps},deleteSSOGroup:function(){return Ds},deleteSamlGroup:function(){return $l},deleteSessionForUser:function(){return Xl},deleteTenantAccessToken:function(){return ns},deleteTenantApiToken:function(){return us},deleteUserAccessToken:function(){return os},deleteUserApiToken:function(){return ds},deleteWebAuthnDevice:function(){return Bs},disableMFAAuthenticatorApp:function(){return dl},disableMFASMS:function(){return fl},disableMFAWebAuthn:function(){return gl},disableMfa:function(){return ul},enrollMFAAuthenticatorApp:function(){return il},enrollMFAAuthenticatorAppForLogin:function(){return hl},enrollMFASMS:function(){return rl},enrollMFASMSForLogin:function(){return Al},enrollMFAWebAuthn:function(){return sl},enrollMFAWebAuthnForLogin:function(){return Il},enrollMfa:function(){return nl},exchangeOAuthTokens:function(){return _s},forgotPassword:function(){return Xr},generateLoginResponse:function(){return _r},generateLoginResponseFromOAuthResponse:function(){return Nr},generateLoginResponseV2:function(){return Mr},getActivateAccountStrategy:function(){return Kr},getCaptchaPolicy:function(){return lr},getCurrentUserSession:function(){return Hl},getCurrentUserSessions:function(){return ql},getCustomSocialLoginProvidersV1:function(){return jl},getDomainRestrictions:function(){return yr},getDomainRestrictionsConfig:function(){return fr},getGlobalSecurityPolicy:function(){return er},getIPRestrictions:function(){return vr},getIPRestrictionsConfig:function(){return hr},getLockoutPolicy:function(){return ir},getMFADevices:function(){return Sl},getMFAStrategiesConfig:function(){return Hs},getMfaPolicy:function(){return tr},getOidcConfiguration:function(){return Gl},getPasswordConfigPolicy:function(){return dr},getPasswordHistoryPolicy:function(){return sr},getSSOConfigurations:function(){return vs},getSSODefaultRoles:function(){return Ls},getSSOGroups:function(){return Cs},getSSOPublicConfiguration:function(){return xl},getSamlConfiguration:function(){return Ol},getSamlRoles:function(){return Ul},getSamlRolesGroups:function(){return _l},getSamlVendorConfiguration:function(){return Dl},getSessionConfigurations:function(){return Yl},getSocialLoginProviders:function(){return Vl},getSocialLoginProvidersV2:function(){return Wl},getTenantAccessTokensData:function(){return ts},getTenantApiTokensData:function(){return ls},getUserAccessTokensData:function(){return es},getUserApiTokensData:function(){return rs},getUserById:function(){return ys},getVendorConfig:function(){return Bl},getVendorLockoutPolicy:function(){return ar},getVendorMfaPolicy:function(){return nr},getVendorPasswordHistoryPolicy:function(){return cr},getVendorPublicAuthStrategiesConfig:function(){return qs},getWebAuthnDevices:function(){return Ks},loadPasswordConfig:function(){return el},login:function(){return Vr},loginViaSocialLogin:function(){return Kl},loginWithMfa:function(){return Wr},logout:function(){return Yr},oidcPostLogin:function(){return xr},oidcPostLoginV2:function(){return Us},passwordlessPostLogin:function(){return gs},passwordlessPreLogin:function(){return ps},postLogin:function(){return Gr},preDisableMFASMS:function(){return yl},preDisableMFAWebAuthn:function(){return pl},preEnrollMFAAuthenticatorApp:function(){return ol},preEnrollMFAAuthenticatorAppForLogin:function(){return vl},preEnrollMFASMS:function(){return al},preEnrollMFASMSForLogin:function(){return bl},preEnrollMFAWebAuthn:function(){return ll},preEnrollMFAWebAuthnForLogin:function(){return Pl},preLogin:function(){return Fr},preLoginV2:function(){return Rs},preLoginWithIdpType:function(){return $r},preVerifyMFASMSForLogin:function(){return kl},preVerifyMFAWebAuthnForLogin:function(){return Ll},recoverMfaToken:function(){return tl},refreshToken:function(){return Hr},refreshTokenV2:function(){return Jr},resendActivationEmail:function(){return Br},resendInvitationEmail:function(){return zr},resetPassword:function(){return Zr},resetPhoneNumber:function(){return Ns},revokeSessionsForUser:function(){return Jl},saveLockoutPolicy:function(){return rr},saveMfaPolicy:function(){return or},savePasswordHistoryPolicy:function(){return ur},setSSODefaultRoles:function(){return Es},signUpUser:function(){return zl},silentOAuthRefreshToken:function(){return Ms},testCurrentIp:function(){return Tr},testCurrentIpInAllowList:function(){return Pr},updateDomainRestrictionConfig:function(){return gr},updateIPRestrictionConfig:function(){return Ar},updateSSOConfiguration:function(){return ms},updateSSOConfigurationByMetadata:function(){return ks},updateSSOGroup:function(){return ws},updateSamlConfiguration:function(){return wl},updateSamlGroup:function(){return Fl},updateSamlRoles:function(){return Ml},updateSamlVendorMetadata:function(){return Cl},updateTenantApiTokensData:function(){return cs},updateUserApiTokensData:function(){return ss},validateSSODomain:function(){return Is},validateSamlDomain:function(){return Rl},verifyChangePhoneNumber:function(){return Gs},verifyInviteToken:function(){return Ss},verifyMFAAuthenticatorAppForLogin:function(){return ml},verifyMFASMSForLogin:function(){return Tl},verifyMFAWebAuthnForLogin:function(){return El},verifyMfa:function(){return cl},verifyNewDeviceSession:function(){return zs},verifyResetPhoneNumber:function(){return Fs},webAuthnCreateNewDeviceSession:function(){return js},webAuthnPostLogin:function(){return Ws},webAuthnPreLogin:function(){return Vs}});var a={};n.r(a),n.d(a,{addUser:function(){return ec},changePassword:function(){return Xs},createInviteUserLink:function(){return oc},deleteInviteUserLink:function(){return ac},deleteUser:function(){return tc},getInviteLinkConfiguration:function(){return lc},getInviteUserLink:function(){return rc},getProfile:function(){return Js},loadAvailablePermissions:function(){return cc},loadAvailableRoles:function(){return sc},loadStats:function(){return uc},loadUsers:function(){return Zs},resendActivationLink:function(){return dc},resendInvitationLink:function(){return yc},resendInvitationLinkToAllTenants:function(){return fc},updateInviteUserLink:function(){return ic},updateProfile:function(){return Ys},updateProfileImage:function(){return Qs},updateUser:function(){return nc}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return hc},getCurrentUserIpMetadata:function(){return gc},getIpAdressMetadata:function(){return mc},getNotificationsMetadata:function(){return Sc},getSamlMetadata:function(){return vc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Ec},getReport:function(){return Pc},getReports:function(){return Tc},renderReport:function(){return Ic},scheduleReport:function(){return Lc},sendReport:function(){return Oc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return wc},markAllAsRead:function(){return Rc},updateNotificationIsPinned:function(){return Cc},updateNotificationStatus:function(){return Dc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Nc},getAudits:function(){return _c},getAuditsStats:function(){return Mc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Yc},deleteEmailSubscriptions:function(){return Hc},deleteSMSConfiguration:function(){return nu},deleteSMSSubscriptions:function(){return eu},deleteSlackConfiguration:function(){return jc},deleteWebhooksConfiguration:function(){return au},getCategories:function(){return cu},getChannelMaps:function(){return uu},getEmailConfiguration:function(){return Bc},getSMSConfiguration:function(){return Qc},getSlackChannels:function(){return Vc},getSlackConfiguration:function(){return Gc},getSlackScope:function(){return xc},getWebhookLog:function(){return ru},getWebhooksConfigurations:function(){return ou},patchEmailConfiguration:function(){return qc},patchSMSConfiguration:function(){return Zc},postEmailConfiguration:function(){return zc},postSMSConfiguration:function(){return Xc},postSlackCode:function(){return Kc},postSlackConfiguration:function(){return Wc},postWebhookRetry:function(){return su},postWebhookTest:function(){return lu},postWebhooksConfiguration:function(){return iu},putEmailSubscriptions:function(){return Jc},putSMSSubscriptions:function(){return tu}});var d={};n.r(d),n.d(d,{getSettings:function(){return yu},updateSettings:function(){return du}});var y={};n.r(y),n.d(y,{addRole:function(){return vu},attachPermissionToRoles:function(){return ku},attachPermissionsToRole:function(){return bu},deleteRole:function(){return hu},getPermissionCategories:function(){return Tu},getPermissions:function(){return Au},getRoles:function(){return Su},updateRole:function(){return mu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},TenantCreatedAction:function(){return id},TrialEndAction:function(){return od},cancelManagedSubscription:function(){return Cu},cancelSubscription:function(){return Lu},createStripeCustomer:function(){return Bu},createStripePaymentMethodSetupIntentSecret:function(){return qu},createSubscription:function(){return ju},createTenantConfiguration:function(){return Yu},getManagedSubscription:function(){return wu},getManagedSubscriptions:function(){return Du},getPaymentMethod:function(){return Vu},getPaymentMethods:function(){return xu},getPaymentProviders:function(){return Qu},getStripeCustomer:function(){return Ku},getStripePaymentProviderConfiguration:function(){return zu},getSubscription:function(){return Iu},getSubscriptionInvoice:function(){return Fu},getSubscriptionInvoicePdf:function(){return $u},getSubscriptionInvoices:function(){return Nu},getSubscriptionPlan:function(){return Mu},getSubscriptionPlans:function(){return _u},getSubscriptionSummaries:function(){return Hu},getSubscriptions:function(){return Pu},getTenantConfiguration:function(){return Ju},getVendorPublicConfigurations:function(){return Xu},renewManagedSubscription:function(){return Ru},renewSubscription:function(){return Eu},updateManagedSubscription:function(){return Uu},updatePaymentMethodBillingDetails:function(){return Wu},updateSubscription:function(){return Ou}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return ad}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return cd},addUserToTenantAndSubTenants:function(){return ld},loadAllUsers:function(){return rd},removeUserFromTenantAndSubTenants:function(){return sd},removeUserRolesFromSubTenants:function(){return ud},setUserRolesForSubTenants:function(){return dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return fd},loadFeatureFlags:function(){return pd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},deleteConfiguration:function(){return hd},getConfigs:function(){return gd},updateConfiguration:function(){return Sd}});var h={};n.r(h),n.d(h,{impersonate:function(){return bd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Od},addUsersToGroup:function(){return Dd},createGroup:function(){return Id},deleteGroup:function(){return Ed},deleteRolesFromGroup:function(){return wd},deleteUsersFromGroup:function(){return Cd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Rd},getGroups:function(){return Td},getGroupsByIds:function(){return Pd},updateGroup:function(){return Ld},updateGroupConfiguration:function(){return Ud}});var b={};n.r(b),n.d(b,{AuthStrategyEnum:function(){return Lr},ContextHolder:function(){return ra},FeatureFlags:function(){return fd},FronteggApiError:function(){return sa},FronteggContext:function(){return la},GroupManagedByEnum:function(){return zd},GroupRelations:function(){return Bd},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Nd},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return _d},SocialLoginProviders:function(){return Ir},TenantType:function(){return $d},UserManagedByEnum:function(){return Fd},WebAuthnDeviceType:function(){return Md},api:function(){return qd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return Hd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Gd},fronteggRefreshTokenUrl:function(){return xd},fronteggSilentRefreshTokenUrl:function(){return Vd},fronteggTenantsUrl:function(){return jd},fronteggUsersUrl:function(){return Wd},getConfigs:function(){return gd},loadFeatureFlags:function(){return pd},updateConfiguration:function(){return Sd}});var A={};function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){return 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},T(e)}function P(e){var t=function(e,t){if("object"!==T(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==T(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===T(t)?t:String(t)}function I(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,P(o.key),o)}}function L(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(A),n.d(A,{AccountPageFields:function(){return $P},DomainRestrictionsTabFields:function(){return KP},GeneralSettingsTabFields:function(){return WP},InviteUserModalFields:function(){return FP},IpRestrictionsTabFields:function(){return jP},Metadata:function(){return CP},PrivacyPageFields:function(){return NP},ProfilePageFields:function(){return MP},SecurityPageTabs:function(){return xP},SessionManagementTabFields:function(){return VP},SsoPageTabs:function(){return BP},SubscriptionsPageFields:function(){return GP},alpha:function(){return AP},fieldAppearance:function(){return zP},tabAppearance:function(){return qP}});var E=function(){function e(){k(this,e)}return L(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 O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},O.apply(this,arguments)}function w(e,t,n,o,i,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){w(a,o,i,r,l,"next",e)}function l(e){w(a,o,i,r,l,"throw",e)}r(void 0)}))}}E._apps={};var C=n(841),R=n.n(C);function U(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function _(e){return!!e&&!!e[be]}function M(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)===Ae}(e)||Array.isArray(e)||!!e[me]||!!e.constructor[me]||V(e)||W(e))}function N(e,t,n){void 0===n&&(n=!1),0===F(e)?(n?Object.keys:ke)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function F(e){var t=e[be];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:V(e)?2:W(e)?3:0}function $(e,t){return 2===F(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function G(e,t,n){var o=F(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function x(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function V(e){return ge&&e instanceof Map}function W(e){return Se&&e instanceof Set}function j(e){return e.o||e.t}function K(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Te(e);delete t[be];for(var n=ke(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function B(e,t){return void 0===t&&(t=!1),q(e)||_(e)||!M(e)||(F(e)>1&&(e.set=e.add=e.clear=e.delete=z),Object.freeze(e),t&&N(e,(function(e,t){return B(t,!0)}),!0)),e}function z(){U(2)}function q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function H(e){var t=Pe[e];return t||U(18,e),t}function J(){return fe}function Y(e,t){t&&(H("Patches"),e.u=[],e.s=[],e.v=t)}function Q(e){X(e),e.p.forEach(ee),e.p=null}function X(e){e===fe&&(fe=e.l)}function Z(e){return fe={p:[],l:fe,h:e,m:!0,_:0}}function ee(e){var t=e[be];0===t.i||1===t.i?t.j():t.O=!0}function te(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||H("ES5").S(t,e,o),o?(n[be].P&&(Q(t),U(4)),M(e)&&(e=ne(t,e),t.l||ie(t,e)),t.u&&H("Patches").M(n[be].t,e,t.u,t.s)):e=ne(t,n,[]),Q(t),t.u&&t.v(t.u,t.s),e!==he?e:void 0}function ne(e,t,n){if(q(t))return t;var o=t[be];if(!o)return N(t,(function(i,a){return oe(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return ie(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=K(o.k):o.o;N(3===o.i?new Set(i):i,(function(t,a){return oe(e,o,i,t,a,n)})),ie(e,i,!1),n&&e.u&&H("Patches").R(o,n,e.u,e.s)}return o.o}function oe(e,t,n,o,i,a){if(_(i)){var r=ne(e,i,a&&t&&3!==t.i&&!$(t.D,o)?a.concat(o):void 0);if(G(n,o,r),!_(r))return;e.m=!1}if(M(i)&&!q(i)){if(!e.h.F&&e._<1)return;ne(e,i),t&&t.A.l||ie(e,i)}}function ie(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&B(t,n)}function ae(e,t){var n=e[be];return(n?j(n):e)[t]}function re(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function le(e){e.P||(e.P=!0,e.l&&le(e.l))}function se(e){e.o||(e.o=K(e.t))}function ce(e,t,n){var o=V(t)?H("MapSet").N(t,n):W(t)?H("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={i:n?1:0,A:t?t.A:J(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=o,a=Ie;n&&(i=[o],a=Le);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):H("ES5").J(t,n);return(n?n.A:J()).p.push(o),o}function ue(e){return _(e)||U(22,e),function e(t){if(!M(t))return t;var n,o=t[be],i=F(t);if(o){if(!o.P&&(o.i<4||!H("ES5").K(o)))return o.t;o.I=!0,n=de(t,i),o.I=!1}else n=de(t,i);return N(n,(function(t,i){o&&function(e,t){return 2===F(e)?e.get(t):e[t]}(o.t,t)===i||G(n,t,e(i))})),3===i?new Set(n):n}(e)}function de(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return K(e)}var ye,fe,pe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ge="undefined"!=typeof Map,Se="undefined"!=typeof Set,ve="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,he=pe?Symbol.for("immer-nothing"):((ye={})["immer-nothing"]=!0,ye),me=pe?Symbol.for("immer-draftable"):"__$immer_draftable",be=pe?Symbol.for("immer-state"):"__$immer_state",Ae=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(e){var t={};return ke(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Pe={},Ie={get:function(e,t){if(t===be)return e;var n=j(e);if(!$(n,t))return function(e,t,n){var o,i=re(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!M(o)?o:o===ae(e.t,t)?(se(e),e.o[t]=ce(e.A.h,o,e)):o},has:function(e,t){return t in j(e)},ownKeys:function(e){return Reflect.ownKeys(j(e))},set:function(e,t,n){var o=re(j(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=ae(j(e),t),a=null==i?void 0:i[be];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(x(n,i)&&(void 0!==n||$(e.t,t)))return!0;se(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!==ae(e.t,t)||t in e.t?(e.D[t]=!1,se(e),le(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=j(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){U(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){U(12)}},Le={};N(Ie,(function(e,t){Le[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Le.deleteProperty=function(e,t){return Le.set.call(this,e,t,void 0)},Le.set=function(e,t,n){return Ie.set.call(this,e[0],t,n,e[0])};var Ee=function(){function e(e){var t=this;this.g=ve,this.F=!0,this.produce=function(e,n,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&U(6),void 0!==o&&"function"!=typeof o&&U(7),M(e)){var l=Z(t),s=ce(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Q(l):X(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Y(l,o),te(e,l)}),(function(e){throw Q(l),e})):(Y(l,o),te(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===he&&(r=void 0),t.F&&B(r,!0),o){var u=[],d=[];H("Patches").M(e,r,u,d),o(u,d)}return r}U(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){M(e)||U(8),_(e)&&(e=ue(e));var t=Z(this),n=ce(this,e,void 0);return n[be].C=!0,X(t),n},t.finishDraft=function(e,t){var n=(e&&e[be]).A;return Y(n,t),te(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ve&&U(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=H("Patches").$;return _(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Oe=new Ee,we=Oe.produce,De=(Oe.produceWithPatches.bind(Oe),Oe.setAutoFreeze.bind(Oe),Oe.setUseProxies.bind(Oe),Oe.applyPatches.bind(Oe),Oe.createDraft.bind(Oe),Oe.finishDraft.bind(Oe),we);function Ce(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _e(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 Me="function"==typeof Symbol&&Symbol.observable||"@@observable",Ne=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Ne(),REPLACE:"@@redux/REPLACE"+Ne(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ne()}};function $e(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 Ge(e,t,n){var o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Ge)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(_e(3));return a}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(s)throw new Error(_e(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(_e(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!$e(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(s)throw new Error(_e(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(_e(10));i=e,y({type:Fe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_e(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Me]=function(){return this},e}return y({type:Fe.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Me]=p,o}function xe(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(_e(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function Ve(){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),o=function(){throw new Error(_e(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=Ve.apply(void 0,a)(n.dispatch),Ue(Ue({},n),{},{dispatch:o})}}}function je(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var Ke=je();Ke.withExtraArgument=je;var Be,ze=Ke,qe=(Be=function(e,t){return Be=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])},Be(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}Be(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),He=function(e,t){for(var n=0,o=t.length,i=e.length;n<o;n++,i++)e[i]=t[n];return e},Je=Object.defineProperty,Ye=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Qe=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ze=function(e,t,n){return t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},et=function(e,t){for(var n in t||(t={}))Qe.call(t,n)&&Ze(e,n,t[n]);if(Ye)for(var o=0,i=Ye(t);o<i.length;o++)n=i[o],Xe.call(t,n)&&Ze(e,n,t[n]);return e},tt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ve:Ve.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var nt=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return qe(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,He([void 0],e[0].concat(this)))):new(t.bind.apply(t,He([void 0],e.concat(this))))},t}(Array);function ot(e){return M(e)?De(e,(function(){})):e}function it(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new nt);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(ze):o.push(ze.withExtraArgument(n.extraArgument))),o}function at(e){var t,n=function(e){return it(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=xe(a)}var p=l;"function"==typeof p&&(p=p(n));var g=We.apply(void 0,p),S=Ve;c&&(S=tt(et({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=He([g],f):"function"==typeof f&&(v=f(v)),Ge(t,d,S.apply(void 0,v))}function rt(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return et(et({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function lt(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function st(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:ot(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?lt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=et(et({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?lt(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return ot(e())};else{var c=ot(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=He([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(_(e))return void 0===(o=n(e,t))?e:o;if(M(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?rt(c,o):rt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var ct="listenerMiddleware";rt(ct+"/add"),rt(ct+"/removeAll"),rt(ct+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[be];return Ie.get(t,e)},set:function(t){var n=this[be];Ie.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][be];if(!i.P)switch(i.i){case 5:o(i)&&le(i);break;case 4:n(i)&&le(i)}}}function n(e){for(var t=e.t,n=e.k,o=ke(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==be){var r=t[a];if(void 0===r&&!$(t,a))return!0;var l=n[a],s=l&&l[be];if(s?s.t!==r:!x(l,r))return!0}}var c=!!t[be];return o.length!==ke(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Pe[e]||(Pe[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Te(n);delete a[be];for(var r=ke(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:J(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,be,{value:a,writable:!0}),i},S:function(e,n,i){i?_(n)&&n[be].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[be];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)N(a,(function(t){t!==be&&(void 0!==i[t]||$(i,t)?r[t]||e(a[t]):(r[t]=!0,le(n)))})),N(i,(function(e){void 0!==a[e]||$(a,e)||(r[e]=!1,le(n))}));else if(5===l){if(o(n)&&(le(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const ut=(e,t)=>n=>O({},n,{[e]:t[e]}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),yt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return O({},n,{[e]:O({},n[e],{[t]:O({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{loaders:O({},t[e].loaders,{[n.key]:null==(o=n.value)||o})})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return O({},t,{[e]:O({},t[e],{errors:O({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),gt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),St=(e,t,n)=>o=>{var i;return O({},o,{[e]:O({},o[e],{[t]:O({},null==o||null==(i=o[e])?void 0:i[t],n)})})},vt=(e=500)=>new Promise((t=>setTimeout(t,e))),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",mt=new Uint8Array(256);for(let e=0;e<ht.length;e++)mt[ht.charCodeAt(e)]=e;const bt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=mt[e.charCodeAt(o)],a=mt[e.charCodeAt(o+1)],r=mt[e.charCodeAt(o+2)],l=mt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},At=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(At(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let o,i="";for(o=0;o<n;o+=3)i+=ht[t[o]>>2],i+=ht[(3&t[o])<<4|t[o+1]>>4],i+=ht[(15&t[o+1])<<2|t[o+2]>>6],i+=ht[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=At(e[n]);return t}return e};let kt,Tt,Pt;!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"}(kt||(kt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Tt||(Tt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Pt||(Pt={}));const It="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Lt="HOSTED_LOGIN_VERIFIER_KEY",Et="auth",Ot="connectivity",wt="auditLogs",Dt="vendor",Ct={flow:Tt.Login,step:kt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:dt("loginState"),resetLoginState:ut("loginState",{loginState:Ct})},Ut={requestAuthorize:rt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:rt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:rt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:rt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:rt("auth/afterAuthNavigation"),preLogin:rt("auth/preLogin",(e=>({payload:e}))),postLogin:rt("auth/postLogin",(e=>({payload:e}))),login:rt("auth/login",(e=>({payload:e}))),loginWithMfa:rt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:rt("auth/recoverMfa",(e=>({payload:e}))),logout:rt("auth/logout",(e=>({payload:e}))),silentLogout:rt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:rt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:rt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:rt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:rt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:rt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:rt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:rt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:rt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:rt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:rt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:rt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:rt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:rt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:rt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:rt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:rt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:rt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:rt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:rt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:rt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:rt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let _t;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(_t||(_t={}));const Mt={step:_t.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Nt={setActivateState:dt("activateState"),resetActivateState:ut("activateState",{activateState:Mt}),setActivateStrategyState:yt("activateState","activationStrategy")},Ft={activateAccount:rt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:rt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:rt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:rt("auth/resendActivationEmail",(e=>({payload:e})))};let $t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}($t||($t={}));const Gt={step:$t.validate},xt={setAcceptInvitationState:dt("acceptInvitationState"),resetAcceptInvitationState:ut("acceptInvitationState",{acceptInvitationState:Gt})},Vt={acceptInvitation:rt("auth/acceptInvitation",(e=>({payload:e})))};let Wt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Wt||(Wt={}));const jt={step:Wt.forgotPassword,loading:!1,email:"",passwordConfig:null},Kt={setForgotPasswordState:dt("forgotPasswordState"),resetForgotPasswordState:ut("forgotPasswordState",{forgotPasswordState:jt})},Bt={forgotPassword:rt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:rt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:rt("auth/loadPasswordConfig",(e=>({payload:e})))};let zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(zt||(zt={}));const qt={step:zt.ResetPhoneNumber,loading:!1},Ht={setResetPhoneNumberState:dt("resetPhoneNumberState"),resetResetPhoneNumberState:ut("resetPhoneNumberState",{resetPhoneNumberState:qt})},Jt={resetPhoneNumber:rt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:rt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:rt("auth/changePhoneNumber",(e=>({payload:e})))},Yt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Qt={setSSOLoader:ft("ssoState"),setSSOError:pt("ssoState"),setSSOState:dt("ssoState"),resetSSOState:ut("ssoState",{ssoState:Yt})},Xt={loadSSOConfigurationsV2:rt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:rt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:rt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:rt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:rt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:rt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:rt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:rt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:rt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:rt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:rt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:rt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:rt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:rt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:rt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:rt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:rt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:rt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:rt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:rt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:rt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:rt("auth/oidcPostlogin",(e=>({payload:e})))},Zt={loading:!1,error:null},en={setProfileState:dt("profileState"),resetProfileState:ut("profileState",{profileState:Zt})},tn={loadProfile:rt("auth/loadProfile"),saveProfile:rt("auth/saveProfile",(e=>({payload:e}))),changePassword:rt("auth/changePassword",(e=>({payload:e})))};let nn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(nn||(nn={}));const on={step:nn.verify,loading:!1,saving:!1},an={setMfaState:dt("mfaState"),resetMfaState:ut("mfaState",{mfaState:on})},rn={enrollMfa:rt("auth/enrollMfa"),getMFADevices:rt("auth/getMFADevices"),getMFAStrategies:rt("auth/getMFAStrategies"),verifyMfa:rt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:rt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:rt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:rt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:rt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:rt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:rt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:rt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:rt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:rt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:rt("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}},sn={setTeamLoader:ft("teamState"),setTeamError:pt("teamState"),setTeamState:dt("teamState"),resetTeamState:ut("teamState",{teamState:ln})},cn={loadUsers:rt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:rt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:rt("auth/loadRoles",(e=>({payload:e}))),addUser:rt("auth/addUser",(e=>({payload:e}))),addUsersBulk:rt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:rt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:rt("auth/updateUser",(e=>({payload:e}))),deleteUser:rt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:rt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:rt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:rt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:rt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:rt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:rt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:rt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:rt("auth/getInvitationLink"),createInvitationLink:rt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:rt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:rt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:rt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:rt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:rt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:rt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:rt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:rt("auth/closeLockUserDialog",(e=>({payload:e})))},un={firstLoad:!0,loading:!1,error:""},dn={setSocialLoginsState:dt("socialLoginState"),resetSocialLoginsState:ut("socialLoginState",{socialLoginState:un})},yn={loadSocialLoginsConfiguration:rt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:rt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:rt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:rt("auth/setSocialLoginError",(e=>({payload:e})))};let fn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(fn||(fn={}));const pn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:fn.SignUp},gn={setSignUpState:dt("signUpState"),resetSignUpState:ut("signUpState",{signUpState:pn})},Sn={signUpUser:rt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:rt("auth/resetSignUpStateSoft")},vn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},hn={setApiTokensLoader:ft("apiTokensState"),setApiTokensError:pt("apiTokensState"),setApiTokensState:dt("apiTokensState"),resetApiTokensState:ut("apiTokensState",{apiTokensState:vn})},mn={loadApiTokens:rt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:rt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:rt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:rt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:rt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:rt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:rt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:rt("auth/deleteTenantApiToken",(e=>({payload:e})))},bn={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}},An={setSecurityPolicyState:dt("securityPolicyState"),setSecurityPolicyGlobalState:yt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:yt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:yt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:yt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:yt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:yt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:yt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:yt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:yt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:yt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:yt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ut("securityPolicyState",{securityPolicyState:bn})},kn={loadSecurityPolicy:rt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:rt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:rt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:rt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:rt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:rt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:rt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:rt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:rt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:rt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:rt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:rt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:rt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:rt("auth/loadPublicAuthStrategiesPolicy")},Tn={loading:!1},Pn={setAccountSettingsState:dt("accountSettingsState"),resetAccountSettingsState:ut("accountSettingsState",{accountSettingsState:Tn})},In={loadAccountSettings:rt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:rt("auth/saveAccountSettings",(e=>({payload:e})))},Ln={tenants:[],subTenants:[],loading:!0,tenantTree:null},En={setTenantsState:dt("tenantsState"),resetTenantsState:ut("tenantsState",{tenantsState:Ln})},On={switchTenant:rt("auth/switchTenant",(e=>({payload:e}))),loadTenants:rt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:rt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:rt("auth/loadSubTenantsTree",(e=>({payload:e})))},wn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:dt("rolesState"),resetRolesState:ut("rolesState",{rolesState:wn})},Cn={loadRolesAndPermissions:rt("auth/loadRoles",(e=>({payload:e}))),addRole:rt("auth/addRole",(e=>({payload:e}))),updateRole:rt("auth/updateRole",(e=>({payload:e}))),deleteRole:rt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:rt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:rt("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Un={setSessionsState:dt("sessionsState"),resetSessionsState:ut("sessionsState",{sessionsState:Rn})},_n={loadUserSessions:rt("auth/loadUserSessions"),loadCurrentUserSession:rt("auth/loadCurrentUserSession"),deleteUserSession:rt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:rt("auth/deleteAllUserSessions"),revokeUserSessions:rt("auth/revokeUserSessions",(e=>({payload:e})))},Mn={loading:!1,configurations:{}},Nn={setSessionsPolicyState:dt("sessionsPolicyState"),resetSessionsPolicyState:ut("sessionsPolicyState",{sessionsPolicyState:Mn})},Fn={loadSessionsPolicy:rt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:rt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let $n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}($n||($n={}));const Gn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:$n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},xn={setRestrictionsState:dt("restrictionsState"),setIpRestrictionsState:yt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:yt("restrictionsState","emailDomainRestrictions")},Vn={checkIfUserIpValid:rt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:rt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:rt("auth/loadIpRestrictions"),saveIpRestriction:rt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:rt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:rt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:rt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:rt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:rt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:rt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Wn={loading:!1},jn={setProvisioningState:dt("provisioningState"),resetProvisioningState:ut("provisioningState",{provisioningState:Wn})},Kn={loadProvisionConnections:rt("auth/loadProvisionConnections"),createProvisionConnection:rt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:rt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:rt("auth/updateProvisionConnection",(e=>({payload:e})))},Bn={devices:[],loading:!1,error:null},zn={setPasskeysState:dt("passkeysState"),resetPasskeysState:ut("passkeysState",{passkeysState:Bn})},qn={loadWebAuthnDevices:rt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:rt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Hn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Jn={setUsersGroupsLoader:ft("groupsState"),setUsersGroupsError:pt("groupsState"),setGroupsState:dt("groupsState"),resetUsersGroupsState:ut("groupsState",{groupsState:Hn})},Yn={loadGroups:rt("auth/loadUsersGroups"),getGroupById:rt("auth/getGroupById",(e=>({payload:e}))),createGroup:rt("auth/createGroup",(e=>({payload:e}))),updateGroup:rt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:rt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:rt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:rt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:rt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:rt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:rt("auth/getGroupConfiguration"),updateGroupConfiguration:rt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:rt("auth/getUsers",(e=>({payload:e})))},Qn={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}},Xn={setGroupsDialogsState:dt("groupsDialogsState"),resetGroupsDialogsState:ut("groupsState",{groupsDialogsState:Qn}),openAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:gt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:St("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:gt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:St("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:gt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:St("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Zn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:pn,loginState:Ct,activateState:Mt,acceptInvitationState:Gt,forgotPasswordState:jt,ssoState:Yt,profileState:Zt,mfaState:on,teamState:ln,groupsState:Hn,groupsDialogsState:Qn,socialLoginState:un,apiTokensState:vn,securityPolicyState:bn,accountSettingsState:Tn,tenantsState:Ln,rolesState:wn,resetPhoneNumberState:qt,sessionsState:Rn,sessionsPolicyState:Mn,restrictionsState:Gn,provisioningState:Wn,passkeysState:Bn},eo=O({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:()=>{}},Zn);let to;!function(e){e.impersonating="impersonating",e.success="success"}(to||(to={}));const no={step:to.impersonating,loading:!1},oo={setImpersonateState:dt("impersonateState"),resetImpersonateState:ut("impersonateState",{impersonateState:no})},io={impersonate:rt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ao,actions:ro}=st({name:Et,initialState:eo,reducers:O({resetState:e=>O({},e,Zn),setState:(e,{payload:t})=>O({},e,t),setUser:("user",(e,{payload:t})=>O({},e,{user:t}))},Rt,dn,Nt,oo,xt,Kt,Ht,gn,en,Qt,an,sn,Jn,Xn,hn,An,Pn,En,Dn,Un,Nn,xn,jn,zn)});const lo=O({},ro,Ut,yn,Ft,Vt,Bt,Jt,Sn,tn,Xt,rn,cn,Yn,{},mn,kn,In,On,Cn,_n,Fn,Vn,Kn,io,qn);var so=function(e){return"@@redux-saga/"+e},co=so("CANCEL_PROMISE"),uo=so("CHANNEL_END"),yo=so("IO"),fo=so("MATCH"),po=so("MULTICAST"),go=so("SAGA_ACTION"),So=so("SELF_CANCELLATION"),vo=so("TASK"),ho=so("TASK_CANCEL"),mo=so("TERMINATE"),bo=so("LOCATION");function Ao(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var ko=function(e){return null==e},To=function(e){return null!=e},Po=function(e){return"function"==typeof e},Io=function(e){return"string"==typeof e},Lo=Array.isArray,Eo=function(e){return e&&Po(e.then)},Oo=function(e){return e&&Po(e.next)&&Po(e.throw)},wo=function e(t){return t&&(Io(t)||Ro(t)||Po(t)||Lo(t)&&t.every(e))},Do=function(e){return e&&Po(e.take)&&Po(e.close)},Co=function(e){return Po(e)&&e.hasOwnProperty("toString")},Ro=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Uo=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[co]=function(){clearTimeout(n)},o},_o=function(e){return function(){return e}},Mo=_o(!0),No=function(){},Fo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var $o=function(e,t){O(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Go(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var xo=function(e){throw e},Vo=function(e){return{value:e,done:!0}};function Wo(e,t,n){void 0===t&&(t=xo),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Vo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function jo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ko=function(e){return Array.apply(null,new Array(e))},Bo=function(e){return function(t){return e(Object.defineProperty(t,go,{value:!0}))}},zo=function(e){return e===mo},qo=function(e){return e===ho},Ho=function(e){return zo(e)||qo(e)};function Jo(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Lo(e)?Ko(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||Ho(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=No,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function Yo(e){return{name:e.name||"anonymous",location:Qo(e)}}function Qo(e){return e[bo]}var Xo=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Zo="TAKE",ei="CALL",ti="FORK",ni="SELECT",oi=function(e,t){var n;return(n={})[yo]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function ii(e,t){return void 0===e&&(e="*"),wo(e)?(To(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),oi(Zo,{pattern:e})):Do(n=e)&&n[po]&&To(t)&&wo(t)?oi(Zo,{channel:e,pattern:t}):Do(e)?(To(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),oi(Zo,{channel:e})):void 0;var n}function ai(e,t){return ko(t)&&(t=e,e=void 0),oi("PUT",{channel:e,action:t})}function ri(e){var t=oi("ALL",e);return t.combinator=!0,t}function li(e,t){var n,o=null;return Po(e)?n=e:(Lo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&Io(n)&&Po(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function si(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ei,li(e,n))}function ci(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ti,li(e,n))}function ui(e){return void 0===e&&(e=So),oi("CANCEL",e)}function di(e){void 0===e&&(e=Fo);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return oi(ni,{selector:e,args:n})}var yi=si.bind(null,Uo);var fi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},pi=[],gi=0;function Si(e){try{mi(),e()}finally{bi()}}function vi(e){pi.push(e),gi||(mi(),Ai())}function hi(e){try{return mi(),e()}finally{Ai()}}function mi(){gi++}function bi(){gi--}function Ai(){var e;for(bi();!gi&&void 0!==(e=pi.shift());)Si(e)}var ki=function(e){return function(t){return e.some((function(e){return Ei(e)(t)}))}},Ti=function(e){return function(t){return e(t)}},Pi=function(e){return function(t){return t.type===String(e)}},Ii=function(e){return function(t){return t.type===e}},Li=function(){return Mo};function Ei(e){var t="*"===e?Li:Io(e)?Pi:Lo(e)?ki:Co(e)?Pi:Po(e)?Ti:Ro(e)?Ii:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Oi={type:uo},wi=function(e){return e&&e.type===uo};function Di(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(Oi)}))},(e={})[po]=!0,e.put=function(e){if(!t)if(wi(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[fo](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Li),t?e(Oi):(e[fo]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),Go(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[go]?l(e):vi((function(){l(e)}))},r}function Ci(e,t){var n=e[co];Po(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ri,Ui=0,_i=function(){return++Ui};function Mi(e){e.isRunning()&&e.cancel()}var Ni=((Ri={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!wi(e)||r?n(e):n(mo)};try{i.take(l,To(a)?Ei(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ri.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;vi((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Eo(t)?Ci(t,n):n(t)}))},Ri.ALL=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t);if(0!==r.length){var l=Jo(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Lo(t)?[]:{})},Ri.RACE=function(e,t,n,o){var i=o.digestEffect,a=Ui,r=Object.keys(t),l=Lo(t)?Ko(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||Ho(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=No,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},Ri.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(Eo(s))return void Ci(s,n);if(Oo(s))return void zi(e,s,l.context,Ui,Yo(a),!1,n);n(s)}catch(e){n(e,!0)}},Ri.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){ko(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ri.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(Oo(i))return i;var a=!1;return Wo((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Eo(i)})}))}catch(e){return Wo((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Yo(t)}(c,a);hi((function(){var t=zi(e,c,s.context,Ui,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ri.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Go(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Lo(t)){if(0===t.length)return void n([]);var r=Jo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ri.CANCEL=function(e,t,n,o){var i=o.task;t===So?Mi(i):Lo(t)?t.forEach(Mi):Mi(t),n()},Ri.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},Ri.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=Xo());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Oi):e.isEmpty()?(n.push(o),o.cancel=function(){Go(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(Oi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(Oi)}}}}(t.buffer),a=Ei(o),r=function t(n){wi(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},Ri.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},Ri.FLUSH=function(e,t,n){t.flush(n)},Ri.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},Ri.SET_CONTEXT=function(e,t,n,o){var i=o.task;$o(i.context,t),n()},Ri);function Fi(e,t){return e+"?"+t}function $i(e){var t=e.name,n=e.location;return n?t+" "+Fi(n.fileName,n.lineNumber):t}function Gi(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var xi=null,Vi=[],Wi=function(e){e.crashedEffect=xi,Vi.push(e)},ji=function(){xi=null,Vi.length=0},Ki=function(){var e,t,n=Vi[0],o=Vi.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Qo(e))?t.code+" "+Fi(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+$i(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+$i(e.meta)})),[Gi(Vi)]).join("\n")};function Bi(e,t,n,o,i,a,r){var l;void 0===r&&(r=No);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(Go(i,t),t.cont=No,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=No,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,Wi({meta:i,cancelledTasks:y}),S.isRoot){var o=Ki();ji(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===ho?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[vo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(ho,!1))},l.cont=r,l.end=g,l.setContext=function(e){$o(f,e)},l.toPromise=function(){return d||(d=fi(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function zi(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Eo(t)?Ci(t,o):Oo(t)?zi(e,t,c.context,n,i,!1,o):t&&t[yo]?(0,Ni[t.type])(e,t.payload,o,u):o(t)}));d.cancel=No;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(ho))},status:0},c=Bi(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),ji()):qo(e)?(s.status=1,d.cancel(),i=Po(t.return)?t.return(ho):{done:!0,value:ho}):i=zo(e)?Po(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=_i();function s(n,i){a||(a=!0,o.cancel=No,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){xi=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=No,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=No,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function qi(e,t){for(var n=e.channel,o=void 0===n?Di():n,i=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?jo: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=_i();if(s&&(s.rootSagaStarted=s.rootSagaStarted||No,s.effectTriggered=s.effectTriggered||No,s.effectResolved=s.effectResolved||No,s.effectRejected=s.effectRejected||No,s.effectCancelled=s.effectCancelled||No,s.actionDispatched=s.actionDispatched||No,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ve.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=Fo;var m={channel:o,dispatch:Bo(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return hi((function(){var e=zi(m,S,l,v,Yo(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var Hi=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?Di():a,l=n.sagaMonitor,s=Ao(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=qi.bind(null,O({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){$o(i,e)},c},Ji=function(e){return{done:!0,value:e}},Yi={};function Qi(e){return Do(e)?"channel":Co(e)?String(e):Po(e)?e.name:String(e)}function Xi(e,t,n){var o,i,a,r=t;function l(t,n){if(r===Yi)return Ji(t);if(n&&!i)throw r=Yi,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===Yi?Ji(t):a}return Wo(l,(function(e){return l(null,e)}),n)}function Zi(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Qi(e)+", "+t.name+")")}function ea(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:ii(e)},s=function(e){return{done:!1,value:ci.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:ui(e)}},u=function(e){return a=e},d=function(e){return r=e};return Xi({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+Qi(e)+", "+t.name+")")}function ta(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:ii(e)},l=function(e){return{done:!1,value:si.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return Xi({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Qi(e)+", "+t.name+")")}function na(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:si.apply(void 0,[n].concat(a))},s={done:!1,value:yi(t)};return Xi({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Yi}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function oa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[Zi,e,t].concat(o))}function ia(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ea,e,t].concat(o))}function aa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return ci.apply(void 0,[ta,e,t].concat(o))}class ra{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 ra.instance||(ra.instance=new ra),ra.instance}static setContext(e){ra.getInstance().context=e}static setAccessToken(e){ra.getInstance().accessToken=e}static setUser(e){ra.getInstance().user=e}static setOnRedirectTo(e){ra.getInstance().onRedirectTo=e}static setLogout(e,t){ra.getInstance().logout=n=>{n?e(n):ra.onRedirectTo(t)}}static getContext(){var e;return null!=(e=ra.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return ra.getInstance().accessToken}static getUser(){return ra.getInstance().user}static onRedirectTo(e,t){return ra.getInstance().onRedirectTo(e,t)}static logout(e){return ra.getInstance().logout(e)}}ra.instance=void 0;const la={getContext:()=>ra.getContext(),getAccessToken:()=>ra.getAccessToken(),getUser:()=>ra.getUser(),onRedirectTo:(e,t)=>ra.onRedirectTo(e,t),logout:e=>ra.logout(e)};class sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ca(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}const ua=async e=>{var t,n,o;const i=ra.getContext(),a=await async function(e,t){var n;const o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:ra.getAccessToken)(),i={};o&&(i.Authorization=`Bearer ${o}`),t&&(i["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))i[`${t.key}`]=`${t.value}`;return i["x-frontegg-source"]="frontegg-react",i}(i,e.contentType),r=await async function(e,t,n){const o=ca(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:O({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new sa("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new sa(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},da=async(e,t,n)=>ua(O({url:e,method:"GET",contentType:"application/json",params:t},n)),ya=async(e,t,n)=>ua(O({url:e,method:"POST",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>ua(O({url:e,method:"PATCH",contentType:"application/json",body:t},n)),pa=async(e,t,n)=>ua(O({url:e,method:"PUT",contentType:"application/json",body:t},n)),ga=async(e,t,n)=>ua(O({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Sa=async(e,t,n,o)=>ua(O({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),va={v1:"/identity/resources/users/webauthn/v1/devices"},ha={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ma={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",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"}}},ba={v1:"/identity/resources/configurations/v1"},Aa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ka={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ta={v1:"/identity/resources/permissions/v1"},Pa={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"}}},Ia={v1:"/identity/resources/roles/v1"},La={v1:"/identity/resources/sub-tenants/users/v1"},Ea={v1:"/identity/resources/impersonation/v1"},Oa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},wa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Da={v1:"/team/resources/members/v1"},Ca={v1:"/team/resources/roles/v1"},Ra={v1:"/team/resources/stats/v1"},Ua={v1:"/team/resources/profile"},_a={v1:"/tenants/resources/account-settings/v1"},Ma={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Na={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Fa={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"}}}},$a={v1:"/subscriptions/resources/payment-providers/v1"},Ga={v1:"/subscriptions/resources/subscriptions/v1"},xa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Va={v1:"/reports/engine/resources/triggers/v1"},Wa="/notification",ja="/audits",Ka={v1:"/event/resources/configurations/v1"},Ba="/webhook",za="/oauth",qa="/flags",Ha="/directory/resources/v1/configurations/scim2",Ja="/directory/resources/scim/temp";async function Ya(e){return pa(`${ma.v1}/tenant`,e)}async function Qa(){return da(`${ma.v2}/me/tenants`)}async function Xa(){return da(Ma.v1)}async function Za(){return da(Ma.tree.v1)}async function er(){return da(ba.v1)}async function tr(){return da(`${ba.v1}/mfa-policy`)}async function nr(){return da(`${ba.v1}/mfa-policy/vendor`)}async function or(e){return e.id?fa(`${ba.v1}/mfa-policy`,e):ya(`${ba.v1}/mfa-policy`,e)}async function ir(){return da(`${ba.v1}/lockout-policy`)}async function ar(){return da(`${ba.v1}/lockout-policy/vendor`)}async function rr(e){return e.id?fa(`${ba.v1}/lockout-policy`,e):ya(`${ba.v1}/lockout-policy`,e)}async function lr(){try{return await da(`${ba.v1}/captcha-policy/public`)}catch{return null}}async function sr(){return da(`${ba.v1}/password-history-policy`)}async function cr(){return da(`${ba.v1}/password-history-policy/vendor`)}async function ur(e){return e.id?fa(`${ba.v1}/password-history-policy`,e):ya(`${ba.v1}/password-history-policy`,e)}async function dr(){return da(`${ba.v1}/password`)}async function yr(){return da(`${Aa.emailDomain.v1}`)}async function fr(){return da(`${Aa.emailDomain.v1}/config`)}async function pr(e){return ya(`${Aa.emailDomain.v1}`,e)}async function gr(e){return ya(`${Aa.emailDomain.v1}/config`,e)}async function Sr(e){return ga(`${Aa.emailDomain.v1}/${e}`)}async function vr(e){return da(`${Aa.ip.v1}`,e)}async function hr(){return da(`${Aa.ip.v1}/config`)}async function mr(e){return ya(`${Aa.ip.v1}`,e)}async function br(e){return ya(`${Aa.ip.v1}/bulk`,e)}async function Ar(e){return ya(`${Aa.ip.v1}/config`,e)}async function kr(e){return ga(`${Aa.ip.v1}/${e}`)}async function Tr(){return ya(`${Aa.ip.v1}/verify`)}async function Pr(){return ya(`${Aa.ip.v1}/verify/allow`)}let Ir,Lr,Er;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ir||(Ir={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Lr||(Lr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Er||(Er={}));class Or extends Error{constructor(e){super(e)}}const wr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Or("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class Dr extends Error{constructor(e){super(e)}}const Cr=(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(wr(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 wr(t)}})(e.split(".")[n]))}catch(e){throw new Dr("Invalid token specified: "+e.message)}},Rr=["type"],Ur=["type"];async function _r(e){if(!e.accessToken)return e;ra.setAccessToken(e.accessToken);const t=await da(`${ma.v2}/me`),n=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(n),n}async function Mr(e){if(!e.accessToken)return{user:e};ra.setAccessToken(e.accessToken);const[t,n]=await Promise.all([da(`${ma.v2}/me`),Qa()]),o=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(o),{user:o,tenants:n}}async function Nr(e){ra.setAccessToken(e.id_token);const t=await da(`${ma.v2}/me`),n=e.id_token?Cr(e.id_token):{},o=O({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return ra.setUser(o),o}async function Fr(e){try{const{address:t}=await ya(`${ha.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function $r(e){return ya(`${ha.v1}/user/saml/prelogin`,e)}async function Gr(e){return _r(await ya(`${ha.v1}/user/saml/postlogin`,e))}async function xr(e){return _r(await ya(`${ha.v1}/user/oidc/postlogin`,e))}async function Vr(e){return _r(await ya(`${ha.v1}/user`,e))}async function Wr(e){return _r(await ya(`${ha.v1}/user/mfa/verify`,e))}async function jr(e){return ya(`${ma.v1}/activate`,e)}async function Kr(e){return da(`${ma.v1}/activate/strategy`,e)}async function Br(e){return ya(`${ma.v1}/activate/reset`,e)}async function zr(e){return ya(`${ma.v1}/invitation/reset`,e)}async function qr(e){return ya(`${ma.v1}/invitation/accept`,e)}async function Hr(){return _r(await ya(`${ha.v1}/user/token/refresh`))}async function Jr(){return Mr(await ya(`${ha.v1}/user/token/refresh`))}async function Yr(){return ya(`${ha.v1}/logout`)}async function Qr(e){return da(`${za}/logout`,e)}async function Xr(e){return ya(`${ma.v1}/passwords/reset`,e)}async function Zr(e){return ya(`${ma.v1}/passwords/reset/verify`,e)}async function el(e){return da(`${ma.v1}/passwords/config`,e)}async function tl(e){return ya(`${ha.v1}/user/mfa/recover`,e)}async function nl(){return ya(`${ma.v1}/mfa/enroll`)}async function ol(){return ya(`${ma.v1}/mfa/authenticator/enroll`)}async function il(e){return ya(`${ma.v1}/mfa/authenticator/enroll/verify`,e)}async function al(e){return ya(`${ma.v1}/mfa/sms/enroll`,e)}async function rl(e){return ya(`${ma.v1}/mfa/sms/enroll/verify`,e)}async function ll(){return ya(`${ma.v1}/mfa/webauthn/enroll`)}async function sl(e){return ya(`${ma.v1}/mfa/webauthn/enroll/verify`,e)}async function cl(e){return ya(`${ma.v1}/mfa/enroll/verify`,e)}async function ul(e){return ya(`${ma.v1}/mfa/disable`,e)}async function dl(e,t){return ya(`${ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function yl(e){return ya(`${ma.v1}/mfa/sms/${e}/disable`)}async function fl(e,t){return ya(`${ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function pl(e){return ya(`${ma.v1}/mfa/webauthn/${e}/disable`)}async function gl(e,t){return ya(`${ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Sl(){return da(`${ma.v1}/mfa/devices`)}async function vl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll`,e)}async function hl(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ml(e,t){return ya(`${ha.v1}/user/mfa/authenticator/${e}/verify`,t)}async function bl(e){return ya(`${ha.v1}/user/mfa/sms/enroll`,e)}async function Al(e){return ya(`${ha.v1}/user/mfa/sms/enroll/verify`,e)}async function kl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}`,t)}async function Tl(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}/verify`,t)}async function Pl(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll`,e)}async function Il(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Ll(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}`,t)}async function El(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Ol(){return da(`${wa.v1}/saml/configurations`)}async function wl(e){return ya(`${wa.v1}/saml/configurations`,e)}async function Dl(){return da(`${wa.v1}/saml/configurations/vendor-config`)}async function Cl(e){return pa(`${wa.v1}/saml/configurations/metadata`,e)}async function Rl(){return pa(`${wa.v1}/saml/validations/domain`)}async function Ul(){return da(`${wa.v1}/saml/configurations/roles/default`)}async function _l(){return da(`${wa.v2}/saml/configurations/groups`)}async function Ml({roleIds:e}){return ya(`${wa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Nl({roleIds:e,group:t}){return ya(`${wa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Fl({roleIds:e,group:t,id:n}){return fa(`${wa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function $l({id:e}){return ga(`${wa.v2}/saml/configurations/groups/${e}`)}async function Gl(){return da(`${wa.v1}/oidc/configurations`)}async function xl(){return da(`${wa.v2}/configurations/public`)}async function Vl(){return da(ka.v1)}async function Wl(){return da(ka.v2)}async function jl(){return da(ka.custom.v1)}async function Kl({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),ya(`${ha.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Bl(){return da(`${ba.v1}/public`)}async function zl(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await ya(`${ma.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await _r(n):void 0,userId:o,tenantId:i}}async function ql(){return da(ma.sessions.currentUser.v1)}async function Hl(){return da(`${ma.sessions.currentUser.v1}/current`)}async function Jl(e){return ya(`${ma.sessions.v1}/revoke`,{userId:e})}async function Yl(){return da(ma.sessions.configurations.v1)}async function Ql(e){await ya(ma.sessions.configurations.v1,e)}async function Xl(e){await ga(`${ma.sessions.currentUser.v1}/${e}`)}async function Zl(){await ga(`${ma.sessions.currentUser.v1}/all`)}async function es(){return da(ma.accessTokens.v1)}async function ts(){return da(Pa.accessTokens.v1)}async function ns({id:e}){return ga(`${Pa.accessTokens.v1}/${e}`)}async function os({id:e}){return ga(`${ma.accessTokens.v1}/${e}`)}async function is(e){return ya(ma.accessTokens.v1,e)}async function as(e){return ya(Pa.accessTokens.v1,e)}async function rs(){return da(ma.apiTokens.v1)}async function ls(){return da(Pa.apiTokens.v1)}async function ss(e){return ya(ma.apiTokens.v1,e)}async function cs(e){return ya(Pa.apiTokens.v2,e)}async function us({tokenId:e}){return ga(`${Pa.apiTokens.v1}/${e}`)}async function ds({tokenId:e}){return ga(`${ma.apiTokens.v1}/${e}`)}async function ys({userId:e}){return da(`${ma.v1}/${e}`)}async function fs(e){return da(`${ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ps(e){let{type:t}=e,n=Ao(e,Rr);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function gs(e){let{type:t}=e,n=Ao(e,Ur);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Ss({token:e}){return ya(Pa.invites.verify.v1,{token:e})}async function vs(){return da(`${wa.v1}/configurations`)}async function hs(e){return ya(`${wa.v1}/configurations`,e)}async function ms(e,t){return fa(`${wa.v1}/configurations/${e}`,t)}async function bs(e){return ga(`${wa.v1}/configurations/${e}`)}async function As(e){return ya(`${wa.v1}/configurations/metadata`,e)}async function ks(e,t){return pa(`${wa.v1}/configurations/${e}/metadata`,t)}async function Ts(e,t){return ya(`${wa.v1}/configurations/${e}/domains`,t)}async function Ps(e,t){return ga(`${wa.v1}/configurations/${e}/domains/${t}`)}async function Is(e,t){return pa(`${wa.v1}/configurations/${e}/domains/${t}/validate`)}async function Ls(e){return da(`${wa.v1}/configurations/${e}/roles`)}async function Es(e,t){return pa(`${wa.v1}/configurations/${e}/roles`,t)}async function Os(e,t){return ya(`${wa.v1}/configurations/${e}/groups`,t)}async function ws(e,{roleIds:t,group:n,id:o}){return fa(`${wa.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Ds(e,t){return ga(`${wa.v1}/configurations/${e}/groups/${t}`)}async function Cs(e){return da(`${wa.v1}/configurations/${e}/groups`)}async function Rs(e){return ya(`${ha.v2}/user/sso/prelogin`,e)}async function Us(e){return _r(await ya(`${ha.v2}/user/oidc/postlogin`,e))}async function _s(e){return Nr(await ya(`${za}/token`,e))}async function Ms(){return Nr(await ya(`${za}/authorize/silent`))}async function Ns(e){return ya(`${ma.v1}/phone/reset`,e)}async function Fs(e){return ya(`${ma.v1}/phone/reset/verify`,e)}async function $s(e){return ya(`${ma.v1}/phone`,e)}async function Gs(e){return ya(`${ma.v1}/phone/verify`,e)}async function xs(e){return pa(`${ma.v1}/phone/change`,e)}async function Vs(e){return ya(`${ha.v1}/webauthn/prelogin`,e)}async function Ws(e){return ya(`${ha.v1}/webauthn/postlogin`,e)}async function js(){return ya(va.v1)}async function Ks(){return da(va.v1)}async function Bs(e){return ga(`${va.v1}/${e}`)}async function zs(e){return ya(`${va.v1}/verify`,e)}async function qs(){return da(`${ba.v1}/auth/strategies/public`)}async function Hs(){return da(`${ba.v1}/mfa/strategies`)}async function Js(e){return da(`${ma.v2}/me`,null!=e?e:{addRoles:!0})}async function Ys(e){return pa(`${ma.v2}/me`,e)}async function Qs(e){return pa(`${Ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Xs(e){return ya(`${ma.v1}/passwords/change`,e)}async function Zs(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>O({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return da(Da.v1,O({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function ec(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function tc(e){return ga(`${Da.v1}/${e.userId}`)}async function nc(e){return pa(Da.v1,e)}async function oc(e){return ya(Pa.invites.user.v1,O({},e))}async function ic(e){return fa(Pa.invites.user.v1,O({},e))}async function ac(){return ga(Pa.invites.user.v1)}async function rc(){return da(Pa.invites.user.v1)}async function lc(){return da(Pa.invites.configuration.v1)}async function sc(){return da(Ca.v1)}async function cc(){return da(Ta.v1)}async function uc(){return da(`${Ra.v1}/members`)}async function dc(e){return ya(`${Da.v1}/${e.userId}/resendActivationEmail`,{})}async function yc(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function fc(e){return ya(ma.invitation.resendAll.v1,O({},e))}async function pc(e){var t,n;const o=await da("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function gc(){const e=await da("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Sc=async()=>pc({entityName:"notifications"}),vc=async()=>pc({entityName:"saml"}),hc=async()=>pc({entityName:"audits"}),mc=async e=>async function(e){const t=await da(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),bc=["dataFilters"],Ac=["templateId","dataFilters"],kc=["dataFilters"];async function Tc(e){return da(`${xa.v2}/tenant-reports`,e)}async function Pc(e){return da(`${xa.v2}/${e.id}/tenant-reports`)}async function Ic(e){let{dataFilters:t}=e,n=Ao(e,bc);return{html:await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lc(e){let{templateId:t,dataFilters:n}=e,o=Ao(e,Ac);return ya(`${xa.v2}/${t}/tenant-reports`,O({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Ec(e){let{dataFilters:t}=e,n=Ao(e,kc);const o=await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Oc(e){return ya(`${Va.v1}/tenant-reports`,e)}async function wc(e){return da(Wa,{params:e})}async function Dc(e){return pa(`${Wa}/status`,{params:e})}async function Cc(e){const{notificationId:t,pinStatus:n}=e;return pa(`${Wa}/${n}`,{notificationId:t})}async function Rc(){return ya(`${Wa}/status/mark-all-read`)}const Uc=["endpoint","headerProps"];async function _c(e){return da(ja,e)}async function Mc(e){return da(`${ja}/stats`,e)}async function Nc(e){const{endpoint:t,headerProps:n}=e,o=Ao(e,Uc);return Sa(`${ja}/export/${t}`,{properties:n},o)}const Fc=["eventKey"],$c=["eventKey"],Gc=()=>da(`${Na.v1}/slack`),xc=()=>da(`${Na.v1}/slack/applications`),Vc=()=>da(`${Na.v1}/slack/channels`),Wc=e=>e.id?fa(`${Na.v1}/slack/subscription/${e.id}`,e):ya(`${Na.v1}/slack/subscriptions`,e),jc=e=>ga(`${Na.v1}/slack/subscriptions/${e.id}`),Kc=e=>ya(`${Na.v1}/slack/applications/registrations`,{code:e}),Bc=()=>da(`${Na.v1}/emails`),zc=e=>{let{eventKey:t}=e,n=Ao(e,Fc);return ya(`${Na.v1}/emails/${t}`,n)},qc=({eventKey:e,enabled:t})=>fa(`${Na.v1}/emails/${e}`,{enabled:t}),Hc=(e,t)=>ga(`${Na.v1}/emails/${e}/subscriptions/${t}`),Jc=(e,t,n)=>pa(`${Na.v1}/emails/${t}/subscriptions/${e}`,n),Yc=e=>ga(`${Na.v1}/emails/${e}`),Qc=()=>da(`${Na.v2}/sms`),Xc=e=>{let{eventKey:t}=e,n=Ao(e,$c);return ya(`${Na.v2}/sms/${t}`,n)},Zc=({eventKey:e,enabled:t})=>fa(`${Na.v2}/sms/${e}`,{enabled:t}),eu=(e,t)=>ga(`${Na.v2}/sms/${e}/subscriptions/${t}`),tu=(e,t,n)=>pa(`${Na.v2}/sms/${t}/subscriptions/${e}`,n),nu=e=>ga(`${Na.v2}/sms/${e}`),ou=()=>da(Ba),iu=e=>e._id?fa(`${Ba}/${e._id}`,e):ya(`${Ba}/custom`,e),au=e=>ga(`${Ba}/${e}`),ru=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return da(`${Ba}/logs/?${o.toString()}`)},lu=e=>ya(`${Ba}/test`,e),su=e=>ya(`${Ba}/logs/${e}/retries`),cu=()=>da(`${Ka.v1}/categories`),uu=e=>da(Ka.v1,{channels:e});async function du(e){return pa(_a.v1,e)}async function yu(){return da(_a.v1)}const fu=["roleId"],pu=["roleId"],gu=["permissionId"];async function Su(){return da(Ia.v1)}async function vu(e){return ya(Ia.v1,e)}async function hu({roleId:e}){return ga(`${Ia.v1}/${e}`)}async function mu(e){let{roleId:t}=e,n=Ao(e,fu);return fa(`${Ia.v1}/${t}`,n)}async function bu(e){let{roleId:t}=e,n=Ao(e,pu);return pa(`${Ia.v1}/${t}/permissions`,n)}async function Au(){return da(Ta.v1)}async function ku(e){let{permissionId:t}=e,n=Ao(e,gu);return pa(`${Ta.v1}/${t}/roles`,n)}async function Tu(){return da(`${Ta.v1}/categories`)}async function Pu(){return da(Fa.subscriptions.v1)}async function Iu(e){return da(`${Fa.subscriptions.v1}/${e}`)}async function Lu(e){return pa(`${Fa.subscriptions.v1}/${e}/cancellations/`,{})}async function Eu(e){return pa(`${Fa.subscriptions.v1}/${e}/renewals/`,{})}async function Ou(e,{paymentMethodId:t,planId:n}){return pa(`${Fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function wu(e){return da(`${Ga.v1}/${e}`)}async function Du(){return da(`${Ga.v1}`)}async function Cu(e){return pa(`${Ga.v1}/${e}/cancellations/`,{})}async function Ru(e){return pa(`${Ga.v1}/${e}/renewals/`,{})}async function Uu(e,{paymentMethodId:t,planId:n}){return pa(`${Ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function _u(){return da(Fa.plans.v1)}async function Mu(e){return da(`${Fa.plans.v1}/${e}`)}async function Nu(){return da(Fa.invoices.v1)}async function Fu(e){return da(`${Fa.invoices.v1}/${e}`)}async function $u(e,t){return da(`${Fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Gu=["email"];async function xu(){return da(Fa.paymentMethods.v1)}async function Vu(e){return da(`${Fa.paymentMethods.v1}/${e}`)}async function Wu(e,t){let{email:n}=t,o=Ao(t,Gu);return fa(`${Fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function ju(e){return ya(Fa.paymentProviders.stripe.subscriptions.v1,e)}async function Ku(e){return da(`${Fa.paymentProviders.stripe.customers.v1}/${e}`)}async function Bu(e){return ya(`${Fa.paymentProviders.stripe.customers.v1}`,e)}async function zu(){return da(`${Fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function qu(e){return ya(`${Fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Hu(e){return da(`${Fa.summaries.v1}/${e}`)}async function Ju(e){return da(`${Fa.tenantConfiguration.v1}/${e}`)}async function Yu(e){return ya(`${Fa.tenantConfiguration.v1}`,e)}async function Qu(){return da($a.v1)}async function Xu(){return da(`${Fa.configurations.vendorPublicConfigurations.v1}`)}let Zu,ed,td,nd,od,id;async function ad(){return da("/vendors/public")}async function rd(e){return da(La.v1,e)}async function ld(e){return ya(La.v1,e)}async function sd(e){return ga(La.v1,e)}async function cd(e,t){return ya(`${La.v1}/${e}/roles`,t)}async function ud(e,t){return ga(`${La.v1}/${e}/roles`,t)}async function dd(e,t){return fa(`${La.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Zu||(Zu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(ed||(ed={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(td||(td={})),(nd||(nd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(od||(od={})),function(e){e.CREATE="create_customer"}(id||(id={}));const yd={flags:{}};class fd{constructor(){var e;this._flags={},this._flags=null!=(e=yd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new fd;return n.set(e),fd._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=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=e?e:{})}}async function pd(){return da(qa)}async function gd(){return da(`${Ha}`)}async function Sd(e,t){return fa(`${Ha}/${e}`,t)}async function vd(e){return ya(`${Ha}`,e)}async function hd(e){return ga(`${Ha}/${e}`)}async function md(e){return da(`${Ja}/${e}/Users/count`)}async function bd(e){return ya(`${Ea.v1}`,e)}fd._instances={};const Ad=["groupId"];async function kd({groupId:e},t){return da(`${Oa.v1}/${e}`,O({},t))}async function Td(e){return da(`${Oa.v1}`,O({},e))}async function Pd(e,t){return ya(`${Oa.getByIds.v1}`,e,{params:t})}async function Id(e){return ya(`${Oa.v1}`,e)}async function Ld(e){let{groupId:t}=e,n=Ao(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ed(e){return ga(`${Oa.v1}/${e}`)}async function Od(e,t){return ya(`${Oa.v1}/${e}/roles`,t)}async function wd(e,t){return ga(`${Oa.v1}/${e}/roles`,t)}async function Dd(e,t){return ya(`${Oa.v1}/${e}/users`,t)}async function Cd(e,t){return ga(`${Oa.v1}/${e}/users`,t)}async function Rd(){return da(`${Oa.configurations.v1}`)}async function Ud(e){return ya(`${Oa.configurations.v1}`,e)}let _d,Md,Nd,Fd,$d;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(_d||(_d={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Md||(Md={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Nd||(Nd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Fd||(Fd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}($d||($d={}));const Gd=[/^(.*)\/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],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,Wd=`${ma.v2}/me`,jd=`${ma.v2}/me/tenants`;let Kd,Bd,zd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bd||(Bd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(zd||(zd={}));const qd={auth:i,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m};var Hd={fetch:e,ContextHolder:ra,FronteggContext:la,api:qd,FronteggApiError:sa,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let Jd,Yd;function Qd(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function Xd(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Zd(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(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"}(Jd||(Jd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Yd||(Yd={}));const ey=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*ty(e){const t=yield di((e=>e.root.appName));return fd.getFeatureFlags(e,t)}const ny={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},oy=O({},ny,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),iy=[{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"}],ay={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},ry=O({},ay,{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}),ly={loading:!1,error:void 0,saving:!0,profile:ay},sy={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"},cy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},uy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},dy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},yy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},fy={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},py={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},gy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Sy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:fy,roles:gy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},vy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],hy={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:[iy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[iy[0]],managedBy:zd.FRONTEGG}]},my={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:[iy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[iy[0]],managedBy:zd.FRONTEGG}]},by={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Ay=[my,hy],ky=[by],Ty=[{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}],Py=[{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"}],Iy={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Ly={isActive:!0,strategy:$n.ALLOW},Ey=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:$n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:$n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 4"}],Oy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},my,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},wy=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"}),Dy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Oy(6),roles:[wy("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:zd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Oy(44),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Oy(8),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Oy(5),roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Oy(21),description:"BDR, AE, and inside sales",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Oy(23),description:"Dev success and customer success",roles:[wy("Admin")],managedBy:zd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Oy(10),description:"The marketing department",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Oy(4),description:"Human resources",roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Oy(3),roles:[wy("Viewer")],managedBy:zd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Oy(8),roles:[wy("Editor")],managedBy:zd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Oy(4),roles:[wy("Viewer")],managedBy:zd.FRONTEGG}];let Cy,Ry,Uy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Cy||(Cy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ry||(Ry={})),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"}(Uy||(Uy={})),Uy.profile,Uy.privacy,Uy.personalApiTokens,Uy.account,Uy.users,Uy.groups,Uy.security,Uy.sso,Uy.audits,Uy.webhooks,Uy.apiTokens,Uy.roles,Uy.subscriptions;const _y=["events","url"];function*My(){yield ai(lo.setSignUpState({loading:!0}));try{const e=yield si(qd.auth.getVendorConfig),[t]=(yield si(qd.auth.getVendorPublicAuthStrategiesConfig),yield si(ty,["admin_portal_login_per_tenant"]));if(t){const t=yield si(qd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield ai(lo.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Ny(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,_y);yield ai(lo.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield di((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield si(qd.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Ry.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(ra.setAccessToken(null==l?void 0:l.accessToken),ra.setUser(l),!r&&l&&Jf(l)){const t=yield Xf(l);yield ai(lo.setState(t)),a(e.loginUrl)}else yield ai(lo.setSignUpState({loading:!1,shouldActivate:r,stage:fn.SignUpSuccess})),yield ai(lo.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield ai(lo.loadTenants()))}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setSignUpState({loading:!1,error:e.message}))}yield ai(lo.setSignUpState({loading:!1}))}function*Fy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield di((e=>e.auth.signUpState));yield ai(lo.resetSignUpState()),yield ai(lo.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*$y(){yield aa(lo.signUpUser,Ny),yield aa(lo.resetSignUpStateSoft,Fy)}const Gy={setVendorState:(e,{payload:t})=>O({},e,t)},xy={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},Vy={loading:!1},{reducer:Wy,actions:jy}=st({name:Dt,initialState:Vy,reducers:O({},Gy)}),Ky=O({},jy,xy);function*By(){yield ai(Ky.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield qd.vendor.getVendorPublicInfo();yield ai(Ky.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield ai(Ky.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback"],Qy=["callback"];function*Xy(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield si(qd.auth.getGlobalSecurityPolicy);yield ai(lo.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha()),yield ai(lo.loadPublicAuthStrategiesPolicy())}function*Zy(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorConfig),[t]=yield si(ty,["admin_portal_login_per_tenant"]);if(t){const t=yield si(qd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield ai(lo.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ef(){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPublicAuthStrategiesConfig);yield ai(lo.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*tf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getMfaPolicy);yield ai(lo.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*nf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorMfaPolicy);yield ai(lo.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*of(e){let{payload:{callback:t}}=e,n=Ao(e.payload,zy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield si(qd.auth.saveMfaPolicy,n);yield ai(lo.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*af(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getLockoutPolicy);yield ai(lo.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*rf(e){let{payload:{callback:t}}=e,n=Ao(e.payload,qy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield si(qd.auth.saveLockoutPolicy,n);yield ai(lo.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*lf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorLockoutPolicy);yield ai(lo.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*sf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCaptchaPolicy);yield ai(lo.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*cf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*uf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield si(qd.auth.getVendorPasswordHistoryPolicy);yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*df(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield si(qd.auth.savePasswordHistoryPolicy,n);yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*yf(){yield ai(lo.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield si(qd.auth.getPasswordConfigPolicy);yield ai(lo.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*ff(){yield aa(lo.loadSecurityPolicy,Xy),yield oa(lo.saveSecurityPolicyMfa,of),yield oa(lo.loadSecurityPolicyMfa,tf),yield oa(lo.loadSecurityPolicyVendorMfa,nf),yield oa(lo.saveSecurityPolicyLockout,rf),yield oa(lo.loadSecurityPolicyLockout,af),yield oa(lo.loadSecurityPolicyVendorLockout,lf),yield oa(lo.loadSecurityPolicyCaptcha,sf),yield oa(lo.saveSecurityPolicyPasswordHistory,df),yield oa(lo.loadSecurityPolicyPasswordHistory,cf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,uf),yield oa(lo.loadVendorPasswordConfig,yf),yield oa(lo.loadPublicSecurityPolicy,Zy),yield oa(lo.loadPublicAuthStrategiesPolicy,ef)}function*pf(){yield ai(lo.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ai(lo.setSecurityPolicyPublicState({policy:cy,loading:!1}))}catch(e){yield ai(lo.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*gf(){yield ai(lo.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyGlobalState({policy:sy,loading:!1})),yield ai(lo.loadSecurityPolicyMfa()),yield ai(lo.loadSecurityPolicyVendorMfa()),yield ai(lo.loadSecurityPolicyLockout()),yield ai(lo.loadSecurityPolicyVendorLockout()),yield ai(lo.loadSecurityPolicyPasswordHistory()),yield ai(lo.loadSecurityPolicyVendorPasswordHistory()),yield ai(lo.loadSecurityPolicyCaptcha())}function*Sf(){yield ai(lo.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:uy,loading:!1}))}function*vf(){yield ai(lo.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorMfaState({policy:uy,loading:!1}))}function*hf(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Jy);yield ai(lo.setSecurityPolicyMfaState({saving:!0,error:null}));const i=O({},dy,{id:null!=(t=o.id)?t:dy.id,enforceMFAType:o.enforceMFAType});yield vt(),yield ai(lo.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*mf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*bf(){yield ai(lo.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorLockoutState({policy:dy,loading:!1}))}function*Af(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yy);yield ai(lo.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const o=O({},dy,n,{id:n.id?n.id:dy.id});null==t||t(o),yield ai(lo.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*kf(){yield ai(lo.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyLockoutState({policy:dy,loading:!1}))}function*Tf(){yield ai(lo.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:yy,loading:!1}))}function*Pf(){yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield ai(lo.setSecurityPolicyVendorPasswordHistoryState({policy:yy,loading:!1}))}function*If(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qy);yield ai(lo.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const o=O({},yy,n,{id:n.id?n.id:yy.id});null==t||t(o),yield ai(lo.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Lf(){yield aa(lo.loadSecurityPolicy,gf),yield oa(lo.loadPublicSecurityPolicy,pf),yield oa(lo.saveSecurityPolicyMfa,hf),yield oa(lo.loadSecurityPolicyMfa,Sf),yield oa(lo.loadSecurityPolicyVendorMfa,vf),yield oa(lo.saveSecurityPolicyLockout,Af),yield oa(lo.loadSecurityPolicyLockout,mf),yield oa(lo.loadSecurityPolicyVendorLockout,bf),yield oa(lo.loadSecurityPolicyCaptcha,kf),yield oa(lo.saveSecurityPolicyPasswordHistory,If),yield oa(lo.loadSecurityPolicyPasswordHistory,Tf),yield oa(lo.loadSecurityPolicyVendorPasswordHistory,Pf)}const Ef=["callback"],Of=["callback"],wf=["callback"],Df=["callback"],Cf=["callback","events"],Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"],xf=["callback"],Vf=["callback","deviceId"],Wf=["callback","deviceId"],jf=["callback","deviceId"],Kf=["callback","deviceId"],Bf={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*zf(){const e=ra.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield di((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(It);u&&![a,r,l,s].includes(u)&&(c=u),window.localStorage.removeItem(It),yield vt(200),ai(lo.resetLoginState());const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(d,{refresh:d.startsWith("http")})}function*qf(){let e;try{var t;const n=yield si(qd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ai(lo.setState({ssoACS:e}))}function*Hf(){try{const{isActive:e}=yield si(qd.auth.getSSOPublicConfiguration);yield ai(lo.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Jf=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),Yf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return nn.authenticatorApp;if(t)return nn.smsVerifyCode}return nn.verify},Qf=e=>{if(1===e.length){const[t]=e;if(t===Nd.AuthenticatorApp)return nn.authenticatorApp;if(t===Nd.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*Xf(e){let t=kt.loginWithTwoFactor,n={};const{loginState:o}=yield di((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield si(qd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Yf(e.mfaDevices)}:(n={step:Qf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=kt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Tt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:O({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*Zf(e){var t;const{routes:n,loginState:o}=yield di((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*ep(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(tp):yield si(op)}function*tp(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(qd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*np(){const{user:e}=yield di((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield ai(lo.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield si(qd.auth.exchangeOAuthTokens,t);yield ai(lo.setState({user:n,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:null,isAuthenticated:!1}))}}function*op(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Zf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ip(){try{const t=ra.onRedirectTo,{routes:n,loginState:o}=yield di((e=>e.auth)),{user:i,tenants:a}=yield si(qd.auth.refreshTokenV2);if(Jf(i)){const e=yield Xf(i);yield ai(lo.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield si(Sp))yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Zf(i);yield ai(lo.setTenantsState({tenants:a,loading:!1})),yield ai(lo.setState({user:i,isAuthenticated:!0,loginState:O({},o,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield ap(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield ai(lo.setState({user:void 0,isAuthenticated:!1}))}}function*ap(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=ra.onRedirectTo,{routes:i,loginState:a}=yield di((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield zf())}function*rp({payload:{callback:e}}){try{const{ip:t}=yield si(qd.metadata.getCurrentUserIpMetadata);yield ai(lo.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*lp({payload:e}){const t=[];e&&(yield ai(lo.setState({isLoading:!0})),yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(ef)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf))),t.push(si(ep)),yield ri(t),yield ai(lo.setState({isLoading:!1}))}function*sp({accessToken:e,user:t}){if(!e)return void(yield ai(lo.setState({user:void 0,isAuthenticated:!1})));const n=ra.onRedirectTo,{routes:o}=yield di((e=>e.auth));if(Jf(t)){const e=yield Xf(t);yield ai(lo.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*cp({payload:e}){const t=[];yield ai(lo.loadSocialLoginsConfigurationV2()),t.push(si(My)),t.push(si(Hf)),t.push(si(By)),t.push(si(qf)),t.push(si(sp,e)),yield ri(t)}function*up({payload:e}){const{disableSilentRefresh:t}=yield di((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield si(qd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield di((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ai(lo.setState({isLoading:!0}));const a=Zd(),r=Zd(),l=yield si(Xd,r);localStorage.setItem(Lt,r);const s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${ca(n,"/oauth/authorize")}/oauth/authorize`,u=O({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}o(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*dp({payload:e}){const t=localStorage.getItem(Lt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield di((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield si(qd.auth.exchangeOAuthTokens,a);yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield zf()}}function*yp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ef);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.auth.changePhoneNumberWithVerification,n);yield ai(lo.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:kt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Of);try{yield ai(lo.setLoginState({loading:!0})),yield si(qd.auth.verifyChangePhoneNumber,n),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1}))}}function*pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,wf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.auth.passwordlessPreLogin,O({},n,{type:Lr.SmsCode}));yield ai(lo.setLoginState({step:kt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*gp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Df);try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));const i=yield si(qd.auth.passwordlessPreLogin,n),a=Bf[n.type];if(a===kt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield ai(lo.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield ai(lo.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Sp(){const{publicAuthStrategyPolicy:e}=yield di((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===_d.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield si(ty,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);return yield ai(lo.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*vp(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,Cf);try{yield ai(lo.setLoginState({loading:!0}));const e=yield si(qd.auth.passwordlessPostLogin,o),a=ra.onRedirectTo,{routes:r}=yield di((e=>e.auth));if(Jf(e)){const t=yield Xf(e);yield ai(lo.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield di((e=>e.auth)),l=yield si(qd.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Cy.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield ai(lo.setState({user:l})),yield ai(lo.setLoginState({error:void 0})),yield ai(lo.loadTenants()),yield ai(lo.setState({isLoading:!1})),o.flow===Tt.Login?(yield si(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield ai(lo.setState({isAuthenticated:!0})),yield zf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield ai(lo.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*hp({payload:e}){try{yield ai(lo.setLoginState({loading:!0}));const{name:t}=yield si(qd.auth.verifyInviteToken,e);yield ai(lo.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield ai(lo.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield ai(lo.setLoginState({loading:!1}))}}function*mp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield di((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield si(qd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Yd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield di((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield ai(lo.setLoginState({step:kt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield bp({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*bp(e){let{callback:t}=e,n=Ao(e,Rf);const o=yield di((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===Lr.EmailAndPassword?(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t()):[Lr.MagicLink,Lr.Code,Lr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield ai(lo.passwordlessPreLogin(O({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield ai(lo.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t())}function*Ap({payload:{callback:e}}){try{yield ai(lo.setLoginState({loading:!0}));const{options:t}=yield si(qd.auth.webAuthnCreateNewDeviceSession);t.user.id=bt(t.user.id),t.challenge=bt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ai(lo.setLoginState({error:t.message})),null==e||e(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*kp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Uf);try{yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?Md.Platform:Md.CrossPlatform;yield si(qd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setLoginState({loading:!1}))}}function*Tp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_f);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const{options:e}=yield si(qd.auth.webAuthnPreLogin,n);e.challenge=bt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)}))),yield ai(lo.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*Pp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mf);try{var o;yield ai(lo.setPasskeysState({loading:!0})),yield ai(lo.setLoginState({loading:!0}));const e=At(n.publicKey),i=yield si(qd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Jf(i)){const e=ra.onRedirectTo,{routes:t}=yield di((e=>e.auth)),n=yield Xf(i);yield ai(lo.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield si(qd.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield ai(lo.loadTenants()),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield ai(lo.setLoginState({error:void 0})),yield zf(),null==t||t(!0)}}catch(e){yield ai(lo.setLoginState({error:e.message})),null==t||t(null)}finally{yield ai(lo.setPasskeysState({loading:!1})),yield ai(lo.setLoginState({loading:!1}))}}function*Ip({payload:e}){const{onRedirectTo:t,routes:n}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ai(lo.setLoginState({loading:!0}));try{const t=yield si(qd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield ai(lo.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield zf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ai(lo.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Lp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield ai(lo.setLoginState({loading:!0}));try{const a=yield si(qd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});ra.setAccessToken(a.accessToken),ra.setUser(a);const r=ra.onRedirectTo,{routes:l}=yield di((e=>e.auth));if(Jf(a)){const e=yield Xf(a);yield ai(lo.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield di((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield ai(lo.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===Tt.Login?kt.success:t.step,tenants:[],tenantsLoading:!0}})),yield ai(lo.loadTenants()),n&&t.flow===Tt.Login&&((yield si(Sp))?(yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield zf())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){ra.setAccessToken(null),ra.setUser(null),null==i||i(!1,t),yield ai(lo.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ep({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield ai(lo.setLoginState({loading:!0}));try{const i=yield si(qd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield di((e=>e.auth)),r=a.flow===Tt.Login?kt.success:a.step;yield ai(lo.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:i,isAuthenticated:!0})),i.id&&localStorage.setItem("userId",i.id),yield ai(lo.loadTenants()),yield ai(lo.setLoginState({error:void 0,loading:!1})),a.flow===Tt.Login&&((yield si(Sp))?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()),null==o||o(!0)}catch(e){yield ai(lo.setLoginState({error:e.message,loading:!1})),null==o||o(!1,e)}}function*Op({payload:e}){yield ai(lo.setLoginState({loading:!0}));try{var t;yield si(qd.auth.recoverMfaToken,e),yield ai(lo.setLoginState({loading:!1,error:void 0,step:kt.preLogin})),yield ai(lo.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*wp({payload:e}){const{hostedLoginBox:t}=yield di((e=>e.auth));yield ai(lo.setState({isLoading:!0}));try{t?yield si(qd.auth.OAuthLogout):yield si(qd.auth.logout)}catch{}yield ai(lo.resetState()),yield ai(lo.requestAuthorize(!0)),null==e||e()}function*Dp({payload:e}){var t;try{yield si(qd.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*Cp({user:e,tenants:t}){const n={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(n)),yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Rp({user:e,tenants:t}){const{loginState:n}=yield di((e=>e.auth));yield ai(lo.setUser(e)),yield ai(lo.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield di((e=>e.auth.mfaState));if(n.flow===Tt.Login){const e=yield si(Sp);o===nn.smsVerifyCode&&e?yield ai(lo.setLoginState({step:kt.promptPasskeys,loading:!1})):yield zf()}yield ai(lo.setState({isAuthenticated:!0}))}function*Up(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.preEnrollMFASMSForLogin,n);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_p(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Ff);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFASMSForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$f);yield ai(lo.setLoginState({loading:!0}));try{var o;const e=yield si(qd.auth.preEnrollMFAWebAuthnForLogin,n),i=O({},e.options,{challenge:bt(e.options.challenge),user:O({},e.options.user,{id:bt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Gf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),i=yield si(qd.auth.generateLoginResponseV2,o);yield Cp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Fp(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield si(qd.auth.generateLoginResponseV2,e);yield Cp(o),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*$p(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Vf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.preVerifyMFASMSForLogin,n,o);yield ai(lo.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Gp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Wf);yield ai(lo.setLoginState({loading:!0}));try{const e=yield si(qd.auth.verifyMFASMSForLogin,n,o),i=yield si(qd.auth.generateLoginResponseV2,e);yield Rp(i),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*xp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,jf);yield ai(lo.setLoginState({loading:!0}));try{var i;const e=yield si(qd.auth.preVerifyMFAWebAuthnForLogin,n,o),a=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Vp(e){let{payload:{callback:t,deviceId:n}}=e,o=Ao(e.payload,Kf);yield ai(lo.setLoginState({loading:!0}));try{const e=At(o.publicKey),i=yield si(qd.auth.verifyMFAWebAuthnForLogin,n,O({},o,{options:e})),a=yield si(qd.auth.generateLoginResponseV2,i);yield Rp(a),yield ai(lo.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Wp(){yield aa(lo.requestAuthorize,lp),yield aa(lo.requestAuthorizeSSR,cp),yield aa(lo.requestHostedLoginAuthorize,up),yield aa(lo.handleHostedLoginCallback,dp),yield aa(lo.preLogin,mp),yield aa(lo.postLogin,Ip),yield aa(lo.login,Lp),yield aa(lo.logout,wp),yield aa(lo.silentLogout,Dp),yield aa(lo.loginWithMfa,Ep),yield aa(lo.recoverMfa,Op),yield aa(lo.quickSmsPasswordlessPreLogin,pp),yield aa(lo.changePhoneNumberWithVerification,yp),yield aa(lo.verifyChangePhoneNumber,fp),yield aa(lo.passwordlessPreLogin,gp),yield aa(lo.passwordlessPostLogin,vp),yield aa(lo.verifyInviteToken,hp),yield aa(lo.webAuthnPrelogin,Tp),yield aa(lo.webAuthnPostLogin,Pp),yield aa(lo.webAuthnCreateNewDeviceSession,Ap),yield aa(lo.webAuthnVerifyNewDeviceSession,kp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,rp),yield aa(lo.preEnrollMFASMSForLogin,Up),yield aa(lo.enrollMFASMSForLogin,_p),yield aa(lo.preEnrollMFAWebAuthnForLogin,Mp),yield aa(lo.enrollMFAWebAuthnForLogin,Np),yield aa(lo.enrollMFAAuthenticatorAppForLogin,Fp),yield aa(lo.preVerifyMFASMSForLogin,$p),yield aa(lo.verifyMFASMSForLogin,Gp),yield aa(lo.preVerifyMFAWebAuthnForLogin,xp),yield aa(lo.verifyMFAWebAuthnForLogin,Vp)}function*jp({payload:e}){e&&(yield ai(lo.setState({isLoading:!0})));const t=ry;yield ai(lo.loadTenants()),yield ai(lo.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Kp({payload:{callback:e}}){try{const{ip:t}=Ey[0];yield ai(lo.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Bp(){yield aa(lo.requestAuthorize,jp),yield aa(lo.afterAuthNavigation,zf),yield aa(lo.getUserIP,Kp)}const zp=["callback","samlVendor"],qp=["callback","samlVendor"];function*Hp(){try{var e,t;yield ai(lo.setSSOState({loading:!0}));const n=yield si(qd.auth.getSamlConfiguration),o=yield si(qd.auth.getOidcConfiguration),i=yield si(qd.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield ai(lo.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSSOState({error:e.message,loading:!1}))}}function*Jp({payload:e}){const t=yield di((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ai(lo.setSSOState({error:void 0,[n]:!0}));try{const o=yield ey(e[0]),i=yield si(qd.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ai(lo.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Yp({payload:e}){const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ai(lo.setSSOState({error:void 0,[i]:!0}));try{const e=yield ey(t),a=yield si(qd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:o,error:e.message,[i]:!1})),null==n||n(null,e)}}function*Qp({payload:e}){const{callback:t,samlVendor:n}=e,o=Ao(e,zp),i=yield di((e=>e.auth.ssoState.samlConfiguration)),a=O({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},i,a)})));if(yield ai(lo.setSSOState({error:void 0,[r]:!0})),e.type===Yd.Saml){var l,s;const e=yield si(qd.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const o=Qd(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield si(qd.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ai(lo.setSSOState({samlConfiguration:i,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Xp({payload:{callback:e}={}}){const t=yield di((e=>e.auth.ssoState.samlConfiguration));try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.validateSamlDomain),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Zp(){try{const e=yield si(qd.auth.getSamlRoles),t=yield si(qd.auth.getSamlRolesGroups);yield ai(lo.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}function*eg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ri(e.map((e=>si(qd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ai(lo.setSSOState({error:e.message}))}}(n)),yield Zp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*tg({payload:{callback:e,id:t}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.deleteSamlGroup,{id:t}),yield Zp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*ng({payload:{group:e,roleIds:t,callback:n}}){try{yield ai(lo.setSSOState({error:void 0,saving:!0})),yield si(qd.auth.createSamlGroup,{group:e,roleIds:t}),yield Zp(),yield ai(lo.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ai(lo.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*og({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ai(lo.setSSOState({loading:!0})),yield si(qd.auth.oidcPostLoginV2,t),yield si(ep),yield ai(lo.setSSOState({loading:!1}))}catch(e){var n;yield ai(lo.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*ig(){yield oa(lo.loadSSOConfigurations,Hp),yield oa(lo.saveSSOConfigurations,Qp),yield oa(lo.saveSSOConfigurationsFile,Jp),yield oa(lo.saveSSOConfigurationsFileWithCallback,Yp),yield oa(lo.validateSSODomain,Xp),yield oa(lo.loadSSOAuthorizationRoles,Zp),yield oa(lo.updateSSOAuthorizationRoles,eg),yield oa(lo.deleteSamlGroup,tg),yield oa(lo.createSamlGroup,ng),yield oa(lo.oidcPostlogin,og)}function*ag(){yield ai(lo.setSSOState({loading:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:fy,loading:!1,firstLoad:!1}))}function*rg({payload:e}){const t="saving";yield ai(lo.setSSOState({error:void 0,[t]:!0}));const n=O({},yield di((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ai(lo.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*lg({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Ao(e,qp),r=Sy.samlConfiguration,l=O({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield ai(lo.setSSOState({samlConfiguration:O({},r,l)})));yield ai(lo.setSSOState({error:void 0,[s]:!0})),yield vt(),l.acsUrl=null==py||null==(t=py.configuration)?void 0:t.acsUrl,l.spEntityId=null==py||null==(n=py.configuration)?void 0:n.spEntityId;const c=Qd(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield vt(),yield ai(lo.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*sg({payload:{callback:e}={}}){const t=Sy.samlConfiguration;yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*cg(){yield vt(),yield ai(lo.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*ug({payload:{callback:e,authorizationRoles:t}}){yield ai(lo.setSSOState({error:void 0,saving:!0})),yield vt(),yield ai(lo.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*dg(){yield oa(lo.loadSSOConfigurations,ag),yield oa(lo.saveSSOConfigurations,lg),yield oa(lo.saveSSOConfigurationsFile,rg),yield oa(lo.validateSSODomain,sg),yield oa(lo.loadSSOAuthorizationRoles,cg),yield oa(lo.updateSSOAuthorizationRoles,ug)}const yg=["callback"],fg=["callback","ssoConfigId"],pg=["callback","ssoConfigId"];function*gg(){try{return yield si(qd.auth.getOidcConfiguration)}catch(e){return null}}function*Sg(){try{return yield si(qd.metadata.getSamlMetadata)}catch(e){return null}}function*vg(){try{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ri([si(gg),si(Sg)]),n=yield si(qd.auth.getSSOConfigurations);yield ai(lo.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ai(lo.setSSOError({key:Jd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield ai(lo.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*hg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ao(e,yg),o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield si(qd.auth.createSSOConfiguration,O({},n,{enabled:null!=(i=n.enabled)&&i}));yield ai(lo.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ey(t),i=yield si(qd.auth.createSSOConfigurationByMetadata,{metadata:e});yield ai(lo.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Ao(e,fg),i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ey(o),a=yield si(qd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield ai(lo.setSSOError({key:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*kg({payload:e}){yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.auth.deleteSSOConfiguration,t),yield ai(lo.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Tg({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Ao(e,pg);yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield si(qd.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?O({},t,{domains:[...t.domains,e]}):t));yield ai(lo.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?O({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.DELETE_SSO_DOMAIN,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!1}))}}function*Ig({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?O({},e,{domains:e.domains.map((e=>e.id===n?O({},e,{validated:!0}):e))}):e));yield ai(lo.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Lg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield si(qd.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?O({},e,{roleIds:n}):e));yield ai(lo.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ai(lo.setSSOError({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield ai(lo.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Eg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!0}));const i=yield di((e=>e.auth.ssoState.ssoConfigurations));try{yield ri(t.map((e=>si(qd.auth.deleteSSOGroup,n,e)))),yield ri(e.map((e=>si(qd.auth.createSSOGroup,n,e))));const a=yield si(qd.auth.getSSOGroups,n),r=i.map((e=>e.id===n?O({},e,{groups:a}):e));yield ai(lo.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==o||o(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*Og({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ri(t.map((t=>si(qd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ai(lo.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield ai(lo.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*wg(){yield oa(lo.loadSSOConfigurationsV2,vg),yield oa(lo.saveSSOConfigurationV2,hg),yield oa(lo.saveSSODomain,Tg),yield oa(lo.deleteSSODomain,Pg),yield oa(lo.validateSSODomainV2,Ig),yield oa(lo.updateSSOConfiguration,bg),yield oa(lo.deleteSSOConfiguration,kg),yield oa(lo.setSSOGroups,Eg),yield oa(lo.updateSSOGroups,Og),yield oa(lo.setSSODefaultRoles,Lg),yield oa(lo.saveSSOConfigurationByMetadata,mg),yield oa(lo.updateSSOConfigurationByMetadata,Ag)}const Dg=["callback","profilePictureUrl"],Cg=["callback","profilePictureUrl"];function*Rg(){yield ai(lo.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return si.apply(void 0,[na,e,t,n].concat(i))}(3,2e3,qd.teams.getProfile),t=yield di((e=>e.auth.user));lo.setUser(O({},t,e)),yield ai(lo.setProfileState({profile:e,loading:!1}))}catch(e){yield ai(lo.setProfileState({loading:!1,error:e.message}))}}function*Ug(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Dg);yield ai(lo.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield di((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield si(qd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=O({},e,o,{profilePictureUrl:i}),r=yield si(qd.teams.updateProfile,a),l=yield di((e=>e.auth.user));yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield ai(lo.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*_g({payload:e}){yield ai(lo.setProfileState({loading:!0}));try{var t;yield si(qd.teams.changePassword,e),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Mg(){yield aa(lo.loadProfile,Rg),yield oa(lo.saveProfile,Ug),yield oa(lo.changePassword,_g)}function*Ng(){yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setUser(O({},ry,ay))),yield ai(lo.setProfileState({loading:!1,profile:ay}))}function*Fg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Ao(e.payload,Cg);yield ai(lo.setProfileState({saving:!0,error:null}));const i=ly;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=O({},i.profile,o,{profilePictureUrl:a}),l=ry;yield vt(),yield ai(lo.setUser(O({},l,r))),yield ai(lo.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*$g({payload:e}){var t;yield ai(lo.setProfileState({loading:!0})),yield vt(),yield ai(lo.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Gg(){yield aa(lo.loadProfile,Ng),yield oa(lo.saveProfile,Fg),yield oa(lo.changePassword,$g)}const xg=["callback"],Vg=["callback"],Wg=["callback"],jg=["deviceId","callback"],Kg=["deviceId","callback"],Bg=["callback"],zg=["deviceId"],qg=["deviceId"],Hg=["callback"],Jg=["deviceId"],Yg=["callback"];function*Qg(e){const{step:t}=yield di((e=>e.auth.mfaState));return{step:e.recoveryCode?nn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Xg(){yield ai(lo.setMfaState({saving:!0}));try{const{qrCode:e}=yield si(qd.auth.enrollMfa);yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message}))}}function*Zg(e){let{payload:{callback:t}}=e,n=Ao(e.payload,xg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield di((e=>e.auth.user)),o=yield si(qd.auth.verifyMfa,n),i=yield si(qd.auth.getMFADevices),a=yield Qg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),yield ai(lo.setUser(O({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*eS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Vg);yield ai(lo.setMfaState({loading:!0}));try{const e=yield si(qd.auth.loginWithMfa,n),o={step:nn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setState({user:e})),yield ai(lo.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*tS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;yield si(qd.auth.disableMfa,e);const n=yield si(qd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*nS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t,n;const o=yield si(qd.auth.preEnrollMFAWebAuthn),i=O({},o.options,{challenge:bt(o.options.challenge),user:O({},o.options.user,{id:bt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield ai(lo.setMfaState({saving:!1,error:t.message})),null==(o=e.callback)||o.call(e,null,t)}}function*oS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Wg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(n.publicKey),o=yield si(qd.auth.enrollMFAWebAuthn,O({},n,{options:e})),i=yield si(qd.auth.getMFADevices),a=yield Qg(o);yield ai(lo.setMfaState(O({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*iS(e){let{payload:{deviceId:t,callback:n}}=e;Ao(e.payload,jg),yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.auth.preDisableMFAWebAuthn,t),i=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield ai(lo.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*aS(e){let{payload:{deviceId:t,callback:n}}=e,o=Ao(e.payload,Kg);yield ai(lo.setMfaState({saving:!0}));try{const e=At(o.publicKey);yield si(qd.auth.disableMFAWebAuthn,t,O({},o,{options:e}));const i=yield si(qd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*rS({payload:e}){yield ai(lo.setMfaState({saving:!0}));try{var t;const n=yield si(qd.auth.preEnrollMFASMS,e);yield ai(lo.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 ai(lo.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*lS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Bg);yield ai(lo.setMfaState({saving:!0}));try{const e=yield si(qd.auth.enrollMFASMS,n),o=yield si(qd.auth.getMFADevices),i=yield Qg(e);yield ai(lo.setMfaState(O({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield ai(lo.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*sS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,zg);yield ai(lo.setMfaState({saving:!0}));try{var o;const e=yield si(qd.auth.preDisableMFASMS,t);yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*cS(e){let{payload:{deviceId:t}}=e,n=Ao(e.payload,qg);yield ai(lo.setMfaState({saving:!0}));try{var o;yield si(qd.auth.disableMFASMS,t,n);const e=yield si(qd.auth.getMFADevices);yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(i=n.callback)||i.call(n,!1,e)}}function*uS(){yield ai(lo.setMfaState({loading:!0}));try{yield di((e=>e.auth.user));const e=yield si(qd.auth.getMFADevices);yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*dS(){yield ai(lo.setMfaState({loading:!0}));try{const e=(yield si(qd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ai(lo.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ai(lo.setMfaState({loading:!1,error:e.message}))}}function*yS(){yield oa(lo.enrollMfa,Xg),yield oa(lo.getMFADevices,uS),yield oa(lo.getMFAStrategies,dS),yield oa(lo.verifyMfa,Zg),yield oa(lo.disableMfa,tS),yield oa(lo.verifyMfaAfterForce,eS),yield oa(lo.preDisableMfaSms,sS),yield oa(lo.disableMfaSms,cS),yield oa(lo.preEnrollMfaSms,rS),yield oa(lo.enrollMfaSms,lS),yield oa(lo.preEnrollMfaWebAuthn,nS),yield oa(lo.enrollMfaWebAuthn,oS),yield oa(lo.preDisableMfaWebAuthn,iS),yield oa(lo.disableMfaWebAuthn,aS)}function*fS(){yield ai(lo.setMfaState({saving:!0})),yield ai(lo.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*pS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield ai(lo.setMfaState(o)),yield ai(lo.setUser(O({},ry,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*gS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hg);yield ai(lo.setMfaState({loading:!0})),yield vt();const o=O({},n,{recoveryCode:"recoveryCode"}),i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield vt(),yield ai(lo.setUser(O({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*SS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield ai(lo.setUser(O({},ry))),null==(t=e.callback)||t.call(e,!0)}function*vS(e){let{}=e,t=Ao(e.payload,Jg);yield ai(lo.setMfaState({saving:!0}));try{var n;yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield ai(lo.setMfaState({saving:!1,error:e.message})),null==(o=t.callback)||o.call(t,!1,e)}}function*hS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({loading:!1,error:void 0,mfaDevices:O({},n,{phones:[]})})),yield ai(lo.setUser(O({},ry))),null==(t=e.callback)||t.call(e,!0)}function*mS({payload:e}){var t;yield ai(lo.setMfaState({saving:!0})),yield vt(),yield ai(lo.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*bS(e){let{payload:{callback:t}}=e;Ao(e.payload,Yg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield di((e=>e.auth.mfaState));yield ai(lo.setMfaState({saving:!0})),yield vt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield ai(lo.setMfaState(i)),yield ai(lo.setUser(O({},ry,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*AS(){yield oa(lo.enrollMfa,fS),yield oa(lo.verifyMfa,pS),yield oa(lo.disableMfa,SS),yield oa(lo.verifyMfaAfterForce,gS),yield oa(lo.preDisableMfaSms,vS),yield oa(lo.disableMfaSms,hS),yield oa(lo.preEnrollMfaSms,mS),yield oa(lo.enrollMfaSms,bS)}const kS=["callback"];function*TS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{var t;yield si(qd.auth.forgotPassword,e),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*PS(e){let{payload:{callback:t}}=e,n=Ao(e.payload,kS);yield ai(lo.setForgotPasswordState({loading:!0}));try{yield si(qd.auth.resetPassword,n),yield ai(lo.setForgotPasswordState({loading:!1,error:void 0,step:Wt.success})),null==t||t(!0)}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*IS({payload:e}){yield ai(lo.setForgotPasswordState({loading:!0}));try{const t=yield si(qd.auth.loadPasswordConfig,e);yield ai(lo.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ai(lo.setForgotPasswordState({loading:!1,error:e.message}))}}function*LS(){yield aa(lo.forgotPassword,TS),yield aa(lo.resetPassword,PS),yield aa(lo.loadPasswordConfig,IS)}let ES;!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"}(ES||(ES={}));const OS=["callback","events"],wS=["callback"],DS=["callback"];function*CS({payload:{userId:e,token:t}}){yield ai(lo.setActivateState({loading:!0,step:_t.activating}));try{const{isAuthenticated:n}=yield di((e=>e.auth));n&&(yield ai(lo.silentLogout()));const o=yield si(qd.auth.getActivateAccountStrategy,{userId:e,token:t});yield ai(lo.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield ai(lo.setActivateState({loading:!1,step:_t.activatingForm})))}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*RS(e){let{payload:{callback:t,events:n}}=e,o=Ao(e.payload,OS);yield ai(lo.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield di((e=>e.auth)),r=yield si(qd.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Jf(r)){yield ai(lo.setActivateState({step:_t.success}));const t=yield Xf(r);yield ai(lo.setState(t)),yield yi(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield ai(lo.setActivateState({step:_t.success}));const{user:e,tenants:t}=yield si(qd.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Cy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield ai(lo.setTenantsState({tenants:t,loading:!1})),yield ai(lo.setState({user:e,isAuthenticated:!0})),yield yi(1e3),yield zf(),yield ai(lo.resetActivateState())}null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message}))}}function*US({payload:e}){const{callback:t}=e,n=Ao(e,wS);yield ai(lo.setActivateStrategyState({loading:!0}));try{const e=yield si(qd.auth.getActivateAccountStrategy,n);yield ai(lo.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ai(lo.setActivateStrategyState({loading:!1,error:e.message}))}}function*_S({payload:e}){const{callback:t}=e,n=Ao(e,DS);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.email})),yield ai(lo.setActivateState({loading:!0}));try{yield si(qd.auth.resendActivationEmail,n),yield ai(lo.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ai(lo.setActivateState({loading:!1,error:e.message})),yield ai(lo.setTeamError({key:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*MS(){yield aa(lo.activateAccount,RS),yield aa(lo.preActivateAccount,CS),yield aa(lo.getActivateAccountStrategy,US),yield aa(lo.resendActivationEmail,_S)}function*NS({payload:e}){if(e.token&&e.userId)try{yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.pending})),yield si(qd.auth.acceptInvitation,e),yield ai(lo.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:$t.success}}))}catch(e){yield ai(lo.setAcceptInvitationState({step:$t.failed,error:e.message}))}else yield ai(lo.setAcceptInvitationState({error:void 0,step:$t.invalid}))}function*FS(){yield aa(lo.acceptInvitation,NS)}var $S,GS=new Uint8Array(16);function xS(){if(!$S&&!($S="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 $S(GS)}for(var VS=/^(?:[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,WS=function(e){return"string"==typeof e&&VS.test(e)},jS=[],KS=0;KS<256;++KS)jS.push((KS+256).toString(16).substr(1));var BS=function(e,t,n){var o=(e=e||{}).random||(e.rng||xS)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(jS[e[t+0]]+jS[e[t+1]]+jS[e[t+2]]+jS[e[t+3]]+"-"+jS[e[t+4]]+jS[e[t+5]]+"-"+jS[e[t+6]]+jS[e[t+7]]+"-"+jS[e[t+8]]+jS[e[t+9]]+"-"+jS[e[t+10]]+jS[e[t+11]]+jS[e[t+12]]+jS[e[t+13]]+jS[e[t+14]]+jS[e[t+15]]).toLowerCase();if(!WS(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let zS,qS;!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"}(zS||(zS={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qS||(qS={}));const HS=["callback"],JS=["roles"],YS=["callback"],QS=["callback","profileImage"],XS=["callback"],ZS=["callback","userId"],ev=["callback"],tv=["callback"],nv=["callback"],ov=["callback"],iv=["callback"],av=["callback"],rv=["callback"],lv=["callback","profileImage"],sv=["callback"],cv=["callback"],uv=["callback"],dv=["callback"],yv=["callback"],fv=["callback"],pv=()=>di((e=>e.auth.teamState));function*gv(){try{const{groups:e}=yield si(qd.groups.getGroups,{_groupsRelations:qS.roles});return e}catch(e){return[]}}function*Sv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:ES.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i},a]=yield ri([si(qd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),si(qd.teams.loadAvailableRoles),si(qd.teams.loadAvailablePermissions),si(gv)]),l=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 O({},e,{groups:n})}));yield ai(lo.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield ai(lo.setTeamError({key:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield ai(lo.setTeamLoader({key:ES.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield ri([si(qd.subTenants.loadAllUsers,O({},c)),si(qd.teams.loadAvailableRoles),si(qd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield ai(lo.setTeamError({key:ES.USERS,value:e.message})),yield ai(lo.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield ai(lo.setTeamLoader({key:ES.USERS,value:!1}))}function*hv({payload:e}){yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield ri([si(qd.teams.loadAvailableRoles),si(qd.teams.loadAvailablePermissions)]);yield ai(lo.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ai(lo.setTeamError({key:ES.ROLES_AND_PERMISSIONS,value:t.message}))}yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0}))}function*mv({payload:e}){const{callback:t}=e,n=Ao(e,HS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield si(qd.teams.addUser,n),{roles:a}=e,r=O({},Ao(e,JS),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield ai(lo.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*bv({payload:e}){const{callback:t}=e,n=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield ai(lo.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield si(qd.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield ai(lo.loadUsers(r)),yield ai(lo.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*Av({payload:e}){const{callback:t}=e,n=Ao(e,YS),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield si(qd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield si(qd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ai(lo.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*kv({payload:e}){const{callback:t}=e,n=Ao(e,QS),{id:o}=n,i=yield pv(),a=i.users.find((e=>e.id===n.id));yield ai(lo.setTeamLoader({key:ES.UPDATE_USER,value:o||""})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?O({},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 si(qd.teams.updateUser,n);null==t||t(e),yield ai(lo.setTeamState({users:i.users.map((t=>t.id===e.id?O({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ai(lo.setTeamLoader({key:ES.UPDATE_USER,value:!1}))}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message}),users:i.users.map((e=>e.id===n.id?O({},e,a):e))})),yield ai(lo.setTeamLoader({key:ES.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Tv({payload:e}){const{callback:t}=e,n=Ao(e,XS),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.teams.deleteUser,n),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Pv({payload:e}){const{callback:t,userId:n}=e,o=Ao(e,ZS),i=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield si(qd.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return O({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ai(lo.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[O({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ai(lo.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Iv({payload:e}){const{callback:t}=e,n=Ao(e,ev),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})}));try{yield si(qd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Lv({payload:e}){const{callback:t}=e,n=Ao(e,tv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield si(qd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev({payload:e}){const{callback:t}=e,n=Ao(e,nv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Ov({payload:e}){const{callback:t}=e,n=Ao(e,ov);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*wv({payload:e}){const{callback:t}=e,n=Ao(e,iv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email}));try{yield si(qd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Dv(){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield si(qd.teams.getInviteLinkConfiguration);yield ai(lo.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield ai(lo.setTeamError({key:ES.CONFIG_TOKEN_LINK,value:e.message}))}}function*Cv(){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:!1}));try{yield si(Dv);const e=yield si(qd.teams.getInviteUserLink),{inviteTokenState:t}=yield pv();yield ai(lo.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield ai(lo.setTeamError({key:ES.GET_TOKEN_LINK,value:e.message}))}}function*Rv({payload:{callback:e}}){yield ai(lo.setTeamError({key:ES.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield pv();try{const n=yield si(qd.teams.createInviteUserLink,{expiresInMinutes:43200});yield ai(lo.setTeamState({inviteTokenState:O({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:ES.CREATE_TOKEN_LINK,value:t.message}))}}function*Uv({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield pv();yield ai(lo.setTeamError({key:ES.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield si(qd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ai(lo.setTeamState({inviteTokenState:O({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield ai(lo.setTeamError({key:ES.UPDATE_TOKEN_LINK,value:t.message}))}}function*_v({payload:e}){const{callback:t}=null!=e?e:{};yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:!1}));try{yield si(qd.teams.deleteInviteUserLink),yield ai(lo.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ai(lo.setTeamError({key:ES.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Mv({payload:e}){yield ai(lo.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Nv({payload:e}){const t=yield pv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Fv({payload:e}){yield ai(lo.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*$v({payload:e}){const t=yield pv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ai(lo.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gv(){yield ia(lo.loadUsers,Sv),yield ia(lo.loadAllSubTenantsUsers,vv),yield ia(lo.loadRoles,hv),yield oa(lo.addUser,mv),yield oa(lo.addUsersBulk,bv),yield oa(lo.addUserToSubTenants,Av),yield oa(lo.updateUser,kv),yield oa(lo.setUserRolesForSubTenants,Pv),yield oa(lo.deleteUser,Tv),yield oa(lo.deleteUserFromSubTenants,Iv),yield oa(lo.resendActivationLink,Lv),yield oa(lo.resendInvitationLink,Ev),yield oa(lo.resendInvitationEmail,Ov),yield oa(lo.resendInvitationLinkToAllSubTenants,wv),yield oa(lo.getInvitationLink,Cv),yield oa(lo.createInvitationLink,Rv),yield oa(lo.updateInvitationLink,Uv),yield oa(lo.deleteInvitationLink,_v),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}function*xv({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield pv(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield ai(lo.setTeamLoader({key:ES.USERS,value:!a})),yield ai(lo.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield vt(),yield ai(lo.setTeamState({users:Ay,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==r||r(Ay)}function*Vv({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield pv(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield ai(lo.setTeamLoader({key:ES.USERS,value:!r})),yield ai(lo.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield vt(),yield ai(lo.setTeamState({allUsers:ky,totalPages:2,totalItems:10,roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.USERS,value:!1})),null==l||l(ky)}function*Wv({payload:e}){var t;yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield ai(lo.setTeamState({roles:gy,permissions:vy})),yield ai(lo.setTeamLoader({key:ES.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:gy,permissions:vy})}function*jv({payload:e}){const{callback:t}=e,n=Ao(e,av),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,{groups:[]},n,{id:`${BS()}`});null==t||t(i),yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kv({payload:e}){const{callback:t}=e,n=Ao(e,rv),o=yield pv();yield ai(lo.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield vt();const i=O({},my,n,{id:`${BS()}`});yield ai(lo.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Bv({payload:e}){var t;const{callback:n}=e,o=Ao(e,lv),{id:i}=o,a=yield pv(),r=a.users.find((e=>e.id===o.id));yield ai(lo.setTeamLoader({key:ES.UPDATE_USER,value:i||""})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0})})),yield ai(lo.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?O({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield vt();const l=O({},r,o);null==n||n(l),yield ai(lo.setTeamState({users:a.users.map((e=>e.id===l.id?O({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ai(lo.setTeamLoader({key:ES.UPDATE_USER,value:!1}))}function*zv({payload:e}){const{callback:t}=e,n=Ao(e,sv),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*qv({payload:e}){const{callback:t}=e,n=Ao(e,cv),o=yield pv();yield ai(lo.setTeamState({deleteUserDialogState:O({},o.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield ai(lo.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Hv({payload:e}){const{callback:t}=e,n=Ao(e,uv);yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_ACTIVATE_LINK,value:!1}))}function*Jv({payload:e}){const{callback:t}=e,n=Ao(e,dv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Yv({payload:e}){const{callback:t}=e,n=Ao(e,yv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Qv({payload:e}){const{callback:t}=e,n=Ao(e,fv);yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield ai(lo.setTeamLoader({key:ES.RESEND_INVITATION_LINK,value:!1}))}function*Xv(){yield ia(lo.loadUsers,xv),yield ia(lo.loadAllSubTenantsUsers,Vv),yield ia(lo.loadRoles,Wv),yield oa(lo.addUser,jv),yield oa(lo.addUserToSubTenants,Kv),yield oa(lo.updateUser,Bv),yield oa(lo.deleteUser,zv),yield oa(lo.deleteUserFromSubTenants,qv),yield oa(lo.resendActivationLink,Hv),yield oa(lo.resendInvitationLink,Jv),yield oa(lo.resendInvitationEmail,Yv),yield oa(lo.resendInvitationLinkToAllSubTenants,Qv),yield oa(lo.openAddUserDialog,Mv),yield oa(lo.closeAddUserDialog,Nv),yield oa(lo.openDeleteUserDialog,Fv),yield oa(lo.closeDeleteUserDialog,$v)}const Zv=["authorizationUrl"],eh=["events","url"];function*th(){try{yield ai(lo.setSocialLoginsState({loading:!0}));const e=yield si(qd.auth.getSocialLoginProviders);yield ai(lo.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*nh(){try{const e=yield di((e=>e.root.context));yield ai(lo.setSocialLoginsState({loading:!0}));const t=yield si(qd.auth.getSocialLoginProvidersV2),{providers:n}=yield si(qd.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Ao(t,Zv);const i=ca(e,null!=n?n:"");return O({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield ai(lo.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield ai(lo.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*oh(e){let{payload:{events:t,url:n}}=e,o=Ao(e.payload,eh);try{yield ai(lo.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield si(qd.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:Ry.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Cy.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield ai(lo.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield di((e=>e.auth));e?yield si(np):yield si(ip)}(),localStorage.removeItem("register-quick-login"),yield ai(lo.setSocialLoginsState({loading:!1}))}catch(e){var r;yield ai(lo.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*ih({payload:e}){yield ai(lo.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*ah(){yield aa(lo.loadSocialLoginsConfiguration,th),yield aa(lo.loadSocialLoginsConfigurationV2,nh),yield aa(lo.loginViaSocialLogin,oh),yield ia(lo.setSocialLoginError,ih)}let rh;function*lh({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield di((e=>e.auth.apiTokensState));try{let e,a;yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield si(qd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield si(qd.auth.updateUserApiTokensData,{description:t}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*sh({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield di((e=>e.auth.apiTokensState));try{let e,r;yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield si(qd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield si(qd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ai(lo.setApiTokensError({key:rh.ADD_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*ch({payload:e}){const{apiTokensDataUser:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteUserAccessToken,{id:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield si(qd.auth.deleteUserApiToken,{tokenId:e}),yield ai(lo.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*uh({payload:e}){const{apiTokensDataTenant:t}=yield di((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),n?(yield si(qd.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield si(qd.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield ai(lo.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}catch(e){yield ai(lo.setApiTokensError({key:rh.DELETE_API_TOKEN,value:e.message})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}}function*dh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield ri([si(qd.auth.getUserApiTokensData),si(qd.auth.getTenantApiTokensData)]);yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.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 ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=si(qd.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*fh({payload:e}){null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=si(qd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=si(qd.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ai(lo.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield ai(lo.setApiTokensError({key:rh.LOAD_API_TOKENS,value:t.message})),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ph(){yield aa(lo.loadApiTokens,dh),yield aa(lo.loadUserApiTokens,yh),yield aa(lo.loadTenantApiTokens,fh),yield oa(lo.addUserApiToken,lh),yield oa(lo.addTenantApiToken,sh),yield ia(lo.deleteTenantApiToken,uh),yield ia(lo.deleteUserApiToken,ch)}function*gh({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield di((e=>e.auth.apiTokensState)),a=O({},oy,{description:t,roleIds:n,clientId:`CLIENT_ID_${BS()}`});yield ai(lo.setApiTokensState({showAddTokenDialog:!1})),yield yi(200),yield ai(lo.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*Sh({payload:e}){yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!0})),yield yi(200);const t=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ai(lo.setApiTokensLoader({key:rh.DELETE_API_TOKEN,value:!1}))}function*vh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny],o=[oy];yield ai(lo.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*hh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[ny];yield ai(lo.setApiTokensState({apiTokensDataUser:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*mh({payload:e}){var t;null!=e&&e.silentLoading||(yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!0})));const n=[oy];yield ai(lo.setApiTokensState({apiTokensDataTenant:n})),yield yi(200),yield ai(lo.setApiTokensLoader({key:rh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bh(){yield aa(lo.loadApiTokens,vh),yield aa(lo.loadUserApiTokens,hh),yield aa(lo.loadTenantApiTokens,mh),yield oa(lo.addTenantApiToken,gh),yield ia(lo.deleteTenantApiToken,Sh)}function*Ah({payload:e}){try{var t;yield ai(lo.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield si(qd.accountSettings.updateSettings,O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ai(lo.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*kh({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield si(qd.accountSettings.getSettings);yield ai(lo.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield ai(lo.setAccountSettingsState({loading:!1,error:e.message}))}}function*Th(){yield aa(lo.saveAccountSettings,Ah),yield aa(lo.loadAccountSettings,kh)}function*Ph({payload:e}){var t;yield ai(lo.setAccountSettingsState({loading:!0})),yield vt();const{accountSettingsState:n}=yield di((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=O({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield ai(lo.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Ih({payload:e}){yield ai(lo.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield vt(),yield ai(lo.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Lh(){yield aa(lo.saveAccountSettings,Ph),yield aa(lo.loadAccountSettings,Ih)}function*Eh({payload:{tenantId:e,callback:t}}){yield ai(lo.setState({isLoading:!0}));try{yield si(qd.tenants.switchTenant,{tenantId:e}),yield si(ep),(null==t?void 0:t(!0))||(yield ai(lo.setState({isLoading:!1})))}catch(e){yield ai(lo.setState({isLoading:!1})),null==t||t(!1,e)}}function*Oh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.tenants.getTenants);yield ai(lo.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 ai(lo.setTenantsState({loading:!1}))}}function*wh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.tenants.getSubTenants);yield ai(lo.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Dh({payload:e}){yield ai(lo.setTenantsState({loading:!0}));try{var t;const n=yield si(qd.tenants.getSubTenantsAsTree);yield ai(lo.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ai(lo.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Ch(){yield oa(lo.loadTenants,Oh),yield oa(lo.loadSubTenants,wh),yield oa(lo.switchTenant,Eh),yield oa(lo.loadSubTenantsTree,Dh)}function*Rh(){yield ai(lo.setTenantsState({loading:!0})),yield vt(),yield ai(lo.setTenantsState({tenants:Ty,loading:!1}))}function*Uh(){yield oa(lo.loadTenants,Rh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(rh||(rh={}));const _h=["callback"],Mh=["callback"],Nh=["callback"],Fh=["callback"],$h=["callback"];function*Gh({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield ri([si(qd.roles.getRoles),si(qd.roles.getPermissions),si(qd.roles.getPermissionCategories)]),[t,n,o]=e;yield ai(lo.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,_h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.addRole,n),o=yield si(qd.roles.getRoles);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Vh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Mh);yield ai(lo.setRolesState({saving:!0}));try{yield si(qd.roles.deleteRole,n),yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Wh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Nh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.updateRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*jh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Fh);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.attachPermissionsToRole,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Kh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,$h);yield ai(lo.setRolesState({saving:!0}));try{const e=yield si(qd.roles.attachPermissionToRoles,n);yield ai(lo.loadRolesAndPermissions({silentLoading:!0})),yield ai(lo.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield ai(lo.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Bh(){yield aa(lo.loadRolesAndPermissions,Gh),yield oa(lo.addRole,xh),yield oa(lo.deleteRole,Vh),yield oa(lo.updateRole,Wh),yield oa(lo.attachPermissionsToRole,jh),yield oa(lo.attachPermissionToRoles,Kh)}function*zh({payload:e}){var t;yield ai(lo.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield ai(lo.setRolesState({roles:iy,loading:!1}))}catch(e){yield ai(lo.setRolesState({error:e.message,loading:!1}))}}function*qh(){yield aa(lo.loadRolesAndPermissions,zh)}const Hh=["callback"],Jh=["callback"],Yh=["callback"];function*Qh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Hh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.auth.resetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),yield ai(lo.setLoginState({email:n.email}))}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Xh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Jh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const e=yield si(qd.auth.verifyResetPhoneNumber,n);yield ai(lo.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Zh(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Yh);yield ai(lo.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield di((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield si(qd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ai(lo.setLoginState({step:kt.loginWithSmsOtc})),yield ai(lo.passwordlessPreLogin({type:Lr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield ai(lo.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*em(){yield aa(lo.resetPhoneNumber,Qh),yield aa(lo.verifyResetPhoneNumber,Xh),yield aa(lo.changePhoneNumber,Zh)}function*tm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSessions);yield ai(lo.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*nm(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getCurrentUserSession);yield ai(lo.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*om({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteSessionForUser,e),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*im({payload:{callback:e,userId:t}}){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield ai(lo.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*am(){yield ai(lo.setSessionsState({loading:!0,error:null}));try{yield si(qd.auth.deleteAllSessionsForUser),yield ai(lo.loadUserSessions())}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*rm(){yield ia(lo.loadUserSessions,tm),yield ia(lo.deleteUserSession,om),yield ia(lo.deleteAllUserSessions,am),yield ia(lo.loadCurrentUserSession,nm),yield oa(lo.revokeUserSessions,im)}function*lm(){yield ai(lo.setSessionsState({loading:!0,error:null})),yield ai(lo.setSessionsState({sessions:Py,loading:!1}))}function*sm({payload:{id:e}}){yield ai(lo.setSessionsState({loading:!0,error:null}));const t=(yield di((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ai(lo.setSessionsState({sessions:t,loading:!1}))}function*cm(){yield ai(lo.setSessionsState({loading:!0,error:null}));const e=Py.filter((e=>e.current));yield ai(lo.setSessionsState({sessions:e,loading:!1}))}function*um(){yield ia(lo.loadUserSessions,lm),yield ia(lo.deleteUserSession,sm),yield ia(lo.deleteAllUserSessions,cm)}const dm=["callback"],ym=["callback"];function*fm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield si(qd.auth.getSessionConfigurations);yield ai(lo.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ai(lo.setSessionsState({error:e,loading:!1}))}}function*pm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ao(e,dm);yield si(qd.auth.createOrUpdateSessionConfigrations,n),yield ai(lo.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ai(lo.setSessionsPolicyState({error:e,loading:!1}))}}function*gm(){yield aa(lo.loadSessionsPolicy,fm),yield ia(lo.createOrUpdateSessionsPolicy,pm)}function*Sm(){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const e=yield di((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Iy}));yield ai(lo.setSessionsPolicyState(O({},e,{loading:!1})))}function*vm({payload:e}){yield ai(lo.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ao(e,ym);null==t||t(!0),yield ai(lo.setSessionsPolicyState({configurations:n,loading:!1}))}function*hm(){yield aa(lo.loadSessionsPolicy,Sm),yield ia(lo.createOrUpdateSessionsPolicy,vm)}const mm=["callback"],bm=["callback"],Am=["callback"],km=["callback"],Tm=["callback"],Pm=["callback"],Im=["callback"],Lm=["callback"],Em=()=>di((e=>e.auth.restrictionsState.ipRestrictions)),Om=()=>di((e=>e.auth.restrictionsState.emailDomainRestrictions));function*wm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield si(qd.auth.getDomainRestrictionsConfig),t=(yield si(qd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Dm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,mm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield Om();try{var i;yield si(qd.auth.createDomainRestriction,n);const e=(yield si(qd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Cm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,bm);yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield si(qd.auth.updateDomainRestrictionConfig,n),o=(yield si(qd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ai(lo.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rm({payload:{id:e}}){yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Om();try{var n;yield si(qd.auth.deleteDomainRestriction,e);const o=(yield si(qd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:o},saving:!1}))}catch(e){yield ai(lo.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Um=e=>{var t,n,o;return{_filter:null!=(t=null==e?void 0:e._filter)?t:$n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(o=null==e?void 0:e._offset)?o:0}};function*_m(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=yield si(qd.auth.getIPRestrictionsConfig),n=Um({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield si(qd.auth.getIPRestrictions,n);yield ai(lo.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Mm(){try{const{valid:e}=yield si(qd.auth.testCurrentIpInAllowList);yield ai(lo.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message}))}}function*Nm({payload:{callback:e}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield di((e=>e.auth.userIp));yield ri([si(qd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),si(qd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Em(),o=Um(n.pagination),{items:i,_metadata:{totalPages:a}}=yield si(qd.auth.getIPRestrictions,o);yield ai(lo.setIpRestrictionsState({data:{config:{isActive:!0,strategy:$n.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield ai(lo.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Fm(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Am);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();try{var i,a;yield si(qd.auth.createIPRestriction,n);const e=yield Em(),r=Um(e.pagination),{items:l,_metadata:{totalPages:s}}=yield si(qd.auth.getIPRestrictions,r);yield Mm(),yield ai(lo.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:$n.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*$m(e){let{payload:{callback:t}}=e,n=Ao(e.payload,km);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));try{yield si(qd.auth.updateIPRestrictionConfig,n);const e=yield Em(),o=yield si(qd.auth.getIPRestrictionsConfig),i=Um(O({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield si(qd.auth.getIPRestrictions,i);yield Mm(),yield ai(lo.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Gm({payload:{id:e,callback:t}}){yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const n=yield Em();try{var o;yield si(qd.auth.deleteIPRestriction,e);const i=yield Em(),a=Um(i.pagination),{items:r,_metadata:{totalPages:l}}=yield si(qd.auth.getIPRestrictions,a);yield Mm(),yield ai(lo.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ai(lo.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xm(){yield aa(lo.loadIpRestrictions,_m),yield aa(lo.loadEmailDomainRestrictions,wm),yield oa(lo.saveIpRestriction,Fm),yield oa(lo.saveIpRestrictionsConfig,$m),yield oa(lo.deleteIpRestriction,Gm),yield oa(lo.checkIfUserIpValid,Mm),yield oa(lo.addCurrentUserIpAndActivate,Nm),yield oa(lo.saveEmailDomainRestriction,Dm),yield oa(lo.saveEmailDomainRestrictionsConfig,Cm),yield oa(lo.deleteEmailDomainRestriction,Rm)}function*Vm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{restrictions:Ey.filter((e=>e.strategy===Ly.strategy)),config:Ly},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Wm(){yield ai(lo.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Em(),t=Ey[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ai(lo.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ai(lo.setIpRestrictionsState({error:e.message,loading:!1}))}}function*jm(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Tm);yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const r=yield Em(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield ai(lo.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:$n.ALLOW},restrictions:[...l,O({},a,{createdAt:new Date,updatedAt:new Date,id:BS(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*Km(e){var t,n,o;let{payload:{callback:i}}=e,a=Ao(e.payload,Pm);const r=yield Em();yield ai(lo.setIpRestrictionsState({saving:!0,error:null})),yield ai(lo.setIpRestrictionsState({data:{config:O({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ai(lo.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*Bm({payload:{id:e,callback:t}}){var n;yield ai(lo.setIpRestrictionsState({saving:!0,error:null}));const o=yield Em();yield ai(lo.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:o.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*zm(){yield ai(lo.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ai(lo.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:$n.ALLOW}],config:{active:!0,listType:$n.ALLOW,blockPublicDomains:!1}}}))}function*qm(e){var t,n;let{payload:{callback:o}}=e,i=Ao(e.payload,Im);const a=yield Om();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==o||o(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],O({},i,{id:Date.now().toString()})]},saving:!1}))}function*Hm(e){var t;let{payload:{callback:n}}=e,o=Ao(e.payload,Lm);const i=yield Om();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==n||n(!0),yield ai(lo.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||$n.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Jm({payload:{id:e}}){var t,n;const o=yield Om();yield ai(lo.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),yield ai(lo.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Ym(){yield aa(lo.loadIpRestrictions,Vm),yield aa(lo.loadEmailDomainRestrictions,zm),yield oa(lo.saveIpRestriction,jm),yield oa(lo.saveIpRestrictionsConfig,Km),yield oa(lo.deleteIpRestriction,Bm),yield oa(lo.checkIfUserIpValid,Wm),yield oa(lo.saveEmailDomainRestriction,qm),yield oa(lo.saveEmailDomainRestrictionsConfig,Hm),yield oa(lo.deleteEmailDomainRestriction,Jm)}const Qm=["callback"],Xm=["id"];function*Zm(e){const{count:t}=yield si(qd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*eb(){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.getConfigs),t=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*tb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,Qm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{const e=yield si(qd.directory.createConfiguration,n),o=yield si(qd.directory.getConfigs),i=yield ri(o.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*nb(e){let{payload:{id:t}}=e,n=Ao(e.payload,Xm);yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.updateConfiguration,t,n);const e=yield si(qd.directory.getConfigs),o=yield ri(e.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1}))}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1}))}}function*ob({payload:{id:e,callback:t}}){yield ai(lo.setProvisioningState({loading:!0,error:null}));try{yield si(qd.directory.deleteConfiguration,e);const n=yield si(qd.directory.getConfigs),o=yield ri(n.map((e=>Zm(e))));yield ai(lo.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*ib(){yield aa(lo.loadProvisionConnections,eb),yield oa(lo.createProvisionConnection,tb),yield oa(lo.deleteProvisionConnection,ob),yield oa(lo.updateProvisionConnection,nb)}const ab=["callback","events"];function*rb(e){let{payload:{callback:t}}=e,n=Ao(e.payload,ab);yield ai(lo.setImpersonateState({loading:!0}));try{yield si(qd.impersonate.impersonate,n),yield ai(lo.setImpersonateState({step:to.success})),yield yi(1e3),yield zf(),yield ai(lo.resetImpersonateState()),null==t||t(!0)}catch(e){yield ai(lo.setImpersonateState({loading:!1,error:e.message}))}}function*lb(){yield aa(lo.impersonate,rb)}function*sb({payload:e}){const{callback:t,deviceId:n}=e;yield ai(lo.setPasskeysState({loading:!0}));try{yield si(qd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield di((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield ai(lo.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*cb(){yield ai(lo.setPasskeysState({loading:!0}));try{const{devices:e}=yield si(qd.auth.getWebAuthnDevices);yield ai(lo.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ai(lo.setPasskeysState({loading:!1,error:e.message||null}))}}function*ub(){yield oa(lo.loadWebAuthnDevices,cb),yield oa(lo.deleteWebAuthnDevice,sb)}const db=["roleIds","userIds"],yb=()=>di((e=>e.auth.groupsState));function*fb({payload:e}){const t=zS.GET_TEAM_USERS;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield si(qd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield ai(lo.setGroupsState({teamUsers:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*pb({payload:e}){const t=zS.GET_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield si(qd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:qS.rolesAndUsers});yield ai(lo.setGroupsState({selectedGroup:n}))}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*gb(){const e=zS.GET_GROUPS,t=yield yb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield si(qd.groups.getGroups,{_groupsRelations:qS.rolesAndUsers});yield ai(lo.setGroupsState(O({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*Sb({payload:e}){const t=zS.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Ao(e,db);yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield si(qd.groups.createGroup,O({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield ai(lo.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield ai(lo.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ai(lo.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*vb({payload:e}){const t=zS.UPDATE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.updateGroup,e),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*hb({payload:e}){const t=zS.DELETE_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.deleteGroup,e.groupId),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1,n.message)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=zS.ADD_ROLES_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*bb({payload:e}){const t=zS.DELETE_ROLES_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*Ab({payload:e}){const t=zS.ADD_USERS_TO_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield ai(lo.setUsersGroupsError({key:t,value:n.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*kb({payload:e}){const t=zS.DELETE_USERS_FROM_GROUP;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield si(qd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ai(lo.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield ai(lo.setUsersGroupsError({key:t,value:n.message})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb(){const e=zS.GET_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield si(qd.groups.getGroupConfiguration);yield ai(lo.setGroupsState({groupsConfiguration:t}))}catch(t){yield ai(lo.setUsersGroupsError({key:e,value:t.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}}function*Pb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION;yield ai(lo.setUsersGroupsLoader({key:t,value:!0}));try{yield si(qd.groups.updateGroupConfiguration,e),yield ai(lo.getGroupConfiguration())}catch(e){yield ai(lo.setUsersGroupsError({key:t,value:e.message}))}finally{yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}}function*Ib(){yield ia(lo.loadGroups,gb),yield ia(lo.getGroupById,pb),yield ia(lo.createGroup,Sb),yield ia(lo.updateGroup,vb),yield ia(lo.deleteGroup,hb),yield ia(lo.addRolesToGroup,mb),yield ia(lo.deleteRolesFromGroup,bb),yield ia(lo.addUsersToGroup,Ab),yield ia(lo.deleteUsersFromGroup,kb),yield ia(lo.getGroupConfiguration,Tb),yield ia(lo.updateGroupConfiguration,Pb),yield ia(lo.getTeamUsers,fb)}function*Lb(){const e=zS.GET_GROUPS;yield ai(lo.setUsersGroupsLoader({key:e,value:!0}));const t=Dy;yield ai(lo.setGroupsState({groups:t})),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Eb({payload:e}){var t;const n=zS.CREATE_GROUP,{groups:o}=yield yb();yield ai(lo.setUsersGroupsLoader({key:n,value:!0})),yield ai(lo.setGroupsState({groups:[O({},e,{id:`${e.name}ID`,managedBy:zd.FRONTEGG}),...null!=o?o:[]]})),yield yi(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:n,value:!1}))}function*Ob({payload:e}){var t,n,o,i,a;const r=zS.UPDATE_GROUP,l=yield yb();yield ai(lo.setUsersGroupsLoader({key:r,value:!0})),yield ai(lo.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:zd.FRONTEGG}):t})),selectedGroup:O({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield yi(500),null==e||null==(a=e.callback)||a.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:r,value:!1}))}function*wb({payload:e}){var t,n;const o=zS.DELETE_GROUP,i=yield yb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Db({payload:e}){var t,n;const o=zS.ADD_ROLES_TO_GROUP,i=yield yb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Cb({payload:e}){var t,n;const o=zS.DELETE_ROLES_FROM_GROUP,i=yield yb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Rb({payload:e}){var t,n;const o=zS.ADD_USERS_TO_GROUP,i=yield yb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*Ub({payload:e}){var t,n;const o=zS.DELETE_USERS_FROM_GROUP,i=yield yb();yield ai(lo.setUsersGroupsLoader({key:o,value:!0})),yield ai(lo.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield yi(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ai(lo.setUsersGroupsLoader({key:o,value:!1}))}function*_b(){const e=zS.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield yb();yield ai(lo.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},t)}))),yield ai(lo.setUsersGroupsLoader({key:e,value:!1}))}function*Mb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield yb();yield ai(lo.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ai(lo.setGroupsState({groupsConfiguration:O({},n,e)}))),yield ai(lo.setUsersGroupsLoader({key:t,value:!1}))}function*Nb(){yield ia(lo.loadGroups,Lb),yield ia(lo.createGroup,Eb),yield ia(lo.updateGroup,Ob),yield ia(lo.deleteGroup,wb),yield ia(lo.addRolesToGroup,Db),yield ia(lo.deleteRolesFromGroup,Cb),yield ia(lo.addUsersToGroup,Rb),yield ia(lo.deleteUsersFromGroup,Ub),yield ia(lo.getGroupConfiguration,_b),yield ia(lo.updateGroupConfiguration,Mb)}var Fb={sagas:function*(){yield ri([si(Wp),si(MS),si(FS),si(LS),si(em),si(ig),si(wg),si(Mg),si(yS),si(Gv),si(Ib),si(ah),si($y),si(ph),si(ff),si(Th),si(Ch),si(Bh),si(rm),si(gm),si(xm),si(ib),si(lb),si(ub)])},mockSagas:function*(){yield ri([si(Bp),si(dg),si(Gg),si(AS),si(Xv),si(bh),si(Lf),si(um),si(Lh),si(Uh),si(hm),si(Ym),si(qh),si(Nb)])},storeName:Et,initialState:eo,reducer:ao,actions:lo};const $b=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),Gb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},xb={setAuditLogsState:$b("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:Gb})},Vb={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},Wb={loading:!0},jb={setAuditsMetadataState:$b("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:Wb})},Kb={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},Bb={auditLogsState:Gb,auditsMetadataState:Wb},{reducer:zb,actions:qb}=st({name:wt,initialState:Bb,reducers:O({resetState:e=>O({},e,Bb),setState:(e,{payload:t})=>O({},e,t)},xb,jb)}),Hb=O({},qb,Vb,Kb),Jb=e=>"createdAt"!==e.id,Yb={total:20,data:Array.from(Array(5).keys()).map((e=>O({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`})))},Qb={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}]},Xb=()=>di((e=>e.auditLogs.auditLogsState)),Zb=()=>di((e=>e.auditLogs.auditsMetadataState));function*eA(){const e=yield Xb(),{columns:t}=yield Zb();try{const n=e.filter,o=e.sort.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});yield ai(Hb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield qd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield ai(Hb.setAuditLogsState({isDownloadingCsv:!1}))}function*tA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Hb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});n||(yield ai(Hb.loadAuditsMetadata()));const{data:p,total:g}=yield si(qd.audits.getAudits,O({offset:c,count:s},y,f));yield ai(Hb.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*nA(){yield oa(Hb.exportAuditsCsv,eA),yield oa(Hb.loadAuditLogs,tA)}function*oA({payload:e}){yield ai(Hb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Xb(),{columns:n}=yield Zb();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield ai(Hb.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield ai(Hb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Yb;let o=n.filter((e=>t=>e.filter(Jb).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield ai(Hb.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield ai(Hb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*iA(){yield oa(Hb.loadAuditLogs,oA)}function*aA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield si(qd.metadata.getAuditsMetadata);yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*rA(){yield oa(Hb.loadAuditsMetadata,aA)}function*lA(){yield ai(Hb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Qb;yield ai(Hb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ai(Hb.setAuditsMetadataState({error:e,loading:!1}))}}function*sA(){yield oa(Hb.loadAuditsMetadata,lA)}var cA={sagas:function*(){yield ri([si(nA),si(rA)])},mockSagas:function*(){yield ri([si(iA),si(sA)])},storeName:wt,initialState:Bb,reducer:zb,actions:Hb};const uA={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:dA,actions:yA,reducer:fA}=st({name:"audits",initialState:uA,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=O({},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]})))}}}),pA=O({},yA,{initData:rt(`${dA}/initData`),loadAudits:rt(`${dA}/loadAudits`),removeFilter:rt(`${dA}/removeFilter`),filterData:rt(`${dA}/filterData`),exportCSV:rt(`${dA}/exportCSV`),deleteAudits:rt(`${dA}/deleteAudits`)}),gA=()=>di((e=>e[dA]));function*SA(){const{sortBy:e,sortDirection:t}=yield gA();try{const n=yield si(qd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ai(pA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ai(pA.loadItemFailedAction(t))}}function*vA(){try{const e=yield si(qd.metadata.getAuditsMetadata);yield ai(pA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ai(pA.loadItemFailedAction(t))}}const hA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*mA({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield gA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield gA():{rowsData:[]};try{const e=hA(t),{data:l,total:d}=yield si(qd.audits.getAudits,O({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield ai(pA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield ai(pA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ai(pA.loadItemFailedAction(t))}}function*bA(){yield ai(pA.startLoading()),yield ri([SA(),vA(),mA({payload:{onlyOneLoad:!1},type:""})]),yield ai(pA.finishLoading())}function*AA({payload:e}){const{filters:t}=yield gA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield ai(pA.setFilterData(o))}function*kA({payload:e}){const{filters:t}=yield gA();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield ai(pA.setFilterData(o))}function*TA(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield gA(),a=hA(e);yield ai(pA.startDownloadingCsv());try{yield qd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ai(pA.stopDownloadingCsv())}}function*PA(){yield ia(pA.initData,bA),yield ia(pA.removeFilter,AA),yield ia(pA.filterData,kA),yield ia([pA.loadAudits,pA.textSearch,pA.onPageChange],mA),yield ia([pA.setFilterData,pA.setDataSorting,pA.startRefresh],(()=>mA({payload:{appendMode:!1},type:""}))),yield ia(pA.exportCSV,TA)}const IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LA={initData:()=>O({},IA),setConnectivityState:(e,{payload:t})=>O({},e,t),cleanWebhookTestData:e=>O({},e,{testResult:void 0}),cleanWebhookLogsData:e=>O({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return O({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>O({},e,{error:void 0}),cleanSlackData:e=>O({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,t)})}},EA={loadSlackActions:rt("connectivity/loadSlackActions"),loadDataAction:rt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:rt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:rt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:rt("connectivity/loadScope"),deleteWebhookConfigAction:rt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:rt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:rt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},OA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:wA,actions:DA}=st({name:Ot,initialState:OA,reducers:O({},LA)}),CA=O({},DA,EA),RA={slack:qd.connectivity.getSlackConfiguration,email:qd.connectivity.getEmailConfiguration,sms:qd.connectivity.getSMSConfiguration,webhook:qd.connectivity.getWebhooksConfigurations,categories:qd.connectivity.getCategories,channelMap:qd.connectivity.getChannelMaps},UA={slack:qd.connectivity.postSlackConfiguration,email:qd.connectivity.postEmailConfiguration,sms:qd.connectivity.postSMSConfiguration,webhook:qd.connectivity.postWebhooksConfiguration},_A=["email","slack","sms","webhook"],MA={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"}},NA=["id"],FA=["id","enabled"],$A=["categories","channelMap"];function*GA(e){return yield si(VA,{payload:{api:e},type:""})}function*xA({payload:e=_A}){yield ai(CA.setConnectivityState({isLoading:!0}));try{const t=yield ri([...e.map(GA),yield VA({payload:{api:"categories"},type:""}),yield function*(){return(yield ri(e.map((function*(e){return yield VA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>O({},t,{[`${e[o]}`]:n})),{})}()]),n=yield VA({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?O({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:MA[e[i]].events(o),active:MA[e[i]].isActive(o),platform:MA[e[i]].title,image:MA[e[i]].image}]}):n:O({},n,{[`${$A[i-e.length]}`]:o})),{list:[],webhook:n});yield ai(CA.setConnectivityState(O({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ai(CA.setConnectivityState({isLoading:!1}))}}function*VA({payload:{api:e,params:t}}){try{return yield si(RA[e],t)}catch(e){return}}function*WA(){try{yield ai(CA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield si(qd.connectivity.getSlackChannels);yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*jA(e,t){const{connectivity:{list:n}}=yield di(),o=n.find((({key:t})=>t===e));if(!o)return;const i=MA[e].isActive(t);i!==o.active&&(yield ai(CA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:i}):t))})))}function*KA({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield di((e=>e.connectivity));try{if(yield ai(CA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield di();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield ri([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Ao(e,NA);return n===t.id&&JSON.stringify(O({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield si(UA.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield si(qd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield di(),{processIds:o}=yield di((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield ri([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield si("email"===t?qd.connectivity.postEmailConfiguration:qd.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Ao(i,FA);return yield ri([yield si("email"===t?qd.connectivity.patchEmailConfiguration:qd.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield si("email"===t?qd.connectivity.putEmailSubscriptions:qd.connectivity.putSMSSubscriptions,a,o,O({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return si("email"===t?qd.connectivity.deleteEmailSubscriptions:qd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield VA({payload:{api:t},type:""});yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield jA(t,e)}else yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield si(UA[e],t),!["sms","email"].includes(e)){const i=yield VA({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield jA(e,i),null==n||n(!0)}}catch(e){var i;yield ai(CA.setConnectivityState({error:null!=(i=e.message)?i:e.toString(),isSaving:!1,isLoading:!1}))}}function*BA({payload:e}){try{yield qd.connectivity.postSlackCode(e)}catch{}yield ai(CA.setConnectivityState({error:void 0,isSaving:!1}))}function*zA(){const{slackChannels:e}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield si(qd.connectivity.getSlackScope);yield ai(CA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ai(CA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*qA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({isSaving:!0})),yield si(qd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const i=yield VA({payload:{api:"webhook"},type:""});i&&(yield ai(CA.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*HA({payload:e}){try{yield ai(CA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield si(qd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ai(CA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*JA({payload:e}){try{const{statusCode:t}=yield si(qd.connectivity.postWebhookRetry,e);yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ai(CA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*YA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield di((e=>e.connectivity));try{yield ai(CA.setConnectivityState({webhookLogs:O({},o,{isLoading:!0})}));const i=yield si(qd.connectivity.getWebhookLog,e,n,t);yield ai(CA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},i)}))}catch(e){yield ai(CA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var QA={sagas:function*(){yield oa(CA.loadDataAction,xA),yield ia(CA.loadSlackActions,WA),yield oa(CA.postDataAction,KA),yield oa(CA.postCodeAction,BA),yield oa(CA.loadScope,zA),yield oa(CA.deleteWebhookConfigAction,qA),yield oa(CA.postWebhookTestAction,HA),yield oa(CA.postWebhookRetryAction,JA),yield ia(CA.loadWebhookLogsAction,YA)},storeName:Ot,initialState:OA,reducer:wA,actions:CA};function XA(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}}function ZA(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>O({},n,{[e]:t(n[e],o)})}}function ek(e){return ZA(e,((e,t)=>O({},e,{loading:t.payload})))}function tk(e){return ZA(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const nk={loading:!1,error:null,fetching:!0,plans:[]},{actions:ok,reducer:ik,name:ak}=st({name:"subscriptions/plans",initialState:nk,reducers:O({},XA())}),rk=O({loadPlans:rt(`${ak}/loadPlans`)},ok),lk={loading:!1,error:null,fetching:!0,config:null},sk=O({},XA()),{actions:ck,reducer:uk,name:dk}=st({name:"subscriptions/config",initialState:lk,reducers:sk}),yk=O({loadPaymentConfiguration:rt(`${dk}/loadPaymentConfiguration`)},ck),fk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},pk=O({},XA(),{setCancellationLoading:ek("cancellation"),setCancellationError:tk("cancellation"),setRenewalLoading:ek("renewal"),setRenewalError:tk("renewal")}),{reducer:gk,actions:Sk,name:vk}=st({name:"subscriptions/billing/subscription",initialState:fk,reducers:pk}),hk=O({load:rt(`${vk}/loadSubscription`),cancelSubscription:rt(`${vk}/cancelSubscription`),renewSubscription:rt(`${vk}/renewSubscription`)},Sk),mk={loading:!1,error:null,fetching:!0},bk=O({},XA()),{reducer:Ak,actions:kk,name:Tk}=st({name:"subscriptions/billing/information",initialState:mk,reducers:bk}),Pk=O({loadBillingInformation:rt(`${Tk}/loadBillingInformation`),cancelSubscription:hk.cancelSubscription,renewSubscription:hk.renewSubscription},kk),Ik={loading:!1,error:null,fetching:!0},Lk=O({},XA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Ek,actions:Ok,name:wk}=st({name:"subscriptions/billing/payment",initialState:Ik,reducers:Lk}),Dk=O({loadPaymentMethod:rt(`${wk}/loadPaymentMethod`),submitPaymentMethod:rt(`${wk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${wk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${wk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${wk}/updateBillingDetails`,(e=>({payload:e})))},Ok),Ck={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Rk=O({},XA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Uk,actions:_k,name:Mk}=st({name:"subscriptions/billing/invoices",initialState:Ck,reducers:Rk}),Nk=O({loadInvoices:rt(`${Mk}/loadInvoices`),downloadInvoice:rt(`${Mk}/downloadInvoice`,(e=>({payload:e})))},_k),Fk={information:mk,invoices:Ck,paymentMethod:Ik,subscription:fk},$k={invoices:Nk,information:Pk,paymentMethod:Dk,subscription:hk},Gk=xe({invoices:Uk,information:Ak,paymentMethod:Ek,subscription:gk}),xk={fetching:!0,loading:!1,error:null,confirmed:!1},Vk=O({},XA()),{actions:Wk,reducer:jk,name:Kk}=st({name:"subscriptions/checkout",initialState:xk,reducers:Vk}),Bk=O({loadCheckout:rt(`${Kk}/loadCheckout`),resetCheckout:rt(`${Kk}/resetCheckout`),submitCheckout:rt(`${Kk}/submitCheckout`),confirmCheckout:rt(`${Kk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${Kk}/errorCheckout`,(e=>({payload:e})))},Wk),zk={loading:!1,error:null,cardSetupIntentSecret:null},qk=O({},XA()),{reducer:Hk,actions:Jk,name:Yk}=st({name:"subscriptions/stripe",initialState:zk,reducers:qk}),Qk=O({loadCustomer:rt(`${Yk}/loadCustomer`),createCardSetupIntentSecret:rt(`${Yk}/createCardSetupIntentSecret`)},Jk),Xk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:Zk,reducer:eT,name:tT}=st({name:"subscriptions/vendorPublicConfig",initialState:Xk,reducers:O({},XA())}),nT=O({loadVendorPublicConfiguration:rt(`${tT}/loadVendorPublicConfiguration`)},Zk),oT={config:lk,plans:nk,checkout:xk,billing:Fk,stripe:zk,vendorPublicConfig:Xk},iT={config:yk,billing:$k,plans:rk,checkout:Bk,stripe:Qk,vendorPublicConfig:nT},aT=xe({config:uk,billing:Gk,plans:ik,checkout:jk,stripe:Hk,vendorPublicConfig:eT});let rT,lT,sT;function cT({policy:e}){return{policy:sT.AT_PERIOD_END}}function uT(e){switch(e){case Zu.ACTIVE:return lT.ACTIVE;case Zu.INCOMPLETE:return lT.INCOMPLETE;case Zu.CANCELED:return lT.CANCELED;case Zu.EXPIRED:return lT.EXPIRED;case Zu.TRIALING:return lT.TRIALING;default:return lT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(rT||(rT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(lT||(lT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(sT||(sT={}));const dT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Zu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},yT=[{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"}],fT=[{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:""}],pT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],gT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*ST(){yield oa(hk.load,vT),yield oa(hk.cancelSubscription,mT),yield oa(hk.renewSubscription,bT)}function*vT(){const e=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IT(e)}function*hT(){yield ai(hk.setLoading(!0));try{const[e]=yield si(qd.subscriptions.getManagedSubscriptions);yield ai(hk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ai(hk.setError(e))}}function*mT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Zu.ACTIVE)try{yield ai(hk.setCancellationLoading(!0)),yield si(qd.subscriptions.cancelManagedSubscription,t),yield hT(),yield ai(hk.setCancellationLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*bT(){const{subscription:e}=yield di((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ai(hk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ai(hk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===td.AT_PERIOD_END)try{yield ai(hk.setRenewalLoading(!0)),yield si(qd.subscriptions.renewManagedSubscription,t),yield hT(),yield ai(hk.setRenewalLoading(!1))}catch(e){yield ai(hk.setCancellationError(e.message))}}function*AT(){yield ai(hk.setLoading(!0)),yield yi(500),yield ai(hk.setState({subscription:dT,fetching:!1,loading:!1,error:null}))}function*kT(){yield oa(hk.load,AT)}function*TT(){yield oa(Pk.loadBillingInformation,PT)}function*PT(){yield function*(e){const t=yield di((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield di((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield IT(n,!1):yield ai(Pk.setError(t?"Not authorized":"Internal feature failure"))}()}function*IT(e,t){yield ai(Pk.setLoading(!0));try{var n,o;const i=yield si(qd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield si(qd.subscriptions.getSubscriptionPlan,a):([,l]=yield ri([si(hT),si(qd.subscriptions.getSubscriptionPlan,a)]),s=yield di((e=>e.subscriptions.billing.subscription.subscription||null))),yield ai(Pk.setState(O({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?lT.ACTIVE:uT(s.status),cancellation:s.cancellation&&cT(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield ai(Pk.setError(e.message))}}function*LT(){yield function*(){var e,t;yield ai(Pk.setLoading(!0)),yield yi(500),yield ai(Pk.setState({loading:!1,fetching:!1,summary:{subscriptionId:dT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:yT[0].id,defaultPlanId:yT[0].id},plan:O({},yT[0],{price:null==(e=yT[0].price)?void 0:e.amount,currency:null==(t=yT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*ET(){yield oa(Pk.loadBillingInformation,LT)}function*OT(){yield oa(Dk.loadPaymentMethod,wT),yield oa(Dk.submitPaymentMethod,CT),yield oa(Dk.submitPaymentMethodError,RT),yield oa(Dk.submitPaymentMethodSuccess,UT),yield oa(Dk.updatePaymentMethodBillingDetails,DT)}function*wT(){yield ai(Dk.setLoading(!0));try{const e=(yield si(qd.subscriptions.getPaymentMethods))[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ai(Dk.setError(e.message))}}function*DT({payload:e}){yield ai(Dk.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield si(qd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},o)),yield si(wT),null==i||i(!0)}catch(e){yield ai(Dk.setError(e.message)),null==i||i(!1)}yield ai(Dk.setLoading(!1))}function*CT(){yield ai(Dk.setLoading(!0))}function*RT({payload:e}){yield ai(Dk.setError(e))}function*UT(){yield ai(Dk.loadPaymentMethod())}function*_T(){yield ai(Dk.setLoading(!0)),yield yi(500);const e=pT[0];yield ai(Dk.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*MT(){yield oa(Dk.loadPaymentMethod,_T)}function*NT(){yield oa(Nk.loadInvoices,FT),yield oa(Nk.downloadInvoice,$T)}function*FT(){yield ai(Nk.setLoading(!0));try{const e=(yield si(qd.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 ai(Nk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ai(Nk.setError(e.message))}}function*$T({payload:e}){yield ai(Nk.setInvoiceDownloadState({loading:!0,error:null}));try{yield si(qd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ai(Nk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ai(Nk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*GT(){yield ai(Nk.setLoading(!0)),yield yi(500),yield ai(Nk.setState({loading:!1,fetching:!1,invoices:fT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ai(Nk.setLoading(!1))}function*xT(){yield oa(Nk.loadInvoices,GT)}function*VT(){yield ri([si(TT),si(OT),si(NT),si(ST)])}function*WT(){yield ri([si(ET),si(MT),si(xT),si(kT)])}function*jT(){yield oa(Bk.loadCheckout,KT),yield oa(Bk.resetCheckout,BT),yield oa(Bk.submitCheckout,zT),yield oa(Bk.confirmCheckout,qT),yield oa(Bk.errorCheckout,JT)}function*KT(){yield ai(Bk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*BT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!1}))}function*zT(){yield ai(Bk.setState({loading:!0,error:null}))}function*qT({payload:{paymentMethodId:e,planId:t}}){const n=yield di((e=>e.subscriptions.billing.subscription.subscription)),o=yield di((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Zu.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield ai(Bk.setState({loading:!0,error:null})),i&&a)return yield HT(),void(yield ai(hk.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield si(qd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ri([PT(),wT(),FT()]),yield HT()}catch(e){yield ai(Bk.setState({loading:!1,error:e.message}))}}else yield ai(Bk.setState({loading:!1,error:"Subscription not found"}))}function*HT(){yield ai(Bk.setState({loading:!1,error:null,confirmed:!0}))}function*JT({payload:e}){yield ai(Bk.setState({loading:!1,error:e}))}function*YT(){yield oa(Bk.resetCheckout,BT)}function*QT(){yield oa(rk.loadPlans,XT)}function*XT(){yield ai(rk.setLoading(!0));try{const e=(yield si(qd.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 ai(rk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ai(rk.setError(e.message))}}function*ZT(){yield ai(rk.setLoading(!0)),yield yi(500),yield ai(rk.setState({fetching:!1,loading:!1,plans:yT.map((e=>{var t,n;return O({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*eP(){yield oa(rk.loadPlans,ZT)}function*tP(){yield oa(yk.loadPaymentConfiguration,nP)}function*nP(){yield ai(yk.setLoading(!0));try{(yield si(qd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield ai(yk.setLoading(!0));try{const e=yield si(qd.subscriptions.getStripePaymentProviderConfiguration);yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ai(yk.setError(e.message))}}():yield ai(yk.setError("Payment provider not configured"))}catch(e){yield ai(yk.setError(e.message))}}function*oP(){yield ai(yk.setLoading(!0)),yield yi(500),yield ai(yk.setState({loading:!1,fetching:!1,config:{paymentProvider:rT.STRIPE,apiKey:""}}))}function*iP(){yield oa(yk.loadPaymentConfiguration,oP)}function*aP(){yield oa(Qk.createCardSetupIntentSecret,rP)}function*rP({payload:e}){yield ai(Qk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield si(qd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ai(Qk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ai(Qk.setError(e.message))}}function*lP(){yield oa(nT.loadVendorPublicConfiguration,sP)}function*sP(){yield ai(nT.setLoading(!0));try{const e=yield si(qd.subscriptions.getVendorPublicConfigurations);yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ai(nT.setError(e.message))}}function*cP(){yield ai(nT.setLoading(!0)),yield yi(500),yield ai(nT.setState({fetching:!1,loading:!1,vendorPublicConfig:gT}))}function*uP(){yield oa(nT.loadVendorPublicConfiguration,cP)}var dP={sagas:function*(){yield ri([si(VT),si(jT),si(QT),si(tP),si(aP),si(lP)])},mockSagas:function*(){yield ri([si(WT),si(YT),si(eP),si(iP),si(uP)])},reducer:aT,actions:iT,initialState:oT,storeName:"subscriptions"},yP={sagas:function*(){yield oa(Ky.loadVendorPublicInfo,By)},storeName:Dt,initialState:Vy,reducer:Wy,actions:Ky};const{reducer:fP}=st({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),pP=(e,t,n=!1,o,i,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,p,g,S,v;n||a||ra.setContext(e.context);const t=Hi(),h=[...it({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=at({middleware:h,preloadedState:{root:O({},e,{previewMode:n,urlStrategy:r}),[Fb.storeName]:O({},Fb.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:O({},Fb.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[cA.storeName]:O({},cA.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:O({},cA.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},cA.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[dA]:O({},uA,null!=(v=null==i?void 0:i.audits)?v:{}),[QA.storeName]:QA.initialState,[dP.storeName]:dP.initialState,[yP.storeName]:yP.initialState},reducer:xe({root:fP,[Fb.storeName]:Fb.reducer,[cA.storeName]:cA.reducer,[dA]:fA,[QA.storeName]:QA.reducer,[dP.storeName]:dP.reducer,[yP.storeName]:yP.reducer})});const m=function*(){yield ri([si(Fb.sagas),si(cA.sagas),si(PA),si(QA.sagas),si(dP.sagas),si(yP.sagas)])},b=function*(){yield ri([si(Fb.mockSagas),si(cA.mockSagas),si(dP.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(lo.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var gP=n(714),SP=n.n(gP);function vP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function hP(e){if(e.type)return e;if("#"===e.charAt(0))return hP(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function mP(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function bP(e){if(0===e.indexOf("#"))return e;const{values:t}=hP(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 AP(e,t){return e=hP(e),t=vP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,mP(e)}function kP(e,t){if(e=hP(e),t=vP(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 mP(e)}function TP(e,t){if(e=hP(e),t=vP(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 mP(e)}const PP=e=>{if(e)return{main:e,light:bP(TP(e,.4)),dark:bP(kP(e,.15)),hover:bP(kP(e,.15)),active:bP(kP(e,.2))}},IP=e=>{if(e)return{main:e,light:TP(e,.7),dark:kP(e,.2)}},LP=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?O({},t,{palette:{primary:O({},PP(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:O({},PP(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:O({},PP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},IP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},IP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},IP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},IP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},EP={},OP={},wP={},DP={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class CP{constructor(){this._theme=EP,this._themeV2=OP,this._navigation=DP,this._localizations=wP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new CP;return n.set(e),CP._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,o,i,a,r,l;this._navigation=SP().all([null!=(t=DP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=SP().all([null!=(o=EP)?o:{},LP(null==e?void 0:e.theme,EP)]),this._themeV2=SP().all([null!=(i=OP)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=SP().all([null!=(r=wP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=DP,this._theme=EP,this._themeV2=OP,this._localizations=wP}}}CP._instances={};var RP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},UP=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},_P=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))};let MP,NP,FP,$P,GP,xP,VP,WP,jP,KP,BP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(MP||(MP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(NP||(NP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(FP||(FP={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}($P||($P={})),function(e){e.Invoices="invoices"}(GP||(GP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(xP||(xP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(VP||(VP={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(WP||(WP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(jP||(jP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(KP||(KP={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(BP||(BP={}));const zP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},qP={hidden:"hidden",edit:"edit"};var HP="6.85.0",JP={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"},YP=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];k(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(HP),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(R().mark((function e(){var t,n,o,a,r;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:CP.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}fd.set(JP,i.name),e.next=14;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,fd.set(t,i.name),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e};var l=RP(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=pP({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);E.setInstance(l,this)}var t,n,o,i;return L(e,[{key:"initContainers",value:(i=D(R().mark((function e(t){return R().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 i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;CP.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:b,FronteggTypes:A})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(R().mark((function e(){var t;return R().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(R().mark((function e(t){var n;return R().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,O({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}(),QP=function(){function e(){k(this,e)}return L(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=E.getInstance(o);e&&t?(ra.setAccessToken(t),ra.setUser(O({},n,{accessToken:t})),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(lo.loadTenants())):(ra.setAccessToken(null),ra.setUser(null),i.store.dispatch(lo.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),XP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideAdminPortal()}}]),e}(),ZP=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";E.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideCheckoutDialog()}}]),e}(),eI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},tI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new YP(this.options,t,!0),CP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,_P(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}(),nI="modern",oI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[nI]},iI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];k(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=pP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new YP(this.options,t,!0,a),CP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,_P(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 aI(e,t){return aI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},aI(e,t)}function rI(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&&aI(e,t)}function lI(e,t){if(t&&("object"===T(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 sI(e){return sI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},sI(e)}function cI(){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 uI(e,t,n){return uI=cI()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&aI(i,n.prototype),i},uI.apply(null,arguments)}function dI(e){var t="function"==typeof Map?new Map:void 0;return dI=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 uI(e,arguments,sI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),aI(n,e)},dI(e)}function yI(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=sI(e);if(t){var i=sI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return lI(this,n)}}var fI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new YP(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){rI(n,e);var t=yI(n);function n(){var e;k(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return L(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=E.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var o=UP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=UP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=UP(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=UP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=UP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=UP(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(dI(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var __webpack_modules__={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},965:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e,t){return function(n){return new Sha256(t,!0).update(n)[e]()}},createMethod=function(e){var t=createOutputMethod("hex",e);NODE_JS&&(t=nodeWrap(t,e)),t.create=function(){return new Sha256(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];t[i]=createOutputMethod(i,e)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(e){if("string"==typeof e)return crypto.createHash(algorithm).update(e,"utf8").digest("hex");if(null==e)throw new Error(ERROR);return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod},createHmacOutputMethod=function(e,t){return function(n,i){return new HmacSha256(n,t,!0).update(i)[e]()}},createHmacMethod=function(e){var t=createHmacOutputMethod("hex",e);t.create=function(t){return new HmacSha256(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];t[i]=createHmacOutputMethod(i,e)}return t};function Sha256(e,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(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.is224=e}function HmacSha256(e,t,n){var i,o=typeof e;if("string"===o){var a,r=[],s=e.length,l=0;for(i=0;i<s;++i)(a=e.charCodeAt(i))<128?r[l++]=a:a<2048?(r[l++]=192|a>>6,r[l++]=128|63&a):a<55296||a>=57344?(r[l++]=224|a>>12,r[l++]=128|a>>6&63,r[l++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++i)),r[l++]=240|a>>18,r[l++]=128|a>>12&63,r[l++]=128|a>>6&63,r[l++]=128|63&a);e=r}else{if("object"!==o)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR)}e.length>64&&(e=new Sha256(t,!0).update(e).array());var c=[],u=[];for(i=0;i<64;++i){var d=e[i]||0;c[i]=92^d,u[i]=54^d}Sha256.call(this,t,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}Sha256.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR);t=!0}for(var i,o,a=0,r=e.length,s=this.blocks;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]<<SHIFT[3&o++];else for(o=this.start;a<r&&o<64;++a)(i=e.charCodeAt(a))<128?s[o>>2]|=i<<SHIFT[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<SHIFT[3&o++],s[o>>2]|=(128|i>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<SHIFT[3&o++],s[o>>2]|=(128|i>>12&63)<<SHIFT[3&o++],s[o>>2]|=(128|i>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[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}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[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()}},Sha256.prototype.hash=function(){var e,t,n,i,o,a,r,s,l,c=this.h0,u=this.h1,d=this.h2,y=this.h3,f=this.h4,p=this.h5,g=this.h6,S=this.h7,h=this.blocks;for(e=16;e<64;++e)t=((o=h[e-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,n=((o=h[e-2])>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,h[e]=h[e-16]+t+h[e-7]+n<<0;for(l=u&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,S=(o=h[0]-1413257819)-150054599<<0,y=o+24177077<<0):(a=704751109,S=(o=h[0]-210244248)-1521486534<<0,y=o+143694565<<0),this.first=!1):(t=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(a=c&u)^c&d^l,S=y+(o=S+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&p^~f&g)+K[e]+h[e])<<0,y=o+(t+i)<<0),t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),i=(r=y&c)^y&u^a,g=d+(o=g+(n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7))+(S&f^~S&p)+K[e+1]+h[e+1])<<0,t=((d=o+(t+i)<<0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(s=d&y)^d&c^r,p=u+(o=p+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&S^~g&f)+K[e+2]+h[e+2])<<0,t=((u=o+(t+i)<<0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(l=u&d)^u&y^s,f=c+(o=f+(n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&g^~p&S)+K[e+3]+h[e+3])<<0,c=o+(t+i)<<0;this.h0=this.h0+c<<0,this.h1=this.h1+u<<0,this.h2=this.h2+d<<0,this.h3=this.h3+y<<0,this.h4=this.h4+f<<0,this.h5=this.h5+p<<0,this.h6=this.h6+g<<0,this.h7=this.h7+S<<0},Sha256.prototype.hex=function(){this.finalize();var 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=HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r];return this.is224||(l+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var 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 this.is224||l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28: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),this.is224||t.setUint32(28,this.h7),e},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()},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 L(i||[]);return r(a,"_invoke",{value:_(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 h(){}var v={};d(v,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(O([])));b&&b!==n&&a.call(b,l)&&(v=b);var A=h.prototype=g.prototype=Object.create(v);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 _(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=P(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 P(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,P(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 E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=h,r(A,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:S,configurable:!0}),S.displayName=d(h,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,h):(e.__proto__=h,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=O,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var 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),I(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;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),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)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.amdO={},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AdminPortal:function(){return eP},AdminPortalRenderer:function(){return iP},AppHolder:function(){return P},CheckoutDialog:function(){return tP},FronteggApp:function(){return Q_},HostedLogin:function(){return Z_},LoginBoxRenderer:function(){return rP},createElement:function(){return M_},defaultTheme:function(){return oP},formatName:function(){return U_},getThemeAdminByName:function(){return nP},getThemeByName:function(){return aP},initialize:function(){return gP},mockFlagsList:function(){return Y_},waitThemeSetter:function(){return N_}});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{Delete:function(){return fa},Get:function(){return ca},Patch:function(){return da},Post:function(){return ua},PostDownload:function(){return pa},Put:function(){return ya},getBaseUrl:function(){return sa}});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{getSubTenants:function(){return Ja},getSubTenantsAsTree:function(){return Ya},getTenants:function(){return Xa},switchTenant:function(){return za}});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{AuthStrategyEnum:function(){return _r},MachineToMachineAuthStrategy:function(){return Pr},OAuthLogout:function(){return Xr},SocialLoginProviders:function(){return Tr},acceptInvitation:function(){return Br},activateAccount:function(){return Vr},bulkCreateIPRestriction:function(){return vr},changePhoneNumber:function(){return $l},changePhoneNumberWithVerification:function(){return Nl},checkIfAllowToRememberMfaDevice:function(){return dl},createDomainRestriction:function(){return yr},createIPRestriction:function(){return hr},createOrUpdateSessionConfigrations:function(){return Xs},createSSOConfiguration:function(){return Sl},createSSOConfigurationByMetadata:function(){return ml},createSSODomain:function(){return Al},createSSOGroup:function(){return El},createSamlGroup:function(){return Us},createTenantAccessToken:function(){return il},createUserAccessToken:function(){return nl},deleteAllSessionsForUser:function(){return Ys},deleteDomainRestriction:function(){return pr},deleteIPRestriction:function(){return br},deleteSSOConfiguration:function(){return vl},deleteSSODomain:function(){return kl},deleteSSOGroup:function(){return Ll},deleteSamlGroup:function(){return Ns},deleteSessionForUser:function(){return Js},deleteTenantAccessToken:function(){return el},deleteTenantApiToken:function(){return ll},deleteUserAccessToken:function(){return tl},deleteUserApiToken:function(){return cl},deleteWebAuthnDevice:function(){return Wl},disableMFAAuthenticatorApp:function(){return cs},disableMFASMS:function(){return ds},disableMFAWebAuthn:function(){return fs},disableMfa:function(){return ls},enrollMFAAuthenticatorApp:function(){return ns},enrollMFAAuthenticatorAppForLogin:function(){return Ss},enrollMFASMS:function(){return os},enrollMFASMSForLogin:function(){return ms},enrollMFAWebAuthn:function(){return rs},enrollMFAWebAuthnForLogin:function(){return Ts},enrollMfa:function(){return es},exchangeOAuthTokens:function(){return Cl},forgotPassword:function(){return Jr},generateLoginResponse:function(){return Cr},generateLoginResponseFromOAuthResponse:function(){return Ur},generateLoginResponseV2:function(){return Dr},getActivateAccountStrategy:function(){return Hr},getCaptchaPolicy:function(){return ar},getCurrentUserSession:function(){return Ks},getCurrentUserSessions:function(){return Bs},getCustomSocialLoginProvidersV1:function(){return Vs},getDomainRestrictions:function(){return ur},getDomainRestrictionsConfig:function(){return dr},getGlobalSecurityPolicy:function(){return Qa},getIPRestrictions:function(){return gr},getIPRestrictionsConfig:function(){return Sr},getLockoutPolicy:function(){return nr},getMFADevices:function(){return ps},getMFAStrategiesConfig:function(){return Kl},getMfaPolicy:function(){return Za},getOidcConfiguration:function(){return Fs},getPasswordConfigPolicy:function(){return cr},getPasswordHistoryPolicy:function(){return rr},getSSOConfigurations:function(){return gl},getSSODefaultRoles:function(){return _l},getSSOGroups:function(){return Ol},getSSOPublicConfiguration:function(){return $s},getSamlConfiguration:function(){return Es},getSamlRoles:function(){return Rs},getSamlRolesGroups:function(){return Cs},getSamlVendorConfiguration:function(){return Ls},getSessionConfigurations:function(){return zs},getSocialLoginProviders:function(){return Gs},getSocialLoginProvidersV2:function(){return xs},getTenantAccessTokensData:function(){return Zs},getTenantApiTokensData:function(){return al},getUserAccessTokensData:function(){return Qs},getUserApiTokensData:function(){return ol},getUserById:function(){return ul},getVendorConfig:function(){return Ws},getVendorLockoutPolicy:function(){return ir},getVendorMfaPolicy:function(){return er},getVendorPasswordHistoryPolicy:function(){return sr},getVendorPublicAuthStrategiesConfig:function(){return Bl},getWebAuthnDevices:function(){return Hl},loadPasswordConfig:function(){return Qr},login:function(){return Gr},loginViaSocialLogin:function(){return Hs},loginWithMfa:function(){return xr},logout:function(){return zr},oidcPostLogin:function(){return $r},oidcPostLoginV2:function(){return Rl},passwordlessPostLogin:function(){return fl},passwordlessPreLogin:function(){return yl},postLogin:function(){return Fr},preDisableMFASMS:function(){return us},preDisableMFAWebAuthn:function(){return ys},preEnrollMFAAuthenticatorApp:function(){return ts},preEnrollMFAAuthenticatorAppForLogin:function(){return gs},preEnrollMFASMS:function(){return is},preEnrollMFASMSForLogin:function(){return vs},preEnrollMFAWebAuthn:function(){return as},preEnrollMFAWebAuthnForLogin:function(){return ks},preLogin:function(){return Mr},preLoginV2:function(){return wl},preLoginWithIdpType:function(){return Nr},preVerifyMFASMSForLogin:function(){return bs},preVerifyMFAWebAuthnForLogin:function(){return _s},recoverMfaToken:function(){return Zr},refreshToken:function(){return Kr},refreshTokenV2:function(){return qr},resendActivationEmail:function(){return Wr},resendInvitationEmail:function(){return jr},resetPassword:function(){return Yr},resetPhoneNumber:function(){return Ul},revokeSessionsForUser:function(){return qs},saveLockoutPolicy:function(){return or},saveMfaPolicy:function(){return tr},savePasswordHistoryPolicy:function(){return lr},setSSODefaultRoles:function(){return Pl},signUpUser:function(){return js},silentOAuthRefreshToken:function(){return Dl},testCurrentIp:function(){return Ar},testCurrentIpInAllowList:function(){return kr},updateDomainRestrictionConfig:function(){return fr},updateIPRestrictionConfig:function(){return mr},updateSSOConfiguration:function(){return hl},updateSSOConfigurationByMetadata:function(){return bl},updateSSOGroup:function(){return Il},updateSamlConfiguration:function(){return Is},updateSamlGroup:function(){return Ms},updateSamlRoles:function(){return Ds},updateSamlVendorMetadata:function(){return Os},updateTenantApiTokensData:function(){return sl},updateUserApiTokensData:function(){return rl},validateSSODomain:function(){return Tl},validateSamlDomain:function(){return ws},verifyChangePhoneNumber:function(){return Fl},verifyInviteToken:function(){return pl},verifyMFAAuthenticatorAppForLogin:function(){return hs},verifyMFASMSForLogin:function(){return As},verifyMFAWebAuthnForLogin:function(){return Ps},verifyMfa:function(){return ss},verifyNewDeviceSession:function(){return jl},verifyResetPhoneNumber:function(){return Ml},webAuthnCreateNewDeviceSession:function(){return Vl},webAuthnPostLogin:function(){return xl},webAuthnPreLogin:function(){return Gl}});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{addUser:function(){return Ql},changePassword:function(){return Jl},createInviteUserLink:function(){return tc},deleteInviteUserLink:function(){return ic},deleteUser:function(){return Zl},getInviteLinkConfiguration:function(){return ac},getInviteUserLink:function(){return oc},getProfile:function(){return ql},loadAvailablePermissions:function(){return sc},loadAvailableRoles:function(){return rc},loadStats:function(){return lc},loadUsers:function(){return Yl},resendActivationLink:function(){return cc},resendInvitationLink:function(){return uc},resendInvitationLinkToAllTenants:function(){return dc},updateInviteUserLink:function(){return nc},updateProfile:function(){return zl},updateProfileImage:function(){return Xl},updateUser:function(){return ec}});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{getAuditsMetadata:function(){return Sc},getCurrentUserIpMetadata:function(){return fc},getIpAdressMetadata:function(){return hc},getNotificationsMetadata:function(){return pc},getSamlMetadata:function(){return gc}});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{downloadReport:function(){return Pc},getReport:function(){return kc},getReports:function(){return Ac},renderReport:function(){return Tc},scheduleReport:function(){return _c},sendReport:function(){return Ec}});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{getNotifications:function(){return Ic},markAllAsRead:function(){return wc},updateNotificationIsPinned:function(){return Oc},updateNotificationStatus:function(){return Lc}});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{exportAudits:function(){return Uc},getAudits:function(){return Cc},getAuditsStats:function(){return Dc}});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{deleteEmailConfiguration:function(){return zc},deleteEmailSubscriptions:function(){return Kc},deleteSMSConfiguration:function(){return eu},deleteSMSSubscriptions:function(){return Qc},deleteSlackConfiguration:function(){return Vc},deleteWebhooksConfiguration:function(){return iu},getCategories:function(){return su},getChannelMaps:function(){return lu},getEmailConfiguration:function(){return Wc},getSMSConfiguration:function(){return Xc},getSlackChannels:function(){return Gc},getSlackConfiguration:function(){return Fc},getSlackScope:function(){return $c},getWebhookLog:function(){return ou},getWebhooksConfigurations:function(){return tu},patchEmailConfiguration:function(){return Bc},patchSMSConfiguration:function(){return Yc},postEmailConfiguration:function(){return jc},postSMSConfiguration:function(){return Jc},postSlackCode:function(){return Hc},postSlackConfiguration:function(){return xc},postWebhookRetry:function(){return ru},postWebhookTest:function(){return au},postWebhooksConfiguration:function(){return nu},putEmailSubscriptions:function(){return qc},putSMSSubscriptions:function(){return Zc}});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{getSettings:function(){return uu},updateSettings:function(){return cu}});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{addRole:function(){return gu},attachPermissionToRoles:function(){return bu},attachPermissionsToRole:function(){return vu},deleteRole:function(){return Su},getPermissionCategories:function(){return Au},getPermissions:function(){return mu},getRoles:function(){return pu},updateRole:function(){return hu}});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{ISubscriptionCancellationPolicy:function(){return Zu},ISubscriptionStatus:function(){return Yu},PaymentMethodType:function(){return Qu},ProviderType:function(){return ed},TenantCreatedAction:function(){return nd},TrialEndAction:function(){return td},cancelManagedSubscription:function(){return Ou},cancelSubscription:function(){return _u},createStripeCustomer:function(){return Wu},createStripePaymentMethodSetupIntentSecret:function(){return Bu},createSubscription:function(){return Vu},createTenantConfiguration:function(){return zu},getManagedSubscription:function(){return Iu},getManagedSubscriptions:function(){return Lu},getPaymentMethod:function(){return Gu},getPaymentMethods:function(){return $u},getPaymentProviders:function(){return Xu},getStripeCustomer:function(){return Hu},getStripePaymentProviderConfiguration:function(){return ju},getSubscription:function(){return Tu},getSubscriptionInvoice:function(){return Mu},getSubscriptionInvoicePdf:function(){return Nu},getSubscriptionInvoices:function(){return Uu},getSubscriptionPlan:function(){return Du},getSubscriptionPlans:function(){return Cu},getSubscriptionSummaries:function(){return Ku},getSubscriptions:function(){return ku},getTenantConfiguration:function(){return qu},getVendorPublicConfigurations:function(){return Ju},renewManagedSubscription:function(){return wu},renewSubscription:function(){return Pu},updateManagedSubscription:function(){return Ru},updatePaymentMethodBillingDetails:function(){return xu},updateSubscription:function(){return Eu}});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{getVendorPublicInfo:function(){return id}});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{addUserRolesForSubTenants:function(){return sd},addUserToTenantAndSubTenants:function(){return ad},loadAllUsers:function(){return od},removeUserFromTenantAndSubTenants:function(){return rd},removeUserRolesFromSubTenants:function(){return ld},setUserRolesForSubTenants:function(){return cd}});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{FeatureFlags:function(){return dd},loadFeatureFlags:function(){return yd}});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{countConfigurationUsers:function(){return hd},createConfiguration:function(){return gd},deleteConfiguration:function(){return Sd},getConfigs:function(){return fd},updateConfiguration:function(){return pd}});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{impersonate:function(){return vd}});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{addRolesToGroup:function(){return Ed},addUsersToGroup:function(){return Ld},createGroup:function(){return Td},deleteGroup:function(){return Pd},deleteRolesFromGroup:function(){return Id},deleteUsersFromGroup:function(){return Od},getGroupById:function(){return bd},getGroupConfiguration:function(){return wd},getGroups:function(){return Ad},getGroupsByIds:function(){return kd},updateGroup:function(){return _d},updateGroupConfiguration:function(){return Rd}});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{AuthStrategyEnum:function(){return _r},ContextHolder:function(){return oa},FeatureFlags:function(){return dd},FronteggApiError:function(){return ra},FronteggContext:function(){return aa},GroupManagedByEnum:function(){return jd},GroupRelations:function(){return Wd},ISubscriptionCancellationPolicy:function(){return Zu},ISubscriptionStatus:function(){return Yu},MFAStrategyEnum:function(){return Ud},MachineToMachineAuthStrategy:function(){return Pr},PaymentMethodType:function(){return Qu},ProviderType:function(){return ed},RestrictionType:function(){return Nn},ScimConnectionSource:function(){return Hd},SecondaryAuthStrategy:function(){return Cd},SocialLoginProviders:function(){return Tr},TenantType:function(){return Nd},UserManagedByEnum:function(){return Md},WebAuthnDeviceType:function(){return Dd},api:function(){return Bd},countConfigurationUsers:function(){return hd},createConfiguration:function(){return gd},default:function(){return Kd},deleteConfiguration:function(){return Sd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Fd},fronteggRefreshTokenUrl:function(){return $d},fronteggSilentRefreshTokenUrl:function(){return Gd},fronteggTenantsUrl:function(){return Vd},fronteggUsersUrl:function(){return xd},getConfigs:function(){return fd},loadFeatureFlags:function(){return yd},updateConfiguration:function(){return pd}});var m={};function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e){return A="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},A(e)}function k(e){var t=function(e,t){if("object"!==A(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==A(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===A(t)?t:String(t)}function T(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,k(i.key),i)}}function _(e,t,n){return t&&T(e.prototype,t),n&&T(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}__webpack_require__.r(m),__webpack_require__.d(m,{AccountPageFields:function(){return x_},DomainRestrictionsTabFields:function(){return K_},GeneralSettingsTabFields:function(){return j_},InviteUserModalFields:function(){return G_},IpRestrictionsTabFields:function(){return B_},Metadata:function(){return D_},PrivacyPageFields:function(){return $_},ProfilePageFields:function(){return F_},SecurityPageTabs:function(){return H_},SessionManagementTabFields:function(){return W_},SsoPageTabs:function(){return q_},SubscriptionsPageFields:function(){return V_},alpha:function(){return T_},fieldAppearance:function(){return z_},tabAppearance:function(){return X_}});var P=function(){function e(){b(this,e)}return _(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function E(){return E=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},E.apply(this,arguments)}function I(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 L(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){I(a,i,o,r,s,"next",e)}function s(e){I(a,i,o,r,s,"throw",e)}r(void 0)}))}}P._apps={};var O=__webpack_require__(841),w=__webpack_require__.n(O);function R(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 C(e){return!!e&&!!e[ve]}function D(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)===me}(e)||Array.isArray(e)||!!e[he]||!!e.constructor[he]||G(e)||x(e))}function U(e,t,n){void 0===n&&(n=!1),0===M(e)?(n?Object.keys:be)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function M(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:G(e)?2:x(e)?3:0}function N(e,t){return 2===M(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function F(e,t,n){var i=M(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function G(e){return fe&&e instanceof Map}function x(e){return pe&&e instanceof Set}function V(e){return e.o||e.t}function H(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ae(e);delete t[ve];for(var n=be(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function W(e,t){return void 0===t&&(t=!1),B(e)||C(e)||!D(e)||(M(e)>1&&(e.set=e.add=e.clear=e.delete=j),Object.freeze(e),t&&U(e,(function(e,t){return W(t,!0)}),!0)),e}function j(){R(2)}function B(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function K(e){var t=ke[e];return t||R(18,e),t}function q(){return de}function z(e,t){t&&(K("Patches"),e.u=[],e.s=[],e.v=t)}function X(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===de&&(de=e.l)}function Y(e){return de={p:[],l:de,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function Z(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||K("ES5").S(t,e,i),i?(n[ve].P&&(X(t),R(4)),D(e)&&(e=ee(t,e),t.l||ne(t,e)),t.u&&K("Patches").M(n[ve].t,e,t.u,t.s)):e=ee(t,n,[]),X(t),t.u&&t.v(t.u,t.s),e!==Se?e:void 0}function ee(e,t,n){if(B(t))return t;var i=t[ve];if(!i)return U(t,(function(o,a){return te(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ne(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=H(i.k):i.o;U(3===i.i?new Set(o):o,(function(t,a){return te(e,i,o,t,a,n)})),ne(e,o,!1),n&&e.u&&K("Patches").R(i,n,e.u,e.s)}return i.o}function te(e,t,n,i,o,a){if(C(o)){var r=ee(e,o,a&&t&&3!==t.i&&!N(t.D,i)?a.concat(i):void 0);if(F(n,i,r),!C(r))return;e.m=!1}if(D(o)&&!B(o)){if(!e.h.F&&e._<1)return;ee(e,o),t&&t.A.l||ne(e,o)}}function ne(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ie(e,t){var n=e[ve];return(n?V(n):e)[t]}function oe(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 ae(e){e.P||(e.P=!0,e.l&&ae(e.l))}function re(e){e.o||(e.o=H(e.t))}function se(e,t,n){var i=G(t)?K("MapSet").N(t,n):x(t)?K("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=Te;n&&(o=[i],a=_e);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):K("ES5").J(t,n);return(n?n.A:q()).p.push(i),i}function le(e){return C(e)||R(22,e),function e(t){if(!D(t))return t;var n,i=t[ve],o=M(t);if(i){if(!i.P&&(i.i<4||!K("ES5").K(i)))return i.t;i.I=!0,n=ce(t,o),i.I=!1}else n=ce(t,o);return U(n,(function(t,o){i&&function(e,t){return 2===M(e)?e.get(t):e[t]}(i.t,t)===o||F(n,t,e(o))})),3===o?new Set(n):n}(e)}function ce(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return H(e)}var ue,de,ye="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),fe="undefined"!=typeof Map,pe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Se=ye?Symbol.for("immer-nothing"):((ue={})["immer-nothing"]=!0,ue),he=ye?Symbol.for("immer-draftable"):"__$immer_draftable",ve=ye?Symbol.for("immer-state"):"__$immer_state",me=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),be="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ae=Object.getOwnPropertyDescriptors||function(e){var t={};return be(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},ke={},Te={get:function(e,t){if(t===ve)return e;var n=V(e);if(!N(n,t))return function(e,t,n){var i,o=oe(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||!D(i)?i:i===ie(e.t,t)?(re(e),e.o[t]=se(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=oe(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ie(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||N(e.t,t)))return!0;re(e),ae(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!==ie(e.t,t)||t in e.t?(e.D[t]=!1,re(e),ae(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){R(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){R(12)}},_e={};U(Te,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Te.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),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&&R(6),void 0!==i&&"function"!=typeof i&&R(7),D(e)){var s=Y(t),l=se(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?X(s):J(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(s,i),Z(e,s)}),(function(e){throw X(s),e})):(z(s,i),Z(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Se&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];K("Patches").M(e,r,u,d),i(u,d)}return r}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){D(e)||R(8),C(e)&&(e=le(e));var t=Y(this),n=se(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return z(n,t),Z(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&R(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=K("Patches").$;return C(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ee=new Pe,Ie=Ee.produce,Le=(Ee.produceWithPatches.bind(Ee),Ee.setAutoFreeze.bind(Ee),Ee.setUseProxies.bind(Ee),Ee.applyPatches.bind(Ee),Ee.createDraft.bind(Ee),Ee.finishDraft.bind(Ee),Ie);function Oe(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(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 Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(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 De="function"==typeof Symbol&&Symbol.observable||"@@observable",Ue=function(){return Math.random().toString(36).substring(7).split("").join(".")},Me={INIT:"@@redux/INIT"+Ue(),REPLACE:"@@redux/REPLACE"+Ue(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ue()}};function Ne(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 Fe(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ce(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ce(1));return n(Fe)(e,t)}if("function"!=typeof e)throw new Error(Ce(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(Ce(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ce(4));if(l)throw new Error(Ce(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ce(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!Ne(e))throw new Error(Ce(7));if(void 0===e.type)throw new Error(Ce(8));if(l)throw new Error(Ce(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(Ce(10));o=e,y({type:Me.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ce(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[De]=function(){return this},e}return y({type:Me.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[De]=p,i}function $e(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Me.INIT}))throw new Error(Ce(12));if(void 0===n(void 0,{type:Me.PROBE_UNKNOWN_ACTION()}))throw new Error(Ce(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(Ce(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Ge(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ce(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Ge.apply(void 0,a)(n.dispatch),Re(Re({},n),{},{dispatch:i})}}}function Ve(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var He=Ve();He.withExtraArgument=Ve;var We,je=He,Be=(We=function(e,t){return We=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},We(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ke=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,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Xe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))Xe.call(t,n)&&Ye(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Ze="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ge:Ge.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var et=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 Be(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,Ke([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ke([void 0],e.concat(this))))},t}(Array);function tt(e){return D(e)?Le(e,(function(){})):e}function nt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new et);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(je):i.push(je.withExtraArgument(n.extraArgument))),i}function it(e){var t,n=function(e){return nt(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=$e(a)}var p=s;"function"==typeof p&&(p=p(n));var g=xe.apply(void 0,p),S=Ge;c&&(S=Ze(Qe({trace:!1},"object"==typeof c&&c)));var h=[g];return Array.isArray(f)?h=Ke([g],f):"function"==typeof f&&(h=f(h)),Fe(t,d,S.apply(void 0,h))}function ot(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return Qe(Qe({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function at(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 rt(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:tt(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?at(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=Qe(Qe({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?at(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return tt(e())};else{var c=tt(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ke([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(C(e))return void 0===(i=n(e,t))?e:i;if(D(e))return Le(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?ot(c,i):ot(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 st="listenerMiddleware";ot(st+"/add"),ot(st+"/removeAll"),ot(st+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ve];return Te.get(t,e)},set:function(t){var n=this[ve];Te.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&ae(o);break;case 4:n(o)&&ae(o)}}}function n(e){for(var t=e.t,n=e.k,i=be(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!N(t,a))return!0;var s=n[a],l=s&&s[ve];if(l?l.t!==r:!$(s,r))return!0}}var c=!!t[ve];return i.length!==be(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){ke[e]||(ke[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=Ae(n);delete a[ve];for(var r=be(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,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?C(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)U(a,(function(t){t!==ve&&(void 0!==o[t]||N(o,t)?r[t]||e(a[t]):(r[t]=!0,ae(n)))})),U(o,(function(e){void 0!==a[e]||N(a,e)||(r[e]=!1,ae(n))}));else if(5===s){if(i(n)&&(ae(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 lt=(e,t)=>n=>E({},n,{[e]:t[e]}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),ut=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return E({},n,{[e]:E({},n[e],{[t]:E({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{loaders:E({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),yt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{errors:E({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),ft=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),pt=(e,t,n)=>i=>{var o;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(o=i[e])?void 0:o[t],n)})})},gt=(e=500)=>new Promise((t=>setTimeout(t,e))),St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ht=new Uint8Array(256);for(let e=0;e<St.length;e++)ht[St.charCodeAt(e)]=e;const vt=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=ht[e.charCodeAt(i)],a=ht[e.charCodeAt(i+1)],r=ht[e.charCodeAt(i+2)],s=ht[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},mt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(mt(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+=St[t[i]>>2],o+=St[(3&t[i])<<4|t[i+1]>>4],o+=St[(15&t[i+1])<<2|t[i+2]>>6],o+=St[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]=mt(e[n]);return t}return e};let bt,At,kt;!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"}(bt||(bt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(At||(At={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(kt||(kt={}));const Tt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",_t="HOSTED_LOGIN_VERIFIER_KEY",Pt="auth",Et="connectivity",It="auditLogs",Lt="vendor",Ot={flow:At.Login,step:bt.preLogin,loading:!1,email:"",tenants:[]},wt={setLoginState:ct("loginState"),resetLoginState:lt("loginState",{loginState:Ot})},Rt={requestAuthorize:ot("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ot("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ot("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:ot("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ot("auth/afterAuthNavigation"),preLogin:ot("auth/preLogin",(e=>({payload:e}))),postLogin:ot("auth/postLogin",(e=>({payload:e}))),login:ot("auth/login",(e=>({payload:e}))),loginWithMfa:ot("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ot("auth/recoverMfa",(e=>({payload:e}))),logout:ot("auth/logout",(e=>({payload:e}))),silentLogout:ot("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ot("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ot("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ot("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ot("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ot("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ot("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ot("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ot("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ot("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ot("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ot("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ot("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ot("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ot("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ot("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ot("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ot("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ot("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ot("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ot("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ot("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Ct;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ct||(Ct={}));const Dt={step:Ct.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Ut={setActivateState:ct("activateState"),resetActivateState:lt("activateState",{activateState:Dt}),setActivateStrategyState:ut("activateState","activationStrategy")},Mt={activateAccount:ot("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ot("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ot("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ot("auth/resendActivationEmail",(e=>({payload:e})))};let Nt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Nt||(Nt={}));const Ft={step:Nt.validate},$t={setAcceptInvitationState:ct("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ft})},Gt={acceptInvitation:ot("auth/acceptInvitation",(e=>({payload:e})))};let xt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(xt||(xt={}));const Vt={step:xt.forgotPassword,loading:!1,email:"",passwordConfig:null},Ht={setForgotPasswordState:ct("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Vt})},Wt={forgotPassword:ot("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ot("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ot("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Bt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:ct("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Bt})},qt={resetPhoneNumber:ot("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ot("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ot("auth/changePhoneNumber",(e=>({payload:e})))},zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Xt={setSSOLoader:dt("ssoState"),setSSOError:yt("ssoState"),setSSOState:ct("ssoState"),resetSSOState:lt("ssoState",{ssoState:zt})},Jt={loadSSOConfigurationsV2:ot("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ot("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ot("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ot("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ot("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ot("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ot("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ot("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ot("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ot("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ot("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ot("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ot("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ot("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ot("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ot("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ot("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ot("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ot("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ot("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ot("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ot("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ot("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ot("auth/oidcPostlogin",(e=>({payload:e})))},Yt={loading:!1,error:null},Qt={setProfileState:ct("profileState"),resetProfileState:lt("profileState",{profileState:Yt})},Zt={loadProfile:ot("auth/loadProfile"),saveProfile:ot("auth/saveProfile",(e=>({payload:e}))),changePassword:ot("auth/changePassword",(e=>({payload:e})))};let en;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(en||(en={}));const tn={step:en.verify,loading:!1,saving:!1},nn={setMfaState:ct("mfaState"),resetMfaState:lt("mfaState",{mfaState:tn})},on={enrollMfa:ot("auth/enrollMfa"),getMFADevices:ot("auth/getMFADevices"),getMFAStrategies:ot("auth/getMFAStrategies"),verifyMfa:ot("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ot("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ot("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ot("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ot("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ot("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ot("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ot("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ot("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ot("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ot("auth/disableMfaWebAuthn",(e=>({payload:e})))},an={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}},rn={setTeamLoader:dt("teamState"),setTeamError:yt("teamState"),setTeamState:ct("teamState"),resetTeamState:lt("teamState",{teamState:an})},sn={loadUsers:ot("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ot("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ot("auth/loadRoles",(e=>({payload:e}))),addUser:ot("auth/addUser",(e=>({payload:e}))),addUsersBulk:ot("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ot("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ot("auth/updateUser",(e=>({payload:e}))),deleteUser:ot("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ot("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ot("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ot("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ot("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ot("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ot("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ot("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ot("auth/getInvitationLink"),createInvitationLink:ot("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ot("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ot("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ot("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ot("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ot("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ot("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ot("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ot("auth/closeLockUserDialog",(e=>({payload:e})))},ln={firstLoad:!0,loading:!1,error:""},cn={setSocialLoginsState:ct("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:ln})},un={loadSocialLoginsConfiguration:ot("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ot("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ot("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ot("auth/setSocialLoginError",(e=>({payload:e})))};let dn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(dn||(dn={}));const yn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:dn.SignUp},fn={setSignUpState:ct("signUpState"),resetSignUpState:lt("signUpState",{signUpState:yn})},pn={signUpUser:ot("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ot("auth/resetSignUpStateSoft")},gn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},Sn={setApiTokensLoader:dt("apiTokensState"),setApiTokensError:yt("apiTokensState"),setApiTokensState:ct("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:gn})},hn={loadApiTokens:ot("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ot("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ot("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ot("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ot("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ot("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ot("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ot("auth/deleteTenantApiToken",(e=>({payload:e})))},vn={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}},mn={setSecurityPolicyState:ct("securityPolicyState"),setSecurityPolicyGlobalState:ut("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ut("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ut("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ut("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ut("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ut("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ut("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ut("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ut("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ut("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ut("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:vn})},bn={loadSecurityPolicy:ot("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ot("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ot("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ot("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ot("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ot("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ot("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ot("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ot("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ot("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ot("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ot("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ot("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ot("auth/loadPublicAuthStrategiesPolicy")},An={loading:!1},kn={setAccountSettingsState:ct("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:An})},Tn={loadAccountSettings:ot("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ot("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},Pn={setTenantsState:ct("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:_n})},En={switchTenant:ot("auth/switchTenant",(e=>({payload:e}))),loadTenants:ot("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ot("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ot("auth/loadSubTenantsTree",(e=>({payload:e})))},In={loading:!1,roles:[],permissions:[],permissionCategories:[]},Ln={setRolesState:ct("rolesState"),resetRolesState:lt("rolesState",{rolesState:In})},On={loadRolesAndPermissions:ot("auth/loadRoles",(e=>({payload:e}))),addRole:ot("auth/addRole",(e=>({payload:e}))),updateRole:ot("auth/updateRole",(e=>({payload:e}))),deleteRole:ot("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ot("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ot("auth/attachPermissionToRoles",(e=>({payload:e})))},wn={loading:!1,sessions:[]},Rn={setSessionsState:ct("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:wn})},Cn={loadUserSessions:ot("auth/loadUserSessions"),loadCurrentUserSession:ot("auth/loadCurrentUserSession"),deleteUserSession:ot("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ot("auth/deleteAllUserSessions"),revokeUserSessions:ot("auth/revokeUserSessions",(e=>({payload:e})))},Dn={loading:!1,configurations:{}},Un={setSessionsPolicyState:ct("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Dn})},Mn={loadSessionsPolicy:ot("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ot("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Nn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Nn||(Nn={}));const Fn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Nn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},$n={setRestrictionsState:ct("restrictionsState"),setIpRestrictionsState:ut("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ut("restrictionsState","emailDomainRestrictions")},Gn={checkIfUserIpValid:ot("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ot("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ot("auth/loadIpRestrictions"),saveIpRestriction:ot("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ot("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ot("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ot("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ot("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ot("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ot("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},xn={loading:!1},Vn={setProvisioningState:ct("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:xn})},Hn={loadProvisionConnections:ot("auth/loadProvisionConnections"),createProvisionConnection:ot("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ot("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ot("auth/updateProvisionConnection",(e=>({payload:e})))},Wn={devices:[],loading:!1,error:null},jn={setPasskeysState:ct("passkeysState"),resetPasskeysState:lt("passkeysState",{passkeysState:Wn})},Bn={loadWebAuthnDevices:ot("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ot("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Kn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},qn={setUsersGroupsLoader:dt("groupsState"),setUsersGroupsError:yt("groupsState"),setGroupsState:ct("groupsState"),resetUsersGroupsState:lt("groupsState",{groupsState:Kn})},zn={loadGroups:ot("auth/loadUsersGroups"),getGroupById:ot("auth/getGroupById",(e=>({payload:e}))),createGroup:ot("auth/createGroup",(e=>({payload:e}))),updateGroup:ot("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ot("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ot("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ot("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ot("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ot("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ot("auth/getGroupConfiguration"),updateGroupConfiguration:ot("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ot("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}},Jn={setGroupsDialogsState:ct("groupsDialogsState"),resetGroupsDialogsState:lt("groupsState",{groupsDialogsState:Xn}),openAddGroupDialog:pt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:pt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ft("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:pt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ft("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:pt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:pt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:pt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ft("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:pt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Yn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:yn,loginState:Ot,activateState:Dt,acceptInvitationState:Ft,forgotPasswordState:Vt,ssoState:zt,profileState:Yt,mfaState:tn,teamState:an,groupsState:Kn,groupsDialogsState:Xn,socialLoginState:ln,apiTokensState:gn,securityPolicyState:vn,accountSettingsState:An,tenantsState:_n,rolesState:In,resetPhoneNumberState:Bt,sessionsState:wn,sessionsPolicyState:Dn,restrictionsState:Fn,provisioningState:xn,passkeysState:Wn},Qn=E({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:()=>{}},Yn);let Zn;!function(e){e.impersonating="impersonating",e.success="success"}(Zn||(Zn={}));const ei={step:Zn.impersonating,loading:!1},ti={setImpersonateState:ct("impersonateState"),resetImpersonateState:lt("impersonateState",{impersonateState:ei})},ni={impersonate:ot("impersonation/impersonate",(e=>({payload:e})))},{reducer:ii,actions:oi}=rt({name:Pt,initialState:Qn,reducers:E({resetState:e=>E({},e,Yn),setState:(e,{payload:t})=>E({},e,t),setUser:("user",(e,{payload:t})=>E({},e,{user:t}))},wt,cn,Ut,ti,$t,Ht,Kt,fn,Qt,Xt,nn,rn,qn,Jn,Sn,mn,kn,Pn,Ln,Rn,Un,$n,Vn,jn)});const ai=E({},oi,Rt,un,Mt,Gt,Wt,qt,pn,Zt,Jt,on,sn,zn,{},hn,bn,Tn,En,On,Cn,Mn,Gn,Hn,ni,Bn);var ri=function(e){return"@@redux-saga/"+e},si=ri("CANCEL_PROMISE"),li=ri("CHANNEL_END"),ci=ri("IO"),ui=ri("MATCH"),di=ri("MULTICAST"),yi=ri("SAGA_ACTION"),fi=ri("SELF_CANCELLATION"),pi=ri("TASK"),gi=ri("TASK_CANCEL"),Si=ri("TERMINATE"),hi=ri("LOCATION");function vi(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 mi=function(e){return null==e},bi=function(e){return null!=e},Ai=function(e){return"function"==typeof e},ki=function(e){return"string"==typeof e},Ti=Array.isArray,_i=function(e){return e&&Ai(e.then)},Pi=function(e){return e&&Ai(e.next)&&Ai(e.throw)},Ei=function e(t){return t&&(ki(t)||Oi(t)||Ai(t)||Ti(t)&&t.every(e))},Ii=function(e){return e&&Ai(e.take)&&Ai(e.close)},Li=function(e){return Ai(e)&&e.hasOwnProperty("toString")},Oi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},wi=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[si]=function(){clearTimeout(n)},i},Ri=function(e){return function(){return e}},Ci=Ri(!0),Di=function(){},Ui=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Mi=function(e,t){E(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ni(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Fi=function(e){throw e},$i=function(e){return{value:e,done:!0}};function Gi(e,t,n){void 0===t&&(t=Fi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:$i,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function xi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Vi=function(e){return Array.apply(null,new Array(e))},Hi=function(e){return function(t){return e(Object.defineProperty(t,yi,{value:!0}))}},Wi=function(e){return e===Si},ji=function(e){return e===gi},Bi=function(e){return Wi(e)||ji(e)};function Ki(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ti(e)?Vi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Bi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=Di,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function qi(e){return{name:e.name||"anonymous",location:zi(e)}}function zi(e){return e[hi]}var Xi=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)},Ji="TAKE",Yi="CALL",Qi="FORK",Zi="SELECT",eo=function(e,t){var n;return(n={})[ci]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function to(e,t){return void 0===e&&(e="*"),Ei(e)?(bi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),eo(Ji,{pattern:e})):Ii(n=e)&&n[di]&&bi(t)&&Ei(t)?eo(Ji,{channel:e,pattern:t}):Ii(e)?(bi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),eo(Ji,{channel:e})):void 0;var n}function no(e,t){return mi(t)&&(t=e,e=void 0),eo("PUT",{channel:e,action:t})}function io(e){var t=eo("ALL",e);return t.combinator=!0,t}function oo(e,t){var n,i=null;return Ai(e)?n=e:(Ti(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ki(n)&&Ai(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function ao(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 eo(Yi,oo(e,n))}function ro(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 eo(Qi,oo(e,n))}function so(e){return void 0===e&&(e=fi),eo("CANCEL",e)}function lo(e){void 0===e&&(e=Ui);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return eo(Zi,{selector:e,args:n})}var co=ao.bind(null,wi);var uo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},yo=[],fo=0;function po(e){try{ho(),e()}finally{vo()}}function go(e){yo.push(e),fo||(ho(),mo())}function So(e){try{return ho(),e()}finally{mo()}}function ho(){fo++}function vo(){fo--}function mo(){var e;for(vo();!fo&&void 0!==(e=yo.shift());)po(e)}var bo=function(e){return function(t){return e.some((function(e){return Po(e)(t)}))}},Ao=function(e){return function(t){return e(t)}},ko=function(e){return function(t){return t.type===String(e)}},To=function(e){return function(t){return t.type===e}},_o=function(){return Ci};function Po(e){var t="*"===e?_o:ki(e)?ko:Ti(e)?bo:Li(e)?ko:Ai(e)?Ao:Oi(e)?To:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Eo={type:li},Io=function(e){return e&&e.type===li};function Lo(){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(Eo)}))},(e={})[di]=!0,e.put=function(e){if(!t)if(Io(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[ui](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=_o),t?e(Eo):(e[ui]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ni(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[yi]?s(e):go((function(){s(e)}))},r}function Oo(e,t){var n=e[si];Ai(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var wo,Ro=0,Co=function(){return++Ro};function Do(e){e.isRunning()&&e.cancel()}var Uo=((wo={}).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):!Io(e)||r?n(e):n(Si)};try{o.take(s,bi(a)?Po(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},wo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;go((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&_i(t)?Oo(t,n):n(t)}))},wo.ALL=function(e,t,n,i){var o=i.digestEffect,a=Ro,r=Object.keys(t);if(0!==r.length){var s=Ki(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ti(t)?[]:{})},wo.RACE=function(e,t,n,i){var o=i.digestEffect,a=Ro,r=Object.keys(t),s=Ti(t)?Vi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Bi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=Di,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)}))},wo.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(_i(l))return void Oo(l,n);if(Pi(l))return void jo(e,l,s.context,Ro,qi(a),!1,n);n(l)}catch(e){n(e,!0)}},wo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){mi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},wo.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(Pi(o))return o;var a=!1;return Gi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!_i(o)})}))}catch(e){return Gi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:qi(t)}(c,a);So((function(){var t=jo(e,c,l.context,Ro,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},wo.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()&&Ni(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ti(t)){if(0===t.length)return void n([]);var r=Ki(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},wo.CANCEL=function(e,t,n,i){var o=i.task;t===fi?Do(o):Ti(t)?t.forEach(Do):Do(t),n()},wo.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)}},wo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Xi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Eo):e.isEmpty()?(n.push(i),i.cancel=function(){Ni(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(Eo):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])(Eo)}}}}(t.buffer),a=Po(i),r=function t(n){Io(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)},wo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},wo.FLUSH=function(e,t,n){t.flush(n)},wo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},wo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Mi(o.context,t),n()},wo);function Mo(e,t){return e+"?"+t}function No(e){var t=e.name,n=e.location;return n?t+" "+Mo(n.fileName,n.lineNumber):t}function Fo(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 $o=null,Go=[],xo=function(e){e.crashedEffect=$o,Go.push(e)},Vo=function(){$o=null,Go.length=0},Ho=function(){var e,t,n=Go[0],i=Go.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=zi(e))?t.code+" "+Mo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+No(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+No(e.meta)})),[Fo(Go)]).join("\n")};function Wo(e,t,n,i,o,a,r){var s;void 0===r&&(r=Di);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||(Ni(o,t),t.cont=Di,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=Di,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,xo({meta:o,cancelledTasks:y}),S.isRoot){var i=Ho();Vo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===gi?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={})[pi]=!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(gi,!1))},s.cont=r,s.end=g,s.setContext=function(e){Mi(f,e)},s.toPromise=function(){return d||(d=uo(),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 jo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){_i(t)?Oo(t,i):Pi(t)?jo(e,t,c.context,n,o,!1,i):t&&t[ci]?(0,Uo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Di;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(gi))},status:0},c=Wo(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),Vo()):ji(e)?(l.status=1,d.cancel(),o=Ai(t.return)?t.return(gi):{done:!0,value:gi}):o=Wi(e)?Ai(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=Co();function l(n,o){a||(a=!0,i.cancel=Di,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){$o=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=Di,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=Di,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Bo(e,t){for(var n=e.channel,i=void 0===n?Lo():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?xi: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),h=Co();if(l&&(l.rootSagaStarted=l.rootSagaStarted||Di,l.effectTriggered=l.effectTriggered||Di,l.effectResolved=l.effectResolved||Di,l.effectRejected=l.effectRejected||Di,l.effectCancelled=l.effectCancelled||Di,l.actionDispatched=l.actionDispatched||Di,l.rootSagaStarted({effectId:h,saga:t,args:f})),c){var v=Ge.apply(void 0,c);g=function(e){return function(t,n,i){return v((function(t){return e(t,n,i)}))(t)}}}else g=Ui;var m={channel:i,dispatch:Hi(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return So((function(){var e=jo(m,S,s,h,qi(t),!0,void 0);return l&&l.effectResolved(h,e),e}))}var Ko=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Lo():a,s=n.sagaMonitor,l=vi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Bo.bind(null,E({},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){Mi(o,e)},c},qo=function(e){return{done:!0,value:e}},zo={};function Xo(e){return Ii(e)?"channel":Li(e)?String(e):Ai(e)?e.name:String(e)}function Jo(e,t,n){var i,o,a,r=t;function s(t,n){if(r===zo)return qo(t);if(n&&!o)throw r=zo,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===zo?qo(t):a}return Gi(s,(function(e){return s(null,e)}),n)}function Yo(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:to(e)},s=function(e){return{done:!1,value:ro.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Xo(e)+", "+t.name+")")}function Qo(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:to(e)},l=function(e){return{done:!1,value:ro.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:so(e)}},u=function(e){return a=e},d=function(e){return r=e};return Jo({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("+Xo(e)+", "+t.name+")")}function Zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:to(e)},s=function(e){return{done:!1,value:ao.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Xo(e)+", "+t.name+")")}function ea(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:ao.apply(void 0,[n].concat(a))},l={done:!1,value:co(t)};return Jo({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:zo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function ta(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 ro.apply(void 0,[Yo,e,t].concat(i))}function na(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 ro.apply(void 0,[Qo,e,t].concat(i))}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];return ro.apply(void 0,[Zo,e,t].concat(i))}class oa{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 oa.instance||(oa.instance=new oa),oa.instance}static setContext(e){oa.getInstance().context=e}static setAccessToken(e){oa.getInstance().accessToken=e}static setUser(e){oa.getInstance().user=e}static setOnRedirectTo(e){oa.getInstance().onRedirectTo=e}static setLogout(e,t){oa.getInstance().logout=n=>{n?e(n):oa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=oa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return oa.getInstance().accessToken}static getUser(){return oa.getInstance().user}static onRedirectTo(e,t){return oa.getInstance().onRedirectTo(e,t)}static logout(e){return oa.getInstance().logout(e)}}oa.instance=void 0;const aa={getContext:()=>oa.getContext(),getAccessToken:()=>oa.getAccessToken(),getUser:()=>oa.getUser(),onRedirectTo:(e,t)=>oa.onRedirectTo(e,t),logout:e=>oa.logout(e)};class ra extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function sa(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 la=async e=>{var t,n,i;const o=oa.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:oa.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=sa(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:E({},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 ra("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 ra(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{}}},ca=async(e,t,n)=>la(E({url:e,method:"GET",contentType:"application/json",params:t},n)),ua=async(e,t,n)=>la(E({url:e,method:"POST",contentType:"application/json",body:t},n)),da=async(e,t,n)=>la(E({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ya=async(e,t,n)=>la(E({url:e,method:"PUT",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>la(E({url:e,method:"DELETE",contentType:"application/json",body:t},n)),pa=async(e,t,n,i)=>la(E({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ga={v1:"/identity/resources/users/webauthn/v1/devices"},Sa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ha={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",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"}}},va={v1:"/identity/resources/configurations/v1"},ma={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ba={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Aa={v1:"/identity/resources/permissions/v1"},ka={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"}}},Ta={v1:"/identity/resources/roles/v1"},_a={v1:"/identity/resources/sub-tenants/users/v1"},Pa={v1:"/identity/resources/impersonation/v1"},Ea={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ia={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},La={v1:"/team/resources/members/v1"},Oa={v1:"/team/resources/roles/v1"},wa={v1:"/team/resources/stats/v1"},Ra={v1:"/team/resources/profile"},Ca={v1:"/tenants/resources/account-settings/v1"},Da={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Ua={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ma={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"}}}},Na={v1:"/subscriptions/resources/payment-providers/v1"},Fa={v1:"/subscriptions/resources/subscriptions/v1"},$a={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ga={v1:"/reports/engine/resources/triggers/v1"},xa="/notification",Va="/audits",Ha={v1:"/event/resources/configurations/v1"},Wa="/webhook",ja="/oauth",Ba="/flags",Ka="/directory/resources/v1/configurations/scim2",qa="/directory/resources/scim/temp";async function za(e){return ya(`${ha.v1}/tenant`,e)}async function Xa(){return ca(`${ha.v2}/me/tenants`)}async function Ja(){return ca(Da.v1)}async function Ya(){return ca(Da.tree.v1)}async function Qa(){return ca(va.v1)}async function Za(){return ca(`${va.v1}/mfa-policy`)}async function er(){return ca(`${va.v1}/mfa-policy/vendor`)}async function tr(e){return e.id?da(`${va.v1}/mfa-policy`,e):ua(`${va.v1}/mfa-policy`,e)}async function nr(){return ca(`${va.v1}/lockout-policy`)}async function ir(){return ca(`${va.v1}/lockout-policy/vendor`)}async function or(e){return e.id?da(`${va.v1}/lockout-policy`,e):ua(`${va.v1}/lockout-policy`,e)}async function ar(){try{return await ca(`${va.v1}/captcha-policy/public`)}catch{return null}}async function rr(){return ca(`${va.v1}/password-history-policy`)}async function sr(){return ca(`${va.v1}/password-history-policy/vendor`)}async function lr(e){return e.id?da(`${va.v1}/password-history-policy`,e):ua(`${va.v1}/password-history-policy`,e)}async function cr(){return ca(`${va.v1}/password`)}async function ur(){return ca(`${ma.emailDomain.v1}`)}async function dr(){return ca(`${ma.emailDomain.v1}/config`)}async function yr(e){return ua(`${ma.emailDomain.v1}`,e)}async function fr(e){return ua(`${ma.emailDomain.v1}/config`,e)}async function pr(e){return fa(`${ma.emailDomain.v1}/${e}`)}async function gr(e){return ca(`${ma.ip.v1}`,e)}async function Sr(){return ca(`${ma.ip.v1}/config`)}async function hr(e){return ua(`${ma.ip.v1}`,e)}async function vr(e){return ua(`${ma.ip.v1}/bulk`,e)}async function mr(e){return ua(`${ma.ip.v1}/config`,e)}async function br(e){return fa(`${ma.ip.v1}/${e}`)}async function Ar(){return ua(`${ma.ip.v1}/verify`)}async function kr(){return ua(`${ma.ip.v1}/verify/allow`)}let Tr,_r,Pr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Tr||(Tr={})),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"}(Pr||(Pr={}));class Er extends Error{constructor(e){super(e)}}const Ir="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Er("'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 Lr extends Error{constructor(e){super(e)}}const Or=(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(Ir(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 Ir(t)}})(e.split(".")[n]))}catch(e){throw new Lr("Invalid token specified: "+e.message)}},wr=["type"],Rr=["type"];async function Cr(e){if(!e.accessToken)return e;oa.setAccessToken(e.accessToken);const t=await ca(`${ha.v2}/me`),n=E({},e,e.accessToken?Or(e.accessToken):{},t);return oa.setUser(n),n}async function Dr(e){if(!e.accessToken)return{user:e};oa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ca(`${ha.v2}/me`),Xa()]),i=E({},e,e.accessToken?Or(e.accessToken):{},t);return oa.setUser(i),{user:i,tenants:n}}async function Ur(e){oa.setAccessToken(e.id_token);const t=await ca(`${ha.v2}/me`),n=e.id_token?Or(e.id_token):{},i=E({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return oa.setUser(i),i}async function Mr(e){try{const{address:t}=await ua(`${Sa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Nr(e){return ua(`${Sa.v1}/user/saml/prelogin`,e)}async function Fr(e){return Cr(await ua(`${Sa.v1}/user/saml/postlogin`,e))}async function $r(e){return Cr(await ua(`${Sa.v1}/user/oidc/postlogin`,e))}async function Gr(e){return Cr(await ua(`${Sa.v1}/user`,e))}async function xr(e){return Cr(await ua(`${Sa.v1}/user/mfa/verify`,e))}async function Vr(e){return ua(`${ha.v1}/activate`,e)}async function Hr(e){return ca(`${ha.v1}/activate/strategy`,e)}async function Wr(e){return ua(`${ha.v1}/activate/reset`,e)}async function jr(e){return ua(`${ha.v1}/invitation/reset`,e)}async function Br(e){return ua(`${ha.v1}/invitation/accept`,e)}async function Kr(){return Cr(await ua(`${Sa.v1}/user/token/refresh`))}async function qr(){return Dr(await ua(`${Sa.v1}/user/token/refresh`))}async function zr(){return ua(`${Sa.v1}/logout`)}async function Xr(e){return ca(`${ja}/logout`,e)}async function Jr(e){return ua(`${ha.v1}/passwords/reset`,e)}async function Yr(e){return ua(`${ha.v1}/passwords/reset/verify`,e)}async function Qr(e){return ca(`${ha.v1}/passwords/config`,e)}async function Zr(e){return ua(`${Sa.v1}/user/mfa/recover`,e)}async function es(){return ua(`${ha.v1}/mfa/enroll`)}async function ts(){return ua(`${ha.v1}/mfa/authenticator/enroll`)}async function ns(e){return ua(`${ha.v1}/mfa/authenticator/enroll/verify`,e)}async function is(e){return ua(`${ha.v1}/mfa/sms/enroll`,e)}async function os(e){return ua(`${ha.v1}/mfa/sms/enroll/verify`,e)}async function as(){return ua(`${ha.v1}/mfa/webauthn/enroll`)}async function rs(e){return ua(`${ha.v1}/mfa/webauthn/enroll/verify`,e)}async function ss(e){return ua(`${ha.v1}/mfa/enroll/verify`,e)}async function ls(e){return ua(`${ha.v1}/mfa/disable`,e)}async function cs(e,t){return ua(`${ha.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function us(e){return ua(`${ha.v1}/mfa/sms/${e}/disable`)}async function ds(e,t){return ua(`${ha.v1}/mfa/sms/${e}/disable/verify`,t)}async function ys(e){return ua(`${ha.v1}/mfa/webauthn/${e}/disable`)}async function fs(e,t){return ua(`${ha.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function ps(){return ca(`${ha.v1}/mfa/devices`)}async function gs(e){return ua(`${Sa.v1}/user/mfa/authenticator/enroll`,e)}async function Ss(e){return ua(`${Sa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function hs(e,t){return ua(`${Sa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function vs(e){return ua(`${Sa.v1}/user/mfa/sms/enroll`,e)}async function ms(e){return ua(`${Sa.v1}/user/mfa/sms/enroll/verify`,e)}async function bs(e,t){return ua(`${Sa.v1}/user/mfa/sms/${e}`,t)}async function As(e,t){return ua(`${Sa.v1}/user/mfa/sms/${e}/verify`,t)}async function ks(e){return ua(`${Sa.v1}/user/mfa/webauthn/enroll`,e)}async function Ts(e){return ua(`${Sa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function _s(e,t){return ua(`${Sa.v1}/user/mfa/webauthn/${e}`,t)}async function Ps(e,t){return ua(`${Sa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Es(){return ca(`${Ia.v1}/saml/configurations`)}async function Is(e){return ua(`${Ia.v1}/saml/configurations`,e)}async function Ls(){return ca(`${Ia.v1}/saml/configurations/vendor-config`)}async function Os(e){return ya(`${Ia.v1}/saml/configurations/metadata`,e)}async function ws(){return ya(`${Ia.v1}/saml/validations/domain`)}async function Rs(){return ca(`${Ia.v1}/saml/configurations/roles/default`)}async function Cs(){return ca(`${Ia.v2}/saml/configurations/groups`)}async function Ds({roleIds:e}){return ua(`${Ia.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Us({roleIds:e,group:t}){return ua(`${Ia.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Ms({roleIds:e,group:t,id:n}){return da(`${Ia.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Ns({id:e}){return fa(`${Ia.v2}/saml/configurations/groups/${e}`)}async function Fs(){return ca(`${Ia.v1}/oidc/configurations`)}async function $s(){return ca(`${Ia.v2}/configurations/public`)}async function Gs(){return ca(ba.v1)}async function xs(){return ca(ba.v2)}async function Vs(){return ca(ba.custom.v1)}async function Hs({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),ua(`${Sa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Ws(){return ca(`${va.v1}/public`)}async function js(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await ua(`${ha.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Cr(n):void 0,userId:i,tenantId:o}}async function Bs(){return ca(ha.sessions.currentUser.v1)}async function Ks(){return ca(`${ha.sessions.currentUser.v1}/current`)}async function qs(e){return ua(`${ha.sessions.v1}/revoke`,{userId:e})}async function zs(){return ca(ha.sessions.configurations.v1)}async function Xs(e){await ua(ha.sessions.configurations.v1,e)}async function Js(e){await fa(`${ha.sessions.currentUser.v1}/${e}`)}async function Ys(){await fa(`${ha.sessions.currentUser.v1}/all`)}async function Qs(){return ca(ha.accessTokens.v1)}async function Zs(){return ca(ka.accessTokens.v1)}async function el({id:e}){return fa(`${ka.accessTokens.v1}/${e}`)}async function tl({id:e}){return fa(`${ha.accessTokens.v1}/${e}`)}async function nl(e){return ua(ha.accessTokens.v1,e)}async function il(e){return ua(ka.accessTokens.v1,e)}async function ol(){return ca(ha.apiTokens.v1)}async function al(){return ca(ka.apiTokens.v1)}async function rl(e){return ua(ha.apiTokens.v1,e)}async function sl(e){return ua(ka.apiTokens.v2,e)}async function ll({tokenId:e}){return fa(`${ka.apiTokens.v1}/${e}`)}async function cl({tokenId:e}){return fa(`${ha.apiTokens.v1}/${e}`)}async function ul({userId:e}){return ca(`${ha.v1}/${e}`)}async function dl(e){return ca(`${va.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function yl(e){let{type:t}=e,n=vi(e,wr);return ua(`${Sa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function fl(e){let{type:t}=e,n=vi(e,Rr);return ua(`${Sa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function pl({token:e}){return ua(ka.invites.verify.v1,{token:e})}async function gl(){return ca(`${Ia.v1}/configurations`)}async function Sl(e){return ua(`${Ia.v1}/configurations`,e)}async function hl(e,t){return da(`${Ia.v1}/configurations/${e}`,t)}async function vl(e){return fa(`${Ia.v1}/configurations/${e}`)}async function ml(e){return ua(`${Ia.v1}/configurations/metadata`,e)}async function bl(e,t){return ya(`${Ia.v1}/configurations/${e}/metadata`,t)}async function Al(e,t){return ua(`${Ia.v1}/configurations/${e}/domains`,t)}async function kl(e,t){return fa(`${Ia.v1}/configurations/${e}/domains/${t}`)}async function Tl(e,t){return ya(`${Ia.v1}/configurations/${e}/domains/${t}/validate`)}async function _l(e){return ca(`${Ia.v1}/configurations/${e}/roles`)}async function Pl(e,t){return ya(`${Ia.v1}/configurations/${e}/roles`,t)}async function El(e,t){return ua(`${Ia.v1}/configurations/${e}/groups`,t)}async function Il(e,{roleIds:t,group:n,id:i}){return da(`${Ia.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Ll(e,t){return fa(`${Ia.v1}/configurations/${e}/groups/${t}`)}async function Ol(e){return ca(`${Ia.v1}/configurations/${e}/groups`)}async function wl(e){return ua(`${Sa.v2}/user/sso/prelogin`,e)}async function Rl(e){return Cr(await ua(`${Sa.v2}/user/oidc/postlogin`,e))}async function Cl(e){return Ur(await ua(`${ja}/token`,e))}async function Dl(){return Ur(await ua(`${ja}/authorize/silent`))}async function Ul(e){return ua(`${ha.v1}/phone/reset`,e)}async function Ml(e){return ua(`${ha.v1}/phone/reset/verify`,e)}async function Nl(e){return ua(`${ha.v1}/phone`,e)}async function Fl(e){return ua(`${ha.v1}/phone/verify`,e)}async function $l(e){return ya(`${ha.v1}/phone/change`,e)}async function Gl(e){return ua(`${Sa.v1}/webauthn/prelogin`,e)}async function xl(e){return ua(`${Sa.v1}/webauthn/postlogin`,e)}async function Vl(){return ua(ga.v1)}async function Hl(){return ca(ga.v1)}async function Wl(e){return fa(`${ga.v1}/${e}`)}async function jl(e){return ua(`${ga.v1}/verify`,e)}async function Bl(){return ca(`${va.v1}/auth/strategies/public`)}async function Kl(){return ca(`${va.v1}/mfa/strategies`)}async function ql(e){return ca(`${ha.v2}/me`,null!=e?e:{addRoles:!0})}async function zl(e){return ya(`${ha.v2}/me`,e)}async function Xl(e){return ya(`${Ra.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Jl(e){return ua(`${ha.v1}/passwords/change`,e)}async function Yl(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>E({},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 ca(La.v1,E({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ql(e){return ua(ha.v2,E({},e,{provider:"local"}))}async function Zl(e){return fa(`${La.v1}/${e.userId}`)}async function ec(e){return ya(La.v1,e)}async function tc(e){return ua(ka.invites.user.v1,E({},e))}async function nc(e){return da(ka.invites.user.v1,E({},e))}async function ic(){return fa(ka.invites.user.v1)}async function oc(){return ca(ka.invites.user.v1)}async function ac(){return ca(ka.invites.configuration.v1)}async function rc(){return ca(Oa.v1)}async function sc(){return ca(Aa.v1)}async function lc(){return ca(`${wa.v1}/members`)}async function cc(e){return ua(`${La.v1}/${e.userId}/resendActivationEmail`,{})}async function uc(e){return ua(ha.v2,E({},e,{provider:"local"}))}async function dc(e){return ua(ha.invitation.resendAll.v1,E({},e))}async function yc(e){var t,n;const i=await ca("/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 fc(){const e=await ca("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const pc=async()=>yc({entityName:"notifications"}),gc=async()=>yc({entityName:"saml"}),Sc=async()=>yc({entityName:"audits"}),hc=async e=>async function(e){const t=await ca(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vc=["dataFilters"],mc=["templateId","dataFilters"],bc=["dataFilters"];async function Ac(e){return ca(`${$a.v2}/tenant-reports`,e)}async function kc(e){return ca(`${$a.v2}/${e.id}/tenant-reports`)}async function Tc(e){let{dataFilters:t}=e,n=vi(e,vc);return{html:await ca(`${Ga.v1}/preview-report`,E({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function _c(e){let{templateId:t,dataFilters:n}=e,i=vi(e,mc);return ua(`${$a.v2}/${t}/tenant-reports`,E({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Pc(e){let{dataFilters:t}=e,n=vi(e,bc);const i=await ca(`${Ga.v1}/preview-report`,E({},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 Ec(e){return ua(`${Ga.v1}/tenant-reports`,e)}async function Ic(e){return ca(xa,{params:e})}async function Lc(e){return ya(`${xa}/status`,{params:e})}async function Oc(e){const{notificationId:t,pinStatus:n}=e;return ya(`${xa}/${n}`,{notificationId:t})}async function wc(){return ua(`${xa}/status/mark-all-read`)}const Rc=["endpoint","headerProps"];async function Cc(e){return ca(Va,e)}async function Dc(e){return ca(`${Va}/stats`,e)}async function Uc(e){const{endpoint:t,headerProps:n}=e,i=vi(e,Rc);return pa(`${Va}/export/${t}`,{properties:n},i)}const Mc=["eventKey"],Nc=["eventKey"],Fc=()=>ca(`${Ua.v1}/slack`),$c=()=>ca(`${Ua.v1}/slack/applications`),Gc=()=>ca(`${Ua.v1}/slack/channels`),xc=e=>e.id?da(`${Ua.v1}/slack/subscription/${e.id}`,e):ua(`${Ua.v1}/slack/subscriptions`,e),Vc=e=>fa(`${Ua.v1}/slack/subscriptions/${e.id}`),Hc=e=>ua(`${Ua.v1}/slack/applications/registrations`,{code:e}),Wc=()=>ca(`${Ua.v1}/emails`),jc=e=>{let{eventKey:t}=e,n=vi(e,Mc);return ua(`${Ua.v1}/emails/${t}`,n)},Bc=({eventKey:e,enabled:t})=>da(`${Ua.v1}/emails/${e}`,{enabled:t}),Kc=(e,t)=>fa(`${Ua.v1}/emails/${e}/subscriptions/${t}`),qc=(e,t,n)=>ya(`${Ua.v1}/emails/${t}/subscriptions/${e}`,n),zc=e=>fa(`${Ua.v1}/emails/${e}`),Xc=()=>ca(`${Ua.v2}/sms`),Jc=e=>{let{eventKey:t}=e,n=vi(e,Nc);return ua(`${Ua.v2}/sms/${t}`,n)},Yc=({eventKey:e,enabled:t})=>da(`${Ua.v2}/sms/${e}`,{enabled:t}),Qc=(e,t)=>fa(`${Ua.v2}/sms/${e}/subscriptions/${t}`),Zc=(e,t,n)=>ya(`${Ua.v2}/sms/${t}/subscriptions/${e}`,n),eu=e=>fa(`${Ua.v2}/sms/${e}`),tu=()=>ca(Wa),nu=e=>e._id?da(`${Wa}/${e._id}`,e):ua(`${Wa}/custom`,e),iu=e=>fa(`${Wa}/${e}`),ou=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ca(`${Wa}/logs/?${i.toString()}`)},au=e=>ua(`${Wa}/test`,e),ru=e=>ua(`${Wa}/logs/${e}/retries`),su=()=>ca(`${Ha.v1}/categories`),lu=e=>ca(Ha.v1,{channels:e});async function cu(e){return ya(Ca.v1,e)}async function uu(){return ca(Ca.v1)}const du=["roleId"],yu=["roleId"],fu=["permissionId"];async function pu(){return ca(Ta.v1)}async function gu(e){return ua(Ta.v1,e)}async function Su({roleId:e}){return fa(`${Ta.v1}/${e}`)}async function hu(e){let{roleId:t}=e,n=vi(e,du);return da(`${Ta.v1}/${t}`,n)}async function vu(e){let{roleId:t}=e,n=vi(e,yu);return ya(`${Ta.v1}/${t}/permissions`,n)}async function mu(){return ca(Aa.v1)}async function bu(e){let{permissionId:t}=e,n=vi(e,fu);return ya(`${Aa.v1}/${t}/roles`,n)}async function Au(){return ca(`${Aa.v1}/categories`)}async function ku(){return ca(Ma.subscriptions.v1)}async function Tu(e){return ca(`${Ma.subscriptions.v1}/${e}`)}async function _u(e){return ya(`${Ma.subscriptions.v1}/${e}/cancellations/`,{})}async function Pu(e){return ya(`${Ma.subscriptions.v1}/${e}/renewals/`,{})}async function Eu(e,{paymentMethodId:t,planId:n}){return ya(`${Ma.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Iu(e){return ca(`${Fa.v1}/${e}`)}async function Lu(){return ca(`${Fa.v1}`)}async function Ou(e){return ya(`${Fa.v1}/${e}/cancellations/`,{})}async function wu(e){return ya(`${Fa.v1}/${e}/renewals/`,{})}async function Ru(e,{paymentMethodId:t,planId:n}){return ya(`${Fa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cu(){return ca(Ma.plans.v1)}async function Du(e){return ca(`${Ma.plans.v1}/${e}`)}async function Uu(){return ca(Ma.invoices.v1)}async function Mu(e){return ca(`${Ma.invoices.v1}/${e}`)}async function Nu(e,t){return ca(`${Ma.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fu=["email"];async function $u(){return ca(Ma.paymentMethods.v1)}async function Gu(e){return ca(`${Ma.paymentMethods.v1}/${e}`)}async function xu(e,t){let{email:n}=t,i=vi(t,Fu);return da(`${Ma.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Vu(e){return ua(Ma.paymentProviders.stripe.subscriptions.v1,e)}async function Hu(e){return ca(`${Ma.paymentProviders.stripe.customers.v1}/${e}`)}async function Wu(e){return ua(`${Ma.paymentProviders.stripe.customers.v1}`,e)}async function ju(){return ca(`${Ma.paymentProviders.stripe.publicConfigurations.v1}`)}async function Bu(e){return ua(`${Ma.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ku(e){return ca(`${Ma.summaries.v1}/${e}`)}async function qu(e){return ca(`${Ma.tenantConfiguration.v1}/${e}`)}async function zu(e){return ua(`${Ma.tenantConfiguration.v1}`,e)}async function Xu(){return ca(Na.v1)}async function Ju(){return ca(`${Ma.configurations.vendorPublicConfigurations.v1}`)}let Yu,Qu,Zu,ed,td,nd;async function id(){return ca("/vendors/public")}async function od(e){return ca(_a.v1,e)}async function ad(e){return ua(_a.v1,e)}async function rd(e){return fa(_a.v1,e)}async function sd(e,t){return ua(`${_a.v1}/${e}/roles`,t)}async function ld(e,t){return fa(`${_a.v1}/${e}/roles`,t)}async function cd(e,t){return da(`${_a.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Yu||(Yu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qu||(Qu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zu||(Zu={})),(ed||(ed={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(td||(td={})),function(e){e.CREATE="create_customer"}(nd||(nd={}));const ud={flags:{}};class dd{constructor(){var e;this._flags={},this._flags=null!=(e=ud.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new dd;return n.set(e),dd._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=E({},null!=(t=null==ud?void 0:ud.flags)?t:{},null!=e?e:{})}}async function yd(){return ca(Ba)}async function fd(){return ca(`${Ka}`)}async function pd(e,t){return da(`${Ka}/${e}`,t)}async function gd(e){return ua(`${Ka}`,e)}async function Sd(e){return fa(`${Ka}/${e}`)}async function hd(e){return ca(`${qa}/${e}/Users/count`)}async function vd(e){return ua(`${Pa.v1}`,e)}dd._instances={};const md=["groupId"];async function bd({groupId:e},t){return ca(`${Ea.v1}/${e}`,E({},t))}async function Ad(e){return ca(`${Ea.v1}`,E({},e))}async function kd(e,t){return ua(`${Ea.getByIds.v1}`,e,{params:t})}async function Td(e){return ua(`${Ea.v1}`,e)}async function _d(e){let{groupId:t}=e,n=vi(e,md);return da(`${Ea.v1}/${t}`,n)}async function Pd(e){return fa(`${Ea.v1}/${e}`)}async function Ed(e,t){return ua(`${Ea.v1}/${e}/roles`,t)}async function Id(e,t){return fa(`${Ea.v1}/${e}/roles`,t)}async function Ld(e,t){return ua(`${Ea.v1}/${e}/users`,t)}async function Od(e,t){return fa(`${Ea.v1}/${e}/users`,t)}async function wd(){return ca(`${Ea.configurations.v1}`)}async function Rd(e){return ua(`${Ea.configurations.v1}`,e)}let Cd,Dd,Ud,Md,Nd;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Cd||(Cd={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Dd||(Dd={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ud||(Ud={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Md||(Md={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Nd||(Nd={}));const Fd=[/^(.*)\/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],$d=`${Sa.v1}/user/token/refresh`,Gd=`${ja}/authorize/silent`,xd=`${ha.v2}/me`,Vd=`${ha.v2}/me/tenants`;let Hd,Wd,jd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Hd||(Hd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Wd||(Wd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(jd||(jd={}));const Bd={auth:n,teams:i,metadata:o,reports:a,connectivity:l,notifications:r,audits:s,tenants:t,accountSettings:c,roles:u,subscriptions:d,vendor:y,subTenants:f,featureFlags:p,directory:g,impersonate:S,groups:h};var Kd={fetch:e,ContextHolder:oa,FronteggContext:aa,api:Bd,FronteggApiError:ra,AuthStrategyEnum:_r,MachineToMachineAuthStrategy:Pr,SocialLoginProviders:Tr,ISubscriptionCancellationPolicy:Zu,ISubscriptionStatus:Yu,PaymentMethodType:Qu,ProviderType:ed};let qd,zd;!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"}(qd||(qd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(zd||(zd={}));var Xd=__webpack_require__(965);function Jd(e,t){const n=E({},e);return t.forEach((e=>{delete n[e]})),n}async function Yd(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=Xd.sha256.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Qd(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}const Zd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*ey(e){const t=yield lo((e=>e.root.appName));return dd.getFeatureFlags(e,t)}const ty={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ny=E({},ty,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),iy=[{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"}],oy={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},ay=E({},oy,{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}),ry={loading:!1,error:void 0,saving:!0,profile:oy},sy={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"},ly={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:_r.EmailAndPassword,machineToMachineAuthStrategy:Pr.ClientCredentials},cy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},uy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},dy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},yy={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},fy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},py=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],gy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:yy,roles:py,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Sy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],hy={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:[iy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[iy[0]],managedBy:jd.FRONTEGG}]},vy={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:[iy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[iy[0]],managedBy:jd.FRONTEGG}]},my={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},by=[vy,hy],Ay=[my],ky=[{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}],Ty=[{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"}],_y={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Py={isActive:!0,strategy:Nn.ALLOW},Ey=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Nn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Nn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Nn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Nn.BLOCK,description:"IP 4"}],Iy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(E({},vy,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ly=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"}),Oy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Iy(6),roles:[Ly("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:jd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Iy(44),roles:[Ly("Editor")],managedBy:jd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Iy(8),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Iy(5),roles:[Ly("Admin")],managedBy:jd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Iy(21),description:"BDR, AE, and inside sales",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Iy(23),description:"Dev success and customer success",roles:[Ly("Admin")],managedBy:jd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Iy(10),description:"The marketing department",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Iy(4),description:"Human resources",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Iy(3),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Iy(8),roles:[Ly("Editor")],managedBy:jd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Iy(4),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG}];let wy,Ry,Cy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(wy||(wy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ry||(Ry={})),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"}(Cy||(Cy={})),Cy.profile,Cy.privacy,Cy.personalApiTokens,Cy.account,Cy.users,Cy.groups,Cy.security,Cy.sso,Cy.audits,Cy.webhooks,Cy.apiTokens,Cy.roles,Cy.subscriptions;const Dy=["events","url"];function*Uy(){yield no(ai.setSignUpState({loading:!0}));try{const e=yield ao(Bd.auth.getVendorConfig),[t]=(yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig),yield ao(ey,["admin_portal_login_per_tenant"]));if(t){const t=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield no(ai.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield no(ai.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*My(e){let{payload:{events:t,url:n}}=e,i=vi(e.payload,Dy);yield no(ai.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield lo((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield ao(Bd.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:Ry.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(oa.setAccessToken(null==s?void 0:s.accessToken),oa.setUser(s),!r&&s&&zf(s)){const t=yield Yf(s);yield no(ai.setState(t)),a(e.loginUrl)}else yield no(ai.setSignUpState({loading:!1,shouldActivate:r,stage:dn.SignUpSuccess})),yield no(ai.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield no(ai.loadTenants()))}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setSignUpState({loading:!1,error:e.message}))}yield no(ai.setSignUpState({loading:!1}))}function*Ny(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield lo((e=>e.auth.signUpState));yield no(ai.resetSignUpState()),yield no(ai.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Fy(){yield ia(ai.signUpUser,My),yield ia(ai.resetSignUpStateSoft,Ny)}const $y={setVendorState:(e,{payload:t})=>E({},e,t)},Gy={loadVendorPublicInfo:ot("vendor/loadVendorPublicInfo")},xy={loading:!1},{reducer:Vy,actions:Hy}=rt({name:Lt,initialState:xy,reducers:E({},$y)}),Wy=E({},Hy,Gy);function*jy(){yield no(Wy.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Bd.vendor.getVendorPublicInfo();yield no(Wy.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield no(Wy.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const By=["callback"],Ky=["callback"],qy=["callback"],zy=["callback"],Xy=["callback"],Jy=["callback"];function*Yy(){yield no(ai.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getGlobalSecurityPolicy);yield no(ai.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield no(ai.loadSecurityPolicyMfa()),yield no(ai.loadSecurityPolicyVendorMfa()),yield no(ai.loadSecurityPolicyLockout()),yield no(ai.loadSecurityPolicyVendorLockout()),yield no(ai.loadSecurityPolicyVendorPasswordHistory()),yield no(ai.loadSecurityPolicyCaptcha()),yield no(ai.loadPublicAuthStrategiesPolicy())}function*Qy(){yield no(ai.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorConfig),[t]=yield ao(ey,["admin_portal_login_per_tenant"]);if(t){const t=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield no(ai.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Zy(){yield no(ai.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);yield no(ai.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*ef(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getMfaPolicy);yield no(ai.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*tf(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorMfaPolicy);yield no(ai.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*nf(e){let{payload:{callback:t}}=e,n=vi(e.payload,By);yield no(ai.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.saveMfaPolicy,n);yield no(ai.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*of(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getLockoutPolicy);yield no(ai.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*af(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ky);yield no(ai.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.saveLockoutPolicy,n);yield no(ai.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rf(){yield no(ai.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorLockoutPolicy);yield no(ai.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*sf(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCaptchaPolicy);yield no(ai.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*lf(){yield no(ai.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getPasswordHistoryPolicy);yield no(ai.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*cf(){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorPasswordHistoryPolicy);yield no(ai.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*uf(e){let{payload:{callback:t}}=e,n=vi(e.payload,qy);yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.savePasswordHistoryPolicy,n);yield no(ai.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*df(){yield no(ai.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getPasswordConfigPolicy);yield no(ai.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*yf(){yield ia(ai.loadSecurityPolicy,Yy),yield ta(ai.saveSecurityPolicyMfa,nf),yield ta(ai.loadSecurityPolicyMfa,ef),yield ta(ai.loadSecurityPolicyVendorMfa,tf),yield ta(ai.saveSecurityPolicyLockout,af),yield ta(ai.loadSecurityPolicyLockout,of),yield ta(ai.loadSecurityPolicyVendorLockout,rf),yield ta(ai.loadSecurityPolicyCaptcha,sf),yield ta(ai.saveSecurityPolicyPasswordHistory,uf),yield ta(ai.loadSecurityPolicyPasswordHistory,lf),yield ta(ai.loadSecurityPolicyVendorPasswordHistory,cf),yield ta(ai.loadVendorPasswordConfig,df),yield ta(ai.loadPublicSecurityPolicy,Qy),yield ta(ai.loadPublicAuthStrategiesPolicy,Zy)}function*ff(){yield no(ai.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield no(ai.setSecurityPolicyPublicState({policy:ly,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*pf(){yield no(ai.setSecurityPolicyGlobalState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyGlobalState({policy:sy,loading:!1})),yield no(ai.loadSecurityPolicyMfa()),yield no(ai.loadSecurityPolicyVendorMfa()),yield no(ai.loadSecurityPolicyLockout()),yield no(ai.loadSecurityPolicyVendorLockout()),yield no(ai.loadSecurityPolicyPasswordHistory()),yield no(ai.loadSecurityPolicyVendorPasswordHistory()),yield no(ai.loadSecurityPolicyCaptcha())}function*gf(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyMfaState({policy:cy,loading:!1}))}function*Sf(){yield no(ai.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorMfaState({policy:cy,loading:!1}))}function*hf(e){var t;let{payload:{callback:n}}=e,i=vi(e.payload,zy);yield no(ai.setSecurityPolicyMfaState({saving:!0,error:null}));const o=E({},uy,{id:null!=(t=i.id)?t:uy.id,enforceMFAType:i.enforceMFAType});yield gt(),yield no(ai.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*vf(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyLockoutState({policy:uy,loading:!1}))}function*mf(){yield no(ai.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorLockoutState({policy:uy,loading:!1}))}function*bf(e){let{payload:{callback:t}}=e,n=vi(e.payload,Xy);yield no(ai.setSecurityPolicyLockoutState({saving:!0,error:null})),yield gt();const i=E({},uy,n,{id:n.id?n.id:uy.id});null==t||t(i),yield no(ai.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Af(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyLockoutState({policy:uy,loading:!1}))}function*kf(){yield no(ai.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyPasswordHistoryState({policy:dy,loading:!1}))}function*Tf(){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorPasswordHistoryState({policy:dy,loading:!1}))}function*_f(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jy);yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield gt();const i=E({},dy,n,{id:n.id?n.id:dy.id});null==t||t(i),yield no(ai.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Pf(){yield ia(ai.loadSecurityPolicy,pf),yield ta(ai.loadPublicSecurityPolicy,ff),yield ta(ai.saveSecurityPolicyMfa,hf),yield ta(ai.loadSecurityPolicyMfa,gf),yield ta(ai.loadSecurityPolicyVendorMfa,Sf),yield ta(ai.saveSecurityPolicyLockout,bf),yield ta(ai.loadSecurityPolicyLockout,vf),yield ta(ai.loadSecurityPolicyVendorLockout,mf),yield ta(ai.loadSecurityPolicyCaptcha,Af),yield ta(ai.saveSecurityPolicyPasswordHistory,_f),yield ta(ai.loadSecurityPolicyPasswordHistory,kf),yield ta(ai.loadSecurityPolicyVendorPasswordHistory,Tf)}const Ef=["callback"],If=["callback"],Lf=["callback"],Of=["callback"],wf=["callback","events"],Rf=["callback"],Cf=["callback"],Df=["callback"],Uf=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"],xf=["callback","deviceId"],Vf=["callback","deviceId"],Hf=["callback","deviceId"],Wf=["callback","deviceId"],jf={[_r.Code]:bt.loginWithOtc,[_r.EmailAndPassword]:bt.loginWithPassword,[_r.MagicLink]:bt.magicLinkPreLoginSuccess,[_r.SmsCode]:bt.loginWithSmsOtc};function*Bf(){const e=oa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield lo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(Tt);u&&![a,r,s,l].includes(u)&&(c=u),window.localStorage.removeItem(Tt),yield gt(200),no(ai.resetLoginState());const d=(({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:c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(d,{refresh:d.startsWith("http")})}function*Kf(){let e;try{var t;const n=yield ao(Bd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield no(ai.setState({ssoACS:e}))}function*qf(){try{const{isActive:e}=yield ao(Bd.auth.getSSOPublicConfiguration);yield no(ai.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const zf=e=>e.mfaRequired&&e.mfaToken?(oa.setAccessToken(null),oa.setUser(null),!0):(oa.setAccessToken(e.accessToken),oa.setUser(e),!1),Xf=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 en.authenticatorApp;if(t)return en.smsVerifyCode}return en.verify},Jf=e=>{if(1===e.length){const[t]=e;if(t===Ud.AuthenticatorApp)return en.authenticatorApp;if(t===Ud.SMS)return en.smsSetPhoneNumber}return en.verify};function*Yf(e){let t=bt.loginWithTwoFactor,n={};const{loginState:i}=yield lo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield ao(Bd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Xf(e.mfaDevices)}:(n={step:Jf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=bt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:At.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:E({},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*Qf(e){var t;const{routes:n,loginState:i}=yield lo((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*Zf(){const{hostedLoginBox:e}=yield lo((e=>e.auth));e?yield ao(ep):yield ao(np)}function*ep(){const{user:e}=yield lo((e=>e.auth));if(null==e||!e.refreshToken)return oa.setAccessToken(null),oa.setUser(null),void(yield no(ai.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ao(Bd.auth.exchangeOAuthTokens,t);yield no(ai.setState({user:n,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:null,isAuthenticated:!1}))}}function*tp(){const{user:e}=yield lo((e=>e.auth));if(null==e||!e.refreshToken)return oa.setAccessToken(null),oa.setUser(null),void(yield no(ai.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ao(Bd.auth.exchangeOAuthTokens,t);yield no(ai.setState({user:n,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:null,isAuthenticated:!1}))}}function*np(){try{const t=oa.onRedirectTo,{routes:n,loginState:i}=yield lo((e=>e.auth)),{user:o,tenants:a}=yield ao(Bd.auth.refreshTokenV2);if(zf(o)){const e=yield Yf(o);yield no(ai.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 Qf(o);yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?At.RegisterQuickLogin:At.Login})})),yield op(n)}}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:void 0,isAuthenticated:!1}))}}function*ip(){try{const t=oa.onRedirectTo,{routes:n,loginState:i}=yield lo((e=>e.auth)),{user:o,tenants:a}=yield ao(Bd.auth.refreshTokenV2);if(zf(o)){const e=yield Yf(o);yield no(ai.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield ao(gp))yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.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 Qf(o);yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?At.RegisterQuickLogin:At.Login})})),yield op(n)}}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:void 0,isAuthenticated:!1}))}}function*op(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=oa.onRedirectTo,{routes:o,loginState:a}=yield lo((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 Bf())}function*ap({payload:{callback:e}}){try{const{ip:t}=yield ao(Bd.metadata.getCurrentUserIpMetadata);yield no(ai.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*rp({payload:e}){const t=[];e&&(yield no(ai.setState({isLoading:!0})),yield no(ai.loadSocialLoginsConfigurationV2()),t.push(ao(Uy)),t.push(ao(Zy)),t.push(ao(qf)),t.push(ao(jy)),t.push(ao(Kf))),t.push(ao(Zf)),yield io(t),yield no(ai.setState({isLoading:!1}))}function*sp({accessToken:e,user:t}){if(!e)return void(yield no(ai.setState({user:void 0,isAuthenticated:!1})));const n=oa.onRedirectTo,{routes:i}=yield lo((e=>e.auth));if(zf(t)){const e=yield Yf(t);yield no(ai.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*lp({payload:e}){const t=[];yield no(ai.loadSocialLoginsConfigurationV2()),t.push(ao(Uy)),t.push(ao(qf)),t.push(ao(jy)),t.push(ao(Kf)),t.push(ao(sp,e)),yield io(t)}function*cp({payload:e}){const{disableSilentRefresh:t}=yield lo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield ao(Bd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.loadTenants()),yield no(ai.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield lo((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 no(ai.setState({isLoading:!0}));const a=Qd(),r=Qd(),s=yield ao(Yd,r);localStorage.setItem(_t,r);const l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${sa(n,"/oauth/authorize")}/oauth/authorize`,u=E({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 d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*up({payload:e}){const t=localStorage.getItem(_t)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield lo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield ao(Bd.auth.exchangeOAuthTokens,a);yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Bf()}}function*dp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ef);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.changePhoneNumberWithVerification,n);yield no(ai.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:bt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=vi(e.payload,If);try{yield no(ai.setLoginState({loading:!0})),yield ao(Bd.auth.verifyChangePhoneNumber,n),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Lf);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.passwordlessPreLogin,E({},n,{type:_r.SmsCode}));yield no(ai.setLoginState({step:bt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*pp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Of);try{const{onRedirectTo:e,routes:i}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield no(ai.setLoginState({loading:!0}));const o=yield ao(Bd.auth.passwordlessPreLogin,n),a=jf[n.type];if(a===bt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield no(ai.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield no(ai.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*gp(){const{publicAuthStrategyPolicy:e}=yield lo((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===Cd.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield ao(ey,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield ao(Bd.auth.getWebAuthnDevices);return yield no(ai.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Sp(e){let{payload:{callback:t,events:n}}=e,i=vi(e.payload,wf);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.passwordlessPostLogin,i),a=oa.onRedirectTo,{routes:r}=yield lo((e=>e.auth));if(zf(e)){const t=yield Yf(e);yield no(ai.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield lo((e=>e.auth)),s=yield ao(Bd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:wy.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield no(ai.setState({user:s})),yield no(ai.setLoginState({error:void 0})),yield no(ai.loadTenants()),yield no(ai.setState({isLoading:!1})),i.flow===At.Login?(yield ao(gp))?(yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield no(ai.setState({isAuthenticated:!0})),yield Bf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield no(ai.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield no(ai.setLoginState({loading:!1}))}}function*hp({payload:e}){try{yield no(ai.setLoginState({loading:!0}));const{name:t}=yield ao(Bd.auth.verifyInviteToken,e);yield no(ai.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield no(ai.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield no(ai.setLoginState({loading:!1}))}}function*vp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield no(ai.setLoginState({loading:!0}));try{const o=yield lo((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield ao(Bd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===zd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield lo((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield no(ai.setLoginState({step:bt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield mp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield mp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*mp(e){let{callback:t}=e,n=vi(e,Rf);const i=yield lo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===_r.EmailAndPassword?(yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),null==t||t()):[_r.MagicLink,_r.Code,_r.SmsCode].includes(null==i?void 0:i.authStrategy)?yield no(ai.passwordlessPreLogin(E({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),null==t||t())}function*bp({payload:{callback:e}}){try{yield no(ai.setLoginState({loading:!0}));const{options:t}=yield ao(Bd.auth.webAuthnCreateNewDeviceSession);t.user.id=vt(t.user.id),t.challenge=vt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield no(ai.setLoginState({error:t.message})),null==e||e(null)}finally{yield no(ai.setLoginState({loading:!1}))}}function*Ap(e){let{payload:{callback:t}}=e,n=vi(e.payload,Cf);try{yield no(ai.setLoginState({loading:!0}));const e=mt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Dd.Platform:Dd.CrossPlatform;yield ao(Bd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setLoginState({loading:!1}))}}function*kp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Df);try{var i;yield no(ai.setPasskeysState({loading:!0})),yield no(ai.setLoginState({loading:!0}));const{options:e}=yield ao(Bd.auth.webAuthnPreLogin,n);e.challenge=vt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)}))),yield no(ai.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setPasskeysState({loading:!1})),yield no(ai.setLoginState({loading:!1}))}}function*Tp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Uf);try{var i;yield no(ai.setPasskeysState({loading:!0})),yield no(ai.setLoginState({loading:!0}));const e=mt(n.publicKey),o=yield ao(Bd.auth.webAuthnPostLogin,E({},e,{response:E({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(zf(o)){const e=oa.onRedirectTo,{routes:t}=yield lo((e=>e.auth)),n=yield Yf(o);yield no(ai.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield ao(Bd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield no(ai.loadTenants()),yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.setLoginState({error:void 0})),yield Bf(),null==t||t(!0)}}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setPasskeysState({loading:!1})),yield no(ai.setLoginState({loading:!1}))}}function*_p({payload:e}){const{onRedirectTo:t,routes:n}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield no(ai.setLoginState({loading:!0}));try{const t=yield ao(Bd.auth.postLogin,e);oa.setAccessToken(t.accessToken),oa.setUser(t),yield no(ai.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Bf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield no(ai.setLoginState({step:bt.loginWithSSOFailed,loading:!1}))}}function*Pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield no(ai.setLoginState({loading:!0}));try{const a=yield ao(Bd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});oa.setAccessToken(a.accessToken),oa.setUser(a);const r=oa.onRedirectTo,{routes:s}=yield lo((e=>e.auth));if(zf(a)){const e=yield Yf(a);yield no(ai.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield lo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield no(ai.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===At.Login?bt.success:t.step,tenants:[],tenantsLoading:!0}})),yield no(ai.loadTenants()),n&&t.flow===At.Login&&((yield ao(gp))?(yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Bf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){oa.setAccessToken(null),oa.setUser(null),null==o||o(!1,t),yield no(ai.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ep({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield no(ai.setLoginState({loading:!0}));try{const o=yield ao(Bd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield lo((e=>e.auth)),r=a.flow===At.Login?bt.success:a.step;yield no(ai.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 no(ai.loadTenants()),yield no(ai.setLoginState({error:void 0,loading:!1})),a.flow===At.Login&&((yield ao(gp))?yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})):yield Bf()),null==i||i(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Ip({payload:e}){yield no(ai.setLoginState({loading:!0}));try{var t;yield ao(Bd.auth.recoverMfaToken,e),yield no(ai.setLoginState({loading:!1,error:void 0,step:bt.preLogin})),yield no(ai.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lp({payload:e}){const{hostedLoginBox:t}=yield lo((e=>e.auth));yield no(ai.setState({isLoading:!0}));try{t?yield ao(Bd.auth.OAuthLogout):yield ao(Bd.auth.logout)}catch{}yield no(ai.resetState()),yield no(ai.requestAuthorize(!0)),null==e||e()}function*Op({payload:e}){var t;try{yield ao(Bd.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*wp({user:e,tenants:t}){const n={step:en.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield no(ai.setMfaState(n)),yield no(ai.setUser(e)),yield no(ai.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Rp({user:e,tenants:t}){const{loginState:n}=yield lo((e=>e.auth));yield no(ai.setUser(e)),yield no(ai.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield lo((e=>e.auth.mfaState));if(n.flow===At.Login){const e=yield ao(gp);i===en.smsVerifyCode&&e?yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})):yield Bf()}yield no(ai.setState({isAuthenticated:!0}))}function*Cp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Mf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.preEnrollMFASMSForLogin,n);yield no(ai.setMfaState({otcToken:e.otcToken,step:en.smsVerifyCode,phoneNumber:e.phoneNumber})),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Nf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.enrollMFASMSForLogin,n),i=yield ao(Bd.auth.generateLoginResponseV2,e);yield wp(i),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ff);yield no(ai.setLoginState({loading:!0}));try{var i;const e=yield ao(Bd.auth.preEnrollMFAWebAuthnForLogin,n),o=E({},e.options,{challenge:vt(e.options.challenge),user:E({},e.options.user,{id:vt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t}}=e,n=vi(e.payload,$f);yield no(ai.setLoginState({loading:!0}));try{const e=mt(n.publicKey),i=yield ao(Bd.auth.enrollMFAWebAuthnForLogin,E({},n,{options:e})),o=yield ao(Bd.auth.generateLoginResponseV2,i);yield wp(o),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(e){let{payload:{callback:t}}=e,n=vi(e.payload,Gf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield ao(Bd.auth.generateLoginResponseV2,e);yield wp(i),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Fp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,xf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.preVerifyMFASMSForLogin,n,i);yield no(ai.setMfaState({otcToken:e.otcToken,step:en.smsVerifyCode,phoneNumber:e.phoneNumber})),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*$p(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Vf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.verifyMFASMSForLogin,n,i),o=yield ao(Bd.auth.generateLoginResponseV2,e);yield Rp(o),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Gp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Hf);yield no(ai.setLoginState({loading:!0}));try{var o;const e=yield ao(Bd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=E({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*xp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Wf);yield no(ai.setLoginState({loading:!0}));try{const e=mt(i.publicKey),o=yield ao(Bd.auth.verifyMFAWebAuthnForLogin,n,E({},i,{options:e})),a=yield ao(Bd.auth.generateLoginResponseV2,o);yield Rp(a),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Vp(){yield ia(ai.requestAuthorize,rp),yield ia(ai.requestAuthorizeSSR,lp),yield ia(ai.requestHostedLoginAuthorize,cp),yield ia(ai.handleHostedLoginCallback,up),yield ia(ai.preLogin,vp),yield ia(ai.postLogin,_p),yield ia(ai.login,Pp),yield ia(ai.logout,Lp),yield ia(ai.silentLogout,Op),yield ia(ai.loginWithMfa,Ep),yield ia(ai.recoverMfa,Ip),yield ia(ai.quickSmsPasswordlessPreLogin,fp),yield ia(ai.changePhoneNumberWithVerification,dp),yield ia(ai.verifyChangePhoneNumber,yp),yield ia(ai.passwordlessPreLogin,pp),yield ia(ai.passwordlessPostLogin,Sp),yield ia(ai.verifyInviteToken,hp),yield ia(ai.webAuthnPrelogin,kp),yield ia(ai.webAuthnPostLogin,Tp),yield ia(ai.webAuthnCreateNewDeviceSession,bp),yield ia(ai.webAuthnVerifyNewDeviceSession,Ap),yield ia(ai.afterAuthNavigation,Bf),yield ia(ai.getUserIP,ap),yield ia(ai.preEnrollMFASMSForLogin,Cp),yield ia(ai.enrollMFASMSForLogin,Dp),yield ia(ai.preEnrollMFAWebAuthnForLogin,Up),yield ia(ai.enrollMFAWebAuthnForLogin,Mp),yield ia(ai.enrollMFAAuthenticatorAppForLogin,Np),yield ia(ai.preVerifyMFASMSForLogin,Fp),yield ia(ai.verifyMFASMSForLogin,$p),yield ia(ai.preVerifyMFAWebAuthnForLogin,Gp),yield ia(ai.verifyMFAWebAuthnForLogin,xp)}function*Hp({payload:e}){e&&(yield no(ai.setState({isLoading:!0})));const t=ay;yield no(ai.loadTenants()),yield no(ai.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Wp({payload:{callback:e}}){try{const{ip:t}=Ey[0];yield no(ai.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*jp(){yield ia(ai.requestAuthorize,Hp),yield ia(ai.afterAuthNavigation,Bf),yield ia(ai.getUserIP,Wp)}const Bp=["callback","samlVendor"],Kp=["callback","samlVendor"];function*qp(){try{var e,t;yield no(ai.setSSOState({loading:!0}));const n=yield ao(Bd.auth.getSamlConfiguration),i=yield ao(Bd.auth.getOidcConfiguration),o=yield ao(Bd.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 no(ai.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSSOState({error:e.message,loading:!1}))}}function*zp({payload:e}){const t=yield lo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield no(ai.setSSOState({error:void 0,[n]:!0}));try{const i=yield Zd(e[0]),o=yield ao(Bd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield no(ai.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield no(ai.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Xp({payload:e}){const{configFile:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield no(ai.setSSOState({error:void 0,[o]:!0}));try{const e=yield Zd(t),a=yield ao(Bd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield no(ai.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield no(ai.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Jp({payload:e}){const{callback:t,samlVendor:n}=e,i=vi(e,Bp),o=yield lo((e=>e.auth.ssoState.samlConfiguration)),a=E({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield no(ai.setSSOState({samlConfiguration:E({},o,a)})));if(yield no(ai.setSSOState({error:void 0,[r]:!0})),e.type===zd.Saml){var s,l;const e=yield ao(Bd.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=Jd(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 ao(Bd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield no(ai.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield no(ai.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Yp({payload:{callback:e}={}}){const t=yield lo((e=>e.auth.ssoState.samlConfiguration));try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.validateSamlDomain),yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Qp(){try{const e=yield ao(Bd.auth.getSamlRoles),t=yield ao(Bd.auth.getSamlRolesGroups);yield no(ai.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield no(ai.setSSOState({error:e.message}))}}function*Zp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield io(e.map((e=>ao(Bd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield no(ai.setSSOState({error:e.message}))}}(n)),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*eg({payload:{callback:e,id:t}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.deleteSamlGroup,{id:t}),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*tg({payload:{group:e,roleIds:t,callback:n}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.createSamlGroup,{group:e,roleIds:t}),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield no(ai.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*ng({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield no(ai.setSSOState({loading:!0})),yield ao(Bd.auth.oidcPostLoginV2,t),yield ao(Zf),yield no(ai.setSSOState({loading:!1}))}catch(e){var n;yield no(ai.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*ig(){yield ta(ai.loadSSOConfigurations,qp),yield ta(ai.saveSSOConfigurations,Jp),yield ta(ai.saveSSOConfigurationsFile,zp),yield ta(ai.saveSSOConfigurationsFileWithCallback,Xp),yield ta(ai.validateSSODomain,Yp),yield ta(ai.loadSSOAuthorizationRoles,Qp),yield ta(ai.updateSSOAuthorizationRoles,Zp),yield ta(ai.deleteSamlGroup,eg),yield ta(ai.createSamlGroup,tg),yield ta(ai.oidcPostlogin,ng)}function*og(){yield no(ai.setSSOState({loading:!0})),yield gt(),yield no(ai.setSSOState({samlConfiguration:yy,loading:!1,firstLoad:!1}))}function*ag({payload:e}){const t="saving";yield no(ai.setSSOState({error:void 0,[t]:!0}));const n=E({},yield lo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield no(ai.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*rg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=vi(e,Kp),r=gy.samlConfiguration,s=E({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield no(ai.setSSOState({samlConfiguration:E({},r,s)})));yield no(ai.setSSOState({error:void 0,[l]:!0})),yield gt(),s.acsUrl=null==fy||null==(t=fy.configuration)?void 0:t.acsUrl,s.spEntityId=null==fy||null==(n=fy.configuration)?void 0:n.spEntityId;const c=Jd(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 gt(),yield no(ai.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*sg({payload:{callback:e}={}}){const t=gy.samlConfiguration;yield no(ai.setSSOState({error:void 0,saving:!0})),yield gt(),yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lg(){yield gt(),yield no(ai.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*cg({payload:{callback:e,authorizationRoles:t}}){yield no(ai.setSSOState({error:void 0,saving:!0})),yield gt(),yield no(ai.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*ug(){yield ta(ai.loadSSOConfigurations,og),yield ta(ai.saveSSOConfigurations,rg),yield ta(ai.saveSSOConfigurationsFile,ag),yield ta(ai.validateSSODomain,sg),yield ta(ai.loadSSOAuthorizationRoles,lg),yield ta(ai.updateSSOAuthorizationRoles,cg)}const dg=["callback"],yg=["callback","ssoConfigId"],fg=["callback","ssoConfigId"],pg=["callback","ssoConfigId"];function*gg(){try{return yield ao(Bd.auth.getOidcConfiguration)}catch(e){return null}}function*Sg(){try{return yield ao(Bd.metadata.getSamlMetadata)}catch(e){return null}}function*hg(){try{yield no(ai.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield io([ao(gg),ao(Sg)]),n=yield ao(Bd.auth.getSSOConfigurations);yield no(ai.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield no(ai.setSSOError({key:qd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield no(ai.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*vg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=vi(e,dg),i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield ao(Bd.auth.createSSOConfiguration,E({},n,{enabled:null!=(o=n.enabled)&&o}));yield no(ai.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Zd(t),o=yield ao(Bd.auth.createSSOConfigurationByMetadata,{metadata:e});yield no(ai.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bg({payload:e}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=vi(e,yg),o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ao(Bd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Zd(i),a=yield ao(Bd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield no(ai.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield no(ai.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*kg({payload:e}){yield no(ai.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.deleteSSOConfiguration,t),yield no(ai.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield no(ai.setSSOError({key:qd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Tg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=vi(e,fg);yield no(ai.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ao(Bd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?E({},t,{domains:[...t.domains,e]}):t));yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!1}))}}function*_g({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield no(ai.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?E({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield no(ai.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield no(ai.setSSOError({key:qd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield no(ai.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield no(ai.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?E({},e,{domains:e.domains.map((e=>e.id===n?E({},e,{validated:!0}):e))}):e));yield no(ai.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield no(ai.setSSOError({key:qd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Eg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?E({},e,{roleIds:n}):e));yield no(ai.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield no(ai.setSSOError({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ig({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield io(t.map((e=>ao(Bd.auth.deleteSSOGroup,n,e)))),yield io(e.map((e=>ao(Bd.auth.createSSOGroup,n,e))));const a=yield ao(Bd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?E({},e,{groups:a}):e));yield no(ai.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Lg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield io(t.map((t=>ao(Bd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Og({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield ao(ca,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield ao(Bd.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield ao(Bd.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield no(ai.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=vi(e,pg),o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield ao(Bd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield ao(Bd.auth.createSSOConfiguration,i),a=[e,...o]),yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Rg(){yield ta(ai.loadSSOConfigurationsV2,hg),yield ta(ai.saveSSOConfigurationV2,vg),yield ta(ai.saveSSODomain,Tg),yield ta(ai.deleteSSODomain,_g),yield ta(ai.validateSSODomainV2,Pg),yield ta(ai.updateSSOConfiguration,bg),yield ta(ai.deleteSSOConfiguration,kg),yield ta(ai.setSSOGroups,Ig),yield ta(ai.updateSSOGroups,Lg),yield ta(ai.setSSODefaultRoles,Eg),yield ta(ai.saveSSOConfigurationByMetadata,mg),yield ta(ai.updateSSOConfigurationByMetadata,Ag),yield ta(ai.saveSSOConfigurationByUrl,Og),yield ta(ai.saveSSOConfigurationByData,wg)}const Cg=["callback","profilePictureUrl"],Dg=["callback","profilePictureUrl"];function*Ug(){yield no(ai.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 ao.apply(void 0,[ea,e,t,n].concat(o))}(3,2e3,Bd.teams.getProfile),t=yield lo((e=>e.auth.user));ai.setUser(E({},t,e)),yield no(ai.setProfileState({profile:e,loading:!1}))}catch(e){yield no(ai.setProfileState({loading:!1,error:e.message}))}}function*Mg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=vi(e.payload,Cg);yield no(ai.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield lo((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 ao(Bd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=E({},e,i,{profilePictureUrl:o}),r=yield ao(Bd.teams.updateProfile,a),s=yield lo((e=>e.auth.user));yield no(ai.setUser(E({},s,r))),yield no(ai.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield no(ai.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*Ng({payload:e}){yield no(ai.setProfileState({loading:!0}));try{var t;yield ao(Bd.teams.changePassword,e),yield no(ai.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Fg(){yield ia(ai.loadProfile,Ug),yield ta(ai.saveProfile,Mg),yield ta(ai.changePassword,Ng)}function*$g(){yield no(ai.setProfileState({loading:!0})),yield gt(),yield no(ai.setUser(E({},ay,oy))),yield no(ai.setProfileState({loading:!1,profile:oy}))}function*Gg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=vi(e.payload,Dg);yield no(ai.setProfileState({saving:!0,error:null}));const o=ry;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=E({},o.profile,i,{profilePictureUrl:a}),s=ay;yield gt(),yield no(ai.setUser(E({},s,r))),yield no(ai.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*xg({payload:e}){var t;yield no(ai.setProfileState({loading:!0})),yield gt(),yield no(ai.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Vg(){yield ia(ai.loadProfile,$g),yield ta(ai.saveProfile,Gg),yield ta(ai.changePassword,xg)}const Hg=["callback"],Wg=["callback"],jg=["callback"],Bg=["deviceId","callback"],Kg=["deviceId","callback"],qg=["callback"],zg=["deviceId"],Xg=["deviceId"],Jg=["callback"],Yg=["deviceId"],Qg=["callback"];function*Zg(e){const{step:t}=yield lo((e=>e.auth.mfaState));return{step:e.recoveryCode?en.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*eS(){yield no(ai.setMfaState({saving:!0}));try{const{qrCode:e}=yield ao(Bd.auth.enrollMfa);yield no(ai.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message}))}}function*tS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Hg);yield no(ai.setMfaState({saving:!0}));try{const e=yield lo((e=>e.auth.user)),i=yield ao(Bd.auth.verifyMfa,n),o=yield ao(Bd.auth.getMFADevices),a=yield Zg(i);yield no(ai.setMfaState(E({},a,{mfaDevices:o}))),yield no(ai.setUser(E({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Wg);yield no(ai.setMfaState({loading:!0}));try{const e=yield ao(Bd.auth.loginWithMfa,n),i={step:en.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield no(ai.setMfaState(i)),yield no(ai.setState({user:e})),yield no(ai.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*iS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t;yield ao(Bd.auth.disableMfa,e);const n=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*oS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t,n;const i=yield ao(Bd.auth.preEnrollMFAWebAuthn),o=E({},i.options,{challenge:vt(i.options.challenge),user:E({},i.options.user,{id:vt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield no(ai.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*aS(e){let{payload:{callback:t}}=e,n=vi(e.payload,jg);yield no(ai.setMfaState({saving:!0}));try{const e=mt(n.publicKey),i=yield ao(Bd.auth.enrollMFAWebAuthn,E({},n,{options:e})),o=yield ao(Bd.auth.getMFADevices),a=yield Zg(i);yield no(ai.setMfaState(E({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rS(e){let{payload:{deviceId:t,callback:n}}=e;vi(e.payload,Bg),yield no(ai.setMfaState({saving:!0}));try{var i;const e=yield ao(Bd.auth.preDisableMFAWebAuthn,t),o=E({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*sS(e){let{payload:{deviceId:t,callback:n}}=e,i=vi(e.payload,Kg);yield no(ai.setMfaState({saving:!0}));try{const e=mt(i.publicKey);yield ao(Bd.auth.disableMFAWebAuthn,t,E({},i,{options:e}));const o=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*lS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t;const n=yield ao(Bd.auth.preEnrollMFASMS,e);yield no(ai.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 no(ai.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*cS(e){let{payload:{callback:t}}=e,n=vi(e.payload,qg);yield no(ai.setMfaState({saving:!0}));try{const e=yield ao(Bd.auth.enrollMFASMS,n),i=yield ao(Bd.auth.getMFADevices),o=yield Zg(e);yield no(ai.setMfaState(E({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*uS(e){let{payload:{deviceId:t}}=e,n=vi(e.payload,zg);yield no(ai.setMfaState({saving:!0}));try{var i;const e=yield ao(Bd.auth.preDisableMFASMS,t);yield no(ai.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 no(ai.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*dS(e){let{payload:{deviceId:t}}=e,n=vi(e.payload,Xg);yield no(ai.setMfaState({saving:!0}));try{var i;yield ao(Bd.auth.disableMFASMS,t,n);const e=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield no(ai.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*yS(){yield no(ai.setMfaState({loading:!0}));try{yield lo((e=>e.auth.user));const e=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message}))}}function*fS(){yield no(ai.setMfaState({loading:!0}));try{const e=(yield ao(Bd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield no(ai.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message}))}}function*pS(){yield ta(ai.enrollMfa,eS),yield ta(ai.getMFADevices,yS),yield ta(ai.getMFAStrategies,fS),yield ta(ai.verifyMfa,tS),yield ta(ai.disableMfa,iS),yield ta(ai.verifyMfaAfterForce,nS),yield ta(ai.preDisableMfaSms,uS),yield ta(ai.disableMfaSms,dS),yield ta(ai.preEnrollMfaSms,lS),yield ta(ai.enrollMfaSms,cS),yield ta(ai.preEnrollMfaWebAuthn,oS),yield ta(ai.enrollMfaWebAuthn,aS),yield ta(ai.preDisableMfaWebAuthn,rS),yield ta(ai.disableMfaWebAuthn,sS)}function*gS(){yield no(ai.setMfaState({saving:!0})),yield no(ai.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*SS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:en.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield no(ai.setMfaState(i)),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*hS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jg);yield no(ai.setMfaState({loading:!0})),yield gt();const i=E({},n,{recoveryCode:"recoveryCode"}),o={step:en.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield no(ai.setMfaState(o)),yield gt(),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*vS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:E({},n,{authenticators:[]})})),yield no(ai.setUser(E({},ay))),null==(t=e.callback)||t.call(e,!0)}function*mS(e){let{}=e,t=vi(e.payload,Yg);yield no(ai.setMfaState({saving:!0}));try{var n;yield no(ai.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield no(ai.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*bS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({loading:!1,error:void 0,mfaDevices:E({},n,{phones:[]})})),yield no(ai.setUser(E({},ay))),null==(t=e.callback)||t.call(e,!0)}function*AS({payload:e}){var t;yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*kS(e){let{payload:{callback:t}}=e;vi(e.payload,Qg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:en.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield no(ai.setMfaState(o)),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*TS(){yield ta(ai.enrollMfa,gS),yield ta(ai.verifyMfa,SS),yield ta(ai.disableMfa,vS),yield ta(ai.verifyMfaAfterForce,hS),yield ta(ai.preDisableMfaSms,mS),yield ta(ai.disableMfaSms,bS),yield ta(ai.preEnrollMfaSms,AS),yield ta(ai.enrollMfaSms,kS)}const _S=["callback"];function*PS({payload:e}){yield no(ai.setForgotPasswordState({loading:!0}));try{var t;yield ao(Bd.auth.forgotPassword,e),yield no(ai.setForgotPasswordState({loading:!1,error:void 0,step:xt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*ES(e){let{payload:{callback:t}}=e,n=vi(e.payload,_S);yield no(ai.setForgotPasswordState({loading:!0}));try{yield ao(Bd.auth.resetPassword,n),yield no(ai.setForgotPasswordState({loading:!1,error:void 0,step:xt.success})),null==t||t(!0)}catch(e){yield no(ai.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*IS({payload:e}){yield no(ai.setForgotPasswordState({loading:!0}));try{const t=yield ao(Bd.auth.loadPasswordConfig,e);yield no(ai.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield no(ai.setForgotPasswordState({loading:!1,error:e.message}))}}function*LS(){yield ia(ai.forgotPassword,PS),yield ia(ai.resetPassword,ES),yield ia(ai.loadPasswordConfig,IS)}let OS;!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"}(OS||(OS={}));const wS=["callback","events"],RS=["callback"],CS=["callback"];function*DS({payload:{userId:e,token:t}}){yield no(ai.setActivateState({loading:!0,step:Ct.activating}));try{const{isAuthenticated:n}=yield lo((e=>e.auth));n&&(yield no(ai.silentLogout()));const i=yield ao(Bd.auth.getActivateAccountStrategy,{userId:e,token:t});yield no(ai.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield no(ai.setActivateState({loading:!1,step:Ct.activatingForm})))}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message}))}}function*US(e){let{payload:{callback:t,events:n}}=e,i=vi(e.payload,wS);yield no(ai.setActivateState({loading:!0}));try{const e=oa.onRedirectTo,{routes:a}=yield lo((e=>e.auth)),r=yield ao(Bd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(zf(r)){yield no(ai.setActivateState({step:Ct.success}));const t=yield Yf(r);yield no(ai.setState(t)),yield co(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield no(ai.setActivateState({step:Ct.success}));const{user:e,tenants:t}=yield ao(Bd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:wy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield no(ai.setTenantsState({tenants:t,loading:!1})),yield no(ai.setState({user:e,isAuthenticated:!0})),yield co(1e3),yield Bf(),yield no(ai.resetActivateState())}null==t||t(!0)}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message}))}}function*MS({payload:e}){const{callback:t}=e,n=vi(e,RS);yield no(ai.setActivateStrategyState({loading:!0}));try{const e=yield ao(Bd.auth.getActivateAccountStrategy,n);yield no(ai.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield no(ai.setActivateStrategyState({loading:!1,error:e.message}))}}function*NS({payload:e}){const{callback:t}=e,n=vi(e,CS);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.email})),yield no(ai.setActivateState({loading:!0}));try{yield ao(Bd.auth.resendActivationEmail,n),yield no(ai.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message})),yield no(ai.setTeamError({key:OS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*FS(){yield ia(ai.activateAccount,US),yield ia(ai.preActivateAccount,DS),yield ia(ai.getActivateAccountStrategy,MS),yield ia(ai.resendActivationEmail,NS)}function*$S({payload:e}){if(e.token&&e.userId)try{yield no(ai.setAcceptInvitationState({error:void 0,step:Nt.pending})),yield ao(Bd.auth.acceptInvitation,e),yield no(ai.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Nt.success}}))}catch(e){yield no(ai.setAcceptInvitationState({step:Nt.failed,error:e.message}))}else yield no(ai.setAcceptInvitationState({error:void 0,step:Nt.invalid}))}function*GS(){yield ia(ai.acceptInvitation,$S)}var xS,VS=new Uint8Array(16);function HS(){if(!xS&&!(xS="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 xS(VS)}for(var WS=/^(?:[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,jS=function(e){return"string"==typeof e&&WS.test(e)},BS=[],KS=0;KS<256;++KS)BS.push((KS+256).toString(16).substr(1));var qS=function(e,t,n){var i=(e=e||{}).random||(e.rng||HS)();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=(BS[e[t+0]]+BS[e[t+1]]+BS[e[t+2]]+BS[e[t+3]]+"-"+BS[e[t+4]]+BS[e[t+5]]+"-"+BS[e[t+6]]+BS[e[t+7]]+"-"+BS[e[t+8]]+BS[e[t+9]]+"-"+BS[e[t+10]]+BS[e[t+11]]+BS[e[t+12]]+BS[e[t+13]]+BS[e[t+14]]+BS[e[t+15]]).toLowerCase();if(!jS(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let zS,XS;!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"}(zS||(zS={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(XS||(XS={}));const JS=["callback"],YS=["roles"],QS=["callback"],ZS=["callback","profileImage"],eh=["callback"],th=["callback","userId"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=["callback"],sh=["callback"],lh=["callback"],ch=["callback","profileImage"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=()=>lo((e=>e.auth.teamState));function*hh(){try{const{groups:e}=yield ao(Bd.groups.getGroups,{_groupsRelations:XS.roles});return e}catch(e){return[]}}function*vh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!a})),yield no(ai.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield io([ao(Bd.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions),ao(hh)]),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 E({},e,{groups:n})}));yield no(ai.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield no(ai.setTeamError({key:OS.USERS,value:e.message})),yield no(ai.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield no(ai.setTeamLoader({key:OS.USERS,value:!1}))}function*mh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!r})),yield no(ai.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield io([ao(Bd.subTenants.loadAllUsers,E({},c)),ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions)]);yield no(ai.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield no(ai.setTeamError({key:OS.USERS,value:e.message})),yield no(ai.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield no(ai.setTeamLoader({key:OS.USERS,value:!1}))}function*bh({payload:e}){yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield io([ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions)]);yield no(ai.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 no(ai.setTeamError({key:OS.ROLES_AND_PERMISSIONS,value:t.message}))}yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0}))}function*Ah({payload:e}){const{callback:t}=e,n=vi(e,JS),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield ao(Bd.teams.addUser,n),{roles:a}=e,r=E({},vi(e,YS),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield no(ai.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*kh({payload:e}){const{callback:t}=e,n=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield no(ai.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield ao(Bd.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 no(ai.loadUsers(r)),yield no(ai.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*Th({payload:e}){const{callback:t}=e,n=vi(e,QS),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield ao(Bd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield no(ai.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*_h({payload:e}){const{callback:t}=e,n=vi(e,ZS),{id:i}=n,o=yield Sh(),a=o.users.find((e=>e.id===n.id));yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:i||""})),yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})})),yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?E({},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 ao(Bd.teams.updateUser,n);null==t||t(e),yield no(ai.setTeamState({users:o.users.map((t=>t.id===e.id?E({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1}))}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?E({},e,a):e))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Ph({payload:e}){const{callback:t}=e,n=vi(e,eh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ao(Bd.teams.deleteUser,n),null==t||t(!0),yield no(ai.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Eh({payload:e}){const{callback:t,userId:n}=e,i=vi(e,th),o=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return E({},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 no(ai.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[E({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Ih({payload:e}){const{callback:t}=e,n=vi(e,nh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield no(ai.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Lh({payload:e}){const{callback:t}=e,n=vi(e,ih);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield ao(Bd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*Oh({payload:e}){const{callback:t}=e,n=vi(e,oh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*wh({payload:e}){const{callback:t}=e,n=vi(e,ah);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Rh({payload:e}){const{callback:t}=e,n=vi(e,rh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Ch(){yield no(ai.setTeamError({key:OS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield ao(Bd.teams.getInviteLinkConfiguration);yield no(ai.setTeamState({inviteTokenState:E({},e)}))}catch(e){yield no(ai.setTeamError({key:OS.CONFIG_TOKEN_LINK,value:e.message}))}}function*Dh(){yield no(ai.setTeamError({key:OS.GET_TOKEN_LINK,value:!1}));try{yield ao(Ch);const e=yield ao(Bd.teams.getInviteUserLink),{inviteTokenState:t}=yield Sh();yield no(ai.setTeamState({inviteTokenState:E({},t,e)}))}catch(e){yield no(ai.setTeamError({key:OS.GET_TOKEN_LINK,value:e.message}))}}function*Uh({payload:{callback:e}}){yield no(ai.setTeamError({key:OS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Sh();try{const n=yield ao(Bd.teams.createInviteUserLink,{expiresInMinutes:43200});yield no(ai.setTeamState({inviteTokenState:E({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield no(ai.setTeamError({key:OS.CREATE_TOKEN_LINK,value:t.message}))}}function*Mh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Sh();yield no(ai.setTeamError({key:OS.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield ao(Bd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield no(ai.setTeamState({inviteTokenState:E({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield no(ai.setTeamError({key:OS.UPDATE_TOKEN_LINK,value:t.message}))}}function*Nh({payload:e}){const{callback:t}=null!=e?e:{};yield no(ai.setTeamError({key:OS.DELETE_TOKEN_LINK,value:!1}));try{yield ao(Bd.teams.deleteInviteUserLink),yield no(ai.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Fh({payload:e}){yield no(ai.setTeamState({addUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*$h({payload:e}){const t=yield Sh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield no(ai.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gh({payload:e}){yield no(ai.setTeamState({deleteUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*xh({payload:e}){const t=yield Sh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield no(ai.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Vh(){yield na(ai.loadUsers,vh),yield na(ai.loadAllSubTenantsUsers,mh),yield na(ai.loadRoles,bh),yield ta(ai.addUser,Ah),yield ta(ai.addUsersBulk,kh),yield ta(ai.addUserToSubTenants,Th),yield ta(ai.updateUser,_h),yield ta(ai.setUserRolesForSubTenants,Eh),yield ta(ai.deleteUser,Ph),yield ta(ai.deleteUserFromSubTenants,Ih),yield ta(ai.resendActivationLink,Lh),yield ta(ai.resendInvitationLink,Oh),yield ta(ai.resendInvitationEmail,wh),yield ta(ai.resendInvitationLinkToAllSubTenants,Rh),yield ta(ai.getInvitationLink,Dh),yield ta(ai.createInvitationLink,Uh),yield ta(ai.updateInvitationLink,Mh),yield ta(ai.deleteInvitationLink,Nh),yield ta(ai.openAddUserDialog,Fh),yield ta(ai.closeAddUserDialog,$h),yield ta(ai.openDeleteUserDialog,Gh),yield ta(ai.closeDeleteUserDialog,xh)}function*Hh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!a})),yield no(ai.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield gt(),yield no(ai.setTeamState({users:by,totalPages:2,totalItems:10,roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.USERS,value:!1})),null==r||r(by)}function*Wh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!r})),yield no(ai.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield gt(),yield no(ai.setTeamState({allUsers:Ay,totalPages:2,totalItems:10,roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.USERS,value:!1})),null==s||s(Ay)}function*jh({payload:e}){var t;yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0})),yield gt(),yield no(ai.setTeamState({roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:py,permissions:Sy})}function*Bh({payload:e}){const{callback:t}=e,n=vi(e,sh),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield gt();const o=E({},vy,{groups:[]},n,{id:`${qS()}`});null==t||t(o),yield no(ai.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kh({payload:e}){const{callback:t}=e,n=vi(e,lh),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield gt();const o=E({},vy,n,{id:`${qS()}`});yield no(ai.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*qh({payload:e}){var t;const{callback:n}=e,i=vi(e,ch),{id:o}=i,a=yield Sh(),r=a.users.find((e=>e.id===i.id));yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:o||""})),yield no(ai.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0})})),yield no(ai.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?E({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield gt();const s=E({},r,i);null==n||n(s),yield no(ai.setTeamState({users:a.users.map((e=>e.id===s.id?E({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1}))}function*zh({payload:e}){const{callback:t}=e,n=vi(e,uh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield no(ai.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Xh({payload:e}){const{callback:t}=e,n=vi(e,dh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield no(ai.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Jh({payload:e}){const{callback:t}=e,n=vi(e,yh);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.userId})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*Yh({payload:e}){const{callback:t}=e,n=vi(e,fh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Qh({payload:e}){const{callback:t}=e,n=vi(e,ph);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Zh({payload:e}){const{callback:t}=e,n=vi(e,gh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*ev(){yield na(ai.loadUsers,Hh),yield na(ai.loadAllSubTenantsUsers,Wh),yield na(ai.loadRoles,jh),yield ta(ai.addUser,Bh),yield ta(ai.addUserToSubTenants,Kh),yield ta(ai.updateUser,qh),yield ta(ai.deleteUser,zh),yield ta(ai.deleteUserFromSubTenants,Xh),yield ta(ai.resendActivationLink,Jh),yield ta(ai.resendInvitationLink,Yh),yield ta(ai.resendInvitationEmail,Qh),yield ta(ai.resendInvitationLinkToAllSubTenants,Zh),yield ta(ai.openAddUserDialog,Fh),yield ta(ai.closeAddUserDialog,$h),yield ta(ai.openDeleteUserDialog,Gh),yield ta(ai.closeDeleteUserDialog,xh)}const tv=["authorizationUrl"],nv=["events","url"];function*iv(){try{yield no(ai.setSocialLoginsState({loading:!0}));const e=yield ao(Bd.auth.getSocialLoginProviders);yield no(ai.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*ov(){try{const e=yield lo((e=>e.root.context));yield no(ai.setSocialLoginsState({loading:!0}));const t=yield ao(Bd.auth.getSocialLoginProvidersV2),{providers:n}=yield ao(Bd.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=vi(t,tv);const o=sa(e,null!=n?n:"");return E({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield no(ai.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*av(e){let{payload:{events:t,url:n}}=e,i=vi(e.payload,nv);try{yield no(ai.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield ao(Bd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Ry.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:wy.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield no(ai.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield lo((e=>e.auth));e?yield ao(tp):yield ao(ip)}(),localStorage.removeItem("register-quick-login"),yield no(ai.setSocialLoginsState({loading:!1}))}catch(e){var r;yield no(ai.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*rv({payload:e}){yield no(ai.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*sv(){yield ia(ai.loadSocialLoginsConfiguration,iv),yield ia(ai.loadSocialLoginsConfigurationV2,ov),yield ia(ai.loginViaSocialLogin,av),yield na(ai.setSocialLoginError,rv)}let lv;function*cv({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield lo((e=>e.auth.apiTokensState));try{let e,a;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield ao(Bd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield ao(Bd.auth.updateUserApiTokensData,{description:t}),yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield no(ai.setApiTokensError({key:lv.ADD_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*uv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield lo((e=>e.auth.apiTokensState));try{let e,r;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield ao(Bd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield ao(Bd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield no(ai.setApiTokensError({key:lv.ADD_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*dv({payload:e}){const{apiTokensDataUser:t}=yield lo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),n?(yield ao(Bd.auth.deleteUserAccessToken,{id:e}),yield no(ai.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield ao(Bd.auth.deleteUserApiToken,{tokenId:e}),yield no(ai.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}catch(e){yield no(ai.setApiTokensError({key:lv.DELETE_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}}function*yv({payload:e}){const{apiTokensDataTenant:t}=yield lo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),n?(yield ao(Bd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield ao(Bd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield no(ai.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}catch(e){yield no(ai.setApiTokensError({key:lv.DELETE_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}}function*fv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield io([ao(Bd.auth.getUserApiTokensData),ao(Bd.auth.getTenantApiTokensData)]);yield no(ai.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*pv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ao(Bd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=ao(Bd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield no(ai.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*gv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ao(Bd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=ao(Bd.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 no(ai.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Sv(){yield ia(ai.loadApiTokens,fv),yield ia(ai.loadUserApiTokens,pv),yield ia(ai.loadTenantApiTokens,gv),yield ta(ai.addUserApiToken,cv),yield ta(ai.addTenantApiToken,uv),yield na(ai.deleteTenantApiToken,yv),yield na(ai.deleteUserApiToken,dv)}function*hv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield lo((e=>e.auth.apiTokensState)),a=E({},ny,{description:t,roleIds:n,clientId:`CLIENT_ID_${qS()}`});yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*vv({payload:e}){yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),yield co(200);const t=[ny];yield no(ai.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}function*mv({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ty],i=[ny];yield no(ai.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bv({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ty];yield no(ai.setApiTokensState({apiTokensDataUser:n})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Av({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ny];yield no(ai.setApiTokensState({apiTokensDataTenant:n})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*kv(){yield ia(ai.loadApiTokens,mv),yield ia(ai.loadUserApiTokens,bv),yield ia(ai.loadTenantApiTokens,Av),yield ta(ai.addTenantApiToken,hv),yield na(ai.deleteTenantApiToken,vv)}function*Tv({payload:e}){try{var t;yield no(ai.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield lo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield ao(Bd.accountSettings.updateSettings,E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield no(ai.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield no(ai.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*_v({payload:e}){yield no(ai.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield ao(Bd.accountSettings.getSettings);yield no(ai.setAccountSettingsState(E({},e,{loading:!1})))}catch(e){yield no(ai.setAccountSettingsState({loading:!1,error:e.message}))}}function*Pv(){yield ia(ai.saveAccountSettings,Tv),yield ia(ai.loadAccountSettings,_v)}function*Ev({payload:e}){var t;yield no(ai.setAccountSettingsState({loading:!0})),yield gt();const{accountSettingsState:n}=yield lo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield no(ai.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Iv({payload:e}){yield no(ai.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield gt(),yield no(ai.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Lv(){yield ia(ai.saveAccountSettings,Ev),yield ia(ai.loadAccountSettings,Iv)}function*Ov({payload:{tenantId:e,callback:t}}){yield no(ai.setState({isLoading:!0}));try{yield ao(Bd.tenants.switchTenant,{tenantId:e}),yield ao(Zf),(null==t?void 0:t(!0))||(yield no(ai.setState({isLoading:!1})))}catch(e){yield no(ai.setState({isLoading:!1})),null==t||t(!1,e)}}function*wv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getTenants);yield no(ai.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 no(ai.setTenantsState({loading:!1}))}}function*Rv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getSubTenants);yield no(ai.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Cv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getSubTenantsAsTree);yield no(ai.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Dv(){yield ta(ai.loadTenants,wv),yield ta(ai.loadSubTenants,Rv),yield ta(ai.switchTenant,Ov),yield ta(ai.loadSubTenantsTree,Cv)}function*Uv(){yield no(ai.setTenantsState({loading:!0})),yield gt(),yield no(ai.setTenantsState({tenants:ky,loading:!1}))}function*Mv(){yield ta(ai.loadTenants,Uv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(lv||(lv={}));const Nv=["callback"],Fv=["callback"],$v=["callback"],Gv=["callback"],xv=["callback"];function*Vv({payload:e}){var t;yield no(ai.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield io([ao(Bd.roles.getRoles),ao(Bd.roles.getPermissions),ao(Bd.roles.getPermissionCategories)]),[t,n,i]=e;yield no(ai.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield no(ai.setRolesState({error:e.message,loading:!1}))}}function*Hv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Nv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.addRole,n),i=yield ao(Bd.roles.getRoles);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Wv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Fv);yield no(ai.setRolesState({saving:!0}));try{yield ao(Bd.roles.deleteRole,n),yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*jv(e){let{payload:{callback:t}}=e,n=vi(e.payload,$v);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.updateRole,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Bv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Gv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.attachPermissionsToRole,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Kv(e){let{payload:{callback:t}}=e,n=vi(e.payload,xv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.attachPermissionToRoles,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*qv(){yield ia(ai.loadRolesAndPermissions,Vv),yield ta(ai.addRole,Hv),yield ta(ai.deleteRole,Wv),yield ta(ai.updateRole,jv),yield ta(ai.attachPermissionsToRole,Bv),yield ta(ai.attachPermissionToRoles,Kv)}function*zv({payload:e}){var t;yield no(ai.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield no(ai.setRolesState({roles:iy,loading:!1}))}catch(e){yield no(ai.setRolesState({error:e.message,loading:!1}))}}function*Xv(){yield ia(ai.loadRolesAndPermissions,zv)}const Jv=["callback"],Yv=["callback"],Qv=["callback"];function*Zv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const e=yield ao(Bd.auth.resetPhoneNumber,n);yield no(ai.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield no(ai.setLoginState({email:n.email}))}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*em(e){let{payload:{callback:t}}=e,n=vi(e.payload,Yv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const e=yield ao(Bd.auth.verifyResetPhoneNumber,n);yield no(ai.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*tm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Qv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ao(Bd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield no(ai.setLoginState({step:bt.loginWithSmsOtc})),yield no(ai.passwordlessPreLogin({type:_r.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield no(ai.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*nm(){yield ia(ai.resetPhoneNumber,Zv),yield ia(ai.verifyResetPhoneNumber,em),yield ia(ai.changePhoneNumber,tm)}function*im(){yield no(ai.setSessionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCurrentUserSessions);yield no(ai.setSessionsState({sessions:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*om(){yield no(ai.setSessionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCurrentUserSession);yield no(ai.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*am({payload:{id:e}}){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.deleteSessionForUser,e),yield no(ai.loadUserSessions())}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*rm({payload:{callback:e,userId:t}}){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield no(ai.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*sm(){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.deleteAllSessionsForUser),yield no(ai.loadUserSessions())}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*lm(){yield na(ai.loadUserSessions,im),yield na(ai.deleteUserSession,am),yield na(ai.deleteAllUserSessions,sm),yield na(ai.loadCurrentUserSession,om),yield ta(ai.revokeUserSessions,rm)}function*cm(){yield no(ai.setSessionsState({loading:!0,error:null})),yield no(ai.setSessionsState({sessions:Ty,loading:!1}))}function*um({payload:{id:e}}){yield no(ai.setSessionsState({loading:!0,error:null}));const t=(yield lo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield no(ai.setSessionsState({sessions:t,loading:!1}))}function*dm(){yield no(ai.setSessionsState({loading:!0,error:null}));const e=Ty.filter((e=>e.current));yield no(ai.setSessionsState({sessions:e,loading:!1}))}function*ym(){yield na(ai.loadUserSessions,cm),yield na(ai.deleteUserSession,um),yield na(ai.deleteAllUserSessions,dm)}const fm=["callback"],pm=["callback"];function*gm(){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getSessionConfigurations);yield no(ai.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*Sm({payload:e}){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=vi(e,fm);yield ao(Bd.auth.createOrUpdateSessionConfigrations,n),yield no(ai.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield no(ai.setSessionsPolicyState({error:e,loading:!1}))}}function*hm(){yield ia(ai.loadSessionsPolicy,gm),yield na(ai.createOrUpdateSessionsPolicy,Sm)}function*vm(){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));const e=yield lo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:_y}));yield no(ai.setSessionsPolicyState(E({},e,{loading:!1})))}function*mm({payload:e}){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=vi(e,pm);null==t||t(!0),yield no(ai.setSessionsPolicyState({configurations:n,loading:!1}))}function*bm(){yield ia(ai.loadSessionsPolicy,vm),yield na(ai.createOrUpdateSessionsPolicy,mm)}const Am=["callback"],km=["callback"],Tm=["callback"],_m=["callback"],Pm=["callback"],Em=["callback"],Im=["callback"],Lm=["callback"],Om=()=>lo((e=>e.auth.restrictionsState.ipRestrictions)),wm=()=>lo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Rm(){yield no(ai.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getDomainRestrictionsConfig),t=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield no(ai.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield no(ai.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Cm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Am);yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield wm();try{var o;yield ao(Bd.auth.createDomainRestriction,n);const e=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield no(ai.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 no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Dm(e){let{payload:{callback:t}}=e,n=vi(e.payload,km);yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.updateDomainRestrictionConfig,n),i=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield no(ai.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Um({payload:{id:e}}){yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield wm();try{var n;yield ao(Bd.auth.deleteDomainRestriction,e);const i=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield no(ai.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Nn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Mm=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Nn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Nm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Om(),t=yield ao(Bd.auth.getIPRestrictionsConfig),n=Mm({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield ao(Bd.auth.getIPRestrictions,n);yield no(ai.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Fm(){try{const{valid:e}=yield ao(Bd.auth.testCurrentIpInAllowList);yield no(ai.setIpRestrictionsState({userIpValid:e}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message}))}}function*$m({payload:{callback:e}}){yield no(ai.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield lo((e=>e.auth.userIp));yield io([ao(Bd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Nn.ALLOW}),ao(Bd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Om(),i=Mm(n.pagination),{items:o,_metadata:{totalPages:a}}=yield ao(Bd.auth.getIPRestrictions,i);yield no(ai.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Nn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Gm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Tm);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const i=yield Om();try{var o,a;yield ao(Bd.auth.createIPRestriction,n);const e=yield Om(),r=Mm(e.pagination),{items:s,_metadata:{totalPages:l}}=yield ao(Bd.auth.getIPRestrictions,r);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Nn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xm(e){let{payload:{callback:t}}=e,n=vi(e.payload,_m);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));try{yield ao(Bd.auth.updateIPRestrictionConfig,n);const e=yield Om(),i=yield ao(Bd.auth.getIPRestrictionsConfig),o=Mm(E({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield ao(Bd.auth.getIPRestrictions,o);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Vm({payload:{id:e,callback:t}}){yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const n=yield Om();try{var i;yield ao(Bd.auth.deleteIPRestriction,e);const o=yield Om(),a=Mm(o.pagination),{items:r,_metadata:{totalPages:s}}=yield ao(Bd.auth.getIPRestrictions,a);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Nn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hm(){yield ia(ai.loadIpRestrictions,Nm),yield ia(ai.loadEmailDomainRestrictions,Rm),yield ta(ai.saveIpRestriction,Gm),yield ta(ai.saveIpRestrictionsConfig,xm),yield ta(ai.deleteIpRestriction,Vm),yield ta(ai.checkIfUserIpValid,Fm),yield ta(ai.addCurrentUserIpAndActivate,$m),yield ta(ai.saveEmailDomainRestriction,Cm),yield ta(ai.saveEmailDomainRestrictionsConfig,Dm),yield ta(ai.deleteEmailDomainRestriction,Um)}function*Wm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null})),yield no(ai.setIpRestrictionsState({data:{restrictions:Ey.filter((e=>e.strategy===Py.strategy)),config:Py},totalPages:1,pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*jm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Om(),t=Ey[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield no(ai.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Bm(e){var t,n,i;let{payload:{callback:o}}=e,a=vi(e.payload,Pm);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const r=yield Om(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield no(ai.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Nn.ALLOW},restrictions:[...s,E({},a,{createdAt:new Date,updatedAt:new Date,id:qS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Km(e){var t,n,i;let{payload:{callback:o}}=e,a=vi(e.payload,Em);const r=yield Om();yield no(ai.setIpRestrictionsState({saving:!0,error:null})),yield no(ai.setIpRestrictionsState({data:{config:E({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield no(ai.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*qm({payload:{id:e,callback:t}}){var n;yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const i=yield Om();yield no(ai.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Nn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*zm(){yield no(ai.setEmailDomainRestrictionsState({loading:!0,error:null})),yield no(ai.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Nn.ALLOW}],config:{active:!0,listType:Nn.ALLOW,blockPublicDomains:!1}}}))}function*Xm(e){var t,n;let{payload:{callback:i}}=e,o=vi(e.payload,Im);const a=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==i||i(!0),yield no(ai.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)||[],E({},o,{id:Date.now().toString()})]},saving:!1}))}function*Jm(e){var t;let{payload:{callback:n}}=e,i=vi(e.payload,Lm);const o=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==n||n(!0),yield no(ai.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Nn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Ym({payload:{id:e}}){var t,n;const i=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),yield no(ai.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Nn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Qm(){yield ia(ai.loadIpRestrictions,Wm),yield ia(ai.loadEmailDomainRestrictions,zm),yield ta(ai.saveIpRestriction,Bm),yield ta(ai.saveIpRestrictionsConfig,Km),yield ta(ai.deleteIpRestriction,qm),yield ta(ai.checkIfUserIpValid,jm),yield ta(ai.saveEmailDomainRestriction,Xm),yield ta(ai.saveEmailDomainRestrictionsConfig,Jm),yield ta(ai.deleteEmailDomainRestriction,Ym)}const Zm=["callback"],eb=["id"];function*tb(e){const{count:t}=yield ao(Bd.directory.countConfigurationUsers,e.id);return E({},e,{count:t})}function*nb(){yield no(ai.setProvisioningState({loading:!0,error:null}));try{const e=yield ao(Bd.directory.getConfigs),t=yield io(e.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:t,loading:!1}))}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ib(e){let{payload:{callback:t}}=e,n=vi(e.payload,Zm);yield no(ai.setProvisioningState({loading:!0,error:null}));try{const e=yield ao(Bd.directory.createConfiguration,n),i=yield ao(Bd.directory.getConfigs),o=yield io(i.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ob(e){let{payload:{id:t}}=e,n=vi(e.payload,eb);yield no(ai.setProvisioningState({loading:!0,error:null}));try{yield ao(Bd.directory.updateConfiguration,t,n);const e=yield ao(Bd.directory.getConfigs),i=yield io(e.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:i,loading:!1}))}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ab({payload:{id:e,callback:t}}){yield no(ai.setProvisioningState({loading:!0,error:null}));try{yield ao(Bd.directory.deleteConfiguration,e);const n=yield ao(Bd.directory.getConfigs),i=yield io(n.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*rb(){yield ia(ai.loadProvisionConnections,nb),yield ta(ai.createProvisionConnection,ib),yield ta(ai.deleteProvisionConnection,ab),yield ta(ai.updateProvisionConnection,ob)}const sb=["callback","events"];function*lb(e){let{payload:{callback:t}}=e,n=vi(e.payload,sb);yield no(ai.setImpersonateState({loading:!0}));try{yield ao(Bd.impersonate.impersonate,n),yield no(ai.setImpersonateState({step:Zn.success})),yield co(1e3),yield Bf(),yield no(ai.resetImpersonateState()),null==t||t(!0)}catch(e){yield no(ai.setImpersonateState({loading:!1,error:e.message}))}}function*cb(){yield ia(ai.impersonate,lb)}function*ub({payload:e}){const{callback:t,deviceId:n}=e;yield no(ai.setPasskeysState({loading:!0}));try{yield ao(Bd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield lo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield no(ai.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*db(){yield no(ai.setPasskeysState({loading:!0}));try{const{devices:e}=yield ao(Bd.auth.getWebAuthnDevices);yield no(ai.setPasskeysState({devices:e,loading:!1}))}catch(e){yield no(ai.setPasskeysState({loading:!1,error:e.message||null}))}}function*yb(){yield ta(ai.loadWebAuthnDevices,db),yield ta(ai.deleteWebAuthnDevice,ub)}const fb=["roleIds","userIds"],pb=()=>lo((e=>e.auth.groupsState));function*gb({payload:e}){const t=zS.GET_TEAM_USERS;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield ao(Bd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield no(ai.setGroupsState({teamUsers:n}))}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Sb({payload:e}){const t=zS.GET_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield ao(Bd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:XS.rolesAndUsers});yield no(ai.setGroupsState({selectedGroup:n}))}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*hb(){const e=zS.GET_GROUPS,t=yield pb();yield no(ai.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield ao(Bd.groups.getGroups,{_groupsRelations:XS.rolesAndUsers});yield no(ai.setGroupsState(E({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield no(ai.setUsersGroupsError({key:e,value:t.message}))}finally{yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}}function*vb({payload:e}){const t=zS.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=vi(e,fb);yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield ao(Bd.groups.createGroup,E({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield no(ai.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield no(ai.addRolesToGroup({groupId:r.id,roleIds:n}))),yield no(ai.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=zS.UPDATE_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.updateGroup,e),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*bb({payload:e}){const t=zS.DELETE_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteGroup,e.groupId),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Ab({payload:e}){const t=zS.ADD_ROLES_TO_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*kb({payload:e}){const t=zS.DELETE_ROLES_FROM_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb({payload:e}){const t=zS.ADD_USERS_TO_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield no(ai.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 no(ai.setUsersGroupsError({key:t,value:n.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*_b({payload:e}){const t=zS.DELETE_USERS_FROM_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Pb(){const e=zS.GET_GROUP_CONFIGURATION;yield no(ai.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield ao(Bd.groups.getGroupConfiguration);yield no(ai.setGroupsState({groupsConfiguration:t}))}catch(t){yield no(ai.setUsersGroupsError({key:e,value:t.message}))}finally{yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}}function*Eb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{yield ao(Bd.groups.updateGroupConfiguration,e),yield no(ai.getGroupConfiguration())}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Ib(){yield na(ai.loadGroups,hb),yield na(ai.getGroupById,Sb),yield na(ai.createGroup,vb),yield na(ai.updateGroup,mb),yield na(ai.deleteGroup,bb),yield na(ai.addRolesToGroup,Ab),yield na(ai.deleteRolesFromGroup,kb),yield na(ai.addUsersToGroup,Tb),yield na(ai.deleteUsersFromGroup,_b),yield na(ai.getGroupConfiguration,Pb),yield na(ai.updateGroupConfiguration,Eb),yield na(ai.getTeamUsers,gb)}function*Lb(){const e=zS.GET_GROUPS;yield no(ai.setUsersGroupsLoader({key:e,value:!0}));const t=Oy;yield no(ai.setGroupsState({groups:t})),yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}function*Ob({payload:e}){var t;const n=zS.CREATE_GROUP,{groups:i}=yield pb();yield no(ai.setUsersGroupsLoader({key:n,value:!0})),yield no(ai.setGroupsState({groups:[E({},e,{id:`${e.name}ID`,managedBy:jd.FRONTEGG}),...null!=i?i:[]]})),yield co(500),null==e||null==(t=e.callback)||t.call(e,!0),yield no(ai.setUsersGroupsLoader({key:n,value:!1}))}function*wb({payload:e}){var t,n,i,o,a;const r=zS.UPDATE_GROUP,s=yield pb();yield no(ai.setUsersGroupsLoader({key:r,value:!0})),yield no(ai.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:jd.FRONTEGG}):t})),selectedGroup:E({},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 co(500),null==e||null==(a=e.callback)||a.call(e,!0),yield no(ai.setUsersGroupsLoader({key:r,value:!1}))}function*Rb({payload:e}){var t,n;const i=zS.DELETE_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Cb({payload:e}){var t,n;const i=zS.ADD_ROLES_TO_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Db({payload:e}){var t,n;const i=zS.DELETE_ROLES_FROM_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Ub({payload:e}){var t,n;const i=zS.ADD_USERS_TO_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Mb({payload:e}){var t,n;const i=zS.DELETE_USERS_FROM_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Nb(){const e=zS.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield pb();yield no(ai.setUsersGroupsLoader({key:e,value:!0})),t&&(yield no(ai.setGroupsState({groupsConfiguration:E({},t)}))),yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}function*Fb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield pb();yield no(ai.setUsersGroupsLoader({key:t,value:!0})),n&&(yield no(ai.setGroupsState({groupsConfiguration:E({},n,e)}))),yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}function*$b(){yield na(ai.loadGroups,Lb),yield na(ai.createGroup,Ob),yield na(ai.updateGroup,wb),yield na(ai.deleteGroup,Rb),yield na(ai.addRolesToGroup,Cb),yield na(ai.deleteRolesFromGroup,Db),yield na(ai.addUsersToGroup,Ub),yield na(ai.deleteUsersFromGroup,Mb),yield na(ai.getGroupConfiguration,Nb),yield na(ai.updateGroupConfiguration,Fb)}var Gb={sagas:function*(){yield io([ao(Vp),ao(FS),ao(GS),ao(LS),ao(nm),ao(ig),ao(Rg),ao(Fg),ao(pS),ao(Vh),ao(Ib),ao(sv),ao(Fy),ao(Sv),ao(yf),ao(Pv),ao(Dv),ao(qv),ao(lm),ao(hm),ao(Hm),ao(rb),ao(cb),ao(yb)])},mockSagas:function*(){yield io([ao(jp),ao(ug),ao(Vg),ao(TS),ao(ev),ao(kv),ao(Pf),ao(ym),ao(Lv),ao(Mv),ao(bm),ao(Qm),ao(Xv),ao($b)])},storeName:Pt,initialState:Qn,reducer:ii,actions:ai};const xb=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),Vb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Hb={setAuditLogsState:xb("auditLogsState"),resetAuditLogsState:e=>E({},e,{auditLogsState:Vb})},Wb={exportAuditsCsv:ot("auditLogs/exportAuditsCsv"),loadAuditLogs:ot("auditLogs/loadAuditLogs",(e=>({payload:e})))},jb={loading:!0},Bb={setAuditsMetadataState:xb("auditsMetadataState"),resetAuditsMetadataState:e=>E({},e,{auditsMetadataState:jb})},Kb={loadAuditsMetadata:ot("auditLogs/loadAuditsMetadata")},qb={auditLogsState:Vb,auditsMetadataState:jb},{reducer:zb,actions:Xb}=rt({name:It,initialState:qb,reducers:E({resetState:e=>E({},e,qb),setState:(e,{payload:t})=>E({},e,t)},Hb,Bb)}),Jb=E({},Xb,Wb,Kb),Yb=e=>"createdAt"!==e.id,Qb={total:20,data:Array.from(Array(5).keys()).map((e=>E({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`})))},Zb={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}]},eA=()=>lo((e=>e.auditLogs.auditLogsState)),tA=()=>lo((e=>e.auditLogs.auditsMetadataState));function*nA(){const e=yield eA(),{columns:t}=yield tA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});yield no(Jb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Bd.audits.exportAudits(E({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield no(Jb.setAuditLogsState({isDownloadingCsv:!1}))}function*iA({payload:e}){yield no(Jb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eA(),{columns:n}=yield tA();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 no(Jb.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});n||(yield no(Jb.loadAuditsMetadata()));const{data:p,total:g}=yield ao(Bd.audits.getAudits,E({offset:c,count:l},y,f));yield no(Jb.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 no(Jb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*oA(){yield ta(Jb.exportAuditsCsv,nA),yield ta(Jb.loadAuditLogs,iA)}function*aA({payload:e}){yield no(Jb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eA(),{columns:n}=yield tA();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 no(Jb.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield no(Jb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Qb;let i=n.filter((e=>t=>e.filter(Yb).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 no(Jb.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 no(Jb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*rA(){yield ta(Jb.loadAuditLogs,aA)}function*sA(){yield no(Jb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield ao(Bd.metadata.getAuditsMetadata);yield no(Jb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield no(Jb.setAuditsMetadataState({error:e,loading:!1}))}}function*lA(){yield ta(Jb.loadAuditsMetadata,sA)}function*cA(){yield no(Jb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Zb;yield no(Jb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield no(Jb.setAuditsMetadataState({error:e,loading:!1}))}}function*uA(){yield ta(Jb.loadAuditsMetadata,cA)}var dA={sagas:function*(){yield io([ao(oA),ao(lA)])},mockSagas:function*(){yield io([ao(rA),ao(uA)])},storeName:It,initialState:qb,reducer:zb,actions:Jb};const yA={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:fA,actions:pA,reducer:gA}=rt({name:"audits",initialState:yA,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=E({},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]})))}}}),SA=E({},pA,{initData:ot(`${fA}/initData`),loadAudits:ot(`${fA}/loadAudits`),removeFilter:ot(`${fA}/removeFilter`),filterData:ot(`${fA}/filterData`),exportCSV:ot(`${fA}/exportCSV`),deleteAudits:ot(`${fA}/deleteAudits`)}),hA=()=>lo((e=>e[fA]));function*vA(){const{sortBy:e,sortDirection:t}=yield hA();try{const n=yield ao(Bd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield no(SA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield no(SA.loadItemFailedAction(t))}}function*mA(){try{const e=yield ao(Bd.metadata.getAuditsMetadata);yield no(SA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield no(SA.loadItemFailedAction(t))}}const bA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*AA({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield hA(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield hA():{rowsData:[]};try{const e=bA(t),{data:s,total:d}=yield ao(Bd.audits.getAudits,E({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield no(SA.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield no(SA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield no(SA.loadItemFailedAction(t))}}function*kA(){yield no(SA.startLoading()),yield io([vA(),mA(),AA({payload:{onlyOneLoad:!1},type:""})]),yield no(SA.finishLoading())}function*TA({payload:e}){const{filters:t}=yield hA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield no(SA.setFilterData(i))}function*_A({payload:e}){const{filters:t}=yield hA();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 no(SA.setFilterData(i))}function*PA(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield hA(),a=bA(e);yield no(SA.startDownloadingCsv());try{yield Bd.audits.exportAudits(E({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 no(SA.stopDownloadingCsv())}}function*EA(){yield na(SA.initData,kA),yield na(SA.removeFilter,TA),yield na(SA.filterData,_A),yield na([SA.loadAudits,SA.textSearch,SA.onPageChange],AA),yield na([SA.setFilterData,SA.setDataSorting,SA.startRefresh],(()=>AA({payload:{appendMode:!1},type:""}))),yield na(SA.exportCSV,PA)}const IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LA={initData:()=>E({},IA),setConnectivityState:(e,{payload:t})=>E({},e,t),cleanWebhookTestData:e=>E({},e,{testResult:void 0}),cleanWebhookLogsData:e=>E({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return E({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>E({},e,{error:void 0}),cleanSlackData:e=>E({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,t)})}},OA={loadSlackActions:ot("connectivity/loadSlackActions"),loadDataAction:ot("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ot("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ot("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ot("connectivity/loadScope"),deleteWebhookConfigAction:ot("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ot("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ot("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},wA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:RA,actions:CA}=rt({name:Et,initialState:wA,reducers:E({},LA)}),DA=E({},CA,OA),UA={slack:Bd.connectivity.getSlackConfiguration,email:Bd.connectivity.getEmailConfiguration,sms:Bd.connectivity.getSMSConfiguration,webhook:Bd.connectivity.getWebhooksConfigurations,categories:Bd.connectivity.getCategories,channelMap:Bd.connectivity.getChannelMaps},MA={slack:Bd.connectivity.postSlackConfiguration,email:Bd.connectivity.postEmailConfiguration,sms:Bd.connectivity.postSMSConfiguration,webhook:Bd.connectivity.postWebhooksConfiguration},NA=["email","slack","sms","webhook"],FA={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"}},$A=["id"],GA=["id","enabled"],xA=["categories","channelMap"];function*VA(e){return yield ao(WA,{payload:{api:e},type:""})}function*HA({payload:e=NA}){yield no(DA.setConnectivityState({isLoading:!0}));try{const t=yield io([...e.map(VA),yield WA({payload:{api:"categories"},type:""}),yield function*(){return(yield io(e.map((function*(e){return yield WA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>E({},t,{[`${e[i]}`]:n})),{})}()]),n=yield WA({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?E({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:FA[e[o]].events(i),active:FA[e[o]].isActive(i),platform:FA[e[o]].title,image:FA[e[o]].image}]}):n:E({},n,{[`${xA[o-e.length]}`]:i})),{list:[],webhook:n});yield no(DA.setConnectivityState(E({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield no(DA.setConnectivityState({isLoading:!1}))}}function*WA({payload:{api:e,params:t}}){try{return yield ao(UA[e],t)}catch(e){return}}function*jA(){try{yield no(DA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield ao(Bd.connectivity.getSlackChannels);yield no(DA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield no(DA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*BA(e,t){const{connectivity:{list:n}}=yield lo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=FA[e].isActive(t);o!==i.active&&(yield no(DA.setConnectivityState({list:n.map((t=>t.key===e?E({},t,{active:o}):t))})))}function*KA({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield lo((e=>e.connectivity));try{if(yield no(DA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield lo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield io([...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=vi(e,$A);return n===t.id&&JSON.stringify(E({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield ao(MA.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield ao(Bd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield lo(),{processIds:i}=yield lo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield io([...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 ao("email"===t?Bd.connectivity.postEmailConfiguration:Bd.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=vi(o,GA);return yield io([yield ao("email"===t?Bd.connectivity.patchEmailConfiguration:Bd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield ao("email"===t?Bd.connectivity.putEmailSubscriptions:Bd.connectivity.putSMSSubscriptions,a,i,E({},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 ao("email"===t?Bd.connectivity.deleteEmailSubscriptions:Bd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield WA({payload:{api:t},type:""});yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield BA(t,e)}else yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield ao(MA[e],t),!["sms","email"].includes(e)){const o=yield WA({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield BA(e,o),null==n||n(!0)}}catch(e){var o;yield no(DA.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*qA({payload:e}){try{yield Bd.connectivity.postSlackCode(e)}catch{}yield no(DA.setConnectivityState({error:void 0,isSaving:!1}))}function*zA(){const{slackChannels:e}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({slackChannels:E({},e,{isLoadingScope:!0})}));const{clientId:t}=yield ao(Bd.connectivity.getSlackScope);yield no(DA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield no(DA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*XA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({isSaving:!0})),yield ao(Bd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield WA({payload:{api:"webhook"},type:""});o&&(yield no(DA.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*JA({payload:e}){try{yield no(DA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield ao(Bd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*YA({payload:e}){try{const{statusCode:t}=yield ao(Bd.connectivity.postWebhookRetry,e);yield no(DA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield no(DA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*QA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({webhookLogs:E({},i,{isLoading:!0})}));const o=yield ao(Bd.connectivity.getWebhookLog,e,n,t);yield no(DA.setConnectivityState({error:void 0,webhookLogs:E({isLoading:!1},o)}))}catch(e){yield no(DA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var ZA={sagas:function*(){yield ta(DA.loadDataAction,HA),yield na(DA.loadSlackActions,jA),yield ta(DA.postDataAction,KA),yield ta(DA.postCodeAction,qA),yield ta(DA.loadScope,zA),yield ta(DA.deleteWebhookConfigAction,XA),yield ta(DA.postWebhookTestAction,JA),yield ta(DA.postWebhookRetryAction,YA),yield na(DA.loadWebhookLogsAction,QA)},storeName:Et,initialState:wA,reducer:RA,actions:DA};function ek(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}}function tk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>E({},n,{[e]:t(n[e],i)})}}function nk(e){return tk(e,((e,t)=>E({},e,{loading:t.payload})))}function ik(e){return tk(e,((e,t)=>E({},e,{error:t.payload,loading:!1})))}const ok={loading:!1,error:null,fetching:!0,plans:[]},{actions:ak,reducer:rk,name:sk}=rt({name:"subscriptions/plans",initialState:ok,reducers:E({},ek())}),lk=E({loadPlans:ot(`${sk}/loadPlans`)},ak),ck={loading:!1,error:null,fetching:!0,config:null},uk=E({},ek()),{actions:dk,reducer:yk,name:fk}=rt({name:"subscriptions/config",initialState:ck,reducers:uk}),pk=E({loadPaymentConfiguration:ot(`${fk}/loadPaymentConfiguration`)},dk),gk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Sk=E({},ek(),{setCancellationLoading:nk("cancellation"),setCancellationError:ik("cancellation"),setRenewalLoading:nk("renewal"),setRenewalError:ik("renewal")}),{reducer:hk,actions:vk,name:mk}=rt({name:"subscriptions/billing/subscription",initialState:gk,reducers:Sk}),bk=E({load:ot(`${mk}/loadSubscription`),cancelSubscription:ot(`${mk}/cancelSubscription`),renewSubscription:ot(`${mk}/renewSubscription`)},vk),Ak={loading:!1,error:null,fetching:!0},kk=E({},ek()),{reducer:Tk,actions:_k,name:Pk}=rt({name:"subscriptions/billing/information",initialState:Ak,reducers:kk}),Ek=E({loadBillingInformation:ot(`${Pk}/loadBillingInformation`),cancelSubscription:bk.cancelSubscription,renewSubscription:bk.renewSubscription},_k),Ik={loading:!1,error:null,fetching:!0},Lk=E({},ek(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}),{reducer:Ok,actions:wk,name:Rk}=rt({name:"subscriptions/billing/payment",initialState:Ik,reducers:Lk}),Ck=E({loadPaymentMethod:ot(`${Rk}/loadPaymentMethod`),submitPaymentMethod:ot(`${Rk}/submitPaymentMethod`),submitPaymentMethodError:ot(`${Rk}/submitPaymentMethodError`),submitPaymentMethodSuccess:ot(`${Rk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ot(`${Rk}/updateBillingDetails`,(e=>({payload:e})))},wk),Dk={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Uk=E({},ek(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{invoiceDownload:E({},e.invoiceDownload,t.payload)})}}),{reducer:Mk,actions:Nk,name:Fk}=rt({name:"subscriptions/billing/invoices",initialState:Dk,reducers:Uk}),$k=E({loadInvoices:ot(`${Fk}/loadInvoices`),downloadInvoice:ot(`${Fk}/downloadInvoice`,(e=>({payload:e})))},Nk),Gk={information:Ak,invoices:Dk,paymentMethod:Ik,subscription:gk},xk={invoices:$k,information:Ek,paymentMethod:Ck,subscription:bk},Vk=$e({invoices:Mk,information:Tk,paymentMethod:Ok,subscription:hk}),Hk={fetching:!0,loading:!1,error:null,confirmed:!1},Wk=E({},ek()),{actions:jk,reducer:Bk,name:Kk}=rt({name:"subscriptions/checkout",initialState:Hk,reducers:Wk}),qk=E({loadCheckout:ot(`${Kk}/loadCheckout`),resetCheckout:ot(`${Kk}/resetCheckout`),submitCheckout:ot(`${Kk}/submitCheckout`),confirmCheckout:ot(`${Kk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ot(`${Kk}/errorCheckout`,(e=>({payload:e})))},jk),zk={loading:!1,error:null,cardSetupIntentSecret:null},Xk=E({},ek()),{reducer:Jk,actions:Yk,name:Qk}=rt({name:"subscriptions/stripe",initialState:zk,reducers:Xk}),Zk=E({loadCustomer:ot(`${Qk}/loadCustomer`),createCardSetupIntentSecret:ot(`${Qk}/createCardSetupIntentSecret`)},Yk),eT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:tT,reducer:nT,name:iT}=rt({name:"subscriptions/vendorPublicConfig",initialState:eT,reducers:E({},ek())}),oT=E({loadVendorPublicConfiguration:ot(`${iT}/loadVendorPublicConfiguration`)},tT),aT={config:ck,plans:ok,checkout:Hk,billing:Gk,stripe:zk,vendorPublicConfig:eT},rT={config:pk,billing:xk,plans:lk,checkout:qk,stripe:Zk,vendorPublicConfig:oT},sT=$e({config:yk,billing:Vk,plans:rk,checkout:Bk,stripe:Jk,vendorPublicConfig:nT});let lT,cT,uT;function dT({policy:e}){return{policy:uT.AT_PERIOD_END}}function yT(e){switch(e){case Yu.ACTIVE:return cT.ACTIVE;case Yu.INCOMPLETE:return cT.INCOMPLETE;case Yu.CANCELED:return cT.CANCELED;case Yu.EXPIRED:return cT.EXPIRED;case Yu.TRIALING:return cT.TRIALING;default:return cT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(lT||(lT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(cT||(cT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(uT||(uT={}));const fT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Yu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},pT=[{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"}],gT=[{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:""}],ST=[{id:"id",externalId:"externalId",type:Qu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],hT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*vT(){yield ta(bk.load,mT),yield ta(bk.cancelSubscription,AT),yield ta(bk.renewSubscription,kT)}function*mT(){const e=yield lo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IT(e)}function*bT(){yield no(bk.setLoading(!0));try{const[e]=yield ao(Bd.subscriptions.getManagedSubscriptions);yield no(bk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield no(bk.setError(e))}}function*AT(){const{subscription:e}=yield lo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield no(bk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield no(bk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Yu.ACTIVE)try{yield no(bk.setCancellationLoading(!0)),yield ao(Bd.subscriptions.cancelManagedSubscription,t),yield bT(),yield no(bk.setCancellationLoading(!1))}catch(e){yield no(bk.setCancellationError(e.message))}}function*kT(){const{subscription:e}=yield lo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield no(bk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield no(bk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zu.AT_PERIOD_END)try{yield no(bk.setRenewalLoading(!0)),yield ao(Bd.subscriptions.renewManagedSubscription,t),yield bT(),yield no(bk.setRenewalLoading(!1))}catch(e){yield no(bk.setCancellationError(e.message))}}function*TT(){yield no(bk.setLoading(!0)),yield co(500),yield no(bk.setState({subscription:fT,fetching:!1,loading:!1,error:null}))}function*_T(){yield ta(bk.load,TT)}function*PT(){yield ta(Ek.loadBillingInformation,ET)}function*ET(){yield function*(e){const t=yield lo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield lo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield IT(n,!1):yield no(Ek.setError(t?"Not authorized":"Internal feature failure"))}()}function*IT(e,t){yield no(Ek.setLoading(!0));try{var n,i;const o=yield ao(Bd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield ao(Bd.subscriptions.getSubscriptionPlan,a):([,s]=yield io([ao(bT),ao(Bd.subscriptions.getSubscriptionPlan,a)]),l=yield lo((e=>e.subscriptions.billing.subscription.subscription||null))),yield no(Ek.setState(E({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?cT.ACTIVE:yT(l.status),cancellation:l.cancellation&&dT(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 no(Ek.setError(e.message))}}function*LT(){yield function*(){var e,t;yield no(Ek.setLoading(!0)),yield co(500),yield no(Ek.setState({loading:!1,fetching:!1,summary:{subscriptionId:fT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ed.Stripe,externallyManaged:!1,currentPlanId:pT[0].id,defaultPlanId:pT[0].id},plan:E({},pT[0],{price:null==(e=pT[0].price)?void 0:e.amount,currency:null==(t=pT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*OT(){yield ta(Ek.loadBillingInformation,LT)}function*wT(){yield ta(Ck.loadPaymentMethod,RT),yield ta(Ck.submitPaymentMethod,DT),yield ta(Ck.submitPaymentMethodError,UT),yield ta(Ck.submitPaymentMethodSuccess,MT),yield ta(Ck.updatePaymentMethodBillingDetails,CT)}function*RT(){yield no(Ck.setLoading(!0));try{const e=(yield ao(Bd.subscriptions.getPaymentMethods))[0];yield no(Ck.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield no(Ck.setError(e.message))}}function*CT({payload:e}){yield no(Ck.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield ao(Bd.subscriptions.updatePaymentMethodBillingDetails,t,E({email:n},i)),yield ao(RT),null==o||o(!0)}catch(e){yield no(Ck.setError(e.message)),null==o||o(!1)}yield no(Ck.setLoading(!1))}function*DT(){yield no(Ck.setLoading(!0))}function*UT({payload:e}){yield no(Ck.setError(e))}function*MT(){yield no(Ck.loadPaymentMethod())}function*NT(){yield no(Ck.setLoading(!0)),yield co(500);const e=ST[0];yield no(Ck.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*FT(){yield ta(Ck.loadPaymentMethod,NT)}function*$T(){yield ta($k.loadInvoices,GT),yield ta($k.downloadInvoice,xT)}function*GT(){yield no($k.setLoading(!0));try{const e=(yield ao(Bd.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 no($k.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield no($k.setError(e.message))}}function*xT({payload:e}){yield no($k.setInvoiceDownloadState({loading:!0,error:null}));try{yield ao(Bd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield no($k.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield no($k.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*VT(){yield no($k.setLoading(!0)),yield co(500),yield no($k.setState({loading:!1,fetching:!1,invoices:gT.map((e=>E({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield no($k.setLoading(!1))}function*HT(){yield ta($k.loadInvoices,VT)}function*WT(){yield io([ao(PT),ao(wT),ao($T),ao(vT)])}function*jT(){yield io([ao(OT),ao(FT),ao(HT),ao(_T)])}function*BT(){yield ta(qk.loadCheckout,KT),yield ta(qk.resetCheckout,qT),yield ta(qk.submitCheckout,zT),yield ta(qk.confirmCheckout,XT),yield ta(qk.errorCheckout,YT)}function*KT(){yield no(qk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*qT(){yield no(qk.setState({loading:!1,error:null,confirmed:!1}))}function*zT(){yield no(qk.setState({loading:!0,error:null}))}function*XT({payload:{paymentMethodId:e,planId:t}}){const n=yield lo((e=>e.subscriptions.billing.subscription.subscription)),i=yield lo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Yu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield no(qk.setState({loading:!0,error:null})),o&&a)return yield JT(),void(yield no(bk.setState({subscription:E({},n,{status:Yu.ACTIVE})})));try{yield ao(Bd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield io([ET(),RT(),GT()]),yield JT()}catch(e){yield no(qk.setState({loading:!1,error:e.message}))}}else yield no(qk.setState({loading:!1,error:"Subscription not found"}))}function*JT(){yield no(qk.setState({loading:!1,error:null,confirmed:!0}))}function*YT({payload:e}){yield no(qk.setState({loading:!1,error:e}))}function*QT(){yield ta(qk.resetCheckout,qT)}function*ZT(){yield ta(lk.loadPlans,e_)}function*e_(){yield no(lk.setLoading(!0));try{const e=(yield ao(Bd.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 no(lk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield no(lk.setError(e.message))}}function*t_(){yield no(lk.setLoading(!0)),yield co(500),yield no(lk.setState({fetching:!1,loading:!1,plans:pT.map((e=>{var t,n;return E({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*n_(){yield ta(lk.loadPlans,t_)}function*i_(){yield ta(pk.loadPaymentConfiguration,o_)}function*o_(){yield no(pk.setLoading(!0));try{(yield ao(Bd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ed.Stripe))?yield function*(){yield no(pk.setLoading(!0));try{const e=yield ao(Bd.subscriptions.getStripePaymentProviderConfiguration);yield no(pk.setState({loading:!1,fetching:!1,config:{paymentProvider:lT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield no(pk.setError(e.message))}}():yield no(pk.setError("Payment provider not configured"))}catch(e){yield no(pk.setError(e.message))}}function*a_(){yield no(pk.setLoading(!0)),yield co(500),yield no(pk.setState({loading:!1,fetching:!1,config:{paymentProvider:lT.STRIPE,apiKey:""}}))}function*r_(){yield ta(pk.loadPaymentConfiguration,a_)}function*s_(){yield ta(Zk.createCardSetupIntentSecret,l_)}function*l_({payload:e}){yield no(Zk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield ao(Bd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield no(Zk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield no(Zk.setError(e.message))}}function*c_(){yield ta(oT.loadVendorPublicConfiguration,u_)}function*u_(){yield no(oT.setLoading(!0));try{const e=yield ao(Bd.subscriptions.getVendorPublicConfigurations);yield no(oT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield no(oT.setError(e.message))}}function*d_(){yield no(oT.setLoading(!0)),yield co(500),yield no(oT.setState({fetching:!1,loading:!1,vendorPublicConfig:hT}))}function*y_(){yield ta(oT.loadVendorPublicConfiguration,d_)}var f_={sagas:function*(){yield io([ao(WT),ao(BT),ao(ZT),ao(i_),ao(s_),ao(c_)])},mockSagas:function*(){yield io([ao(jT),ao(QT),ao(n_),ao(r_),ao(y_)])},reducer:sT,actions:rT,initialState:aT,storeName:"subscriptions"},p_={sagas:function*(){yield ta(Wy.loadVendorPublicInfo,jy)},storeName:Lt,initialState:xy,reducer:Vy,actions:Wy};const{reducer:g_}=rt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(oa.setContext(t),E({},e,{context:t}))}}}),S_=(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,h;n||a||oa.setContext(e.context);const t=Ko(),v=[...nt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=it({middleware:v,preloadedState:{root:E({},e,{previewMode:n,urlStrategy:r}),[Gb.storeName]:E({},Gb.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:E({},Gb.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[dA.storeName]:E({},dA.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:E({},dA.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:E({},dA.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[fA]:E({},yA,null!=(h=null==o?void 0:o.audits)?h:{}),[ZA.storeName]:ZA.initialState,[f_.storeName]:f_.initialState,[p_.storeName]:p_.initialState},reducer:$e({root:g_,[Gb.storeName]:Gb.reducer,[dA.storeName]:dA.reducer,[fA]:gA,[ZA.storeName]:ZA.reducer,[f_.storeName]:f_.reducer,[p_.storeName]:p_.reducer})});const m=function*(){yield io([ao(Gb.sagas),ao(dA.sagas),ao(EA),ao(ZA.sagas),ao(f_.sagas),ao(p_.sagas)])},b=function*(){yield io([ao(Gb.mockSagas),ao(dA.mockSagas),ao(f_.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(ai.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var h_=__webpack_require__(714),v_=__webpack_require__.n(h_);function m_(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function b_(e){if(e.type)return e;if("#"===e.charAt(0))return b_(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 A_(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 k_(e){if(0===e.indexOf("#"))return e;const{values:t}=b_(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 T_(e,t){return e=b_(e),t=m_(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,A_(e)}function __(e,t){if(e=b_(e),t=m_(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 A_(e)}function P_(e,t){if(e=b_(e),t=m_(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 A_(e)}const E_=e=>{if(e)return{main:e,light:k_(P_(e,.4)),dark:k_(__(e,.15)),hover:k_(__(e,.15)),active:k_(__(e,.2))}},I_=e=>{if(e)return{main:e,light:P_(e,.7),dark:__(e,.2)}},L_=(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)?E({},t,{palette:{primary:E({},E_(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:E({},E_(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:E({},E_(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:E({},I_(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:E({},I_(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:E({},I_(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:E({},I_(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},O_={},w_={},R_={},C_={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class D_{constructor(){this._theme=O_,this._themeV2=w_,this._navigation=C_,this._localizations=R_}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new D_;return n.set(e),D_._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=v_().all([null!=(t=C_)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=v_().all([null!=(i=O_)?i:{},L_(null==e?void 0:e.theme,O_)]),this._themeV2=v_().all([null!=(o=w_)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=v_().all([null!=(r=R_)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=C_,this._theme=O_,this._themeV2=w_,this._localizations=R_}}}D_._instances={};var U_=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},M_=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},N_=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 F_,$_,G_,x_,V_,H_,W_,j_,B_,K_,q_;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(F_||(F_={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}($_||($_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(G_||(G_={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(x_||(x_={})),function(e){e.Invoices="invoices"}(V_||(V_={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(H_||(H_={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(W_||(W_={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(j_||(j_={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(B_||(B_={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(K_||(K_={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(q_||(q_={}));const z_={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},X_={hidden:"hidden",edit:"edit"};var J_="6.87.0",Y_={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"},Q_=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];b(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(J_),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=L(w().mark((function e(){var t,n,i,a,r;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ca,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:D_.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=L(w().mark((function e(){return w().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=L(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}dd.set(Y_,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,yd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),dd.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=U_(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=E({},t,{contextOptions:E({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?E({},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=S_({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);P.setInstance(s,this)}var t,n,i,o;return _(e,[{key:"initContainers",value:(o=L(w().mark((function e(t){return w().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;D_.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:v,FronteggTypes:m})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=L(w().mark((function e(){return w().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=L(w().mark((function e(){var t;return w().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=L(w().mark((function e(t){var n;return w().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,E({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}(),Z_=function(){function e(){b(this,e)}return _(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(oa.setAccessToken(t),oa.setUser(E({},n,{accessToken:t})),o.store.dispatch(ai.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ai.loadTenants())):(oa.setAccessToken(null),oa.setUser(null),o.store.dispatch(ai.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),eP=function(){function e(){b(this,e)}return _(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),tP=function(){function e(){b(this,e)}return _(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),nP=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},iP=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];b(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=S_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new Q_(this.options,t,!0),D_.set({},t)}var t;return _(e,[{key:"render",value:(t=L(w().mark((function e(t){var n,i,o,a,r=this;return w().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,N_(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}(),oP="modern",aP=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[oP]},rP=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];b(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=S_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new Q_(this.options,t,!0,a),D_.set({},t)}var t;return _(e,[{key:"render",value:(t=L(w().mark((function e(t){var n,i,o,a,r=this;return w().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,N_(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 sP(e,t){return sP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sP(e,t)}function lP(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&&sP(e,t)}function cP(e,t){if(t&&("object"===A(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 uP(e){return uP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uP(e)}function dP(){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 yP(e,t,n){return yP=dP()?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&&sP(o,n.prototype),o},yP.apply(null,arguments)}function fP(e){var t="function"==typeof Map?new Map:void 0;return fP=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 yP(e,arguments,uP(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),sP(n,e)},fP(e)}function pP(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=uP(e);if(t){var o=uP(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return cP(this,n)}}var gP=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new Q_(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){lP(n,e);var t=pP(n);function n(){var e;b(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 _(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=M_(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=M_(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=M_(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=M_(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=M_(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=M_(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}(fP(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}}(),__webpack_exports__}()}));
|