@frontegg/js 6.100.0 → 6.101.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var g={};function p(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=p.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function P(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===g)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===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;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,g):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=w,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),g}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return eL},AdminPortalRenderer:function(){return iL},AppHolder:function(){return w},CheckoutDialog:function(){return tL},FronteggApp:function(){return XI},HostedLogin:function(){return ZI},LoginBoxRenderer:function(){return rL},createElement:function(){return MI},defaultTheme:function(){return oL},formatName:function(){return _I},getThemeAdminByName:function(){return nL},getThemeByName:function(){return aL},initialize:function(){return pL},mockFlagsList:function(){return QI},waitThemeSetter:function(){return NI}});var e={};n.r(e),n.d(e,{Delete:function(){return La},Get:function(){return ka},Patch:function(){return Pa},Post:function(){return Ta},PostDownload:function(){return Ea},Put:function(){return Ia},extractHeadersFromOptions:function(){return Oa},getBaseUrl:function(){return ma},getMetadataHeaders:function(){return ba}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return gr},getSubTenants:function(){return yr},getSubTenantsAsTree:function(){return fr},getTenants:function(){return dr},getTenantsUsersCount:function(){return pr},switchTenant:function(){return ur}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return jr},MachineToMachineAuthStrategy:function(){return Wr},OAuthLogout:function(){return fs},SocialLoginProviders:function(){return Vr},acceptInvitation:function(){return cs},activateAccount:function(){return as},bulkCreateIPRestriction:function(){return Nr},changePhoneNumber:function(){return nc},changePhoneNumberWithVerification:function(){return ec},checkIfAllowToRememberMfaDevice:function(){return wl},createDomainRestriction:function(){return Cr},createIPRestriction:function(){return Mr},createOrUpdateSessionConfigrations:function(){return fl},createSSOConfiguration:function(){return _l},createSSOConfigurationByMetadata:function(){return Fl},createSSODomain:function(){return Gl},createSSOGroup:function(){return Bl},createSamlGroup:function(){return Xs},createTenantAccessToken:function(){return Al},createUserAccessToken:function(){return bl},deleteAllSessionsForUser:function(){return pl},deleteDomainRestriction:function(){return Rr},deleteIPRestriction:function(){return $r},deleteSSOConfiguration:function(){return Nl},deleteSSODomain:function(){return xl},deleteSSOGroup:function(){return zl},deleteSamlGroup:function(){return el},deleteSessionForUser:function(){return gl},deleteTenantAccessToken:function(){return hl},deleteTenantApiToken:function(){return Ll},deleteUserAccessToken:function(){return ml},deleteUserApiToken:function(){return El},deleteWebAuthnDevice:function(){return sc},disableMFAAuthenticatorApp:function(){return Es},disableMFASMS:function(){return ws},disableMFAWebAuthn:function(){return Ds},disableMfa:function(){return Ls},enrollMFAAuthenticatorApp:function(){return bs},enrollMFAAuthenticatorAppForLogin:function(){return _s},enrollMFASMS:function(){return ks},enrollMFASMSForLogin:function(){return Fs},enrollMFAWebAuthn:function(){return Ps},enrollMFAWebAuthnForLogin:function(){return Vs},enrollMfa:function(){return hs},exchangeOAuthTokens:function(){return Yl},forgotPassword:function(){return gs},generateLoginResponse:function(){return Yr},generateLoginResponseFromOAuthResponse:function(){return Xr},generateLoginResponseV2:function(){return Qr},getActivateAccountStrategy:function(){return rs},getCaptchaPolicy:function(){return Tr},getCurrentUserSession:function(){return ul},getCurrentUserSessions:function(){return cl},getCustomSocialLoginProvidersV1:function(){return al},getDomainRestrictions:function(){return Or},getDomainRestrictionsConfig:function(){return wr},getGlobalSecurityPolicy:function(){return Sr},getIPRestrictions:function(){return Ur},getIPRestrictionsConfig:function(){return _r},getLockoutPolicy:function(){return br},getMFADevices:function(){return Rs},getMFAStrategiesConfig:function(){return uc},getMfaPolicy:function(){return vr},getOidcConfiguration:function(){return tl},getPasswordConfigPolicy:function(){return Er},getPasswordHistoryPolicy:function(){return Pr},getSSOConfigurations:function(){return Ul},getSSODefaultRoles:function(){return jl},getSSOGroups:function(){return ql},getSSOPublicConfiguration:function(){return nl},getSamlConfiguration:function(){return Bs},getSamlRoles:function(){return Js},getSamlRolesGroups:function(){return Ys},getSamlVendorConfiguration:function(){return zs},getSessionConfigurations:function(){return yl},getSocialLoginProviders:function(){return il},getSocialLoginProvidersV2:function(){return ol},getTenantAccessTokensData:function(){return vl},getTenantApiTokensData:function(){return Tl},getUserAccessTokensData:function(){return Sl},getUserApiTokensData:function(){return kl},getUserById:function(){return Ol},getVendorConfig:function(){return sl},getVendorLockoutPolicy:function(){return Ar},getVendorMfaPolicy:function(){return hr},getVendorPasswordHistoryPolicy:function(){return Ir},getVendorPublicAuthStrategiesConfig:function(){return cc},getWebAuthnDevices:function(){return rc},loadPasswordConfig:function(){return Ss},login:function(){return is},loginViaSocialLogin:function(){return rl},loginWithMfa:function(){return os},logout:function(){return ys},oidcPostLogin:function(){return ns},oidcPostLoginV2:function(){return Jl},passwordlessPostLogin:function(){return Dl},passwordlessPreLogin:function(){return Cl},postLogin:function(){return ts},preDisableMFASMS:function(){return Os},preDisableMFAWebAuthn:function(){return Cs},preEnrollMFAAuthenticatorApp:function(){return ms},preEnrollMFAAuthenticatorAppForLogin:function(){return Us},preEnrollMFASMS:function(){return As},preEnrollMFASMSForLogin:function(){return Ns},preEnrollMFAWebAuthn:function(){return Ts},preEnrollMFAWebAuthnForLogin:function(){return xs},preLogin:function(){return Zr},preLoginV2:function(){return Hl},preLoginWithIdpType:function(){return es},preVerifyMFASMSForLogin:function(){return $s},preVerifyMFAWebAuthnForLogin:function(){return js},recoverMfaToken:function(){return vs},refreshToken:function(){return us},refreshTokenV2:function(){return ds},resendActivationEmail:function(){return ss},resendInvitationEmail:function(){return ls},resetPassword:function(){return ps},resetPhoneNumber:function(){return Xl},revokeSessionsForUser:function(){return dl},saveLockoutPolicy:function(){return kr},saveMfaPolicy:function(){return mr},savePasswordHistoryPolicy:function(){return Lr},setSSODefaultRoles:function(){return Wl},signUpUser:function(){return ll},silentOAuthRefreshToken:function(){return Ql},testCurrentIp:function(){return Gr},testCurrentIpInAllowList:function(){return xr},updateDomainRestrictionConfig:function(){return Dr},updateIPRestrictionConfig:function(){return Fr},updateSSOConfiguration:function(){return Ml},updateSSOConfigurationByMetadata:function(){return $l},updateSSOGroup:function(){return Kl},updateSamlConfiguration:function(){return Ks},updateSamlGroup:function(){return Zs},updateSamlRoles:function(){return Qs},updateSamlVendorMetadata:function(){return qs},updateTenantApiTokensData:function(){return Il},updateUserApiTokensData:function(){return Pl},validateSSODomain:function(){return Vl},validateSamlDomain:function(){return Hs},verifyChangePhoneNumber:function(){return tc},verifyInviteToken:function(){return Rl},verifyMFAAuthenticatorAppForLogin:function(){return Ms},verifyMFASMSForLogin:function(){return Gs},verifyMFAWebAuthnForLogin:function(){return Ws},verifyMfa:function(){return Is},verifyNewDeviceSession:function(){return lc},verifyResetPhoneNumber:function(){return Zl},webAuthnCreateNewDeviceSession:function(){return ac},webAuthnPostLogin:function(){return oc},webAuthnPreLogin:function(){return ic}});var a={};n.r(a),n.d(a,{addUser:function(){return Sc},changePassword:function(){return gc},createInviteUserLink:function(){return mc},deleteInviteUserLink:function(){return Ac},deleteUser:function(){return vc},getInviteLinkConfiguration:function(){return Tc},getInviteUserLink:function(){return kc},getProfile:function(){return dc},loadAvailablePermissions:function(){return Ic},loadAvailableRoles:function(){return Pc},loadStats:function(){return Lc},loadUsers:function(){return pc},resendActivationLink:function(){return Ec},resendInvitationLink:function(){return Oc},resendInvitationLinkToAllTenants:function(){return wc},updateInviteUserLink:function(){return bc},updateProfile:function(){return yc},updateProfileImage:function(){return fc},updateUser:function(){return hc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Dc},getAuditsMetadata:function(){return Nc},getCurrentUserIpMetadata:function(){return Uc},getIpAdressMetadata:function(){return Fc},getNotificationsMetadata:function(){return _c},getSamlMetadata:function(){return Mc},updateAdminBoxMetadata:function(){return Rc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Kc},getReport:function(){return jc},getReports:function(){return Vc},renderReport:function(){return Wc},scheduleReport:function(){return Bc},sendReport:function(){return zc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return qc},markAllAsRead:function(){return Yc},updateNotificationIsPinned:function(){return Jc},updateNotificationStatus:function(){return Hc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return eu},getAudits:function(){return Xc},getAuditsStats:function(){return Zc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return gu},deleteEmailSubscriptions:function(){return yu},deleteSMSConfiguration:function(){return bu},deleteSMSSubscriptions:function(){return hu},deleteSlackConfiguration:function(){return su},deleteWebhooksConfiguration:function(){return Tu},getCategories:function(){return Eu},getChannelMaps:function(){return Ou},getEmailConfiguration:function(){return cu},getSMSConfiguration:function(){return pu},getSlackChannels:function(){return au},getSlackConfiguration:function(){return iu},getSlackScope:function(){return ou},getWebhookLog:function(){return Pu},getWebhooksConfigurations:function(){return Au},patchEmailConfiguration:function(){return du},patchSMSConfiguration:function(){return vu},postEmailConfiguration:function(){return uu},postSMSConfiguration:function(){return Su},postSlackCode:function(){return lu},postSlackConfiguration:function(){return ru},postWebhookRetry:function(){return Lu},postWebhookTest:function(){return Iu},postWebhooksConfiguration:function(){return ku},putEmailSubscriptions:function(){return fu},putSMSSubscriptions:function(){return mu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Du},getSettings:function(){return Cu},updateSettings:function(){return wu}});var y={};n.r(y),n.d(y,{addRole:function(){return Nu},attachPermissionToRoles:function(){return Vu},attachPermissionsToRole:function(){return Gu},deleteRole:function(){return Fu},getPermissionCategories:function(){return ju},getPermissions:function(){return xu},getRoles:function(){return Mu},updateRole:function(){return $u}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return bd},ISubscriptionStatus:function(){return hd},PaymentMethodType:function(){return md},ProviderType:function(){return Ad},TenantCreatedAction:function(){return Td},TrialEndAction:function(){return kd},cancelManagedSubscription:function(){return Yu},cancelSubscription:function(){return Ku},createStripeCustomer:function(){return ud},createStripePaymentMethodSetupIntentSecret:function(){return yd},createSubscription:function(){return ld},createTenantConfiguration:function(){return pd},getManagedSubscription:function(){return Hu},getManagedSubscriptions:function(){return Ju},getPaymentMethod:function(){return rd},getPaymentMethods:function(){return ad},getPaymentProviders:function(){return Sd},getStripeCustomer:function(){return cd},getStripePaymentProviderConfiguration:function(){return dd},getSubscription:function(){return Bu},getSubscriptionInvoice:function(){return nd},getSubscriptionInvoicePdf:function(){return id},getSubscriptionInvoices:function(){return td},getSubscriptionPlan:function(){return ed},getSubscriptionPlans:function(){return Zu},getSubscriptionSummaries:function(){return fd},getSubscriptions:function(){return Wu},getTenantConfiguration:function(){return gd},getVendorPublicConfigurations:function(){return vd},renewManagedSubscription:function(){return Qu},renewSubscription:function(){return zu},updateManagedSubscription:function(){return Xu},updatePaymentMethodBillingDetails:function(){return sd},updateSubscription:function(){return qu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Pd}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Od},addUserToTenantAndSubTenants:function(){return Ld},addUsersToSubTenant:function(){return _d},createSubTenant:function(){return Dd},deleteSubTenant:function(){return Rd},loadAllUsers:function(){return Id},removeUserFromTenantAndSubTenants:function(){return Ed},removeUserRolesFromSubTenants:function(){return wd},setUserRolesForSubTenants:function(){return Cd},updateSubAccountAccess:function(){return Ud}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return Nd},loadFeatureFlags:function(){return Fd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return jd},createConfiguration:function(){return xd},deleteConfiguration:function(){return Vd},getConfigs:function(){return $d},updateConfiguration:function(){return Gd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Wd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Qd},addUsersToGroup:function(){return Zd},createGroup:function(){return Hd},deleteGroup:function(){return Yd},deleteRolesFromGroup:function(){return Xd},deleteUsersFromGroup:function(){return ey},getGroupById:function(){return Kd},getGroupConfiguration:function(){return ty},getGroups:function(){return zd},getGroupsByIds:function(){return qd},updateGroup:function(){return Jd},updateGroupConfiguration:function(){return ny}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return iy},getUsersV3:function(){return oy}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return ay}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return jr},ContextHolder:function(){return fa},FeatureFlags:function(){return Nd},FronteggApiError:function(){return ha},FronteggContext:function(){return ga},FronteggFrameworks:function(){return va},GroupManagedByEnum:function(){return hy},GroupRelations:function(){return vy},ISubscriptionCancellationPolicy:function(){return bd},ISubscriptionStatus:function(){return hd},MFAStrategyEnum:function(){return ly},MachineToMachineAuthStrategy:function(){return Wr},PaginationOrderEnum:function(){return by},PaymentMethodType:function(){return md},ProviderType:function(){return Ad},RequestSource:function(){return Sa},RestrictionType:function(){return xn},ScimConnectionSource:function(){return Sy},SecondaryAuthStrategy:function(){return ry},SocialLoginProviders:function(){return Vr},SortByEnum:function(){return my},TenantType:function(){return uy},UserManagedByEnum:function(){return cy},WebAuthnDeviceType:function(){return sy},api:function(){return Ay},countConfigurationUsers:function(){return jd},createConfiguration:function(){return xd},default:function(){return ky},deleteConfiguration:function(){return Vd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return dy},fronteggHeaders:function(){return pa},fronteggRefreshTokenUrl:function(){return yy},fronteggSilentRefreshTokenUrl:function(){return fy},fronteggTenantsUrl:function(){return py},fronteggUsersUrl:function(){return gy},getConfigs:function(){return $d},loadFeatureFlags:function(){return Fd},updateConfiguration:function(){return Gd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function L(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==I(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function E(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,L(i.key),i)}}function O(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return qI},AccountPageFields:function(){return xI},DomainRestrictionsTabFields:function(){return zI},GeneralSettingsTabFields:function(){return BI},InviteUserModalFields:function(){return GI},IpRestrictionsTabFields:function(){return KI},Metadata:function(){return UI},PrivacyPageFields:function(){return $I},ProfilePageFields:function(){return FI},SecurityPageTabs:function(){return jI},SessionManagementTabFields:function(){return WI},SubscriptionsPageFields:function(){return VI},alpha:function(){return TI},fieldAppearance:function(){return HI},tabAppearance:function(){return JI}});var w=function(){function e(){P(this,e)}return O(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},C.apply(this,arguments)}function D(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){D(a,i,o,r,s,"next",e)}function s(e){D(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var U=n(841),_=n.n(U);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function N(e){return!!e&&!!e[ke]}function F(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Te}(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor[Ae]||W(e)||B(e))}function $(e,t,n){void 0===n&&(n=!1),0===G(e)?(n?Object.keys:Pe)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function G(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===G(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var i=G(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||N(e)||!F(e)||(G(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Le[e];return t||M(18,e),t}function Q(){return pe}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===pe&&(pe=e.l)}function te(e){return pe={p:[],l:pe,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,i),i?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=oe(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=oe(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function oe(e,t,n){if(J(t))return t;var i=t[ke];if(!i)return $(t,(function(o,a){return ae(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return re(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=z(i.k):i.o;$(3===i.i?new Set(o):o,(function(t,a){return ae(e,i,o,t,a,n)})),re(e,o,!1),n&&e.u&&Y("Patches").R(i,n,e.u,e.s)}return i.o}function ae(e,t,n,i,o,a){if(N(o)){var r=oe(e,o,a&&t&&3!==t.i&&!x(t.D,i)?a.concat(i):void 0);if(V(n,i,r),!N(r))return;e.m=!1}if(F(o)&&!J(o)){if(!e.h.F&&e._<1)return;oe(e,o),t&&t.A.l||re(e,o)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?K(n):e)[t]}function le(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var i=W(t)?Y("MapSet").N(t,n):B(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ee;n&&(o=[i],a=Oe);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(i),i}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,i=t[ke],o=G(t);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=fe(t,o),i.I=!1}else n=fe(t,o);return $(n,(function(t,o){i&&function(e,t){return 2===G(e)?e.get(t):e[t]}(i.t,t)===o||V(n,t,e(o))})),3===o?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,pe,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=Se?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Ae=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Ee={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var i,o=le(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!F(i)?i:i===se(e.t,t)?(ue(e),e.o[t]=de(e.A.h,i,e)):i},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var i=le(K(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=se(K(e),t),a=null==o?void 0:o[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,o)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==se(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};$(Ee,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==i&&"function"!=typeof i&&M(7),F(e)){var s=te(t),l=de(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Z(s):ee(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(s,i),ie(e,s)}),(function(e){throw Z(s),e})):(X(s,i),ie(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),i){var u=[],d=[];Y("Patches").M(e,r,u,d),i(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=Y("Patches").$;return N(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ce=new we,De=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),De);function Ue(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function xe(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ve(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(l)throw new Error(Ne(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ne(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(l)throw new Error(Ne(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ne(10));o=e,y({type:Ge.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:Ge.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=g,i}function je(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ge.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ne(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ne(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:i})}}}function Ke(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ye=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Qe=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var i=0,o=Xe(t);i<o.length;i++)n=o[i],et.call(t,n)&&tt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ot=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Ye([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ye([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?Re(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new ot);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(He):i.push(He.withExtraArgument(n.extraArgument))),i}function st(e){var t,n=function(e){return rt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=je(a)}var g=s;"function"==typeof g&&(g=g(n));var p=Be.apply(void 0,g),S=We;c&&(S=it(nt({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ye([p],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function lt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return nt(nt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ct(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ut(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:at(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ct(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=nt(nt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ct(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return at(e())};else{var c=at(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ye([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(N(e))return void 0===(i=n(e,t))?e:i;if(F(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?lt(c,i):lt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var dt="listenerMiddleware";lt(dt+"/add"),lt(dt+"/removeAll"),lt(dt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Ee.get(t,e)},set:function(t){var n=this[ke];Ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ke];if(!o.P)switch(o.i){case 5:i(o)&&ce(o);break;case 4:n(o)&&ce(o)}}}function n(e){for(var t=e.t,n=e.k,i=Pe(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var s=n[a],l=s&&s[ke];if(l?l.t!==r:!j(s,r))return!0}}var c=!!t[ke];return i.length!==Pe(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Ie(n);delete a[ke];for(var r=Pe(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:Q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ke,{value:a,writable:!0}),o},S:function(e,n,o){o?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)$(a,(function(t){t!==ke&&(void 0!==o[t]||x(o,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),$(o,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===s){if(i(n)&&(ce(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const yt=(e,t)=>n=>C({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{loaders:C({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),ht=(e,t,n)=>i=>{var o;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(o=i[e])?void 0:o[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",At=new Uint8Array(256);for(let e=0;e<bt.length;e++)At[bt.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=At[e.charCodeAt(i)],a=At[e.charCodeAt(i+1)],r=At[e.charCodeAt(i+2)],s=At[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=bt[t[i]>>2],o+=bt[(3&t[i])<<4|t[i+1]>>4],o+=bt[(15&t[i+1])<<2|t[i+2]>>6],o+=bt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Tt(e[n]);return t}return e};let Pt,It,Lt;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Et="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Dt="auditLogs",Rt="vendor",Ut={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},_t={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:Ut})},Mt={requestAuthorize:lt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:lt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:lt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:lt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:lt("auth/afterAuthNavigation"),preLogin:lt("auth/preLogin",(e=>({payload:e}))),postLogin:lt("auth/postLogin",(e=>({payload:e}))),login:lt("auth/login",(e=>({payload:e}))),loginWithMfa:lt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:lt("auth/recoverMfa",(e=>({payload:e}))),logout:lt("auth/logout",(e=>({payload:e}))),silentLogout:lt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:lt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:lt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:lt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:lt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:lt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:lt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:lt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:lt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:lt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:lt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:lt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:lt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:lt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:lt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:lt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:lt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:lt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:lt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:lt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:lt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:lt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:gt("activateState","activationStrategy")},Gt={activateAccount:lt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:lt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:lt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:lt("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:lt("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:lt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:lt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:lt("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Yt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Qt={resetPhoneNumber:lt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:lt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:lt("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:pt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:lt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:lt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:lt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:lt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:lt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:lt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:lt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:lt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:lt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:lt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:lt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:lt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:lt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:lt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:lt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:lt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:lt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:lt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:lt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:lt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:lt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:lt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:lt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:lt("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:lt("auth/loadProfile"),saveProfile:lt("auth/saveProfile",(e=>({payload:e}))),changePassword:lt("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},sn={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},ln={enrollMfa:lt("auth/enrollMfa"),getMFADevices:lt("auth/getMFADevices"),getMFAStrategies:lt("auth/getMFAStrategies"),verifyMfa:lt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:lt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:lt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:lt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:lt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:lt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:lt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:lt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:lt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:lt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:lt("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:pt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:lt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:lt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:lt("auth/loadRoles",(e=>({payload:e}))),addUser:lt("auth/addUser",(e=>({payload:e}))),addUsersBulk:lt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:lt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:lt("auth/updateUser",(e=>({payload:e}))),deleteUser:lt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:lt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:lt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:lt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:lt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:lt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:lt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:lt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:lt("auth/getInvitationLink"),createInvitationLink:lt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:lt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:lt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:lt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:lt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:lt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:lt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:lt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:lt("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},gn={loadSocialLoginsConfiguration:lt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:lt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:lt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:lt("auth/setSocialLoginError",(e=>({payload:e})))};let pn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(pn||(pn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:pn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:lt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:lt("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:pt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},An={loadApiTokens:lt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:lt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:lt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:lt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:lt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:lt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:lt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:lt("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:lt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:lt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:lt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:lt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:lt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:lt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:lt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:lt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:lt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:lt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:lt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:lt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:lt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:lt("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},Ln={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},En={loadAccountSettings:lt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:lt("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Cn={switchTenant:lt("auth/switchTenant",(e=>({payload:e}))),loadTenants:lt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:lt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:lt("auth/loadSubTenantsTree",(e=>({payload:e})))},Dn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Dn})},Un={loadRolesAndPermissions:lt("auth/loadRoles",(e=>({payload:e}))),addRole:lt("auth/addRole",(e=>({payload:e}))),updateRole:lt("auth/updateRole",(e=>({payload:e}))),deleteRole:lt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:lt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:lt("auth/attachPermissionToRoles",(e=>({payload:e})))},_n={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:_n})},Nn={loadUserSessions:lt("auth/loadUserSessions"),loadCurrentUserSession:lt("auth/loadCurrentUserSession"),deleteUserSession:lt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:lt("auth/deleteAllUserSessions"),revokeUserSessions:lt("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},$n={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},Gn={loadSessionsPolicy:lt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:lt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:lt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:lt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:lt("auth/loadIpRestrictions"),saveIpRestriction:lt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:lt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:lt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:lt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:lt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:lt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:lt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:lt("auth/loadProvisionConnections"),createProvisionConnection:lt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:lt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:lt("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:lt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:lt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:pt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:lt("auth/loadUsersGroups"),getGroupById:lt("auth/getGroupById",(e=>({payload:e}))),createGroup:lt("auth/createGroup",(e=>({payload:e}))),updateGroup:lt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:lt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:lt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:lt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:lt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:lt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:lt("auth/getGroupConfiguration"),updateGroupConfiguration:lt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:lt("auth/getUsers",(e=>({payload:e})))},Zn={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},ei={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ti={loading:!0,error:null},ni={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:ti})},ii={loadTenantMetadata:lt("auth/loadTenantMetadata"),updateTenantMetadata:lt("auth/updateTenantMetadata",(e=>({payload:e})))},oi={setEntitlementsState:ft("entitlementsState")},ai={loadEntitlements:lt("auth/loadEntitlements")},ri={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:Ut,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:ti,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Dn,resetPhoneNumberState:Jt,sessionsState:_n,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn,entitlementsState:{entitlements:void 0,loading:!1,error:void 0}},si=C({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},ri);let li;!function(e){e.impersonating="impersonating",e.success="success"}(li||(li={}));const ci={step:li.impersonating,loading:!1},ui={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:ci})},di={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:yi,actions:fi}=ut({name:wt,initialState:si,reducers:C({resetState:e=>C({},e,ri),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,ui,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Kn,Hn,oi)});const gi=C({},fi,Mt,gn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ai,di,Jn);var pi=function(e){return"@@redux-saga/"+e},Si=pi("CANCEL_PROMISE"),vi=pi("CHANNEL_END"),hi=pi("IO"),mi=pi("MATCH"),bi=pi("MULTICAST"),Ai=pi("SAGA_ACTION"),ki=pi("SELF_CANCELLATION"),Ti=pi("TASK"),Pi=pi("TASK_CANCEL"),Ii=pi("TERMINATE"),Li=pi("LOCATION");function Ei(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 Oi=function(e){return null==e},wi=function(e){return null!=e},Ci=function(e){return"function"==typeof e},Di=function(e){return"string"==typeof e},Ri=Array.isArray,Ui=function(e){return e&&Ci(e.then)},_i=function(e){return e&&Ci(e.next)&&Ci(e.throw)},Mi=function e(t){return t&&(Di(t)||$i(t)||Ci(t)||Ri(t)&&t.every(e))},Ni=function(e){return e&&Ci(e.take)&&Ci(e.close)},Fi=function(e){return Ci(e)&&e.hasOwnProperty("toString")},$i=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Gi=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},xi=function(e){return function(){return e}},Vi=xi(!0),ji=function(){},Wi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Bi=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ki(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var zi=function(e){throw e},qi=function(e){return{value:e,done:!0}};function Hi(e,t,n){void 0===t&&(t=zi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:qi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ji(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Yi=function(e){return Array.apply(null,new Array(e))},Qi=function(e){return function(t){return e(Object.defineProperty(t,Ai,{value:!0}))}},Xi=function(e){return e===Ii},Zi=function(e){return e===Pi},eo=function(e){return Xi(e)||Zi(e)};function to(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ri(e)?Yi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||eo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=ji,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function no(e){return{name:e.name||"anonymous",location:io(e)}}function io(e){return e[Li]}var oo=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)},ao="TAKE",ro="CALL",so="FORK",lo="SELECT",co=function(e,t){var n;return(n={})[hi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function uo(e,t){return void 0===e&&(e="*"),Mi(e)?(wi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),co(ao,{pattern:e})):Ni(n=e)&&n[bi]&&wi(t)&&Mi(t)?co(ao,{channel:e,pattern:t}):Ni(e)?(wi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),co(ao,{channel:e})):void 0;var n}function yo(e,t){return Oi(t)&&(t=e,e=void 0),co("PUT",{channel:e,action:t})}function fo(e){var t=co("ALL",e);return t.combinator=!0,t}function go(e,t){var n,i=null;return Ci(e)?n=e:(Ri(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&Di(n)&&Ci(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function po(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return co(ro,go(e,n))}function So(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 co(so,go(e,n))}function vo(e){return void 0===e&&(e=ki),co("CANCEL",e)}function ho(e){void 0===e&&(e=Wi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return co(lo,{selector:e,args:n})}var mo=po.bind(null,Gi);var bo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ao=[],ko=0;function To(e){try{Lo(),e()}finally{Eo()}}function Po(e){Ao.push(e),ko||(Lo(),Oo())}function Io(e){try{return Lo(),e()}finally{Oo()}}function Lo(){ko++}function Eo(){ko--}function Oo(){var e;for(Eo();!ko&&void 0!==(e=Ao.shift());)To(e)}var wo=function(e){return function(t){return e.some((function(e){return _o(e)(t)}))}},Co=function(e){return function(t){return e(t)}},Do=function(e){return function(t){return t.type===String(e)}},Ro=function(e){return function(t){return t.type===e}},Uo=function(){return Vi};function _o(e){var t="*"===e?Uo:Di(e)?Do:Ri(e)?wo:Fi(e)?Do:Ci(e)?Co:$i(e)?Ro:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Mo={type:vi},No=function(e){return e&&e.type===vi};function Fo(){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(Mo)}))},(e={})[bi]=!0,e.put=function(e){if(!t)if(No(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[mi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Uo),t?e(Mo):(e[mi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ki(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ai]?s(e):Po((function(){s(e)}))},r}function $o(e,t){var n=e[Si];Ci(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Go,xo=0,Vo=function(){return++xo};function jo(e){e.isRunning()&&e.cancel()}var Wo=((Go={}).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):!No(e)||r?n(e):n(Ii)};try{o.take(s,wi(a)?_o(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Go.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Po((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Ui(t)?$o(t,n):n(t)}))},Go.ALL=function(e,t,n,i){var o=i.digestEffect,a=xo,r=Object.keys(t);if(0!==r.length){var s=to(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ri(t)?[]:{})},Go.RACE=function(e,t,n,i){var o=i.digestEffect,a=xo,r=Object.keys(t),s=Ri(t)?Yi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||eo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=ji,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)}))},Go.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(Ui(l))return void $o(l,n);if(_i(l))return void Zo(e,l,s.context,xo,no(a),!1,n);n(l)}catch(e){n(e,!0)}},Go.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Oi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Go.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(_i(o))return o;var a=!1;return Hi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Ui(o)})}))}catch(e){return Hi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:no(t)}(c,a);Io((function(){var t=Zo(e,c,l.context,xo,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Go.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()&&Ki(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ri(t)){if(0===t.length)return void n([]);var r=to(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Go.CANCEL=function(e,t,n,i){var o=i.task;t===ki?jo(o):Ri(t)?t.forEach(jo):jo(t),n()},Go.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)}},Go.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=oo());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Mo):e.isEmpty()?(n.push(i),i.cancel=function(){Ki(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(Mo):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])(Mo)}}}}(t.buffer),a=_o(i),r=function t(n){No(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)},Go.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Go.FLUSH=function(e,t,n){t.flush(n)},Go.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Go.SET_CONTEXT=function(e,t,n,i){var o=i.task;Bi(o.context,t),n()},Go);function Bo(e,t){return e+"?"+t}function Ko(e){var t=e.name,n=e.location;return n?t+" "+Bo(n.fileName,n.lineNumber):t}function zo(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 qo=null,Ho=[],Jo=function(e){e.crashedEffect=qo,Ho.push(e)},Yo=function(){qo=null,Ho.length=0},Qo=function(){var e,t,n=Ho[0],i=Ho.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=io(e))?t.code+" "+Bo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Ko(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Ko(e.meta)})),[zo(Ho)]).join("\n")};function Xo(e,t,n,i,o,a,r){var s;void 0===r&&(r=ji);var l,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Ki(o,t),t.cont=ji,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=ji,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Jo({meta:o,cancelledTasks:y}),S.isRoot){var i=Qo();Yo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Pi?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={})[Ti]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=g,s.cancel=function(){0===u&&(u=1,g.cancelAll(),p(Pi,!1))},s.cont=r,s.end=p,s.setContext=function(e){Bi(f,e)},s.toPromise=function(){return d||(d=bo(),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 Zo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Ui(t)?$o(t,i):_i(t)?Zo(e,t,c.context,n,o,!1,i):t&&t[hi]?(0,Wo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=ji;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Pi))},status:0},c=Xo(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),Yo()):Zi(e)?(l.status=1,d.cancel(),o=Ci(t.return)?t.return(Pi):{done:!0,value:Pi}):o=Xi(e)?Ci(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=Vo();function l(n,o){a||(a=!0,i.cancel=ji,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){qo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=ji,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=ji,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function ea(e,t){for(var n=e.channel,i=void 0===n?Fo():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?Ji:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Vo();if(l&&(l.rootSagaStarted=l.rootSagaStarted||ji,l.effectTriggered=l.effectTriggered||ji,l.effectResolved=l.effectResolved||ji,l.effectRejected=l.effectRejected||ji,l.effectCancelled=l.effectCancelled||ji,l.actionDispatched=l.actionDispatched||ji,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Wi;var m={channel:i,dispatch:Qi(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:p};return Io((function(){var e=Zo(m,S,s,v,no(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var ta=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Fo():a,s=n.sagaMonitor,l=Ei(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=ea.bind(null,C({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Bi(o,e)},c},na=function(e){return{done:!0,value:e}},ia={};function oa(e){return Ni(e)?"channel":Fi(e)?String(e):Ci(e)?e.name:String(e)}function aa(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ia)return na(t);if(n&&!o)throw r=ia,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===ia?na(t):a}return Hi(s,(function(e){return s(null,e)}),n)}function ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:uo(e)},s=function(e){return{done:!1,value:So.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return aa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+oa(e)+", "+t.name+")")}function sa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:uo(e)},l=function(e){return{done:!1,value:So.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:vo(e)}},u=function(e){return a=e},d=function(e){return r=e};return aa({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("+oa(e)+", "+t.name+")")}function la(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:uo(e)},s=function(e){return{done:!1,value:po.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return aa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+oa(e)+", "+t.name+")")}function ca(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:po.apply(void 0,[n].concat(a))},l={done:!1,value:mo(t)};return aa({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ia}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function ua(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return So.apply(void 0,[ra,e,t].concat(i))}function da(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 So.apply(void 0,[sa,e,t].concat(i))}function ya(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 So.apply(void 0,[la,e,t].concat(i))}class fa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return fa.instance||(fa.instance=new fa),fa.instance}static setContext(e){fa.getInstance().context=e}static setAccessToken(e){fa.getInstance().accessToken=e}static setUser(e){fa.getInstance().user=e}static setRequestSource(e){fa.getInstance().requestSource=e}static setOnRedirectTo(e){fa.getInstance().onRedirectTo=e}static setLogout(e,t){fa.getInstance().logout=n=>{n?e(n):fa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=fa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return fa.getInstance().accessToken}static getRequestSource(){return fa.getInstance().requestSource}static getUser(){return fa.getInstance().user}static onRedirectTo(e,t){return fa.getInstance().onRedirectTo(e,t)}static logout(e){return fa.getInstance().logout(e)}}fa.instance=void 0;const ga={getContext:()=>fa.getContext(),getAccessToken:()=>fa.getAccessToken(),getUser:()=>fa.getUser(),onRedirectTo:(e,t)=>fa.onRedirectTo(e,t),logout:e=>fa.logout(e)},pa={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let Sa,va;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(Sa||(Sa={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(va||(va={}));class ha extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ma(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}function ba(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[pa.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[pa.frameWork]=e.metadataHeaders.framework),i}const Aa=async e=>{var t,n,i;const o=fa.getContext(),a=await async function(e,t){var n;const i=ba(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:fa.getAccessToken)(),a=fa.getRequestSource();t&&(i[pa.contentType]=t),a&&(i[pa.source]=a),o&&(i.Authorization=`Bearer ${o}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=ma(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:C({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new ha("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 ha(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{}}},ka=async(e,t,n)=>Aa(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Ta=async(e,t,n)=>Aa(C({url:e,method:"POST",contentType:"application/json",body:t},n)),Pa=async(e,t,n)=>Aa(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ia=async(e,t,n)=>Aa(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),La=async(e,t,n)=>Aa(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ea=async(e,t,n,i)=>Aa(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Oa=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),wa={v1:"/identity/resources/users/webauthn/v1/devices"},Ca={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Da={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},Ra={v1:"/identity/resources/configurations/v1"},Ua={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},_a={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ma={v1:"/identity/resources/permissions/v1"},Na={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Fa={v1:"/identity/resources/roles/v1"},$a={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ga={v1:"/identity/resources/impersonation/v1"},xa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Va={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ja={v1:"/team/resources/members/v1"},Wa={v1:"/team/resources/roles/v1"},Ba={v1:"/team/resources/stats/v1"},Ka={v1:"/team/resources/profile"},za={v1:"/tenants/resources/account-settings/v1"},qa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},Ha={v1:"/tenants/resources/sub-tenants/v1"},Ja={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ya={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},Qa={v1:"/subscriptions/resources/payment-providers/v1"},Xa={v1:"/subscriptions/resources/subscriptions/v1"},Za={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},er={v1:"/reports/engine/resources/triggers/v1"},tr="/notification",nr="/audits",ir={v1:"/event/resources/configurations/v1"},or="/webhook",ar="/oauth",rr="/flags",sr="/directory/resources/v1/configurations/scim2",lr="/directory/resources/scim/temp",cr="/entitlements/check/v1";async function ur(e){return Ia(`${Da.v1}/tenant`,e)}async function dr(){return ka(`${Da.v2}/me/tenants`)}async function yr(e){return ka(qa.v1,void 0,{headers:Oa(e)})}async function fr(e){return ka(qa.tree.v1,void 0,{headers:Oa(e)})}async function gr(e){return ka(qa.parents.v1,void 0,{headers:Oa(e)})}async function pr(e,t){return Ta(`${Na.users.v1}/count`,e,{headers:Oa(t)})}async function Sr(){return ka(Ra.v1)}async function vr(){return ka(`${Ra.v1}/mfa-policy`)}async function hr(){return ka(`${Ra.v1}/mfa-policy/vendor`)}async function mr(e){return e.id?Pa(`${Ra.v1}/mfa-policy`,e):Ta(`${Ra.v1}/mfa-policy`,e)}async function br(){return ka(`${Ra.v1}/lockout-policy`)}async function Ar(){return ka(`${Ra.v1}/lockout-policy/vendor`)}async function kr(e){return e.id?Pa(`${Ra.v1}/lockout-policy`,e):Ta(`${Ra.v1}/lockout-policy`,e)}async function Tr(){try{return await ka(`${Ra.v1}/captcha-policy/public`)}catch{return null}}async function Pr(){return ka(`${Ra.v1}/password-history-policy`)}async function Ir(){return ka(`${Ra.v1}/password-history-policy/vendor`)}async function Lr(e){return e.id?Pa(`${Ra.v1}/password-history-policy`,e):Ta(`${Ra.v1}/password-history-policy`,e)}async function Er(){return ka(`${Ra.v1}/password`)}async function Or(){return ka(`${Ua.emailDomain.v1}`)}async function wr(){return ka(`${Ua.emailDomain.v1}/config`)}async function Cr(e){return Ta(`${Ua.emailDomain.v1}`,e)}async function Dr(e){return Ta(`${Ua.emailDomain.v1}/config`,e)}async function Rr(e){return La(`${Ua.emailDomain.v1}/${e}`)}async function Ur(e){return ka(`${Ua.ip.v1}`,e)}async function _r(){return ka(`${Ua.ip.v1}/config`)}async function Mr(e){return Ta(`${Ua.ip.v1}`,e)}async function Nr(e){return Ta(`${Ua.ip.v1}/bulk`,e)}async function Fr(e){return Ta(`${Ua.ip.v1}/config`,e)}async function $r(e){return La(`${Ua.ip.v1}/${e}`)}async function Gr(){return Ta(`${Ua.ip.v1}/verify`)}async function xr(){return Ta(`${Ua.ip.v1}/verify/allow`)}let Vr,jr,Wr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Vr||(Vr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(jr||(jr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Wr||(Wr={}));class Br extends Error{constructor(e){super(e)}}const Kr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Br("'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 zr extends Error{constructor(e){super(e)}}const qr=(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(Kr(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 Kr(t)}})(e.split(".")[n]))}catch(e){throw new zr("Invalid token specified: "+e.message)}},Hr=["type"],Jr=["type"];async function Yr(e){if(!e.accessToken)return e;fa.setAccessToken(e.accessToken);const t=await ka(`${Da.v2}/me`),n=C({},e,e.accessToken?qr(e.accessToken):{},t);return fa.setUser(n),n}async function Qr(e){if(!e.accessToken)return{user:e};fa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ka(`${Da.v2}/me`),dr()]),i=C({},e,e.accessToken?qr(e.accessToken):{},t);return fa.setUser(i),{user:i,tenants:n}}async function Xr(e){fa.setAccessToken(e.id_token);const t=await ka(`${Da.v2}/me`),n=e.id_token?qr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return fa.setUser(i),i}async function Zr(e){try{const{address:t}=await Ta(`${Ca.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function es(e){return Ta(`${Ca.v1}/user/saml/prelogin`,e)}async function ts(e){return Yr(await Ta(`${Ca.v1}/user/saml/postlogin`,e))}async function ns(e){return Yr(await Ta(`${Ca.v1}/user/oidc/postlogin`,e))}async function is(e){return Yr(await Ta(`${Ca.v1}/user`,e))}async function os(e){return Yr(await Ta(`${Ca.v1}/user/mfa/verify`,e))}async function as(e){return Ta(`${Da.v1}/activate`,e)}async function rs(e){return ka(`${Da.v1}/activate/strategy`,e)}async function ss(e){return Ta(`${Da.v1}/activate/reset`,e)}async function ls(e){return Ta(`${Da.v1}/invitation/reset`,e)}async function cs(e){return Ta(`${Da.v1}/invitation/accept`,e)}async function us(){return Yr(await Ta(`${Ca.v1}/user/token/refresh`))}async function ds(){return Qr(await Ta(`${Ca.v1}/user/token/refresh`))}async function ys(){return Ta(`${Ca.v1}/logout`)}async function fs(e){return ka(`${ar}/logout`,e)}async function gs(e){return Ta(`${Da.v1}/passwords/reset`,e)}async function ps(e){return Ta(`${Da.v1}/passwords/reset/verify`,e)}async function Ss(e){return ka(`${Da.v1}/passwords/config`,e)}async function vs(e){return Ta(`${Ca.v1}/user/mfa/recover`,e)}async function hs(){return Ta(`${Da.v1}/mfa/enroll`)}async function ms(){return Ta(`${Da.v1}/mfa/authenticator/enroll`)}async function bs(e){return Ta(`${Da.v1}/mfa/authenticator/enroll/verify`,e)}async function As(e){return Ta(`${Da.v1}/mfa/sms/enroll`,e)}async function ks(e){return Ta(`${Da.v1}/mfa/sms/enroll/verify`,e)}async function Ts(){return Ta(`${Da.v1}/mfa/webauthn/enroll`)}async function Ps(e){return Ta(`${Da.v1}/mfa/webauthn/enroll/verify`,e)}async function Is(e){return Ta(`${Da.v1}/mfa/enroll/verify`,e)}async function Ls(e){return Ta(`${Da.v1}/mfa/disable`,e)}async function Es(e,t){return Ta(`${Da.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Os(e){return Ta(`${Da.v1}/mfa/sms/${e}/disable`)}async function ws(e,t){return Ta(`${Da.v1}/mfa/sms/${e}/disable/verify`,t)}async function Cs(e){return Ta(`${Da.v1}/mfa/webauthn/${e}/disable`)}async function Ds(e,t){return Ta(`${Da.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Rs(){return ka(`${Da.v1}/mfa/devices`)}async function Us(e){return Ta(`${Ca.v1}/user/mfa/authenticator/enroll`,e)}async function _s(e){return Ta(`${Ca.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Ms(e,t){return Ta(`${Ca.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Ns(e){return Ta(`${Ca.v1}/user/mfa/sms/enroll`,e)}async function Fs(e){return Ta(`${Ca.v1}/user/mfa/sms/enroll/verify`,e)}async function $s(e,t){return Ta(`${Ca.v1}/user/mfa/sms/${e}`,t)}async function Gs(e,t){return Ta(`${Ca.v1}/user/mfa/sms/${e}/verify`,t)}async function xs(e){return Ta(`${Ca.v1}/user/mfa/webauthn/enroll`,e)}async function Vs(e){return Ta(`${Ca.v1}/user/mfa/webauthn/enroll/verify`,e)}async function js(e,t){return Ta(`${Ca.v1}/user/mfa/webauthn/${e}`,t)}async function Ws(e,t){return Ta(`${Ca.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Bs(){return ka(`${Va.v1}/saml/configurations`)}async function Ks(e){return Ta(`${Va.v1}/saml/configurations`,e)}async function zs(){return ka(`${Va.v1}/saml/configurations/vendor-config`)}async function qs(e){return Ia(`${Va.v1}/saml/configurations/metadata`,e)}async function Hs(){return Ia(`${Va.v1}/saml/validations/domain`)}async function Js(){return ka(`${Va.v1}/saml/configurations/roles/default`)}async function Ys(){return ka(`${Va.v2}/saml/configurations/groups`)}async function Qs({roleIds:e}){return Ta(`${Va.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Xs({roleIds:e,group:t}){return Ta(`${Va.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Zs({roleIds:e,group:t,id:n}){return Pa(`${Va.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function el({id:e}){return La(`${Va.v2}/saml/configurations/groups/${e}`)}async function tl(){return ka(`${Va.v1}/oidc/configurations`)}async function nl(){return ka(`${Va.v2}/configurations/public`)}async function il(){return ka(_a.v1)}async function ol(){return ka(_a.v2)}async function al(){return ka(_a.custom.v1)}async function rl({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),Ta(`${Ca.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function sl(){return ka(`${Ra.v1}/public`)}async function ll(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Ta(`${Da.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Yr(n):void 0,userId:i,tenantId:o}}async function cl(){return ka(Da.sessions.currentUser.v1)}async function ul(){return ka(`${Da.sessions.currentUser.v1}/current`)}async function dl(e){return Ta(`${Da.sessions.v1}/revoke`,{userId:e})}async function yl(){return ka(Da.sessions.configurations.v1)}async function fl(e){await Ta(Da.sessions.configurations.v1,e)}async function gl(e){await La(`${Da.sessions.currentUser.v1}/${e}`)}async function pl(){await La(`${Da.sessions.currentUser.v1}/all`)}async function Sl(){return ka(Da.accessTokens.v1)}async function vl(){return ka(Na.accessTokens.v1)}async function hl({id:e}){return La(`${Na.accessTokens.v1}/${e}`)}async function ml({id:e}){return La(`${Da.accessTokens.v1}/${e}`)}async function bl(e){return Ta(Da.accessTokens.v1,e)}async function Al(e){return Ta(Na.accessTokens.v1,e)}async function kl(){return ka(Da.apiTokens.v1)}async function Tl(){return ka(Na.apiTokens.v1)}async function Pl(e){return Ta(Da.apiTokens.v1,e)}async function Il(e){return Ta(Na.apiTokens.v2,e)}async function Ll({tokenId:e}){return La(`${Na.apiTokens.v1}/${e}`)}async function El({tokenId:e}){return La(`${Da.apiTokens.v1}/${e}`)}async function Ol({userId:e}){return ka(`${Da.v1}/${e}`)}async function wl(e){return ka(`${Ra.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Cl(e){let{type:t}=e,n=Ei(e,Hr);return Ta(`${Ca.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Dl(e){let{type:t}=e,n=Ei(e,Jr);return Ta(`${Ca.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Rl({token:e}){return Ta(Na.invites.verify.v1,{token:e})}async function Ul(){return ka(`${Va.v1}/configurations`)}async function _l(e){return Ta(`${Va.v1}/configurations`,e)}async function Ml(e,t){return Pa(`${Va.v1}/configurations/${e}`,t)}async function Nl(e){return La(`${Va.v1}/configurations/${e}`)}async function Fl(e){return Ta(`${Va.v1}/configurations/metadata`,e)}async function $l(e,t){return Ia(`${Va.v1}/configurations/${e}/metadata`,t)}async function Gl(e,t){return Ta(`${Va.v1}/configurations/${e}/domains`,t)}async function xl(e,t){return La(`${Va.v1}/configurations/${e}/domains/${t}`)}async function Vl(e,t){return Ia(`${Va.v1}/configurations/${e}/domains/${t}/validate`)}async function jl(e){return ka(`${Va.v1}/configurations/${e}/roles`)}async function Wl(e,t){return Ia(`${Va.v1}/configurations/${e}/roles`,t)}async function Bl(e,t){return Ta(`${Va.v1}/configurations/${e}/groups`,t)}async function Kl(e,{roleIds:t,group:n,id:i}){return Pa(`${Va.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function zl(e,t){return La(`${Va.v1}/configurations/${e}/groups/${t}`)}async function ql(e){return ka(`${Va.v1}/configurations/${e}/groups`)}async function Hl(e){return Ta(`${Ca.v2}/user/sso/prelogin`,e)}async function Jl(e){return Yr(await Ta(`${Ca.v2}/user/oidc/postlogin`,e))}async function Yl(e){return Xr(await Ta(`${ar}/token`,e))}async function Ql(){return Xr(await Ta(`${ar}/authorize/silent`))}async function Xl(e){return Ta(`${Da.v1}/phone/reset`,e)}async function Zl(e){return Ta(`${Da.v1}/phone/reset/verify`,e)}async function ec(e){return Ta(`${Da.v1}/phone`,e)}async function tc(e){return Ta(`${Da.v1}/phone/verify`,e)}async function nc(e){return Ia(`${Da.v1}/phone/change`,e)}async function ic(e){return Ta(`${Ca.v1}/webauthn/prelogin`,e)}async function oc(e){return Ta(`${Ca.v1}/webauthn/postlogin`,e)}async function ac(){return Ta(wa.v1)}async function rc(){return ka(wa.v1)}async function sc(e){return La(`${wa.v1}/${e}`)}async function lc(e){return Ta(`${wa.v1}/verify`,e)}async function cc(){return ka(`${Ra.v1}/auth/strategies/public`)}async function uc(){return ka(`${Ra.v1}/mfa/strategies`)}async function dc(e){return ka(`${Da.v2}/me`,null!=e?e:{addRoles:!0})}async function yc(e){return Ia(`${Da.v2}/me`,e)}async function fc(e){return Ia(`${Ka.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function gc(e){return Ta(`${Da.v1}/passwords/change`,e)}async function pc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>C({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return ka(ja.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Sc(e){return Ta(Da.v2,C({},e,{provider:"local"}))}async function vc(e){return La(`${ja.v1}/${e.userId}`)}async function hc(e){return Ia(ja.v1,e)}async function mc(e){return Ta(Na.invites.user.v1,C({},e))}async function bc(e){return Pa(Na.invites.user.v1,C({},e))}async function Ac(){return La(Na.invites.user.v1)}async function kc(){return ka(Na.invites.user.v1)}async function Tc(){return ka(Na.invites.configuration.v1)}async function Pc(){return ka(Wa.v1)}async function Ic(){return ka(Ma.v1)}async function Lc(){return ka(`${Ba.v1}/members`)}async function Ec(e){return Ta(`${ja.v1}/${e.userId}/resendActivationEmail`,{})}async function Oc(e){return Ta(Da.v2,C({},e,{provider:"local"}))}async function wc(e){return Ta(Da.invitation.resendAll.v1,C({},e))}async function Cc(e){var t,n;const i=await ka("/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 Dc(){return ka("/metadata/admin-box")}async function Rc(e){return Ta("/metadata/admin-box",e)}async function Uc(){const e=await ka("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const _c=async()=>Cc({entityName:"notifications"}),Mc=async()=>Cc({entityName:"saml"}),Nc=async()=>Cc({entityName:"audits"}),Fc=async e=>async function(e){const t=await ka(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),$c=["dataFilters"],Gc=["templateId","dataFilters"],xc=["dataFilters"];async function Vc(e){return ka(`${Za.v2}/tenant-reports`,e)}async function jc(e){return ka(`${Za.v2}/${e.id}/tenant-reports`)}async function Wc(e){let{dataFilters:t}=e,n=Ei(e,$c);return{html:await ka(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Bc(e){let{templateId:t,dataFilters:n}=e,i=Ei(e,Gc);return Ta(`${Za.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Kc(e){let{dataFilters:t}=e,n=Ei(e,xc);const i=await ka(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function zc(e){return Ta(`${er.v1}/tenant-reports`,e)}async function qc(e){return ka(tr,{params:e})}async function Hc(e){return Ia(`${tr}/status`,{params:e})}async function Jc(e){const{notificationId:t,pinStatus:n}=e;return Ia(`${tr}/${n}`,{notificationId:t})}async function Yc(){return Ta(`${tr}/status/mark-all-read`)}const Qc=["endpoint","headerProps"];async function Xc(e){return ka(nr,e)}async function Zc(e){return ka(`${nr}/stats`,e)}async function eu(e){const{endpoint:t,headerProps:n}=e,i=Ei(e,Qc);return Ea(`${nr}/export/${t}`,{properties:n},i)}const tu=["eventKey"],nu=["eventKey"],iu=()=>ka(`${Ja.v1}/slack`),ou=()=>ka(`${Ja.v1}/slack/applications`),au=()=>ka(`${Ja.v1}/slack/channels`),ru=e=>e.id?Pa(`${Ja.v1}/slack/subscription/${e.id}`,e):Ta(`${Ja.v1}/slack/subscriptions`,e),su=e=>La(`${Ja.v1}/slack/subscriptions/${e.id}`),lu=e=>Ta(`${Ja.v1}/slack/applications/registrations`,{code:e}),cu=()=>ka(`${Ja.v1}/emails`),uu=e=>{let{eventKey:t}=e,n=Ei(e,tu);return Ta(`${Ja.v1}/emails/${t}`,n)},du=({eventKey:e,enabled:t})=>Pa(`${Ja.v1}/emails/${e}`,{enabled:t}),yu=(e,t)=>La(`${Ja.v1}/emails/${e}/subscriptions/${t}`),fu=(e,t,n)=>Ia(`${Ja.v1}/emails/${t}/subscriptions/${e}`,n),gu=e=>La(`${Ja.v1}/emails/${e}`),pu=()=>ka(`${Ja.v2}/sms`),Su=e=>{let{eventKey:t}=e,n=Ei(e,nu);return Ta(`${Ja.v2}/sms/${t}`,n)},vu=({eventKey:e,enabled:t})=>Pa(`${Ja.v2}/sms/${e}`,{enabled:t}),hu=(e,t)=>La(`${Ja.v2}/sms/${e}/subscriptions/${t}`),mu=(e,t,n)=>Ia(`${Ja.v2}/sms/${t}/subscriptions/${e}`,n),bu=e=>La(`${Ja.v2}/sms/${e}`),Au=()=>ka(or),ku=e=>e._id?Pa(`${or}/${e._id}`,e):Ta(`${or}/custom`,e),Tu=e=>La(`${or}/${e}`),Pu=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ka(`${or}/logs/?${i.toString()}`)},Iu=e=>Ta(`${or}/test`,e),Lu=e=>Ta(`${or}/logs/${e}/retries`),Eu=()=>ka(`${ir.v1}/categories`),Ou=e=>ka(ir.v1,{channels:e});async function wu(e,t){return Ia(za.v1,e,{headers:Oa(t)})}async function Cu(e){return ka(za.v1,void 0,{headers:Oa(e)})}async function Du(){return ka(`${za.v1}/public`)}const Ru=["roleId"],Uu=["roleId"],_u=["permissionId"];async function Mu(){return ka(Fa.v1)}async function Nu(e){return Ta(Fa.v1,e)}async function Fu({roleId:e}){return La(`${Fa.v1}/${e}`)}async function $u(e){let{roleId:t}=e,n=Ei(e,Ru);return Pa(`${Fa.v1}/${t}`,n)}async function Gu(e){let{roleId:t}=e,n=Ei(e,Uu);return Ia(`${Fa.v1}/${t}/permissions`,n)}async function xu(){return ka(Ma.v1)}async function Vu(e){let{permissionId:t}=e,n=Ei(e,_u);return Ia(`${Ma.v1}/${t}/roles`,n)}async function ju(){return ka(`${Ma.v1}/categories`)}async function Wu(){return ka(Ya.subscriptions.v1)}async function Bu(e){return ka(`${Ya.subscriptions.v1}/${e}`)}async function Ku(e){return Ia(`${Ya.subscriptions.v1}/${e}/cancellations/`,{})}async function zu(e){return Ia(`${Ya.subscriptions.v1}/${e}/renewals/`,{})}async function qu(e,{paymentMethodId:t,planId:n}){return Ia(`${Ya.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Hu(e){return ka(`${Xa.v1}/${e}`)}async function Ju(){return ka(`${Xa.v1}`)}async function Yu(e){return Ia(`${Xa.v1}/${e}/cancellations/`,{})}async function Qu(e){return Ia(`${Xa.v1}/${e}/renewals/`,{})}async function Xu(e,{paymentMethodId:t,planId:n}){return Ia(`${Xa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zu(){return ka(Ya.plans.v1)}async function ed(e){return ka(`${Ya.plans.v1}/${e}`)}async function td(){return ka(Ya.invoices.v1)}async function nd(e){return ka(`${Ya.invoices.v1}/${e}`)}async function id(e,t){return ka(`${Ya.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const od=["email"];async function ad(){return ka(Ya.paymentMethods.v1)}async function rd(e){return ka(`${Ya.paymentMethods.v1}/${e}`)}async function sd(e,t){let{email:n}=t,i=Ei(t,od);return Pa(`${Ya.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function ld(e){return Ta(Ya.paymentProviders.stripe.subscriptions.v1,e)}async function cd(e){return ka(`${Ya.paymentProviders.stripe.customers.v1}/${e}`)}async function ud(e){return Ta(`${Ya.paymentProviders.stripe.customers.v1}`,e)}async function dd(){return ka(`${Ya.paymentProviders.stripe.publicConfigurations.v1}`)}async function yd(e){return Ta(`${Ya.paymentProviders.stripe.setupIntents.v1}`,e)}async function fd(e){return ka(`${Ya.summaries.v1}/${e}`)}async function gd(e){return ka(`${Ya.tenantConfiguration.v1}/${e}`)}async function pd(e){return Ta(`${Ya.tenantConfiguration.v1}`,e)}async function Sd(){return ka(Qa.v1)}async function vd(){return ka(`${Ya.configurations.vendorPublicConfigurations.v1}`)}let hd,md,bd,Ad,kd,Td;async function Pd(){return ka("/vendors/public")}async function Id(e){return ka($a.v1,e)}async function Ld(e){return Ta($a.v1,e)}async function Ed(e,t){return La($a.v1,e,{headers:Oa(t)})}async function Od(e,t,n){return Ta(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function wd(e,t,n){return La(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function Cd(e,t,n){return Pa(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function Dd(e,t){return Ta(Ha.v1,e,{headers:Oa(t)})}async function Rd(e,t){return La(`${Ha.v1}/${e}`,void 0,{headers:Oa(t)})}async function Ud(e,t,n){return Ia(`${$a.v1}/${e}/access`,t,{headers:Oa(n)})}async function _d(e,t){return Ta(`${$a.v2}/`,e,{headers:Oa(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(hd||(hd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(md||(md={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bd||(bd={})),(Ad||(Ad={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(kd||(kd={})),function(e){e.CREATE="create_customer"}(Td||(Td={}));const Md={flags:{}};class Nd{constructor(){var e;this._flags={},this._flags=null!=(e=Md.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Nd;return n.set(e),Nd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=C({},null!=(t=null==Md?void 0:Md.flags)?t:{},null!=e?e:{})}}async function Fd(){return ka(rr)}async function $d(){return ka(`${sr}`)}async function Gd(e,t){return Pa(`${sr}/${e}`,t)}async function xd(e){return Ta(`${sr}`,e)}async function Vd(e){return La(`${sr}/${e}`)}async function jd(e){return ka(`${lr}/${e}/Users/count`)}async function Wd(e){return Ta(`${Ga.v1}`,e)}Nd._instances={};const Bd=["groupId"];async function Kd({groupId:e},t){return ka(`${xa.v1}/${e}`,C({},t))}async function zd(e){return ka(`${xa.v1}`,C({},e))}async function qd(e,t){return Ta(`${xa.getByIds.v1}`,e,{params:t})}async function Hd(e){return Ta(`${xa.v1}`,e)}async function Jd(e){let{groupId:t}=e,n=Ei(e,Bd);return Pa(`${xa.v1}/${t}`,n)}async function Yd(e){return La(`${xa.v1}/${e}`)}async function Qd(e,t){return Ta(`${xa.v1}/${e}/roles`,t)}async function Xd(e,t){return La(`${xa.v1}/${e}/roles`,t)}async function Zd(e,t){return Ta(`${xa.v1}/${e}/users`,t)}async function ey(e,t){return La(`${xa.v1}/${e}/users`,t)}async function ty(){return ka(`${xa.configurations.v1}`)}async function ny(e){return Ta(`${xa.configurations.v1}`,e)}async function iy(e){return Ta(`${Da.v3}/me/token`,e)}async function oy(e,t){return ka(Da.v3,e,{headers:Oa(t)})}async function ay(){return ka(cr)}let ry,sy,ly,cy,uy;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(ry||(ry={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(sy||(sy={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ly||(ly={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(cy||(cy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(uy||(uy={}));const dy=[/^(.*)\/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],yy=`${Ca.v1}/user/token/refresh`,fy=`${ar}/authorize/silent`,gy=`${Da.v2}/me`,py=`${Da.v2}/me/tenants`;let Sy,vy,hy,my,by;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Sy||(Sy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(vy||(vy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(hy||(hy={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(my||(my={})),function(e){e.ASC="ASC",e.DESC="DESC"}(by||(by={}));const Ay={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h,groups:m,users:b,entitlements:A};var ky={fetch:e,ContextHolder:fa,FronteggContext:ga,api:Ay,FronteggApiError:ha,AuthStrategyEnum:jr,MachineToMachineAuthStrategy:Wr,SocialLoginProviders:Vr,ISubscriptionCancellationPolicy:bd,ISubscriptionStatus:hd,PaymentMethodType:md,ProviderType:Ad};let Ty,Py;!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(Ty||(Ty={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Py||(Py={}));const Iy="input is invalid type",Ly="undefined"!=typeof ArrayBuffer,Ey="0123456789abcdef".split(""),Oy=[-2147483648,8388608,32768,128],wy=[24,16,8,0],Cy=[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],Dy=["hex","array","digest","arrayBuffer"],Ry=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Ly&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Uy=function(e){return function(t){const n=new My(!0).update(t);return null==n?void 0:n[e]()}},_y=function(e){return function(t,n){const i=new Ny(t,!0).update(n);return null==i?void 0:i[e]()}};class My{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>My.prototype.digest(),e?(Ry[0]=Ry[16]=Ry[1]=Ry[2]=Ry[3]=Ry[4]=Ry[5]=Ry[6]=Ry[7]=Ry[8]=Ry[9]=Ry[10]=Ry[11]=Ry[12]=Ry[13]=Ry[14]=Ry[15]=0,this.blocks=Ry):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Iy);if(null===e)throw new Error(Iy);if(Ly&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Ly&&ArrayBuffer.isView(e)))throw new Error(Iy);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<wy[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<wy[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<wy[3&o++],s[o>>2]|=(128|i>>6&63)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<wy[3&o++],s[o>>2]|=(128|i>>12&63)<<wy[3&o++],s[o>>2]|=(128|i>>6&63)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Oy[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,o,a,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,g=this.h3,p=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,g=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),s=d&y,i=s^d&f^u,r=p&S^~p&v,o=h+n+r+Cy[e]+m[e],a=t+i,h=g+o<<0,g=o+a<<0),t=(g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=g&d,i=l^g&y^s,r=h&p^~h&S,o=v+n+r+Cy[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&g,i=c^f&d^l,r=v&h^~v&p,o=S+n+r+Cy[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&g^c,r=S&v^~S&h,o=p+n+r+Cy[e+3]+m[e+3],a=t+i,p=d+o<<0,d=o+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+g<<0,this.h4=this.h4+p<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=Ey[e>>28&15]+Ey[e>>24&15]+Ey[e>>20&15]+Ey[e>>16&15]+Ey[e>>12&15]+Ey[e>>8&15]+Ey[e>>4&15]+Ey[15&e]+Ey[t>>28&15]+Ey[t>>24&15]+Ey[t>>20&15]+Ey[t>>16&15]+Ey[t>>12&15]+Ey[t>>8&15]+Ey[t>>4&15]+Ey[15&t]+Ey[n>>28&15]+Ey[n>>24&15]+Ey[n>>20&15]+Ey[n>>16&15]+Ey[n>>12&15]+Ey[n>>8&15]+Ey[n>>4&15]+Ey[15&n]+Ey[i>>28&15]+Ey[i>>24&15]+Ey[i>>20&15]+Ey[i>>16&15]+Ey[i>>12&15]+Ey[i>>8&15]+Ey[i>>4&15]+Ey[15&i]+Ey[o>>28&15]+Ey[o>>24&15]+Ey[o>>20&15]+Ey[o>>16&15]+Ey[o>>12&15]+Ey[o>>8&15]+Ey[o>>4&15]+Ey[15&o]+Ey[a>>28&15]+Ey[a>>24&15]+Ey[a>>20&15]+Ey[a>>16&15]+Ey[a>>12&15]+Ey[a>>8&15]+Ey[a>>4&15]+Ey[15&a]+Ey[r>>28&15]+Ey[r>>24&15]+Ey[r>>20&15]+Ey[r>>16&15]+Ey[r>>12&15]+Ey[r>>8&15]+Ey[r>>4&15]+Ey[15&r];return l+=Ey[s>>28&15]+Ey[s>>24&15]+Ey[s>>20&15]+Ey[s>>16&15]+Ey[s>>12&15]+Ey[s>>8&15]+Ey[s>>4&15]+Ey[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class Ny extends My{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(Iy);if(null===e)throw new Error(Iy);if(Ly&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Ly&&ArrayBuffer.isView(e)))throw new Error(Iy)}var o;e.length>64&&(e=null==(o=new My(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}My.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();My.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),My.prototype.finalize.call(this)}}}const Fy=function(){const e=Uy("hex");e.create=function(){return new My},e.update=function(t){return e.create().update(t)};for(let t=0;t<Dy.length;++t){const n=Dy[t];e[n]=Uy(n)}return e}();function $y(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Gy(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=Fy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function xy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=_y("hex");e.create=function(e){return new Ny(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Dy.length;++t){const n=Dy[t];e[n]=_y(n)}}();const Vy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*jy(e){const t=yield ho((e=>e.root.appName));return Nd.getFeatureFlags(e,t)}const Wy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},By=C({},Wy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Ky=[{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"}],zy={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},qy=C({},zy,{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}),Hy={loading:!1,error:void 0,saving:!0,profile:zy},Jy={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"},Yy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:jr.EmailAndPassword,machineToMachineAuthStrategy:Wr.ClientCredentials},Qy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Xy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Zy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},ef={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},tf={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},nf=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],of={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:ef,roles:nf,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},af=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],rf={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:[Ky[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Ky[0]],managedBy:hy.FRONTEGG}]},sf={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:[Ky[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Ky[0]],managedBy:hy.FRONTEGG}]},lf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},cf=[sf,rf],uf=[lf],df=[{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}],yf=[{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"}],ff={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},gf={isActive:!0,strategy:xn.ALLOW},pf=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],Sf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},sf,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},vf=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"}),hf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Sf(6),roles:[vf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:hy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Sf(44),roles:[vf("Editor")],managedBy:hy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Sf(8),roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Sf(5),roles:[vf("Admin")],managedBy:hy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Sf(21),description:"BDR, AE, and inside sales",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Sf(23),description:"Dev success and customer success",roles:[vf("Admin")],managedBy:hy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Sf(10),description:"The marketing department",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Sf(4),description:"Human resources",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Sf(3),roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Sf(8),roles:[vf("Editor")],managedBy:hy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Sf(4),roles:[vf("Viewer")],managedBy:hy.FRONTEGG}];let mf,bf,Af;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(mf||(mf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(bf||(bf={})),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"}(Af||(Af={})),Af.profile,Af.privacy,Af.personalApiTokens,Af.account,Af.users,Af.groups,Af.security,Af.sso,Af.audits,Af.webhooks,Af.apiTokens,Af.roles,Af.subscriptions;const kf=["events","url"];function*Tf(){yield yo(gi.setSignUpState({loading:!0}));try{const e=yield po(Ay.auth.getVendorConfig),[t]=(yield po(Ay.auth.getVendorPublicAuthStrategiesConfig),yield po(jy,["admin_portal_login_per_tenant"]));if(t){const t=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield yo(gi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield yo(gi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Pf(e){let{payload:{events:t,url:n}}=e,i=Ei(e.payload,kf);yield yo(gi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield ho((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield po(Ay.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:bf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(fa.setAccessToken(null==s?void 0:s.accessToken),fa.setUser(s),!r&&s&&xg(s)){const t=yield Wg(s);yield yo(gi.setState(t)),a(e.loginUrl)}else yield yo(gi.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield yo(gi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield yo(gi.loadTenants()))}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setSignUpState({loading:!1,error:e.message}))}yield yo(gi.setSignUpState({loading:!1}))}function*If(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield ho((e=>e.auth.signUpState));yield yo(gi.resetSignUpState()),yield yo(gi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Lf(){yield ya(gi.signUpUser,Pf),yield ya(gi.resetSignUpStateSoft,If)}const Ef={setVendorState:(e,{payload:t})=>C({},e,t)},Of={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},wf={loading:!1},{reducer:Cf,actions:Df}=ut({name:Rt,initialState:wf,reducers:C({},Ef)}),Rf=C({},Df,Of);function*Uf(){yield yo(Rf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Ay.vendor.getVendorPublicInfo();yield yo(Rf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield yo(Rf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const _f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"];function*xf(){yield yo(gi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getGlobalSecurityPolicy);yield yo(gi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield yo(gi.loadSecurityPolicyMfa()),yield yo(gi.loadSecurityPolicyVendorMfa()),yield yo(gi.loadSecurityPolicyLockout()),yield yo(gi.loadSecurityPolicyVendorLockout()),yield yo(gi.loadSecurityPolicyVendorPasswordHistory()),yield yo(gi.loadSecurityPolicyCaptcha()),yield yo(gi.loadPublicAuthStrategiesPolicy())}function*Vf(){yield yo(gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorConfig),[t]=yield po(jy,["admin_portal_login_per_tenant"]);if(t){const t=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield yo(gi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*jf(){yield yo(gi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);yield yo(gi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Wf(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getMfaPolicy);yield yo(gi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Bf(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorMfaPolicy);yield yo(gi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,_f);yield yo(gi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield po(Ay.auth.saveMfaPolicy,n);yield yo(gi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zf(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getLockoutPolicy);yield yo(gi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*qf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Mf);yield yo(gi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield po(Ay.auth.saveLockoutPolicy,n);yield yo(gi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hf(){yield yo(gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorLockoutPolicy);yield yo(gi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Jf(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCaptchaPolicy);yield yo(gi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Yf(){yield yo(gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getPasswordHistoryPolicy);yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Qf(){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorPasswordHistoryPolicy);yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Xf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Nf);yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield po(Ay.auth.savePasswordHistoryPolicy,n);yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Zf(){yield yo(gi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getPasswordConfigPolicy);yield yo(gi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*eg(){yield ya(gi.loadSecurityPolicy,xf),yield ua(gi.saveSecurityPolicyMfa,Kf),yield ua(gi.loadSecurityPolicyMfa,Wf),yield ua(gi.loadSecurityPolicyVendorMfa,Bf),yield ua(gi.saveSecurityPolicyLockout,qf),yield ua(gi.loadSecurityPolicyLockout,zf),yield ua(gi.loadSecurityPolicyVendorLockout,Hf),yield ua(gi.loadSecurityPolicyCaptcha,Jf),yield ua(gi.saveSecurityPolicyPasswordHistory,Xf),yield ua(gi.loadSecurityPolicyPasswordHistory,Yf),yield ua(gi.loadSecurityPolicyVendorPasswordHistory,Qf),yield ua(gi.loadVendorPasswordConfig,Zf),yield ua(gi.loadPublicSecurityPolicy,Vf),yield ua(gi.loadPublicAuthStrategiesPolicy,jf)}function*tg(){yield yo(gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield yo(gi.setSecurityPolicyPublicState({policy:Yy,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ng(){yield yo(gi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyGlobalState({policy:Jy,loading:!1})),yield yo(gi.loadSecurityPolicyMfa()),yield yo(gi.loadSecurityPolicyVendorMfa()),yield yo(gi.loadSecurityPolicyLockout()),yield yo(gi.loadSecurityPolicyVendorLockout()),yield yo(gi.loadSecurityPolicyPasswordHistory()),yield yo(gi.loadSecurityPolicyVendorPasswordHistory()),yield yo(gi.loadSecurityPolicyCaptcha())}function*ig(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyMfaState({policy:Qy,loading:!1}))}function*og(){yield yo(gi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorMfaState({policy:Qy,loading:!1}))}function*ag(e){var t;let{payload:{callback:n}}=e,i=Ei(e.payload,Ff);yield yo(gi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},Xy,{id:null!=(t=i.id)?t:Xy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield yo(gi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*rg(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyLockoutState({policy:Xy,loading:!1}))}function*sg(){yield yo(gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorLockoutState({policy:Xy,loading:!1}))}function*lg(e){let{payload:{callback:t}}=e,n=Ei(e.payload,$f);yield yo(gi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},Xy,n,{id:n.id?n.id:Xy.id});null==t||t(i),yield yo(gi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*cg(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyLockoutState({policy:Xy,loading:!1}))}function*ug(){yield yo(gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:Zy,loading:!1}))}function*dg(){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({policy:Zy,loading:!1}))}function*yg(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Gf);yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},Zy,n,{id:n.id?n.id:Zy.id});null==t||t(i),yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*fg(){yield ya(gi.loadSecurityPolicy,ng),yield ua(gi.loadPublicSecurityPolicy,tg),yield ua(gi.saveSecurityPolicyMfa,ag),yield ua(gi.loadSecurityPolicyMfa,ig),yield ua(gi.loadSecurityPolicyVendorMfa,og),yield ua(gi.saveSecurityPolicyLockout,lg),yield ua(gi.loadSecurityPolicyLockout,rg),yield ua(gi.loadSecurityPolicyVendorLockout,sg),yield ua(gi.loadSecurityPolicyCaptcha,cg),yield ua(gi.saveSecurityPolicyPasswordHistory,yg),yield ua(gi.loadSecurityPolicyPasswordHistory,ug),yield ua(gi.loadSecurityPolicyVendorPasswordHistory,dg)}const gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},pg=e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t};function*Sg(){yield yo(gi.setEntitlementsState({loading:!0,error:null}));try{const e=yield po(Ay.entitlements.loadEntitlements);yield yo(gi.setEntitlementsState({entitlements:e,loading:!1}))}catch(e){yield yo(gi.setEntitlementsState({error:e.message,loading:!1}))}}function*vg(){yield ya(gi.loadEntitlements,Sg)}const hg=["callback"],mg=["callback"],bg=["callback"],Ag=["callback"],kg=["callback","events"],Tg=["callback"],Pg=["callback"],Ig=["callback"],Lg=["callback"],Eg=["callback"],Og=["callback"],wg=["callback"],Cg=["callback"],Dg=["callback"],Rg=["callback","deviceId"],Ug=["callback","deviceId"],_g=["callback","deviceId"],Mg=["callback","deviceId"],Ng={[jr.Code]:Pt.loginWithOtc,[jr.EmailAndPassword]:Pt.loginWithPassword,[jr.MagicLink]:Pt.magicLinkPreLoginSuccess,[jr.SmsCode]:Pt.loginWithSmsOtc};function*Fg(){const e=fa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield ho((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=fa.getContext()).tenantResolver)&&d.call(y)&&(yield po(Zg),u=yield ho((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),yo(gi.resetLoginState());const g=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u?pg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(g,{refresh:g.startsWith("http")})}function*$g(){let e;try{var t;const n=yield po(Ay.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield yo(gi.setState({ssoACS:e}))}function*Gg(){try{const{isActive:e}=yield po(Ay.auth.getSSOPublicConfiguration);yield yo(gi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const xg=e=>e.mfaRequired&&e.mfaToken?(fa.setAccessToken(null),fa.setUser(null),!0):(fa.setAccessToken(e.accessToken),fa.setUser(e),!1),Vg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},jg=e=>{if(1===e.length){const[t]=e;if(t===ly.AuthenticatorApp)return an.authenticatorApp;if(t===ly.SMS)return an.smsSetPhoneNumber}return an.verify};function*Wg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield ho((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield po(Ay.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Vg(e.mfaDevices)}:(n={step:jg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Bg(e){var t;const{routes:n,loginState:i}=yield ho((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*Kg(){const[e]=yield po(jy,["admin_portal_entitlements"]);e&&(yield po(Sg))}function*zg(){const{hostedLoginBox:e}=yield ho((e=>e.auth));e?yield po(qg):yield po(Jg),yield Kg()}function*qg(){const{user:e}=yield ho((e=>e.auth));if(null==e||!e.refreshToken)return fa.setAccessToken(null),fa.setUser(null),void(yield yo(gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield po(Ay.auth.exchangeOAuthTokens,t);yield yo(gi.setState({user:n,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:null,isAuthenticated:!1}))}}function*Hg(){const{user:e}=yield ho((e=>e.auth));if(null==e||!e.refreshToken)return fa.setAccessToken(null),fa.setUser(null),void(yield yo(gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield po(Ay.auth.exchangeOAuthTokens,t);yield yo(gi.setState({user:n,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:null,isAuthenticated:!1}))}}function*Jg(){try{const t=fa.onRedirectTo,{routes:n,loginState:i}=yield ho((e=>e.auth)),{user:o,tenants:a}=yield po(Ay.auth.refreshTokenV2);if(xg(o)){const e=yield Wg(o);yield yo(gi.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 Bg(o);yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield Qg(n)}}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:void 0,isAuthenticated:!1}))}}function*Yg(){try{const t=fa.onRedirectTo,{routes:n,loginState:i}=yield ho((e=>e.auth)),{user:o,tenants:a}=yield po(Ay.auth.refreshTokenV2);if(xg(o)){const e=yield Wg(o);yield yo(gi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield po(up))yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.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 Bg(o);yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield Qg(n)}}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:void 0,isAuthenticated:!1}))}}function*Qg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=fa.onRedirectTo,{routes:o,loginState:a}=yield ho((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 Fg())}function*Xg({payload:{callback:e}}){try{const{ip:t}=yield po(Ay.metadata.getCurrentUserIpMetadata);yield yo(gi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Zg(){try{var e,t;if(null!=(e=fa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield ho((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield po(Du);var n;t&&i&&(yield yo(gi.setState({routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+gg(t))?n:""})})))}}catch{}}function*ep({payload:e}){const t=[];e&&(yield yo(gi.setState({isLoading:!0})),yield yo(gi.loadSocialLoginsConfigurationV2()),t.push(po(Tf)),t.push(po(jf)),t.push(po(Gg)),t.push(po(Uf)),t.push(po($g)),t.push(po(Zg))),t.push(po(zg)),yield fo(t),yield yo(gi.setState({isLoading:!1}))}function*tp({accessToken:e,user:t}){if(!e)return void(yield yo(gi.setState({user:void 0,isAuthenticated:!1})));const n=fa.onRedirectTo,{routes:i}=yield ho((e=>e.auth));if(xg(t)){const e=yield Wg(t);yield yo(gi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*np({payload:e}){const t=[];yield yo(gi.loadSocialLoginsConfigurationV2()),t.push(po(Tf)),t.push(po(Gg)),t.push(po(Uf)),t.push(po($g)),t.push(po(tp,e)),t.push(po(Zg)),yield fo(t)}function*ip({payload:e}){const{disableSilentRefresh:t}=yield ho((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield po(Ay.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.loadTenants()),yield yo(gi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield ho((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 yo(gi.setState({isLoading:!0}));const a=xy(),r=xy(),s=yield po(Gy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield op();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${ma(n,"/oauth/authorize")}/oauth/authorize`,d=C({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*op(){try{var e,t;if(null!=(e=fa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield po(Zg);const e=yield ho((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return gg(e)}}catch{}}function*ap({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield ho((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield op();a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield po(Ay.auth.exchangeOAuthTokens,r);yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Fg()}}function*rp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,hg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.changePhoneNumberWithVerification,n);yield yo(gi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1}))}}function*sp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mg);try{yield yo(gi.setLoginState({loading:!0})),yield po(Ay.auth.verifyChangePhoneNumber,n),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1}))}}function*lp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,bg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.passwordlessPreLogin,C({},n,{type:jr.SmsCode}));yield yo(gi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*cp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Ag);try{const{onRedirectTo:e,routes:i}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield yo(gi.setLoginState({loading:!0}));const o=yield po(Ay.auth.passwordlessPreLogin,n),a=Ng[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield yo(gi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield yo(gi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*up(){const{publicAuthStrategyPolicy:e}=yield ho((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===ry.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield po(jy,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield po(Ay.auth.getWebAuthnDevices);return yield yo(gi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*dp(e){let{payload:{callback:t,events:n}}=e,i=Ei(e.payload,kg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.passwordlessPostLogin,i),a=fa.onRedirectTo,{routes:r}=yield ho((e=>e.auth));if(xg(e)){const t=yield Wg(e);yield yo(gi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield ho((e=>e.auth)),s=yield po(Ay.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:mf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield yo(gi.setState({user:s})),yield yo(gi.setLoginState({error:void 0})),yield yo(gi.loadTenants()),yield yo(gi.setState({isLoading:!1})),i.flow===It.Login?(yield po(up))?(yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield yo(gi.setState({isAuthenticated:!0})),yield Fg()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield yo(gi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield yo(gi.setLoginState({loading:!1}))}}function*yp({payload:e}){try{yield yo(gi.setLoginState({loading:!0}));const{name:t}=yield po(Ay.auth.verifyInviteToken,e);yield yo(gi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield yo(gi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield yo(gi.setLoginState({loading:!1}))}}function*fp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield yo(gi.setLoginState({loading:!0}));try{const o=yield ho((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield po(Ay.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Py.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield ho((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield yo(gi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield gp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield gp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*gp(e){let{callback:t}=e,n=Ei(e,Tg);const i=yield ho((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===jr.EmailAndPassword?(yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[jr.MagicLink,jr.Code,jr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield yo(gi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*pp({payload:{callback:e}}){try{yield yo(gi.setLoginState({loading:!0}));const{options:t}=yield po(Ay.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield yo(gi.setLoginState({error:t.message})),null==e||e(null)}finally{yield yo(gi.setLoginState({loading:!1}))}}function*Sp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Pg);try{yield yo(gi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?sy.Platform:sy.CrossPlatform;yield po(Ay.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setLoginState({loading:!1}))}}function*vp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Ig);try{var i;yield yo(gi.setPasskeysState({loading:!0})),yield yo(gi.setLoginState({loading:!0}));const{options:e}=yield po(Ay.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield yo(gi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setPasskeysState({loading:!1})),yield yo(gi.setLoginState({loading:!1}))}}function*hp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Lg);try{var i;yield yo(gi.setPasskeysState({loading:!0})),yield yo(gi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield po(Ay.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(xg(o)){const e=fa.onRedirectTo,{routes:t}=yield ho((e=>e.auth)),n=yield Wg(o);yield yo(gi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield po(Ay.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield yo(gi.loadTenants()),yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.setLoginState({error:void 0})),yield Fg(),null==t||t(!0)}}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setPasskeysState({loading:!1})),yield yo(gi.setLoginState({loading:!1}))}}function*mp({payload:e}){const{onRedirectTo:t,routes:n}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield yo(gi.setLoginState({loading:!0}));try{const t=yield po(Ay.auth.postLogin,e);fa.setAccessToken(t.accessToken),fa.setUser(t),yield yo(gi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Fg()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield yo(gi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*bp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield yo(gi.setLoginState({loading:!0}));try{const a=yield po(Ay.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});fa.setAccessToken(a.accessToken),fa.setUser(a);const r=fa.onRedirectTo,{routes:s}=yield ho((e=>e.auth));if(xg(a)){const e=yield Wg(a);yield yo(gi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield ho((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield yo(gi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield yo(gi.loadTenants()),n&&t.flow===It.Login&&((yield po(up))?(yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Fg())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){fa.setAccessToken(null),fa.setUser(null),null==o||o(!1,t),yield yo(gi.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ap({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield yo(gi.setLoginState({loading:!0}));try{const o=yield po(Ay.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield ho((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield yo(gi.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 yo(gi.loadTenants()),yield yo(gi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield po(up))?yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Fg()),null==i||i(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*kp({payload:e}){yield yo(gi.setLoginState({loading:!0}));try{var t;yield po(Ay.auth.recoverMfaToken,e),yield yo(gi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield yo(gi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Tp({payload:e}){const{hostedLoginBox:t}=yield ho((e=>e.auth));yield yo(gi.setState({isLoading:!0}));try{t?yield po(Ay.auth.OAuthLogout):yield po(Ay.auth.logout)}catch{}yield yo(gi.resetState()),yield yo(gi.requestAuthorize(!0)),null==e||e()}function*Pp({payload:e}){var t;try{yield po(Ay.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*Ip({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield yo(gi.setMfaState(n)),yield yo(gi.setUser(e)),yield yo(gi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Lp({user:e,tenants:t}){const{loginState:n}=yield ho((e=>e.auth));yield yo(gi.setUser(e)),yield yo(gi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield ho((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield po(up);i===an.smsVerifyCode&&e?yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Fg()}yield yo(gi.setState({isAuthenticated:!0}))}function*Ep(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Eg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.preEnrollMFASMSForLogin,n);yield yo(gi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Op(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Og);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.enrollMFASMSForLogin,n),i=yield po(Ay.auth.generateLoginResponseV2,e);yield Ip(i),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,wg);yield yo(gi.setLoginState({loading:!0}));try{var i;const e=yield po(Ay.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Cg);yield yo(gi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield po(Ay.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield po(Ay.auth.generateLoginResponseV2,i);yield Ip(o),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Dg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield po(Ay.auth.generateLoginResponseV2,e);yield Ip(i),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Rg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.preVerifyMFASMSForLogin,n,i);yield yo(gi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Ug);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.verifyMFASMSForLogin,n,i),o=yield po(Ay.auth.generateLoginResponseV2,e);yield Lp(o),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_p(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,_g);yield yo(gi.setLoginState({loading:!0}));try{var o;const e=yield po(Ay.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Mg);yield yo(gi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield po(Ay.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield po(Ay.auth.generateLoginResponseV2,o);yield Lp(a),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(){yield ya(gi.requestAuthorize,ep),yield ya(gi.requestAuthorizeSSR,np),yield ya(gi.requestHostedLoginAuthorize,ip),yield ya(gi.handleHostedLoginCallback,ap),yield ya(gi.preLogin,fp),yield ya(gi.postLogin,mp),yield ya(gi.login,bp),yield ya(gi.logout,Tp),yield ya(gi.silentLogout,Pp),yield ya(gi.loginWithMfa,Ap),yield ya(gi.recoverMfa,kp),yield ya(gi.quickSmsPasswordlessPreLogin,lp),yield ya(gi.changePhoneNumberWithVerification,rp),yield ya(gi.verifyChangePhoneNumber,sp),yield ya(gi.passwordlessPreLogin,cp),yield ya(gi.passwordlessPostLogin,dp),yield ya(gi.verifyInviteToken,yp),yield ya(gi.webAuthnPrelogin,vp),yield ya(gi.webAuthnPostLogin,hp),yield ya(gi.webAuthnCreateNewDeviceSession,pp),yield ya(gi.webAuthnVerifyNewDeviceSession,Sp),yield ya(gi.afterAuthNavigation,Fg),yield ya(gi.getUserIP,Xg),yield ya(gi.preEnrollMFASMSForLogin,Ep),yield ya(gi.enrollMFASMSForLogin,Op),yield ya(gi.preEnrollMFAWebAuthnForLogin,wp),yield ya(gi.enrollMFAWebAuthnForLogin,Cp),yield ya(gi.enrollMFAAuthenticatorAppForLogin,Dp),yield ya(gi.preVerifyMFASMSForLogin,Rp),yield ya(gi.verifyMFASMSForLogin,Up),yield ya(gi.preVerifyMFAWebAuthnForLogin,_p),yield ya(gi.verifyMFAWebAuthnForLogin,Mp)}function*Fp({payload:e}){e&&(yield yo(gi.setState({isLoading:!0})));const t=qy;yield yo(gi.loadTenants()),yield yo(gi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*$p({payload:{callback:e}}){try{const{ip:t}=pf[0];yield yo(gi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Gp(){yield ya(gi.requestAuthorize,Fp),yield ya(gi.afterAuthNavigation,Fg),yield ya(gi.getUserIP,$p)}const xp=["callback","samlVendor"],Vp=["callback","samlVendor"];function*jp(){try{var e,t;yield yo(gi.setSSOState({loading:!0}));const n=yield po(Ay.auth.getSamlConfiguration),i=yield po(Ay.auth.getOidcConfiguration),o=yield po(Ay.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 yo(gi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSSOState({error:e.message,loading:!1}))}}function*Wp({payload:e}){const t=yield ho((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield yo(gi.setSSOState({error:void 0,[n]:!0}));try{const i=yield Vy(e[0]),o=yield po(Ay.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield yo(gi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Bp({payload:e}){const{configFile:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield yo(gi.setSSOState({error:void 0,[o]:!0}));try{const e=yield Vy(t),a=yield po(Ay.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield yo(gi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Kp({payload:e}){const{callback:t,samlVendor:n}=e,i=Ei(e,xp),o=yield ho((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield yo(gi.setSSOState({samlConfiguration:C({},o,a)})));if(yield yo(gi.setSSOState({error:void 0,[r]:!0})),e.type===Py.Saml){var s,l;const e=yield po(Ay.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=$y(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 po(Ay.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield yo(gi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*zp({payload:{callback:e}={}}){const t=yield ho((e=>e.auth.ssoState.samlConfiguration));try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.validateSamlDomain),yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*qp(){try{const e=yield po(Ay.auth.getSamlRoles),t=yield po(Ay.auth.getSamlRolesGroups);yield yo(gi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield yo(gi.setSSOState({error:e.message}))}}function*Hp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield fo(e.map((e=>po(Ay.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield yo(gi.setSSOState({error:e.message}))}}(n)),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Jp({payload:{callback:e,id:t}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.deleteSamlGroup,{id:t}),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Yp({payload:{group:e,roleIds:t,callback:n}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.createSamlGroup,{group:e,roleIds:t}),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield yo(gi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Qp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield yo(gi.setSSOState({loading:!0})),yield po(Ay.auth.oidcPostLoginV2,t),yield po(zg),yield yo(gi.setSSOState({loading:!1}))}catch(e){var n;yield yo(gi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Xp(){yield ua(gi.loadSSOConfigurations,jp),yield ua(gi.saveSSOConfigurations,Kp),yield ua(gi.saveSSOConfigurationsFile,Wp),yield ua(gi.saveSSOConfigurationsFileWithCallback,Bp),yield ua(gi.validateSSODomain,zp),yield ua(gi.loadSSOAuthorizationRoles,qp),yield ua(gi.updateSSOAuthorizationRoles,Hp),yield ua(gi.deleteSamlGroup,Jp),yield ua(gi.createSamlGroup,Yp),yield ua(gi.oidcPostlogin,Qp)}function*Zp(){yield yo(gi.setSSOState({loading:!0})),yield mt(),yield yo(gi.setSSOState({samlConfiguration:ef,loading:!1,firstLoad:!1}))}function*eS({payload:e}){const t="saving";yield yo(gi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield ho((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield yo(gi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*tS({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ei(e,Vp),r=of.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield yo(gi.setSSOState({samlConfiguration:C({},r,s)})));yield yo(gi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==tf||null==(t=tf.configuration)?void 0:t.acsUrl,s.spEntityId=null==tf||null==(n=tf.configuration)?void 0:n.spEntityId;const c=$y(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield mt(),yield yo(gi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*nS({payload:{callback:e}={}}){const t=of.samlConfiguration;yield yo(gi.setSSOState({error:void 0,saving:!0})),yield mt(),yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*iS(){yield mt(),yield yo(gi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*oS({payload:{callback:e,authorizationRoles:t}}){yield yo(gi.setSSOState({error:void 0,saving:!0})),yield mt(),yield yo(gi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*aS(){yield ua(gi.loadSSOConfigurations,Zp),yield ua(gi.saveSSOConfigurations,tS),yield ua(gi.saveSSOConfigurationsFile,eS),yield ua(gi.validateSSODomain,nS),yield ua(gi.loadSSOAuthorizationRoles,iS),yield ua(gi.updateSSOAuthorizationRoles,oS)}const rS=["callback"],sS=["callback","ssoConfigId"],lS=["callback","ssoConfigId"],cS=["callback","ssoConfigId"];function*uS(){try{return yield po(Ay.auth.getOidcConfiguration)}catch(e){return null}}function*dS(){try{return yield po(Ay.metadata.getSamlMetadata)}catch(e){return null}}function*yS(){try{yield yo(gi.setSSOLoader({key:Ty.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield fo([po(uS),po(dS)]),n=yield po(Ay.auth.getSSOConfigurations);yield yo(gi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield yo(gi.setSSOError({key:Ty.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield yo(gi.setSSOLoader({key:Ty.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*fS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ei(e,rS),i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield po(Ay.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield yo(gi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!1}))}}function*gS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vy(t),o=yield po(Ay.auth.createSSOConfigurationByMetadata,{metadata:e});yield yo(gi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*pS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ei(e,sS),o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield po(Ay.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*SS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vy(i),a=yield po(Ay.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield yo(gi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*vS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.deleteSSOConfiguration,t),yield yo(gi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_CONFIGURATION,value:!1}))}}function*hS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ei(e,lS);yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield po(Ay.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_DOMAIN,value:!1}))}}function*mS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield yo(gi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_DOMAIN,value:!1}))}}function*bS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield yo(gi.setSSOLoader({key:Ty.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield yo(gi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.VALIDATE_SSO_DOMAIN,value:!1}))}}function*AS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield yo(gi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*kS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(t.map((e=>po(Ay.auth.deleteSSOGroup,n,e)))),yield fo(e.map((e=>po(Ay.auth.createSSOGroup,n,e))));const a=yield po(Ay.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield yo(gi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!1}))}}function*TS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield fo(t.map((t=>po(Ay.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!1}))}}function*PS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield po(ka,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield po(Ay.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield po(Ay.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield yo(gi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*IS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ei(e,cS),o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield po(Ay.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield po(Ay.auth.createSSOConfiguration,i),a=[e,...o]),yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*LS(){yield ua(gi.loadSSOConfigurationsV2,yS),yield ua(gi.saveSSOConfigurationV2,fS),yield ua(gi.saveSSODomain,hS),yield ua(gi.deleteSSODomain,mS),yield ua(gi.validateSSODomainV2,bS),yield ua(gi.updateSSOConfiguration,pS),yield ua(gi.deleteSSOConfiguration,vS),yield ua(gi.setSSOGroups,kS),yield ua(gi.updateSSOGroups,TS),yield ua(gi.setSSODefaultRoles,AS),yield ua(gi.saveSSOConfigurationByMetadata,gS),yield ua(gi.updateSSOConfigurationByMetadata,SS),yield ua(gi.saveSSOConfigurationByUrl,PS),yield ua(gi.saveSSOConfigurationByData,IS)}const ES=["callback","profilePictureUrl"],OS=["callback","profilePictureUrl"];function*wS(){yield yo(gi.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 po.apply(void 0,[ca,e,t,n].concat(o))}(3,2e3,Ay.teams.getProfile),t=yield ho((e=>e.auth.user));gi.setUser(C({},t,e)),yield yo(gi.setProfileState({profile:e,loading:!1}))}catch(e){yield yo(gi.setProfileState({loading:!1,error:e.message}))}}function*CS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ei(e.payload,ES);yield yo(gi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield ho((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 po(Ay.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield po(Ay.teams.updateProfile,a),s=yield ho((e=>e.auth.user));yield yo(gi.setUser(C({},s,r))),yield yo(gi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield yo(gi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*DS({payload:e}){yield yo(gi.setProfileState({loading:!0}));try{var t;yield po(Ay.teams.changePassword,e),yield yo(gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*RS(){yield ya(gi.loadProfile,wS),yield ua(gi.saveProfile,CS),yield ua(gi.changePassword,DS)}function*US(){yield yo(gi.setProfileState({loading:!0})),yield mt(),yield yo(gi.setUser(C({},qy,zy))),yield yo(gi.setProfileState({loading:!1,profile:zy}))}function*_S(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ei(e.payload,OS);yield yo(gi.setProfileState({saving:!0,error:null}));const o=Hy;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},o.profile,i,{profilePictureUrl:a}),s=qy;yield mt(),yield yo(gi.setUser(C({},s,r))),yield yo(gi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*MS({payload:e}){var t;yield yo(gi.setProfileState({loading:!0})),yield mt(),yield yo(gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*NS(){yield ya(gi.loadProfile,US),yield ua(gi.saveProfile,_S),yield ua(gi.changePassword,MS)}const FS=["callback"],$S=["callback"],GS=["callback"],xS=["deviceId","callback"],VS=["deviceId","callback"],jS=["callback"],WS=["deviceId"],BS=["deviceId"],KS=["callback"],zS=["deviceId"],qS=["callback"];function*HS(e){const{step:t}=yield ho((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*JS(){yield yo(gi.setMfaState({saving:!0}));try{const{qrCode:e}=yield po(Ay.auth.enrollMfa);yield yo(gi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message}))}}function*YS(e){let{payload:{callback:t}}=e,n=Ei(e.payload,FS);yield yo(gi.setMfaState({saving:!0}));try{const e=yield ho((e=>e.auth.user)),i=yield po(Ay.auth.verifyMfa,n),o=yield po(Ay.auth.getMFADevices),a=yield HS(i);yield yo(gi.setMfaState(C({},a,{mfaDevices:o}))),yield yo(gi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*QS(e){let{payload:{callback:t}}=e,n=Ei(e.payload,$S);yield yo(gi.setMfaState({loading:!0}));try{const e=yield po(Ay.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield yo(gi.setMfaState(i)),yield yo(gi.setState({user:e})),yield yo(gi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*XS({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t;yield po(Ay.auth.disableMfa,e);const n=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ZS({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t,n;const i=yield po(Ay.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield yo(gi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*ev(e){let{payload:{callback:t}}=e,n=Ei(e.payload,GS);yield yo(gi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield po(Ay.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield po(Ay.auth.getMFADevices),a=yield HS(i);yield yo(gi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tv(e){let{payload:{deviceId:t,callback:n}}=e;Ei(e.payload,xS),yield yo(gi.setMfaState({saving:!0}));try{var i;const e=yield po(Ay.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*nv(e){let{payload:{deviceId:t,callback:n}}=e,i=Ei(e.payload,VS);yield yo(gi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield po(Ay.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*iv({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t;const n=yield po(Ay.auth.preEnrollMFASMS,e);yield yo(gi.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 yo(gi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ov(e){let{payload:{callback:t}}=e,n=Ei(e.payload,jS);yield yo(gi.setMfaState({saving:!0}));try{const e=yield po(Ay.auth.enrollMFASMS,n),i=yield po(Ay.auth.getMFADevices),o=yield HS(e);yield yo(gi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*av(e){let{payload:{deviceId:t}}=e,n=Ei(e.payload,WS);yield yo(gi.setMfaState({saving:!0}));try{var i;const e=yield po(Ay.auth.preDisableMFASMS,t);yield yo(gi.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 yo(gi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*rv(e){let{payload:{deviceId:t}}=e,n=Ei(e.payload,BS);yield yo(gi.setMfaState({saving:!0}));try{var i;yield po(Ay.auth.disableMFASMS,t,n);const e=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield yo(gi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*sv(){yield yo(gi.setMfaState({loading:!0}));try{yield ho((e=>e.auth.user));const e=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message}))}}function*lv(){yield yo(gi.setMfaState({loading:!0}));try{const e=(yield po(Ay.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield yo(gi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message}))}}function*cv(){yield ua(gi.enrollMfa,JS),yield ua(gi.getMFADevices,sv),yield ua(gi.getMFAStrategies,lv),yield ua(gi.verifyMfa,YS),yield ua(gi.disableMfa,XS),yield ua(gi.verifyMfaAfterForce,QS),yield ua(gi.preDisableMfaSms,av),yield ua(gi.disableMfaSms,rv),yield ua(gi.preEnrollMfaSms,iv),yield ua(gi.enrollMfaSms,ov),yield ua(gi.preEnrollMfaWebAuthn,ZS),yield ua(gi.enrollMfaWebAuthn,ev),yield ua(gi.preDisableMfaWebAuthn,tv),yield ua(gi.disableMfaWebAuthn,nv)}function*uv(){yield yo(gi.setMfaState({saving:!0})),yield yo(gi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*dv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield yo(gi.setMfaState(i)),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*yv(e){let{payload:{callback:t}}=e,n=Ei(e.payload,KS);yield yo(gi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield yo(gi.setMfaState(o)),yield mt(),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield yo(gi.setUser(C({},qy))),null==(t=e.callback)||t.call(e,!0)}function*gv(e){let{}=e,t=Ei(e.payload,zS);yield yo(gi.setMfaState({saving:!0}));try{var n;yield yo(gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield yo(gi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*pv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield yo(gi.setUser(C({},qy))),null==(t=e.callback)||t.call(e,!0)}function*Sv({payload:e}){var t;yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*vv(e){let{payload:{callback:t}}=e;Ei(e.payload,qS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield yo(gi.setMfaState(o)),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*hv(){yield ua(gi.enrollMfa,uv),yield ua(gi.verifyMfa,dv),yield ua(gi.disableMfa,fv),yield ua(gi.verifyMfaAfterForce,yv),yield ua(gi.preDisableMfaSms,gv),yield ua(gi.disableMfaSms,pv),yield ua(gi.preEnrollMfaSms,Sv),yield ua(gi.enrollMfaSms,vv)}const mv=["callback"];function*bv({payload:e}){yield yo(gi.setForgotPasswordState({loading:!0}));try{var t;yield po(Ay.auth.forgotPassword,e),yield yo(gi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*Av(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mv);yield yo(gi.setForgotPasswordState({loading:!0}));try{yield po(Ay.auth.resetPassword,n),yield yo(gi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield yo(gi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*kv({payload:e}){yield yo(gi.setForgotPasswordState({loading:!0}));try{const t=yield po(Ay.auth.loadPasswordConfig,e);yield yo(gi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield yo(gi.setForgotPasswordState({loading:!1,error:e.message}))}}function*Tv(){yield ya(gi.forgotPassword,bv),yield ya(gi.resetPassword,Av),yield ya(gi.loadPasswordConfig,kv)}let Pv;!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"}(Pv||(Pv={}));const Iv=["callback","events"],Lv=["callback"],Ev=["callback"];function*Ov({payload:{userId:e,token:t}}){yield yo(gi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield ho((e=>e.auth));n&&(yield yo(gi.silentLogout()));const i=yield po(Ay.auth.getActivateAccountStrategy,{userId:e,token:t});yield yo(gi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield yo(gi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message}))}}function*wv(e){let{payload:{callback:t,events:n}}=e,i=Ei(e.payload,Iv);yield yo(gi.setActivateState({loading:!0}));try{const e=fa.onRedirectTo,{routes:a}=yield ho((e=>e.auth)),r=yield po(Ay.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(xg(r)){yield yo(gi.setActivateState({step:Nt.success}));const t=yield Wg(r);yield yo(gi.setState(t)),yield mo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield yo(gi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield po(Ay.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:mf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield yo(gi.setTenantsState({tenants:t,loading:!1})),yield yo(gi.setState({user:e,isAuthenticated:!0})),yield mo(1e3),yield Fg(),yield yo(gi.resetActivateState())}null==t||t(!0)}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message}))}}function*Cv({payload:e}){const{callback:t}=e,n=Ei(e,Lv);yield yo(gi.setActivateStrategyState({loading:!0}));try{const e=yield po(Ay.auth.getActivateAccountStrategy,n);yield yo(gi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield yo(gi.setActivateStrategyState({loading:!1,error:e.message}))}}function*Dv({payload:e}){const{callback:t}=e,n=Ei(e,Ev);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.email})),yield yo(gi.setActivateState({loading:!0}));try{yield po(Ay.auth.resendActivationEmail,n),yield yo(gi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message})),yield yo(gi.setTeamError({key:Pv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*Rv(){yield ya(gi.activateAccount,wv),yield ya(gi.preActivateAccount,Ov),yield ya(gi.getActivateAccountStrategy,Cv),yield ya(gi.resendActivationEmail,Dv)}function*Uv({payload:e}){if(e.token&&e.userId)try{yield yo(gi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield po(Ay.auth.acceptInvitation,e),yield yo(gi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield yo(gi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield yo(gi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*_v(){yield ya(gi.acceptInvitation,Uv)}var Mv,Nv=new Uint8Array(16);function Fv(){if(!Mv&&!(Mv="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 Mv(Nv)}for(var $v=/^(?:[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,Gv=function(e){return"string"==typeof e&&$v.test(e)},xv=[],Vv=0;Vv<256;++Vv)xv.push((Vv+256).toString(16).substr(1));var jv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Fv)();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=(xv[e[t+0]]+xv[e[t+1]]+xv[e[t+2]]+xv[e[t+3]]+"-"+xv[e[t+4]]+xv[e[t+5]]+"-"+xv[e[t+6]]+xv[e[t+7]]+"-"+xv[e[t+8]]+xv[e[t+9]]+"-"+xv[e[t+10]]+xv[e[t+11]]+xv[e[t+12]]+xv[e[t+13]]+xv[e[t+14]]+xv[e[t+15]]).toLowerCase();if(!Gv(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let Wv,Bv;!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"}(Wv||(Wv={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bv||(Bv={}));const Kv=["callback"],zv=["roles"],qv=["callback"],Hv=["callback","profileImage"],Jv=["callback"],Yv=["callback","userId"],Qv=["callback"],Xv=["callback"],Zv=["callback"],eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback","profileImage"],ah=["callback"],rh=["callback"],sh=["callback"],lh=["callback"],ch=["callback"],uh=["callback"],dh=()=>ho((e=>e.auth.teamState));function*yh(){try{const{groups:e}=yield po(Ay.groups.getGroups,{_groupsRelations:Bv.roles});return e}catch(e){return[]}}function*fh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!a})),yield yo(gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield fo([po(Ay.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions),po(yh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield yo(gi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield yo(gi.setTeamError({key:Pv.USERS,value:e.message})),yield yo(gi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1}))}function*gh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!r})),yield yo(gi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield fo([po(Ay.subTenants.loadAllUsers,C({},c)),po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions)]);yield yo(gi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield yo(gi.setTeamError({key:Pv.USERS,value:e.message})),yield yo(gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1}))}function*ph({payload:e}){yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield fo([po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions)]);yield yo(gi.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 yo(gi.setTeamError({key:Pv.ROLES_AND_PERMISSIONS,value:t.message}))}yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0}))}function*Sh({payload:e}){const{callback:t}=e,n=Ei(e,Kv),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield po(Ay.teams.addUser,n),{roles:a}=e,r=C({},Ei(e,zv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield yo(gi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vh({payload:e}){const{callback:t}=e,n=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield yo(gi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield po(Ay.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 yo(gi.loadUsers(r)),yield yo(gi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*hh({payload:e}){const{callback:t}=e,n=Ei(e,qv),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield po(Ay.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield yo(gi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*mh({payload:e}){const{callback:t}=e,n=Ei(e,Hv),{id:i}=n,o=yield dh(),a=o.users.find((e=>e.id===n.id));yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:i||""})),yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield po(Ay.teams.updateUser,n);null==t||t(e),yield yo(gi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1}))}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*bh({payload:e}){const{callback:t}=e,n=Ei(e,Jv),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield po(Ay.teams.deleteUser,n),null==t||t(!0),yield yo(gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Ah({payload:e}){const{callback:t,userId:n}=e,i=Ei(e,Yv),o=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield yo(gi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*kh({payload:e}){const{callback:t}=e,n=Ei(e,Qv),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield yo(gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Th({payload:e}){const{callback:t}=e,n=Ei(e,Xv);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield po(Ay.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*Ph({payload:e}){const{callback:t}=e,n=Ei(e,Zv);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Ih({payload:e}){const{callback:t}=e,n=Ei(e,eh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Lh({payload:e}){const{callback:t}=e,n=Ei(e,th);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Eh(){yield yo(gi.setTeamError({key:Pv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield po(Ay.teams.getInviteLinkConfiguration);yield yo(gi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield yo(gi.setTeamError({key:Pv.CONFIG_TOKEN_LINK,value:e.message}))}}function*Oh(){yield yo(gi.setTeamError({key:Pv.GET_TOKEN_LINK,value:!1}));try{yield po(Eh);const e=yield po(Ay.teams.getInviteUserLink),{inviteTokenState:t}=yield dh();yield yo(gi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield yo(gi.setTeamError({key:Pv.GET_TOKEN_LINK,value:e.message}))}}function*wh({payload:{callback:e}}){yield yo(gi.setTeamError({key:Pv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield dh();try{const n=yield po(Ay.teams.createInviteUserLink,{expiresInMinutes:43200});yield yo(gi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield yo(gi.setTeamError({key:Pv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ch({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield dh();yield yo(gi.setTeamError({key:Pv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield po(Ay.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield yo(gi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield yo(gi.setTeamError({key:Pv.UPDATE_TOKEN_LINK,value:t.message}))}}function*Dh({payload:e}){const{callback:t}=null!=e?e:{};yield yo(gi.setTeamError({key:Pv.DELETE_TOKEN_LINK,value:!1}));try{yield po(Ay.teams.deleteInviteUserLink),yield yo(gi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Rh({payload:e}){yield yo(gi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Uh({payload:e}){const t=yield dh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield yo(gi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_h({payload:e}){yield yo(gi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Mh({payload:e}){const t=yield dh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield yo(gi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Nh(){yield da(gi.loadUsers,fh),yield da(gi.loadAllSubTenantsUsers,gh),yield da(gi.loadRoles,ph),yield ua(gi.addUser,Sh),yield ua(gi.addUsersBulk,vh),yield ua(gi.addUserToSubTenants,hh),yield ua(gi.updateUser,mh),yield ua(gi.setUserRolesForSubTenants,Ah),yield ua(gi.deleteUser,bh),yield ua(gi.deleteUserFromSubTenants,kh),yield ua(gi.resendActivationLink,Th),yield ua(gi.resendInvitationLink,Ph),yield ua(gi.resendInvitationEmail,Ih),yield ua(gi.resendInvitationLinkToAllSubTenants,Lh),yield ua(gi.getInvitationLink,Oh),yield ua(gi.createInvitationLink,wh),yield ua(gi.updateInvitationLink,Ch),yield ua(gi.deleteInvitationLink,Dh),yield ua(gi.openAddUserDialog,Rh),yield ua(gi.closeAddUserDialog,Uh),yield ua(gi.openDeleteUserDialog,_h),yield ua(gi.closeDeleteUserDialog,Mh)}function*Fh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!a})),yield yo(gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield yo(gi.setTeamState({users:cf,totalPages:2,totalItems:10,roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1})),null==r||r(cf)}function*$h({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!r})),yield yo(gi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield yo(gi.setTeamState({allUsers:uf,totalPages:2,totalItems:10,roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1})),null==s||s(uf)}function*Gh({payload:e}){var t;yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield yo(gi.setTeamState({roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:nf,permissions:af})}function*xh({payload:e}){const{callback:t}=e,n=Ei(e,nh),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},sf,{groups:[]},n,{id:`${jv()}`});null==t||t(o),yield yo(gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Vh({payload:e}){const{callback:t}=e,n=Ei(e,ih),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},sf,n,{id:`${jv()}`});yield yo(gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*jh({payload:e}){var t;const{callback:n}=e,i=Ei(e,oh),{id:o}=i,a=yield dh(),r=a.users.find((e=>e.id===i.id));yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:o||""})),yield yo(gi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield yo(gi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield yo(gi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1}))}function*Wh({payload:e}){const{callback:t}=e,n=Ei(e,ah),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield yo(gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Bh({payload:e}){const{callback:t}=e,n=Ei(e,rh),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield yo(gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Kh({payload:e}){const{callback:t}=e,n=Ei(e,sh);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*zh({payload:e}){const{callback:t}=e,n=Ei(e,lh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*qh({payload:e}){const{callback:t}=e,n=Ei(e,ch);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Hh({payload:e}){const{callback:t}=e,n=Ei(e,uh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Jh(){yield da(gi.loadUsers,Fh),yield da(gi.loadAllSubTenantsUsers,$h),yield da(gi.loadRoles,Gh),yield ua(gi.addUser,xh),yield ua(gi.addUserToSubTenants,Vh),yield ua(gi.updateUser,jh),yield ua(gi.deleteUser,Wh),yield ua(gi.deleteUserFromSubTenants,Bh),yield ua(gi.resendActivationLink,Kh),yield ua(gi.resendInvitationLink,zh),yield ua(gi.resendInvitationEmail,qh),yield ua(gi.resendInvitationLinkToAllSubTenants,Hh),yield ua(gi.openAddUserDialog,Rh),yield ua(gi.closeAddUserDialog,Uh),yield ua(gi.openDeleteUserDialog,_h),yield ua(gi.closeDeleteUserDialog,Mh)}const Yh=["authorizationUrl"],Qh=["events","url"];function*Xh(){try{yield yo(gi.setSocialLoginsState({loading:!0}));const e=yield po(Ay.auth.getSocialLoginProviders);yield yo(gi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Zh(){try{const e=yield ho((e=>e.root.context));yield yo(gi.setSocialLoginsState({loading:!0}));const t=yield po(Ay.auth.getSocialLoginProvidersV2),{providers:n}=yield po(Ay.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ei(t,Yh);const o=ma(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield yo(gi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*em(e){let{payload:{events:t,url:n}}=e,i=Ei(e.payload,Qh);try{yield yo(gi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield po(Ay.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:bf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:mf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield yo(gi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield ho((e=>e.auth));e?yield po(Hg):yield po(Yg),yield Kg()}(),localStorage.removeItem("register-quick-login"),yield yo(gi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield yo(gi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*tm({payload:e}){yield yo(gi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*nm(){yield ya(gi.loadSocialLoginsConfiguration,Xh),yield ya(gi.loadSocialLoginsConfigurationV2,Zh),yield ya(gi.loginViaSocialLogin,em),yield da(gi.setSocialLoginError,tm)}let im;function*om({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield ho((e=>e.auth.apiTokensState));try{let e,a;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield po(Ay.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield po(Ay.auth.updateUserApiTokensData,{description:t}),yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield yo(gi.setApiTokensError({key:im.ADD_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*am({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield ho((e=>e.auth.apiTokensState));try{let e,r;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield po(Ay.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield po(Ay.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield yo(gi.setApiTokensError({key:im.ADD_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*rm({payload:e}){const{apiTokensDataUser:t}=yield ho((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),n?(yield po(Ay.auth.deleteUserAccessToken,{id:e}),yield yo(gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield po(Ay.auth.deleteUserApiToken,{tokenId:e}),yield yo(gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}catch(e){yield yo(gi.setApiTokensError({key:im.DELETE_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}}function*sm({payload:e}){const{apiTokensDataTenant:t}=yield ho((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),n?(yield po(Ay.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield po(Ay.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield yo(gi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}catch(e){yield yo(gi.setApiTokensError({key:im.DELETE_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}}function*lm({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield fo([po(Ay.auth.getUserApiTokensData),po(Ay.auth.getTenantApiTokensData)]);yield yo(gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cm({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=po(Ay.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=po(Ay.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield yo(gi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*um({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=po(Ay.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=po(Ay.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 yo(gi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*dm(){yield ya(gi.loadApiTokens,lm),yield ya(gi.loadUserApiTokens,cm),yield ya(gi.loadTenantApiTokens,um),yield ua(gi.addUserApiToken,om),yield ua(gi.addTenantApiToken,am),yield da(gi.deleteTenantApiToken,sm),yield da(gi.deleteUserApiToken,rm)}function*ym({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield ho((e=>e.auth.apiTokensState)),a=C({},By,{description:t,roleIds:n,clientId:`CLIENT_ID_${jv()}`});yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*fm({payload:e}){yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),yield mo(200);const t=[By];yield yo(gi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}function*gm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[Wy],i=[By];yield yo(gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*pm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[Wy];yield yo(gi.setApiTokensState({apiTokensDataUser:n})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Sm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[By];yield yo(gi.setApiTokensState({apiTokensDataTenant:n})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*vm(){yield ya(gi.loadApiTokens,gm),yield ya(gi.loadUserApiTokens,pm),yield ya(gi.loadTenantApiTokens,Sm),yield ua(gi.addTenantApiToken,ym),yield da(gi.deleteTenantApiToken,fm)}function*hm({payload:e}){try{var t;yield yo(gi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield ho((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield po(Ay.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield yo(gi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield yo(gi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*mm({payload:e}){yield yo(gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield po(Ay.accountSettings.getSettings);yield yo(gi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield yo(gi.setAccountSettingsState({loading:!1,error:e.message}))}}function*bm(){yield ya(gi.saveAccountSettings,hm),yield ya(gi.loadAccountSettings,mm)}function*Am({payload:e}){var t;yield yo(gi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield ho((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield yo(gi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*km({payload:e}){yield yo(gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield yo(gi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Tm(){yield ya(gi.saveAccountSettings,Am),yield ya(gi.loadAccountSettings,km)}function*Pm({payload:{tenantId:e,callback:t}}){yield yo(gi.setState({isLoading:!0}));try{yield po(Ay.tenants.switchTenant,{tenantId:e}),yield po(zg),(null==t?void 0:t(!0))||(yield yo(gi.setState({isLoading:!1})))}catch(e){yield yo(gi.setState({isLoading:!1})),null==t||t(!1,e)}}function*Im({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getTenants);yield yo(gi.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 yo(gi.setTenantsState({loading:!1}))}}function*Lm({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getSubTenants);yield yo(gi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Em({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getSubTenantsAsTree);yield yo(gi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Om(){yield ua(gi.loadTenants,Im),yield ua(gi.loadSubTenants,Lm),yield ua(gi.switchTenant,Pm),yield ua(gi.loadSubTenantsTree,Em)}function*wm(){yield yo(gi.setTenantsState({loading:!0})),yield mt(),yield yo(gi.setTenantsState({tenants:df,loading:!1}))}function*Cm(){yield ua(gi.loadTenants,wm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(im||(im={}));const Dm=["callback"],Rm=["callback"],Um=["callback"],_m=["callback"],Mm=["callback"];function*Nm({payload:e}){var t;yield yo(gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield fo([po(Ay.roles.getRoles),po(Ay.roles.getPermissions),po(Ay.roles.getPermissionCategories)]),[t,n,i]=e;yield yo(gi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield yo(gi.setRolesState({error:e.message,loading:!1}))}}function*Fm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Dm);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.addRole,n),i=yield po(Ay.roles.getRoles);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$m(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Rm);yield yo(gi.setRolesState({saving:!0}));try{yield po(Ay.roles.deleteRole,n),yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Gm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Um);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.updateRole,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*xm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,_m);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.attachPermissionsToRole,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Vm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Mm);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.attachPermissionToRoles,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*jm(){yield ya(gi.loadRolesAndPermissions,Nm),yield ua(gi.addRole,Fm),yield ua(gi.deleteRole,$m),yield ua(gi.updateRole,Gm),yield ua(gi.attachPermissionsToRole,xm),yield ua(gi.attachPermissionToRoles,Vm)}function*Wm({payload:e}){var t;yield yo(gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield yo(gi.setRolesState({roles:Ky,loading:!1}))}catch(e){yield yo(gi.setRolesState({error:e.message,loading:!1}))}}function*Bm(){yield ya(gi.loadRolesAndPermissions,Wm)}const Km=["callback"],zm=["callback"],qm=["callback"];function*Hm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Km);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const e=yield po(Ay.auth.resetPhoneNumber,n);yield yo(gi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield yo(gi.setLoginState({email:n.email}))}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Jm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,zm);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const e=yield po(Ay.auth.verifyResetPhoneNumber,n);yield yo(gi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Ym(e){let{payload:{callback:t}}=e,n=Ei(e.payload,qm);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield po(Ay.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield yo(gi.setLoginState({step:Pt.loginWithSmsOtc})),yield yo(gi.passwordlessPreLogin({type:jr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield yo(gi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Qm(){yield ya(gi.resetPhoneNumber,Hm),yield ya(gi.verifyResetPhoneNumber,Jm),yield ya(gi.changePhoneNumber,Ym)}function*Xm(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCurrentUserSessions);yield yo(gi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*Zm(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCurrentUserSession);yield yo(gi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*eb({payload:{id:e}}){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.deleteSessionForUser,e),yield yo(gi.loadUserSessions())}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*tb({payload:{callback:e,userId:t}}){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield yo(gi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*nb(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.deleteAllSessionsForUser),yield yo(gi.loadUserSessions())}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*ib(){yield da(gi.loadUserSessions,Xm),yield da(gi.deleteUserSession,eb),yield da(gi.deleteAllUserSessions,nb),yield da(gi.loadCurrentUserSession,Zm),yield ua(gi.revokeUserSessions,tb)}function*ob(){yield yo(gi.setSessionsState({loading:!0,error:null})),yield yo(gi.setSessionsState({sessions:yf,loading:!1}))}function*ab({payload:{id:e}}){yield yo(gi.setSessionsState({loading:!0,error:null}));const t=(yield ho((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield yo(gi.setSessionsState({sessions:t,loading:!1}))}function*rb(){yield yo(gi.setSessionsState({loading:!0,error:null}));const e=yf.filter((e=>e.current));yield yo(gi.setSessionsState({sessions:e,loading:!1}))}function*sb(){yield da(gi.loadUserSessions,ob),yield da(gi.deleteUserSession,ab),yield da(gi.deleteAllUserSessions,rb)}const lb=["callback"],cb=["callback"];function*ub(){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getSessionConfigurations);yield yo(gi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*db({payload:e}){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ei(e,lb);yield po(Ay.auth.createOrUpdateSessionConfigrations,n),yield yo(gi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield yo(gi.setSessionsPolicyState({error:e,loading:!1}))}}function*yb(){yield ya(gi.loadSessionsPolicy,ub),yield da(gi.createOrUpdateSessionsPolicy,db)}function*fb(){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));const e=yield ho((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:ff}));yield yo(gi.setSessionsPolicyState(C({},e,{loading:!1})))}function*gb({payload:e}){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ei(e,cb);null==t||t(!0),yield yo(gi.setSessionsPolicyState({configurations:n,loading:!1}))}function*pb(){yield ya(gi.loadSessionsPolicy,fb),yield da(gi.createOrUpdateSessionsPolicy,gb)}const Sb=["callback"],vb=["callback"],hb=["callback"],mb=["callback"],bb=["callback"],Ab=["callback"],kb=["callback"],Tb=["callback"],Pb=()=>ho((e=>e.auth.restrictionsState.ipRestrictions)),Ib=()=>ho((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Lb(){yield yo(gi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getDomainRestrictionsConfig),t=(yield po(Ay.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield yo(gi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield yo(gi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Eb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Sb);yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Ib();try{var o;yield po(Ay.auth.createDomainRestriction,n);const e=(yield po(Ay.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield yo(gi.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 yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ob(e){let{payload:{callback:t}}=e,n=Ei(e.payload,vb);yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield po(Ay.auth.updateDomainRestrictionConfig,n),i=(yield po(Ay.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield yo(gi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wb({payload:{id:e}}){yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Ib();try{var n;yield po(Ay.auth.deleteDomainRestriction,e);const i=(yield po(Ay.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Cb=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Db(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Pb(),t=yield po(Ay.auth.getIPRestrictionsConfig),n=Cb({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield po(Ay.auth.getIPRestrictions,n);yield yo(gi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Rb(){try{const{valid:e}=yield po(Ay.auth.testCurrentIpInAllowList);yield yo(gi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message}))}}function*Ub({payload:{callback:e}}){yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield ho((e=>e.auth.userIp));yield fo([po(Ay.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),po(Ay.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Pb(),i=Cb(n.pagination),{items:o,_metadata:{totalPages:a}}=yield po(Ay.auth.getIPRestrictions,i);yield yo(gi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*_b(e){let{payload:{callback:t}}=e,n=Ei(e.payload,hb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield Pb();try{var o,a;yield po(Ay.auth.createIPRestriction,n);const e=yield Pb(),r=Cb(e.pagination),{items:s,_metadata:{totalPages:l}}=yield po(Ay.auth.getIPRestrictions,r);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Mb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));try{yield po(Ay.auth.updateIPRestrictionConfig,n);const e=yield Pb(),i=yield po(Ay.auth.getIPRestrictionsConfig),o=Cb(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield po(Ay.auth.getIPRestrictions,o);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Nb({payload:{id:e,callback:t}}){yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const n=yield Pb();try{var i;yield po(Ay.auth.deleteIPRestriction,e);const o=yield Pb(),a=Cb(o.pagination),{items:r,_metadata:{totalPages:s}}=yield po(Ay.auth.getIPRestrictions,a);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Fb(){yield ya(gi.loadIpRestrictions,Db),yield ya(gi.loadEmailDomainRestrictions,Lb),yield ua(gi.saveIpRestriction,_b),yield ua(gi.saveIpRestrictionsConfig,Mb),yield ua(gi.deleteIpRestriction,Nb),yield ua(gi.checkIfUserIpValid,Rb),yield ua(gi.addCurrentUserIpAndActivate,Ub),yield ua(gi.saveEmailDomainRestriction,Eb),yield ua(gi.saveEmailDomainRestrictionsConfig,Ob),yield ua(gi.deleteEmailDomainRestriction,wb)}function*$b(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null})),yield yo(gi.setIpRestrictionsState({data:{restrictions:pf.filter((e=>e.strategy===gf.strategy)),config:gf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Gb(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Pb(),t=pf[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield yo(gi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*xb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ei(e.payload,bb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const r=yield Pb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield yo(gi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:jv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Vb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ei(e.payload,Ab);const r=yield Pb();yield yo(gi.setIpRestrictionsState({saving:!0,error:null})),yield yo(gi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield yo(gi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*jb({payload:{id:e,callback:t}}){var n;yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield Pb();yield yo(gi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Wb(){yield yo(gi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield yo(gi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Bb(e){var t,n;let{payload:{callback:i}}=e,o=Ei(e.payload,kb);const a=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*Kb(e){var t;let{payload:{callback:n}}=e,i=Ei(e.payload,Tb);const o=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield yo(gi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*zb({payload:{id:e}}){var t,n;const i=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*qb(){yield ya(gi.loadIpRestrictions,$b),yield ya(gi.loadEmailDomainRestrictions,Wb),yield ua(gi.saveIpRestriction,xb),yield ua(gi.saveIpRestrictionsConfig,Vb),yield ua(gi.deleteIpRestriction,jb),yield ua(gi.checkIfUserIpValid,Gb),yield ua(gi.saveEmailDomainRestriction,Bb),yield ua(gi.saveEmailDomainRestrictionsConfig,Kb),yield ua(gi.deleteEmailDomainRestriction,zb)}const Hb=["callback"],Jb=["id"];function*Yb(e){const{count:t}=yield po(Ay.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*Qb(){yield yo(gi.setProvisioningState({loading:!0,error:null}));try{const e=yield po(Ay.directory.getConfigs),t=yield fo(e.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*Xb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Hb);yield yo(gi.setProvisioningState({loading:!0,error:null}));try{const e=yield po(Ay.directory.createConfiguration,n),i=yield po(Ay.directory.getConfigs),o=yield fo(i.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*Zb(e){let{payload:{id:t}}=e,n=Ei(e.payload,Jb);yield yo(gi.setProvisioningState({loading:!0,error:null}));try{yield po(Ay.directory.updateConfiguration,t,n);const e=yield po(Ay.directory.getConfigs),i=yield fo(e.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*eA({payload:{id:e,callback:t}}){yield yo(gi.setProvisioningState({loading:!0,error:null}));try{yield po(Ay.directory.deleteConfiguration,e);const n=yield po(Ay.directory.getConfigs),i=yield fo(n.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*tA(){yield ya(gi.loadProvisionConnections,Qb),yield ua(gi.createProvisionConnection,Xb),yield ua(gi.deleteProvisionConnection,eA),yield ua(gi.updateProvisionConnection,Zb)}const nA=["callback","events"];function*iA(e){let{payload:{callback:t}}=e,n=Ei(e.payload,nA);yield yo(gi.setImpersonateState({loading:!0}));try{yield po(Ay.impersonate.impersonate,n),yield yo(gi.setImpersonateState({step:li.success})),yield mo(1e3),yield Fg(),yield yo(gi.resetImpersonateState()),null==t||t(!0)}catch(e){yield yo(gi.setImpersonateState({loading:!1,error:e.message}))}}function*oA(){yield ya(gi.impersonate,iA)}function*aA({payload:e}){const{callback:t,deviceId:n}=e;yield yo(gi.setPasskeysState({loading:!0}));try{yield po(Ay.auth.deleteWebAuthnDevice,n);const{devices:e}=yield ho((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield yo(gi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*rA(){yield yo(gi.setPasskeysState({loading:!0}));try{const{devices:e}=yield po(Ay.auth.getWebAuthnDevices);yield yo(gi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield yo(gi.setPasskeysState({loading:!1,error:e.message||null}))}}function*sA(){yield ua(gi.loadWebAuthnDevices,rA),yield ua(gi.deleteWebAuthnDevice,aA)}const lA=["roleIds","userIds"],cA=()=>ho((e=>e.auth.groupsState));function*uA({payload:e}){const t=Wv.GET_TEAM_USERS;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield po(Ay.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield yo(gi.setGroupsState({teamUsers:n}))}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA({payload:e}){const t=Wv.GET_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield po(Ay.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Bv.rolesAndUsers});yield yo(gi.setGroupsState({selectedGroup:n}))}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*yA(){const e=Wv.GET_GROUPS,t=yield cA();yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield po(Ay.groups.getGroups,{_groupsRelations:Bv.rolesAndUsers});yield yo(gi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield yo(gi.setUsersGroupsError({key:e,value:t.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}}function*fA({payload:e}){const t=Wv.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ei(e,lA);yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield po(Ay.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield yo(gi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield yo(gi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield yo(gi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*gA({payload:e}){const t=Wv.UPDATE_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.updateGroup,e),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*pA({payload:e}){const t=Wv.DELETE_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteGroup,e.groupId),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*SA({payload:e}){const t=Wv.ADD_ROLES_TO_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*vA({payload:e}){const t=Wv.DELETE_ROLES_FROM_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*hA({payload:e}){const t=Wv.ADD_USERS_TO_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield yo(gi.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 yo(gi.setUsersGroupsError({key:t,value:n.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*mA({payload:e}){const t=Wv.DELETE_USERS_FROM_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*bA(){const e=Wv.GET_GROUP_CONFIGURATION;yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield po(Ay.groups.getGroupConfiguration);yield yo(gi.setGroupsState({groupsConfiguration:t}))}catch(t){yield yo(gi.setUsersGroupsError({key:e,value:t.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}}function*AA({payload:e}){const t=Wv.UPDATE_GROUP_CONFIGURATION;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{yield po(Ay.groups.updateGroupConfiguration,e),yield yo(gi.getGroupConfiguration())}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*kA(){yield da(gi.loadGroups,yA),yield da(gi.getGroupById,dA),yield da(gi.createGroup,fA),yield da(gi.updateGroup,gA),yield da(gi.deleteGroup,pA),yield da(gi.addRolesToGroup,SA),yield da(gi.deleteRolesFromGroup,vA),yield da(gi.addUsersToGroup,hA),yield da(gi.deleteUsersFromGroup,mA),yield da(gi.getGroupConfiguration,bA),yield da(gi.updateGroupConfiguration,AA),yield da(gi.getTeamUsers,uA)}function*TA(){const e=Wv.GET_GROUPS;yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));const t=hf;yield yo(gi.setGroupsState({groups:t})),yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}function*PA({payload:e}){var t;const n=Wv.CREATE_GROUP,{groups:i}=yield cA();yield yo(gi.setUsersGroupsLoader({key:n,value:!0})),yield yo(gi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:hy.FRONTEGG}),...null!=i?i:[]]})),yield mo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:n,value:!1}))}function*IA({payload:e}){var t,n,i,o,a;const r=Wv.UPDATE_GROUP,s=yield cA();yield yo(gi.setUsersGroupsLoader({key:r,value:!0})),yield yo(gi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:hy.FRONTEGG}):t})),selectedGroup:C({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield mo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:r,value:!1}))}function*LA({payload:e}){var t,n;const i=Wv.DELETE_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*EA({payload:e}){var t,n;const i=Wv.ADD_ROLES_TO_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*OA({payload:e}){var t,n;const i=Wv.DELETE_ROLES_FROM_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*wA({payload:e}){var t,n;const i=Wv.ADD_USERS_TO_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*CA({payload:e}){var t,n;const i=Wv.DELETE_USERS_FROM_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*DA(){const e=Wv.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield cA();yield yo(gi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield yo(gi.setGroupsState({groupsConfiguration:C({},t)}))),yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}function*RA({payload:e}){const t=Wv.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield cA();yield yo(gi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield yo(gi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}function*UA(){yield da(gi.loadGroups,TA),yield da(gi.createGroup,PA),yield da(gi.updateGroup,IA),yield da(gi.deleteGroup,LA),yield da(gi.addRolesToGroup,EA),yield da(gi.deleteRolesFromGroup,OA),yield da(gi.addUsersToGroup,wA),yield da(gi.deleteUsersFromGroup,CA),yield da(gi.getGroupConfiguration,DA),yield da(gi.updateGroupConfiguration,RA)}const _A=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,..._A(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),MA=["callback"];function*NA(){yield yo(gi.setCustomLoginState({loading:!0}));try{const e=yield po(Dc);yield yo(gi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield yo(gi.setCustomLoginState({loading:!1,error:e.message}))}}function*FA(e){let{payload:{callback:t}}=e,n=Ei(e.payload,MA);try{if(yield yo(gi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=_A(n);if(0===e.length)throw new Error("no changes to update");yield po(Rc,{actions:e});const i=yield po(Dc);yield yo(gi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$A(){yield ya(gi.loadTenantMetadata,NA),yield ya(gi.updateTenantMetadata,FA)}var GA={sagas:function*(){yield fo([po(Np),po(Rv),po(_v),po(Tv),po(Qm),po(Xp),po(LS),po(RS),po($A),po(cv),po(Nh),po(kA),po(nm),po(Lf),po(dm),po(eg),po(bm),po(Om),po(jm),po(ib),po(yb),po(Fb),po(tA),po(oA),po(sA),po(vg)])},mockSagas:function*(){yield fo([po(Gp),po(aS),po(NS),po(hv),po(Jh),po(vm),po(fg),po(sb),po(Tm),po(Cm),po(pb),po(qb),po(Bm),po(UA)])},storeName:wt,initialState:si,reducer:yi,actions:gi};const xA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),VA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},jA={setAuditLogsState:xA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:VA})},WA={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},BA={loading:!0},KA={setAuditsMetadataState:xA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:BA})},zA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},qA={auditLogsState:VA,auditsMetadataState:BA},{reducer:HA,actions:JA}=ut({name:Dt,initialState:qA,reducers:C({resetState:e=>C({},e,qA),setState:(e,{payload:t})=>C({},e,t)},jA,KA)}),YA=C({},JA,WA,zA),QA=e=>"createdAt"!==e.id,XA={total:20,data:Array.from(Array(5).keys()).map((e=>C({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},ZA={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}]},ek=()=>ho((e=>e.auditLogs.auditLogsState)),tk=()=>ho((e=>e.auditLogs.auditsMetadataState));function*nk(){const e=yield ek(),{columns:t}=yield tk();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield yo(YA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Ay.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield yo(YA.setAuditLogsState({isDownloadingCsv:!1}))}function*ik({payload:e}){yield yo(YA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield ek(),{columns:n}=yield tk();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 yo(YA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield yo(YA.loadAuditsMetadata()));const{data:g,total:p}=yield po(Ay.audits.getAudits,C({offset:c,count:l},y,f));yield yo(YA.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield yo(YA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*ok(){yield ua(YA.exportAuditsCsv,nk),yield ua(YA.loadAuditLogs,ik)}function*ak({payload:e}){yield yo(YA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield ek(),{columns:n}=yield tk();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 yo(YA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield yo(YA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=XA;let i=n.filter((e=>t=>e.filter(QA).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 yo(YA.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 yo(YA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*rk(){yield ua(YA.loadAuditLogs,ak)}function*sk(){yield yo(YA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield po(Ay.metadata.getAuditsMetadata);yield yo(YA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield yo(YA.setAuditsMetadataState({error:e,loading:!1}))}}function*lk(){yield ua(YA.loadAuditsMetadata,sk)}function*ck(){yield yo(YA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=ZA;yield yo(YA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield yo(YA.setAuditsMetadataState({error:e,loading:!1}))}}function*uk(){yield ua(YA.loadAuditsMetadata,ck)}var dk={sagas:function*(){yield fo([po(ok),po(lk)])},mockSagas:function*(){yield fo([po(rk),po(uk)])},storeName:Dt,initialState:qA,reducer:HA,actions:YA};const yk={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:fk,actions:gk,reducer:pk}=ut({name:"audits",initialState:yk,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=C({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Sk=C({},gk,{initData:lt(`${fk}/initData`),loadAudits:lt(`${fk}/loadAudits`),removeFilter:lt(`${fk}/removeFilter`),filterData:lt(`${fk}/filterData`),exportCSV:lt(`${fk}/exportCSV`),deleteAudits:lt(`${fk}/deleteAudits`)}),vk=()=>ho((e=>e[fk]));function*hk(){const{sortBy:e,sortDirection:t}=yield vk();try{const n=yield po(Ay.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield yo(Sk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield yo(Sk.loadItemFailedAction(t))}}function*mk(){try{const e=yield po(Ay.metadata.getAuditsMetadata);yield yo(Sk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield yo(Sk.loadItemFailedAction(t))}}const bk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Ak({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield vk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield vk():{rowsData:[]};try{const e=bk(t),{data:s,total:d}=yield po(Ay.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield yo(Sk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield yo(Sk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield yo(Sk.loadItemFailedAction(t))}}function*kk(){yield yo(Sk.startLoading()),yield fo([hk(),mk(),Ak({payload:{onlyOneLoad:!1},type:""})]),yield yo(Sk.finishLoading())}function*Tk({payload:e}){const{filters:t}=yield vk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield yo(Sk.setFilterData(i))}function*Pk({payload:e}){const{filters:t}=yield vk();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 yo(Sk.setFilterData(i))}function*Ik(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield vk(),a=bk(e);yield yo(Sk.startDownloadingCsv());try{yield Ay.audits.exportAudits(C({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield yo(Sk.stopDownloadingCsv())}}function*Lk(){yield da(Sk.initData,kk),yield da(Sk.removeFilter,Tk),yield da(Sk.filterData,Pk),yield da([Sk.loadAudits,Sk.textSearch,Sk.onPageChange],Ak),yield da([Sk.setFilterData,Sk.setDataSorting,Sk.startRefresh],(()=>Ak({payload:{appendMode:!1},type:""}))),yield da(Sk.exportCSV,Ik)}const Ek={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Ok={initData:()=>C({},Ek),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},wk={loadSlackActions:lt("connectivity/loadSlackActions"),loadDataAction:lt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:lt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:lt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:lt("connectivity/loadScope"),deleteWebhookConfigAction:lt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:lt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:lt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ck={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Dk,actions:Rk}=ut({name:Ct,initialState:Ck,reducers:C({},Ok)}),Uk=C({},Rk,wk),_k={slack:Ay.connectivity.getSlackConfiguration,email:Ay.connectivity.getEmailConfiguration,sms:Ay.connectivity.getSMSConfiguration,webhook:Ay.connectivity.getWebhooksConfigurations,categories:Ay.connectivity.getCategories,channelMap:Ay.connectivity.getChannelMaps},Mk={slack:Ay.connectivity.postSlackConfiguration,email:Ay.connectivity.postEmailConfiguration,sms:Ay.connectivity.postSMSConfiguration,webhook:Ay.connectivity.postWebhooksConfiguration},Nk=["email","slack","sms","webhook"],Fk={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"}},$k=["id"],Gk=["id","enabled"],xk=["categories","channelMap"];function*Vk(e){return yield po(Wk,{payload:{api:e},type:""})}function*jk({payload:e=Nk}){yield yo(Uk.setConnectivityState({isLoading:!0}));try{const t=yield fo([...e.map(Vk),yield Wk({payload:{api:"categories"},type:""}),yield function*(){return(yield fo(e.map((function*(e){return yield Wk({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Wk({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Fk[e[o]].events(i),active:Fk[e[o]].isActive(i),platform:Fk[e[o]].title,image:Fk[e[o]].image}]}):n:C({},n,{[`${xk[o-e.length]}`]:i})),{list:[],webhook:n});yield yo(Uk.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield yo(Uk.setConnectivityState({isLoading:!1}))}}function*Wk({payload:{api:e,params:t}}){try{return yield po(_k[e],t)}catch(e){return}}function*Bk(){try{yield yo(Uk.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield po(Ay.connectivity.getSlackChannels);yield yo(Uk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield yo(Uk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Kk(e,t){const{connectivity:{list:n}}=yield ho(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Fk[e].isActive(t);o!==i.active&&(yield yo(Uk.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*zk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield ho((e=>e.connectivity));try{if(yield yo(Uk.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield ho();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield fo([...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=Ei(e,$k);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield po(Mk.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield po(Ay.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield ho(),{processIds:i}=yield ho((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield fo([...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 po("email"===t?Ay.connectivity.postEmailConfiguration:Ay.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=Ei(o,Gk);return yield fo([yield po("email"===t?Ay.connectivity.patchEmailConfiguration:Ay.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield po("email"===t?Ay.connectivity.putEmailSubscriptions:Ay.connectivity.putSMSSubscriptions,a,i,C({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return po("email"===t?Ay.connectivity.deleteEmailSubscriptions:Ay.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Wk({payload:{api:t},type:""});yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Kk(t,e)}else yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield po(Mk[e],t),!["sms","email"].includes(e)){const o=yield Wk({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Kk(e,o),null==n||n(!0)}}catch(e){var o;yield yo(Uk.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*qk({payload:e}){try{yield Ay.connectivity.postSlackCode(e)}catch{}yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1}))}function*Hk(){const{slackChannels:e}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield po(Ay.connectivity.getSlackScope);yield yo(Uk.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield yo(Uk.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Jk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({isSaving:!0})),yield po(Ay.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Wk({payload:{api:"webhook"},type:""});o&&(yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Yk({payload:e}){try{yield yo(Uk.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield po(Ay.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Qk({payload:e}){try{const{statusCode:t}=yield po(Ay.connectivity.postWebhookRetry,e);yield yo(Uk.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield yo(Uk.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Xk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield po(Ay.connectivity.getWebhookLog,e,n,t);yield yo(Uk.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield yo(Uk.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Zk={sagas:function*(){yield ua(Uk.loadDataAction,jk),yield da(Uk.loadSlackActions,Bk),yield ua(Uk.postDataAction,zk),yield ua(Uk.postCodeAction,qk),yield ua(Uk.loadScope,Hk),yield ua(Uk.deleteWebhookConfigAction,Jk),yield ua(Uk.postWebhookTestAction,Yk),yield ua(Uk.postWebhookRetryAction,Qk),yield da(Uk.loadWebhookLogsAction,Xk)},storeName:Ct,initialState:Ck,reducer:Dk,actions:Uk};function eT(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function tT(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function nT(e){return tT(e,((e,t)=>C({},e,{loading:t.payload})))}function iT(e){return tT(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const oT={loading:!1,error:null,fetching:!0,plans:[]},{actions:aT,reducer:rT,name:sT}=ut({name:"subscriptions/plans",initialState:oT,reducers:C({},eT())}),lT=C({loadPlans:lt(`${sT}/loadPlans`)},aT),cT={loading:!1,error:null,fetching:!0,config:null},uT=C({},eT()),{actions:dT,reducer:yT,name:fT}=ut({name:"subscriptions/config",initialState:cT,reducers:uT}),gT=C({loadPaymentConfiguration:lt(`${fT}/loadPaymentConfiguration`)},dT),pT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},ST=C({},eT(),{setCancellationLoading:nT("cancellation"),setCancellationError:iT("cancellation"),setRenewalLoading:nT("renewal"),setRenewalError:iT("renewal")}),{reducer:vT,actions:hT,name:mT}=ut({name:"subscriptions/billing/subscription",initialState:pT,reducers:ST}),bT=C({load:lt(`${mT}/loadSubscription`),cancelSubscription:lt(`${mT}/cancelSubscription`),renewSubscription:lt(`${mT}/renewSubscription`)},hT),AT={loading:!1,error:null,fetching:!0},kT=C({},eT()),{reducer:TT,actions:PT,name:IT}=ut({name:"subscriptions/billing/information",initialState:AT,reducers:kT}),LT=C({loadBillingInformation:lt(`${IT}/loadBillingInformation`),cancelSubscription:bT.cancelSubscription,renewSubscription:bT.renewSubscription},PT),ET={loading:!1,error:null,fetching:!0},OT=C({},eT(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:wT,actions:CT,name:DT}=ut({name:"subscriptions/billing/payment",initialState:ET,reducers:OT}),RT=C({loadPaymentMethod:lt(`${DT}/loadPaymentMethod`),submitPaymentMethod:lt(`${DT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${DT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${DT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${DT}/updateBillingDetails`,(e=>({payload:e})))},CT),UT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_T=C({},eT(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:MT,actions:NT,name:FT}=ut({name:"subscriptions/billing/invoices",initialState:UT,reducers:_T}),$T=C({loadInvoices:lt(`${FT}/loadInvoices`),downloadInvoice:lt(`${FT}/downloadInvoice`,(e=>({payload:e})))},NT),GT={information:AT,invoices:UT,paymentMethod:ET,subscription:pT},xT={invoices:$T,information:LT,paymentMethod:RT,subscription:bT},VT=je({invoices:MT,information:TT,paymentMethod:wT,subscription:vT}),jT={fetching:!0,loading:!1,error:null,confirmed:!1},WT=C({},eT()),{actions:BT,reducer:KT,name:zT}=ut({name:"subscriptions/checkout",initialState:jT,reducers:WT}),qT=C({loadCheckout:lt(`${zT}/loadCheckout`),resetCheckout:lt(`${zT}/resetCheckout`),submitCheckout:lt(`${zT}/submitCheckout`),confirmCheckout:lt(`${zT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${zT}/errorCheckout`,(e=>({payload:e})))},BT),HT={loading:!1,error:null,cardSetupIntentSecret:null},JT=C({},eT()),{reducer:YT,actions:QT,name:XT}=ut({name:"subscriptions/stripe",initialState:HT,reducers:JT}),ZT=C({loadCustomer:lt(`${XT}/loadCustomer`),createCardSetupIntentSecret:lt(`${XT}/createCardSetupIntentSecret`)},QT),eP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:tP,reducer:nP,name:iP}=ut({name:"subscriptions/vendorPublicConfig",initialState:eP,reducers:C({},eT())}),oP=C({loadVendorPublicConfiguration:lt(`${iP}/loadVendorPublicConfiguration`)},tP),aP={config:cT,plans:oT,checkout:jT,billing:GT,stripe:HT,vendorPublicConfig:eP},rP={config:gT,billing:xT,plans:lT,checkout:qT,stripe:ZT,vendorPublicConfig:oP},sP=je({config:yT,billing:VT,plans:rT,checkout:KT,stripe:YT,vendorPublicConfig:nP});let lP,cP,uP;function dP({policy:e}){return{policy:uP.AT_PERIOD_END}}function yP(e){switch(e){case hd.ACTIVE:return cP.ACTIVE;case hd.INCOMPLETE:return cP.INCOMPLETE;case hd.CANCELED:return cP.CANCELED;case hd.EXPIRED:return cP.EXPIRED;case hd.TRIALING:return cP.TRIALING;default:return cP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(lP||(lP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(cP||(cP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(uP||(uP={}));const fP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:hd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},gP=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],pP=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],SP=[{id:"id",externalId:"externalId",type:md.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],vP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*hP(){yield ua(bT.load,mP),yield ua(bT.cancelSubscription,AP),yield ua(bT.renewSubscription,kP)}function*mP(){const e=yield ho((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield EP(e)}function*bP(){yield yo(bT.setLoading(!0));try{const[e]=yield po(Ay.subscriptions.getManagedSubscriptions);yield yo(bT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield yo(bT.setError(e))}}function*AP(){const{subscription:e}=yield ho((e=>e.subscriptions.billing.subscription));if(!e)return void(yield yo(bT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield yo(bT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===hd.ACTIVE)try{yield yo(bT.setCancellationLoading(!0)),yield po(Ay.subscriptions.cancelManagedSubscription,t),yield bP(),yield yo(bT.setCancellationLoading(!1))}catch(e){yield yo(bT.setCancellationError(e.message))}}function*kP(){const{subscription:e}=yield ho((e=>e.subscriptions.billing.subscription));if(!e)return void(yield yo(bT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield yo(bT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===bd.AT_PERIOD_END)try{yield yo(bT.setRenewalLoading(!0)),yield po(Ay.subscriptions.renewManagedSubscription,t),yield bP(),yield yo(bT.setRenewalLoading(!1))}catch(e){yield yo(bT.setCancellationError(e.message))}}function*TP(){yield yo(bT.setLoading(!0)),yield mo(500),yield yo(bT.setState({subscription:fP,fetching:!1,loading:!1,error:null}))}function*PP(){yield ua(bT.load,TP)}function*IP(){yield ua(LT.loadBillingInformation,LP)}function*LP(){yield function*(e){const t=yield ho((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield ho((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield EP(n,!1):yield yo(LT.setError(t?"Not authorized":"Internal feature failure"))}()}function*EP(e,t){yield yo(LT.setLoading(!0));try{var n,i;const o=yield po(Ay.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield po(Ay.subscriptions.getSubscriptionPlan,a):([,s]=yield fo([po(bP),po(Ay.subscriptions.getSubscriptionPlan,a)]),l=yield ho((e=>e.subscriptions.billing.subscription.subscription||null))),yield yo(LT.setState(C({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?cP.ACTIVE:yP(l.status),cancellation:l.cancellation&&dP(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 yo(LT.setError(e.message))}}function*OP(){yield function*(){var e,t;yield yo(LT.setLoading(!0)),yield mo(500),yield yo(LT.setState({loading:!1,fetching:!1,summary:{subscriptionId:fP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ad.Stripe,externallyManaged:!1,currentPlanId:gP[0].id,defaultPlanId:gP[0].id},plan:C({},gP[0],{price:null==(e=gP[0].price)?void 0:e.amount,currency:null==(t=gP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*wP(){yield ua(LT.loadBillingInformation,OP)}function*CP(){yield ua(RT.loadPaymentMethod,DP),yield ua(RT.submitPaymentMethod,UP),yield ua(RT.submitPaymentMethodError,_P),yield ua(RT.submitPaymentMethodSuccess,MP),yield ua(RT.updatePaymentMethodBillingDetails,RP)}function*DP(){yield yo(RT.setLoading(!0));try{const e=(yield po(Ay.subscriptions.getPaymentMethods))[0];yield yo(RT.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield yo(RT.setError(e.message))}}function*RP({payload:e}){yield yo(RT.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield po(Ay.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield po(DP),null==o||o(!0)}catch(e){yield yo(RT.setError(e.message)),null==o||o(!1)}yield yo(RT.setLoading(!1))}function*UP(){yield yo(RT.setLoading(!0))}function*_P({payload:e}){yield yo(RT.setError(e))}function*MP(){yield yo(RT.loadPaymentMethod())}function*NP(){yield yo(RT.setLoading(!0)),yield mo(500);const e=SP[0];yield yo(RT.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*FP(){yield ua(RT.loadPaymentMethod,NP)}function*$P(){yield ua($T.loadInvoices,GP),yield ua($T.downloadInvoice,xP)}function*GP(){yield yo($T.setLoading(!0));try{const e=(yield po(Ay.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 yo($T.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield yo($T.setError(e.message))}}function*xP({payload:e}){yield yo($T.setInvoiceDownloadState({loading:!0,error:null}));try{yield po(Ay.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield yo($T.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield yo($T.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*VP(){yield yo($T.setLoading(!0)),yield mo(500),yield yo($T.setState({loading:!1,fetching:!1,invoices:pP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield yo($T.setLoading(!1))}function*jP(){yield ua($T.loadInvoices,VP)}function*WP(){yield fo([po(IP),po(CP),po($P),po(hP)])}function*BP(){yield fo([po(wP),po(FP),po(jP),po(PP)])}function*KP(){yield ua(qT.loadCheckout,zP),yield ua(qT.resetCheckout,qP),yield ua(qT.submitCheckout,HP),yield ua(qT.confirmCheckout,JP),yield ua(qT.errorCheckout,QP)}function*zP(){yield yo(qT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*qP(){yield yo(qT.setState({loading:!1,error:null,confirmed:!1}))}function*HP(){yield yo(qT.setState({loading:!0,error:null}))}function*JP({payload:{paymentMethodId:e,planId:t}}){const n=yield ho((e=>e.subscriptions.billing.subscription.subscription)),i=yield ho((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===hd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield yo(qT.setState({loading:!0,error:null})),o&&a)return yield YP(),void(yield yo(bT.setState({subscription:C({},n,{status:hd.ACTIVE})})));try{yield po(Ay.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield fo([LP(),DP(),GP()]),yield YP()}catch(e){yield yo(qT.setState({loading:!1,error:e.message}))}}else yield yo(qT.setState({loading:!1,error:"Subscription not found"}))}function*YP(){yield yo(qT.setState({loading:!1,error:null,confirmed:!0}))}function*QP({payload:e}){yield yo(qT.setState({loading:!1,error:e}))}function*XP(){yield ua(qT.resetCheckout,qP)}function*ZP(){yield ua(lT.loadPlans,eI)}function*eI(){yield yo(lT.setLoading(!0));try{const e=(yield po(Ay.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 yo(lT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield yo(lT.setError(e.message))}}function*tI(){yield yo(lT.setLoading(!0)),yield mo(500),yield yo(lT.setState({fetching:!1,loading:!1,plans:gP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*nI(){yield ua(lT.loadPlans,tI)}function*iI(){yield ua(gT.loadPaymentConfiguration,oI)}function*oI(){yield yo(gT.setLoading(!0));try{(yield po(Ay.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ad.Stripe))?yield function*(){yield yo(gT.setLoading(!0));try{const e=yield po(Ay.subscriptions.getStripePaymentProviderConfiguration);yield yo(gT.setState({loading:!1,fetching:!1,config:{paymentProvider:lP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield yo(gT.setError(e.message))}}():yield yo(gT.setError("Payment provider not configured"))}catch(e){yield yo(gT.setError(e.message))}}function*aI(){yield yo(gT.setLoading(!0)),yield mo(500),yield yo(gT.setState({loading:!1,fetching:!1,config:{paymentProvider:lP.STRIPE,apiKey:""}}))}function*rI(){yield ua(gT.loadPaymentConfiguration,aI)}function*sI(){yield ua(ZT.createCardSetupIntentSecret,lI)}function*lI({payload:e}){yield yo(ZT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield po(Ay.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield yo(ZT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield yo(ZT.setError(e.message))}}function*cI(){yield ua(oP.loadVendorPublicConfiguration,uI)}function*uI(){yield yo(oP.setLoading(!0));try{const e=yield po(Ay.subscriptions.getVendorPublicConfigurations);yield yo(oP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield yo(oP.setError(e.message))}}function*dI(){yield yo(oP.setLoading(!0)),yield mo(500),yield yo(oP.setState({fetching:!1,loading:!1,vendorPublicConfig:vP}))}function*yI(){yield ua(oP.loadVendorPublicConfiguration,dI)}var fI={sagas:function*(){yield fo([po(WP),po(KP),po(ZP),po(iI),po(sI),po(cI)])},mockSagas:function*(){yield fo([po(BP),po(XP),po(nI),po(rI),po(yI)])},reducer:sP,actions:rP,initialState:aP,storeName:"subscriptions"},gI={sagas:function*(){yield ua(Rf.loadVendorPublicInfo,Uf)},storeName:Rt,initialState:wf,reducer:Cf,actions:Rf};const{reducer:pI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(fa.setContext(t),C({},e,{context:t}))}}}),SI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,g,p,S,v;n||a||fa.setContext(e.context);const t=ta(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[GA.storeName]:C({},GA.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},GA.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[dk.storeName]:C({},dk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},dk.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:C({},dk.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[fk]:C({},yk,null!=(v=null==o?void 0:o.audits)?v:{}),[Zk.storeName]:Zk.initialState,[fI.storeName]:fI.initialState,[gI.storeName]:gI.initialState},reducer:je({root:pI,[GA.storeName]:GA.reducer,[dk.storeName]:dk.reducer,[fk]:pk,[Zk.storeName]:Zk.reducer,[fI.storeName]:fI.reducer,[gI.storeName]:gI.reducer})});const m=function*(){yield fo([po(GA.sagas),po(dk.sagas),po(Lk),po(Zk.sagas),po(fI.sagas),po(gI.sagas)])},b=function*(){yield fo([po(GA.mockSagas),po(dk.mockSagas),po(fI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(gi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var vI=n(714),hI=n.n(vI);function mI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function bI(e){if(e.type)return e;if("#"===e.charAt(0))return bI(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 AI(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 kI(e){if(0===e.indexOf("#"))return e;const{values:t}=bI(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 TI(e,t){return e=bI(e),t=mI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,AI(e)}function PI(e,t){if(e=bI(e),t=mI(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 AI(e)}function II(e,t){if(e=bI(e),t=mI(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 AI(e)}const LI=e=>{if(e)return{main:e,light:kI(II(e,.4)),dark:kI(PI(e,.15)),hover:kI(PI(e,.15)),active:kI(PI(e,.2))}},EI=e=>{if(e)return{main:e,light:II(e,.7),dark:PI(e,.2)}},OI=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?C({},t,{palette:{primary:C({},LI(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:C({},LI(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:C({},LI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},EI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},EI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},EI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},EI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},wI={},CI={},DI={},RI={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class UI{constructor(){this._theme=wI,this._themeV2=CI,this._navigation=RI,this._localizations=DI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new UI;return n.set(e),UI._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=hI().all([null!=(t=RI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=hI().all([null!=(i=wI)?i:{},OI(null==e?void 0:e.theme,wI)]),this._themeV2=hI().all([null!=(o=CI)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=hI().all([null!=(r=DI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=RI,this._theme=wI,this._themeV2=CI,this._localizations=DI}}}UI._instances={};var _I=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},MI=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},NI=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 FI,$I,GI,xI,VI,jI,WI,BI,KI,zI,qI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(FI||(FI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}($I||($I={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(GI||(GI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(xI||(xI={})),function(e){e.Invoices="invoices"}(VI||(VI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(jI||(jI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(WI||(WI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(BI||(BI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(KI||(KI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(zI||(zI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(qI||(qI={}));const HI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},JI={hidden:"hidden",edit:"edit"};var YI="6.100.0",QI={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"},XI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(YI),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=R(_().mark((function e(){var t,n,i,a,r;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ka,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:UI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Nd.set(QI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Fd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Nd.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=_I(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=SI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(s,this)}var t,n,i,o;return O(e,[{key:"initContainers",value:(o=R(_().mark((function e(t){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;UI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fa.setRequestSource(Sa.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount(),fa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getEntitlements",value:function(e){var t;return((e,t)=>t.reduce(((t,n)=>[...t,{isEntitled:e[n]||!1}]),[]))((null==(t=this.store.getState().auth.entitlementsState)?void 0:t.entitlements)||{},e)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),ZI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(fa.setAccessToken(t),fa.setUser(C({},n,{accessToken:t})),o.store.dispatch(gi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(gi.loadTenants())):(fa.setAccessToken(null),fa.setUser(null),o.store.dispatch(gi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),eL=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),tL=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),nL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},iL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=SI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new XI(this.options,t,!0),UI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,NI(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}(),oL="modern",aL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[oL]},rL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=SI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new XI(this.options,t,!0,a),UI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,NI(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 sL(e,t){return sL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sL(e,t)}function lL(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&&sL(e,t)}function cL(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function uL(e){return uL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uL(e)}function dL(){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 yL(e,t,n){return yL=dL()?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&&sL(o,n.prototype),o},yL.apply(null,arguments)}function fL(e){var t="function"==typeof Map?new Map:void 0;return fL=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 yL(e,arguments,uL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),sL(n,e)},fL(e)}function gL(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=uL(e);if(t){var o=uL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return cL(this,n)}}var pL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new XI(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){lL(n,e);var t=gL(n);function n(){var e;P(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return O(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=MI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=MI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=MI(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=MI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=MI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=MI(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}(fL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var g={};function p(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=p.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function P(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===g)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===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,g;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,g):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,g)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:C}}function C(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=w,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):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),g},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),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),g}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return tL},AdminPortalRenderer:function(){return oL},AppHolder:function(){return w},CheckoutDialog:function(){return nL},FronteggApp:function(){return ZI},HostedLogin:function(){return eL},LoginBoxRenderer:function(){return sL},createElement:function(){return MI},defaultTheme:function(){return aL},formatName:function(){return _I},getThemeAdminByName:function(){return iL},getThemeByName:function(){return rL},initialize:function(){return SL},mockFlagsList:function(){return XI},restoreSearchParams:function(){return FI},waitThemeSetter:function(){return NI}});var e={};n.r(e),n.d(e,{Delete:function(){return La},Get:function(){return ka},Patch:function(){return Pa},Post:function(){return Ta},PostDownload:function(){return Ea},Put:function(){return Ia},extractHeadersFromOptions:function(){return Oa},getBaseUrl:function(){return ma},getMetadataHeaders:function(){return ba}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return gr},getSubTenants:function(){return yr},getSubTenantsAsTree:function(){return fr},getTenants:function(){return dr},getTenantsUsersCount:function(){return pr},switchTenant:function(){return ur}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return jr},MachineToMachineAuthStrategy:function(){return Wr},OAuthLogout:function(){return fs},SocialLoginProviders:function(){return Vr},acceptInvitation:function(){return cs},activateAccount:function(){return as},bulkCreateIPRestriction:function(){return Nr},changePhoneNumber:function(){return nc},changePhoneNumberWithVerification:function(){return ec},checkIfAllowToRememberMfaDevice:function(){return wl},createDomainRestriction:function(){return Cr},createIPRestriction:function(){return Mr},createOrUpdateSessionConfigrations:function(){return fl},createSSOConfiguration:function(){return _l},createSSOConfigurationByMetadata:function(){return Fl},createSSODomain:function(){return Gl},createSSOGroup:function(){return Bl},createSamlGroup:function(){return Xs},createTenantAccessToken:function(){return Al},createUserAccessToken:function(){return bl},deleteAllSessionsForUser:function(){return pl},deleteDomainRestriction:function(){return Rr},deleteIPRestriction:function(){return $r},deleteSSOConfiguration:function(){return Nl},deleteSSODomain:function(){return xl},deleteSSOGroup:function(){return zl},deleteSamlGroup:function(){return el},deleteSessionForUser:function(){return gl},deleteTenantAccessToken:function(){return hl},deleteTenantApiToken:function(){return Ll},deleteUserAccessToken:function(){return ml},deleteUserApiToken:function(){return El},deleteWebAuthnDevice:function(){return sc},disableMFAAuthenticatorApp:function(){return Es},disableMFASMS:function(){return ws},disableMFAWebAuthn:function(){return Ds},disableMfa:function(){return Ls},enrollMFAAuthenticatorApp:function(){return bs},enrollMFAAuthenticatorAppForLogin:function(){return _s},enrollMFASMS:function(){return ks},enrollMFASMSForLogin:function(){return Fs},enrollMFAWebAuthn:function(){return Ps},enrollMFAWebAuthnForLogin:function(){return Vs},enrollMfa:function(){return hs},exchangeOAuthTokens:function(){return Yl},forgotPassword:function(){return gs},generateLoginResponse:function(){return Yr},generateLoginResponseFromOAuthResponse:function(){return Xr},generateLoginResponseV2:function(){return Qr},getActivateAccountStrategy:function(){return rs},getCaptchaPolicy:function(){return Tr},getCurrentUserSession:function(){return ul},getCurrentUserSessions:function(){return cl},getCustomSocialLoginProvidersV1:function(){return al},getDomainRestrictions:function(){return Or},getDomainRestrictionsConfig:function(){return wr},getGlobalSecurityPolicy:function(){return Sr},getIPRestrictions:function(){return Ur},getIPRestrictionsConfig:function(){return _r},getLockoutPolicy:function(){return br},getMFADevices:function(){return Rs},getMFAStrategiesConfig:function(){return uc},getMfaPolicy:function(){return vr},getOidcConfiguration:function(){return tl},getPasswordConfigPolicy:function(){return Er},getPasswordHistoryPolicy:function(){return Pr},getSSOConfigurations:function(){return Ul},getSSODefaultRoles:function(){return jl},getSSOGroups:function(){return ql},getSSOPublicConfiguration:function(){return nl},getSamlConfiguration:function(){return Bs},getSamlRoles:function(){return Js},getSamlRolesGroups:function(){return Ys},getSamlVendorConfiguration:function(){return zs},getSessionConfigurations:function(){return yl},getSocialLoginProviders:function(){return il},getSocialLoginProvidersV2:function(){return ol},getTenantAccessTokensData:function(){return vl},getTenantApiTokensData:function(){return Tl},getUserAccessTokensData:function(){return Sl},getUserApiTokensData:function(){return kl},getUserById:function(){return Ol},getVendorConfig:function(){return sl},getVendorLockoutPolicy:function(){return Ar},getVendorMfaPolicy:function(){return hr},getVendorPasswordHistoryPolicy:function(){return Ir},getVendorPublicAuthStrategiesConfig:function(){return cc},getWebAuthnDevices:function(){return rc},loadPasswordConfig:function(){return Ss},login:function(){return is},loginViaSocialLogin:function(){return rl},loginWithMfa:function(){return os},logout:function(){return ys},oidcPostLogin:function(){return ns},oidcPostLoginV2:function(){return Jl},passwordlessPostLogin:function(){return Dl},passwordlessPreLogin:function(){return Cl},postLogin:function(){return ts},preDisableMFASMS:function(){return Os},preDisableMFAWebAuthn:function(){return Cs},preEnrollMFAAuthenticatorApp:function(){return ms},preEnrollMFAAuthenticatorAppForLogin:function(){return Us},preEnrollMFASMS:function(){return As},preEnrollMFASMSForLogin:function(){return Ns},preEnrollMFAWebAuthn:function(){return Ts},preEnrollMFAWebAuthnForLogin:function(){return xs},preLogin:function(){return Zr},preLoginV2:function(){return Hl},preLoginWithIdpType:function(){return es},preVerifyMFASMSForLogin:function(){return $s},preVerifyMFAWebAuthnForLogin:function(){return js},recoverMfaToken:function(){return vs},refreshToken:function(){return us},refreshTokenV2:function(){return ds},resendActivationEmail:function(){return ss},resendInvitationEmail:function(){return ls},resetPassword:function(){return ps},resetPhoneNumber:function(){return Xl},revokeSessionsForUser:function(){return dl},saveLockoutPolicy:function(){return kr},saveMfaPolicy:function(){return mr},savePasswordHistoryPolicy:function(){return Lr},setSSODefaultRoles:function(){return Wl},signUpUser:function(){return ll},silentOAuthRefreshToken:function(){return Ql},testCurrentIp:function(){return Gr},testCurrentIpInAllowList:function(){return xr},updateDomainRestrictionConfig:function(){return Dr},updateIPRestrictionConfig:function(){return Fr},updateSSOConfiguration:function(){return Ml},updateSSOConfigurationByMetadata:function(){return $l},updateSSOGroup:function(){return Kl},updateSamlConfiguration:function(){return Ks},updateSamlGroup:function(){return Zs},updateSamlRoles:function(){return Qs},updateSamlVendorMetadata:function(){return qs},updateTenantApiTokensData:function(){return Il},updateUserApiTokensData:function(){return Pl},validateSSODomain:function(){return Vl},validateSamlDomain:function(){return Hs},verifyChangePhoneNumber:function(){return tc},verifyInviteToken:function(){return Rl},verifyMFAAuthenticatorAppForLogin:function(){return Ms},verifyMFASMSForLogin:function(){return Gs},verifyMFAWebAuthnForLogin:function(){return Ws},verifyMfa:function(){return Is},verifyNewDeviceSession:function(){return lc},verifyResetPhoneNumber:function(){return Zl},webAuthnCreateNewDeviceSession:function(){return ac},webAuthnPostLogin:function(){return oc},webAuthnPreLogin:function(){return ic}});var a={};n.r(a),n.d(a,{addUser:function(){return Sc},changePassword:function(){return gc},createInviteUserLink:function(){return mc},deleteInviteUserLink:function(){return Ac},deleteUser:function(){return vc},getInviteLinkConfiguration:function(){return Tc},getInviteUserLink:function(){return kc},getProfile:function(){return dc},loadAvailablePermissions:function(){return Ic},loadAvailableRoles:function(){return Pc},loadStats:function(){return Lc},loadUsers:function(){return pc},resendActivationLink:function(){return Ec},resendInvitationLink:function(){return Oc},resendInvitationLinkToAllTenants:function(){return wc},updateInviteUserLink:function(){return bc},updateProfile:function(){return yc},updateProfileImage:function(){return fc},updateUser:function(){return hc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Dc},getAuditsMetadata:function(){return Nc},getCurrentUserIpMetadata:function(){return Uc},getIpAdressMetadata:function(){return Fc},getNotificationsMetadata:function(){return _c},getSamlMetadata:function(){return Mc},updateAdminBoxMetadata:function(){return Rc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Kc},getReport:function(){return jc},getReports:function(){return Vc},renderReport:function(){return Wc},scheduleReport:function(){return Bc},sendReport:function(){return zc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return qc},markAllAsRead:function(){return Yc},updateNotificationIsPinned:function(){return Jc},updateNotificationStatus:function(){return Hc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return eu},getAudits:function(){return Xc},getAuditsStats:function(){return Zc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return gu},deleteEmailSubscriptions:function(){return yu},deleteSMSConfiguration:function(){return bu},deleteSMSSubscriptions:function(){return hu},deleteSlackConfiguration:function(){return su},deleteWebhooksConfiguration:function(){return Tu},getCategories:function(){return Eu},getChannelMaps:function(){return Ou},getEmailConfiguration:function(){return cu},getSMSConfiguration:function(){return pu},getSlackChannels:function(){return au},getSlackConfiguration:function(){return iu},getSlackScope:function(){return ou},getWebhookLog:function(){return Pu},getWebhooksConfigurations:function(){return Au},patchEmailConfiguration:function(){return du},patchSMSConfiguration:function(){return vu},postEmailConfiguration:function(){return uu},postSMSConfiguration:function(){return Su},postSlackCode:function(){return lu},postSlackConfiguration:function(){return ru},postWebhookRetry:function(){return Lu},postWebhookTest:function(){return Iu},postWebhooksConfiguration:function(){return ku},putEmailSubscriptions:function(){return fu},putSMSSubscriptions:function(){return mu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Du},getSettings:function(){return Cu},updateSettings:function(){return wu}});var y={};n.r(y),n.d(y,{addRole:function(){return Nu},attachPermissionToRoles:function(){return Vu},attachPermissionsToRole:function(){return Gu},deleteRole:function(){return Fu},getPermissionCategories:function(){return ju},getPermissions:function(){return xu},getRoles:function(){return Mu},updateRole:function(){return $u}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return bd},ISubscriptionStatus:function(){return hd},PaymentMethodType:function(){return md},ProviderType:function(){return Ad},TenantCreatedAction:function(){return Td},TrialEndAction:function(){return kd},cancelManagedSubscription:function(){return Yu},cancelSubscription:function(){return Ku},createStripeCustomer:function(){return ud},createStripePaymentMethodSetupIntentSecret:function(){return yd},createSubscription:function(){return ld},createTenantConfiguration:function(){return pd},getManagedSubscription:function(){return Hu},getManagedSubscriptions:function(){return Ju},getPaymentMethod:function(){return rd},getPaymentMethods:function(){return ad},getPaymentProviders:function(){return Sd},getStripeCustomer:function(){return cd},getStripePaymentProviderConfiguration:function(){return dd},getSubscription:function(){return Bu},getSubscriptionInvoice:function(){return nd},getSubscriptionInvoicePdf:function(){return id},getSubscriptionInvoices:function(){return td},getSubscriptionPlan:function(){return ed},getSubscriptionPlans:function(){return Zu},getSubscriptionSummaries:function(){return fd},getSubscriptions:function(){return Wu},getTenantConfiguration:function(){return gd},getVendorPublicConfigurations:function(){return vd},renewManagedSubscription:function(){return Qu},renewSubscription:function(){return zu},updateManagedSubscription:function(){return Xu},updatePaymentMethodBillingDetails:function(){return sd},updateSubscription:function(){return qu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Pd}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Od},addUserToTenantAndSubTenants:function(){return Ld},addUsersToSubTenant:function(){return _d},createSubTenant:function(){return Dd},deleteSubTenant:function(){return Rd},loadAllUsers:function(){return Id},removeUserFromTenantAndSubTenants:function(){return Ed},removeUserRolesFromSubTenants:function(){return wd},setUserRolesForSubTenants:function(){return Cd},updateSubAccountAccess:function(){return Ud}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return Nd},loadFeatureFlags:function(){return Fd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return jd},createConfiguration:function(){return xd},deleteConfiguration:function(){return Vd},getConfigs:function(){return $d},updateConfiguration:function(){return Gd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Wd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Qd},addUsersToGroup:function(){return Zd},createGroup:function(){return Hd},deleteGroup:function(){return Yd},deleteRolesFromGroup:function(){return Xd},deleteUsersFromGroup:function(){return ey},getGroupById:function(){return Kd},getGroupConfiguration:function(){return ty},getGroups:function(){return zd},getGroupsByIds:function(){return qd},updateGroup:function(){return Jd},updateGroupConfiguration:function(){return ny}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return iy},getUsersV3:function(){return oy}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return ay}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return jr},ContextHolder:function(){return fa},FeatureFlags:function(){return Nd},FronteggApiError:function(){return ha},FronteggContext:function(){return ga},FronteggFrameworks:function(){return va},GroupManagedByEnum:function(){return hy},GroupRelations:function(){return vy},ISubscriptionCancellationPolicy:function(){return bd},ISubscriptionStatus:function(){return hd},MFAStrategyEnum:function(){return ly},MachineToMachineAuthStrategy:function(){return Wr},PaginationOrderEnum:function(){return by},PaymentMethodType:function(){return md},ProviderType:function(){return Ad},RequestSource:function(){return Sa},RestrictionType:function(){return xn},ScimConnectionSource:function(){return Sy},SecondaryAuthStrategy:function(){return ry},SocialLoginProviders:function(){return Vr},SortByEnum:function(){return my},TenantType:function(){return uy},UserManagedByEnum:function(){return cy},WebAuthnDeviceType:function(){return sy},api:function(){return Ay},countConfigurationUsers:function(){return jd},createConfiguration:function(){return xd},default:function(){return ky},deleteConfiguration:function(){return Vd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return dy},fronteggHeaders:function(){return pa},fronteggRefreshTokenUrl:function(){return yy},fronteggSilentRefreshTokenUrl:function(){return fy},fronteggTenantsUrl:function(){return py},fronteggUsersUrl:function(){return gy},getConfigs:function(){return $d},loadFeatureFlags:function(){return Fd},updateConfiguration:function(){return Gd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function L(e){var t=function(e,t){if("object"!==I(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==I(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===I(t)?t:String(t)}function E(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,L(i.key),i)}}function O(e,t,n){return t&&E(e.prototype,t),n&&E(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return HI},AccountPageFields:function(){return VI},DomainRestrictionsTabFields:function(){return qI},GeneralSettingsTabFields:function(){return KI},InviteUserModalFields:function(){return xI},IpRestrictionsTabFields:function(){return zI},Metadata:function(){return UI},PrivacyPageFields:function(){return GI},ProfilePageFields:function(){return $I},SecurityPageTabs:function(){return WI},SessionManagementTabFields:function(){return BI},SubscriptionsPageFields:function(){return jI},alpha:function(){return TI},fieldAppearance:function(){return JI},tabAppearance:function(){return YI}});var w=function(){function e(){P(this,e)}return O(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(){return C=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},C.apply(this,arguments)}function D(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function R(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){D(a,i,o,r,s,"next",e)}function s(e){D(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var U=n(841),_=n.n(U);function M(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function N(e){return!!e&&!!e[ke]}function F(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===Te}(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor[Ae]||W(e)||B(e))}function $(e,t,n){void 0===n&&(n=!1),0===G(e)?(n?Object.keys:Pe)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function G(e){var t=e[ke];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:W(e)?2:B(e)?3:0}function x(e,t){return 2===G(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var i=G(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return ve&&e instanceof Map}function B(e){return he&&e instanceof Set}function K(e){return e.o||e.t}function z(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ie(e);delete t[ke];for(var n=Pe(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||N(e)||!F(e)||(G(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&$(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){M(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Le[e];return t||M(18,e),t}function Q(){return pe}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===pe&&(pe=e.l)}function te(e){return pe={p:[],l:pe,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function ie(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,i),i?(n[ke].P&&(Z(t),M(4)),F(e)&&(e=oe(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=oe(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==be?e:void 0}function oe(e,t,n){if(J(t))return t;var i=t[ke];if(!i)return $(t,(function(o,a){return ae(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return re(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=z(i.k):i.o;$(3===i.i?new Set(o):o,(function(t,a){return ae(e,i,o,t,a,n)})),re(e,o,!1),n&&e.u&&Y("Patches").R(i,n,e.u,e.s)}return i.o}function ae(e,t,n,i,o,a){if(N(o)){var r=oe(e,o,a&&t&&3!==t.i&&!x(t.D,i)?a.concat(i):void 0);if(V(n,i,r),!N(r))return;e.m=!1}if(F(o)&&!J(o)){if(!e.h.F&&e._<1)return;oe(e,o),t&&t.A.l||re(e,o)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function se(e,t){var n=e[ke];return(n?K(n):e)[t]}function le(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function ce(e){e.P||(e.P=!0,e.l&&ce(e.l))}function ue(e){e.o||(e.o=z(e.t))}function de(e,t,n){var i=W(t)?Y("MapSet").N(t,n):B(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:Q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ee;n&&(o=[i],a=Oe);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(i),i}function ye(e){return N(e)||M(22,e),function e(t){if(!F(t))return t;var n,i=t[ke],o=G(t);if(i){if(!i.P&&(i.i<4||!Y("ES5").K(i)))return i.t;i.I=!0,n=fe(t,o),i.I=!1}else n=fe(t,o);return $(n,(function(t,o){i&&function(e,t){return 2===G(e)?e.get(t):e[t]}(i.t,t)===o||V(n,t,e(o))})),3===o?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var ge,pe,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,be=Se?Symbol.for("immer-nothing"):((ge={})["immer-nothing"]=!0,ge),Ae=Se?Symbol.for("immer-draftable"):"__$immer_draftable",ke=Se?Symbol.for("immer-state"):"__$immer_state",Te=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Pe="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ie=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Le={},Ee={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var i,o=le(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!F(i)?i:i===se(e.t,t)?(ue(e),e.o[t]=de(e.A.h,i,e)):i},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var i=le(K(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=se(K(e),t),a=null==o?void 0:o[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,o)&&(void 0!==n||x(e.t,t)))return!0;ue(e),ce(e)}return e.o[t]===n&&"number"!=typeof n&&(void 0!==n||t in e.o)||(e.o[t]=n,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==se(e.t,t)||t in e.t?(e.D[t]=!1,ue(e),ce(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=K(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){M(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){M(12)}},Oe={};$(Ee,(function(e,t){Oe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Oe.deleteProperty=function(e,t){return Oe.set.call(this,e,t,void 0)},Oe.set=function(e,t,n){return Ee.set.call(this,e[0],t,n,e[0])};var we=function(){function e(e){var t=this;this.g=me,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&M(6),void 0!==i&&"function"!=typeof i&&M(7),F(e)){var s=te(t),l=de(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Z(s):ee(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(s,i),ie(e,s)}),(function(e){throw Z(s),e})):(X(s,i),ie(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===be&&(r=void 0),t.F&&q(r,!0),i){var u=[],d=[];Y("Patches").M(e,r,u,d),i(u,d)}return r}M(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){F(e)||M(8),N(e)&&(e=ye(e));var t=te(this),n=de(this,e,void 0);return n[ke].C=!0,ee(t),n},t.finishDraft=function(e,t){var n=(e&&e[ke]).A;return X(n,t),ie(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&M(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=Y("Patches").$;return N(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ce=new we,De=Ce.produce,Re=(Ce.produceWithPatches.bind(Ce),Ce.setAutoFreeze.bind(Ce),Ce.setUseProxies.bind(Ce),Ce.applyPatches.bind(Ce),Ce.createDraft.bind(Ce),Ce.finishDraft.bind(Ce),De);function Ue(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(n),!0).forEach((function(t){Ue(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ne(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",$e=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ge={INIT:"@@redux/INIT"+$e(),REPLACE:"@@redux/REPLACE"+$e(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+$e()}};function xe(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ve(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ne(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ne(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Ne(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Ne(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ne(4));if(l)throw new Error(Ne(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ne(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Ne(7));if(void 0===e.type)throw new Error(Ne(8));if(l)throw new Error(Ne(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ne(10));o=e,y({type:Ge.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ne(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:Ge.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=g,i}function je(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Ge.INIT}))throw new Error(Ne(12));if(void 0===n(void 0,{type:Ge.PROBE_UNKNOWN_ACTION()}))throw new Error(Ne(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ne(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ne(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=We.apply(void 0,a)(n.dispatch),Me(Me({},n),{},{dispatch:i})}}}function Ke(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var ze=Ke();ze.withExtraArgument=Ke;var qe,He=ze,Je=(qe=function(e,t){return qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ye=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Qe=Object.defineProperty,Xe=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ze=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=function(e,t,n){return t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},nt=function(e,t){for(var n in t||(t={}))Ze.call(t,n)&&tt(e,n,t[n]);if(Xe)for(var i=0,o=Xe(t);i<o.length;i++)n=o[i],et.call(t,n)&&tt(e,n,t[n]);return e},it="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?We:We.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ot=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,Ye([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ye([void 0],e.concat(this))))},t}(Array);function at(e){return F(e)?Re(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new ot);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(He):i.push(He.withExtraArgument(n.extraArgument))),i}function st(e){var t,n=function(e){return rt(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=je(a)}var g=s;"function"==typeof g&&(g=g(n));var p=Be.apply(void 0,g),S=We;c&&(S=it(nt({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=Ye([p],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function lt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return nt(nt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ct(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function ut(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:at(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ct(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=nt(nt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ct(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return at(e())};else{var c=at(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ye([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(N(e))return void 0===(i=n(e,t))?e:i;if(F(e))return Re(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?lt(c,i):lt(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var dt="listenerMiddleware";lt(dt+"/add"),lt(dt+"/removeAll"),lt(dt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Ee.get(t,e)},set:function(t){var n=this[ke];Ee.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ke];if(!o.P)switch(o.i){case 5:i(o)&&ce(o);break;case 4:n(o)&&ce(o)}}}function n(e){for(var t=e.t,n=e.k,i=Pe(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var s=n[a],l=s&&s[ke];if(l?l.t!==r:!j(s,r))return!0}}var c=!!t[ke];return i.length!==Pe(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Le[e]||(Le[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Ie(n);delete a[ke];for(var r=Pe(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:Q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ke,{value:a,writable:!0}),o},S:function(e,n,o){o?N(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)$(a,(function(t){t!==ke&&(void 0!==o[t]||x(o,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),$(o,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===s){if(i(n)&&(ce(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const yt=(e,t)=>n=>C({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),gt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return C({},n,{[e]:C({},n[e],{[t]:C({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{loaders:C({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return C({},t,{[e]:C({},t[e],{errors:C({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),ht=(e,t,n)=>i=>{var o;return C({},i,{[e]:C({},i[e],{[t]:C({},null==i||null==(o=i[e])?void 0:o[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",At=new Uint8Array(256);for(let e=0;e<bt.length;e++)At[bt.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=At[e.charCodeAt(i)],a=At[e.charCodeAt(i+1)],r=At[e.charCodeAt(i+2)],s=At[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Tt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Tt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=bt[t[i]>>2],o+=bt[(3&t[i])<<4|t[i+1]>>4],o+=bt[(15&t[i+1])<<2|t[i+2]>>6],o+=bt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Tt(e[n]);return t}return e};let Pt,It,Lt;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(It||(It={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Lt||(Lt={}));const Et="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ct="connectivity",Dt="auditLogs",Rt="vendor",Ut={flow:It.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},_t={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:Ut})},Mt={requestAuthorize:lt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:lt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:lt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:lt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:lt("auth/afterAuthNavigation"),preLogin:lt("auth/preLogin",(e=>({payload:e}))),postLogin:lt("auth/postLogin",(e=>({payload:e}))),login:lt("auth/login",(e=>({payload:e}))),loginWithMfa:lt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:lt("auth/recoverMfa",(e=>({payload:e}))),logout:lt("auth/logout",(e=>({payload:e}))),silentLogout:lt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:lt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:lt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:lt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:lt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:lt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:lt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:lt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:lt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:lt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:lt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:lt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:lt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:lt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:lt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:lt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:lt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:lt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:lt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:lt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:lt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:lt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Nt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Nt||(Nt={}));const Ft={step:Nt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},$t={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:gt("activateState","activationStrategy")},Gt={activateAccount:lt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:lt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:lt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:lt("auth/resendActivationEmail",(e=>({payload:e})))};let xt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(xt||(xt={}));const Vt={step:xt.validate},jt={setAcceptInvitationState:ft("acceptInvitationState"),resetAcceptInvitationState:yt("acceptInvitationState",{acceptInvitationState:Vt})},Wt={acceptInvitation:lt("auth/acceptInvitation",(e=>({payload:e})))};let Bt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Bt||(Bt={}));const Kt={step:Bt.forgotPassword,loading:!1,email:"",passwordConfig:null},zt={setForgotPasswordState:ft("forgotPasswordState"),resetForgotPasswordState:yt("forgotPasswordState",{forgotPasswordState:Kt})},qt={forgotPassword:lt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:lt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:lt("auth/loadPasswordConfig",(e=>({payload:e})))};let Ht;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Ht||(Ht={}));const Jt={step:Ht.ResetPhoneNumber,loading:!1},Yt={setResetPhoneNumberState:ft("resetPhoneNumberState"),resetResetPhoneNumberState:yt("resetPhoneNumberState",{resetPhoneNumberState:Jt})},Qt={resetPhoneNumber:lt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:lt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:lt("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:pt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:lt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:lt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:lt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:lt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:lt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:lt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:lt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:lt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:lt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:lt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:lt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:lt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:lt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:lt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:lt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:lt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:lt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:lt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:lt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:lt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:lt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:lt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:lt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:lt("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:lt("auth/loadProfile"),saveProfile:lt("auth/saveProfile",(e=>({payload:e}))),changePassword:lt("auth/changePassword",(e=>({payload:e})))};let an;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(an||(an={}));const rn={step:an.verify,loading:!1,saving:!1},sn={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},ln={enrollMfa:lt("auth/enrollMfa"),getMFADevices:lt("auth/getMFADevices"),getMFAStrategies:lt("auth/getMFAStrategies"),verifyMfa:lt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:lt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:lt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:lt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:lt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:lt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:lt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:lt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:lt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:lt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:lt("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:pt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:lt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:lt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:lt("auth/loadRoles",(e=>({payload:e}))),addUser:lt("auth/addUser",(e=>({payload:e}))),addUsersBulk:lt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:lt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:lt("auth/updateUser",(e=>({payload:e}))),deleteUser:lt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:lt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:lt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:lt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:lt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:lt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:lt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:lt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:lt("auth/getInvitationLink"),createInvitationLink:lt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:lt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:lt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:lt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:lt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:lt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:lt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:lt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:lt("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},gn={loadSocialLoginsConfiguration:lt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:lt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:lt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:lt("auth/setSocialLoginError",(e=>({payload:e})))};let pn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(pn||(pn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:pn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:lt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:lt("auth/resetSignUpStateSoft")},mn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},bn={setApiTokensLoader:pt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},An={loadApiTokens:lt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:lt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:lt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:lt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:lt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:lt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:lt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:lt("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:gt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:gt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:gt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:gt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:gt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:gt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:gt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:gt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:gt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:gt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:gt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:lt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:lt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:lt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:lt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:lt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:lt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:lt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:lt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:lt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:lt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:lt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:lt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:lt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:lt("auth/loadPublicAuthStrategiesPolicy")},In={loading:!1},Ln={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:In})},En={loadAccountSettings:lt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:lt("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Cn={switchTenant:lt("auth/switchTenant",(e=>({payload:e}))),loadTenants:lt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:lt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:lt("auth/loadSubTenantsTree",(e=>({payload:e})))},Dn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Rn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Dn})},Un={loadRolesAndPermissions:lt("auth/loadRoles",(e=>({payload:e}))),addRole:lt("auth/addRole",(e=>({payload:e}))),updateRole:lt("auth/updateRole",(e=>({payload:e}))),deleteRole:lt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:lt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:lt("auth/attachPermissionToRoles",(e=>({payload:e})))},_n={loading:!1,sessions:[]},Mn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:_n})},Nn={loadUserSessions:lt("auth/loadUserSessions"),loadCurrentUserSession:lt("auth/loadCurrentUserSession"),deleteUserSession:lt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:lt("auth/deleteAllUserSessions"),revokeUserSessions:lt("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},$n={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},Gn={loadSessionsPolicy:lt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:lt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:gt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:gt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:lt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:lt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:lt("auth/loadIpRestrictions"),saveIpRestriction:lt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:lt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:lt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:lt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:lt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:lt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:lt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:lt("auth/loadProvisionConnections"),createProvisionConnection:lt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:lt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:lt("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:lt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:lt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:pt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:lt("auth/loadUsersGroups"),getGroupById:lt("auth/getGroupById",(e=>({payload:e}))),createGroup:lt("auth/createGroup",(e=>({payload:e}))),updateGroup:lt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:lt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:lt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:lt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:lt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:lt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:lt("auth/getGroupConfiguration"),updateGroupConfiguration:lt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:lt("auth/getUsers",(e=>({payload:e})))},Zn={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},ei={setGroupsDialogsState:ft("groupsDialogsState"),resetGroupsDialogsState:yt("groupsState",{groupsDialogsState:Zn}),openAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:ht("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:vt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:ht("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:vt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:ht("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:ht("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:vt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:ht("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ti={loading:!0,error:null},ni={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:ti})},ii={loadTenantMetadata:lt("auth/loadTenantMetadata"),updateTenantMetadata:lt("auth/updateTenantMetadata",(e=>({payload:e})))},oi={setEntitlementsState:ft("entitlementsState")},ai={loadEntitlements:lt("auth/loadEntitlements")},ri={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:Ut,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:ti,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:In,tenantsState:On,rolesState:Dn,resetPhoneNumberState:Jt,sessionsState:_n,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn,entitlementsState:{entitlements:void 0,loading:!1,error:void 0}},si=C({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},ri);let li;!function(e){e.impersonating="impersonating",e.success="success"}(li||(li={}));const ci={step:li.impersonating,loading:!1},ui={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:ci})},di={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:yi,actions:fi}=ut({name:wt,initialState:si,reducers:C({resetState:e=>C({},e,ri),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,ui,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Kn,Hn,oi)});const gi=C({},fi,Mt,gn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ai,di,Jn);var pi=function(e){return"@@redux-saga/"+e},Si=pi("CANCEL_PROMISE"),vi=pi("CHANNEL_END"),hi=pi("IO"),mi=pi("MATCH"),bi=pi("MULTICAST"),Ai=pi("SAGA_ACTION"),ki=pi("SELF_CANCELLATION"),Ti=pi("TASK"),Pi=pi("TASK_CANCEL"),Ii=pi("TERMINATE"),Li=pi("LOCATION");function Ei(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 Oi=function(e){return null==e},wi=function(e){return null!=e},Ci=function(e){return"function"==typeof e},Di=function(e){return"string"==typeof e},Ri=Array.isArray,Ui=function(e){return e&&Ci(e.then)},_i=function(e){return e&&Ci(e.next)&&Ci(e.throw)},Mi=function e(t){return t&&(Di(t)||$i(t)||Ci(t)||Ri(t)&&t.every(e))},Ni=function(e){return e&&Ci(e.take)&&Ci(e.close)},Fi=function(e){return Ci(e)&&e.hasOwnProperty("toString")},$i=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Gi=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},xi=function(e){return function(){return e}},Vi=xi(!0),ji=function(){},Wi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Bi=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ki(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var zi=function(e){throw e},qi=function(e){return{value:e,done:!0}};function Hi(e,t,n){void 0===t&&(t=zi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:qi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Ji(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Yi=function(e){return Array.apply(null,new Array(e))},Qi=function(e){return function(t){return e(Object.defineProperty(t,Ai,{value:!0}))}},Xi=function(e){return e===Ii},Zi=function(e){return e===Pi},eo=function(e){return Xi(e)||Zi(e)};function to(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ri(e)?Yi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||eo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=ji,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function no(e){return{name:e.name||"anonymous",location:io(e)}}function io(e){return e[Li]}var oo=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)},ao="TAKE",ro="CALL",so="FORK",lo="SELECT",co=function(e,t){var n;return(n={})[hi]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function uo(e,t){return void 0===e&&(e="*"),Mi(e)?(wi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),co(ao,{pattern:e})):Ni(n=e)&&n[bi]&&wi(t)&&Mi(t)?co(ao,{channel:e,pattern:t}):Ni(e)?(wi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),co(ao,{channel:e})):void 0;var n}function yo(e,t){return Oi(t)&&(t=e,e=void 0),co("PUT",{channel:e,action:t})}function fo(e){var t=co("ALL",e);return t.combinator=!0,t}function go(e,t){var n,i=null;return Ci(e)?n=e:(Ri(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&Di(n)&&Ci(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function po(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return co(ro,go(e,n))}function So(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 co(so,go(e,n))}function vo(e){return void 0===e&&(e=ki),co("CANCEL",e)}function ho(e){void 0===e&&(e=Wi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return co(lo,{selector:e,args:n})}var mo=po.bind(null,Gi);var bo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Ao=[],ko=0;function To(e){try{Lo(),e()}finally{Eo()}}function Po(e){Ao.push(e),ko||(Lo(),Oo())}function Io(e){try{return Lo(),e()}finally{Oo()}}function Lo(){ko++}function Eo(){ko--}function Oo(){var e;for(Eo();!ko&&void 0!==(e=Ao.shift());)To(e)}var wo=function(e){return function(t){return e.some((function(e){return _o(e)(t)}))}},Co=function(e){return function(t){return e(t)}},Do=function(e){return function(t){return t.type===String(e)}},Ro=function(e){return function(t){return t.type===e}},Uo=function(){return Vi};function _o(e){var t="*"===e?Uo:Di(e)?Do:Ri(e)?wo:Fi(e)?Do:Ci(e)?Co:$i(e)?Ro:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Mo={type:vi},No=function(e){return e&&e.type===vi};function Fo(){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(Mo)}))},(e={})[bi]=!0,e.put=function(e){if(!t)if(No(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[mi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Uo),t?e(Mo):(e[mi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ki(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ai]?s(e):Po((function(){s(e)}))},r}function $o(e,t){var n=e[Si];Ci(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Go,xo=0,Vo=function(){return++xo};function jo(e){e.isRunning()&&e.cancel()}var Wo=((Go={}).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):!No(e)||r?n(e):n(Ii)};try{o.take(s,wi(a)?_o(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Go.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Po((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Ui(t)?$o(t,n):n(t)}))},Go.ALL=function(e,t,n,i){var o=i.digestEffect,a=xo,r=Object.keys(t);if(0!==r.length){var s=to(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ri(t)?[]:{})},Go.RACE=function(e,t,n,i){var o=i.digestEffect,a=xo,r=Object.keys(t),s=Ri(t)?Yi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||eo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=ji,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)}))},Go.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(Ui(l))return void $o(l,n);if(_i(l))return void Zo(e,l,s.context,xo,no(a),!1,n);n(l)}catch(e){n(e,!0)}},Go.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Oi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Go.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(_i(o))return o;var a=!1;return Hi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Ui(o)})}))}catch(e){return Hi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:no(t)}(c,a);Io((function(){var t=Zo(e,c,l.context,xo,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Go.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()&&Ki(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ri(t)){if(0===t.length)return void n([]);var r=to(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Go.CANCEL=function(e,t,n,i){var o=i.task;t===ki?jo(o):Ri(t)?t.forEach(jo):jo(t),n()},Go.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)}},Go.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=oo());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Mo):e.isEmpty()?(n.push(i),i.cancel=function(){Ki(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(Mo):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])(Mo)}}}}(t.buffer),a=_o(i),r=function t(n){No(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)},Go.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Go.FLUSH=function(e,t,n){t.flush(n)},Go.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Go.SET_CONTEXT=function(e,t,n,i){var o=i.task;Bi(o.context,t),n()},Go);function Bo(e,t){return e+"?"+t}function Ko(e){var t=e.name,n=e.location;return n?t+" "+Bo(n.fileName,n.lineNumber):t}function zo(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 qo=null,Ho=[],Jo=function(e){e.crashedEffect=qo,Ho.push(e)},Yo=function(){qo=null,Ho.length=0},Qo=function(){var e,t,n=Ho[0],i=Ho.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=io(e))?t.code+" "+Bo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Ko(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Ko(e.meta)})),[zo(Ho)]).join("\n")};function Xo(e,t,n,i,o,a,r){var s;void 0===r&&(r=ji);var l,c,u=0,d=null,y=[],f=Object.create(n),g=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,g.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Ki(o,t),t.cont=ji,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=ji,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Jo({meta:o,cancelledTasks:y}),S.isRoot){var i=Qo();Yo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Pi?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={})[Ti]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=g,s.cancel=function(){0===u&&(u=1,g.cancelAll(),p(Pi,!1))},s.cont=r,s.end=p,s.setContext=function(e){Bi(f,e)},s.toPromise=function(){return d||(d=bo(),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 Zo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Ui(t)?$o(t,i):_i(t)?Zo(e,t,c.context,n,o,!1,i):t&&t[hi]?(0,Wo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=ji;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Pi))},status:0},c=Xo(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),Yo()):Zi(e)?(l.status=1,d.cancel(),o=Ci(t.return)?t.return(Pi):{done:!0,value:Pi}):o=Xi(e)?Ci(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=Vo();function l(n,o){a||(a=!0,i.cancel=ji,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){qo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=ji,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=ji,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function ea(e,t){for(var n=e.channel,i=void 0===n?Fo():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?Ji:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Vo();if(l&&(l.rootSagaStarted=l.rootSagaStarted||ji,l.effectTriggered=l.effectTriggered||ji,l.effectResolved=l.effectResolved||ji,l.effectRejected=l.effectRejected||ji,l.effectCancelled=l.effectCancelled||ji,l.actionDispatched=l.actionDispatched||ji,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Wi;var m={channel:i,dispatch:Qi(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:p};return Io((function(){var e=Zo(m,S,s,v,no(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var ta=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Fo():a,s=n.sagaMonitor,l=Ei(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=ea.bind(null,C({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Bi(o,e)},c},na=function(e){return{done:!0,value:e}},ia={};function oa(e){return Ni(e)?"channel":Fi(e)?String(e):Ci(e)?e.name:String(e)}function aa(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ia)return na(t);if(n&&!o)throw r=ia,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===ia?na(t):a}return Hi(s,(function(e){return s(null,e)}),n)}function ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:uo(e)},s=function(e){return{done:!1,value:So.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return aa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+oa(e)+", "+t.name+")")}function sa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:uo(e)},l=function(e){return{done:!1,value:So.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:vo(e)}},u=function(e){return a=e},d=function(e){return r=e};return aa({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("+oa(e)+", "+t.name+")")}function la(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:uo(e)},s=function(e){return{done:!1,value:po.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return aa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+oa(e)+", "+t.name+")")}function ca(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:po.apply(void 0,[n].concat(a))},l={done:!1,value:mo(t)};return aa({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ia}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function ua(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return So.apply(void 0,[ra,e,t].concat(i))}function da(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 So.apply(void 0,[sa,e,t].concat(i))}function ya(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 So.apply(void 0,[la,e,t].concat(i))}class fa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return fa.instance||(fa.instance=new fa),fa.instance}static setContext(e){fa.getInstance().context=e}static setAccessToken(e){fa.getInstance().accessToken=e}static setUser(e){fa.getInstance().user=e}static setRequestSource(e){fa.getInstance().requestSource=e}static setOnRedirectTo(e){fa.getInstance().onRedirectTo=e}static setLogout(e,t){fa.getInstance().logout=n=>{n?e(n):fa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=fa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return fa.getInstance().accessToken}static getRequestSource(){return fa.getInstance().requestSource}static getUser(){return fa.getInstance().user}static onRedirectTo(e,t){return fa.getInstance().onRedirectTo(e,t)}static logout(e){return fa.getInstance().logout(e)}}fa.instance=void 0;const ga={getContext:()=>fa.getContext(),getAccessToken:()=>fa.getAccessToken(),getUser:()=>fa.getUser(),onRedirectTo:(e,t)=>fa.onRedirectTo(e,t),logout:e=>fa.logout(e)},pa={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let Sa,va;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(Sa||(Sa={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(va||(va={}));class ha extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ma(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}function ba(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[pa.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[pa.frameWork]=e.metadataHeaders.framework),i}const Aa=async e=>{var t,n,i;const o=fa.getContext(),a=await async function(e,t){var n;const i=ba(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:fa.getAccessToken)(),a=fa.getRequestSource();t&&(i[pa.contentType]=t),a&&(i[pa.source]=a),o&&(i.Authorization=`Bearer ${o}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=ma(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:C({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new ha("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 ha(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{}}},ka=async(e,t,n)=>Aa(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Ta=async(e,t,n)=>Aa(C({url:e,method:"POST",contentType:"application/json",body:t},n)),Pa=async(e,t,n)=>Aa(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ia=async(e,t,n)=>Aa(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),La=async(e,t,n)=>Aa(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ea=async(e,t,n,i)=>Aa(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Oa=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),wa={v1:"/identity/resources/users/webauthn/v1/devices"},Ca={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Da={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},Ra={v1:"/identity/resources/configurations/v1"},Ua={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},_a={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ma={v1:"/identity/resources/permissions/v1"},Na={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Fa={v1:"/identity/resources/roles/v1"},$a={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Ga={v1:"/identity/resources/impersonation/v1"},xa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Va={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ja={v1:"/team/resources/members/v1"},Wa={v1:"/team/resources/roles/v1"},Ba={v1:"/team/resources/stats/v1"},Ka={v1:"/team/resources/profile"},za={v1:"/tenants/resources/account-settings/v1"},qa={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},Ha={v1:"/tenants/resources/sub-tenants/v1"},Ja={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ya={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},Qa={v1:"/subscriptions/resources/payment-providers/v1"},Xa={v1:"/subscriptions/resources/subscriptions/v1"},Za={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},er={v1:"/reports/engine/resources/triggers/v1"},tr="/notification",nr="/audits",ir={v1:"/event/resources/configurations/v1"},or="/webhook",ar="/oauth",rr="/flags",sr="/directory/resources/v1/configurations/scim2",lr="/directory/resources/scim/temp",cr="/entitlements/check/v1";async function ur(e){return Ia(`${Da.v1}/tenant`,e)}async function dr(){return ka(`${Da.v2}/me/tenants`)}async function yr(e){return ka(qa.v1,void 0,{headers:Oa(e)})}async function fr(e){return ka(qa.tree.v1,void 0,{headers:Oa(e)})}async function gr(e){return ka(qa.parents.v1,void 0,{headers:Oa(e)})}async function pr(e,t){return Ta(`${Na.users.v1}/count`,e,{headers:Oa(t)})}async function Sr(){return ka(Ra.v1)}async function vr(){return ka(`${Ra.v1}/mfa-policy`)}async function hr(){return ka(`${Ra.v1}/mfa-policy/vendor`)}async function mr(e){return e.id?Pa(`${Ra.v1}/mfa-policy`,e):Ta(`${Ra.v1}/mfa-policy`,e)}async function br(){return ka(`${Ra.v1}/lockout-policy`)}async function Ar(){return ka(`${Ra.v1}/lockout-policy/vendor`)}async function kr(e){return e.id?Pa(`${Ra.v1}/lockout-policy`,e):Ta(`${Ra.v1}/lockout-policy`,e)}async function Tr(){try{return await ka(`${Ra.v1}/captcha-policy/public`)}catch{return null}}async function Pr(){return ka(`${Ra.v1}/password-history-policy`)}async function Ir(){return ka(`${Ra.v1}/password-history-policy/vendor`)}async function Lr(e){return e.id?Pa(`${Ra.v1}/password-history-policy`,e):Ta(`${Ra.v1}/password-history-policy`,e)}async function Er(){return ka(`${Ra.v1}/password`)}async function Or(){return ka(`${Ua.emailDomain.v1}`)}async function wr(){return ka(`${Ua.emailDomain.v1}/config`)}async function Cr(e){return Ta(`${Ua.emailDomain.v1}`,e)}async function Dr(e){return Ta(`${Ua.emailDomain.v1}/config`,e)}async function Rr(e){return La(`${Ua.emailDomain.v1}/${e}`)}async function Ur(e){return ka(`${Ua.ip.v1}`,e)}async function _r(){return ka(`${Ua.ip.v1}/config`)}async function Mr(e){return Ta(`${Ua.ip.v1}`,e)}async function Nr(e){return Ta(`${Ua.ip.v1}/bulk`,e)}async function Fr(e){return Ta(`${Ua.ip.v1}/config`,e)}async function $r(e){return La(`${Ua.ip.v1}/${e}`)}async function Gr(){return Ta(`${Ua.ip.v1}/verify`)}async function xr(){return Ta(`${Ua.ip.v1}/verify/allow`)}let Vr,jr,Wr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Vr||(Vr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(jr||(jr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Wr||(Wr={}));class Br extends Error{constructor(e){super(e)}}const Kr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Br("'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 zr extends Error{constructor(e){super(e)}}const qr=(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(Kr(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 Kr(t)}})(e.split(".")[n]))}catch(e){throw new zr("Invalid token specified: "+e.message)}},Hr=["type"],Jr=["type"];async function Yr(e){if(!e.accessToken)return e;fa.setAccessToken(e.accessToken);const t=await ka(`${Da.v2}/me`),n=C({},e,e.accessToken?qr(e.accessToken):{},t);return fa.setUser(n),n}async function Qr(e){if(!e.accessToken)return{user:e};fa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ka(`${Da.v2}/me`),dr()]),i=C({},e,e.accessToken?qr(e.accessToken):{},t);return fa.setUser(i),{user:i,tenants:n}}async function Xr(e){fa.setAccessToken(e.id_token);const t=await ka(`${Da.v2}/me`),n=e.id_token?qr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return fa.setUser(i),i}async function Zr(e){try{const{address:t}=await Ta(`${Ca.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function es(e){return Ta(`${Ca.v1}/user/saml/prelogin`,e)}async function ts(e){return Yr(await Ta(`${Ca.v1}/user/saml/postlogin`,e))}async function ns(e){return Yr(await Ta(`${Ca.v1}/user/oidc/postlogin`,e))}async function is(e){return Yr(await Ta(`${Ca.v1}/user`,e))}async function os(e){return Yr(await Ta(`${Ca.v1}/user/mfa/verify`,e))}async function as(e){return Ta(`${Da.v1}/activate`,e)}async function rs(e){return ka(`${Da.v1}/activate/strategy`,e)}async function ss(e){return Ta(`${Da.v1}/activate/reset`,e)}async function ls(e){return Ta(`${Da.v1}/invitation/reset`,e)}async function cs(e){return Ta(`${Da.v1}/invitation/accept`,e)}async function us(){return Yr(await Ta(`${Ca.v1}/user/token/refresh`))}async function ds(){return Qr(await Ta(`${Ca.v1}/user/token/refresh`))}async function ys(){return Ta(`${Ca.v1}/logout`)}async function fs(e){return ka(`${ar}/logout`,e)}async function gs(e){return Ta(`${Da.v1}/passwords/reset`,e)}async function ps(e){return Ta(`${Da.v1}/passwords/reset/verify`,e)}async function Ss(e){return ka(`${Da.v1}/passwords/config`,e)}async function vs(e){return Ta(`${Ca.v1}/user/mfa/recover`,e)}async function hs(){return Ta(`${Da.v1}/mfa/enroll`)}async function ms(){return Ta(`${Da.v1}/mfa/authenticator/enroll`)}async function bs(e){return Ta(`${Da.v1}/mfa/authenticator/enroll/verify`,e)}async function As(e){return Ta(`${Da.v1}/mfa/sms/enroll`,e)}async function ks(e){return Ta(`${Da.v1}/mfa/sms/enroll/verify`,e)}async function Ts(){return Ta(`${Da.v1}/mfa/webauthn/enroll`)}async function Ps(e){return Ta(`${Da.v1}/mfa/webauthn/enroll/verify`,e)}async function Is(e){return Ta(`${Da.v1}/mfa/enroll/verify`,e)}async function Ls(e){return Ta(`${Da.v1}/mfa/disable`,e)}async function Es(e,t){return Ta(`${Da.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Os(e){return Ta(`${Da.v1}/mfa/sms/${e}/disable`)}async function ws(e,t){return Ta(`${Da.v1}/mfa/sms/${e}/disable/verify`,t)}async function Cs(e){return Ta(`${Da.v1}/mfa/webauthn/${e}/disable`)}async function Ds(e,t){return Ta(`${Da.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Rs(){return ka(`${Da.v1}/mfa/devices`)}async function Us(e){return Ta(`${Ca.v1}/user/mfa/authenticator/enroll`,e)}async function _s(e){return Ta(`${Ca.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Ms(e,t){return Ta(`${Ca.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Ns(e){return Ta(`${Ca.v1}/user/mfa/sms/enroll`,e)}async function Fs(e){return Ta(`${Ca.v1}/user/mfa/sms/enroll/verify`,e)}async function $s(e,t){return Ta(`${Ca.v1}/user/mfa/sms/${e}`,t)}async function Gs(e,t){return Ta(`${Ca.v1}/user/mfa/sms/${e}/verify`,t)}async function xs(e){return Ta(`${Ca.v1}/user/mfa/webauthn/enroll`,e)}async function Vs(e){return Ta(`${Ca.v1}/user/mfa/webauthn/enroll/verify`,e)}async function js(e,t){return Ta(`${Ca.v1}/user/mfa/webauthn/${e}`,t)}async function Ws(e,t){return Ta(`${Ca.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Bs(){return ka(`${Va.v1}/saml/configurations`)}async function Ks(e){return Ta(`${Va.v1}/saml/configurations`,e)}async function zs(){return ka(`${Va.v1}/saml/configurations/vendor-config`)}async function qs(e){return Ia(`${Va.v1}/saml/configurations/metadata`,e)}async function Hs(){return Ia(`${Va.v1}/saml/validations/domain`)}async function Js(){return ka(`${Va.v1}/saml/configurations/roles/default`)}async function Ys(){return ka(`${Va.v2}/saml/configurations/groups`)}async function Qs({roleIds:e}){return Ta(`${Va.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Xs({roleIds:e,group:t}){return Ta(`${Va.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Zs({roleIds:e,group:t,id:n}){return Pa(`${Va.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function el({id:e}){return La(`${Va.v2}/saml/configurations/groups/${e}`)}async function tl(){return ka(`${Va.v1}/oidc/configurations`)}async function nl(){return ka(`${Va.v2}/configurations/public`)}async function il(){return ka(_a.v1)}async function ol(){return ka(_a.v2)}async function al(){return ka(_a.custom.v1)}async function rl({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),Ta(`${Ca.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function sl(){return ka(`${Ra.v1}/public`)}async function ll(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Ta(`${Da.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Yr(n):void 0,userId:i,tenantId:o}}async function cl(){return ka(Da.sessions.currentUser.v1)}async function ul(){return ka(`${Da.sessions.currentUser.v1}/current`)}async function dl(e){return Ta(`${Da.sessions.v1}/revoke`,{userId:e})}async function yl(){return ka(Da.sessions.configurations.v1)}async function fl(e){await Ta(Da.sessions.configurations.v1,e)}async function gl(e){await La(`${Da.sessions.currentUser.v1}/${e}`)}async function pl(){await La(`${Da.sessions.currentUser.v1}/all`)}async function Sl(){return ka(Da.accessTokens.v1)}async function vl(){return ka(Na.accessTokens.v1)}async function hl({id:e}){return La(`${Na.accessTokens.v1}/${e}`)}async function ml({id:e}){return La(`${Da.accessTokens.v1}/${e}`)}async function bl(e){return Ta(Da.accessTokens.v1,e)}async function Al(e){return Ta(Na.accessTokens.v1,e)}async function kl(){return ka(Da.apiTokens.v1)}async function Tl(){return ka(Na.apiTokens.v1)}async function Pl(e){return Ta(Da.apiTokens.v1,e)}async function Il(e){return Ta(Na.apiTokens.v2,e)}async function Ll({tokenId:e}){return La(`${Na.apiTokens.v1}/${e}`)}async function El({tokenId:e}){return La(`${Da.apiTokens.v1}/${e}`)}async function Ol({userId:e}){return ka(`${Da.v1}/${e}`)}async function wl(e){return ka(`${Ra.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Cl(e){let{type:t}=e,n=Ei(e,Hr);return Ta(`${Ca.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Dl(e){let{type:t}=e,n=Ei(e,Jr);return Ta(`${Ca.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Rl({token:e}){return Ta(Na.invites.verify.v1,{token:e})}async function Ul(){return ka(`${Va.v1}/configurations`)}async function _l(e){return Ta(`${Va.v1}/configurations`,e)}async function Ml(e,t){return Pa(`${Va.v1}/configurations/${e}`,t)}async function Nl(e){return La(`${Va.v1}/configurations/${e}`)}async function Fl(e){return Ta(`${Va.v1}/configurations/metadata`,e)}async function $l(e,t){return Ia(`${Va.v1}/configurations/${e}/metadata`,t)}async function Gl(e,t){return Ta(`${Va.v1}/configurations/${e}/domains`,t)}async function xl(e,t){return La(`${Va.v1}/configurations/${e}/domains/${t}`)}async function Vl(e,t){return Ia(`${Va.v1}/configurations/${e}/domains/${t}/validate`)}async function jl(e){return ka(`${Va.v1}/configurations/${e}/roles`)}async function Wl(e,t){return Ia(`${Va.v1}/configurations/${e}/roles`,t)}async function Bl(e,t){return Ta(`${Va.v1}/configurations/${e}/groups`,t)}async function Kl(e,{roleIds:t,group:n,id:i}){return Pa(`${Va.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function zl(e,t){return La(`${Va.v1}/configurations/${e}/groups/${t}`)}async function ql(e){return ka(`${Va.v1}/configurations/${e}/groups`)}async function Hl(e){return Ta(`${Ca.v2}/user/sso/prelogin`,e)}async function Jl(e){return Yr(await Ta(`${Ca.v2}/user/oidc/postlogin`,e))}async function Yl(e){return Xr(await Ta(`${ar}/token`,e))}async function Ql(){return Xr(await Ta(`${ar}/authorize/silent`))}async function Xl(e){return Ta(`${Da.v1}/phone/reset`,e)}async function Zl(e){return Ta(`${Da.v1}/phone/reset/verify`,e)}async function ec(e){return Ta(`${Da.v1}/phone`,e)}async function tc(e){return Ta(`${Da.v1}/phone/verify`,e)}async function nc(e){return Ia(`${Da.v1}/phone/change`,e)}async function ic(e){return Ta(`${Ca.v1}/webauthn/prelogin`,e)}async function oc(e){return Ta(`${Ca.v1}/webauthn/postlogin`,e)}async function ac(){return Ta(wa.v1)}async function rc(){return ka(wa.v1)}async function sc(e){return La(`${wa.v1}/${e}`)}async function lc(e){return Ta(`${wa.v1}/verify`,e)}async function cc(){return ka(`${Ra.v1}/auth/strategies/public`)}async function uc(){return ka(`${Ra.v1}/mfa/strategies`)}async function dc(e){return ka(`${Da.v2}/me`,null!=e?e:{addRoles:!0})}async function yc(e){return Ia(`${Da.v2}/me`,e)}async function fc(e){return Ia(`${Ka.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function gc(e){return Ta(`${Da.v1}/passwords/change`,e)}async function pc(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>C({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return ka(ja.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Sc(e){return Ta(Da.v2,C({},e,{provider:"local"}))}async function vc(e){return La(`${ja.v1}/${e.userId}`)}async function hc(e){return Ia(ja.v1,e)}async function mc(e){return Ta(Na.invites.user.v1,C({},e))}async function bc(e){return Pa(Na.invites.user.v1,C({},e))}async function Ac(){return La(Na.invites.user.v1)}async function kc(){return ka(Na.invites.user.v1)}async function Tc(){return ka(Na.invites.configuration.v1)}async function Pc(){return ka(Wa.v1)}async function Ic(){return ka(Ma.v1)}async function Lc(){return ka(`${Ba.v1}/members`)}async function Ec(e){return Ta(`${ja.v1}/${e.userId}/resendActivationEmail`,{})}async function Oc(e){return Ta(Da.v2,C({},e,{provider:"local"}))}async function wc(e){return Ta(Da.invitation.resendAll.v1,C({},e))}async function Cc(e){var t,n;const i=await ka("/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 Dc(){return ka("/metadata/admin-box")}async function Rc(e){return Ta("/metadata/admin-box",e)}async function Uc(){const e=await ka("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const _c=async()=>Cc({entityName:"notifications"}),Mc=async()=>Cc({entityName:"saml"}),Nc=async()=>Cc({entityName:"audits"}),Fc=async e=>async function(e){const t=await ka(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),$c=["dataFilters"],Gc=["templateId","dataFilters"],xc=["dataFilters"];async function Vc(e){return ka(`${Za.v2}/tenant-reports`,e)}async function jc(e){return ka(`${Za.v2}/${e.id}/tenant-reports`)}async function Wc(e){let{dataFilters:t}=e,n=Ei(e,$c);return{html:await ka(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Bc(e){let{templateId:t,dataFilters:n}=e,i=Ei(e,Gc);return Ta(`${Za.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Kc(e){let{dataFilters:t}=e,n=Ei(e,xc);const i=await ka(`${er.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function zc(e){return Ta(`${er.v1}/tenant-reports`,e)}async function qc(e){return ka(tr,{params:e})}async function Hc(e){return Ia(`${tr}/status`,{params:e})}async function Jc(e){const{notificationId:t,pinStatus:n}=e;return Ia(`${tr}/${n}`,{notificationId:t})}async function Yc(){return Ta(`${tr}/status/mark-all-read`)}const Qc=["endpoint","headerProps"];async function Xc(e){return ka(nr,e)}async function Zc(e){return ka(`${nr}/stats`,e)}async function eu(e){const{endpoint:t,headerProps:n}=e,i=Ei(e,Qc);return Ea(`${nr}/export/${t}`,{properties:n},i)}const tu=["eventKey"],nu=["eventKey"],iu=()=>ka(`${Ja.v1}/slack`),ou=()=>ka(`${Ja.v1}/slack/applications`),au=()=>ka(`${Ja.v1}/slack/channels`),ru=e=>e.id?Pa(`${Ja.v1}/slack/subscription/${e.id}`,e):Ta(`${Ja.v1}/slack/subscriptions`,e),su=e=>La(`${Ja.v1}/slack/subscriptions/${e.id}`),lu=e=>Ta(`${Ja.v1}/slack/applications/registrations`,{code:e}),cu=()=>ka(`${Ja.v1}/emails`),uu=e=>{let{eventKey:t}=e,n=Ei(e,tu);return Ta(`${Ja.v1}/emails/${t}`,n)},du=({eventKey:e,enabled:t})=>Pa(`${Ja.v1}/emails/${e}`,{enabled:t}),yu=(e,t)=>La(`${Ja.v1}/emails/${e}/subscriptions/${t}`),fu=(e,t,n)=>Ia(`${Ja.v1}/emails/${t}/subscriptions/${e}`,n),gu=e=>La(`${Ja.v1}/emails/${e}`),pu=()=>ka(`${Ja.v2}/sms`),Su=e=>{let{eventKey:t}=e,n=Ei(e,nu);return Ta(`${Ja.v2}/sms/${t}`,n)},vu=({eventKey:e,enabled:t})=>Pa(`${Ja.v2}/sms/${e}`,{enabled:t}),hu=(e,t)=>La(`${Ja.v2}/sms/${e}/subscriptions/${t}`),mu=(e,t,n)=>Ia(`${Ja.v2}/sms/${t}/subscriptions/${e}`,n),bu=e=>La(`${Ja.v2}/sms/${e}`),Au=()=>ka(or),ku=e=>e._id?Pa(`${or}/${e._id}`,e):Ta(`${or}/custom`,e),Tu=e=>La(`${or}/${e}`),Pu=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ka(`${or}/logs/?${i.toString()}`)},Iu=e=>Ta(`${or}/test`,e),Lu=e=>Ta(`${or}/logs/${e}/retries`),Eu=()=>ka(`${ir.v1}/categories`),Ou=e=>ka(ir.v1,{channels:e});async function wu(e,t){return Ia(za.v1,e,{headers:Oa(t)})}async function Cu(e){return ka(za.v1,void 0,{headers:Oa(e)})}async function Du(){return ka(`${za.v1}/public`)}const Ru=["roleId"],Uu=["roleId"],_u=["permissionId"];async function Mu(){return ka(Fa.v1)}async function Nu(e){return Ta(Fa.v1,e)}async function Fu({roleId:e}){return La(`${Fa.v1}/${e}`)}async function $u(e){let{roleId:t}=e,n=Ei(e,Ru);return Pa(`${Fa.v1}/${t}`,n)}async function Gu(e){let{roleId:t}=e,n=Ei(e,Uu);return Ia(`${Fa.v1}/${t}/permissions`,n)}async function xu(){return ka(Ma.v1)}async function Vu(e){let{permissionId:t}=e,n=Ei(e,_u);return Ia(`${Ma.v1}/${t}/roles`,n)}async function ju(){return ka(`${Ma.v1}/categories`)}async function Wu(){return ka(Ya.subscriptions.v1)}async function Bu(e){return ka(`${Ya.subscriptions.v1}/${e}`)}async function Ku(e){return Ia(`${Ya.subscriptions.v1}/${e}/cancellations/`,{})}async function zu(e){return Ia(`${Ya.subscriptions.v1}/${e}/renewals/`,{})}async function qu(e,{paymentMethodId:t,planId:n}){return Ia(`${Ya.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Hu(e){return ka(`${Xa.v1}/${e}`)}async function Ju(){return ka(`${Xa.v1}`)}async function Yu(e){return Ia(`${Xa.v1}/${e}/cancellations/`,{})}async function Qu(e){return Ia(`${Xa.v1}/${e}/renewals/`,{})}async function Xu(e,{paymentMethodId:t,planId:n}){return Ia(`${Xa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zu(){return ka(Ya.plans.v1)}async function ed(e){return ka(`${Ya.plans.v1}/${e}`)}async function td(){return ka(Ya.invoices.v1)}async function nd(e){return ka(`${Ya.invoices.v1}/${e}`)}async function id(e,t){return ka(`${Ya.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const od=["email"];async function ad(){return ka(Ya.paymentMethods.v1)}async function rd(e){return ka(`${Ya.paymentMethods.v1}/${e}`)}async function sd(e,t){let{email:n}=t,i=Ei(t,od);return Pa(`${Ya.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function ld(e){return Ta(Ya.paymentProviders.stripe.subscriptions.v1,e)}async function cd(e){return ka(`${Ya.paymentProviders.stripe.customers.v1}/${e}`)}async function ud(e){return Ta(`${Ya.paymentProviders.stripe.customers.v1}`,e)}async function dd(){return ka(`${Ya.paymentProviders.stripe.publicConfigurations.v1}`)}async function yd(e){return Ta(`${Ya.paymentProviders.stripe.setupIntents.v1}`,e)}async function fd(e){return ka(`${Ya.summaries.v1}/${e}`)}async function gd(e){return ka(`${Ya.tenantConfiguration.v1}/${e}`)}async function pd(e){return Ta(`${Ya.tenantConfiguration.v1}`,e)}async function Sd(){return ka(Qa.v1)}async function vd(){return ka(`${Ya.configurations.vendorPublicConfigurations.v1}`)}let hd,md,bd,Ad,kd,Td;async function Pd(){return ka("/vendors/public")}async function Id(e){return ka($a.v1,e)}async function Ld(e){return Ta($a.v1,e)}async function Ed(e,t){return La($a.v1,e,{headers:Oa(t)})}async function Od(e,t,n){return Ta(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function wd(e,t,n){return La(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function Cd(e,t,n){return Pa(`${$a.v1}/${e}/roles`,t,{headers:Oa(n)})}async function Dd(e,t){return Ta(Ha.v1,e,{headers:Oa(t)})}async function Rd(e,t){return La(`${Ha.v1}/${e}`,void 0,{headers:Oa(t)})}async function Ud(e,t,n){return Ia(`${$a.v1}/${e}/access`,t,{headers:Oa(n)})}async function _d(e,t){return Ta(`${$a.v2}/`,e,{headers:Oa(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(hd||(hd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(md||(md={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(bd||(bd={})),(Ad||(Ad={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(kd||(kd={})),function(e){e.CREATE="create_customer"}(Td||(Td={}));const Md={flags:{}};class Nd{constructor(){var e;this._flags={},this._flags=null!=(e=Md.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Nd;return n.set(e),Nd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=C({},null!=(t=null==Md?void 0:Md.flags)?t:{},null!=e?e:{})}}async function Fd(){return ka(rr)}async function $d(){return ka(`${sr}`)}async function Gd(e,t){return Pa(`${sr}/${e}`,t)}async function xd(e){return Ta(`${sr}`,e)}async function Vd(e){return La(`${sr}/${e}`)}async function jd(e){return ka(`${lr}/${e}/Users/count`)}async function Wd(e){return Ta(`${Ga.v1}`,e)}Nd._instances={};const Bd=["groupId"];async function Kd({groupId:e},t){return ka(`${xa.v1}/${e}`,C({},t))}async function zd(e){return ka(`${xa.v1}`,C({},e))}async function qd(e,t){return Ta(`${xa.getByIds.v1}`,e,{params:t})}async function Hd(e){return Ta(`${xa.v1}`,e)}async function Jd(e){let{groupId:t}=e,n=Ei(e,Bd);return Pa(`${xa.v1}/${t}`,n)}async function Yd(e){return La(`${xa.v1}/${e}`)}async function Qd(e,t){return Ta(`${xa.v1}/${e}/roles`,t)}async function Xd(e,t){return La(`${xa.v1}/${e}/roles`,t)}async function Zd(e,t){return Ta(`${xa.v1}/${e}/users`,t)}async function ey(e,t){return La(`${xa.v1}/${e}/users`,t)}async function ty(){return ka(`${xa.configurations.v1}`)}async function ny(e){return Ta(`${xa.configurations.v1}`,e)}async function iy(e){return Ta(`${Da.v3}/me/token`,e)}async function oy(e,t){return ka(Da.v3,e,{headers:Oa(t)})}async function ay(){return ka(cr)}let ry,sy,ly,cy,uy;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(ry||(ry={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(sy||(sy={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ly||(ly={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(cy||(cy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(uy||(uy={}));const dy=[/^(.*)\/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],yy=`${Ca.v1}/user/token/refresh`,fy=`${ar}/authorize/silent`,gy=`${Da.v2}/me`,py=`${Da.v2}/me/tenants`;let Sy,vy,hy,my,by;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Sy||(Sy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(vy||(vy={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(hy||(hy={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(my||(my={})),function(e){e.ASC="ASC",e.DESC="DESC"}(by||(by={}));const Ay={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h,groups:m,users:b,entitlements:A};var ky={fetch:e,ContextHolder:fa,FronteggContext:ga,api:Ay,FronteggApiError:ha,AuthStrategyEnum:jr,MachineToMachineAuthStrategy:Wr,SocialLoginProviders:Vr,ISubscriptionCancellationPolicy:bd,ISubscriptionStatus:hd,PaymentMethodType:md,ProviderType:Ad};let Ty,Py;!function(e){e.LOAD_SSO_CONFIGURATIONS="LOAD_SSO_CONFIGURATIONS",e.SAVE_SSO_CONFIGURATION="SAVE_SSO_CONFIGURATION",e.UPDATE_SSO_CONFIGURATION="UPDATE_SSO_CONFIGURATION",e.SAVE_SSO_CONFIGURATION_BY_METADATA="SAVE_SSO_CONFIGURATION_BY_METADATA",e.UPDATE_SSO_CONFIGURATION_BY_METADATA="UPDATE_SSO_CONFIGURATION",e.DELETE_SSO_CONFIGURATION="DELETE_SSO_CONFIGURATION",e.SAVE_SSO_DOMAIN="SAVE_SSO_DOMAIN",e.DELETE_SSO_DOMAIN="DELETE_SSO_DOMAIN",e.VALIDATE_SSO_DOMAIN="VALIDATE_SSO_DOMAIN",e.UPDATE_SSO_DEFAULT_ROLES="UPDATE_SSO_DEFAULT_ROLES",e.DELETE_SSO_GROUPS="DELETE_SSO_GROUPS",e.SAVE_SSO_GROUPS="SAVE_SSO_GROUPS",e.GET_SSO_AUTHORIZATION_ROLES="GET_SSO_AUTHORIZATION_ROLES"}(Ty||(Ty={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Py||(Py={}));const Iy="input is invalid type",Ly="undefined"!=typeof ArrayBuffer,Ey="0123456789abcdef".split(""),Oy=[-2147483648,8388608,32768,128],wy=[24,16,8,0],Cy=[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],Dy=["hex","array","digest","arrayBuffer"],Ry=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Ly&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Uy=function(e){return function(t){const n=new My(!0).update(t);return null==n?void 0:n[e]()}},_y=function(e){return function(t,n){const i=new Ny(t,!0).update(n);return null==i?void 0:i[e]()}};class My{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>My.prototype.digest(),e?(Ry[0]=Ry[16]=Ry[1]=Ry[2]=Ry[3]=Ry[4]=Ry[5]=Ry[6]=Ry[7]=Ry[8]=Ry[9]=Ry[10]=Ry[11]=Ry[12]=Ry[13]=Ry[14]=Ry[15]=0,this.blocks=Ry):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(Iy);if(null===e)throw new Error(Iy);if(Ly&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Ly&&ArrayBuffer.isView(e)))throw new Error(Iy);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<wy[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<wy[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<wy[3&o++],s[o>>2]|=(128|i>>6&63)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<wy[3&o++],s[o>>2]|=(128|i>>12&63)<<wy[3&o++],s[o>>2]|=(128|i>>6&63)<<wy[3&o++],s[o>>2]|=(128|63&i)<<wy[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Oy[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,o,a,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,g=this.h3,p=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,g=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),s=d&y,i=s^d&f^u,r=p&S^~p&v,o=h+n+r+Cy[e]+m[e],a=t+i,h=g+o<<0,g=o+a<<0),t=(g>>>2|g<<30)^(g>>>13|g<<19)^(g>>>22|g<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=g&d,i=l^g&y^s,r=h&p^~h&S,o=v+n+r+Cy[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&g,i=c^f&d^l,r=v&h^~v&p,o=S+n+r+Cy[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&g^c,r=S&v^~S&h,o=p+n+r+Cy[e+3]+m[e+3],a=t+i,p=d+o<<0,d=o+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+g<<0,this.h4=this.h4+p<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=Ey[e>>28&15]+Ey[e>>24&15]+Ey[e>>20&15]+Ey[e>>16&15]+Ey[e>>12&15]+Ey[e>>8&15]+Ey[e>>4&15]+Ey[15&e]+Ey[t>>28&15]+Ey[t>>24&15]+Ey[t>>20&15]+Ey[t>>16&15]+Ey[t>>12&15]+Ey[t>>8&15]+Ey[t>>4&15]+Ey[15&t]+Ey[n>>28&15]+Ey[n>>24&15]+Ey[n>>20&15]+Ey[n>>16&15]+Ey[n>>12&15]+Ey[n>>8&15]+Ey[n>>4&15]+Ey[15&n]+Ey[i>>28&15]+Ey[i>>24&15]+Ey[i>>20&15]+Ey[i>>16&15]+Ey[i>>12&15]+Ey[i>>8&15]+Ey[i>>4&15]+Ey[15&i]+Ey[o>>28&15]+Ey[o>>24&15]+Ey[o>>20&15]+Ey[o>>16&15]+Ey[o>>12&15]+Ey[o>>8&15]+Ey[o>>4&15]+Ey[15&o]+Ey[a>>28&15]+Ey[a>>24&15]+Ey[a>>20&15]+Ey[a>>16&15]+Ey[a>>12&15]+Ey[a>>8&15]+Ey[a>>4&15]+Ey[15&a]+Ey[r>>28&15]+Ey[r>>24&15]+Ey[r>>20&15]+Ey[r>>16&15]+Ey[r>>12&15]+Ey[r>>8&15]+Ey[r>>4&15]+Ey[15&r];return l+=Ey[s>>28&15]+Ey[s>>24&15]+Ey[s>>20&15]+Ey[s>>16&15]+Ey[s>>12&15]+Ey[s>>8&15]+Ey[s>>4&15]+Ey[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class Ny extends My{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(Iy);if(null===e)throw new Error(Iy);if(Ly&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Ly&&ArrayBuffer.isView(e)))throw new Error(Iy)}var o;e.length>64&&(e=null==(o=new My(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}My.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();My.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),My.prototype.finalize.call(this)}}}const Fy=function(){const e=Uy("hex");e.create=function(){return new My},e.update=function(t){return e.create().update(t)};for(let t=0;t<Dy.length;++t){const n=Dy[t];e[n]=Uy(n)}return e}();function $y(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Gy(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=Fy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function xy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=_y("hex");e.create=function(e){return new Ny(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Dy.length;++t){const n=Dy[t];e[n]=_y(n)}}();const Vy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*jy(e){const t=yield ho((e=>e.root.appName));return Nd.getFeatureFlags(e,t)}const Wy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},By=C({},Wy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Ky=[{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"}],zy={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},qy=C({},zy,{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}),Hy={loading:!1,error:void 0,saving:!0,profile:zy},Jy={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"},Yy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:jr.EmailAndPassword,machineToMachineAuthStrategy:Wr.ClientCredentials},Qy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Xy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Zy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},ef={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},tf={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},nf=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],of={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:ef,roles:nf,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},af=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],rf={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:[Ky[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Ky[0]],managedBy:hy.FRONTEGG}]},sf={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:[Ky[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Ky[0]],managedBy:hy.FRONTEGG}]},lf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},cf=[sf,rf],uf=[lf],df=[{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}],yf=[{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"}],ff={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},gf={isActive:!0,strategy:xn.ALLOW},pf=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:xn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:xn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:xn.BLOCK,description:"IP 4"}],Sf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},sf,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},vf=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"}),hf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Sf(6),roles:[vf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:hy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Sf(44),roles:[vf("Editor")],managedBy:hy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Sf(8),roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Sf(5),roles:[vf("Admin")],managedBy:hy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Sf(21),description:"BDR, AE, and inside sales",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Sf(23),description:"Dev success and customer success",roles:[vf("Admin")],managedBy:hy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Sf(10),description:"The marketing department",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Sf(4),description:"Human resources",roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Sf(3),roles:[vf("Viewer")],managedBy:hy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Sf(8),roles:[vf("Editor")],managedBy:hy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Sf(4),roles:[vf("Viewer")],managedBy:hy.FRONTEGG}];let mf,bf,Af;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(mf||(mf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(bf||(bf={})),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"}(Af||(Af={})),Af.profile,Af.privacy,Af.personalApiTokens,Af.account,Af.users,Af.groups,Af.security,Af.sso,Af.audits,Af.webhooks,Af.apiTokens,Af.roles,Af.subscriptions;const kf=["events","url"];function*Tf(){yield yo(gi.setSignUpState({loading:!0}));try{const e=yield po(Ay.auth.getVendorConfig),[t]=(yield po(Ay.auth.getVendorPublicAuthStrategiesConfig),yield po(jy,["admin_portal_login_per_tenant"]));if(t){const t=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield yo(gi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield yo(gi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Pf(e){let{payload:{events:t,url:n}}=e,i=Ei(e.payload,kf);yield yo(gi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield ho((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield po(Ay.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:bf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(fa.setAccessToken(null==s?void 0:s.accessToken),fa.setUser(s),!r&&s&&xg(s)){const t=yield Wg(s);yield yo(gi.setState(t)),a(e.loginUrl)}else yield yo(gi.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield yo(gi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield yo(gi.loadTenants()))}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setSignUpState({loading:!1,error:e.message}))}yield yo(gi.setSignUpState({loading:!1}))}function*If(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield ho((e=>e.auth.signUpState));yield yo(gi.resetSignUpState()),yield yo(gi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Lf(){yield ya(gi.signUpUser,Pf),yield ya(gi.resetSignUpStateSoft,If)}const Ef={setVendorState:(e,{payload:t})=>C({},e,t)},Of={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},wf={loading:!1},{reducer:Cf,actions:Df}=ut({name:Rt,initialState:wf,reducers:C({},Ef)}),Rf=C({},Df,Of);function*Uf(){yield yo(Rf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Ay.vendor.getVendorPublicInfo();yield yo(Rf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield yo(Rf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const _f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"];function*xf(){yield yo(gi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getGlobalSecurityPolicy);yield yo(gi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield yo(gi.loadSecurityPolicyMfa()),yield yo(gi.loadSecurityPolicyVendorMfa()),yield yo(gi.loadSecurityPolicyLockout()),yield yo(gi.loadSecurityPolicyVendorLockout()),yield yo(gi.loadSecurityPolicyVendorPasswordHistory()),yield yo(gi.loadSecurityPolicyCaptcha()),yield yo(gi.loadPublicAuthStrategiesPolicy())}function*Vf(){yield yo(gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorConfig),[t]=yield po(jy,["admin_portal_login_per_tenant"]);if(t){const t=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield yo(gi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*jf(){yield yo(gi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorPublicAuthStrategiesConfig);yield yo(gi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Wf(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getMfaPolicy);yield yo(gi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Bf(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorMfaPolicy);yield yo(gi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,_f);yield yo(gi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield po(Ay.auth.saveMfaPolicy,n);yield yo(gi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zf(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getLockoutPolicy);yield yo(gi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*qf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Mf);yield yo(gi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield po(Ay.auth.saveLockoutPolicy,n);yield yo(gi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hf(){yield yo(gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorLockoutPolicy);yield yo(gi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Jf(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCaptchaPolicy);yield yo(gi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Yf(){yield yo(gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getPasswordHistoryPolicy);yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Qf(){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getVendorPasswordHistoryPolicy);yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Xf(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Nf);yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield po(Ay.auth.savePasswordHistoryPolicy,n);yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Zf(){yield yo(gi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getPasswordConfigPolicy);yield yo(gi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*eg(){yield ya(gi.loadSecurityPolicy,xf),yield ua(gi.saveSecurityPolicyMfa,Kf),yield ua(gi.loadSecurityPolicyMfa,Wf),yield ua(gi.loadSecurityPolicyVendorMfa,Bf),yield ua(gi.saveSecurityPolicyLockout,qf),yield ua(gi.loadSecurityPolicyLockout,zf),yield ua(gi.loadSecurityPolicyVendorLockout,Hf),yield ua(gi.loadSecurityPolicyCaptcha,Jf),yield ua(gi.saveSecurityPolicyPasswordHistory,Xf),yield ua(gi.loadSecurityPolicyPasswordHistory,Yf),yield ua(gi.loadSecurityPolicyVendorPasswordHistory,Qf),yield ua(gi.loadVendorPasswordConfig,Zf),yield ua(gi.loadPublicSecurityPolicy,Vf),yield ua(gi.loadPublicAuthStrategiesPolicy,jf)}function*tg(){yield yo(gi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield yo(gi.setSecurityPolicyPublicState({policy:Yy,loading:!1}))}catch(e){yield yo(gi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*ng(){yield yo(gi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyGlobalState({policy:Jy,loading:!1})),yield yo(gi.loadSecurityPolicyMfa()),yield yo(gi.loadSecurityPolicyVendorMfa()),yield yo(gi.loadSecurityPolicyLockout()),yield yo(gi.loadSecurityPolicyVendorLockout()),yield yo(gi.loadSecurityPolicyPasswordHistory()),yield yo(gi.loadSecurityPolicyVendorPasswordHistory()),yield yo(gi.loadSecurityPolicyCaptcha())}function*ig(){yield yo(gi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyMfaState({policy:Qy,loading:!1}))}function*og(){yield yo(gi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorMfaState({policy:Qy,loading:!1}))}function*ag(e){var t;let{payload:{callback:n}}=e,i=Ei(e.payload,Ff);yield yo(gi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},Xy,{id:null!=(t=i.id)?t:Xy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield yo(gi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*rg(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyLockoutState({policy:Xy,loading:!1}))}function*sg(){yield yo(gi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorLockoutState({policy:Xy,loading:!1}))}function*lg(e){let{payload:{callback:t}}=e,n=Ei(e.payload,$f);yield yo(gi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},Xy,n,{id:n.id?n.id:Xy.id});null==t||t(i),yield yo(gi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*cg(){yield yo(gi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyLockoutState({policy:Xy,loading:!1}))}function*ug(){yield yo(gi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:Zy,loading:!1}))}function*dg(){yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield yo(gi.setSecurityPolicyVendorPasswordHistoryState({policy:Zy,loading:!1}))}function*yg(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Gf);yield yo(gi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},Zy,n,{id:n.id?n.id:Zy.id});null==t||t(i),yield yo(gi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*fg(){yield ya(gi.loadSecurityPolicy,ng),yield ua(gi.loadPublicSecurityPolicy,tg),yield ua(gi.saveSecurityPolicyMfa,ag),yield ua(gi.loadSecurityPolicyMfa,ig),yield ua(gi.loadSecurityPolicyVendorMfa,og),yield ua(gi.saveSecurityPolicyLockout,lg),yield ua(gi.loadSecurityPolicyLockout,rg),yield ua(gi.loadSecurityPolicyVendorLockout,sg),yield ua(gi.loadSecurityPolicyCaptcha,cg),yield ua(gi.saveSecurityPolicyPasswordHistory,yg),yield ua(gi.loadSecurityPolicyPasswordHistory,ug),yield ua(gi.loadSecurityPolicyVendorPasswordHistory,dg)}const gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},pg=e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t};function*Sg(){yield yo(gi.setEntitlementsState({loading:!0,error:null}));try{const e=yield po(Ay.entitlements.loadEntitlements);yield yo(gi.setEntitlementsState({entitlements:e,loading:!1}))}catch(e){yield yo(gi.setEntitlementsState({error:e.message,loading:!1}))}}function*vg(){yield ya(gi.loadEntitlements,Sg)}const hg=["callback"],mg=["callback"],bg=["callback"],Ag=["callback"],kg=["callback","events"],Tg=["callback"],Pg=["callback"],Ig=["callback"],Lg=["callback"],Eg=["callback"],Og=["callback"],wg=["callback"],Cg=["callback"],Dg=["callback"],Rg=["callback","deviceId"],Ug=["callback","deviceId"],_g=["callback","deviceId"],Mg=["callback","deviceId"],Ng={[jr.Code]:Pt.loginWithOtc,[jr.EmailAndPassword]:Pt.loginWithPassword,[jr.MagicLink]:Pt.magicLinkPreLoginSuccess,[jr.SmsCode]:Pt.loginWithSmsOtc};function*Fg(){const e=fa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield ho((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=fa.getContext()).tenantResolver)&&d.call(y)&&(yield po(Zg),u=yield ho((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),yo(gi.resetLoginState());const g=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u?pg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(g,{refresh:g.startsWith("http")})}function*$g(){let e;try{var t;const n=yield po(Ay.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield yo(gi.setState({ssoACS:e}))}function*Gg(){try{const{isActive:e}=yield po(Ay.auth.getSSOPublicConfiguration);yield yo(gi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const xg=e=>e.mfaRequired&&e.mfaToken?(fa.setAccessToken(null),fa.setUser(null),!0):(fa.setAccessToken(e.accessToken),fa.setUser(e),!1),Vg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},jg=e=>{if(1===e.length){const[t]=e;if(t===ly.AuthenticatorApp)return an.authenticatorApp;if(t===ly.SMS)return an.smsSetPhoneNumber}return an.verify};function*Wg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield ho((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield po(Ay.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Vg(e.mfaDevices)}:(n={step:jg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:It.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:C({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Bg(e){var t;const{routes:n,loginState:i}=yield ho((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*Kg(){const[e]=yield po(jy,["admin_portal_entitlements"]);e&&(yield po(Sg))}function*zg(){const{hostedLoginBox:e}=yield ho((e=>e.auth));e?yield po(qg):yield po(Jg),yield Kg()}function*qg(){const{user:e}=yield ho((e=>e.auth));if(null==e||!e.refreshToken)return fa.setAccessToken(null),fa.setUser(null),void(yield yo(gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield po(Ay.auth.exchangeOAuthTokens,t);yield yo(gi.setState({user:n,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:null,isAuthenticated:!1}))}}function*Hg(){const{user:e}=yield ho((e=>e.auth));if(null==e||!e.refreshToken)return fa.setAccessToken(null),fa.setUser(null),void(yield yo(gi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield po(Ay.auth.exchangeOAuthTokens,t);yield yo(gi.setState({user:n,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:null,isAuthenticated:!1}))}}function*Jg(){try{const t=fa.onRedirectTo,{routes:n,loginState:i}=yield ho((e=>e.auth)),{user:o,tenants:a}=yield po(Ay.auth.refreshTokenV2);if(xg(o)){const e=yield Wg(o);yield yo(gi.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 Bg(o);yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield Qg(n)}}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:void 0,isAuthenticated:!1}))}}function*Yg(){try{const t=fa.onRedirectTo,{routes:n,loginState:i}=yield ho((e=>e.auth)),{user:o,tenants:a}=yield po(Ay.auth.refreshTokenV2);if(xg(o)){const e=yield Wg(o);yield yo(gi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield po(up))yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.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 Bg(o);yield yo(gi.setTenantsState({tenants:a,loading:!1})),yield yo(gi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield Qg(n)}}catch(e){fa.setAccessToken(null),fa.setUser(null),yield yo(gi.setState({user:void 0,isAuthenticated:!1}))}}function*Qg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=fa.onRedirectTo,{routes:o,loginState:a}=yield ho((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 Fg())}function*Xg({payload:{callback:e}}){try{const{ip:t}=yield po(Ay.metadata.getCurrentUserIpMetadata);yield yo(gi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Zg(){try{var e,t;if(null!=(e=fa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield ho((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield po(Du);var n;t&&i&&(yield yo(gi.setState({routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+gg(t))?n:""})})))}}catch{}}function*ep({payload:e}){const t=[];e&&(yield yo(gi.setState({isLoading:!0})),yield yo(gi.loadSocialLoginsConfigurationV2()),t.push(po(Tf)),t.push(po(jf)),t.push(po(Gg)),t.push(po(Uf)),t.push(po($g)),t.push(po(Zg))),t.push(po(zg)),yield fo(t),yield yo(gi.setState({isLoading:!1}))}function*tp({accessToken:e,user:t}){if(!e)return void(yield yo(gi.setState({user:void 0,isAuthenticated:!1})));const n=fa.onRedirectTo,{routes:i}=yield ho((e=>e.auth));if(xg(t)){const e=yield Wg(t);yield yo(gi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*np({payload:e}){const t=[];yield yo(gi.loadSocialLoginsConfigurationV2()),t.push(po(Tf)),t.push(po(Gg)),t.push(po(Uf)),t.push(po($g)),t.push(po(tp,e)),t.push(po(Zg)),yield fo(t)}function*ip({payload:e}){const{disableSilentRefresh:t}=yield ho((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield po(Ay.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.loadTenants()),yield yo(gi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield ho((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 yo(gi.setState({isLoading:!0}));const a=xy(),r=xy(),s=yield po(Gy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield op();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${ma(n,"/oauth/authorize")}/oauth/authorize`,d=C({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*op(){try{var e,t;if(null!=(e=fa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield po(Zg);const e=yield ho((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return gg(e)}}catch{}}function*ap({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield ho((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield op();a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield po(Ay.auth.exchangeOAuthTokens,r);yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Fg()}}function*rp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,hg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.changePhoneNumberWithVerification,n);yield yo(gi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1}))}}function*sp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mg);try{yield yo(gi.setLoginState({loading:!0})),yield po(Ay.auth.verifyChangePhoneNumber,n),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1}))}}function*lp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,bg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.passwordlessPreLogin,C({},n,{type:jr.SmsCode}));yield yo(gi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*cp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Ag);try{const{onRedirectTo:e,routes:i}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield yo(gi.setLoginState({loading:!0}));const o=yield po(Ay.auth.passwordlessPreLogin,n),a=Ng[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield yo(gi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield yo(gi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*up(){const{publicAuthStrategyPolicy:e}=yield ho((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===ry.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield po(jy,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield po(Ay.auth.getWebAuthnDevices);return yield yo(gi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*dp(e){let{payload:{callback:t,events:n}}=e,i=Ei(e.payload,kg);try{yield yo(gi.setLoginState({loading:!0}));const e=yield po(Ay.auth.passwordlessPostLogin,i),a=fa.onRedirectTo,{routes:r}=yield ho((e=>e.auth));if(xg(e)){const t=yield Wg(e);yield yo(gi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield ho((e=>e.auth)),s=yield po(Ay.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:mf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield yo(gi.setState({user:s})),yield yo(gi.setLoginState({error:void 0})),yield yo(gi.loadTenants()),yield yo(gi.setState({isLoading:!1})),i.flow===It.Login?(yield po(up))?(yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield yo(gi.setState({isAuthenticated:!0})),yield Fg()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield yo(gi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield yo(gi.setLoginState({loading:!1}))}}function*yp({payload:e}){try{yield yo(gi.setLoginState({loading:!0}));const{name:t}=yield po(Ay.auth.verifyInviteToken,e);yield yo(gi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield yo(gi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield yo(gi.setLoginState({loading:!1}))}}function*fp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield yo(gi.setLoginState({loading:!0}));try{const o=yield ho((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield po(Ay.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Py.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield ho((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield yo(gi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield gp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield gp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*gp(e){let{callback:t}=e,n=Ei(e,Tg);const i=yield ho((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===jr.EmailAndPassword?(yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[jr.MagicLink,jr.Code,jr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield yo(gi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield yo(gi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*pp({payload:{callback:e}}){try{yield yo(gi.setLoginState({loading:!0}));const{options:t}=yield po(Ay.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield yo(gi.setLoginState({error:t.message})),null==e||e(null)}finally{yield yo(gi.setLoginState({loading:!1}))}}function*Sp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Pg);try{yield yo(gi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?sy.Platform:sy.CrossPlatform;yield po(Ay.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setLoginState({loading:!1}))}}function*vp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Ig);try{var i;yield yo(gi.setPasskeysState({loading:!0})),yield yo(gi.setLoginState({loading:!0}));const{options:e}=yield po(Ay.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield yo(gi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setPasskeysState({loading:!1})),yield yo(gi.setLoginState({loading:!1}))}}function*hp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Lg);try{var i;yield yo(gi.setPasskeysState({loading:!0})),yield yo(gi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield po(Ay.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(xg(o)){const e=fa.onRedirectTo,{routes:t}=yield ho((e=>e.auth)),n=yield Wg(o);yield yo(gi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield po(Ay.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield yo(gi.loadTenants()),yield yo(gi.setState({user:e,isAuthenticated:!0})),yield yo(gi.setLoginState({error:void 0})),yield Fg(),null==t||t(!0)}}catch(e){yield yo(gi.setLoginState({error:e.message})),null==t||t(null)}finally{yield yo(gi.setPasskeysState({loading:!1})),yield yo(gi.setLoginState({loading:!1}))}}function*mp({payload:e}){const{onRedirectTo:t,routes:n}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield yo(gi.setLoginState({loading:!0}));try{const t=yield po(Ay.auth.postLogin,e);fa.setAccessToken(t.accessToken),fa.setUser(t),yield yo(gi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Fg()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield yo(gi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*bp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield yo(gi.setLoginState({loading:!0}));try{const a=yield po(Ay.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});fa.setAccessToken(a.accessToken),fa.setUser(a);const r=fa.onRedirectTo,{routes:s}=yield ho((e=>e.auth));if(xg(a)){const e=yield Wg(a);yield yo(gi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield ho((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield yo(gi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield yo(gi.loadTenants()),n&&t.flow===It.Login&&((yield po(up))?(yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Fg())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){fa.setAccessToken(null),fa.setUser(null),null==o||o(!1,t),yield yo(gi.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ap({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield yo(gi.setLoginState({loading:!0}));try{const o=yield po(Ay.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield ho((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield yo(gi.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 yo(gi.loadTenants()),yield yo(gi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield po(up))?yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Fg()),null==i||i(!0)}catch(e){yield yo(gi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*kp({payload:e}){yield yo(gi.setLoginState({loading:!0}));try{var t;yield po(Ay.auth.recoverMfaToken,e),yield yo(gi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield yo(gi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Tp({payload:e}){const{hostedLoginBox:t}=yield ho((e=>e.auth));yield yo(gi.setState({isLoading:!0}));try{t?yield po(Ay.auth.OAuthLogout):yield po(Ay.auth.logout)}catch{}yield yo(gi.resetState()),yield yo(gi.requestAuthorize(!0)),null==e||e()}function*Pp({payload:e}){var t;try{yield po(Ay.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*Ip({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield yo(gi.setMfaState(n)),yield yo(gi.setUser(e)),yield yo(gi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Lp({user:e,tenants:t}){const{loginState:n}=yield ho((e=>e.auth));yield yo(gi.setUser(e)),yield yo(gi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield ho((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield po(up);i===an.smsVerifyCode&&e?yield yo(gi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Fg()}yield yo(gi.setState({isAuthenticated:!0}))}function*Ep(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Eg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.preEnrollMFASMSForLogin,n);yield yo(gi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Op(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Og);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.enrollMFASMSForLogin,n),i=yield po(Ay.auth.generateLoginResponseV2,e);yield Ip(i),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,wg);yield yo(gi.setLoginState({loading:!0}));try{var i;const e=yield po(Ay.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Cg);yield yo(gi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield po(Ay.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield po(Ay.auth.generateLoginResponseV2,i);yield Ip(o),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Dg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield po(Ay.auth.generateLoginResponseV2,e);yield Ip(i),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Rp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Rg);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.preVerifyMFASMSForLogin,n,i);yield yo(gi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Ug);yield yo(gi.setLoginState({loading:!0}));try{const e=yield po(Ay.auth.verifyMFASMSForLogin,n,i),o=yield po(Ay.auth.generateLoginResponseV2,e);yield Lp(o),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*_p(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,_g);yield yo(gi.setLoginState({loading:!0}));try{var o;const e=yield po(Ay.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ei(e.payload,Mg);yield yo(gi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield po(Ay.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield po(Ay.auth.generateLoginResponseV2,o);yield Lp(a),yield yo(gi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(){yield ya(gi.requestAuthorize,ep),yield ya(gi.requestAuthorizeSSR,np),yield ya(gi.requestHostedLoginAuthorize,ip),yield ya(gi.handleHostedLoginCallback,ap),yield ya(gi.preLogin,fp),yield ya(gi.postLogin,mp),yield ya(gi.login,bp),yield ya(gi.logout,Tp),yield ya(gi.silentLogout,Pp),yield ya(gi.loginWithMfa,Ap),yield ya(gi.recoverMfa,kp),yield ya(gi.quickSmsPasswordlessPreLogin,lp),yield ya(gi.changePhoneNumberWithVerification,rp),yield ya(gi.verifyChangePhoneNumber,sp),yield ya(gi.passwordlessPreLogin,cp),yield ya(gi.passwordlessPostLogin,dp),yield ya(gi.verifyInviteToken,yp),yield ya(gi.webAuthnPrelogin,vp),yield ya(gi.webAuthnPostLogin,hp),yield ya(gi.webAuthnCreateNewDeviceSession,pp),yield ya(gi.webAuthnVerifyNewDeviceSession,Sp),yield ya(gi.afterAuthNavigation,Fg),yield ya(gi.getUserIP,Xg),yield ya(gi.preEnrollMFASMSForLogin,Ep),yield ya(gi.enrollMFASMSForLogin,Op),yield ya(gi.preEnrollMFAWebAuthnForLogin,wp),yield ya(gi.enrollMFAWebAuthnForLogin,Cp),yield ya(gi.enrollMFAAuthenticatorAppForLogin,Dp),yield ya(gi.preVerifyMFASMSForLogin,Rp),yield ya(gi.verifyMFASMSForLogin,Up),yield ya(gi.preVerifyMFAWebAuthnForLogin,_p),yield ya(gi.verifyMFAWebAuthnForLogin,Mp)}function*Fp({payload:e}){e&&(yield yo(gi.setState({isLoading:!0})));const t=qy;yield yo(gi.loadTenants()),yield yo(gi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*$p({payload:{callback:e}}){try{const{ip:t}=pf[0];yield yo(gi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Gp(){yield ya(gi.requestAuthorize,Fp),yield ya(gi.afterAuthNavigation,Fg),yield ya(gi.getUserIP,$p)}const xp=["callback","samlVendor"],Vp=["callback","samlVendor"];function*jp(){try{var e,t;yield yo(gi.setSSOState({loading:!0}));const n=yield po(Ay.auth.getSamlConfiguration),i=yield po(Ay.auth.getOidcConfiguration),o=yield po(Ay.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 yo(gi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSSOState({error:e.message,loading:!1}))}}function*Wp({payload:e}){const t=yield ho((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield yo(gi.setSSOState({error:void 0,[n]:!0}));try{const i=yield Vy(e[0]),o=yield po(Ay.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield yo(gi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Bp({payload:e}){const{configFile:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield yo(gi.setSSOState({error:void 0,[o]:!0}));try{const e=yield Vy(t),a=yield po(Ay.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield yo(gi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Kp({payload:e}){const{callback:t,samlVendor:n}=e,i=Ei(e,xp),o=yield ho((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield yo(gi.setSSOState({samlConfiguration:C({},o,a)})));if(yield yo(gi.setSSOState({error:void 0,[r]:!0})),e.type===Py.Saml){var s,l;const e=yield po(Ay.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=$y(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 po(Ay.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield yo(gi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield yo(gi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*zp({payload:{callback:e}={}}){const t=yield ho((e=>e.auth.ssoState.samlConfiguration));try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.validateSamlDomain),yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*qp(){try{const e=yield po(Ay.auth.getSamlRoles),t=yield po(Ay.auth.getSamlRolesGroups);yield yo(gi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield yo(gi.setSSOState({error:e.message}))}}function*Hp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield fo(e.map((e=>po(Ay.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield yo(gi.setSSOState({error:e.message}))}}(n)),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Jp({payload:{callback:e,id:t}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.deleteSamlGroup,{id:t}),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Yp({payload:{group:e,roleIds:t,callback:n}}){try{yield yo(gi.setSSOState({error:void 0,saving:!0})),yield po(Ay.auth.createSamlGroup,{group:e,roleIds:t}),yield qp(),yield yo(gi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield yo(gi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Qp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield yo(gi.setSSOState({loading:!0})),yield po(Ay.auth.oidcPostLoginV2,t),yield po(zg),yield yo(gi.setSSOState({loading:!1}))}catch(e){var n;yield yo(gi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Xp(){yield ua(gi.loadSSOConfigurations,jp),yield ua(gi.saveSSOConfigurations,Kp),yield ua(gi.saveSSOConfigurationsFile,Wp),yield ua(gi.saveSSOConfigurationsFileWithCallback,Bp),yield ua(gi.validateSSODomain,zp),yield ua(gi.loadSSOAuthorizationRoles,qp),yield ua(gi.updateSSOAuthorizationRoles,Hp),yield ua(gi.deleteSamlGroup,Jp),yield ua(gi.createSamlGroup,Yp),yield ua(gi.oidcPostlogin,Qp)}function*Zp(){yield yo(gi.setSSOState({loading:!0})),yield mt(),yield yo(gi.setSSOState({samlConfiguration:ef,loading:!1,firstLoad:!1}))}function*eS({payload:e}){const t="saving";yield yo(gi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield ho((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield yo(gi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*tS({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ei(e,Vp),r=of.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield yo(gi.setSSOState({samlConfiguration:C({},r,s)})));yield yo(gi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==tf||null==(t=tf.configuration)?void 0:t.acsUrl,s.spEntityId=null==tf||null==(n=tf.configuration)?void 0:n.spEntityId;const c=$y(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield mt(),yield yo(gi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*nS({payload:{callback:e}={}}){const t=of.samlConfiguration;yield yo(gi.setSSOState({error:void 0,saving:!0})),yield mt(),yield yo(gi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*iS(){yield mt(),yield yo(gi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*oS({payload:{callback:e,authorizationRoles:t}}){yield yo(gi.setSSOState({error:void 0,saving:!0})),yield mt(),yield yo(gi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*aS(){yield ua(gi.loadSSOConfigurations,Zp),yield ua(gi.saveSSOConfigurations,tS),yield ua(gi.saveSSOConfigurationsFile,eS),yield ua(gi.validateSSODomain,nS),yield ua(gi.loadSSOAuthorizationRoles,iS),yield ua(gi.updateSSOAuthorizationRoles,oS)}const rS=["callback"],sS=["callback","ssoConfigId"],lS=["callback","ssoConfigId"],cS=["callback","ssoConfigId"];function*uS(){try{return yield po(Ay.auth.getOidcConfiguration)}catch(e){return null}}function*dS(){try{return yield po(Ay.metadata.getSamlMetadata)}catch(e){return null}}function*yS(){try{yield yo(gi.setSSOLoader({key:Ty.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield fo([po(uS),po(dS)]),n=yield po(Ay.auth.getSSOConfigurations);yield yo(gi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield yo(gi.setSSOError({key:Ty.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield yo(gi.setSSOLoader({key:Ty.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*fS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ei(e,rS),i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield po(Ay.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield yo(gi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!1}))}}function*gS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vy(t),o=yield po(Ay.auth.createSSOConfigurationByMetadata,{metadata:e});yield yo(gi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*pS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ei(e,sS),o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield po(Ay.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*SS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Vy(i),a=yield po(Ay.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield yo(gi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*vS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.deleteSSOConfiguration,t),yield yo(gi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_CONFIGURATION,value:!1}))}}function*hS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ei(e,lS);yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield po(Ay.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_DOMAIN,value:!1}))}}function*mS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield yo(gi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.DELETE_SSO_DOMAIN,value:!1}))}}function*bS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield yo(gi.setSSOLoader({key:Ty.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield yo(gi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.VALIDATE_SSO_DOMAIN,value:!1}))}}function*AS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield po(Ay.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield yo(gi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield yo(gi.setSSOError({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield yo(gi.setSSOLoader({key:Ty.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*kS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!0}));const o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(t.map((e=>po(Ay.auth.deleteSSOGroup,n,e)))),yield fo(e.map((e=>po(Ay.auth.createSSOGroup,n,e))));const a=yield po(Ay.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield yo(gi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!1}))}}function*TS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield fo(t.map((t=>po(Ay.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield yo(gi.setSSOError({key:Ty.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_GROUPS,value:!1}))}}function*PS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield po(ka,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield po(Ay.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield po(Ay.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield yo(gi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*IS({payload:e}){yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ei(e,cS),o=yield ho((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield po(Ay.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield po(Ay.auth.createSSOConfiguration,i),a=[e,...o]),yield yo(gi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield yo(gi.setSSOLoader({key:Ty.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*LS(){yield ua(gi.loadSSOConfigurationsV2,yS),yield ua(gi.saveSSOConfigurationV2,fS),yield ua(gi.saveSSODomain,hS),yield ua(gi.deleteSSODomain,mS),yield ua(gi.validateSSODomainV2,bS),yield ua(gi.updateSSOConfiguration,pS),yield ua(gi.deleteSSOConfiguration,vS),yield ua(gi.setSSOGroups,kS),yield ua(gi.updateSSOGroups,TS),yield ua(gi.setSSODefaultRoles,AS),yield ua(gi.saveSSOConfigurationByMetadata,gS),yield ua(gi.updateSSOConfigurationByMetadata,SS),yield ua(gi.saveSSOConfigurationByUrl,PS),yield ua(gi.saveSSOConfigurationByData,IS)}const ES=["callback","profilePictureUrl"],OS=["callback","profilePictureUrl"];function*wS(){yield yo(gi.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 po.apply(void 0,[ca,e,t,n].concat(o))}(3,2e3,Ay.teams.getProfile),t=yield ho((e=>e.auth.user));gi.setUser(C({},t,e)),yield yo(gi.setProfileState({profile:e,loading:!1}))}catch(e){yield yo(gi.setProfileState({loading:!1,error:e.message}))}}function*CS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ei(e.payload,ES);yield yo(gi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield ho((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 po(Ay.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield po(Ay.teams.updateProfile,a),s=yield ho((e=>e.auth.user));yield yo(gi.setUser(C({},s,r))),yield yo(gi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield yo(gi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*DS({payload:e}){yield yo(gi.setProfileState({loading:!0}));try{var t;yield po(Ay.teams.changePassword,e),yield yo(gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*RS(){yield ya(gi.loadProfile,wS),yield ua(gi.saveProfile,CS),yield ua(gi.changePassword,DS)}function*US(){yield yo(gi.setProfileState({loading:!0})),yield mt(),yield yo(gi.setUser(C({},qy,zy))),yield yo(gi.setProfileState({loading:!1,profile:zy}))}function*_S(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ei(e.payload,OS);yield yo(gi.setProfileState({saving:!0,error:null}));const o=Hy;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=C({},o.profile,i,{profilePictureUrl:a}),s=qy;yield mt(),yield yo(gi.setUser(C({},s,r))),yield yo(gi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*MS({payload:e}){var t;yield yo(gi.setProfileState({loading:!0})),yield mt(),yield yo(gi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*NS(){yield ya(gi.loadProfile,US),yield ua(gi.saveProfile,_S),yield ua(gi.changePassword,MS)}const FS=["callback"],$S=["callback"],GS=["callback"],xS=["deviceId","callback"],VS=["deviceId","callback"],jS=["callback"],WS=["deviceId"],BS=["deviceId"],KS=["callback"],zS=["deviceId"],qS=["callback"];function*HS(e){const{step:t}=yield ho((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*JS(){yield yo(gi.setMfaState({saving:!0}));try{const{qrCode:e}=yield po(Ay.auth.enrollMfa);yield yo(gi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message}))}}function*YS(e){let{payload:{callback:t}}=e,n=Ei(e.payload,FS);yield yo(gi.setMfaState({saving:!0}));try{const e=yield ho((e=>e.auth.user)),i=yield po(Ay.auth.verifyMfa,n),o=yield po(Ay.auth.getMFADevices),a=yield HS(i);yield yo(gi.setMfaState(C({},a,{mfaDevices:o}))),yield yo(gi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*QS(e){let{payload:{callback:t}}=e,n=Ei(e.payload,$S);yield yo(gi.setMfaState({loading:!0}));try{const e=yield po(Ay.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield yo(gi.setMfaState(i)),yield yo(gi.setState({user:e})),yield yo(gi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*XS({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t;yield po(Ay.auth.disableMfa,e);const n=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ZS({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t,n;const i=yield po(Ay.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield yo(gi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*ev(e){let{payload:{callback:t}}=e,n=Ei(e.payload,GS);yield yo(gi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield po(Ay.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield po(Ay.auth.getMFADevices),a=yield HS(i);yield yo(gi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tv(e){let{payload:{deviceId:t,callback:n}}=e;Ei(e.payload,xS),yield yo(gi.setMfaState({saving:!0}));try{var i;const e=yield po(Ay.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield yo(gi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*nv(e){let{payload:{deviceId:t,callback:n}}=e,i=Ei(e.payload,VS);yield yo(gi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield po(Ay.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*iv({payload:e}){yield yo(gi.setMfaState({saving:!0}));try{var t;const n=yield po(Ay.auth.preEnrollMFASMS,e);yield yo(gi.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 yo(gi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ov(e){let{payload:{callback:t}}=e,n=Ei(e.payload,jS);yield yo(gi.setMfaState({saving:!0}));try{const e=yield po(Ay.auth.enrollMFASMS,n),i=yield po(Ay.auth.getMFADevices),o=yield HS(e);yield yo(gi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield yo(gi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*av(e){let{payload:{deviceId:t}}=e,n=Ei(e.payload,WS);yield yo(gi.setMfaState({saving:!0}));try{var i;const e=yield po(Ay.auth.preDisableMFASMS,t);yield yo(gi.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 yo(gi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*rv(e){let{payload:{deviceId:t}}=e,n=Ei(e.payload,BS);yield yo(gi.setMfaState({saving:!0}));try{var i;yield po(Ay.auth.disableMFASMS,t,n);const e=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield yo(gi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*sv(){yield yo(gi.setMfaState({loading:!0}));try{yield ho((e=>e.auth.user));const e=yield po(Ay.auth.getMFADevices);yield yo(gi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message}))}}function*lv(){yield yo(gi.setMfaState({loading:!0}));try{const e=(yield po(Ay.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield yo(gi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield yo(gi.setMfaState({loading:!1,error:e.message}))}}function*cv(){yield ua(gi.enrollMfa,JS),yield ua(gi.getMFADevices,sv),yield ua(gi.getMFAStrategies,lv),yield ua(gi.verifyMfa,YS),yield ua(gi.disableMfa,XS),yield ua(gi.verifyMfaAfterForce,QS),yield ua(gi.preDisableMfaSms,av),yield ua(gi.disableMfaSms,rv),yield ua(gi.preEnrollMfaSms,iv),yield ua(gi.enrollMfaSms,ov),yield ua(gi.preEnrollMfaWebAuthn,ZS),yield ua(gi.enrollMfaWebAuthn,ev),yield ua(gi.preDisableMfaWebAuthn,tv),yield ua(gi.disableMfaWebAuthn,nv)}function*uv(){yield yo(gi.setMfaState({saving:!0})),yield yo(gi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*dv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield yo(gi.setMfaState(i)),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*yv(e){let{payload:{callback:t}}=e,n=Ei(e.payload,KS);yield yo(gi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield yo(gi.setMfaState(o)),yield mt(),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield yo(gi.setUser(C({},qy))),null==(t=e.callback)||t.call(e,!0)}function*gv(e){let{}=e,t=Ei(e.payload,zS);yield yo(gi.setMfaState({saving:!0}));try{var n;yield yo(gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield yo(gi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*pv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield yo(gi.setUser(C({},qy))),null==(t=e.callback)||t.call(e,!0)}function*Sv({payload:e}){var t;yield yo(gi.setMfaState({saving:!0})),yield mt(),yield yo(gi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*vv(e){let{payload:{callback:t}}=e;Ei(e.payload,qS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield ho((e=>e.auth.mfaState));yield yo(gi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield yo(gi.setMfaState(o)),yield yo(gi.setUser(C({},qy,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*hv(){yield ua(gi.enrollMfa,uv),yield ua(gi.verifyMfa,dv),yield ua(gi.disableMfa,fv),yield ua(gi.verifyMfaAfterForce,yv),yield ua(gi.preDisableMfaSms,gv),yield ua(gi.disableMfaSms,pv),yield ua(gi.preEnrollMfaSms,Sv),yield ua(gi.enrollMfaSms,vv)}const mv=["callback"];function*bv({payload:e}){yield yo(gi.setForgotPasswordState({loading:!0}));try{var t;yield po(Ay.auth.forgotPassword,e),yield yo(gi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*Av(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mv);yield yo(gi.setForgotPasswordState({loading:!0}));try{yield po(Ay.auth.resetPassword,n),yield yo(gi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield yo(gi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*kv({payload:e}){yield yo(gi.setForgotPasswordState({loading:!0}));try{const t=yield po(Ay.auth.loadPasswordConfig,e);yield yo(gi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield yo(gi.setForgotPasswordState({loading:!1,error:e.message}))}}function*Tv(){yield ya(gi.forgotPassword,bv),yield ya(gi.resetPassword,Av),yield ya(gi.loadPasswordConfig,kv)}let Pv;!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"}(Pv||(Pv={}));const Iv=["callback","events"],Lv=["callback"],Ev=["callback"];function*Ov({payload:{userId:e,token:t}}){yield yo(gi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield ho((e=>e.auth));n&&(yield yo(gi.silentLogout()));const i=yield po(Ay.auth.getActivateAccountStrategy,{userId:e,token:t});yield yo(gi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield yo(gi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message}))}}function*wv(e){let{payload:{callback:t,events:n}}=e,i=Ei(e.payload,Iv);yield yo(gi.setActivateState({loading:!0}));try{const e=fa.onRedirectTo,{routes:a}=yield ho((e=>e.auth)),r=yield po(Ay.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(xg(r)){yield yo(gi.setActivateState({step:Nt.success}));const t=yield Wg(r);yield yo(gi.setState(t)),yield mo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield yo(gi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield po(Ay.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:mf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield yo(gi.setTenantsState({tenants:t,loading:!1})),yield yo(gi.setState({user:e,isAuthenticated:!0})),yield mo(1e3),yield Fg(),yield yo(gi.resetActivateState())}null==t||t(!0)}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message}))}}function*Cv({payload:e}){const{callback:t}=e,n=Ei(e,Lv);yield yo(gi.setActivateStrategyState({loading:!0}));try{const e=yield po(Ay.auth.getActivateAccountStrategy,n);yield yo(gi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield yo(gi.setActivateStrategyState({loading:!1,error:e.message}))}}function*Dv({payload:e}){const{callback:t}=e,n=Ei(e,Ev);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.email})),yield yo(gi.setActivateState({loading:!0}));try{yield po(Ay.auth.resendActivationEmail,n),yield yo(gi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield yo(gi.setActivateState({loading:!1,error:e.message})),yield yo(gi.setTeamError({key:Pv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*Rv(){yield ya(gi.activateAccount,wv),yield ya(gi.preActivateAccount,Ov),yield ya(gi.getActivateAccountStrategy,Cv),yield ya(gi.resendActivationEmail,Dv)}function*Uv({payload:e}){if(e.token&&e.userId)try{yield yo(gi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield po(Ay.auth.acceptInvitation,e),yield yo(gi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield yo(gi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield yo(gi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*_v(){yield ya(gi.acceptInvitation,Uv)}var Mv,Nv=new Uint8Array(16);function Fv(){if(!Mv&&!(Mv="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 Mv(Nv)}for(var $v=/^(?:[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,Gv=function(e){return"string"==typeof e&&$v.test(e)},xv=[],Vv=0;Vv<256;++Vv)xv.push((Vv+256).toString(16).substr(1));var jv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Fv)();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=(xv[e[t+0]]+xv[e[t+1]]+xv[e[t+2]]+xv[e[t+3]]+"-"+xv[e[t+4]]+xv[e[t+5]]+"-"+xv[e[t+6]]+xv[e[t+7]]+"-"+xv[e[t+8]]+xv[e[t+9]]+"-"+xv[e[t+10]]+xv[e[t+11]]+xv[e[t+12]]+xv[e[t+13]]+xv[e[t+14]]+xv[e[t+15]]).toLowerCase();if(!Gv(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let Wv,Bv;!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"}(Wv||(Wv={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bv||(Bv={}));const Kv=["callback"],zv=["roles"],qv=["callback"],Hv=["callback","profileImage"],Jv=["callback"],Yv=["callback","userId"],Qv=["callback"],Xv=["callback"],Zv=["callback"],eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback","profileImage"],ah=["callback"],rh=["callback"],sh=["callback"],lh=["callback"],ch=["callback"],uh=["callback"],dh=()=>ho((e=>e.auth.teamState));function*yh(){try{const{groups:e}=yield po(Ay.groups.getGroups,{_groupsRelations:Bv.roles});return e}catch(e){return[]}}function*fh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!a})),yield yo(gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield fo([po(Ay.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions),po(yh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield yo(gi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield yo(gi.setTeamError({key:Pv.USERS,value:e.message})),yield yo(gi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1}))}function*gh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!r})),yield yo(gi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield fo([po(Ay.subTenants.loadAllUsers,C({},c)),po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions)]);yield yo(gi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield yo(gi.setTeamError({key:Pv.USERS,value:e.message})),yield yo(gi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1}))}function*ph({payload:e}){yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield fo([po(Ay.teams.loadAvailableRoles),po(Ay.teams.loadAvailablePermissions)]);yield yo(gi.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 yo(gi.setTeamError({key:Pv.ROLES_AND_PERMISSIONS,value:t.message}))}yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0}))}function*Sh({payload:e}){const{callback:t}=e,n=Ei(e,Kv),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield po(Ay.teams.addUser,n),{roles:a}=e,r=C({},Ei(e,zv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield yo(gi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vh({payload:e}){const{callback:t}=e,n=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield yo(gi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield po(Ay.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 yo(gi.loadUsers(r)),yield yo(gi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*hh({payload:e}){const{callback:t}=e,n=Ei(e,qv),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield po(Ay.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield yo(gi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*mh({payload:e}){const{callback:t}=e,n=Ei(e,Hv),{id:i}=n,o=yield dh(),a=o.users.find((e=>e.id===n.id));yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:i||""})),yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield po(Ay.teams.updateUser,n);null==t||t(e),yield yo(gi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1}))}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*bh({payload:e}){const{callback:t}=e,n=Ei(e,Jv),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield po(Ay.teams.deleteUser,n),null==t||t(!0),yield yo(gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Ah({payload:e}){const{callback:t,userId:n}=e,i=Ei(e,Yv),o=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield yo(gi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield yo(gi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*kh({payload:e}){const{callback:t}=e,n=Ei(e,Qv),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield po(Ay.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield yo(gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Th({payload:e}){const{callback:t}=e,n=Ei(e,Xv);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield po(Ay.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*Ph({payload:e}){const{callback:t}=e,n=Ei(e,Zv);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Ih({payload:e}){const{callback:t}=e,n=Ei(e,eh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Lh({payload:e}){const{callback:t}=e,n=Ei(e,th);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email}));try{yield po(Ay.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Eh(){yield yo(gi.setTeamError({key:Pv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield po(Ay.teams.getInviteLinkConfiguration);yield yo(gi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield yo(gi.setTeamError({key:Pv.CONFIG_TOKEN_LINK,value:e.message}))}}function*Oh(){yield yo(gi.setTeamError({key:Pv.GET_TOKEN_LINK,value:!1}));try{yield po(Eh);const e=yield po(Ay.teams.getInviteUserLink),{inviteTokenState:t}=yield dh();yield yo(gi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield yo(gi.setTeamError({key:Pv.GET_TOKEN_LINK,value:e.message}))}}function*wh({payload:{callback:e}}){yield yo(gi.setTeamError({key:Pv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield dh();try{const n=yield po(Ay.teams.createInviteUserLink,{expiresInMinutes:43200});yield yo(gi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield yo(gi.setTeamError({key:Pv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ch({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield dh();yield yo(gi.setTeamError({key:Pv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield po(Ay.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield yo(gi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield yo(gi.setTeamError({key:Pv.UPDATE_TOKEN_LINK,value:t.message}))}}function*Dh({payload:e}){const{callback:t}=null!=e?e:{};yield yo(gi.setTeamError({key:Pv.DELETE_TOKEN_LINK,value:!1}));try{yield po(Ay.teams.deleteInviteUserLink),yield yo(gi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield yo(gi.setTeamError({key:Pv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Rh({payload:e}){yield yo(gi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Uh({payload:e}){const t=yield dh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield yo(gi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_h({payload:e}){yield yo(gi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Mh({payload:e}){const t=yield dh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield yo(gi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Nh(){yield da(gi.loadUsers,fh),yield da(gi.loadAllSubTenantsUsers,gh),yield da(gi.loadRoles,ph),yield ua(gi.addUser,Sh),yield ua(gi.addUsersBulk,vh),yield ua(gi.addUserToSubTenants,hh),yield ua(gi.updateUser,mh),yield ua(gi.setUserRolesForSubTenants,Ah),yield ua(gi.deleteUser,bh),yield ua(gi.deleteUserFromSubTenants,kh),yield ua(gi.resendActivationLink,Th),yield ua(gi.resendInvitationLink,Ph),yield ua(gi.resendInvitationEmail,Ih),yield ua(gi.resendInvitationLinkToAllSubTenants,Lh),yield ua(gi.getInvitationLink,Oh),yield ua(gi.createInvitationLink,wh),yield ua(gi.updateInvitationLink,Ch),yield ua(gi.deleteInvitationLink,Dh),yield ua(gi.openAddUserDialog,Rh),yield ua(gi.closeAddUserDialog,Uh),yield ua(gi.openDeleteUserDialog,_h),yield ua(gi.closeDeleteUserDialog,Mh)}function*Fh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!a})),yield yo(gi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield yo(gi.setTeamState({users:cf,totalPages:2,totalItems:10,roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1})),null==r||r(cf)}function*$h({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield dh(),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 yo(gi.setTeamLoader({key:Pv.USERS,value:!r})),yield yo(gi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield yo(gi.setTeamState({allUsers:uf,totalPages:2,totalItems:10,roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.USERS,value:!1})),null==s||s(uf)}function*Gh({payload:e}){var t;yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield yo(gi.setTeamState({roles:nf,permissions:af})),yield yo(gi.setTeamLoader({key:Pv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:nf,permissions:af})}function*xh({payload:e}){const{callback:t}=e,n=Ei(e,nh),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},sf,{groups:[]},n,{id:`${jv()}`});null==t||t(o),yield yo(gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Vh({payload:e}){const{callback:t}=e,n=Ei(e,ih),i=yield dh();yield yo(gi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},sf,n,{id:`${jv()}`});yield yo(gi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*jh({payload:e}){var t;const{callback:n}=e,i=Ei(e,oh),{id:o}=i,a=yield dh(),r=a.users.find((e=>e.id===i.id));yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:o||""})),yield yo(gi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield yo(gi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield yo(gi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield yo(gi.setTeamLoader({key:Pv.UPDATE_USER,value:!1}))}function*Wh({payload:e}){const{callback:t}=e,n=Ei(e,ah),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield yo(gi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Bh({payload:e}){const{callback:t}=e,n=Ei(e,rh),i=yield dh();yield yo(gi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield yo(gi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Kh({payload:e}){const{callback:t}=e,n=Ei(e,sh);yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_ACTIVATE_LINK,value:!1}))}function*zh({payload:e}){const{callback:t}=e,n=Ei(e,lh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*qh({payload:e}){const{callback:t}=e,n=Ei(e,ch);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Hh({payload:e}){const{callback:t}=e,n=Ei(e,uh);yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield yo(gi.setTeamLoader({key:Pv.RESEND_INVITATION_LINK,value:!1}))}function*Jh(){yield da(gi.loadUsers,Fh),yield da(gi.loadAllSubTenantsUsers,$h),yield da(gi.loadRoles,Gh),yield ua(gi.addUser,xh),yield ua(gi.addUserToSubTenants,Vh),yield ua(gi.updateUser,jh),yield ua(gi.deleteUser,Wh),yield ua(gi.deleteUserFromSubTenants,Bh),yield ua(gi.resendActivationLink,Kh),yield ua(gi.resendInvitationLink,zh),yield ua(gi.resendInvitationEmail,qh),yield ua(gi.resendInvitationLinkToAllSubTenants,Hh),yield ua(gi.openAddUserDialog,Rh),yield ua(gi.closeAddUserDialog,Uh),yield ua(gi.openDeleteUserDialog,_h),yield ua(gi.closeDeleteUserDialog,Mh)}const Yh=["authorizationUrl"],Qh=["events","url"];function*Xh(){try{yield yo(gi.setSocialLoginsState({loading:!0}));const e=yield po(Ay.auth.getSocialLoginProviders);yield yo(gi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Zh(){try{const e=yield ho((e=>e.root.context));yield yo(gi.setSocialLoginsState({loading:!0}));const t=yield po(Ay.auth.getSocialLoginProvidersV2),{providers:n}=yield po(Ay.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ei(t,Yh);const o=ma(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield yo(gi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield yo(gi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*em(e){let{payload:{events:t,url:n}}=e,i=Ei(e.payload,Qh);try{yield yo(gi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield po(Ay.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:bf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:mf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield yo(gi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield ho((e=>e.auth));e?yield po(Hg):yield po(Yg),yield Kg()}(),localStorage.removeItem("register-quick-login"),yield yo(gi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield yo(gi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*tm({payload:e}){yield yo(gi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*nm(){yield ya(gi.loadSocialLoginsConfiguration,Xh),yield ya(gi.loadSocialLoginsConfigurationV2,Zh),yield ya(gi.loginViaSocialLogin,em),yield da(gi.setSocialLoginError,tm)}let im;function*om({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield ho((e=>e.auth.apiTokensState));try{let e,a;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield po(Ay.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield po(Ay.auth.updateUserApiTokensData,{description:t}),yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield yo(gi.setApiTokensError({key:im.ADD_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*am({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield ho((e=>e.auth.apiTokensState));try{let e,r;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield po(Ay.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield po(Ay.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield yo(gi.setApiTokensError({key:im.ADD_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*rm({payload:e}){const{apiTokensDataUser:t}=yield ho((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),n?(yield po(Ay.auth.deleteUserAccessToken,{id:e}),yield yo(gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield po(Ay.auth.deleteUserApiToken,{tokenId:e}),yield yo(gi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}catch(e){yield yo(gi.setApiTokensError({key:im.DELETE_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}}function*sm({payload:e}){const{apiTokensDataTenant:t}=yield ho((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),n?(yield po(Ay.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield po(Ay.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield yo(gi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}catch(e){yield yo(gi.setApiTokensError({key:im.DELETE_API_TOKEN,value:e.message})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}}function*lm({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield fo([po(Ay.auth.getUserApiTokensData),po(Ay.auth.getTenantApiTokensData)]);yield yo(gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*cm({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=po(Ay.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=po(Ay.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield yo(gi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*um({payload:e}){null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=po(Ay.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=po(Ay.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 yo(gi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield yo(gi.setApiTokensError({key:im.LOAD_API_TOKENS,value:t.message})),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*dm(){yield ya(gi.loadApiTokens,lm),yield ya(gi.loadUserApiTokens,cm),yield ya(gi.loadTenantApiTokens,um),yield ua(gi.addUserApiToken,om),yield ua(gi.addTenantApiToken,am),yield da(gi.deleteTenantApiToken,sm),yield da(gi.deleteUserApiToken,rm)}function*ym({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield ho((e=>e.auth.apiTokensState)),a=C({},By,{description:t,roleIds:n,clientId:`CLIENT_ID_${jv()}`});yield yo(gi.setApiTokensState({showAddTokenDialog:!1})),yield mo(200),yield yo(gi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*fm({payload:e}){yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!0})),yield mo(200);const t=[By];yield yo(gi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield yo(gi.setApiTokensLoader({key:im.DELETE_API_TOKEN,value:!1}))}function*gm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[Wy],i=[By];yield yo(gi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*pm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[Wy];yield yo(gi.setApiTokensState({apiTokensDataUser:n})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Sm({payload:e}){var t;null!=e&&e.silentLoading||(yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!0})));const n=[By];yield yo(gi.setApiTokensState({apiTokensDataTenant:n})),yield mo(200),yield yo(gi.setApiTokensLoader({key:im.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*vm(){yield ya(gi.loadApiTokens,gm),yield ya(gi.loadUserApiTokens,pm),yield ya(gi.loadTenantApiTokens,Sm),yield ua(gi.addTenantApiToken,ym),yield da(gi.deleteTenantApiToken,fm)}function*hm({payload:e}){try{var t;yield yo(gi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield ho((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield po(Ay.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield yo(gi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield yo(gi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*mm({payload:e}){yield yo(gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield po(Ay.accountSettings.getSettings);yield yo(gi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield yo(gi.setAccountSettingsState({loading:!1,error:e.message}))}}function*bm(){yield ya(gi.saveAccountSettings,hm),yield ya(gi.loadAccountSettings,mm)}function*Am({payload:e}){var t;yield yo(gi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield ho((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield yo(gi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*km({payload:e}){yield yo(gi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield yo(gi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Tm(){yield ya(gi.saveAccountSettings,Am),yield ya(gi.loadAccountSettings,km)}function*Pm({payload:{tenantId:e,callback:t}}){yield yo(gi.setState({isLoading:!0}));try{yield po(Ay.tenants.switchTenant,{tenantId:e}),yield po(zg),(null==t?void 0:t(!0))||(yield yo(gi.setState({isLoading:!1})))}catch(e){yield yo(gi.setState({isLoading:!1})),null==t||t(!1,e)}}function*Im({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getTenants);yield yo(gi.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 yo(gi.setTenantsState({loading:!1}))}}function*Lm({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getSubTenants);yield yo(gi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Em({payload:e}){yield yo(gi.setTenantsState({loading:!0}));try{var t;const n=yield po(Ay.tenants.getSubTenantsAsTree);yield yo(gi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield yo(gi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Om(){yield ua(gi.loadTenants,Im),yield ua(gi.loadSubTenants,Lm),yield ua(gi.switchTenant,Pm),yield ua(gi.loadSubTenantsTree,Em)}function*wm(){yield yo(gi.setTenantsState({loading:!0})),yield mt(),yield yo(gi.setTenantsState({tenants:df,loading:!1}))}function*Cm(){yield ua(gi.loadTenants,wm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(im||(im={}));const Dm=["callback"],Rm=["callback"],Um=["callback"],_m=["callback"],Mm=["callback"];function*Nm({payload:e}){var t;yield yo(gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield fo([po(Ay.roles.getRoles),po(Ay.roles.getPermissions),po(Ay.roles.getPermissionCategories)]),[t,n,i]=e;yield yo(gi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield yo(gi.setRolesState({error:e.message,loading:!1}))}}function*Fm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Dm);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.addRole,n),i=yield po(Ay.roles.getRoles);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$m(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Rm);yield yo(gi.setRolesState({saving:!0}));try{yield po(Ay.roles.deleteRole,n),yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*Gm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Um);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.updateRole,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*xm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,_m);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.attachPermissionsToRole,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Vm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Mm);yield yo(gi.setRolesState({saving:!0}));try{const e=yield po(Ay.roles.attachPermissionToRoles,n);yield yo(gi.loadRolesAndPermissions({silentLoading:!0})),yield yo(gi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield yo(gi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*jm(){yield ya(gi.loadRolesAndPermissions,Nm),yield ua(gi.addRole,Fm),yield ua(gi.deleteRole,$m),yield ua(gi.updateRole,Gm),yield ua(gi.attachPermissionsToRole,xm),yield ua(gi.attachPermissionToRoles,Vm)}function*Wm({payload:e}){var t;yield yo(gi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield yo(gi.setRolesState({roles:Ky,loading:!1}))}catch(e){yield yo(gi.setRolesState({error:e.message,loading:!1}))}}function*Bm(){yield ya(gi.loadRolesAndPermissions,Wm)}const Km=["callback"],zm=["callback"],qm=["callback"];function*Hm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Km);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const e=yield po(Ay.auth.resetPhoneNumber,n);yield yo(gi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield yo(gi.setLoginState({email:n.email}))}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Jm(e){let{payload:{callback:t}}=e,n=Ei(e.payload,zm);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const e=yield po(Ay.auth.verifyResetPhoneNumber,n);yield yo(gi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Ym(e){let{payload:{callback:t}}=e,n=Ei(e.payload,qm);yield yo(gi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield ho((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield po(Ay.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield yo(gi.setLoginState({step:Pt.loginWithSmsOtc})),yield yo(gi.passwordlessPreLogin({type:jr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield yo(gi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Qm(){yield ya(gi.resetPhoneNumber,Hm),yield ya(gi.verifyResetPhoneNumber,Jm),yield ya(gi.changePhoneNumber,Ym)}function*Xm(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCurrentUserSessions);yield yo(gi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*Zm(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getCurrentUserSession);yield yo(gi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*eb({payload:{id:e}}){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.deleteSessionForUser,e),yield yo(gi.loadUserSessions())}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*tb({payload:{callback:e,userId:t}}){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield yo(gi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*nb(){yield yo(gi.setSessionsState({loading:!0,error:null}));try{yield po(Ay.auth.deleteAllSessionsForUser),yield yo(gi.loadUserSessions())}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*ib(){yield da(gi.loadUserSessions,Xm),yield da(gi.deleteUserSession,eb),yield da(gi.deleteAllUserSessions,nb),yield da(gi.loadCurrentUserSession,Zm),yield ua(gi.revokeUserSessions,tb)}function*ob(){yield yo(gi.setSessionsState({loading:!0,error:null})),yield yo(gi.setSessionsState({sessions:yf,loading:!1}))}function*ab({payload:{id:e}}){yield yo(gi.setSessionsState({loading:!0,error:null}));const t=(yield ho((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield yo(gi.setSessionsState({sessions:t,loading:!1}))}function*rb(){yield yo(gi.setSessionsState({loading:!0,error:null}));const e=yf.filter((e=>e.current));yield yo(gi.setSessionsState({sessions:e,loading:!1}))}function*sb(){yield da(gi.loadUserSessions,ob),yield da(gi.deleteUserSession,ab),yield da(gi.deleteAllUserSessions,rb)}const lb=["callback"],cb=["callback"];function*ub(){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getSessionConfigurations);yield yo(gi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield yo(gi.setSessionsState({error:e,loading:!1}))}}function*db({payload:e}){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ei(e,lb);yield po(Ay.auth.createOrUpdateSessionConfigrations,n),yield yo(gi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield yo(gi.setSessionsPolicyState({error:e,loading:!1}))}}function*yb(){yield ya(gi.loadSessionsPolicy,ub),yield da(gi.createOrUpdateSessionsPolicy,db)}function*fb(){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));const e=yield ho((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:ff}));yield yo(gi.setSessionsPolicyState(C({},e,{loading:!1})))}function*gb({payload:e}){yield yo(gi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ei(e,cb);null==t||t(!0),yield yo(gi.setSessionsPolicyState({configurations:n,loading:!1}))}function*pb(){yield ya(gi.loadSessionsPolicy,fb),yield da(gi.createOrUpdateSessionsPolicy,gb)}const Sb=["callback"],vb=["callback"],hb=["callback"],mb=["callback"],bb=["callback"],Ab=["callback"],kb=["callback"],Tb=["callback"],Pb=()=>ho((e=>e.auth.restrictionsState.ipRestrictions)),Ib=()=>ho((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Lb(){yield yo(gi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield po(Ay.auth.getDomainRestrictionsConfig),t=(yield po(Ay.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield yo(gi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield yo(gi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Eb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Sb);yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Ib();try{var o;yield po(Ay.auth.createDomainRestriction,n);const e=(yield po(Ay.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield yo(gi.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 yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ob(e){let{payload:{callback:t}}=e,n=Ei(e.payload,vb);yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield po(Ay.auth.updateDomainRestrictionConfig,n),i=(yield po(Ay.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield yo(gi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wb({payload:{id:e}}){yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Ib();try{var n;yield po(Ay.auth.deleteDomainRestriction,e);const i=(yield po(Ay.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield yo(gi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Cb=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:xn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Db(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Pb(),t=yield po(Ay.auth.getIPRestrictionsConfig),n=Cb({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield po(Ay.auth.getIPRestrictions,n);yield yo(gi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Rb(){try{const{valid:e}=yield po(Ay.auth.testCurrentIpInAllowList);yield yo(gi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message}))}}function*Ub({payload:{callback:e}}){yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield ho((e=>e.auth.userIp));yield fo([po(Ay.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),po(Ay.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Pb(),i=Cb(n.pagination),{items:o,_metadata:{totalPages:a}}=yield po(Ay.auth.getIPRestrictions,i);yield yo(gi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield yo(gi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*_b(e){let{payload:{callback:t}}=e,n=Ei(e.payload,hb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield Pb();try{var o,a;yield po(Ay.auth.createIPRestriction,n);const e=yield Pb(),r=Cb(e.pagination),{items:s,_metadata:{totalPages:l}}=yield po(Ay.auth.getIPRestrictions,r);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Mb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,mb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));try{yield po(Ay.auth.updateIPRestrictionConfig,n);const e=yield Pb(),i=yield po(Ay.auth.getIPRestrictionsConfig),o=Cb(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield po(Ay.auth.getIPRestrictions,o);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Nb({payload:{id:e,callback:t}}){yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const n=yield Pb();try{var i;yield po(Ay.auth.deleteIPRestriction,e);const o=yield Pb(),a=Cb(o.pagination),{items:r,_metadata:{totalPages:s}}=yield po(Ay.auth.getIPRestrictions,a);yield Rb(),yield yo(gi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Fb(){yield ya(gi.loadIpRestrictions,Db),yield ya(gi.loadEmailDomainRestrictions,Lb),yield ua(gi.saveIpRestriction,_b),yield ua(gi.saveIpRestrictionsConfig,Mb),yield ua(gi.deleteIpRestriction,Nb),yield ua(gi.checkIfUserIpValid,Rb),yield ua(gi.addCurrentUserIpAndActivate,Ub),yield ua(gi.saveEmailDomainRestriction,Eb),yield ua(gi.saveEmailDomainRestrictionsConfig,Ob),yield ua(gi.deleteEmailDomainRestriction,wb)}function*$b(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null})),yield yo(gi.setIpRestrictionsState({data:{restrictions:pf.filter((e=>e.strategy===gf.strategy)),config:gf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*Gb(){yield yo(gi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Pb(),t=pf[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield yo(gi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield yo(gi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*xb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ei(e.payload,bb);yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const r=yield Pb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield yo(gi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:jv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Vb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ei(e.payload,Ab);const r=yield Pb();yield yo(gi.setIpRestrictionsState({saving:!0,error:null})),yield yo(gi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield yo(gi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*jb({payload:{id:e,callback:t}}){var n;yield yo(gi.setIpRestrictionsState({saving:!0,error:null}));const i=yield Pb();yield yo(gi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Wb(){yield yo(gi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield yo(gi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Bb(e){var t,n;let{payload:{callback:i}}=e,o=Ei(e.payload,kb);const a=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*Kb(e){var t;let{payload:{callback:n}}=e,i=Ei(e.payload,Tb);const o=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield yo(gi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*zb({payload:{id:e}}){var t,n;const i=yield Ib();yield yo(gi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield yo(gi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*qb(){yield ya(gi.loadIpRestrictions,$b),yield ya(gi.loadEmailDomainRestrictions,Wb),yield ua(gi.saveIpRestriction,xb),yield ua(gi.saveIpRestrictionsConfig,Vb),yield ua(gi.deleteIpRestriction,jb),yield ua(gi.checkIfUserIpValid,Gb),yield ua(gi.saveEmailDomainRestriction,Bb),yield ua(gi.saveEmailDomainRestrictionsConfig,Kb),yield ua(gi.deleteEmailDomainRestriction,zb)}const Hb=["callback"],Jb=["id"];function*Yb(e){const{count:t}=yield po(Ay.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*Qb(){yield yo(gi.setProvisioningState({loading:!0,error:null}));try{const e=yield po(Ay.directory.getConfigs),t=yield fo(e.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*Xb(e){let{payload:{callback:t}}=e,n=Ei(e.payload,Hb);yield yo(gi.setProvisioningState({loading:!0,error:null}));try{const e=yield po(Ay.directory.createConfiguration,n),i=yield po(Ay.directory.getConfigs),o=yield fo(i.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*Zb(e){let{payload:{id:t}}=e,n=Ei(e.payload,Jb);yield yo(gi.setProvisioningState({loading:!0,error:null}));try{yield po(Ay.directory.updateConfiguration,t,n);const e=yield po(Ay.directory.getConfigs),i=yield fo(e.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1}))}}function*eA({payload:{id:e,callback:t}}){yield yo(gi.setProvisioningState({loading:!0,error:null}));try{yield po(Ay.directory.deleteConfiguration,e);const n=yield po(Ay.directory.getConfigs),i=yield fo(n.map((e=>Yb(e))));yield yo(gi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*tA(){yield ya(gi.loadProvisionConnections,Qb),yield ua(gi.createProvisionConnection,Xb),yield ua(gi.deleteProvisionConnection,eA),yield ua(gi.updateProvisionConnection,Zb)}const nA=["callback","events"];function*iA(e){let{payload:{callback:t}}=e,n=Ei(e.payload,nA);yield yo(gi.setImpersonateState({loading:!0}));try{yield po(Ay.impersonate.impersonate,n),yield yo(gi.setImpersonateState({step:li.success})),yield mo(1e3),yield Fg(),yield yo(gi.resetImpersonateState()),null==t||t(!0)}catch(e){yield yo(gi.setImpersonateState({loading:!1,error:e.message}))}}function*oA(){yield ya(gi.impersonate,iA)}function*aA({payload:e}){const{callback:t,deviceId:n}=e;yield yo(gi.setPasskeysState({loading:!0}));try{yield po(Ay.auth.deleteWebAuthnDevice,n);const{devices:e}=yield ho((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield yo(gi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield yo(gi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*rA(){yield yo(gi.setPasskeysState({loading:!0}));try{const{devices:e}=yield po(Ay.auth.getWebAuthnDevices);yield yo(gi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield yo(gi.setPasskeysState({loading:!1,error:e.message||null}))}}function*sA(){yield ua(gi.loadWebAuthnDevices,rA),yield ua(gi.deleteWebAuthnDevice,aA)}const lA=["roleIds","userIds"],cA=()=>ho((e=>e.auth.groupsState));function*uA({payload:e}){const t=Wv.GET_TEAM_USERS;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield po(Ay.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield yo(gi.setGroupsState({teamUsers:n}))}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA({payload:e}){const t=Wv.GET_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield po(Ay.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Bv.rolesAndUsers});yield yo(gi.setGroupsState({selectedGroup:n}))}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*yA(){const e=Wv.GET_GROUPS,t=yield cA();yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield po(Ay.groups.getGroups,{_groupsRelations:Bv.rolesAndUsers});yield yo(gi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield yo(gi.setUsersGroupsError({key:e,value:t.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}}function*fA({payload:e}){const t=Wv.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ei(e,lA);yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield po(Ay.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield yo(gi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield yo(gi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield yo(gi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*gA({payload:e}){const t=Wv.UPDATE_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.updateGroup,e),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*pA({payload:e}){const t=Wv.DELETE_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteGroup,e.groupId),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*SA({payload:e}){const t=Wv.ADD_ROLES_TO_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*vA({payload:e}){const t=Wv.DELETE_ROLES_FROM_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*hA({payload:e}){const t=Wv.ADD_USERS_TO_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield yo(gi.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 yo(gi.setUsersGroupsError({key:t,value:n.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*mA({payload:e}){const t=Wv.DELETE_USERS_FROM_GROUP;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield po(Ay.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield yo(gi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield yo(gi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*bA(){const e=Wv.GET_GROUP_CONFIGURATION;yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield po(Ay.groups.getGroupConfiguration);yield yo(gi.setGroupsState({groupsConfiguration:t}))}catch(t){yield yo(gi.setUsersGroupsError({key:e,value:t.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}}function*AA({payload:e}){const t=Wv.UPDATE_GROUP_CONFIGURATION;yield yo(gi.setUsersGroupsLoader({key:t,value:!0}));try{yield po(Ay.groups.updateGroupConfiguration,e),yield yo(gi.getGroupConfiguration())}catch(e){yield yo(gi.setUsersGroupsError({key:t,value:e.message}))}finally{yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}}function*kA(){yield da(gi.loadGroups,yA),yield da(gi.getGroupById,dA),yield da(gi.createGroup,fA),yield da(gi.updateGroup,gA),yield da(gi.deleteGroup,pA),yield da(gi.addRolesToGroup,SA),yield da(gi.deleteRolesFromGroup,vA),yield da(gi.addUsersToGroup,hA),yield da(gi.deleteUsersFromGroup,mA),yield da(gi.getGroupConfiguration,bA),yield da(gi.updateGroupConfiguration,AA),yield da(gi.getTeamUsers,uA)}function*TA(){const e=Wv.GET_GROUPS;yield yo(gi.setUsersGroupsLoader({key:e,value:!0}));const t=hf;yield yo(gi.setGroupsState({groups:t})),yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}function*PA({payload:e}){var t;const n=Wv.CREATE_GROUP,{groups:i}=yield cA();yield yo(gi.setUsersGroupsLoader({key:n,value:!0})),yield yo(gi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:hy.FRONTEGG}),...null!=i?i:[]]})),yield mo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:n,value:!1}))}function*IA({payload:e}){var t,n,i,o,a;const r=Wv.UPDATE_GROUP,s=yield cA();yield yo(gi.setUsersGroupsLoader({key:r,value:!0})),yield yo(gi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:hy.FRONTEGG}):t})),selectedGroup:C({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield mo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:r,value:!1}))}function*LA({payload:e}){var t,n;const i=Wv.DELETE_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*EA({payload:e}){var t,n;const i=Wv.ADD_ROLES_TO_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*OA({payload:e}){var t,n;const i=Wv.DELETE_ROLES_FROM_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*wA({payload:e}){var t,n;const i=Wv.ADD_USERS_TO_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*CA({payload:e}){var t,n;const i=Wv.DELETE_USERS_FROM_GROUP,o=yield cA();yield yo(gi.setUsersGroupsLoader({key:i,value:!0})),yield yo(gi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield mo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield yo(gi.setUsersGroupsLoader({key:i,value:!1}))}function*DA(){const e=Wv.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield cA();yield yo(gi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield yo(gi.setGroupsState({groupsConfiguration:C({},t)}))),yield yo(gi.setUsersGroupsLoader({key:e,value:!1}))}function*RA({payload:e}){const t=Wv.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield cA();yield yo(gi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield yo(gi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield yo(gi.setUsersGroupsLoader({key:t,value:!1}))}function*UA(){yield da(gi.loadGroups,TA),yield da(gi.createGroup,PA),yield da(gi.updateGroup,IA),yield da(gi.deleteGroup,LA),yield da(gi.addRolesToGroup,EA),yield da(gi.deleteRolesFromGroup,OA),yield da(gi.addUsersToGroup,wA),yield da(gi.deleteUsersFromGroup,CA),yield da(gi.getGroupConfiguration,DA),yield da(gi.updateGroupConfiguration,RA)}const _A=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,..._A(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),MA=["callback"];function*NA(){yield yo(gi.setCustomLoginState({loading:!0}));try{const e=yield po(Dc);yield yo(gi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield yo(gi.setCustomLoginState({loading:!1,error:e.message}))}}function*FA(e){let{payload:{callback:t}}=e,n=Ei(e.payload,MA);try{if(yield yo(gi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=_A(n);if(0===e.length)throw new Error("no changes to update");yield po(Rc,{actions:e});const i=yield po(Dc);yield yo(gi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield yo(gi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*$A(){yield ya(gi.loadTenantMetadata,NA),yield ya(gi.updateTenantMetadata,FA)}var GA={sagas:function*(){yield fo([po(Np),po(Rv),po(_v),po(Tv),po(Qm),po(Xp),po(LS),po(RS),po($A),po(cv),po(Nh),po(kA),po(nm),po(Lf),po(dm),po(eg),po(bm),po(Om),po(jm),po(ib),po(yb),po(Fb),po(tA),po(oA),po(sA),po(vg)])},mockSagas:function*(){yield fo([po(Gp),po(aS),po(NS),po(hv),po(Jh),po(vm),po(fg),po(sb),po(Tm),po(Cm),po(pb),po(qb),po(Bm),po(UA)])},storeName:wt,initialState:si,reducer:yi,actions:gi};const xA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),VA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},jA={setAuditLogsState:xA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:VA})},WA={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},BA={loading:!0},KA={setAuditsMetadataState:xA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:BA})},zA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},qA={auditLogsState:VA,auditsMetadataState:BA},{reducer:HA,actions:JA}=ut({name:Dt,initialState:qA,reducers:C({resetState:e=>C({},e,qA),setState:(e,{payload:t})=>C({},e,t)},jA,KA)}),YA=C({},JA,WA,zA),QA=e=>"createdAt"!==e.id,XA={total:20,data:Array.from(Array(5).keys()).map((e=>C({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},ZA={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}]},ek=()=>ho((e=>e.auditLogs.auditLogsState)),tk=()=>ho((e=>e.auditLogs.auditsMetadataState));function*nk(){const e=yield ek(),{columns:t}=yield tk();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield yo(YA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Ay.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield yo(YA.setAuditLogsState({isDownloadingCsv:!1}))}function*ik({payload:e}){yield yo(YA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield ek(),{columns:n}=yield tk();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 yo(YA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield yo(YA.loadAuditsMetadata()));const{data:g,total:p}=yield po(Ay.audits.getAudits,C({offset:c,count:l},y,f));yield yo(YA.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield yo(YA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*ok(){yield ua(YA.exportAuditsCsv,nk),yield ua(YA.loadAuditLogs,ik)}function*ak({payload:e}){yield yo(YA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield ek(),{columns:n}=yield tk();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 yo(YA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield yo(YA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=XA;let i=n.filter((e=>t=>e.filter(QA).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 yo(YA.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 yo(YA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*rk(){yield ua(YA.loadAuditLogs,ak)}function*sk(){yield yo(YA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield po(Ay.metadata.getAuditsMetadata);yield yo(YA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield yo(YA.setAuditsMetadataState({error:e,loading:!1}))}}function*lk(){yield ua(YA.loadAuditsMetadata,sk)}function*ck(){yield yo(YA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=ZA;yield yo(YA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield yo(YA.setAuditsMetadataState({error:e,loading:!1}))}}function*uk(){yield ua(YA.loadAuditsMetadata,ck)}var dk={sagas:function*(){yield fo([po(ok),po(lk)])},mockSagas:function*(){yield fo([po(rk),po(uk)])},storeName:Dt,initialState:qA,reducer:HA,actions:YA};const yk={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:fk,actions:gk,reducer:pk}=ut({name:"audits",initialState:yk,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=C({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Sk=C({},gk,{initData:lt(`${fk}/initData`),loadAudits:lt(`${fk}/loadAudits`),removeFilter:lt(`${fk}/removeFilter`),filterData:lt(`${fk}/filterData`),exportCSV:lt(`${fk}/exportCSV`),deleteAudits:lt(`${fk}/deleteAudits`)}),vk=()=>ho((e=>e[fk]));function*hk(){const{sortBy:e,sortDirection:t}=yield vk();try{const n=yield po(Ay.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield yo(Sk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield yo(Sk.loadItemFailedAction(t))}}function*mk(){try{const e=yield po(Ay.metadata.getAuditsMetadata);yield yo(Sk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield yo(Sk.loadItemFailedAction(t))}}const bk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Ak({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield vk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield vk():{rowsData:[]};try{const e=bk(t),{data:s,total:d}=yield po(Ay.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield yo(Sk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield yo(Sk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield yo(Sk.loadItemFailedAction(t))}}function*kk(){yield yo(Sk.startLoading()),yield fo([hk(),mk(),Ak({payload:{onlyOneLoad:!1},type:""})]),yield yo(Sk.finishLoading())}function*Tk({payload:e}){const{filters:t}=yield vk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield yo(Sk.setFilterData(i))}function*Pk({payload:e}){const{filters:t}=yield vk();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 yo(Sk.setFilterData(i))}function*Ik(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield vk(),a=bk(e);yield yo(Sk.startDownloadingCsv());try{yield Ay.audits.exportAudits(C({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield yo(Sk.stopDownloadingCsv())}}function*Lk(){yield da(Sk.initData,kk),yield da(Sk.removeFilter,Tk),yield da(Sk.filterData,Pk),yield da([Sk.loadAudits,Sk.textSearch,Sk.onPageChange],Ak),yield da([Sk.setFilterData,Sk.setDataSorting,Sk.startRefresh],(()=>Ak({payload:{appendMode:!1},type:""}))),yield da(Sk.exportCSV,Ik)}const Ek={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Ok={initData:()=>C({},Ek),setConnectivityState:(e,{payload:t})=>C({},e,t),cleanWebhookTestData:e=>C({},e,{testResult:void 0}),cleanWebhookLogsData:e=>C({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return C({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>C({},e,{error:void 0}),cleanSlackData:e=>C({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>C({},e,{retryResult:C({},e.retryResult,t)})}},wk={loadSlackActions:lt("connectivity/loadSlackActions"),loadDataAction:lt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:lt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:lt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:lt("connectivity/loadScope"),deleteWebhookConfigAction:lt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:lt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:lt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},Ck={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Dk,actions:Rk}=ut({name:Ct,initialState:Ck,reducers:C({},Ok)}),Uk=C({},Rk,wk),_k={slack:Ay.connectivity.getSlackConfiguration,email:Ay.connectivity.getEmailConfiguration,sms:Ay.connectivity.getSMSConfiguration,webhook:Ay.connectivity.getWebhooksConfigurations,categories:Ay.connectivity.getCategories,channelMap:Ay.connectivity.getChannelMaps},Mk={slack:Ay.connectivity.postSlackConfiguration,email:Ay.connectivity.postEmailConfiguration,sms:Ay.connectivity.postSMSConfiguration,webhook:Ay.connectivity.postWebhooksConfiguration},Nk=["email","slack","sms","webhook"],Fk={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"}},$k=["id"],Gk=["id","enabled"],xk=["categories","channelMap"];function*Vk(e){return yield po(Wk,{payload:{api:e},type:""})}function*jk({payload:e=Nk}){yield yo(Uk.setConnectivityState({isLoading:!0}));try{const t=yield fo([...e.map(Vk),yield Wk({payload:{api:"categories"},type:""}),yield function*(){return(yield fo(e.map((function*(e){return yield Wk({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Wk({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Fk[e[o]].events(i),active:Fk[e[o]].isActive(i),platform:Fk[e[o]].title,image:Fk[e[o]].image}]}):n:C({},n,{[`${xk[o-e.length]}`]:i})),{list:[],webhook:n});yield yo(Uk.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield yo(Uk.setConnectivityState({isLoading:!1}))}}function*Wk({payload:{api:e,params:t}}){try{return yield po(_k[e],t)}catch(e){return}}function*Bk(){try{yield yo(Uk.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield po(Ay.connectivity.getSlackChannels);yield yo(Uk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield yo(Uk.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Kk(e,t){const{connectivity:{list:n}}=yield ho(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Fk[e].isActive(t);o!==i.active&&(yield yo(Uk.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*zk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield ho((e=>e.connectivity));try{if(yield yo(Uk.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield ho();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield fo([...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=Ei(e,$k);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield po(Mk.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield po(Ay.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield ho(),{processIds:i}=yield ho((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield fo([...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 po("email"===t?Ay.connectivity.postEmailConfiguration:Ay.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=Ei(o,Gk);return yield fo([yield po("email"===t?Ay.connectivity.patchEmailConfiguration:Ay.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield po("email"===t?Ay.connectivity.putEmailSubscriptions:Ay.connectivity.putSMSSubscriptions,a,i,C({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return po("email"===t?Ay.connectivity.deleteEmailSubscriptions:Ay.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Wk({payload:{api:t},type:""});yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Kk(t,e)}else yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield po(Mk[e],t),!["sms","email"].includes(e)){const o=yield Wk({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Kk(e,o),null==n||n(!0)}}catch(e){var o;yield yo(Uk.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*qk({payload:e}){try{yield Ay.connectivity.postSlackCode(e)}catch{}yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1}))}function*Hk(){const{slackChannels:e}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield po(Ay.connectivity.getSlackScope);yield yo(Uk.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield yo(Uk.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Jk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({isSaving:!0})),yield po(Ay.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Wk({payload:{api:"webhook"},type:""});o&&(yield yo(Uk.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Yk({payload:e}){try{yield yo(Uk.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield po(Ay.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield yo(Uk.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Qk({payload:e}){try{const{statusCode:t}=yield po(Ay.connectivity.postWebhookRetry,e);yield yo(Uk.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield yo(Uk.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*Xk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield ho((e=>e.connectivity));try{yield yo(Uk.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield po(Ay.connectivity.getWebhookLog,e,n,t);yield yo(Uk.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield yo(Uk.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Zk={sagas:function*(){yield ua(Uk.loadDataAction,jk),yield da(Uk.loadSlackActions,Bk),yield ua(Uk.postDataAction,zk),yield ua(Uk.postCodeAction,qk),yield ua(Uk.loadScope,Hk),yield ua(Uk.deleteWebhookConfigAction,Jk),yield ua(Uk.postWebhookTestAction,Yk),yield ua(Uk.postWebhookRetryAction,Qk),yield da(Uk.loadWebhookLogsAction,Xk)},storeName:Ct,initialState:Ck,reducer:Dk,actions:Uk};function eT(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}}function tT(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function nT(e){return tT(e,((e,t)=>C({},e,{loading:t.payload})))}function iT(e){return tT(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const oT={loading:!1,error:null,fetching:!0,plans:[]},{actions:aT,reducer:rT,name:sT}=ut({name:"subscriptions/plans",initialState:oT,reducers:C({},eT())}),lT=C({loadPlans:lt(`${sT}/loadPlans`)},aT),cT={loading:!1,error:null,fetching:!0,config:null},uT=C({},eT()),{actions:dT,reducer:yT,name:fT}=ut({name:"subscriptions/config",initialState:cT,reducers:uT}),gT=C({loadPaymentConfiguration:lt(`${fT}/loadPaymentConfiguration`)},dT),pT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},ST=C({},eT(),{setCancellationLoading:nT("cancellation"),setCancellationError:iT("cancellation"),setRenewalLoading:nT("renewal"),setRenewalError:iT("renewal")}),{reducer:vT,actions:hT,name:mT}=ut({name:"subscriptions/billing/subscription",initialState:pT,reducers:ST}),bT=C({load:lt(`${mT}/loadSubscription`),cancelSubscription:lt(`${mT}/cancelSubscription`),renewSubscription:lt(`${mT}/renewSubscription`)},hT),AT={loading:!1,error:null,fetching:!0},kT=C({},eT()),{reducer:TT,actions:PT,name:IT}=ut({name:"subscriptions/billing/information",initialState:AT,reducers:kT}),LT=C({loadBillingInformation:lt(`${IT}/loadBillingInformation`),cancelSubscription:bT.cancelSubscription,renewSubscription:bT.renewSubscription},PT),ET={loading:!1,error:null,fetching:!0},OT=C({},eT(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:wT,actions:CT,name:DT}=ut({name:"subscriptions/billing/payment",initialState:ET,reducers:OT}),RT=C({loadPaymentMethod:lt(`${DT}/loadPaymentMethod`),submitPaymentMethod:lt(`${DT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${DT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${DT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${DT}/updateBillingDetails`,(e=>({payload:e})))},CT),UT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},_T=C({},eT(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:MT,actions:NT,name:FT}=ut({name:"subscriptions/billing/invoices",initialState:UT,reducers:_T}),$T=C({loadInvoices:lt(`${FT}/loadInvoices`),downloadInvoice:lt(`${FT}/downloadInvoice`,(e=>({payload:e})))},NT),GT={information:AT,invoices:UT,paymentMethod:ET,subscription:pT},xT={invoices:$T,information:LT,paymentMethod:RT,subscription:bT},VT=je({invoices:MT,information:TT,paymentMethod:wT,subscription:vT}),jT={fetching:!0,loading:!1,error:null,confirmed:!1},WT=C({},eT()),{actions:BT,reducer:KT,name:zT}=ut({name:"subscriptions/checkout",initialState:jT,reducers:WT}),qT=C({loadCheckout:lt(`${zT}/loadCheckout`),resetCheckout:lt(`${zT}/resetCheckout`),submitCheckout:lt(`${zT}/submitCheckout`),confirmCheckout:lt(`${zT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${zT}/errorCheckout`,(e=>({payload:e})))},BT),HT={loading:!1,error:null,cardSetupIntentSecret:null},JT=C({},eT()),{reducer:YT,actions:QT,name:XT}=ut({name:"subscriptions/stripe",initialState:HT,reducers:JT}),ZT=C({loadCustomer:lt(`${XT}/loadCustomer`),createCardSetupIntentSecret:lt(`${XT}/createCardSetupIntentSecret`)},QT),eP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:tP,reducer:nP,name:iP}=ut({name:"subscriptions/vendorPublicConfig",initialState:eP,reducers:C({},eT())}),oP=C({loadVendorPublicConfiguration:lt(`${iP}/loadVendorPublicConfiguration`)},tP),aP={config:cT,plans:oT,checkout:jT,billing:GT,stripe:HT,vendorPublicConfig:eP},rP={config:gT,billing:xT,plans:lT,checkout:qT,stripe:ZT,vendorPublicConfig:oP},sP=je({config:yT,billing:VT,plans:rT,checkout:KT,stripe:YT,vendorPublicConfig:nP});let lP,cP,uP;function dP({policy:e}){return{policy:uP.AT_PERIOD_END}}function yP(e){switch(e){case hd.ACTIVE:return cP.ACTIVE;case hd.INCOMPLETE:return cP.INCOMPLETE;case hd.CANCELED:return cP.CANCELED;case hd.EXPIRED:return cP.EXPIRED;case hd.TRIALING:return cP.TRIALING;default:return cP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(lP||(lP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(cP||(cP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(uP||(uP={}));const fP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:hd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},gP=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],pP=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],SP=[{id:"id",externalId:"externalId",type:md.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],vP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*hP(){yield ua(bT.load,mP),yield ua(bT.cancelSubscription,AP),yield ua(bT.renewSubscription,kP)}function*mP(){const e=yield ho((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield EP(e)}function*bP(){yield yo(bT.setLoading(!0));try{const[e]=yield po(Ay.subscriptions.getManagedSubscriptions);yield yo(bT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield yo(bT.setError(e))}}function*AP(){const{subscription:e}=yield ho((e=>e.subscriptions.billing.subscription));if(!e)return void(yield yo(bT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield yo(bT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===hd.ACTIVE)try{yield yo(bT.setCancellationLoading(!0)),yield po(Ay.subscriptions.cancelManagedSubscription,t),yield bP(),yield yo(bT.setCancellationLoading(!1))}catch(e){yield yo(bT.setCancellationError(e.message))}}function*kP(){const{subscription:e}=yield ho((e=>e.subscriptions.billing.subscription));if(!e)return void(yield yo(bT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield yo(bT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===bd.AT_PERIOD_END)try{yield yo(bT.setRenewalLoading(!0)),yield po(Ay.subscriptions.renewManagedSubscription,t),yield bP(),yield yo(bT.setRenewalLoading(!1))}catch(e){yield yo(bT.setCancellationError(e.message))}}function*TP(){yield yo(bT.setLoading(!0)),yield mo(500),yield yo(bT.setState({subscription:fP,fetching:!1,loading:!1,error:null}))}function*PP(){yield ua(bT.load,TP)}function*IP(){yield ua(LT.loadBillingInformation,LP)}function*LP(){yield function*(e){const t=yield ho((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield ho((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield EP(n,!1):yield yo(LT.setError(t?"Not authorized":"Internal feature failure"))}()}function*EP(e,t){yield yo(LT.setLoading(!0));try{var n,i;const o=yield po(Ay.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield po(Ay.subscriptions.getSubscriptionPlan,a):([,s]=yield fo([po(bP),po(Ay.subscriptions.getSubscriptionPlan,a)]),l=yield ho((e=>e.subscriptions.billing.subscription.subscription||null))),yield yo(LT.setState(C({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?cP.ACTIVE:yP(l.status),cancellation:l.cancellation&&dP(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 yo(LT.setError(e.message))}}function*OP(){yield function*(){var e,t;yield yo(LT.setLoading(!0)),yield mo(500),yield yo(LT.setState({loading:!1,fetching:!1,summary:{subscriptionId:fP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Ad.Stripe,externallyManaged:!1,currentPlanId:gP[0].id,defaultPlanId:gP[0].id},plan:C({},gP[0],{price:null==(e=gP[0].price)?void 0:e.amount,currency:null==(t=gP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*wP(){yield ua(LT.loadBillingInformation,OP)}function*CP(){yield ua(RT.loadPaymentMethod,DP),yield ua(RT.submitPaymentMethod,UP),yield ua(RT.submitPaymentMethodError,_P),yield ua(RT.submitPaymentMethodSuccess,MP),yield ua(RT.updatePaymentMethodBillingDetails,RP)}function*DP(){yield yo(RT.setLoading(!0));try{const e=(yield po(Ay.subscriptions.getPaymentMethods))[0];yield yo(RT.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield yo(RT.setError(e.message))}}function*RP({payload:e}){yield yo(RT.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield po(Ay.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield po(DP),null==o||o(!0)}catch(e){yield yo(RT.setError(e.message)),null==o||o(!1)}yield yo(RT.setLoading(!1))}function*UP(){yield yo(RT.setLoading(!0))}function*_P({payload:e}){yield yo(RT.setError(e))}function*MP(){yield yo(RT.loadPaymentMethod())}function*NP(){yield yo(RT.setLoading(!0)),yield mo(500);const e=SP[0];yield yo(RT.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*FP(){yield ua(RT.loadPaymentMethod,NP)}function*$P(){yield ua($T.loadInvoices,GP),yield ua($T.downloadInvoice,xP)}function*GP(){yield yo($T.setLoading(!0));try{const e=(yield po(Ay.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 yo($T.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield yo($T.setError(e.message))}}function*xP({payload:e}){yield yo($T.setInvoiceDownloadState({loading:!0,error:null}));try{yield po(Ay.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield yo($T.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield yo($T.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*VP(){yield yo($T.setLoading(!0)),yield mo(500),yield yo($T.setState({loading:!1,fetching:!1,invoices:pP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield yo($T.setLoading(!1))}function*jP(){yield ua($T.loadInvoices,VP)}function*WP(){yield fo([po(IP),po(CP),po($P),po(hP)])}function*BP(){yield fo([po(wP),po(FP),po(jP),po(PP)])}function*KP(){yield ua(qT.loadCheckout,zP),yield ua(qT.resetCheckout,qP),yield ua(qT.submitCheckout,HP),yield ua(qT.confirmCheckout,JP),yield ua(qT.errorCheckout,QP)}function*zP(){yield yo(qT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*qP(){yield yo(qT.setState({loading:!1,error:null,confirmed:!1}))}function*HP(){yield yo(qT.setState({loading:!0,error:null}))}function*JP({payload:{paymentMethodId:e,planId:t}}){const n=yield ho((e=>e.subscriptions.billing.subscription.subscription)),i=yield ho((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===hd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield yo(qT.setState({loading:!0,error:null})),o&&a)return yield YP(),void(yield yo(bT.setState({subscription:C({},n,{status:hd.ACTIVE})})));try{yield po(Ay.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield fo([LP(),DP(),GP()]),yield YP()}catch(e){yield yo(qT.setState({loading:!1,error:e.message}))}}else yield yo(qT.setState({loading:!1,error:"Subscription not found"}))}function*YP(){yield yo(qT.setState({loading:!1,error:null,confirmed:!0}))}function*QP({payload:e}){yield yo(qT.setState({loading:!1,error:e}))}function*XP(){yield ua(qT.resetCheckout,qP)}function*ZP(){yield ua(lT.loadPlans,eI)}function*eI(){yield yo(lT.setLoading(!0));try{const e=(yield po(Ay.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 yo(lT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield yo(lT.setError(e.message))}}function*tI(){yield yo(lT.setLoading(!0)),yield mo(500),yield yo(lT.setState({fetching:!1,loading:!1,plans:gP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*nI(){yield ua(lT.loadPlans,tI)}function*iI(){yield ua(gT.loadPaymentConfiguration,oI)}function*oI(){yield yo(gT.setLoading(!0));try{(yield po(Ay.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Ad.Stripe))?yield function*(){yield yo(gT.setLoading(!0));try{const e=yield po(Ay.subscriptions.getStripePaymentProviderConfiguration);yield yo(gT.setState({loading:!1,fetching:!1,config:{paymentProvider:lP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield yo(gT.setError(e.message))}}():yield yo(gT.setError("Payment provider not configured"))}catch(e){yield yo(gT.setError(e.message))}}function*aI(){yield yo(gT.setLoading(!0)),yield mo(500),yield yo(gT.setState({loading:!1,fetching:!1,config:{paymentProvider:lP.STRIPE,apiKey:""}}))}function*rI(){yield ua(gT.loadPaymentConfiguration,aI)}function*sI(){yield ua(ZT.createCardSetupIntentSecret,lI)}function*lI({payload:e}){yield yo(ZT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield po(Ay.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield yo(ZT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield yo(ZT.setError(e.message))}}function*cI(){yield ua(oP.loadVendorPublicConfiguration,uI)}function*uI(){yield yo(oP.setLoading(!0));try{const e=yield po(Ay.subscriptions.getVendorPublicConfigurations);yield yo(oP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield yo(oP.setError(e.message))}}function*dI(){yield yo(oP.setLoading(!0)),yield mo(500),yield yo(oP.setState({fetching:!1,loading:!1,vendorPublicConfig:vP}))}function*yI(){yield ua(oP.loadVendorPublicConfiguration,dI)}var fI={sagas:function*(){yield fo([po(WP),po(KP),po(ZP),po(iI),po(sI),po(cI)])},mockSagas:function*(){yield fo([po(BP),po(XP),po(nI),po(rI),po(yI)])},reducer:sP,actions:rP,initialState:aP,storeName:"subscriptions"},gI={sagas:function*(){yield ua(Rf.loadVendorPublicInfo,Uf)},storeName:Rt,initialState:wf,reducer:Cf,actions:Rf};const{reducer:pI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(fa.setContext(t),C({},e,{context:t}))}}}),SI=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,g,p,S,v;n||a||fa.setContext(e.context);const t=ta(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[GA.storeName]:C({},GA.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},GA.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[dk.storeName]:C({},dk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},dk.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:C({},dk.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[fk]:C({},yk,null!=(v=null==o?void 0:o.audits)?v:{}),[Zk.storeName]:Zk.initialState,[fI.storeName]:fI.initialState,[gI.storeName]:gI.initialState},reducer:je({root:pI,[GA.storeName]:GA.reducer,[dk.storeName]:dk.reducer,[fk]:pk,[Zk.storeName]:Zk.reducer,[fI.storeName]:fI.reducer,[gI.storeName]:gI.reducer})});const m=function*(){yield fo([po(GA.sagas),po(dk.sagas),po(Lk),po(Zk.sagas),po(fI.sagas),po(gI.sagas)])},b=function*(){yield fo([po(GA.mockSagas),po(dk.mockSagas),po(fI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(gi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var vI=n(714),hI=n.n(vI);function mI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function bI(e){if(e.type)return e;if("#"===e.charAt(0))return bI(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 AI(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 kI(e){if(0===e.indexOf("#"))return e;const{values:t}=bI(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 TI(e,t){return e=bI(e),t=mI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,AI(e)}function PI(e,t){if(e=bI(e),t=mI(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 AI(e)}function II(e,t){if(e=bI(e),t=mI(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 AI(e)}const LI=e=>{if(e)return{main:e,light:kI(II(e,.4)),dark:kI(PI(e,.15)),hover:kI(PI(e,.15)),active:kI(PI(e,.2))}},EI=e=>{if(e)return{main:e,light:II(e,.7),dark:PI(e,.2)}},OI=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?C({},t,{palette:{primary:C({},LI(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:C({},LI(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:C({},LI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},EI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},EI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},EI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},EI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},wI={},CI={},DI={},RI={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class UI{constructor(){this._theme=wI,this._themeV2=CI,this._navigation=RI,this._localizations=DI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new UI;return n.set(e),UI._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=hI().all([null!=(t=RI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=hI().all([null!=(i=wI)?i:{},OI(null==e?void 0:e.theme,wI)]),this._themeV2=hI().all([null!=(o=CI)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=hI().all([null!=(r=DI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=RI,this._theme=wI,this._themeV2=CI,this._localizations=DI}}}UI._instances={};var _I=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},MI=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},NI=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)}))},FI=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let $I,GI,xI,VI,jI,WI,BI,KI,zI,qI,HI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}($I||($I={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(GI||(GI={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(xI||(xI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(VI||(VI={})),function(e){e.Invoices="invoices"}(jI||(jI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(WI||(WI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(BI||(BI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(KI||(KI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(zI||(zI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(qI||(qI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(HI||(HI={}));const JI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},YI={hidden:"hidden",edit:"edit"};var QI="6.101.0",XI={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"},ZI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(QI),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=R(_().mark((function e(){var t,n,i,a,r;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ka,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:UI.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Nd.set(XI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Fd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Nd.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=_I(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=C({},t,{contextOptions:C({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?C({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=SI({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(s,this)}var t,n,i,o;return O(e,[{key:"initContainers",value:(o=R(_().mark((function e(t){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;UI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fa.setRequestSource(Sa.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),FI(t),fa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"getEntitlements",value:function(e){var t;return((e,t)=>t.reduce(((t,n)=>[...t,{isEntitled:e[n]||!1}]),[]))((null==(t=this.store.getState().auth.entitlementsState)?void 0:t.entitlements)||{},e)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),eL=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(fa.setAccessToken(t),fa.setUser(C({},n,{accessToken:t})),o.store.dispatch(gi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(gi.loadTenants())):(fa.setAccessToken(null),fa.setUser(null),o.store.dispatch(gi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),tL=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),nL=function(){function e(){P(this,e)}return O(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),iL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},oL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=SI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new ZI(this.options,t,!0),UI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,NI(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}(),aL="modern",rL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[aL]},sL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=SI({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=C({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new ZI(this.options,t,!0,a),UI.set({},t)}var t;return O(e,[{key:"render",value:(t=R(_().mark((function e(t){var n,i,o,a,r=this;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,NI(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 lL(e,t){return lL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},lL(e,t)}function cL(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&&lL(e,t)}function uL(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function dL(e){return dL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dL(e)}function yL(){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 fL(e,t,n){return fL=yL()?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&&lL(o,n.prototype),o},fL.apply(null,arguments)}function gL(e){var t="function"==typeof Map?new Map:void 0;return gL=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 fL(e,arguments,dL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),lL(n,e)},gL(e)}function pL(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=dL(e);if(t){var o=dL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return uL(this,n)}}var SL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new ZI(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){cL(n,e);var t=pL(n);function n(){var e;P(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return O(n,[{key:"connectedCallback",value:function(){this.updateContent()}},{key:"attributeChangedCallback",value:function(e,t,n){if("app-name"===e){if(null===t)return;if(t===n)return;this.innerHTML="",null===n?this.remove():this.updateContent()}console.debug("attributeChangedCallback",e,t,n)}},{key:"updateContent",value:function(){var e,t=null!=(e=this.getAttribute("app-name"))?e:"default",n=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=MI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=MI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=MI(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=MI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=MI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=MI(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}(gL(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));