@frontegg/js 6.101.0 → 6.103.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FronteggApp/FronteggApp.d.ts +1 -6
- package/FronteggApp/FronteggApp.js +1 -13
- package/index.js +1 -1
- package/node/FronteggApp/FronteggApp.js +0 -12
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +1678 -700
- package/umd/frontegg.production.min.js +1 -1
- package/umd/frontegg.production.min.js.LICENSE.txt +1 -1
- package/version.js +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see frontegg.production.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof 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}()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return o(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||i,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=o;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):function(e,t,n){var i={};return n.isMergeableObject(e)&&a(e).forEach((function(t){i[t]=o(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?i[a]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):i[a]=o(t[a],n))})),i}(e,n,s):o(n,s)}l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return l(e,n,t)}),{})};var s=l;e.exports=s},609:function(e,t,n){var o=n(425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,o){var i=t&&t.prototype instanceof g?t:g,a=Object.create(i.prototype),l=new O(o||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(w([])));A&&A!==n&&a.call(A,s)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(i,r,l,s){var c=f(e[i],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==o(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,l,s)}),(function(e){n("throw",e,l,s)})):t.resolve(d).then((function(e){u.value=e,l(u)}),(function(e){return n("throw",e,l,s)}))}s(c.arg)}var i;r(this,"_invoke",{value:function(e,o){function a(){return new t((function(t,i){n(e,o,t,i)}))}return i=i?i.then(a,a):a()}})}function P(e,t,n){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(n.method=i,n.arg=a;;){var r=n.delegate;if(r){var l=E(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===o)throw o="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o="executing";var s=f(e,t,n);if("normal"===s.type){if(o=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o="completed",n.method="throw",n.arg=s.arg)}}}function E(e,t){var n=t.method,o=e.iterator[n];if(void 0===o)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function w(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:U}}function U(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,o,i,a){void 0===a&&(a=Promise);var r=new T(y(e,n,o,i),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(b),d(b,u,"Generator"),d(b,s,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var o in t)n.push(o);return n.reverse(),function e(){for(;n.length;){var o=n.pop();if(o in t)return e.value=o,e.done=!1,e}return e.done=!0,e}},t.values=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(L),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return r.type="throw",r.arg=e,t.next=n,o&&(t.method="next",t.arg=void 0),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&a.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var o=n.completion;if("throw"===o.type){var i=o.arg;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var o=n(609)();e.exports=o;try{regeneratorRuntime=o}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=o:Function("r","regeneratorRuntime = r")(o)}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){"use strict";n.r(o),n.d(o,{AdminPortal:function(){return II},AdminPortalRenderer:function(){return wI},AppHolder:function(){return w},CheckoutDialog:function(){return LI},FronteggApp:function(){return PI},HostedLogin:function(){return EI},LoginBoxRenderer:function(){return DI},createElement:function(){return rI},defaultTheme:function(){return UI},formatName:function(){return aI},getThemeAdminByName:function(){return OI},getThemeByName:function(){return CI},initialize:function(){return VI},mockFlagsList:function(){return TI},restoreSearchParams:function(){return sI},waitThemeSetter:function(){return lI}});var e={};n.r(e),n.d(e,{Delete:function(){return dr},Get:function(){return lr},Patch:function(){return cr},Post:function(){return sr},PostDownload:function(){return yr},Put:function(){return ur},extractHeadersFromOptions:function(){return fr},getBaseUrl:function(){return ir},getMetadataHeaders:function(){return ar}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return hr},getSubTenants:function(){return Sr},getSubTenantsAsTree:function(){return vr},getTenants:function(){return gr},getTenantsUsersCount:function(){return mr},searchSubTenants:function(){return Ar},switchTenant:function(){return pr}});var i={};n.r(i),n.d(i,{AuthStrategyEnum:function(){return qr},MachineToMachineAuthStrategy:function(){return Hr},OAuthLogout:function(){return hl},SocialLoginProviders:function(){return zr},acceptInvitation:function(){return pl},activateAccount:function(){return ul},bulkCreateIPRestriction:function(){return Vr},changePhoneNumber:function(){return lc},changePhoneNumberWithVerification:function(){return ac},checkIfAllowToRememberMfaDevice:function(){return Rs},createDomainRestriction:function(){return Nr},createIPRestriction:function(){return xr},createOrUpdateSessionConfigrations:function(){return hs},createSSOConfiguration:function(){return $s},createSSOConfigurationByMetadata:function(){return js},createSSODomain:function(){return Bs},createSSOGroup:function(){return Js},createSamlGroup:function(){return os},createTenantAccessToken:function(){return Is},createUserAccessToken:function(){return Es},deleteAllSessionsForUser:function(){return As},deleteDomainRestriction:function(){return Fr},deleteIPRestriction:function(){return Wr},deleteSSOConfiguration:function(){return Vs},deleteSSODomain:function(){return Ks},deleteSSOGroup:function(){return Qs},deleteSamlGroup:function(){return as},deleteSessionForUser:function(){return ms},deleteTenantAccessToken:function(){return Ts},deleteTenantApiToken:function(){return Cs},deleteUserAccessToken:function(){return Ps},deleteUserApiToken:function(){return Ds},deleteWebAuthnDevice:function(){return yc},disableMFAAuthenticatorApp:function(){return Dl},disableMFASMS:function(){return Rl},disableMFAWebAuthn:function(){return Ml},disableMfa:function(){return Cl},enrollMFAAuthenticatorApp:function(){return El},enrollMFAAuthenticatorAppForLogin:function(){return $l},enrollMFASMS:function(){return Ll},enrollMFASMSForLogin:function(){return jl},enrollMFAWebAuthn:function(){return wl},enrollMFAWebAuthnForLogin:function(){return zl},enrollMfa:function(){return Tl},exchangeOAuthTokens:function(){return tc},forgotPassword:function(){return ml},generateLoginResponse:function(){return tl},generateLoginResponseFromOAuthResponse:function(){return ol},generateLoginResponseV2:function(){return nl},getActivateAccountStrategy:function(){return dl},getCaptchaPolicy:function(){return Or},getCurrentUserSession:function(){return gs},getCurrentUserSessions:function(){return ps},getCustomSocialLoginProvidersV1:function(){return us},getDomainRestrictions:function(){return _r},getDomainRestrictionsConfig:function(){return Rr},getGlobalSecurityPolicy:function(){return br},getIPRestrictions:function(){return Gr},getIPRestrictionsConfig:function(){return $r},getLockoutPolicy:function(){return Er},getMFADevices:function(){return Fl},getMFAStrategiesConfig:function(){return gc},getMfaPolicy:function(){return kr},getOidcConfiguration:function(){return rs},getPasswordConfigPolicy:function(){return Dr},getPasswordHistoryPolicy:function(){return wr},getSSOConfigurations:function(){return Gs},getSSODefaultRoles:function(){return qs},getSSOGroups:function(){return Xs},getSSOPublicConfiguration:function(){return ls},getSamlConfiguration:function(){return Jl},getSamlRoles:function(){return es},getSamlRolesGroups:function(){return ts},getSamlVendorConfiguration:function(){return Ql},getSessionConfigurations:function(){return vs},getSocialLoginProviders:function(){return ss},getSocialLoginProvidersV2:function(){return cs},getTenantAccessTokensData:function(){return ks},getTenantApiTokensData:function(){return Os},getUserAccessTokensData:function(){return bs},getUserApiTokensData:function(){return Ls},getUserById:function(){return _s},getVendorConfig:function(){return ys},getVendorLockoutPolicy:function(){return Ir},getVendorMfaPolicy:function(){return Tr},getVendorPasswordHistoryPolicy:function(){return Ur},getVendorPublicAuthStrategiesConfig:function(){return pc},getWebAuthnDevices:function(){return dc},loadPasswordConfig:function(){return bl},login:function(){return sl},loginViaSocialLogin:function(){return ds},loginWithMfa:function(){return cl},logout:function(){return vl},oidcPostLogin:function(){return ll},oidcPostLoginV2:function(){return ec},passwordlessPostLogin:function(){return Ms},passwordlessPreLogin:function(){return Ns},postLogin:function(){return rl},preDisableMFASMS:function(){return _l},preDisableMFAWebAuthn:function(){return Nl},preEnrollMFAAuthenticatorApp:function(){return Pl},preEnrollMFAAuthenticatorAppForLogin:function(){return Gl},preEnrollMFASMS:function(){return Il},preEnrollMFASMSForLogin:function(){return Vl},preEnrollMFAWebAuthn:function(){return Ol},preEnrollMFAWebAuthnForLogin:function(){return Kl},preLogin:function(){return il},preLoginV2:function(){return Zs},preLoginWithIdpType:function(){return al},preVerifyMFASMSForLogin:function(){return Wl},preVerifyMFAWebAuthnForLogin:function(){return ql},recoverMfaToken:function(){return kl},refreshToken:function(){return gl},refreshTokenV2:function(){return Sl},resendActivationEmail:function(){return yl},resendInvitationEmail:function(){return fl},resetPassword:function(){return Al},resetPhoneNumber:function(){return oc},revokeSessionsForUser:function(){return Ss},saveLockoutPolicy:function(){return Lr},saveMfaPolicy:function(){return Pr},savePasswordHistoryPolicy:function(){return Cr},setSSODefaultRoles:function(){return Hs},signUpUser:function(){return fs},silentOAuthRefreshToken:function(){return nc},testCurrentIp:function(){return Br},testCurrentIpInAllowList:function(){return Kr},updateDomainRestrictionConfig:function(){return Mr},updateIPRestrictionConfig:function(){return jr},updateSSOConfiguration:function(){return xs},updateSSOConfigurationByMetadata:function(){return Ws},updateSSOGroup:function(){return Ys},updateSamlConfiguration:function(){return Yl},updateSamlGroup:function(){return is},updateSamlRoles:function(){return ns},updateSamlVendorMetadata:function(){return Xl},updateTenantApiTokensData:function(){return Us},updateUserApiTokensData:function(){return ws},validateSSODomain:function(){return zs},validateSamlDomain:function(){return Zl},verifyChangePhoneNumber:function(){return rc},verifyInviteToken:function(){return Fs},verifyMFAAuthenticatorAppForLogin:function(){return xl},verifyMFASMSForLogin:function(){return Bl},verifyMFAWebAuthnForLogin:function(){return Hl},verifyMfa:function(){return Ul},verifyNewDeviceSession:function(){return fc},verifyResetPhoneNumber:function(){return ic},webAuthnCreateNewDeviceSession:function(){return uc},webAuthnPostLogin:function(){return cc},webAuthnPreLogin:function(){return sc}});var a={};n.r(a),n.d(a,{addUser:function(){return bc},changePassword:function(){return mc},createInviteUserLink:function(){return Pc},deleteInviteUserLink:function(){return Ic},deleteUser:function(){return kc},getInviteLinkConfiguration:function(){return Oc},getInviteUserLink:function(){return Lc},getProfile:function(){return Sc},loadAvailablePermissions:function(){return Uc},loadAvailableRoles:function(){return wc},loadStats:function(){return Cc},loadUsers:function(){return Ac},resendActivationLink:function(){return Dc},resendInvitationLink:function(){return _c},resendInvitationLinkToAllTenants:function(){return Rc},updateInviteUserLink:function(){return Ec},updateProfile:function(){return vc},updateProfileImage:function(){return hc},updateUser:function(){return Tc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return Mc},getAuditsMetadata:function(){return Vc},getCurrentUserIpMetadata:function(){return Gc},getIpAdressMetadata:function(){return jc},getNotificationsMetadata:function(){return $c},getSamlMetadata:function(){return xc},updateAdminBoxMetadata:function(){return Fc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Yc},getReport:function(){return qc},getReports:function(){return zc},renderReport:function(){return Hc},scheduleReport:function(){return Jc},sendReport:function(){return Qc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Xc},markAllAsRead:function(){return tu},updateNotificationIsPinned:function(){return eu},updateNotificationStatus:function(){return Zc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return au},getAudits:function(){return ou},getAuditsStats:function(){return iu}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return mu},deleteEmailSubscriptions:function(){return vu},deleteSMSConfiguration:function(){return Eu},deleteSMSSubscriptions:function(){return Tu},deleteSlackConfiguration:function(){return yu},deleteWebhooksConfiguration:function(){return Ou},getCategories:function(){return Du},getChannelMaps:function(){return _u},getEmailConfiguration:function(){return pu},getSMSConfiguration:function(){return Au},getSlackChannels:function(){return uu},getSlackConfiguration:function(){return su},getSlackScope:function(){return cu},getWebhookLog:function(){return wu},getWebhooksConfigurations:function(){return Iu},patchEmailConfiguration:function(){return Su},patchSMSConfiguration:function(){return ku},postEmailConfiguration:function(){return gu},postSMSConfiguration:function(){return bu},postSlackCode:function(){return fu},postSlackConfiguration:function(){return du},postWebhookRetry:function(){return Cu},postWebhookTest:function(){return Uu},postWebhooksConfiguration:function(){return Lu},putEmailSubscriptions:function(){return hu},putSMSSubscriptions:function(){return Pu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return Mu},getSettings:function(){return Nu},updateSettings:function(){return Ru}});var y={};n.r(y),n.d(y,{addRole:function(){return Vu},attachPermissionToRoles:function(){return zu},attachPermissionsToRole:function(){return Bu},deleteRole:function(){return ju},getPermissionCategories:function(){return qu},getPermissions:function(){return Ku},getRoles:function(){return xu},updateRole:function(){return Wu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Ed},ISubscriptionStatus:function(){return Td},PaymentMethodType:function(){return Pd},ProviderType:function(){return Id},TenantCreatedAction:function(){return Od},TrialEndAction:function(){return Ld},cancelManagedSubscription:function(){return td},cancelSubscription:function(){return Yu},createStripeCustomer:function(){return gd},createStripePaymentMethodSetupIntentSecret:function(){return vd},createSubscription:function(){return fd},createTenantConfiguration:function(){return Ad},getManagedSubscription:function(){return Zu},getManagedSubscriptions:function(){return ed},getPaymentMethod:function(){return dd},getPaymentMethods:function(){return ud},getPaymentProviders:function(){return bd},getStripeCustomer:function(){return pd},getStripePaymentProviderConfiguration:function(){return Sd},getSubscription:function(){return Ju},getSubscriptionInvoice:function(){return ld},getSubscriptionInvoicePdf:function(){return sd},getSubscriptionInvoices:function(){return rd},getSubscriptionPlan:function(){return ad},getSubscriptionPlans:function(){return id},getSubscriptionSummaries:function(){return hd},getSubscriptions:function(){return Hu},getTenantConfiguration:function(){return md},getVendorPublicConfigurations:function(){return kd},renewManagedSubscription:function(){return nd},renewSubscription:function(){return Qu},updateManagedSubscription:function(){return od},updatePaymentMethodBillingDetails:function(){return yd},updateSubscription:function(){return Xu}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return wd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return _d},addUserToTenantAndSubTenants:function(){return Cd},addUsersToSubTenant:function(){return xd},createSubTenant:function(){return Md},deleteSubTenant:function(){return Fd},loadAllUsers:function(){return Ud},removeUserFromTenantAndSubTenants:function(){return Dd},removeUserRolesFromSubTenants:function(){return Rd},setUserRolesForSubTenants:function(){return Nd},updateSubAccountAccess:function(){return $d},updateSubTenant:function(){return Gd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return jd},loadFeatureFlags:function(){return Wd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Hd},createConfiguration:function(){return zd},deleteConfiguration:function(){return qd},getConfigs:function(){return Bd},updateConfiguration:function(){return Kd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Jd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return oy},addUsersToGroup:function(){return ay},createGroup:function(){return ey},deleteGroup:function(){return ny},deleteRolesFromGroup:function(){return iy},deleteUsersFromGroup:function(){return ry},getGroupById:function(){return Qd},getGroupConfiguration:function(){return ly},getGroups:function(){return Xd},getGroupsByIds:function(){return Zd},updateGroup:function(){return ty},updateGroupConfiguration:function(){return sy}});var A={};n.r(A),n.d(A,{GetUserJwt:function(){return cy},getUsersV3:function(){return uy}});var b={};n.r(b),n.d(b,{loadEntitlements:function(){return dy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return qr},ContextHolder:function(){return Sa},FeatureFlags:function(){return jd},FronteggApiError:function(){return ka},FronteggContext:function(){return va},FronteggFrameworks:function(){return Aa},GroupManagedByEnum:function(){return Ey},GroupRelations:function(){return Py},ISubscriptionCancellationPolicy:function(){return Ed},ISubscriptionStatus:function(){return Td},MFAStrategyEnum:function(){return py},MachineToMachineAuthStrategy:function(){return Hr},PaginationOrderEnum:function(){return ba},PaymentMethodType:function(){return Pd},ProviderType:function(){return Id},RequestSource:function(){return ma},RestrictionType:function(){return xn},ScimConnectionSource:function(){return Ty},SecondaryAuthStrategy:function(){return yy},SocialLoginProviders:function(){return zr},SortByEnum:function(){return Iy},TenantSortByEnum:function(){return Sy},TenantType:function(){return vy},UserManagedByEnum:function(){return gy},WebAuthnDeviceType:function(){return fy},api:function(){return Ly},countConfigurationUsers:function(){return Hd},createConfiguration:function(){return zd},default:function(){return Oy},deleteConfiguration:function(){return qd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return hy},fronteggHeaders:function(){return ha},fronteggRefreshTokenUrl:function(){return my},fronteggSilentRefreshTokenUrl:function(){return Ay},fronteggTenantsUrl:function(){return ky},fronteggUsersUrl:function(){return by},getConfigs:function(){return Bd},loadFeatureFlags:function(){return Wd},updateConfiguration:function(){return Kd}});var T={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e){return E="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(e)}function I(e){var t=function(e,t){if("object"!==E(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!==E(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===E(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,I(o.key),o)}}function O(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(T),n.d(T,{AccountDetailsPageTabs:function(){return mI},AccountPageFields:function(){return yI},DomainRestrictionsTabFields:function(){return hI},GeneralSettingsTabFields:function(){return SI},InviteUserModalFields:function(){return dI},IpRestrictionsTabFields:function(){return vI},Metadata:function(){return iI},PrivacyPageFields:function(){return uI},ProfilePageFields:function(){return cI},SecurityPageTabs:function(){return pI},SessionManagementTabFields:function(){return gI},SubscriptionsPageFields:function(){return fI},alpha:function(){return HE},fieldAppearance:function(){return AI},tabAppearance:function(){return bI}});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 U(){return U=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},U.apply(this,arguments)}function C(e,t,n,o,i,a,r){try{var l=e[a](r),s=l.value}catch(e){return void n(e)}l.done?t(s):Promise.resolve(s).then(o,i)}function D(e){return function(){var t=this,n=arguments;return new Promise((function(o,i){var a=e.apply(t,n);function r(e){C(a,o,i,r,l,"next",e)}function l(e){C(a,o,i,r,l,"throw",e)}r(void 0)}))}}w._apps={};var _=n(841),R=n.n(_);function N(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function M(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[be]||!!e.constructor[be]||W(e)||B(e))}function G(e,t,n){void 0===n&&(n=!1),0===$(e)?(n?Object.keys:Pe)(e).forEach((function(o){n&&"symbol"==typeof o||t(o,e[o],e)})):e.forEach((function(n,o){return t(o,n,e)}))}function $(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===$(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function V(e,t,n){var o=$(e);2===o?e.set(t,n):3===o?(e.delete(t),e.add(n)):e[t]=n}function j(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function W(e){return 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=Ee(e);delete t[ke];for(var n=Pe(t),o=0;o<n.length;o++){var i=n[o],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function q(e,t){return void 0===t&&(t=!1),J(e)||M(e)||!F(e)||($(e)>1&&(e.set=e.add=e.clear=e.delete=H),Object.freeze(e),t&&G(e,(function(e,t){return q(t,!0)}),!0)),e}function H(){N(2)}function J(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function Y(e){var t=Ie[e];return t||N(18,e),t}function Q(){return ge}function X(e,t){t&&(Y("Patches"),e.u=[],e.s=[],e.v=t)}function Z(e){ee(e),e.p.forEach(ne),e.p=null}function ee(e){e===ge&&(ge=e.l)}function te(e){return ge={p:[],l:ge,h:e,m:!0,_:0}}function ne(e){var t=e[ke];0===t.i||1===t.i?t.j():t.O=!0}function oe(e,t){t._=t.p.length;var n=t.p[0],o=void 0!==e&&e!==n;return t.h.g||Y("ES5").S(t,e,o),o?(n[ke].P&&(Z(t),N(4)),F(e)&&(e=ie(t,e),t.l||re(t,e)),t.u&&Y("Patches").M(n[ke].t,e,t.u,t.s)):e=ie(t,n,[]),Z(t),t.u&&t.v(t.u,t.s),e!==Ae?e:void 0}function ie(e,t,n){if(J(t))return t;var o=t[ke];if(!o)return G(t,(function(i,a){return ae(e,o,t,i,a,n)}),!0),t;if(o.A!==e)return t;if(!o.P)return re(e,o.t,!0),o.t;if(!o.I){o.I=!0,o.A._--;var i=4===o.i||5===o.i?o.o=z(o.k):o.o;G(3===o.i?new Set(i):i,(function(t,a){return ae(e,o,i,t,a,n)})),re(e,i,!1),n&&e.u&&Y("Patches").R(o,n,e.u,e.s)}return o.o}function ae(e,t,n,o,i,a){if(M(i)){var r=ie(e,i,a&&t&&3!==t.i&&!x(t.D,o)?a.concat(o):void 0);if(V(n,o,r),!M(r))return;e.m=!1}if(F(i)&&!J(i)){if(!e.h.F&&e._<1)return;ie(e,i),t&&t.A.l||re(e,i)}}function re(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&q(t,n)}function le(e,t){var n=e[ke];return(n?K(n):e)[t]}function se(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=Object.getPrototypeOf(n)}}function 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 o=W(t)?Y("MapSet").N(t,n):B(t)?Y("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),o={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},i=o,a=Le;n&&(i=[o],a=Oe);var r=Proxy.revocable(i,a),l=r.revoke,s=r.proxy;return o.k=s,o.j=l,s}(t,n):Y("ES5").J(t,n);return(n?n.A:Q()).p.push(o),o}function ye(e){return M(e)||N(22,e),function e(t){if(!F(t))return t;var n,o=t[ke],i=$(t);if(o){if(!o.P&&(o.i<4||!Y("ES5").K(o)))return o.t;o.I=!0,n=fe(t,i),o.I=!1}else n=fe(t,i);return G(n,(function(t,i){o&&function(e,t){return 2===$(e)?e.get(t):e[t]}(o.t,t)===i||V(n,t,e(i))})),3===i?new Set(n):n}(e)}function fe(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return z(e)}var pe,ge,Se="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ve="undefined"!=typeof Map,he="undefined"!=typeof Set,me="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Ae=Se?Symbol.for("immer-nothing"):((pe={})["immer-nothing"]=!0,pe),be=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,Ee=Object.getOwnPropertyDescriptors||function(e){var t={};return Pe(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ie={},Le={get:function(e,t){if(t===ke)return e;var n=K(e);if(!x(n,t))return function(e,t,n){var o,i=se(t,n);return i?"value"in i?i.value:null===(o=i.get)||void 0===o?void 0:o.call(e.k):void 0}(e,n,t);var o=n[t];return e.I||!F(o)?o:o===le(e.t,t)?(ue(e),e.o[t]=de(e.A.h,o,e)):o},has:function(e,t){return t in K(e)},ownKeys:function(e){return Reflect.ownKeys(K(e))},set:function(e,t,n){var o=se(K(e),t);if(null==o?void 0:o.set)return o.set.call(e.k,n),!0;if(!e.P){var i=le(K(e),t),a=null==i?void 0:i[ke];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(j(n,i)&&(void 0!==n||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!==le(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),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty:function(){N(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){N(12)}},Oe={};G(Le,(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 Le.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,o){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=i);for(var o=arguments.length,r=Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var o;return(o=n).call.apply(o,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&N(6),void 0!==o&&"function"!=typeof o&&N(7),F(e)){var l=te(t),s=de(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Z(l):ee(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return X(l,o),oe(e,l)}),(function(e){throw Z(l),e})):(X(l,o),oe(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Ae&&(r=void 0),t.F&&q(r,!0),o){var u=[],d=[];Y("Patches").M(e,r,u,d),o(u,d)}return r}N(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var o,i,a=t.produce(e,n,(function(e,t){o=e,i=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,o,i]})):[a,o,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){F(e)||N(8),M(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),oe(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!me&&N(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));var i=Y("Patches").$;return M(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ue=new we,Ce=Ue.produce,De=(Ue.produceWithPatches.bind(Ue),Ue.setAutoFreeze.bind(Ue),Ue.setUseProxies.bind(Ue),Ue.applyPatches.bind(Ue),Ue.createDraft.bind(Ue),Ue.finishDraft.bind(Ue),Ce);function _e(e,t,n){return(t=I(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){_e(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Me(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Fe="function"==typeof Symbol&&Symbol.observable||"@@observable",Ge=function(){return Math.random().toString(36).substring(7).split("").join(".")},$e={INIT:"@@redux/INIT"+Ge(),REPLACE:"@@redux/REPLACE"+Ge(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ge()}};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 o;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Me(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Me(1));return n(Ve)(e,t)}if("function"!=typeof e)throw new Error(Me(2));var i=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Me(3));return a}function d(e){if("function"!=typeof e)throw new Error(Me(4));if(s)throw new Error(Me(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Me(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!xe(e))throw new Error(Me(7));if(void 0===e.type)throw new Error(Me(8));if(s)throw new Error(Me(9));try{s=!0,a=i(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Me(10));i=e,y({type:$e.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Me(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Fe]=function(){return this},e}return y({type:$e.INIT}),(o={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Fe]=p,o}function je(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var i=t[o];"function"==typeof e[i]&&(n[i]=e[i])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:$e.INIT}))throw new Error(Me(12));if(void 0===n(void 0,{type:$e.PROBE_UNKNOWN_ACTION()}))throw new Error(Me(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var o=!1,i={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Me(14));i[s]=d,o=o||d!==u}return(o=o||r.length!==Object.keys(e).length)?i:e}}function We(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function 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),o=function(){throw new Error(Me(15))},i={getState:n.getState,dispatch:function(){return o.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return o=We.apply(void 0,a)(n.dispatch),Ne(Ne({},n),{},{dispatch:o})}}}function Ke(e){return function(t){var n=t.dispatch,o=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,o,e):t(i)}}}}var ze=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,o=t.length,i=e.length;n<o;n++,i++)e[i]=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 o=0,i=Xe(t);o<i.length;o++)n=i[o],et.call(t,n)&&tt(e,n,t[n]);return e},ot="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 it=function(e){function t(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return Je(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,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)?De(e,(function(){})):e}function rt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,o=(e.immutableCheck,e.serializableCheck,new it);return n&&(function(e){return"boolean"==typeof e}(n)?o.push(He):o.push(He.withExtraArgument(n.extraArgument))),o}function lt(e){var t,n=function(e){return rt(e)},o=e||{},i=o.reducer,a=void 0===i?void 0:i,r=o.middleware,l=void 0===r?n():r,s=o.devTools,c=void 0===s||s,u=o.preloadedState,d=void 0===u?void 0:u,y=o.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=je(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Be.apply(void 0,p),S=We;c&&(S=ot(nt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=Ye([g],f):"function"==typeof f&&(v=f(v)),Ve(t,d,S.apply(void 0,v))}function st(e,t){function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return nt(nt({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ct(e){var t,n={},o=[],i={addCase:function(e,t){var o="string"==typeof e?e:e.type;if(o in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[o]=t,i},addMatcher:function(e,t){return o.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,o,t]}function ut(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,o="function"==typeof e.initialState?e.initialState:at(e.initialState),i=e.reducers||{},a=Object.keys(i),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?ct(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=nt(nt({},i),l);return function(e,t,n,o){void 0===n&&(n=[]);var i,a="function"==typeof t?ct(t):[t,n,o],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))i=function(){return at(e())};else{var c=at(e);i=function(){return c}}function u(e,t){void 0===e&&(e=i());var n=Ye([r[t.type]],l.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[s]),n.reduce((function(e,n){if(n){var o;if(M(e))return void 0===(o=n(e,t))?e:o;if(F(e))return De(e,(function(e){return n(e,t)}));if(void 0===(o=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return o}return e}),e)}return u.getInitialState=i,u}(o,u,r,c)}return a.forEach((function(e){var n,o,a=i[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,o=a.prepare):n=a,r[e]=n,l[c]=n,s[e]=o?st(c,o):st(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:s,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var dt="listenerMiddleware";st(dt+"/add"),st(dt+"/removeAll"),st(dt+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ke];return Le.get(t,e)},set:function(t){var n=this[ke];Le.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][ke];if(!i.P)switch(i.i){case 5:o(i)&&ce(i);break;case 4:n(i)&&ce(i)}}}function n(e){for(var t=e.t,n=e.k,o=Pe(n),i=o.length-1;i>=0;i--){var a=o[i];if(a!==ke){var r=t[a];if(void 0===r&&!x(t,a))return!0;var l=n[a],s=l&&l[ke];if(s?s.t!==r:!j(l,r))return!0}}var c=!!t[ke];return o.length!==Pe(t).length+(c?0:1)}function o(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var o=0;o<t.length;o++)if(!t.hasOwnProperty(o))return!0;return!1}var i={};!function(e,t){Ie[e]||(Ie[e]=t)}("ES5",{J:function(t,n){var o=Array.isArray(t),i=function(t,n){if(t){for(var o=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(o,""+i,e(i,!0));return o}var a=Ee(n);delete a[ke];for(var r=Pe(a),l=0;l<r.length;l++){var s=r[l];a[s]=e(s,t||!!a[s].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(o,t),a={i:o?5:4,A:n?n.A:Q(),P:!1,I:!1,D:{},l:n,t:t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,ke,{value:a,writable:!0}),i},S:function(e,n,i){i?M(n)&&n[ke].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ke];if(n){var i=n.t,a=n.k,r=n.D,l=n.i;if(4===l)G(a,(function(t){t!==ke&&(void 0!==i[t]||x(i,t)?r[t]||e(a[t]):(r[t]=!0,ce(n)))})),G(i,(function(e){void 0!==a[e]||x(a,e)||(r[e]=!1,ce(n))}));else if(5===l){if(o(n)&&(ce(n),r.length=!0),a.length<i.length)for(var s=a.length;s<i.length;s++)r[s]=!1;else for(var c=i.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,i.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):o(e)}})}();const yt=(e,t)=>n=>U({},n,{[e]:t[e]}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),pt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:o})=>{var i;return U({},n,{[e]:U({},n[e],{[t]:U({},null==n||null==(i=n[e])?void 0:i[t],o)})})}}),gt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o,i;return U({},t,{[e]:U({},t[e],{loaders:U({},null==(o=t[e])?void 0:o.loaders,{[n.key]:null==(i=n.value)||i})})})}}),St=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var o;return U({},t,{[e]:U({},t[e],{errors:U({},t[e].errors,{[n.key]:null==(o=n.value)||o})})})}}),vt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(o,{payload:i})=>{var a;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(a=o[e])?void 0:a[t],i,n)})})}}),ht=(e,t,n)=>o=>{var i;return U({},o,{[e]:U({},o[e],{[t]:U({},null==o||null==(i=o[e])?void 0:i[t],n)})})},mt=(e=500)=>new Promise((t=>setTimeout(t,e))),At="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bt=new Uint8Array(256);for(let e=0;e<At.length;e++)bt[At.charCodeAt(e)]=e;const kt=e=>{const t=.75*e.length,n=e.length;let o,i,a,r,l,s=0;const c=new Uint8Array(t);for(o=0;o<n;o+=4)i=bt[e.charCodeAt(o)],a=bt[e.charCodeAt(o+1)],r=bt[e.charCodeAt(o+2)],l=bt[e.charCodeAt(o+3)],c[s++]=i<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},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 o,i="";for(o=0;o<n;o+=3)i+=At[t[o]>>2],i+=At[(3&t[o])<<4|t[o+1]>>4],i+=At[(15&t[o+1])<<2|t[o+2]>>6],i+=At[63&t[o+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Tt(e[n]);return t}return e};let Pt,Et,It;!function(e){e.preLogin="preLogin",e.magicLinkPreLoginSuccess="magicLinkPreLoginSuccess",e.loginWithSmsOtc="loginWithSmsOtc",e.loginWithQuickSmsOtc="loginWithQuickSmsOtc",e.loginWithOtc="loginWithOtc",e.loginWithPassword="loginWithPassword",e.loginWithTwoFactor="loginWithTwoFactor",e.redirectToSSO="redirectToSSO",e.loginWithSSOFailed="loginWithSSOFailed",e.success="success",e.forceTwoFactor="forceTwoFactor",e.recoverTwoFactor="recoverTwoFactor",e.promptPasskeys="promptPasskeys"}(Pt||(Pt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Et||(Et={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(It||(It={}));const Lt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ot="HOSTED_LOGIN_VERIFIER_KEY",wt="auth",Ut="connectivity",Ct="auditLogs",Dt="vendor",_t={flow:Et.Login,step:Pt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:ft("loginState"),resetLoginState:yt("loginState",{loginState:_t})},Nt={requestAuthorize:st("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:st("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:st("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:st("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:st("auth/afterAuthNavigation"),preLogin:st("auth/preLogin",(e=>({payload:e}))),postLogin:st("auth/postLogin",(e=>({payload:e}))),login:st("auth/login",(e=>({payload:e}))),loginWithMfa:st("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:st("auth/recoverMfa",(e=>({payload:e}))),logout:st("auth/logout",(e=>({payload:e}))),silentLogout:st("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:st("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:st("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:st("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:st("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:st("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:st("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:st("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:st("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:st("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:st("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:st("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:st("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:st("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:st("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:st("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:st("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:st("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:st("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:st("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:st("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:st("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Mt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Mt||(Mt={}));const Ft={step:Mt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Gt={setActivateState:ft("activateState"),resetActivateState:yt("activateState",{activateState:Ft}),setActivateStrategyState:pt("activateState","activationStrategy")},$t={activateAccount:st("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:st("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:st("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:st("auth/resendActivationEmail",(e=>({payload:e})))};let 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:st("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:st("auth/forgotPassword",(e=>({payload:e}))),resetPassword:st("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:st("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:st("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:st("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:st("auth/changePhoneNumber",(e=>({payload:e})))},Xt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Zt={setSSOLoader:gt("ssoState"),setSSOError:St("ssoState"),setSSOState:ft("ssoState"),resetSSOState:yt("ssoState",{ssoState:Xt})},en={loadSSOConfigurationsV2:st("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:st("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:st("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:st("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:st("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:st("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:st("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:st("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:st("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:st("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:st("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:st("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:st("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:st("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:st("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:st("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:st("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:st("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:st("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:st("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:st("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:st("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:st("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:st("auth/oidcPostlogin",(e=>({payload:e})))},tn={loading:!1,error:null},nn={setProfileState:ft("profileState"),resetProfileState:yt("profileState",{profileState:tn})},on={loadProfile:st("auth/loadProfile"),saveProfile:st("auth/saveProfile",(e=>({payload:e}))),changePassword:st("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},ln={setMfaState:ft("mfaState"),resetMfaState:yt("mfaState",{mfaState:rn})},sn={enrollMfa:st("auth/enrollMfa"),getMFADevices:st("auth/getMFADevices"),getMFAStrategies:st("auth/getMFAStrategies"),verifyMfa:st("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:st("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:st("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:st("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:st("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:st("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:st("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:st("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:st("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:st("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:st("auth/disableMfaWebAuthn",(e=>({payload:e})))},cn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},un={setTeamLoader:gt("teamState"),setTeamError:St("teamState"),setTeamState:ft("teamState"),resetTeamState:yt("teamState",{teamState:cn})},dn={loadUsers:st("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:st("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:st("auth/loadRoles",(e=>({payload:e}))),addUser:st("auth/addUser",(e=>({payload:e}))),addUsersBulk:st("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:st("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:st("auth/updateUser",(e=>({payload:e}))),deleteUser:st("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:st("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:st("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:st("auth/lockUser",(e=>({payload:e}))),resendActivationLink:st("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:st("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:st("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:st("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:st("auth/getInvitationLink"),createInvitationLink:st("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:st("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:st("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:st("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:st("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:st("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:st("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:st("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:st("auth/closeLockUserDialog",(e=>({payload:e})))},yn={firstLoad:!0,loading:!1,error:""},fn={setSocialLoginsState:ft("socialLoginState"),resetSocialLoginsState:yt("socialLoginState",{socialLoginState:yn})},pn={loadSocialLoginsConfiguration:st("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:st("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:st("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:st("auth/setSocialLoginError",(e=>({payload:e})))};let gn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(gn||(gn={}));const Sn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:gn.SignUp},vn={setSignUpState:ft("signUpState"),resetSignUpState:yt("signUpState",{signUpState:Sn})},hn={signUpUser:st("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:st("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:{}},An={setApiTokensLoader:gt("apiTokensState"),setApiTokensError:St("apiTokensState"),setApiTokensState:ft("apiTokensState"),resetApiTokensState:yt("apiTokensState",{apiTokensState:mn})},bn={loadApiTokens:st("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:st("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:st("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:st("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:st("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:st("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:st("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:st("auth/deleteTenantApiToken",(e=>({payload:e})))},kn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},Tn={setSecurityPolicyState:ft("securityPolicyState"),setSecurityPolicyGlobalState:pt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:pt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:pt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:pt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:pt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:pt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:pt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:pt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:pt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:pt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:pt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:yt("securityPolicyState",{securityPolicyState:kn})},Pn={loadSecurityPolicy:st("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:st("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:st("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:st("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:st("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:st("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:st("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:st("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:st("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:st("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:st("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:st("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:st("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:st("auth/loadPublicAuthStrategiesPolicy")},En={loading:!1},In={setAccountSettingsState:ft("accountSettingsState"),resetAccountSettingsState:yt("accountSettingsState",{accountSettingsState:En})},Ln={loadAccountSettings:st("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:st("auth/saveAccountSettings",(e=>({payload:e})))},On={tenants:[],subTenants:[],loading:!0,tenantTree:null},wn={setTenantsState:ft("tenantsState"),resetTenantsState:yt("tenantsState",{tenantsState:On})},Un={switchTenant:st("auth/switchTenant",(e=>({payload:e}))),loadTenants:st("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:st("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:st("auth/loadSubTenantsTree",(e=>({payload:e})))},Cn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:ft("rolesState"),resetRolesState:yt("rolesState",{rolesState:Cn})},_n={loadRolesAndPermissions:st("auth/loadRoles",(e=>({payload:e}))),addRole:st("auth/addRole",(e=>({payload:e}))),updateRole:st("auth/updateRole",(e=>({payload:e}))),deleteRole:st("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:st("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:st("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Nn={setSessionsState:ft("sessionsState"),resetSessionsState:yt("sessionsState",{sessionsState:Rn})},Mn={loadUserSessions:st("auth/loadUserSessions"),loadCurrentUserSession:st("auth/loadCurrentUserSession"),deleteUserSession:st("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:st("auth/deleteAllUserSessions"),revokeUserSessions:st("auth/revokeUserSessions",(e=>({payload:e})))},Fn={loading:!1,configurations:{}},Gn={setSessionsPolicyState:ft("sessionsPolicyState"),resetSessionsPolicyState:yt("sessionsPolicyState",{sessionsPolicyState:Fn})},$n={loadSessionsPolicy:st("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:st("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let xn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(xn||(xn={}));const Vn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:xn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},jn={setRestrictionsState:ft("restrictionsState"),setIpRestrictionsState:pt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:pt("restrictionsState","emailDomainRestrictions")},Wn={checkIfUserIpValid:st("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:st("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:st("auth/loadIpRestrictions"),saveIpRestriction:st("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:st("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:st("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:st("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:st("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:st("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:st("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Bn={loading:!1},Kn={setProvisioningState:ft("provisioningState"),resetProvisioningState:yt("provisioningState",{provisioningState:Bn})},zn={loadProvisionConnections:st("auth/loadProvisionConnections"),createProvisionConnection:st("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:st("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:st("auth/updateProvisionConnection",(e=>({payload:e})))},qn={devices:[],loading:!1,error:null},Hn={setPasskeysState:ft("passkeysState"),resetPasskeysState:yt("passkeysState",{passkeysState:qn})},Jn={loadWebAuthnDevices:st("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:st("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Yn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Qn={setUsersGroupsLoader:gt("groupsState"),setUsersGroupsError:St("groupsState"),setGroupsState:ft("groupsState"),resetUsersGroupsState:yt("groupsState",{groupsState:Yn})},Xn={loadGroups:st("auth/loadUsersGroups"),getGroupById:st("auth/getGroupById",(e=>({payload:e}))),createGroup:st("auth/createGroup",(e=>({payload:e}))),updateGroup:st("auth/updateGroup",(e=>({payload:e}))),deleteGroup:st("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:st("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:st("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:st("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:st("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:st("auth/getGroupConfiguration"),updateGroupConfiguration:st("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:st("auth/getUsers",(e=>({payload:e})))},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}},eo={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})},to={loading:!0,error:null},no={setCustomLoginState:ft("customLoginState"),resetCustomLoginState:yt("customLoginState",{customLoginState:to})},oo={loadTenantMetadata:st("auth/loadTenantMetadata"),updateTenantMetadata:st("auth/updateTenantMetadata",(e=>({payload:e})))},io={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],topAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""}},selectedAccount:{tenantId:"",children:[],userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_limit:50,_offset:0}},accountSettings:{},teamUsers:[]},ao={setAllAccountsLoader:gt("allAccountsState"),setAllAccountsError:St("allAccountsState"),setAllAccountsState:ft("allAccountsState"),resetAllAccountsState:yt("allAccountsState",{allAccountsState:io})},ro={loadAccounts:st("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:st("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:st("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:st("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:st("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:st("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:st("auth/updateSubAccountSettings",(e=>({payload:e}))),getAccountSettings:st("auth/getAccountSettings",(e=>({payload:e}))),addUsersToAccount:st("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:st("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:st("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:st("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForTopAccount:st("auth/getUserJwtForTopAccount",(e=>({payload:e}))),getUserJwtForSubAccount:st("auth/getUserJwtForSubAccount",(e=>({payload:e}))),getParentAccounts:st("auth/getParentAccounts",(e=>({payload:e})))},lo={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:""},deleteSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,jwt:""},deleteUserFromAccountDialog:{loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:""}},so={setAllAccountDialogsState:ft("allAccountsDialogsState"),resetAllAccountDialogsState:yt("allAccountsDialogsState",{allAccountsDialogsState:lo}),openCreateSubAccountDialog:vt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:ht("allAccountsDialogsState","createSubAccountDialog",lo.createSubAccountDialog),openUpdateSubAccountDialog:vt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:ht("allAccountsDialogsState","updateSubAccountDialog",lo.updateSubAccountDialog),openDeleteSubAccountDialog:vt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:ht("allAccountsDialogsState","deleteSubAccountDialog",lo.deleteSubAccountDialog),openAddUsersToAccountDialog:vt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:ht("allAccountsDialogsState","addUsersToAccountDialog",lo.addUsersToAccountDialog),openDeleteUserFromAccountDialog:vt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:ht("allAccountsDialogsState","deleteUserFromAccountDialog",lo.deleteUserFromAccountDialog),openEditUserRolesDialog:vt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:ht("allAccountsDialogsState","editUserRolesDialog",lo.editUserRolesDialog)},co={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Sn,loginState:_t,activateState:Ft,acceptInvitationState:Vt,forgotPasswordState:Kt,ssoState:Xt,profileState:tn,customLoginState:to,mfaState:rn,teamState:cn,groupsState:Yn,groupsDialogsState:Zn,socialLoginState:yn,apiTokensState:mn,securityPolicyState:kn,accountSettingsState:En,tenantsState:On,rolesState:Cn,resetPhoneNumberState:Jt,sessionsState:Rn,sessionsPolicyState:Fn,restrictionsState:Vn,provisioningState:Bn,passkeysState:qn,allAccountsState:io,allAccountsDialogsState:lo},uo=U({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},co);let yo;!function(e){e.impersonating="impersonating",e.success="success"}(yo||(yo={}));const fo={step:yo.impersonating,loading:!1},po={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:fo})},go={impersonate:st("impersonation/impersonate",(e=>({payload:e})))},{reducer:So,actions:vo}=ut({name:wt,initialState:uo,reducers:U({resetState:e=>U({},e,co),setState:(e,{payload:t})=>U({},e,t),setUser:("user",(e,{payload:t})=>U({},e,{user:t}))},Rt,fn,Gt,po,jt,zt,Yt,vn,nn,no,Zt,ln,un,Qn,eo,An,Tn,In,wn,Dn,Nn,Gn,jn,Kn,Hn,ao,so)});const ho=U({},vo,Nt,pn,$t,Wt,qt,Qt,hn,on,oo,en,sn,dn,Xn,{},bn,Pn,Ln,Un,_n,Mn,$n,Wn,zn,go,Jn,ro);var mo=function(e){return"@@redux-saga/"+e},Ao=mo("CANCEL_PROMISE"),bo=mo("CHANNEL_END"),ko=mo("IO"),To=mo("MATCH"),Po=mo("MULTICAST"),Eo=mo("SAGA_ACTION"),Io=mo("SELF_CANCELLATION"),Lo=mo("TASK"),Oo=mo("TASK_CANCEL"),wo=mo("TERMINATE"),Uo=mo("LOCATION");function Co(e,t){if(null==e)return{};var n,o,i={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}var Do=function(e){return null==e},_o=function(e){return null!=e},Ro=function(e){return"function"==typeof e},No=function(e){return"string"==typeof e},Mo=Array.isArray,Fo=function(e){return e&&Ro(e.then)},Go=function(e){return e&&Ro(e.next)&&Ro(e.throw)},$o=function e(t){return t&&(No(t)||jo(t)||Ro(t)||Mo(t)&&t.every(e))},xo=function(e){return e&&Ro(e.take)&&Ro(e.close)},Vo=function(e){return Ro(e)&&e.hasOwnProperty("toString")},jo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Wo=function(e,t){var n;void 0===t&&(t=!0);var o=new Promise((function(o){n=setTimeout(o,Math.min(2147483647,e),t)}));return o[Ao]=function(){clearTimeout(n)},o},Bo=function(e){return function(){return e}},Ko=Bo(!0),zo=function(){},qo=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Ho=function(e,t){U(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Jo(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Yo=function(e){throw e},Qo=function(e){return{value:e,done:!0}};function Xo(e,t,n){void 0===t&&(t=Yo),void 0===n&&(n="iterator");var o={meta:{name:n},next:e,throw:t,return:Qo,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(o[Symbol.iterator]=function(){return o}),o}function Zo(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var ei=function(e){return Array.apply(null,new Array(e))},ti=function(e){return function(t){return e(Object.defineProperty(t,Eo,{value:!0}))}},ni=function(e){return e===wo},oi=function(e){return e===Oo},ii=function(e){return ni(e)||oi(e)};function ai(e,t){var n,o=Object.keys(e),i=o.length,a=0,r=Mo(e)?ei(i):{},l={};return o.forEach((function(e){var o=function(o,l){n||(l||ii(o)?(t.cancel(),t(o,l)):(r[e]=o,++a===i&&(n=!0,t(r))))};o.cancel=zo,l[e]=o})),t.cancel=function(){n||(n=!0,o.forEach((function(e){return l[e].cancel()})))},l}function ri(e){return{name:e.name||"anonymous",location:li(e)}}function li(e){return e[Uo]}var si=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),o=0,i=0,a=0,r=function(t){n[i]=t,i=(i+1)%e,o++},l=function(){if(0!=o){var t=n[a];return n[a]=null,o--,a=(a+1)%e,t}},s=function(){for(var e=[];o;)e.push(l());return e};return{isEmpty:function(){return 0==o},put:function(l){var c;if(o<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=l,a=i=(i+1)%e;break;case 4:c=2*e,n=s(),o=n.length,i=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},ci="TAKE",ui="CALL",di="FORK",yi="SELECT",fi=function(e,t){var n;return(n={})[ko]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function pi(e,t){return void 0===e&&(e="*"),$o(e)?(_o(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),fi(ci,{pattern:e})):xo(n=e)&&n[Po]&&_o(t)&&$o(t)?fi(ci,{channel:e,pattern:t}):xo(e)?(_o(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),fi(ci,{channel:e})):void 0;var n}function gi(e,t){return Do(t)&&(t=e,e=void 0),fi("PUT",{channel:e,action:t})}function Si(e){var t=fi("ALL",e);return t.combinator=!0,t}function vi(e,t){var n,o=null;return Ro(e)?n=e:(Mo(e)?(o=e[0],n=e[1]):(o=e.context,n=e.fn),o&&No(n)&&Ro(o[n])&&(n=o[n])),{context:o,fn:n,args:t}}function hi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return fi(ui,vi(e,n))}function mi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return fi(di,vi(e,n))}function Ai(e){return void 0===e&&(e=Io),fi("CANCEL",e)}function bi(e){void 0===e&&(e=qo);for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return fi(yi,{selector:e,args:n})}var ki=hi.bind(null,Wo);var Ti=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Pi=[],Ei=0;function Ii(e){try{wi(),e()}finally{Ui()}}function Li(e){Pi.push(e),Ei||(wi(),Ci())}function Oi(e){try{return wi(),e()}finally{Ci()}}function wi(){Ei++}function Ui(){Ei--}function Ci(){var e;for(Ui();!Ei&&void 0!==(e=Pi.shift());)Ii(e)}var Di=function(e){return function(t){return e.some((function(e){return Fi(e)(t)}))}},_i=function(e){return function(t){return e(t)}},Ri=function(e){return function(t){return t.type===String(e)}},Ni=function(e){return function(t){return t.type===e}},Mi=function(){return Ko};function Fi(e){var t="*"===e?Mi:No(e)?Ri:Mo(e)?Di:Vo(e)?Ri:Ro(e)?_i:jo(e)?Ni:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Gi={type:bo},$i=function(e){return e&&e.type===bo};function xi(){var e,t,n,o,i,a,r=(t=!1,o=n=[],i=function(){o===n&&(o=n.slice())},a=function(){t=!0;var e=n=o;o=[],e.forEach((function(e){e(Gi)}))},(e={})[Po]=!0,e.put=function(e){if(!t)if($i(e))a();else for(var i=n=o,r=0,l=i.length;r<l;r++){var s=i[r];s[To](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Mi),t?e(Gi):(e[To]=n,i(),o.push(e),e.cancel=(a=!1,function(){a||(a=!0,i(),Jo(o,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[Eo]?l(e):Li((function(){l(e)}))},r}function Vi(e,t){var n=e[Ao];Ro(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var ji,Wi=0,Bi=function(){return++Wi};function Ki(e){e.isRunning()&&e.cancel()}var zi=((ji={}).TAKE=function(e,t,n){var o=t.channel,i=void 0===o?e.channel:o,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!$i(e)||r?n(e):n(wo)};try{i.take(l,_o(a)?Fi(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},ji.PUT=function(e,t,n){var o=t.channel,i=t.action,a=t.resolve;Li((function(){var t;try{t=(o?o.put:e.dispatch)(i)}catch(e){return void n(e,!0)}a&&Fo(t)?Vi(t,n):n(t)}))},ji.ALL=function(e,t,n,o){var i=o.digestEffect,a=Wi,r=Object.keys(t);if(0!==r.length){var l=ai(t,n);r.forEach((function(e){i(t[e],a,l[e],e)}))}else n(Mo(t)?[]:{})},ji.RACE=function(e,t,n,o){var i=o.digestEffect,a=Wi,r=Object.keys(t),l=Mo(t)?ei(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,o){c||(o||ii(t)?(n.cancel(),n(t,o)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=zo,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||i(t[e],a,s[e],e)}))},ji.CALL=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=o.task;try{var s=a.apply(i,r);if(Fo(s))return void Vi(s,n);if(Go(s))return void na(e,s,l.context,Wi,ri(a),!1,n);n(s)}catch(e){n(e,!0)}},ji.CPS=function(e,t,n){var o=t.context,i=t.fn,a=t.args;try{var r=function(e,t){Do(e)?n(t):n(e,!0)};i.apply(o,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},ji.FORK=function(e,t,n,o){var i=t.context,a=t.fn,r=t.args,l=t.detached,s=o.task,c=function(e){var t=e.context,n=e.fn,o=e.args;try{var i=n.apply(t,o);if(Go(i))return i;var a=!1;return Xo((function(e){return a?{value:e,done:!0}:(a=!0,{value:i,done:!Fo(i)})}))}catch(e){return Xo((function(){throw e}))}}({context:i,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:ri(t)}(c,a);Oi((function(){var t=na(e,c,s.context,Wi,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},ji.JOIN=function(e,t,n,o){var i=o.task,a=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Jo(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Mo(t)){if(0===t.length)return void n([]);var r=ai(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},ji.CANCEL=function(e,t,n,o){var i=o.task;t===Io?Ki(i):Mo(t)?t.forEach(Ki):Ki(t),n()},ji.SELECT=function(e,t,n){var o=t.selector,i=t.args;try{n(o.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},ji.ACTION_CHANNEL=function(e,t,n){var o=t.pattern,i=function(e){void 0===e&&(e=si());var t=!1,n=[];return{take:function(o){t&&e.isEmpty()?o(Gi):e.isEmpty()?(n.push(o),o.cancel=function(){Jo(n,o)}):o(e.take())},put:function(o){if(!t){if(0===n.length)return e.put(o);n.shift()(o)}},flush:function(n){t&&e.isEmpty()?n(Gi):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var o=0,i=e.length;o<i;o++)(0,e[o])(Gi)}}}}(t.buffer),a=Fi(o),r=function t(n){$i(n)||e.channel.take(t,a),i.put(n)},l=i.close;i.close=function(){r.cancel(),l()},e.channel.take(r,a),n(i)},ji.CANCELLED=function(e,t,n,o){n(o.task.isCancelled())},ji.FLUSH=function(e,t,n){t.flush(n)},ji.GET_CONTEXT=function(e,t,n,o){n(o.task.context[t])},ji.SET_CONTEXT=function(e,t,n,o){var i=o.task;Ho(i.context,t),n()},ji);function qi(e,t){return e+"?"+t}function Hi(e){var t=e.name,n=e.location;return n?t+" "+qi(n.fileName,n.lineNumber):t}function Ji(e){var t,n,o,i=(t=function(e){return e.cancelledTasks},n=e,(o=[]).concat.apply(o,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var Yi=null,Qi=[],Xi=function(e){e.crashedEffect=Yi,Qi.push(e)},Zi=function(){Yi=null,Qi.length=0},ea=function(){var e,t,n=Qi[0],o=Qi.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=li(e))?t.code+" "+qi(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Hi(n.meta)+(i?" \n when executing effect "+i:"")].concat(o.map((function(e){return" created by "+Hi(e.meta)})),[Ji(Qi)]).join("\n")};function ta(e,t,n,o,i,a,r){var l;void 0===r&&(r=zo);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var o,i=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){i.push(t),t.cont=function(l,s){a||(Jo(i,t),t.cont=zo,s?r(l):(t===e&&(o=l),i.length||(a=!0,n(o))))}}function s(){a||(a=!0,i.forEach((function(e){e.cont=zo,e.cancel()})),i=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(u=2,Xi({meta:i,cancelledTasks:y}),S.isRoot){var o=ea();Zi(),e.onError(t,{sagaStack:o})}c=t,d&&d.reject(t)}else t===Oo?u=1:1!==u&&(u=3),s=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((l={})[Lo]=!0,l.id=o,l.meta=i,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Oo,!1))},l.cont=r,l.end=g,l.setContext=function(e){Ho(f,e)},l.toPromise=function(){return d||(d=Ti(),2===u?d.reject(c):0!==u&&d.resolve(s)),d.promise},l.isRunning=function(){return 0===u},l.isCancelled=function(){return 1===u||0===u&&1===t.status},l.isAborted=function(){return 2===u},l.result=function(){return s},l.error=function(){return c},l);return S}function na(e,t,n,o,i,a,r){var l=e.finalizeRunEffect((function(t,n,o){Fo(t)?Vi(t,o):Go(t)?na(e,t,c.context,n,i,!1,o):t&&t[ko]?(0,zi[t.type])(e,t.payload,o,u):o(t)}));d.cancel=zo;var s={meta:i,cancel:function(){0===s.status&&(s.status=1,d(Oo))},status:0},c=ta(e,s,n,o,i,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var i;n?(i=t.throw(e),Zi()):oi(e)?(s.status=1,d.cancel(),i=Ro(t.return)?t.return(Oo):{done:!0,value:Oo}):i=ni(e)?Ro(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==s.status&&(s.status=3),s.cont(i.value)):y(i.value,o,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,o,i){void 0===i&&(i="");var a,r=Bi();function s(n,i){a||(a=!0,o.cancel=zo,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){Yi=e}(t),o(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),s.cancel=zo,o.cancel=function(){a||(a=!0,s.cancel(),s.cancel=zo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function oa(e,t){for(var n=e.channel,o=void 0===n?xi():n,i=e.dispatch,a=e.getState,r=e.context,l=void 0===r?{}:r,s=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?Zo:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=Bi();if(s&&(s.rootSagaStarted=s.rootSagaStarted||zo,s.effectTriggered=s.effectTriggered||zo,s.effectResolved=s.effectResolved||zo,s.effectRejected=s.effectRejected||zo,s.effectCancelled=s.effectCancelled||zo,s.actionDispatched=s.actionDispatched||zo,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);g=function(e){return function(t,n,o){return h((function(t){return e(t,n,o)}))(t)}}}else g=qo;var m={channel:o,dispatch:ti(i),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return Oi((function(){var e=na(m,S,l,v,ri(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var ia=function(e){var t,n=void 0===e?{}:e,o=n.context,i=void 0===o?{}:o,a=n.channel,r=void 0===a?xi():a,l=n.sagaMonitor,s=Co(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,o=e.dispatch;return t=oa.bind(null,U({},s,{context:i,channel:r,dispatch:o,getState:n,sagaMonitor:l})),function(e){return function(t){l&&l.actionDispatched&&l.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Ho(i,e)},c},aa=function(e){return{done:!0,value:e}},ra={};function la(e){return xo(e)?"channel":Vo(e)?String(e):Ro(e)?e.name:String(e)}function sa(e,t,n){var o,i,a,r=t;function l(t,n){if(r===ra)return aa(t);if(n&&!i)throw r=ra,n;o&&o(t);var l=n?e[i](n):e[r]();return r=l.nextState,a=l.effect,o=l.stateUpdater,i=l.errorState,r===ra?aa(t):a}return Xo(l,(function(e){return l(null,e)}),n)}function ca(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:pi(e)},l=function(e){return{done:!1,value:mi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return sa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+la(e)+", "+t.name+")")}function ua(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r,l={done:!1,value:pi(e)},s=function(e){return{done:!1,value:mi.apply(void 0,[t].concat(o,[e]))}},c=function(e){return{done:!1,value:Ai(e)}},u=function(e){return a=e},d=function(e){return r=e};return sa({q1:function(){return{nextState:"q2",effect:l,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:s(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:s(r),stateUpdater:u}}},"q1","takeLatest("+la(e)+", "+t.name+")")}function da(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];var a,r={done:!1,value:pi(e)},l=function(e){return{done:!1,value:hi.apply(void 0,[t].concat(o,[e]))}},s=function(e){return a=e};return sa({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+la(e)+", "+t.name+")")}function ya(e,t,n){for(var o=e,i=arguments.length,a=new Array(i>3?i-3:0),r=3;r<i;r++)a[r-3]=arguments[r];var l={done:!1,value:hi.apply(void 0,[n].concat(a))},s={done:!1,value:ki(t)};return sa({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:ra}},q10:function(e){if((o-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function fa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return mi.apply(void 0,[ca,e,t].concat(o))}function pa(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return mi.apply(void 0,[ua,e,t].concat(o))}function ga(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];return mi.apply(void 0,[da,e,t].concat(o))}class Sa{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 Sa.instance||(Sa.instance=new Sa),Sa.instance}static setContext(e){Sa.getInstance().context=e}static setAccessToken(e){Sa.getInstance().accessToken=e}static setUser(e){Sa.getInstance().user=e}static setRequestSource(e){Sa.getInstance().requestSource=e}static setOnRedirectTo(e){Sa.getInstance().onRedirectTo=e}static setLogout(e,t){Sa.getInstance().logout=n=>{n?e(n):Sa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Sa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Sa.getInstance().accessToken}static getRequestSource(){return Sa.getInstance().requestSource}static getUser(){return Sa.getInstance().user}static onRedirectTo(e,t){return Sa.getInstance().onRedirectTo(e,t)}static logout(e){return Sa.getInstance().logout(e)}}Sa.instance=void 0;const va={getContext:()=>Sa.getContext(),getAccessToken:()=>Sa.getAccessToken(),getUser:()=>Sa.getUser(),onRedirectTo:(e,t)=>Sa.onRedirectTo(e,t),logout:e=>Sa.logout(e)},ha={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ma,Aa,ba;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ma||(ma={})),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"}(Aa||(Aa={})),function(e){e.ASC="ASC",e.DESC="DESC"}(ba||(ba={}));class ka extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ta={v1:"/identity/resources/users/webauthn/v1/devices"},Pa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ea={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},Ia={v1:"/identity/resources/configurations/v1"},La={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Oa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},wa={v1:"/identity/resources/permissions/v1"},Ua={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},Ca={v1:"/identity/resources/roles/v1"},Da={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},_a={v1:"/identity/resources/impersonation/v1"},Ra={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Na={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Ma={v1:"/team/resources/members/v1"},Fa={v1:"/team/resources/roles/v1"},Ga={v1:"/team/resources/stats/v1"},$a={v1:"/team/resources/profile"},xa={v1:"/tenants/resources/account-settings/v1"},Va={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2"},ja={v1:"/tenants/resources/sub-tenants/v1"},Wa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ba={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},Ka={v1:"/subscriptions/resources/payment-providers/v1"},za={v1:"/subscriptions/resources/subscriptions/v1"},qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ha={v1:"/reports/engine/resources/triggers/v1"},Ja="/notification",Ya="/audits",Qa={v1:"/event/resources/configurations/v1"},Xa="/webhook",Za="/oauth",er="/flags",tr="/directory/resources/v1/configurations/scim2",nr="/directory/resources/scim/temp",or="/entitlements/check/v1";function ir(e,t,n=!0){let o;o="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",a="frontegg"===i&&!n;return o.endsWith("/")||(o+="/"),o.endsWith(i)||a||(o+=i),o}function ar(e){var t,n;const o={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(o[ha.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(o[ha.frameWork]=e.metadataHeaders.framework),o}const rr=async e=>{var t,n,o;const i=Sa.getContext(),a=await async function(e,t){var n;const o=ar(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Sa.getAccessToken)(),a=Sa.getRequestSource();t&&(o[ha.contentType]=t),a&&(o[ha.source]=a),i&&(o.Authorization=`Bearer ${i}`);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o}(i,e.contentType),r=await async function(e,t,n){const o=ir(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const o=Object.keys(t);for(const e of o){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${o}${t}`;const r=Object.keys(i).length>0;return i&&r&&(a+=`?${new URLSearchParams(i)}`),a}(i,e.url,e.params),l=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:U({},a,e.headers),credentials:null!=(n=null!=(o=e.credentials)?o:i.requestCredentials)?n:"same-origin"});if(302===l.status)return window.location.href=await l.text(),new Promise((()=>{}));if(!l.ok){var s,c;if(413===l.status)throw new ka("Error request is too large",l.status);let e,t=!0;try{e=await l.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=i.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new ka(t?e:"We're facing some difficulties, Please try again",l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},lr=async(e,t,n)=>rr(U({url:e,method:"GET",contentType:"application/json",params:t},n)),sr=async(e,t,n)=>rr(U({url:e,method:"POST",contentType:"application/json",body:t},n)),cr=async(e,t,n)=>rr(U({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ur=async(e,t,n)=>rr(U({url:e,method:"PUT",contentType:"application/json",body:t},n)),dr=async(e,t,n)=>rr(U({url:e,method:"DELETE",contentType:"application/json",body:t},n)),yr=async(e,t,n,o)=>rr(U({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},o)),fr=(e={})=>U({},e.jwt?{Authorization:e.jwt}:{});async function pr(e){return ur(`${Ea.v1}/tenant`,e)}async function gr(){return lr(`${Ea.v2}/me/tenants`)}async function Sr(e){return lr(Va.v1,void 0,{headers:fr(e)})}async function vr(e){return lr(Va.tree.v1,void 0,{headers:fr(e)})}async function hr(e){return lr(Va.parents.v1,void 0,{headers:fr(e)})}async function mr(e,t){return sr(`${Ua.users.v1}/count`,e,{headers:fr(t)})}async function Ar(e,t){return lr(Va.v2,e,{headers:fr(t)})}async function br(){return lr(Ia.v1)}async function kr(){return lr(`${Ia.v1}/mfa-policy`)}async function Tr(){return lr(`${Ia.v1}/mfa-policy/vendor`)}async function Pr(e){return e.id?cr(`${Ia.v1}/mfa-policy`,e):sr(`${Ia.v1}/mfa-policy`,e)}async function Er(){return lr(`${Ia.v1}/lockout-policy`)}async function Ir(){return lr(`${Ia.v1}/lockout-policy/vendor`)}async function Lr(e){return e.id?cr(`${Ia.v1}/lockout-policy`,e):sr(`${Ia.v1}/lockout-policy`,e)}async function Or(){try{return await lr(`${Ia.v1}/captcha-policy/public`)}catch{return null}}async function wr(){return lr(`${Ia.v1}/password-history-policy`)}async function Ur(){return lr(`${Ia.v1}/password-history-policy/vendor`)}async function Cr(e){return e.id?cr(`${Ia.v1}/password-history-policy`,e):sr(`${Ia.v1}/password-history-policy`,e)}async function Dr(){return lr(`${Ia.v1}/password`)}async function _r(){return lr(`${La.emailDomain.v1}`)}async function Rr(){return lr(`${La.emailDomain.v1}/config`)}async function Nr(e){return sr(`${La.emailDomain.v1}`,e)}async function Mr(e){return sr(`${La.emailDomain.v1}/config`,e)}async function Fr(e){return dr(`${La.emailDomain.v1}/${e}`)}async function Gr(e){return lr(`${La.ip.v1}`,e)}async function $r(){return lr(`${La.ip.v1}/config`)}async function xr(e){return sr(`${La.ip.v1}`,e)}async function Vr(e){return sr(`${La.ip.v1}/bulk`,e)}async function jr(e){return sr(`${La.ip.v1}/config`,e)}async function Wr(e){return dr(`${La.ip.v1}/${e}`)}async function Br(){return sr(`${La.ip.v1}/verify`)}async function Kr(){return sr(`${La.ip.v1}/verify/allow`)}let zr,qr,Hr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(zr||(zr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(qr||(qr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Hr||(Hr={}));class Jr extends Error{constructor(e){super(e)}}const Yr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Jr("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,o,i=0,a=0;o=t.charAt(a++);~o&&(e=i%4?64*e+o:o,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};class Qr extends Error{constructor(e){super(e)}}const Xr=(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(Yr(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 Yr(t)}})(e.split(".")[n]))}catch(e){throw new Qr("Invalid token specified: "+e.message)}},Zr=["type"],el=["type"];async function tl(e){if(!e.accessToken)return e;Sa.setAccessToken(e.accessToken);const t=await lr(`${Ea.v2}/me`),n=U({},e,e.accessToken?Xr(e.accessToken):{},t);return Sa.setUser(n),n}async function nl(e){if(!e.accessToken)return{user:e};Sa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([lr(`${Ea.v2}/me`),gr()]),o=U({},e,e.accessToken?Xr(e.accessToken):{},t);return Sa.setUser(o),{user:o,tenants:n}}async function ol(e){Sa.setAccessToken(e.id_token);const t=await lr(`${Ea.v2}/me`),n=e.id_token?Xr(e.id_token):{},o=U({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Sa.setUser(o),o}async function il(e){try{const{address:t}=await sr(`${Pa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function al(e){return sr(`${Pa.v1}/user/saml/prelogin`,e)}async function rl(e){return tl(await sr(`${Pa.v1}/user/saml/postlogin`,e))}async function ll(e){return tl(await sr(`${Pa.v1}/user/oidc/postlogin`,e))}async function sl(e){return tl(await sr(`${Pa.v1}/user`,e))}async function cl(e){return tl(await sr(`${Pa.v1}/user/mfa/verify`,e))}async function ul(e){return sr(`${Ea.v1}/activate`,e)}async function dl(e){return lr(`${Ea.v1}/activate/strategy`,e)}async function yl(e){return sr(`${Ea.v1}/activate/reset`,e)}async function fl(e){return sr(`${Ea.v1}/invitation/reset`,e)}async function pl(e){return sr(`${Ea.v1}/invitation/accept`,e)}async function gl(){return tl(await sr(`${Pa.v1}/user/token/refresh`))}async function Sl(){return nl(await sr(`${Pa.v1}/user/token/refresh`))}async function vl(){return sr(`${Pa.v1}/logout`)}async function hl(e){return lr(`${Za}/logout`,e)}async function ml(e){return sr(`${Ea.v1}/passwords/reset`,e)}async function Al(e){return sr(`${Ea.v1}/passwords/reset/verify`,e)}async function bl(e){return lr(`${Ea.v1}/passwords/config`,e)}async function kl(e){return sr(`${Pa.v1}/user/mfa/recover`,e)}async function Tl(){return sr(`${Ea.v1}/mfa/enroll`)}async function Pl(){return sr(`${Ea.v1}/mfa/authenticator/enroll`)}async function El(e){return sr(`${Ea.v1}/mfa/authenticator/enroll/verify`,e)}async function Il(e){return sr(`${Ea.v1}/mfa/sms/enroll`,e)}async function Ll(e){return sr(`${Ea.v1}/mfa/sms/enroll/verify`,e)}async function Ol(){return sr(`${Ea.v1}/mfa/webauthn/enroll`)}async function wl(e){return sr(`${Ea.v1}/mfa/webauthn/enroll/verify`,e)}async function Ul(e){return sr(`${Ea.v1}/mfa/enroll/verify`,e)}async function Cl(e){return sr(`${Ea.v1}/mfa/disable`,e)}async function Dl(e,t){return sr(`${Ea.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function _l(e){return sr(`${Ea.v1}/mfa/sms/${e}/disable`)}async function Rl(e,t){return sr(`${Ea.v1}/mfa/sms/${e}/disable/verify`,t)}async function Nl(e){return sr(`${Ea.v1}/mfa/webauthn/${e}/disable`)}async function Ml(e,t){return sr(`${Ea.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Fl(){return lr(`${Ea.v1}/mfa/devices`)}async function Gl(e){return sr(`${Pa.v1}/user/mfa/authenticator/enroll`,e)}async function $l(e){return sr(`${Pa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function xl(e,t){return sr(`${Pa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Vl(e){return sr(`${Pa.v1}/user/mfa/sms/enroll`,e)}async function jl(e){return sr(`${Pa.v1}/user/mfa/sms/enroll/verify`,e)}async function Wl(e,t){return sr(`${Pa.v1}/user/mfa/sms/${e}`,t)}async function Bl(e,t){return sr(`${Pa.v1}/user/mfa/sms/${e}/verify`,t)}async function Kl(e){return sr(`${Pa.v1}/user/mfa/webauthn/enroll`,e)}async function zl(e){return sr(`${Pa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function ql(e,t){return sr(`${Pa.v1}/user/mfa/webauthn/${e}`,t)}async function Hl(e,t){return sr(`${Pa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Jl(){return lr(`${Na.v1}/saml/configurations`)}async function Yl(e){return sr(`${Na.v1}/saml/configurations`,e)}async function Ql(){return lr(`${Na.v1}/saml/configurations/vendor-config`)}async function Xl(e){return ur(`${Na.v1}/saml/configurations/metadata`,e)}async function Zl(){return ur(`${Na.v1}/saml/validations/domain`)}async function es(){return lr(`${Na.v1}/saml/configurations/roles/default`)}async function ts(){return lr(`${Na.v2}/saml/configurations/groups`)}async function ns({roleIds:e}){return sr(`${Na.v1}/saml/configurations/roles/default`,{roleIds:e})}async function os({roleIds:e,group:t}){return sr(`${Na.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function is({roleIds:e,group:t,id:n}){return cr(`${Na.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function as({id:e}){return dr(`${Na.v2}/saml/configurations/groups/${e}`)}async function rs(){return lr(`${Na.v1}/oidc/configurations`)}async function ls(){return lr(`${Na.v2}/configurations/public`)}async function ss(){return lr(Oa.v1)}async function cs(){return lr(Oa.v2)}async function us(){return lr(Oa.custom.v1)}async function ds({provider:e,code:t,idToken:n,redirectUri:o,codeVerifier:i,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),o&&(s.redirectUri=o),i&&(s.code_verifier=i),l&&(s.state=l),sr(`${Pa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function ys(){return lr(`${Ia.v1}/public`)}async function fs(e){const{shouldActivate:t,authResponse:n,userId:o,tenantId:i}=await sr(`${Ea.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await tl(n):void 0,userId:o,tenantId:i}}async function ps(){return lr(Ea.sessions.currentUser.v1)}async function gs(){return lr(`${Ea.sessions.currentUser.v1}/current`)}async function Ss(e){return sr(`${Ea.sessions.v1}/revoke`,{userId:e})}async function vs(){return lr(Ea.sessions.configurations.v1)}async function hs(e){await sr(Ea.sessions.configurations.v1,e)}async function ms(e){await dr(`${Ea.sessions.currentUser.v1}/${e}`)}async function As(){await dr(`${Ea.sessions.currentUser.v1}/all`)}async function bs(){return lr(Ea.accessTokens.v1)}async function ks(){return lr(Ua.accessTokens.v1)}async function Ts({id:e}){return dr(`${Ua.accessTokens.v1}/${e}`)}async function Ps({id:e}){return dr(`${Ea.accessTokens.v1}/${e}`)}async function Es(e){return sr(Ea.accessTokens.v1,e)}async function Is(e){return sr(Ua.accessTokens.v1,e)}async function Ls(){return lr(Ea.apiTokens.v1)}async function Os(){return lr(Ua.apiTokens.v1)}async function ws(e){return sr(Ea.apiTokens.v1,e)}async function Us(e){return sr(Ua.apiTokens.v2,e)}async function Cs({tokenId:e}){return dr(`${Ua.apiTokens.v1}/${e}`)}async function Ds({tokenId:e}){return dr(`${Ea.apiTokens.v1}/${e}`)}async function _s({userId:e}){return lr(`${Ea.v1}/${e}`)}async function Rs(e){return lr(`${Ia.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Ns(e){let{type:t}=e,n=Co(e,Zr);return sr(`${Pa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Ms(e){let{type:t}=e,n=Co(e,el);return sr(`${Pa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Fs({token:e}){return sr(Ua.invites.verify.v1,{token:e})}async function Gs(){return lr(`${Na.v1}/configurations`)}async function $s(e){return sr(`${Na.v1}/configurations`,e)}async function xs(e,t){return cr(`${Na.v1}/configurations/${e}`,t)}async function Vs(e){return dr(`${Na.v1}/configurations/${e}`)}async function js(e){return sr(`${Na.v1}/configurations/metadata`,e)}async function Ws(e,t){return ur(`${Na.v1}/configurations/${e}/metadata`,t)}async function Bs(e,t){return sr(`${Na.v1}/configurations/${e}/domains`,t)}async function Ks(e,t){return dr(`${Na.v1}/configurations/${e}/domains/${t}`)}async function zs(e,t){return ur(`${Na.v1}/configurations/${e}/domains/${t}/validate`)}async function qs(e){return lr(`${Na.v1}/configurations/${e}/roles`)}async function Hs(e,t){return ur(`${Na.v1}/configurations/${e}/roles`,t)}async function Js(e,t){return sr(`${Na.v1}/configurations/${e}/groups`,t)}async function Ys(e,{roleIds:t,group:n,id:o}){return cr(`${Na.v1}/configurations/${e}/groups/${o}`,{group:n,roleIds:t})}async function Qs(e,t){return dr(`${Na.v1}/configurations/${e}/groups/${t}`)}async function Xs(e){return lr(`${Na.v1}/configurations/${e}/groups`)}async function Zs(e){return sr(`${Pa.v2}/user/sso/prelogin`,e)}async function ec(e){return tl(await sr(`${Pa.v2}/user/oidc/postlogin`,e))}async function tc(e){return ol(await sr(`${Za}/token`,e))}async function nc(){return ol(await sr(`${Za}/authorize/silent`))}async function oc(e){return sr(`${Ea.v1}/phone/reset`,e)}async function ic(e){return sr(`${Ea.v1}/phone/reset/verify`,e)}async function ac(e){return sr(`${Ea.v1}/phone`,e)}async function rc(e){return sr(`${Ea.v1}/phone/verify`,e)}async function lc(e){return ur(`${Ea.v1}/phone/change`,e)}async function sc(e){return sr(`${Pa.v1}/webauthn/prelogin`,e)}async function cc(e){return sr(`${Pa.v1}/webauthn/postlogin`,e)}async function uc(){return sr(Ta.v1)}async function dc(){return lr(Ta.v1)}async function yc(e){return dr(`${Ta.v1}/${e}`)}async function fc(e){return sr(`${Ta.v1}/verify`,e)}async function pc(){return lr(`${Ia.v1}/auth/strategies/public`)}async function gc(){return lr(`${Ia.v1}/mfa/strategies`)}async function Sc(e){return lr(`${Ea.v2}/me`,null!=e?e:{addRoles:!0})}async function vc(e){return ur(`${Ea.v2}/me`,e)}async function hc(e){return ur(`${$a.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function mc(e){return sr(`${Ea.v1}/passwords/change`,e)}async function Ac(e){var t,n,o,i,a,r;const l=(e.filter||[]).reduce(((e,t)=>U({},e,{[t.id]:t.value})),{}),s=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(o=e.sort)||null==(i=o[0])?void 0:i.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return lr(Ma.v1,U({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function bc(e){return sr(Ea.v2,U({},e,{provider:"local"}))}async function kc(e){return dr(`${Ma.v1}/${e.userId}`)}async function Tc(e){return ur(Ma.v1,e)}async function Pc(e){return sr(Ua.invites.user.v1,U({},e))}async function Ec(e){return cr(Ua.invites.user.v1,U({},e))}async function Ic(){return dr(Ua.invites.user.v1)}async function Lc(){return lr(Ua.invites.user.v1)}async function Oc(){return lr(Ua.invites.configuration.v1)}async function wc(){return lr(Fa.v1)}async function Uc(){return lr(wa.v1)}async function Cc(){return lr(`${Ga.v1}/members`)}async function Dc(e){return sr(`${Ma.v1}/${e.userId}/resendActivationEmail`,{})}async function _c(e){return sr(Ea.v2,U({},e,{provider:"local"}))}async function Rc(e){return sr(Ea.invitation.resendAll.v1,U({},e))}async function Nc(e){var t,n;const o=await lr("/metadata",e);if(null!=o&&null!=(t=o.rows)&&t[0])return null==o||null==(n=o.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Mc(){return lr("/metadata/admin-box")}async function Fc(e){return sr("/metadata/admin-box",e)}async function Gc(){const e=await lr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const $c=async()=>Nc({entityName:"notifications"}),xc=async()=>Nc({entityName:"saml"}),Vc=async()=>Nc({entityName:"audits"}),jc=async e=>async function(e){const t=await lr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Wc=["dataFilters"],Bc=["templateId","dataFilters"],Kc=["dataFilters"];async function zc(e){return lr(`${qa.v2}/tenant-reports`,e)}async function qc(e){return lr(`${qa.v2}/${e.id}/tenant-reports`)}async function Hc(e){let{dataFilters:t}=e,n=Co(e,Wc);return{html:await lr(`${Ha.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Jc(e){let{templateId:t,dataFilters:n}=e,o=Co(e,Bc);return sr(`${qa.v2}/${t}/tenant-reports`,U({},o,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Yc(e){let{dataFilters:t}=e,n=Co(e,Kc);const o=await lr(`${Ha.v1}/preview-report`,U({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",a="html";"pdf"===n.responseType?(i="application/pdf",a="pdf"):"image"===n.responseType&&(i="image/jpeg",a="jpg");const r=new Blob([o],{type:i}),l=URL.createObjectURL(r),s=document.createElement("a");s.href=l,s.setAttribute("download",`report_${n.name||""}.${a}`),s.click(),setTimeout(s.remove.bind(s))}async function Qc(e){return sr(`${Ha.v1}/tenant-reports`,e)}async function Xc(e){return lr(Ja,{params:e})}async function Zc(e){return ur(`${Ja}/status`,{params:e})}async function eu(e){const{notificationId:t,pinStatus:n}=e;return ur(`${Ja}/${n}`,{notificationId:t})}async function tu(){return sr(`${Ja}/status/mark-all-read`)}const nu=["endpoint","headerProps"];async function ou(e){return lr(Ya,e)}async function iu(e){return lr(`${Ya}/stats`,e)}async function au(e){const{endpoint:t,headerProps:n}=e,o=Co(e,nu);return yr(`${Ya}/export/${t}`,{properties:n},o)}const ru=["eventKey"],lu=["eventKey"],su=()=>lr(`${Wa.v1}/slack`),cu=()=>lr(`${Wa.v1}/slack/applications`),uu=()=>lr(`${Wa.v1}/slack/channels`),du=e=>e.id?cr(`${Wa.v1}/slack/subscription/${e.id}`,e):sr(`${Wa.v1}/slack/subscriptions`,e),yu=e=>dr(`${Wa.v1}/slack/subscriptions/${e.id}`),fu=e=>sr(`${Wa.v1}/slack/applications/registrations`,{code:e}),pu=()=>lr(`${Wa.v1}/emails`),gu=e=>{let{eventKey:t}=e,n=Co(e,ru);return sr(`${Wa.v1}/emails/${t}`,n)},Su=({eventKey:e,enabled:t})=>cr(`${Wa.v1}/emails/${e}`,{enabled:t}),vu=(e,t)=>dr(`${Wa.v1}/emails/${e}/subscriptions/${t}`),hu=(e,t,n)=>ur(`${Wa.v1}/emails/${t}/subscriptions/${e}`,n),mu=e=>dr(`${Wa.v1}/emails/${e}`),Au=()=>lr(`${Wa.v2}/sms`),bu=e=>{let{eventKey:t}=e,n=Co(e,lu);return sr(`${Wa.v2}/sms/${t}`,n)},ku=({eventKey:e,enabled:t})=>cr(`${Wa.v2}/sms/${e}`,{enabled:t}),Tu=(e,t)=>dr(`${Wa.v2}/sms/${e}/subscriptions/${t}`),Pu=(e,t,n)=>ur(`${Wa.v2}/sms/${t}/subscriptions/${e}`,n),Eu=e=>dr(`${Wa.v2}/sms/${e}`),Iu=()=>lr(Xa),Lu=e=>e._id?cr(`${Xa}/${e._id}`,e):sr(`${Xa}/custom`,e),Ou=e=>dr(`${Xa}/${e}`),wu=(e,t=0,n=10)=>{const o=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return lr(`${Xa}/logs/?${o.toString()}`)},Uu=e=>sr(`${Xa}/test`,e),Cu=e=>sr(`${Xa}/logs/${e}/retries`),Du=()=>lr(`${Qa.v1}/categories`),_u=e=>lr(Qa.v1,{channels:e});async function Ru(e,t){return ur(xa.v1,e,{headers:fr(t)})}async function Nu(e){return lr(xa.v1,void 0,{headers:fr(e)})}async function Mu(){return lr(`${xa.v1}/public`)}const Fu=["roleId"],Gu=["roleId"],$u=["permissionId"];async function xu(){return lr(Ca.v1)}async function Vu(e){return sr(Ca.v1,e)}async function ju({roleId:e}){return dr(`${Ca.v1}/${e}`)}async function Wu(e){let{roleId:t}=e,n=Co(e,Fu);return cr(`${Ca.v1}/${t}`,n)}async function Bu(e){let{roleId:t}=e,n=Co(e,Gu);return ur(`${Ca.v1}/${t}/permissions`,n)}async function Ku(){return lr(wa.v1)}async function zu(e){let{permissionId:t}=e,n=Co(e,$u);return ur(`${wa.v1}/${t}/roles`,n)}async function qu(){return lr(`${wa.v1}/categories`)}async function Hu(){return lr(Ba.subscriptions.v1)}async function Ju(e){return lr(`${Ba.subscriptions.v1}/${e}`)}async function Yu(e){return ur(`${Ba.subscriptions.v1}/${e}/cancellations/`,{})}async function Qu(e){return ur(`${Ba.subscriptions.v1}/${e}/renewals/`,{})}async function Xu(e,{paymentMethodId:t,planId:n}){return ur(`${Ba.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Zu(e){return lr(`${za.v1}/${e}`)}async function ed(){return lr(`${za.v1}`)}async function td(e){return ur(`${za.v1}/${e}/cancellations/`,{})}async function nd(e){return ur(`${za.v1}/${e}/renewals/`,{})}async function od(e,{paymentMethodId:t,planId:n}){return ur(`${za.v1}/${e}`,{paymentMethodId:t,planId:n})}async function id(){return lr(Ba.plans.v1)}async function ad(e){return lr(`${Ba.plans.v1}/${e}`)}async function rd(){return lr(Ba.invoices.v1)}async function ld(e){return lr(`${Ba.invoices.v1}/${e}`)}async function sd(e,t){return lr(`${Ba.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const cd=["email"];async function ud(){return lr(Ba.paymentMethods.v1)}async function dd(e){return lr(`${Ba.paymentMethods.v1}/${e}`)}async function yd(e,t){let{email:n}=t,o=Co(t,cd);return cr(`${Ba.paymentMethods.v1}/${e}/billing-details`,{email:n,address:o})}async function fd(e){return sr(Ba.paymentProviders.stripe.subscriptions.v1,e)}async function pd(e){return lr(`${Ba.paymentProviders.stripe.customers.v1}/${e}`)}async function gd(e){return sr(`${Ba.paymentProviders.stripe.customers.v1}`,e)}async function Sd(){return lr(`${Ba.paymentProviders.stripe.publicConfigurations.v1}`)}async function vd(e){return sr(`${Ba.paymentProviders.stripe.setupIntents.v1}`,e)}async function hd(e){return lr(`${Ba.summaries.v1}/${e}`)}async function md(e){return lr(`${Ba.tenantConfiguration.v1}/${e}`)}async function Ad(e){return sr(`${Ba.tenantConfiguration.v1}`,e)}async function bd(){return lr(Ka.v1)}async function kd(){return lr(`${Ba.configurations.vendorPublicConfigurations.v1}`)}let Td,Pd,Ed,Id,Ld,Od;async function wd(){return lr("/vendors/public")}async function Ud(e){return lr(Da.v1,e)}async function Cd(e){return sr(Da.v1,e)}async function Dd(e,t){return dr(Da.v1,e,{headers:fr(t)})}async function _d(e,t,n){return sr(`${Da.v1}/${e}/roles`,t,{headers:fr(n)})}async function Rd(e,t,n){return dr(`${Da.v1}/${e}/roles`,t,{headers:fr(n)})}async function Nd(e,t,n){return cr(`${Da.v1}/${e}/roles`,t,{headers:fr(n)})}async function Md(e,t){return sr(ja.v1,e,{headers:fr(t)})}async function Fd(e,t){return dr(`${ja.v1}/${e}`,void 0,{headers:fr(t)})}async function Gd({tenantId:e},t,n){return cr(`${ja.v1}/${e}`,t,{headers:fr(n)})}async function $d(e,t,n){return ur(`${Da.v1}/${e}/access`,t,{headers:fr(n)})}async function xd(e,t){return sr(`${Da.v2}/`,e,{headers:fr(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Td||(Td={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Pd||(Pd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Ed||(Ed={})),(Id||(Id={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ld||(Ld={})),function(e){e.CREATE="create_customer"}(Od||(Od={}));const Vd={flags:{}};class jd{constructor(){var e;this._flags={},this._flags=null!=(e=Vd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new jd;return n.set(e),jd._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=U({},null!=(t=null==Vd?void 0:Vd.flags)?t:{},null!=e?e:{})}}async function Wd(){return lr(er)}async function Bd(){return lr(`${tr}`)}async function Kd(e,t){return cr(`${tr}/${e}`,t)}async function zd(e){return sr(`${tr}`,e)}async function qd(e){return dr(`${tr}/${e}`)}async function Hd(e){return lr(`${nr}/${e}/Users/count`)}async function Jd(e){return sr(`${_a.v1}`,e)}jd._instances={};const Yd=["groupId"];async function Qd({groupId:e},t){return lr(`${Ra.v1}/${e}`,U({},t))}async function Xd(e){return lr(`${Ra.v1}`,U({},e))}async function Zd(e,t){return sr(`${Ra.getByIds.v1}`,e,{params:t})}async function ey(e){return sr(`${Ra.v1}`,e)}async function ty(e){let{groupId:t}=e,n=Co(e,Yd);return cr(`${Ra.v1}/${t}`,n)}async function ny(e){return dr(`${Ra.v1}/${e}`)}async function oy(e,t){return sr(`${Ra.v1}/${e}/roles`,t)}async function iy(e,t){return dr(`${Ra.v1}/${e}/roles`,t)}async function ay(e,t){return sr(`${Ra.v1}/${e}/users`,t)}async function ry(e,t){return dr(`${Ra.v1}/${e}/users`,t)}async function ly(){return lr(`${Ra.configurations.v1}`)}async function sy(e){return sr(`${Ra.configurations.v1}`,e)}async function cy(e){return sr(`${Ea.v3}/me/token`,e)}async function uy(e,t){return lr(Ea.v3,e,{headers:fr(t)})}async function dy(){return lr(or)}let yy,fy,py,gy,Sy,vy;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(yy||(yy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(fy||(fy={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(py||(py={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(gy||(gy={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Sy||(Sy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(vy||(vy={}));const hy=[/^(.*)\/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],my=`${Pa.v1}/user/token/refresh`,Ay=`${Za}/authorize/silent`,by=`${Ea.v2}/me`,ky=`${Ea.v2}/me/tenants`;let Ty,Py,Ey,Iy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Ty||(Ty={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Py||(Py={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ey||(Ey={})),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"}(Iy||(Iy={}));const Ly={auth:i,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m,users:A,entitlements:b};var Oy={fetch:e,ContextHolder:Sa,FronteggContext:va,api:Ly,FronteggApiError:ka,AuthStrategyEnum:qr,MachineToMachineAuthStrategy:Hr,SocialLoginProviders:zr,ISubscriptionCancellationPolicy:Ed,ISubscriptionStatus:Td,PaymentMethodType:Pd,ProviderType:Id};let wy,Uy;!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"}(wy||(wy={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Uy||(Uy={}));const Cy="input is invalid type",Dy="undefined"!=typeof ArrayBuffer,_y="0123456789abcdef".split(""),Ry=[-2147483648,8388608,32768,128],Ny=[24,16,8,0],My=[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],Fy=["hex","array","digest","arrayBuffer"],Gy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Dy&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const $y=function(e){return function(t){const n=new Vy(!0).update(t);return null==n?void 0:n[e]()}},xy=function(e){return function(t,n){const o=new jy(t,!0).update(n);return null==o?void 0:o[e]()}};class Vy{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=()=>Vy.prototype.digest(),e?(Gy[0]=Gy[16]=Gy[1]=Gy[2]=Gy[3]=Gy[4]=Gy[5]=Gy[6]=Gy[7]=Gy[8]=Gy[9]=Gy[10]=Gy[11]=Gy[12]=Gy[13]=Gy[14]=Gy[15]=0,this.blocks=Gy):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(Cy);if(null===e)throw new Error(Cy);if(Dy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Dy&&ArrayBuffer.isView(e)))throw new Error(Cy);t=!0}let o,i,a=0;const r=e.length,l=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,l[0]=this.block,l[16]=l[1]=l[2]=l[3]=l[4]=l[5]=l[6]=l[7]=l[8]=l[9]=l[10]=l[11]=l[12]=l[13]=l[14]=l[15]=0),t)for(i=this.start;a<r&&i<64;++a)l[i>>2]|=e[a]<<Ny[3&i++];else for(i=this.start;a<r&&i<64;++a)o=e.charCodeAt(a),o<128?l[i>>2]|=o<<Ny[3&i++]:o<2048?(l[i>>2]|=(192|o>>6)<<Ny[3&i++],l[i>>2]|=(128|63&o)<<Ny[3&i++]):o<55296||o>=57344?(l[i>>2]|=(224|o>>12)<<Ny[3&i++],l[i>>2]|=(128|o>>6&63)<<Ny[3&i++],l[i>>2]|=(128|63&o)<<Ny[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++a)),l[i>>2]|=(240|o>>18)<<Ny[3&i++],l[i>>2]|=(128|o>>12&63)<<Ny[3&i++],l[i>>2]|=(128|o>>6&63)<<Ny[3&i++],l[i>>2]|=(128|63&o)<<Ny[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=l[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Ry[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,o,i,a,r,l,s,c,u,d=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(l=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),l=d&y,o=l^d&f^u,r=g&S^~g&v,i=h+n+r+My[e]+m[e],a=t+o,h=p+i<<0,p=i+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),s=p&d,o=s^p&y^l,r=h&g^~h&S,i=v+n+r+My[e+1]+m[e+1],a=t+o,v=f+i<<0,f=i+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,o=c^f&d^s,r=v&h^~v&g,i=S+n+r+My[e+2]+m[e+2],a=t+o,S=y+i<<0,y=i+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,o=u^y&p^c,r=S&v^~S&h,i=g+n+r+My[e+3]+m[e+3],a=t+o,g=d+i<<0,d=i+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7;let s=_y[e>>28&15]+_y[e>>24&15]+_y[e>>20&15]+_y[e>>16&15]+_y[e>>12&15]+_y[e>>8&15]+_y[e>>4&15]+_y[15&e]+_y[t>>28&15]+_y[t>>24&15]+_y[t>>20&15]+_y[t>>16&15]+_y[t>>12&15]+_y[t>>8&15]+_y[t>>4&15]+_y[15&t]+_y[n>>28&15]+_y[n>>24&15]+_y[n>>20&15]+_y[n>>16&15]+_y[n>>12&15]+_y[n>>8&15]+_y[n>>4&15]+_y[15&n]+_y[o>>28&15]+_y[o>>24&15]+_y[o>>20&15]+_y[o>>16&15]+_y[o>>12&15]+_y[o>>8&15]+_y[o>>4&15]+_y[15&o]+_y[i>>28&15]+_y[i>>24&15]+_y[i>>20&15]+_y[i>>16&15]+_y[i>>12&15]+_y[i>>8&15]+_y[i>>4&15]+_y[15&i]+_y[a>>28&15]+_y[a>>24&15]+_y[a>>20&15]+_y[a>>16&15]+_y[a>>12&15]+_y[a>>8&15]+_y[a>>4&15]+_y[15&a]+_y[r>>28&15]+_y[r>>24&15]+_y[r>>20&15]+_y[r>>16&15]+_y[r>>12&15]+_y[r>>8&15]+_y[r>>4&15]+_y[15&r];return s+=_y[l>>28&15]+_y[l>>24&15]+_y[l>>20&15]+_y[l>>16&15]+_y[l>>12&15]+_y[l>>8&15]+_y[l>>4&15]+_y[15&l],s}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,o=this.h3,i=this.h4,a=this.h5,r=this.h6,l=this.h7,s=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return s.push(l>>24&255,l>>16&255,l>>8&255,255&l),s}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class jy extends Vy{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const o=typeof e;if("string"===o){const t=[],o=e.length;let i,a=0;for(n=0;n<o;++n)i=e.charCodeAt(n),i<128?t[a++]=i:i<2048?(t[a++]=192|i>>6,t[a++]=128|63&i):i<55296||i>=57344?(t[a++]=224|i>>12,t[a++]=128|i>>6&63,t[a++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[a++]=240|i>>18,t[a++]=128|i>>12&63,t[a++]=128|i>>6&63,t[a++]=128|63&i);e=t}else{if("object"!==o)throw new Error(Cy);if(null===e)throw new Error(Cy);if(Dy&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Dy&&ArrayBuffer.isView(e)))throw new Error(Cy)}var i;e.length>64&&(e=null==(i=new Vy(!0).update(e))?void 0:i.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Vy.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();Vy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Vy.prototype.finalize.call(this)}}}const Wy=function(){const e=$y("hex");e.create=function(){return new Vy},e.update=function(t){return e.create().update(t)};for(let t=0;t<Fy.length;++t){const n=Fy[t];e[n]=$y(n)}return e}();function By(e,t){const n=U({},e);return t.forEach((e=>{delete n[e]})),n}async function Ky(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=Wy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function zy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=xy("hex");e.create=function(e){return new jy(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Fy.length;++t){const n=Fy[t];e[n]=xy(n)}}();const qy=e=>new Promise(((t,n)=>{const o=new FileReader;o.readAsText(e),o.onload=()=>t(o.result),o.onerror=n}));function*Hy(e){const t=yield bi((e=>e.root.appName));return jd.getFeatureFlags(e,t)}const Jy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Yy=U({},Jy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Qy=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],Xy={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},Zy=U({},Xy,{accessToken:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1MTY5YmY0Zi02YmI5LTQ5NGMtOGNkZS05MDc4NDQ0NWY4MDciLCJuYW1lIjoiRHVtbXkgVXNlciIsImVtYWlsIjoiZHVtbXlAZnJvbnRlZ2cuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIm1ldGFkYXRhIjp7fSwicm9sZXMiOlsiYWRtaW4iXSwicGVybWlzc2lvbnMiOlsiZmUuKiJdLCJ0ZW5hbnRJZCI6Im15LXRlbmFudC1pZCIsInRlbmFudElkcyI6WyJteS10ZW5hbnQtaWQiXSwicHJvZmlsZVBpY3R1cmVVcmwiOiJodHRwczovL3d3dy5ncmF2YXRhci5jb20vYXZhdGFyLzQyYjJhZDJiYWQ2ZmM5YjlkYjUwODZkZmNmODA3MmFjP2Q9aHR0cHM6Ly91aS1hdmF0YXJzLmNvbS9hcGkvZmUvMTI4L3JhbmRvbT90PTE2MTcyNjE4OTA4NzU_dD0xNjE3MjYxOTE3NDM0IiwidHlwZSI6InVzZXJUb2tlbiIsImlhdCI6MTYxNzkwNjMyNCwiZXhwIjoxNjE3OTkyNzI0LCJpc3MiOiJmcm9udGVnZyJ9.paaXLkpWEWbQmUtoK2P8IwXCxK4WJp7XhXonvzF8g1I",expiresIn:86400,mfaRequired:!1,refreshToken:"refresh-token-dummy-de39dc9c-9d22-4852-b7f5-c3c0aa613b58",type:"userToken",iat:1617906324,exp:1617992724,iss:"frontegg",email_verified:!0}),ef={loading:!1,error:void 0,saving:!0,profile:Xy},tf={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"},nf={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:qr.EmailAndPassword,machineToMachineAuthStrategy:Hr.ClientCredentials},of={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},af={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},rf={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},lf={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},sf={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},cf=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],uf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:lf,roles:cf,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},df=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],yf={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:[Qy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Qy[0]],managedBy:Ey.FRONTEGG}]},ff={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:[Qy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Qy[0]],managedBy:Ey.FRONTEGG}]},pf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},gf=[ff,yf],Sf=[pf],vf=[{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}],hf=[{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"}],mf={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Af={isActive:!0,strategy:xn.ALLOW},bf=[{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"}],kf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(U({},ff,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Tf=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"}),Pf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:kf(6),roles:[Tf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Ey.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:kf(44),roles:[Tf("Editor")],managedBy:Ey.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:kf(8),roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:kf(5),roles:[Tf("Admin")],managedBy:Ey.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:kf(21),description:"BDR, AE, and inside sales",roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:kf(23),description:"Dev success and customer success",roles:[Tf("Admin")],managedBy:Ey.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:kf(10),description:"The marketing department",roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:kf(4),description:"Human resources",roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:kf(3),roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:kf(8),roles:[Tf("Editor")],managedBy:Ey.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:kf(4),roles:[Tf("Viewer")],managedBy:Ey.FRONTEGG}];let Ef,If,Lf;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ef||(Ef={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(If||(If={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Lf||(Lf={})),Lf.profile,Lf.privacy,Lf.personalApiTokens,Lf.account,Lf.users,Lf.groups,Lf.security,Lf.sso,Lf.audits,Lf.webhooks,Lf.apiTokens,Lf.roles,Lf.subscriptions,Lf.allAccounts;const Of=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>Boolean(null==e?void 0:e.message))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t,wf=["events","url"];function*Uf(){yield gi(ho.setSignUpState({loading:!0}));try{const e=yield hi(Ly.auth.getVendorConfig),[t]=(yield hi(Ly.auth.getVendorPublicAuthStrategiesConfig),yield hi(Hy,["admin_portal_login_per_tenant"]));if(t){const t=yield hi(Ly.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:o}=e;yield gi(ho.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:o,firstLoad:!1})),yield gi(ho.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSignUpState({loading:!1,error:Of(e),firstLoad:!1}))}}function*Cf(e){let{payload:{events:t,url:n}}=e,o=Co(e.payload,wf);yield gi(ho.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield bi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield hi(Ly.auth.signUpUser,o);if(!o.invitationToken){var i;const{email:e,name:a,companyName:r}=o;null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:If.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Sa.setAccessToken(null==l?void 0:l.accessToken),Sa.setUser(l),!r&&l&&Kp(l)){const t=yield Hp(l);yield gi(ho.setState(t)),a(e.loginUrl)}else yield gi(ho.setSignUpState({loading:!1,shouldActivate:r,stage:gn.SignUpSuccess})),yield gi(ho.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield gi(ho.loadTenants()))}catch(e){Sa.setAccessToken(null),Sa.setUser(null),yield gi(ho.setSignUpState({loading:!1,error:Of(e)}))}yield gi(ho.setSignUpState({loading:!1}))}function*Df(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield bi((e=>e.auth.signUpState));yield gi(ho.resetSignUpState()),yield gi(ho.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*_f(){yield ga(ho.signUpUser,Cf),yield ga(ho.resetSignUpStateSoft,Df)}const Rf={setVendorState:(e,{payload:t})=>U({},e,t)},Nf={loadVendorPublicInfo:st("vendor/loadVendorPublicInfo")},Mf={loading:!1},{reducer:Ff,actions:Gf}=ut({name:Dt,initialState:Mf,reducers:U({},Rf)}),$f=U({},Gf,Nf);function*xf(){yield gi($f.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Ly.vendor.getVendorPublicInfo();yield gi($f.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield gi($f.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Vf=["callback"],jf=["callback"],Wf=["callback"],Bf=["callback"],Kf=["callback"],zf=["callback"];function*qf(){yield gi(ho.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getGlobalSecurityPolicy);yield gi(ho.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyGlobalState({error:Of(e),loading:!1}))}yield gi(ho.loadSecurityPolicyMfa()),yield gi(ho.loadSecurityPolicyVendorMfa()),yield gi(ho.loadSecurityPolicyLockout()),yield gi(ho.loadSecurityPolicyVendorLockout()),yield gi(ho.loadSecurityPolicyVendorPasswordHistory()),yield gi(ho.loadSecurityPolicyCaptcha()),yield gi(ho.loadPublicAuthStrategiesPolicy())}function*Hf(){yield gi(ho.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getVendorConfig),[t]=yield hi(Hy,["admin_portal_login_per_tenant"]);if(t){const t=yield hi(Ly.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield gi(ho.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyPublicState({error:Of(e),loading:!1}))}}function*Jf(){yield gi(ho.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getVendorPublicAuthStrategiesConfig);yield gi(ho.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyAuthStrategyPublicState({error:Of(e),loading:!1}))}}function*Yf(){yield gi(ho.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getMfaPolicy);yield gi(ho.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyMfaState({error:Of(e),loading:!1}))}}function*Qf(){yield gi(ho.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getVendorMfaPolicy);yield gi(ho.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyVendorMfaState({error:Of(e),loading:!1}))}}function*Xf(e){let{payload:{callback:t}}=e,n=Co(e.payload,Vf);yield gi(ho.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield hi(Ly.auth.saveMfaPolicy,n);yield gi(ho.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setSecurityPolicyMfaState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*Zf(){yield gi(ho.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getLockoutPolicy);yield gi(ho.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyLockoutState({error:Of(e),loading:!1}))}}function*ep(e){let{payload:{callback:t}}=e,n=Co(e.payload,jf);yield gi(ho.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield hi(Ly.auth.saveLockoutPolicy,n);yield gi(ho.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setSecurityPolicyLockoutState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*tp(){yield gi(ho.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getVendorLockoutPolicy);yield gi(ho.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyVendorLockoutState({error:Of(e),loading:!1}))}}function*np(){yield gi(ho.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getCaptchaPolicy);yield gi(ho.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyCaptchaState({error:Of(e),loading:!1}))}}function*op(){yield gi(ho.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getPasswordHistoryPolicy);yield gi(ho.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyPasswordHistoryState({error:Of(e),loading:!1}))}}function*ip(){yield gi(ho.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getVendorPasswordHistoryPolicy);yield gi(ho.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyVendorPasswordHistoryState({error:Of(e),loading:!1}))}}function*ap(e){let{payload:{callback:t}}=e,n=Co(e.payload,Wf);yield gi(ho.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield hi(Ly.auth.savePasswordHistoryPolicy,n);yield gi(ho.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setSecurityPolicyPasswordHistoryState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*rp(){yield gi(ho.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getPasswordConfigPolicy);yield gi(ho.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyPasswordState({error:Of(e),loading:!1}))}}function*lp(){yield ga(ho.loadSecurityPolicy,qf),yield fa(ho.saveSecurityPolicyMfa,Xf),yield fa(ho.loadSecurityPolicyMfa,Yf),yield fa(ho.loadSecurityPolicyVendorMfa,Qf),yield fa(ho.saveSecurityPolicyLockout,ep),yield fa(ho.loadSecurityPolicyLockout,Zf),yield fa(ho.loadSecurityPolicyVendorLockout,tp),yield fa(ho.loadSecurityPolicyCaptcha,np),yield fa(ho.saveSecurityPolicyPasswordHistory,ap),yield fa(ho.loadSecurityPolicyPasswordHistory,op),yield fa(ho.loadSecurityPolicyVendorPasswordHistory,ip),yield fa(ho.loadVendorPasswordConfig,rp),yield fa(ho.loadPublicSecurityPolicy,Hf),yield fa(ho.loadPublicAuthStrategiesPolicy,Jf)}function*sp(){yield gi(ho.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield gi(ho.setSecurityPolicyPublicState({policy:nf,loading:!1}))}catch(e){yield gi(ho.setSecurityPolicyPublicState({error:Of(e),loading:!1}))}}function*cp(){yield gi(ho.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyGlobalState({policy:tf,loading:!1})),yield gi(ho.loadSecurityPolicyMfa()),yield gi(ho.loadSecurityPolicyVendorMfa()),yield gi(ho.loadSecurityPolicyLockout()),yield gi(ho.loadSecurityPolicyVendorLockout()),yield gi(ho.loadSecurityPolicyPasswordHistory()),yield gi(ho.loadSecurityPolicyVendorPasswordHistory()),yield gi(ho.loadSecurityPolicyCaptcha())}function*up(){yield gi(ho.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyMfaState({policy:of,loading:!1}))}function*dp(){yield gi(ho.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyVendorMfaState({policy:of,loading:!1}))}function*yp(e){var t;let{payload:{callback:n}}=e,o=Co(e.payload,Bf);yield gi(ho.setSecurityPolicyMfaState({saving:!0,error:null}));const i=U({},af,{id:null!=(t=o.id)?t:af.id,enforceMFAType:o.enforceMFAType});yield mt(),yield gi(ho.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*fp(){yield gi(ho.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyLockoutState({policy:af,loading:!1}))}function*pp(){yield gi(ho.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyVendorLockoutState({policy:af,loading:!1}))}function*gp(e){let{payload:{callback:t}}=e,n=Co(e.payload,Kf);yield gi(ho.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const o=U({},af,n,{id:n.id?n.id:af.id});null==t||t(o),yield gi(ho.setSecurityPolicyLockoutState({policy:o,saving:!1}))}function*Sp(){yield gi(ho.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyLockoutState({policy:af,loading:!1}))}function*vp(){yield gi(ho.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyPasswordHistoryState({policy:rf,loading:!1}))}function*hp(){yield gi(ho.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield gi(ho.setSecurityPolicyVendorPasswordHistoryState({policy:rf,loading:!1}))}function*mp(e){let{payload:{callback:t}}=e,n=Co(e.payload,zf);yield gi(ho.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const o=U({},rf,n,{id:n.id?n.id:rf.id});null==t||t(o),yield gi(ho.setSecurityPolicyPasswordHistoryState({policy:o,saving:!1}))}function*Ap(){yield ga(ho.loadSecurityPolicy,cp),yield fa(ho.loadPublicSecurityPolicy,sp),yield fa(ho.saveSecurityPolicyMfa,yp),yield fa(ho.loadSecurityPolicyMfa,up),yield fa(ho.loadSecurityPolicyVendorMfa,dp),yield fa(ho.saveSecurityPolicyLockout,gp),yield fa(ho.loadSecurityPolicyLockout,fp),yield fa(ho.loadSecurityPolicyVendorLockout,pp),yield fa(ho.loadSecurityPolicyCaptcha,Sp),yield fa(ho.saveSecurityPolicyPasswordHistory,mp),yield fa(ho.loadSecurityPolicyPasswordHistory,vp),yield fa(ho.loadSecurityPolicyVendorPasswordHistory,hp)}const bp=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},kp=e=>{const{pathname:t}=new URL(e),n=bp(e);return n?t+n:t},Tp=["callback"],Pp=["callback"],Ep=["callback"],Ip=["callback"],Lp=["callback","events"],Op=["callback"],wp=["callback"],Up=["callback"],Cp=["callback"],Dp=["callback"],_p=["callback"],Rp=["callback"],Np=["callback"],Mp=["callback"],Fp=["callback","deviceId"],Gp=["callback","deviceId"],$p=["callback","deviceId"],xp=["callback","deviceId"],Vp={[qr.Code]:Pt.loginWithOtc,[qr.EmailAndPassword]:Pt.loginWithPassword,[qr.MagicLink]:Pt.magicLinkPreLoginSuccess,[qr.SmsCode]:Pt.loginWithSmsOtc};function*jp(){const e=Sa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:o=!1,allowedRedirectOrigins:i=[]}=yield bi((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:l,activateUrl:s}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=Sa.getContext()).tenantResolver)&&d.call(y)&&(yield hi(og),u=yield bi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Lt);f&&![a,r,l,s].includes(f)&&(c=f),window.localStorage.removeItem(Lt),yield mt(200),gi(ho.resetLoginState());const p=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:o})=>{let i=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),o=new URL(e),i=o.origin===n.origin;return t.includes(o.origin)||i})(a,n)?i=a:console.warn("The redirect url param is not valid, the origin is a different site"):i=a:o&&(i+=window.location.search),i})({authenticatedUrl:u?kp(u):c,includeQueryParam:n,enforceRedirectToSameSite:o,allowedRedirectOrigins:i});e(p,{refresh:p.startsWith("http")})}function*Wp(){let e;try{var t;const n=yield hi(Ly.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield gi(ho.setState({ssoACS:e}))}function*Bp(){try{const{isActive:e}=yield hi(Ly.auth.getSSOPublicConfiguration);yield gi(ho.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Kp=e=>e.mfaRequired&&e.mfaToken?(Sa.setAccessToken(null),Sa.setUser(null),!0):(Sa.setAccessToken(e.accessToken),Sa.setUser(e),!1),zp=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),o=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:o,totalDevices:t+n+o}})(e);if(1===o){if(n)return an.authenticatorApp;if(t)return an.smsVerifyCode}return an.verify},qp=e=>{if(1===e.length){const[t]=e;if(t===py.AuthenticatorApp)return an.authenticatorApp;if(t===py.SMS)return an.smsSetPhoneNumber}return an.verify};function*Hp(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:o}=yield bi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:a}=yield hi(Ly.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:zp(e.mfaDevices)}:(n={step:qp(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Pt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:Et.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:U({},o,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:a})}}function*Jp(e){var t;const{routes:n,loginState:o}=yield bi((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:o.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Yp(){const{hostedLoginBox:e}=yield bi((e=>e.auth));e?yield hi(Qp):yield hi(Zp)}function*Qp(){const{user:e}=yield bi((e=>e.auth));if(null==e||!e.refreshToken)return Sa.setAccessToken(null),Sa.setUser(null),void(yield gi(ho.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield hi(Ly.auth.exchangeOAuthTokens,t);yield gi(ho.setState({user:n,isAuthenticated:!0})),yield gi(ho.loadTenants())}catch(e){Sa.setAccessToken(null),Sa.setUser(null),yield gi(ho.setState({user:null,isAuthenticated:!1}))}}function*Xp(){const{user:e}=yield bi((e=>e.auth));if(null==e||!e.refreshToken)return Sa.setAccessToken(null),Sa.setUser(null),void(yield gi(ho.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield hi(Ly.auth.exchangeOAuthTokens,t);yield gi(ho.setState({user:n,isAuthenticated:!0})),yield gi(ho.loadTenants())}catch(e){Sa.setAccessToken(null),Sa.setUser(null),yield gi(ho.setState({user:null,isAuthenticated:!1}))}}function*Zp(){try{const t=Sa.onRedirectTo,{routes:n,loginState:o}=yield bi((e=>e.auth)),{user:i,tenants:a}=yield hi(Ly.auth.refreshTokenV2);if(Kp(i)){const e=yield Hp(i);yield gi(ho.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Jp(i);yield gi(ho.setTenantsState({tenants:a,loading:!1})),yield gi(ho.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?Et.RegisterQuickLogin:Et.Login})})),yield tg(n)}}catch(e){Sa.setAccessToken(null),Sa.setUser(null),yield gi(ho.setState({user:void 0,isAuthenticated:!1}))}}function*eg(){try{const t=Sa.onRedirectTo,{routes:n,loginState:o}=yield bi((e=>e.auth)),{user:i,tenants:a}=yield hi(Ly.auth.refreshTokenV2);if(Kp(i)){const e=yield Hp(i);yield gi(ho.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield hi(pg))yield gi(ho.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield gi(ho.setTenantsState({tenants:a,loading:!1})),yield gi(ho.setState({user:i})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:o.quickLoginToRegister,n=yield Jp(i);yield gi(ho.setTenantsState({tenants:a,loading:!1})),yield gi(ho.setState({user:i,isAuthenticated:!0,loginState:U({},o,{quickLoginToRegister:t,flow:n?Et.RegisterQuickLogin:Et.Login})})),yield tg(n)}}catch(e){Sa.setAccessToken(null),Sa.setUser(null),yield gi(ho.setState({user:void 0,isAuthenticated:!1}))}}function*tg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),o=Sa.onRedirectTo,{routes:i,loginState:a}=yield bi((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||l.push(i.loginUrl,i.signUpUrl),e?o(i.loginUrl):l.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?o(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield jp())}function*ng({payload:{callback:e}}){try{const{ip:t}=yield hi(Ly.metadata.getCurrentUserIpMetadata);yield gi(ho.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*og(){try{var e,t;if(null!=(e=Sa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield bi((e=>e.auth)),{applicationUrl:t,loginUrl:o}=yield hi(Mu);var n;t&&o&&(yield gi(ho.setState({routes:U({},e,{customLoginAuthenticatedUrl:o,customLoginUrl:null!=(n=e.loginUrl+bp(t))?n:""})})))}}catch{}}function*ig({payload:e}){const t=[];e&&(yield gi(ho.setState({isLoading:!0})),yield gi(ho.loadSocialLoginsConfigurationV2()),t.push(hi(Uf)),t.push(hi(Jf)),t.push(hi(Bp)),t.push(hi(xf)),t.push(hi(Wp)),t.push(hi(og))),t.push(hi(Yp)),yield Si(t),yield gi(ho.setState({isLoading:!1}))}function*ag({accessToken:e,user:t}){if(!e)return void(yield gi(ho.setState({user:void 0,isAuthenticated:!1})));const n=Sa.onRedirectTo,{routes:o}=yield bi((e=>e.auth));if(Kp(t)){const e=yield Hp(t);yield gi(ho.setState(e)),n(o.loginUrl,{preserveQueryParams:!0})}}function*rg({payload:e}){const t=[];yield gi(ho.loadSocialLoginsConfigurationV2()),t.push(hi(Uf)),t.push(hi(Bp)),t.push(hi(xf)),t.push(hi(Wp)),t.push(hi(ag,e)),t.push(hi(og)),yield Si(t)}function*lg({payload:e}){const{disableSilentRefresh:t}=yield bi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield hi(Ly.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield gi(ho.setState({user:e,isAuthenticated:!0})),yield gi(ho.loadTenants()),yield gi(ho.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:o,urlStrategy:i}=yield bi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield gi(ho.setState({isLoading:!0}));const a=zy(),r=zy(),l=yield hi(Ky,r);localStorage.setItem(Ot,r);let s=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield sg();c&&(s.endsWith("/")&&(s=s.slice(0,-1)),s+=c);const u=`${ir(n,"/oauth/authorize")}/oauth/authorize`,d=U({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}o(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}(e)}}function*sg(){try{var e,t;if(null!=(e=Sa.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield hi(og);const e=yield bi((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return bp(e)}}catch{}}function*cg({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:o}=yield bi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===o?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield sg();a&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=a);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield hi(Ly.auth.exchangeOAuthTokens,r);yield gi(ho.setState({user:e,isAuthenticated:!0})),yield gi(ho.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield jp()}}function*ug(e){let{payload:{callback:t}}=e,n=Co(e.payload,Tp);try{yield gi(ho.setLoginState({loading:!0}));const e=yield hi(Ly.auth.changePhoneNumberWithVerification,n);yield gi(ho.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({error:Of(e),loading:!1}))}}function*dg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Pp);try{yield gi(ho.setLoginState({loading:!0})),yield hi(Ly.auth.verifyChangePhoneNumber,n),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({error:Of(e),loading:!1}))}}function*yg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Ep);try{yield gi(ho.setLoginState({loading:!0}));const e=yield hi(Ly.auth.passwordlessPreLogin,U({},n,{type:qr.SmsCode}));yield gi(ho.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({error:Of(e),loading:!1})),null==t||t(e)}}function*fg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Ip);try{const{onRedirectTo:e,routes:o}=yield bi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield gi(ho.setLoginState({loading:!0}));const i=yield hi(Ly.auth.passwordlessPreLogin,n),a=Vp[n.type];if(a===Pt.loginWithSmsOtc&&i.resetPhoneNumberToken)return yield gi(ho.setResetPhoneNumberState({resetPhoneNumberToken:i.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(o.resetPhoneNumberUrl);yield gi(ho.setLoginState({step:a,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield gi(ho.setLoginState({error:Of(e),loading:!1})),null==t||t()}}function*pg(){const{publicAuthStrategyPolicy:e}=yield bi((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===yy.Passkeys)))})(t),o="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield hi(Hy,["show-passkeys-new"]);if(!a||!n||o||i)return!1;{const{devices:e}=yield hi(Ly.auth.getWebAuthnDevices);return yield gi(ho.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*gg(e){let{payload:{callback:t,events:n}}=e,o=Co(e.payload,Lp);try{yield gi(ho.setLoginState({loading:!0}));const e=yield hi(Ly.auth.passwordlessPostLogin,o),a=Sa.onRedirectTo,{routes:r}=yield bi((e=>e.auth));if(Kp(e)){const t=yield Hp(e);yield gi(ho.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:o}=yield bi((e=>e.auth)),l=yield hi(Ly.auth.generateLoginResponse,e);var i;e.emailVerified&&(null==n||null==(i=n.userVerified)||i.call(n,{email:l.email,origin:Ef.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield gi(ho.setState({user:l})),yield gi(ho.setLoginState({error:void 0})),yield gi(ho.loadTenants()),yield gi(ho.setState({isLoading:!1})),o.flow===Et.Login?(yield hi(pg))?(yield gi(ho.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield gi(ho.setState({isAuthenticated:!0})),yield jp()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield gi(ho.setLoginState({error:Of(e,"Failed to authenticate")}))}finally{yield gi(ho.setLoginState({loading:!1}))}}function*Sg({payload:e}){try{yield gi(ho.setLoginState({loading:!0}));const{name:t}=yield hi(Ly.auth.verifyInviteToken,e);yield gi(ho.setLoginState({inviteTokenTenantName:t}))}catch(e){yield gi(ho.setLoginState({inviteTokenError:Of(e,"We couldn't verify your invitation")}))}finally{yield gi(ho.setLoginState({loading:!1}))}}function*vg({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:o}}){yield gi(ho.setLoginState({loading:!0}));try{const i=yield bi((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield hi(Ly.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Uy.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield bi((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield gi(ho.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{i(e,{refresh:!0})}),2e3)}else yield hg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}catch(i){yield hg({email:e,recaptchaToken:t,callback:o,invitationToken:n})}}function*hg(e){let{callback:t}=e,n=Co(e,Op);const o=yield bi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==o||!o.authStrategy)return yield gi(ho.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==o?void 0:o.authStrategy)===qr.EmailAndPassword?(yield gi(ho.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[qr.MagicLink,qr.Code,qr.SmsCode].includes(null==o?void 0:o.authStrategy)?yield gi(ho.passwordlessPreLogin(U({},n,{type:null==o?void 0:o.authStrategy,callback:t}))):(yield gi(ho.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*mg({payload:{callback:e}}){try{yield gi(ho.setLoginState({loading:!0}));const{options:t}=yield hi(Ly.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield gi(ho.setLoginState({error:Of(t)})),null==e||e(null)}finally{yield gi(ho.setLoginState({loading:!1}))}}function*Ag(e){let{payload:{callback:t}}=e,n=Co(e.payload,wp);try{yield gi(ho.setLoginState({loading:!0}));const e=Tt(n.publicKey),o="platform"===(null==e?void 0:e.authenticatorAttachment)?fy.Platform:fy.CrossPlatform;yield hi(Ly.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:o}),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({error:Of(e)})),null==t||t(null)}finally{yield gi(ho.setLoginState({loading:!1}))}}function*bg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Up);try{var o;yield gi(ho.setPasskeysState({loading:!0})),yield gi(ho.setLoginState({loading:!0}));const{options:e}=yield hi(Ly.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(o=e.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)}))),yield gi(ho.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield gi(ho.setLoginState({error:Of(e)})),null==t||t(null)}finally{yield gi(ho.setPasskeysState({loading:!1})),yield gi(ho.setLoginState({loading:!1}))}}function*kg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Cp);try{var o;yield gi(ho.setPasskeysState({loading:!0})),yield gi(ho.setLoginState({loading:!0}));const e=Tt(n.publicKey),i=yield hi(Ly.auth.webAuthnPostLogin,U({},e,{response:U({},e.response,{userHandle:null!=(o=e.response.userHandle)?o:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Kp(i)){const e=Sa.onRedirectTo,{routes:t}=yield bi((e=>e.auth)),n=yield Hp(i);yield gi(ho.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield hi(Ly.auth.generateLoginResponse,i);e.id&&localStorage.setItem("userId",e.id),yield gi(ho.loadTenants()),yield gi(ho.setState({user:e,isAuthenticated:!0})),yield gi(ho.setLoginState({error:void 0})),yield jp(),null==t||t(!0)}}catch(e){yield gi(ho.setLoginState({error:Of(e)})),null==t||t(null)}finally{yield gi(ho.setPasskeysState({loading:!1})),yield gi(ho.setLoginState({loading:!1}))}}function*Tg({payload:e}){const{onRedirectTo:t,routes:n}=yield bi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield gi(ho.setLoginState({loading:!0}));try{const t=yield hi(Ly.auth.postLogin,e);Sa.setAccessToken(t.accessToken),Sa.setUser(t),yield gi(ho.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield jp()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield gi(ho.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*Pg({payload:{email:e,password:t,recaptchaToken:n,invitationToken:o,callback:i}}){yield gi(ho.setLoginState({loading:!0}));try{const a=yield hi(Ly.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:o});Sa.setAccessToken(a.accessToken),Sa.setUser(a);const r=Sa.onRedirectTo,{routes:l}=yield bi((e=>e.auth));if(Kp(a)){const e=yield Hp(a);yield gi(ho.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield bi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield gi(ho.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===Et.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield gi(ho.loadTenants()),n&&t.flow===Et.Login&&((yield hi(pg))?(yield gi(ho.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield jp())}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Sa.setAccessToken(null),Sa.setUser(null),null==i||i(!1,t),yield gi(ho.setLoginState({email:e,error:Of(t),loading:!1}))}}function*Eg({payload:{mfaToken:e,value:t,rememberDevice:n,callback:o}}){yield gi(ho.setLoginState({loading:!0}));try{const i=yield hi(Ly.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield bi((e=>e.auth)),r=a.flow===Et.Login?Pt.success:a.step;yield gi(ho.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:i,isAuthenticated:!0})),i.id&&localStorage.setItem("userId",i.id),yield gi(ho.loadTenants()),yield gi(ho.setLoginState({error:void 0,loading:!1})),a.flow===Et.Login&&((yield hi(pg))?yield gi(ho.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield jp()),null==o||o(!0)}catch(e){yield gi(ho.setLoginState({error:Of(e),loading:!1})),null==o||o(!1,e)}}function*Ig({payload:e}){yield gi(ho.setLoginState({loading:!0}));try{var t;yield hi(Ly.auth.recoverMfaToken,e),yield gi(ho.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield gi(ho.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setLoginState({error:Of(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lg({payload:e}){const{hostedLoginBox:t}=yield bi((e=>e.auth));yield gi(ho.setState({isLoading:!0}));try{t?yield hi(Ly.auth.OAuthLogout):yield hi(Ly.auth.logout)}catch{}yield gi(ho.resetState()),yield gi(ho.requestAuthorize(!0)),null==e||e()}function*Og({payload:e}){var t;try{yield hi(Ly.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*wg({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 gi(ho.setMfaState(n)),yield gi(ho.setUser(e)),yield gi(ho.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ug({user:e,tenants:t}){const{loginState:n}=yield bi((e=>e.auth));yield gi(ho.setUser(e)),yield gi(ho.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:o}=yield bi((e=>e.auth.mfaState));if(n.flow===Et.Login){const e=yield hi(pg);o===an.smsVerifyCode&&e?yield gi(ho.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield jp()}yield gi(ho.setState({isAuthenticated:!0}))}function*Cg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Dp);yield gi(ho.setLoginState({loading:!0}));try{const e=yield hi(Ly.auth.preEnrollMFASMSForLogin,n);yield gi(ho.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Dg(e){let{payload:{callback:t}}=e,n=Co(e.payload,_p);yield gi(ho.setLoginState({loading:!0}));try{const e=yield hi(Ly.auth.enrollMFASMSForLogin,n),o=yield hi(Ly.auth.generateLoginResponseV2,e);yield wg(o),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*_g(e){let{payload:{callback:t}}=e,n=Co(e.payload,Rp);yield gi(ho.setLoginState({loading:!0}));try{var o;const e=yield hi(Ly.auth.preEnrollMFAWebAuthnForLogin,n),i=U({},e.options,{challenge:kt(e.options.challenge),user:U({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(o=e.options.excludeCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield gi(ho.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Rg(e){let{payload:{callback:t}}=e,n=Co(e.payload,Np);yield gi(ho.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),o=yield hi(Ly.auth.enrollMFAWebAuthnForLogin,U({},n,{options:e})),i=yield hi(Ly.auth.generateLoginResponseV2,o);yield wg(i),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Ng(e){let{payload:{callback:t}}=e,n=Co(e.payload,Mp);yield gi(ho.setLoginState({loading:!0}));try{const e=yield hi(Ly.auth.enrollMFAAuthenticatorAppForLogin,n),o=yield hi(Ly.auth.generateLoginResponseV2,e);yield wg(o),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Mg(e){let{payload:{callback:t,deviceId:n}}=e,o=Co(e.payload,Fp);yield gi(ho.setLoginState({loading:!0}));try{const e=yield hi(Ly.auth.preVerifyMFASMSForLogin,n,o);yield gi(ho.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Fg(e){let{payload:{callback:t,deviceId:n}}=e,o=Co(e.payload,Gp);yield gi(ho.setLoginState({loading:!0}));try{const e=yield hi(Ly.auth.verifyMFASMSForLogin,n,o),i=yield hi(Ly.auth.generateLoginResponseV2,e);yield Ug(i),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*Gg(e){let{payload:{callback:t,deviceId:n}}=e,o=Co(e.payload,$p);yield gi(ho.setLoginState({loading:!0}));try{var i;const e=yield hi(Ly.auth.preVerifyMFAWebAuthnForLogin,n,o),a=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>U({},e,{id:kt(e.id)})))});yield gi(ho.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*$g(e){let{payload:{callback:t,deviceId:n}}=e,o=Co(e.payload,xp);yield gi(ho.setLoginState({loading:!0}));try{const e=Tt(o.publicKey),i=yield hi(Ly.auth.verifyMFAWebAuthnForLogin,n,U({},o,{options:e})),a=yield hi(Ly.auth.generateLoginResponseV2,i);yield Ug(a),yield gi(ho.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setLoginState({loading:!1,error:Of(e)})),null==t||t(null)}}function*xg(){yield ga(ho.requestAuthorize,ig),yield ga(ho.requestAuthorizeSSR,rg),yield ga(ho.requestHostedLoginAuthorize,lg),yield ga(ho.handleHostedLoginCallback,cg),yield ga(ho.preLogin,vg),yield ga(ho.postLogin,Tg),yield ga(ho.login,Pg),yield ga(ho.logout,Lg),yield ga(ho.silentLogout,Og),yield ga(ho.loginWithMfa,Eg),yield ga(ho.recoverMfa,Ig),yield ga(ho.quickSmsPasswordlessPreLogin,yg),yield ga(ho.changePhoneNumberWithVerification,ug),yield ga(ho.verifyChangePhoneNumber,dg),yield ga(ho.passwordlessPreLogin,fg),yield ga(ho.passwordlessPostLogin,gg),yield ga(ho.verifyInviteToken,Sg),yield ga(ho.webAuthnPrelogin,bg),yield ga(ho.webAuthnPostLogin,kg),yield ga(ho.webAuthnCreateNewDeviceSession,mg),yield ga(ho.webAuthnVerifyNewDeviceSession,Ag),yield ga(ho.afterAuthNavigation,jp),yield ga(ho.getUserIP,ng),yield ga(ho.preEnrollMFASMSForLogin,Cg),yield ga(ho.enrollMFASMSForLogin,Dg),yield ga(ho.preEnrollMFAWebAuthnForLogin,_g),yield ga(ho.enrollMFAWebAuthnForLogin,Rg),yield ga(ho.enrollMFAAuthenticatorAppForLogin,Ng),yield ga(ho.preVerifyMFASMSForLogin,Mg),yield ga(ho.verifyMFASMSForLogin,Fg),yield ga(ho.preVerifyMFAWebAuthnForLogin,Gg),yield ga(ho.verifyMFAWebAuthnForLogin,$g)}function*Vg({payload:e}){e&&(yield gi(ho.setState({isLoading:!0})));const t=Zy;yield gi(ho.loadTenants()),yield gi(ho.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*jg({payload:{callback:e}}){try{const{ip:t}=bf[0];yield gi(ho.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Wg(){yield ga(ho.requestAuthorize,Vg),yield ga(ho.afterAuthNavigation,jp),yield ga(ho.getUserIP,jg)}const Bg=["callback","samlVendor"],Kg=["callback","samlVendor"];function*zg(){try{var e,t;yield gi(ho.setSSOState({loading:!0}));const n=yield hi(Ly.auth.getSamlConfiguration),o=yield hi(Ly.auth.getOidcConfiguration),i=yield hi(Ly.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield gi(ho.setSSOState({samlConfiguration:n,oidcConfiguration:o,loading:!1,firstLoad:!1}))}catch(e){yield gi(ho.setSSOState({error:Of(e),loading:!1}))}}function*qg({payload:e}){const t=yield bi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield gi(ho.setSSOState({error:void 0,[n]:!0}));try{const o=yield qy(e[0]),i=yield hi(Ly.auth.updateSamlVendorMetadata,{metadata:o});i.isSamlActive=null==t?void 0:t.isSamlActive,yield gi(ho.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield gi(ho.setSSOState({samlConfiguration:t,error:Of(e),[n]:!1}))}}function*Hg({payload:e}){const{configFile:t,callback:n}=e,o=yield bi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield gi(ho.setSSOState({error:void 0,[i]:!0}));try{const e=yield qy(t),a=yield hi(Ly.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==o?void 0:o.isSamlActive,yield gi(ho.setSSOState({samlConfiguration:a,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield gi(ho.setSSOState({samlConfiguration:o,error:Of(e),[i]:!1})),null==n||n(null,e)}}function*Jg({payload:e}){const{callback:t,samlVendor:n}=e,o=Co(e,Bg),i=yield bi((e=>e.auth.ssoState.samlConfiguration)),a=U({},i,o);let r="saving";(null==a?void 0:a.enabled)!==i.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield gi(ho.setSSOState({samlConfiguration:U({},i,a)})));if(yield gi(ho.setSSOState({error:void 0,[r]:!0})),e.type===Uy.Saml){var l,s;const e=yield hi(Ly.metadata.getSamlMetadata);a.acsUrl=null==e||null==(l=e.configuration)?void 0:l.acsUrl,a.spEntityId=null==e||null==(s=e.configuration)?void 0:s.spEntityId}const o=By(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==o?void 0:o.domain)&&(o.ssoEndpoint="",o.publicCertificate="",o.signRequest=!1),o.type=null==n?void 0:n.toLowerCase();const c=yield hi(Ly.auth.updateSamlConfiguration,o);c.isSamlActive=null==i?void 0:i.isSamlActive,yield gi(ho.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield gi(ho.setSSOState({samlConfiguration:i,error:Of(e),[r]:!1})),null==t||t(null,e)}}function*Yg({payload:{callback:e}={}}){const t=yield bi((e=>e.auth.ssoState.samlConfiguration));try{yield gi(ho.setSSOState({error:void 0,saving:!0})),yield hi(Ly.auth.validateSamlDomain),yield gi(ho.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield gi(ho.setSSOState({samlConfiguration:U({},t,{validated:!1}),error:Of(n),saving:!1})),null==e||e(null,n)}}function*Qg(){try{const e=yield hi(Ly.auth.getSamlRoles),t=yield hi(Ly.auth.getSamlRolesGroups);yield gi(ho.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield gi(ho.setSSOState({error:Of(e)}))}}function*Xg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield gi(ho.setSSOState({error:void 0,saving:!0})),yield hi(Ly.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Si(e.map((e=>hi(Ly.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield gi(ho.setSSOState({error:Of(e)}))}}(n)),yield Qg(),yield gi(ho.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield gi(ho.setSSOState({error:Of(t),saving:!1})),null==e||e(null,t)}}function*Zg({payload:{callback:e,id:t}}){try{yield gi(ho.setSSOState({error:void 0,saving:!0})),yield hi(Ly.auth.deleteSamlGroup,{id:t}),yield Qg(),yield gi(ho.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield gi(ho.setSSOState({error:Of(t),saving:!1})),null==e||e(null,t)}}function*eS({payload:{group:e,roleIds:t,callback:n}}){try{yield gi(ho.setSSOState({error:void 0,saving:!0})),yield hi(Ly.auth.createSamlGroup,{group:e,roleIds:t}),yield Qg(),yield gi(ho.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield gi(ho.setSSOState({error:Of(e),saving:!1})),null==n||n(null,e)}}function*tS({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield gi(ho.setSSOState({loading:!0})),yield hi(Ly.auth.oidcPostLoginV2,t),yield hi(Yp),yield gi(ho.setSSOState({loading:!1}))}catch(e){yield gi(ho.setSSOState({loading:!1,error:Of(e,"Failed to authenticate"),firstLoad:!1}))}}function*nS(){yield fa(ho.loadSSOConfigurations,zg),yield fa(ho.saveSSOConfigurations,Jg),yield fa(ho.saveSSOConfigurationsFile,qg),yield fa(ho.saveSSOConfigurationsFileWithCallback,Hg),yield fa(ho.validateSSODomain,Yg),yield fa(ho.loadSSOAuthorizationRoles,Qg),yield fa(ho.updateSSOAuthorizationRoles,Xg),yield fa(ho.deleteSamlGroup,Zg),yield fa(ho.createSamlGroup,eS),yield fa(ho.oidcPostlogin,tS)}function*oS(){yield gi(ho.setSSOState({loading:!0})),yield mt(),yield gi(ho.setSSOState({samlConfiguration:lf,loading:!1,firstLoad:!1}))}function*iS({payload:e}){const t="saving";yield gi(ho.setSSOState({error:void 0,[t]:!0}));const n=U({},yield bi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield gi(ho.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*aS({payload:e}){var t,n;const{callback:o,samlVendor:i}=e,a=Co(e,Kg),r=uf.samlConfiguration,l=U({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield gi(ho.setSSOState({samlConfiguration:U({},r,l)})));yield gi(ho.setSSOState({error:void 0,[s]:!0})),yield mt(),l.acsUrl=null==sf||null==(t=sf.configuration)?void 0:t.acsUrl,l.spEntityId=null==sf||null==(n=sf.configuration)?void 0:n.spEntityId;const c=By(l,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield mt(),yield gi(ho.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==o||o(!0)}function*rS({payload:{callback:e}={}}){const t=uf.samlConfiguration;yield gi(ho.setSSOState({error:void 0,saving:!0})),yield mt(),yield gi(ho.setSSOState({samlConfiguration:U({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lS(){yield mt(),yield gi(ho.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*sS({payload:{callback:e,authorizationRoles:t}}){yield gi(ho.setSSOState({error:void 0,saving:!0})),yield mt(),yield gi(ho.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*cS(){yield fa(ho.loadSSOConfigurations,oS),yield fa(ho.saveSSOConfigurations,aS),yield fa(ho.saveSSOConfigurationsFile,iS),yield fa(ho.validateSSODomain,rS),yield fa(ho.loadSSOAuthorizationRoles,lS),yield fa(ho.updateSSOAuthorizationRoles,sS)}const uS=["callback"],dS=["callback","ssoConfigId"],yS=["callback","ssoConfigId"],fS=["callback","ssoConfigId"];function*pS(){try{return yield hi(Ly.auth.getOidcConfiguration)}catch(e){return null}}function*gS(){try{return yield hi(Ly.metadata.getSamlMetadata)}catch(e){return null}}function*SS(){try{yield gi(ho.setSSOLoader({key:wy.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Si([hi(pS),hi(gS)]),n=yield hi(Ly.auth.getSSOConfigurations);yield gi(ho.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield gi(ho.setSSOError({key:wy.LOAD_SSO_CONFIGURATIONS,value:Of(e)}))}finally{yield gi(ho.setSSOLoader({key:wy.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*vS({payload:e}){yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Co(e,uS),o=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield hi(Ly.auth.createSSOConfiguration,U({},n,{enabled:null!=(i=n.enabled)&&i}));yield gi(ho.setSSOState({ssoConfigurations:[...o,e]})),null==t||t(e)}catch(e){yield gi(ho.setSSOError({key:wy.SAVE_SSO_CONFIGURATION,value:Of(e)})),null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION,value:!1}))}}function*hS({payload:e}){yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,o=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield qy(t),i=yield hi(Ly.auth.createSSOConfigurationByMetadata,{metadata:e});yield gi(ho.setSSOState({ssoConfigurations:[...o,i]})),null==n||n(i)}catch(e){yield gi(ho.setSSOError({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Of(e)})),null==n||n(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*mS({payload:e}){yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Co(e,dS),i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield hi(Ly.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t));yield gi(ho.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield gi(ho.setSSOError({key:wy.UPDATE_SSO_CONFIGURATION,value:Of(e)})),null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*AS({payload:e}){yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:o}=e,i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield qy(o),a=yield hi(Ly.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?a:e));yield gi(ho.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield gi(ho.setSSOError({key:wy.UPDATE_SSO_CONFIGURATION,value:Of(e)})),null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*bS({payload:e}){yield gi(ho.setSSOLoader({key:wy.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,o=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{yield hi(Ly.auth.deleteSSOConfiguration,t),yield gi(ho.setSSOState({ssoConfigurations:o.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield gi(ho.setSSOError({key:wy.DELETE_SSO_CONFIGURATION,value:Of(e)})),null==n||n(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.DELETE_SSO_CONFIGURATION,value:!1}))}}function*kS({payload:e}){const{callback:t,ssoConfigId:n}=e,o=Co(e,yS);yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_DOMAIN,value:!0}));const i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield hi(Ly.auth.createSSODomain,n,o),a=i.map((t=>t.id===n?U({},t,{domains:[...t.domains,e]}):t));yield gi(ho.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield gi(ho.setSSOError({key:wy.SAVE_SSO_DOMAIN,value:Of(e)})),null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_DOMAIN,value:!1}))}}function*TS({payload:e}){const{ssoConfigId:t,domainId:n,callback:o}=e;yield gi(ho.setSSOLoader({key:wy.DELETE_SSO_DOMAIN,value:!0}));const i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{yield hi(Ly.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?U({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield gi(ho.setSSOState({ssoConfigurations:e})),null==o||o(!0)}catch(e){yield gi(ho.setSSOError({key:wy.DELETE_SSO_DOMAIN,value:Of(e)})),null==o||o(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.DELETE_SSO_DOMAIN,value:!1}))}}function*PS({payload:e}){const{callback:t,domainId:n,ssoConfigId:o}=e;yield gi(ho.setSSOLoader({key:wy.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{yield hi(Ly.auth.validateSSODomain,o,n);const e=i.map((e=>e.id===o?U({},e,{domains:e.domains.map((e=>e.id===n?U({},e,{validated:!0}):e))}):e));yield gi(ho.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield gi(ho.setSSOError({key:wy.VALIDATE_SSO_DOMAIN,value:Of(e)})),null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.VALIDATE_SSO_DOMAIN,value:!1}))}}function*ES({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const o=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{yield hi(Ly.auth.setSSODefaultRoles,t,{roleIds:n});const i=o.map((e=>e.id===t?U({},e,{roleIds:n}):e));yield gi(ho.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield gi(ho.setSSOError({key:wy.UPDATE_SSO_DEFAULT_ROLES,value:Of(t)})),null==e||e(null,t)}finally{yield gi(ho.setSSOLoader({key:wy.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*IS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:o}}){yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_GROUPS,value:!0}));const i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{yield Si(t.map((e=>hi(Ly.auth.deleteSSOGroup,n,e)))),yield Si(e.map((e=>hi(Ly.auth.createSSOGroup,n,e))));const a=yield hi(Ly.auth.getSSOGroups,n),r=i.map((e=>e.id===n?U({},e,{groups:a}):e));yield gi(ho.setSSOState({ssoConfigurations:r})),null==o||o(!0)}catch(e){yield gi(ho.setSSOError({key:wy.SAVE_SSO_GROUPS,value:Of(e)})),null==o||o(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_GROUPS,value:!1}))}}function*LS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Si(t.map((t=>hi(Ly.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield gi(ho.setSSOError({key:wy.SAVE_SSO_GROUPS,value:Of(e)})),null==n||n(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_GROUPS,value:!1}))}}function*OS({payload:e}){yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:o,callback:i}=e,a=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield hi(lr,t,void 0,{responseType:"plain"}),configMetadata:n};let r,l;o?(r=yield hi(Ly.auth.updateSSOConfigurationByMetadata,o,e),l=a.map((e=>e.id===o?r:e))):(r=yield hi(Ly.auth.createSSOConfigurationByMetadata,e),l=[r,...a]),yield gi(ho.setSSOState({ssoConfigurations:l})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wS({payload:e}){yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,o=Co(e,fS),i=yield bi((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield hi(Ly.auth.updateSSOConfiguration,n,o),a=i.map((t=>t.id===n?e:t))):(e=yield hi(Ly.auth.createSSOConfiguration,o),a=[e,...i]),yield gi(ho.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield gi(ho.setSSOLoader({key:wy.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*US(){yield fa(ho.loadSSOConfigurationsV2,SS),yield fa(ho.saveSSOConfigurationV2,vS),yield fa(ho.saveSSODomain,kS),yield fa(ho.deleteSSODomain,TS),yield fa(ho.validateSSODomainV2,PS),yield fa(ho.updateSSOConfiguration,mS),yield fa(ho.deleteSSOConfiguration,bS),yield fa(ho.setSSOGroups,IS),yield fa(ho.updateSSOGroups,LS),yield fa(ho.setSSODefaultRoles,ES),yield fa(ho.saveSSOConfigurationByMetadata,hS),yield fa(ho.updateSSOConfigurationByMetadata,AS),yield fa(ho.saveSSOConfigurationByUrl,OS),yield fa(ho.saveSSOConfigurationByData,wS)}const CS=["callback","profilePictureUrl"],DS=["callback","profilePictureUrl"];function*_S(){yield gi(ho.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return hi.apply(void 0,[ya,e,t,n].concat(i))}(3,2e3,Ly.teams.getProfile),t=yield bi((e=>e.auth.user));ho.setUser(U({},t,e)),yield gi(ho.setProfileState({profile:e,loading:!1}))}catch(e){yield gi(ho.setProfileState({loading:!1,error:Of(e)}))}}function*RS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Co(e.payload,CS);yield gi(ho.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield bi((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const o=`image/${n[1]}`,i=function(e,t){const n=atob(e),o=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);o.push(new Uint8Array(i))}return new Blob(o,{type:t})}(n[2],o),a=new FormData;return a.append(t,new File([i],t,{type:o})),a}(n,"image");if(e){i=yield hi(Ly.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const a=U({},e,o,{profilePictureUrl:i}),r=yield hi(Ly.teams.updateProfile,a),l=yield bi((e=>e.auth.user));yield gi(ho.setUser(U({},l,r))),yield gi(ho.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield gi(ho.setProfileState({saving:!1,error:Of(e),loading:!1})),null==t||t(null,e)}}function*NS({payload:e}){yield gi(ho.setProfileState({loading:!0}));try{var t;yield hi(Ly.teams.changePassword,e),yield gi(ho.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setProfileState({loading:!1,error:Of(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*MS(){yield ga(ho.loadProfile,_S),yield fa(ho.saveProfile,RS),yield fa(ho.changePassword,NS)}function*FS(){yield gi(ho.setProfileState({loading:!0})),yield mt(),yield gi(ho.setUser(U({},Zy,Xy))),yield gi(ho.setProfileState({loading:!1,profile:Xy}))}function*GS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,o=Co(e.payload,DS);yield gi(ho.setProfileState({saving:!0,error:null}));const i=ef;let a=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=U({},i.profile,o,{profilePictureUrl:a}),l=Zy;yield mt(),yield gi(ho.setUser(U({},l,r))),yield gi(ho.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*$S({payload:e}){var t;yield gi(ho.setProfileState({loading:!0})),yield mt(),yield gi(ho.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*xS(){yield ga(ho.loadProfile,FS),yield fa(ho.saveProfile,GS),yield fa(ho.changePassword,$S)}const VS=["callback"],jS=["callback"],WS=["callback"],BS=["deviceId","callback"],KS=["deviceId","callback"],zS=["callback"],qS=["deviceId"],HS=["deviceId"],JS=["callback"],YS=["deviceId"],QS=["callback"];function*XS(e){const{step:t}=yield bi((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*ZS(){yield gi(ho.setMfaState({saving:!0}));try{const{qrCode:e}=yield hi(Ly.auth.enrollMfa);yield gi(ho.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)}))}}function*ev(e){let{payload:{callback:t}}=e,n=Co(e.payload,VS);yield gi(ho.setMfaState({saving:!0}));try{const e=yield bi((e=>e.auth.user)),o=yield hi(Ly.auth.verifyMfa,n),i=yield hi(Ly.auth.getMFADevices),a=yield XS(o);yield gi(ho.setMfaState(U({},a,{mfaDevices:i}))),yield gi(ho.setUser(U({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*tv(e){let{payload:{callback:t}}=e,n=Co(e.payload,jS);yield gi(ho.setMfaState({loading:!0}));try{const e=yield hi(Ly.auth.loginWithMfa,n),o={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(o.recoveryCode=e.recoveryCode),yield gi(ho.setMfaState(o)),yield gi(ho.setState({user:e})),yield gi(ho.loadTenants()),null==t||t(o.recoveryCode)}catch(e){yield gi(ho.setMfaState({loading:!1,error:Of(e)})),null==t||t(null,e)}}function*nv({payload:e}){yield gi(ho.setMfaState({saving:!0}));try{var t;yield hi(Ly.auth.disableMfa,e);const n=yield hi(Ly.auth.getMFADevices);yield gi(ho.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setMfaState({saving:!1,error:Of(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*ov({payload:e}){yield gi(ho.setMfaState({saving:!0}));try{var t,n;const o=yield hi(Ly.auth.preEnrollMFAWebAuthn),i=U({},o.options,{challenge:kt(o.options.challenge),user:U({},o.options.user,{id:kt(o.options.user.id)}),excludeCredentials:null==(t=o.options.excludeCredentials)?void 0:t.map((e=>U({},e,{id:kt(e.id)})))});yield gi(ho.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:o.webauthnToken})}catch(t){var o;yield gi(ho.setMfaState({saving:!1,error:Of(t)})),null==(o=e.callback)||o.call(e,null,t)}}function*iv(e){let{payload:{callback:t}}=e,n=Co(e.payload,WS);yield gi(ho.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),o=yield hi(Ly.auth.enrollMFAWebAuthn,U({},n,{options:e})),i=yield hi(Ly.auth.getMFADevices),a=yield XS(o);yield gi(ho.setMfaState(U({},a,{mfaDevices:i}))),null==t||t(a.recoveryCode)}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*av(e){let{payload:{deviceId:t,callback:n}}=e;Co(e.payload,BS),yield gi(ho.setMfaState({saving:!0}));try{var o;const e=yield hi(Ly.auth.preDisableMFAWebAuthn,t),i=U({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>U({},e,{id:kt(e.id)})))});yield gi(ho.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==n||n(null,e)}}function*rv(e){let{payload:{deviceId:t,callback:n}}=e,o=Co(e.payload,KS);yield gi(ho.setMfaState({saving:!0}));try{const e=Tt(o.publicKey);yield hi(Ly.auth.disableMFAWebAuthn,t,U({},o,{options:e}));const i=yield hi(Ly.auth.getMFADevices);yield gi(ho.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==n||n(!1,e)}}function*lv({payload:e}){yield gi(ho.setMfaState({saving:!0}));try{var t;const n=yield hi(Ly.auth.preEnrollMFASMS,e);yield gi(ho.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 gi(ho.setMfaState({saving:!1,error:Of(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*sv(e){let{payload:{callback:t}}=e,n=Co(e.payload,zS);yield gi(ho.setMfaState({saving:!0}));try{const e=yield hi(Ly.auth.enrollMFASMS,n),o=yield hi(Ly.auth.getMFADevices),i=yield XS(e);yield gi(ho.setMfaState(U({},i,{mfaDevices:o}))),null==t||t(i.recoveryCode)}catch(e){yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*cv(e){let{payload:{deviceId:t}}=e,n=Co(e.payload,qS);yield gi(ho.setMfaState({saving:!0}));try{var o;const e=yield hi(Ly.auth.preDisableMFASMS,t);yield gi(ho.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*uv(e){let{payload:{deviceId:t}}=e,n=Co(e.payload,HS);yield gi(ho.setMfaState({saving:!0}));try{var o;yield hi(Ly.auth.disableMFASMS,t,n);const e=yield hi(Ly.auth.getMFADevices);yield gi(ho.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(o=n.callback)||o.call(n,!0)}catch(e){var i;yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*dv(){yield gi(ho.setMfaState({loading:!0}));try{yield bi((e=>e.auth.user));const e=yield hi(Ly.auth.getMFADevices);yield gi(ho.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield gi(ho.setMfaState({loading:!1,error:Of(e)}))}}function*yv(){yield gi(ho.setMfaState({loading:!0}));try{const e=(yield hi(Ly.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield gi(ho.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield gi(ho.setMfaState({loading:!1,error:Of(e)}))}}function*fv(){yield fa(ho.enrollMfa,ZS),yield fa(ho.getMFADevices,dv),yield fa(ho.getMFAStrategies,yv),yield fa(ho.verifyMfa,ev),yield fa(ho.disableMfa,nv),yield fa(ho.verifyMfaAfterForce,tv),yield fa(ho.preDisableMfaSms,cv),yield fa(ho.disableMfaSms,uv),yield fa(ho.preEnrollMfaSms,lv),yield fa(ho.enrollMfaSms,sv),yield fa(ho.preEnrollMfaWebAuthn,ov),yield fa(ho.enrollMfaWebAuthn,iv),yield fa(ho.preDisableMfaWebAuthn,av),yield fa(ho.disableMfaWebAuthn,rv)}function*pv(){yield gi(ho.setMfaState({saving:!0})),yield gi(ho.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*gv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield bi((e=>e.auth.mfaState));yield gi(ho.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(o.recoveryCode=n.recoveryCode),yield gi(ho.setMfaState(o)),yield gi(ho.setUser(U({},Zy,{mfaEnrolled:!0}))),null==e||e(o.recoveryCode)}function*Sv(e){let{payload:{callback:t}}=e,n=Co(e.payload,JS);yield gi(ho.setMfaState({loading:!0})),yield mt();const o=U({},n,{recoveryCode:"recoveryCode"}),i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield gi(ho.setMfaState(i)),yield mt(),yield gi(ho.setUser(U({},Zy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*vv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield bi((e=>e.auth.mfaState));yield gi(ho.setMfaState({saving:!0})),yield mt(),yield gi(ho.setMfaState({saving:!1,error:void 0,mfaDevices:U({},n,{authenticators:[]})})),yield gi(ho.setUser(U({},Zy))),null==(t=e.callback)||t.call(e,!0)}function*hv(e){let{}=e,t=Co(e.payload,YS);yield gi(ho.setMfaState({saving:!0}));try{var n;yield gi(ho.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var o;yield gi(ho.setMfaState({saving:!1,error:Of(e)})),null==(o=t.callback)||o.call(t,!1,e)}}function*mv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield bi((e=>e.auth.mfaState));yield gi(ho.setMfaState({saving:!0})),yield mt(),yield gi(ho.setMfaState({loading:!1,error:void 0,mfaDevices:U({},n,{phones:[]})})),yield gi(ho.setUser(U({},Zy))),null==(t=e.callback)||t.call(e,!0)}function*Av({payload:e}){var t;yield gi(ho.setMfaState({saving:!0})),yield mt(),yield gi(ho.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*bv(e){let{payload:{callback:t}}=e;Co(e.payload,QS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield bi((e=>e.auth.mfaState));yield gi(ho.setMfaState({saving:!0})),yield mt();const o={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:U({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=o&&o.recoveryCode&&(i.recoveryCode=o.recoveryCode),yield gi(ho.setMfaState(i)),yield gi(ho.setUser(U({},Zy,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*kv(){yield fa(ho.enrollMfa,pv),yield fa(ho.verifyMfa,gv),yield fa(ho.disableMfa,vv),yield fa(ho.verifyMfaAfterForce,Sv),yield fa(ho.preDisableMfaSms,hv),yield fa(ho.disableMfaSms,mv),yield fa(ho.preEnrollMfaSms,Av),yield fa(ho.enrollMfaSms,bv)}const Tv=["callback"];function*Pv({payload:e}){yield gi(ho.setForgotPasswordState({loading:!0}));try{var t;yield hi(Ly.auth.forgotPassword,e),yield gi(ho.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setForgotPasswordState({loading:!1,error:Of(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ev(e){let{payload:{callback:t}}=e,n=Co(e.payload,Tv);yield gi(ho.setForgotPasswordState({loading:!0}));try{yield hi(Ly.auth.resetPassword,n),yield gi(ho.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield gi(ho.setForgotPasswordState({loading:!1,error:Of(e)})),null==t||t(!1,e)}}function*Iv({payload:e}){yield gi(ho.setForgotPasswordState({loading:!0}));try{const t=yield hi(Ly.auth.loadPasswordConfig,e);yield gi(ho.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield gi(ho.setForgotPasswordState({loading:!1,error:Of(e)}))}}function*Lv(){yield ga(ho.forgotPassword,Pv),yield ga(ho.resetPassword,Ev),yield ga(ho.loadPasswordConfig,Iv)}let Ov;!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"}(Ov||(Ov={}));const wv=["callback","events"],Uv=["callback"],Cv=["callback"];function*Dv({payload:{userId:e,token:t}}){yield gi(ho.setActivateState({loading:!0,step:Mt.activating}));try{const{isAuthenticated:n}=yield bi((e=>e.auth));n&&(yield gi(ho.silentLogout()));const o=yield hi(Ly.auth.getActivateAccountStrategy,{userId:e,token:t});yield gi(ho.setActivateStrategyState({strategy:o,loading:!1,error:void 0})),o.shouldSetPassword&&(yield gi(ho.setActivateState({loading:!1,step:Mt.activatingForm})))}catch(e){yield gi(ho.setActivateState({loading:!1,error:Of(e)}))}}function*_v(e){let{payload:{callback:t,events:n}}=e,o=Co(e.payload,wv);yield gi(ho.setActivateState({loading:!0}));try{const e=Sa.onRedirectTo,{routes:a}=yield bi((e=>e.auth)),r=yield hi(Ly.auth.activateAccount,o);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Kp(r)){yield gi(ho.setActivateState({step:Mt.success}));const t=yield Hp(r);yield gi(ho.setState(t)),yield ki(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var i;yield gi(ho.setActivateState({step:Mt.success}));const{user:e,tenants:t}=yield hi(Ly.auth.generateLoginResponseV2,r);null==n||null==(i=n.userVerified)||i.call(n,{email:e.email,origin:Ef.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield gi(ho.setTenantsState({tenants:t,loading:!1})),yield gi(ho.setState({user:e,isAuthenticated:!0})),yield ki(1e3),yield jp(),yield gi(ho.resetActivateState())}null==t||t(!0)}catch(e){yield gi(ho.setActivateState({loading:!1,error:Of(e)}))}}function*Rv({payload:e}){const{callback:t}=e,n=Co(e,Uv);yield gi(ho.setActivateStrategyState({loading:!0}));try{const e=yield hi(Ly.auth.getActivateAccountStrategy,n);yield gi(ho.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield gi(ho.setActivateStrategyState({loading:!1,error:Of(e)}))}}function*Nv({payload:e}){const{callback:t}=e,n=Co(e,Cv);yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:n.email})),yield gi(ho.setActivateState({loading:!0}));try{yield hi(Ly.auth.resendActivationEmail,n),yield gi(ho.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield gi(ho.setActivateState({loading:!1,error:Of(e)})),yield gi(ho.setTeamError({key:Ov.RESEND_ACTIVATE_LINK,value:Of(e)})),null==t||t(null,e.message)}yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:!1}))}function*Mv(){yield ga(ho.activateAccount,_v),yield ga(ho.preActivateAccount,Dv),yield ga(ho.getActivateAccountStrategy,Rv),yield ga(ho.resendActivationEmail,Nv)}function*Fv({payload:e}){if(e.token&&e.userId)try{yield gi(ho.setAcceptInvitationState({error:void 0,step:xt.pending})),yield hi(Ly.auth.acceptInvitation,e),yield gi(ho.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield gi(ho.setAcceptInvitationState({step:xt.failed,error:Of(e)}))}else yield gi(ho.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*Gv(){yield ga(ho.acceptInvitation,Fv)}var $v,xv=new Uint8Array(16);function Vv(){if(!$v&&!($v="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 $v(xv)}for(var jv=/^(?:[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,Wv=function(e){return"string"==typeof e&&jv.test(e)},Bv=[],Kv=0;Kv<256;++Kv)Bv.push((Kv+256).toString(16).substr(1));var zv=function(e,t,n){var o=(e=e||{}).random||(e.rng||Vv)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Bv[e[t+0]]+Bv[e[t+1]]+Bv[e[t+2]]+Bv[e[t+3]]+"-"+Bv[e[t+4]]+Bv[e[t+5]]+"-"+Bv[e[t+6]]+Bv[e[t+7]]+"-"+Bv[e[t+8]]+Bv[e[t+9]]+"-"+Bv[e[t+10]]+Bv[e[t+11]]+Bv[e[t+12]]+Bv[e[t+13]]+Bv[e[t+14]]+Bv[e[t+15]]).toLowerCase();if(!Wv(n))throw TypeError("Stringified UUID is invalid");return n}(o)};let qv,Hv;!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"}(qv||(qv={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Hv||(Hv={}));const Jv=["callback"],Yv=["roles"],Qv=["callback"],Xv=["callback","profileImage"],Zv=["callback"],eh=["callback","userId"],th=["callback"],nh=["callback"],oh=["callback"],ih=["callback"],ah=["callback"],rh=["callback"],lh=["callback"],sh=["callback","profileImage"],ch=["callback"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=()=>bi((e=>e.auth.teamState));function*Sh(){try{const{groups:e}=yield hi(Ly.groups.getGroups,{_groupsRelations:Hv.roles});return e}catch(e){return[]}}function*vh({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield gh(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield gi(ho.setTeamLoader({key:Ov.USERS,value:!a})),yield gi(ho.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:o},{items:i},a]=yield Si([hi(Ly.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),hi(Ly.teams.loadAvailableRoles),hi(Ly.teams.loadAvailablePermissions),hi(Sh)]),l=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return U({},e,{groups:n})}));yield gi(ho.setTeamState({users:l,totalPages:t,totalItems:n,roles:o,permissions:i})),null==r||r(e)}catch(e){yield gi(ho.setTeamError({key:Ov.USERS,value:Of(e)})),yield gi(ho.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield gi(ho.setTeamLoader({key:Ov.USERS,value:!1}))}function*hh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield gh(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(o=e._filter)?o:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield gi(ho.setTeamLoader({key:Ov.USERS,value:!r})),yield gi(ho.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:o},{items:i}]=yield Si([hi(Ly.subTenants.loadAllUsers,U({},c)),hi(Ly.teams.loadAvailableRoles),hi(Ly.teams.loadAvailablePermissions)]);yield gi(ho.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:o,permissions:i})),null==l||l(e)}catch(e){yield gi(ho.setTeamError({key:Ov.USERS,value:Of(e)})),yield gi(ho.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield gi(ho.setTeamLoader({key:Ov.USERS,value:!1}))}function*mh({payload:e}){yield gi(ho.setTeamLoader({key:Ov.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:o}]=yield Si([hi(Ly.teams.loadAvailableRoles),hi(Ly.teams.loadAvailablePermissions)]);yield gi(ho.setTeamState({roles:n,permissions:o})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:o})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield gi(ho.setTeamError({key:Ov.ROLES_AND_PERMISSIONS,value:Of(t)}))}yield gi(ho.setTeamLoader({key:Ov.ROLES_AND_PERMISSIONS,value:!0}))}function*Ah({payload:e}){const{callback:t}=e,n=Co(e,Jv),o=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{var i;const e=yield hi(Ly.teams.addUser,n),{roles:a}=e,r=U({},Co(e,Yv),{roleIds:null!=(i=null==a?void 0:a.map((e=>e.id)))?i:[]});null==t||t(r),yield gi(ho.setTeamState({users:[r,...o.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:Of(e)})})),null==t||t(null,e.message)}}function*bh({payload:e}){const{callback:t}=e,n=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},n.addUserDialogState,{loading:!0})}));const o=[],i=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield gi(ho.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield hi(Ly.teams.addUser,t),o.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield gi(ho.loadUsers(r)),yield gi(ho.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:o})}function*kh({payload:e}){const{callback:t}=e,n=Co(e,Qv),o=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})}));try{yield hi(Ly.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:o,totalItems:i}}=yield hi(Ly.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield gi(ho.setTeamState({allUsers:e,totalPages:o,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!1,error:Of(e)})})),null==t||t(null,e.message)}}function*Th({payload:e}){const{callback:t}=e,n=Co(e,Xv),{id:o}=n,i=yield gh(),a=i.users.find((e=>e.id===n.id));yield gi(ho.setTeamLoader({key:Ov.UPDATE_USER,value:o||""})),yield gi(ho.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})})),yield gi(ho.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?U({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield hi(Ly.teams.updateUser,n);null==t||t(e),yield gi(ho.setTeamState({users:i.users.map((t=>t.id===e.id?U({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield gi(ho.setTeamLoader({key:Ov.UPDATE_USER,value:!1}))}catch(e){yield gi(ho.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Of(e)}),users:i.users.map((e=>e.id===n.id?U({},e,a):e))})),yield gi(ho.setTeamLoader({key:Ov.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Ph({payload:e}){const{callback:t}=e,n=Co(e,Zv),o=yield gh();yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield hi(Ly.teams.deleteUser,n),null==t||t(!0),yield gi(ho.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:Of(e)})})),null==t||t(null,e.message)}}function*Eh({payload:e}){const{callback:t,userId:n}=e,o=Co(e,eh),i=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!0})}));try{yield hi(Ly.subTenants.setUserRolesForSubTenants,n,o);const e=i.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return U({},e,{roles:(null==(t=o.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield gi(ho.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[U({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield gi(ho.setTeamState({addUserDialogState:U({},i.addUserDialogState,{loading:!1,error:Of(e)})})),null==t||t(null,e.message)}}function*Ih({payload:e}){const{callback:t}=e,n=Co(e,th),o=yield gh();yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})}));try{yield hi(Ly.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield gi(ho.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!1,error:Of(e)})})),null==t||t(null,e.message)}}function*Lh({payload:e}){const{callback:t}=e,n=Co(e,nh);yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield hi(Ly.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield gi(ho.setTeamError({key:Ov.RESEND_ACTIVATE_LINK,value:Of(e)})),null==t||t(null,e.message)}yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:!1}))}function*Oh({payload:e}){const{callback:t}=e,n=Co(e,oh);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email}));try{yield hi(Ly.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield gi(ho.setTeamError({key:Ov.RESEND_INVITATION_LINK,value:Of(e)})),null==t||t(null,e.message)}yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*wh({payload:e}){const{callback:t}=e,n=Co(e,ih);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email}));try{yield hi(Ly.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield gi(ho.setTeamError({key:Ov.RESEND_INVITATION_LINK,value:Of(e)})),null==t||t(null,e.message)}yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*Uh({payload:e}){const{callback:t}=e,n=Co(e,ah);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email}));try{yield hi(Ly.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield gi(ho.setTeamError({key:Ov.RESEND_INVITATION_LINK,value:Of(e)})),null==t||t(null,e.message)}yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*Ch(){yield gi(ho.setTeamError({key:Ov.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield hi(Ly.teams.getInviteLinkConfiguration);yield gi(ho.setTeamState({inviteTokenState:U({},e)}))}catch(e){yield gi(ho.setTeamError({key:Ov.CONFIG_TOKEN_LINK,value:Of(e)}))}}function*Dh(){yield gi(ho.setTeamError({key:Ov.GET_TOKEN_LINK,value:!1}));try{yield hi(Ch);const e=yield hi(Ly.teams.getInviteUserLink),{inviteTokenState:t}=yield gh();yield gi(ho.setTeamState({inviteTokenState:U({},t,e)}))}catch(e){yield gi(ho.setTeamError({key:Ov.GET_TOKEN_LINK,value:Of(e)}))}}function*_h({payload:{callback:e}}){yield gi(ho.setTeamError({key:Ov.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield gh();try{const n=yield hi(Ly.teams.createInviteUserLink,{expiresInMinutes:43200});yield gi(ho.setTeamState({inviteTokenState:U({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield gi(ho.setTeamError({key:Ov.CREATE_TOKEN_LINK,value:Of(t)}))}}function*Rh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:o}=yield gh();yield gi(ho.setTeamError({key:Ov.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield hi(Ly.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield gi(ho.setTeamState({inviteTokenState:U({},o,i)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield gi(ho.setTeamError({key:Ov.UPDATE_TOKEN_LINK,value:Of(t)}))}}function*Nh({payload:e}){const{callback:t}=null!=e?e:{};yield gi(ho.setTeamError({key:Ov.DELETE_TOKEN_LINK,value:!1}));try{yield hi(Ly.teams.deleteInviteUserLink),yield gi(ho.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield gi(ho.setTeamError({key:Ov.DELETE_TOKEN_LINK,value:Of(e)})),null==t||t(!1,e.message)}}function*Mh({payload:e}){yield gi(ho.setTeamState({addUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*Fh({payload:e}){const t=yield gh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield gi(ho.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gh({payload:e}){yield gi(ho.setTeamState({deleteUserDialogState:U({open:!0,loading:!1,error:!1},e)}))}function*$h({payload:e}){const t=yield gh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield gi(ho.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*xh(){yield pa(ho.loadUsers,vh),yield pa(ho.loadAllSubTenantsUsers,hh),yield pa(ho.loadRoles,mh),yield fa(ho.addUser,Ah),yield fa(ho.addUsersBulk,bh),yield fa(ho.addUserToSubTenants,kh),yield fa(ho.updateUser,Th),yield fa(ho.setUserRolesForSubTenants,Eh),yield fa(ho.deleteUser,Ph),yield fa(ho.deleteUserFromSubTenants,Ih),yield fa(ho.resendActivationLink,Lh),yield fa(ho.resendInvitationLink,Oh),yield fa(ho.resendInvitationEmail,wh),yield fa(ho.resendInvitationLinkToAllSubTenants,Uh),yield fa(ho.getInvitationLink,Dh),yield fa(ho.createInvitationLink,_h),yield fa(ho.updateInvitationLink,Rh),yield fa(ho.deleteInvitationLink,Nh),yield fa(ho.openAddUserDialog,Mh),yield fa(ho.closeAddUserDialog,Fh),yield fa(ho.openDeleteUserDialog,Gh),yield fa(ho.closeDeleteUserDialog,$h)}function*Vh({payload:e}){var t,n,o,i;const{silentLoading:a,callback:r}=e,l=yield gh(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(o=e.filter)?o:l.filter,d=null!=(i=e.sort)?i:l.sort;yield gi(ho.setTeamLoader({key:Ov.USERS,value:!a})),yield gi(ho.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield mt(),yield gi(ho.setTeamState({users:gf,totalPages:2,totalItems:10,roles:cf,permissions:df})),yield gi(ho.setTeamLoader({key:Ov.USERS,value:!1})),null==r||r(gf)}function*jh({payload:e}){var t,n,o,i,a;const{silentLoading:r,callback:l}=e,s=yield gh(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(o=e._filter)?o:s.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield gi(ho.setTeamLoader({key:Ov.USERS,value:!r})),yield gi(ho.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield gi(ho.setTeamState({allUsers:Sf,totalPages:2,totalItems:10,roles:cf,permissions:df})),yield gi(ho.setTeamLoader({key:Ov.USERS,value:!1})),null==l||l(Sf)}function*Wh({payload:e}){var t;yield gi(ho.setTeamLoader({key:Ov.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield gi(ho.setTeamState({roles:cf,permissions:df})),yield gi(ho.setTeamLoader({key:Ov.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:cf,permissions:df})}function*Bh({payload:e}){const{callback:t}=e,n=Co(e,rh),o=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},ff,{groups:[]},n,{id:`${zv()}`});null==t||t(i),yield gi(ho.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kh({payload:e}){const{callback:t}=e,n=Co(e,lh),o=yield gh();yield gi(ho.setTeamState({addUserDialogState:U({},o.addUserDialogState,{loading:!0})})),yield mt();const i=U({},ff,n,{id:`${zv()}`});yield gi(ho.setTeamState({users:[i,...o.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*zh({payload:e}){var t;const{callback:n}=e,o=Co(e,sh),{id:i}=o,a=yield gh(),r=a.users.find((e=>e.id===o.id));yield gi(ho.setTeamLoader({key:Ov.UPDATE_USER,value:i||""})),yield gi(ho.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0})})),yield gi(ho.setTeamState({addUserDialogState:U({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===o.id?U({},e,o):e))})),r.roleIds.length>0&&0===(null==(t=o.roleIds)?void 0:t.length)&&(o.roleIds=[""]),yield mt();const l=U({},r,o);null==n||n(l),yield gi(ho.setTeamState({users:a.users.map((e=>e.id===l.id?U({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield gi(ho.setTeamLoader({key:Ov.UPDATE_USER,value:!1}))}function*qh({payload:e}){const{callback:t}=e,n=Co(e,ch),o=yield gh();yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield gi(ho.setTeamState({users:o.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Hh({payload:e}){const{callback:t}=e,n=Co(e,uh),o=yield gh();yield gi(ho.setTeamState({deleteUserDialogState:U({},o.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield gi(ho.setTeamState({allUsers:o.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Jh({payload:e}){const{callback:t}=e,n=Co(e,dh);yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield gi(ho.setTeamLoader({key:Ov.RESEND_ACTIVATE_LINK,value:!1}))}function*Yh({payload:e}){const{callback:t}=e,n=Co(e,yh);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*Qh({payload:e}){const{callback:t}=e,n=Co(e,fh);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*Xh({payload:e}){const{callback:t}=e,n=Co(e,ph);yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield gi(ho.setTeamLoader({key:Ov.RESEND_INVITATION_LINK,value:!1}))}function*Zh(){yield pa(ho.loadUsers,Vh),yield pa(ho.loadAllSubTenantsUsers,jh),yield pa(ho.loadRoles,Wh),yield fa(ho.addUser,Bh),yield fa(ho.addUserToSubTenants,Kh),yield fa(ho.updateUser,zh),yield fa(ho.deleteUser,qh),yield fa(ho.deleteUserFromSubTenants,Hh),yield fa(ho.resendActivationLink,Jh),yield fa(ho.resendInvitationLink,Yh),yield fa(ho.resendInvitationEmail,Qh),yield fa(ho.resendInvitationLinkToAllSubTenants,Xh),yield fa(ho.openAddUserDialog,Mh),yield fa(ho.closeAddUserDialog,Fh),yield fa(ho.openDeleteUserDialog,Gh),yield fa(ho.closeDeleteUserDialog,$h)}const em=["authorizationUrl"],tm=["events","url"];function*nm(){try{yield gi(ho.setSocialLoginsState({loading:!0}));const e=yield hi(Ly.auth.getSocialLoginProviders);yield gi(ho.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield gi(ho.setSocialLoginsState({error:Of(e),loading:!1,firstLoad:!1}))}}function*om(){try{const e=yield bi((e=>e.root.context));yield gi(ho.setSocialLoginsState({loading:!0}));const t=yield hi(Ly.auth.getSocialLoginProvidersV2),{providers:n}=yield hi(Ly.auth.getCustomSocialLoginProvidersV1),o=t.map((t=>{let{authorizationUrl:n}=t,o=Co(t,em);const i=ir(e,null!=n?n:"");return U({},o,{authorizationUrl:n?`${i}${n}`:null})}));yield gi(ho.setSocialLoginsState({socialLoginsConfigV2:o,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield gi(ho.setSocialLoginsState({error:Of(e),loading:!1,firstLoad:!1}))}}function*im(e){let{payload:{events:t,url:n}}=e,o=Co(e.payload,tm);try{yield gi(ho.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield hi(Ly.auth.loginViaSocialLogin,o);var i,a;r&&(null==t||null==(i=t.signUpComplete)||i.call(t,{email:e,url:n,authenticationType:If.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:o.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Ef.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield gi(ho.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield bi((e=>e.auth));e?yield hi(Xp):yield hi(eg)}(),localStorage.removeItem("register-quick-login"),yield gi(ho.setSocialLoginsState({loading:!1}))}catch(e){yield gi(ho.setSocialLoginsState({loading:!1,error:Of(e,"Failed to authenticate"),firstLoad:!1}))}}function*am({payload:e}){yield gi(ho.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*rm(){yield ga(ho.loadSocialLoginsConfiguration,nm),yield ga(ho.loadSocialLoginsConfigurationV2,om),yield ga(ho.loginViaSocialLogin,im),yield pa(ho.setSocialLoginError,am)}let lm;function*sm({payload:e}){const{description:t,expires:n,callback:o}=e,{apiTokensDataUser:i}=yield bi((e=>e.auth.apiTokensState));try{let e,a;yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield hi(Ly.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield hi(Ly.auth.updateUserApiTokensData,{description:t}),yield gi(ho.setApiTokensState({showAddTokenDialog:!1})),yield ki(200),yield gi(ho.setApiTokensState({apiTokensDataUser:[e,...i],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield gi(ho.setApiTokensError({key:lm.ADD_API_TOKEN,value:Of(e)})),yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*cm({payload:e}){const{description:t,roleIds:n,expires:o,callback:i}=e,{apiTokensDataTenant:a}=yield bi((e=>e.auth.apiTokensState));try{let e,r;yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!0})),void 0!==o?(r=null===o?null:1440*o,e=yield hi(Ly.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield hi(Ly.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield gi(ho.setApiTokensState({showAddTokenDialog:!1})),yield ki(200),yield gi(ho.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===o?e.clientId:void 0}})),yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield gi(ho.setApiTokensError({key:lm.ADD_API_TOKEN,value:Of(e)})),yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*um({payload:e}){const{apiTokensDataUser:t}=yield bi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!0})),n?(yield hi(Ly.auth.deleteUserAccessToken,{id:e}),yield gi(ho.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield hi(Ly.auth.deleteUserApiToken,{tokenId:e}),yield gi(ho.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!1}))}catch(e){yield gi(ho.setApiTokensError({key:lm.DELETE_API_TOKEN,value:Of(e)})),yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!1}))}}function*dm({payload:e}){const{apiTokensDataTenant:t}=yield bi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let o=t;try{yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!0})),n?(yield hi(Ly.auth.deleteTenantAccessToken,{id:e}),o=t.filter((t=>t.id!==e))):(yield hi(Ly.auth.deleteTenantApiToken,{tokenId:e}),o=t.filter((t=>t.clientId!==e))),yield gi(ho.setApiTokensState({apiTokensDataTenant:o,deleteTokenDialog:{open:!1,id:e}})),yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!1}))}catch(e){yield gi(ho.setApiTokensError({key:lm.DELETE_API_TOKEN,value:Of(e)})),yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!1}))}}function*ym({payload:e}){null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],o=[]]=yield Si([hi(Ly.auth.getUserApiTokensData),hi(Ly.auth.getTenantApiTokensData)]);yield gi(ho.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setApiTokensError({key:lm.LOAD_API_TOKENS,value:Of(t)})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*fm({payload:e}){null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=hi(Ly.auth.getUserApiTokensData))?t:[],r=(null!=(o=(yield null!=(n=hi(Ly.auth.getUserAccessTokensData))?n:[]).accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield gi(ho.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield gi(ho.setApiTokensError({key:lm.LOAD_API_TOKENS,value:Of(t)})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*pm({payload:e}){null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));try{var t,n,o,i;const a=yield null!=(t=hi(Ly.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=hi(Ly.auth.getTenantAccessTokensData))?n:[],l=(null!=(o=null==r?void 0:r.accessTokens)?o:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield gi(ho.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var a;yield gi(ho.setApiTokensError({key:lm.LOAD_API_TOKENS,value:Of(t)})),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*gm(){yield ga(ho.loadApiTokens,ym),yield ga(ho.loadUserApiTokens,fm),yield ga(ho.loadTenantApiTokens,pm),yield fa(ho.addUserApiToken,sm),yield fa(ho.addTenantApiToken,cm),yield pa(ho.deleteTenantApiToken,dm),yield pa(ho.deleteUserApiToken,um)}function*Sm({payload:e}){const{description:t,roleIds:n,callback:o}=e;yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield bi((e=>e.auth.apiTokensState)),a=U({},Yy,{description:t,roleIds:n,clientId:`CLIENT_ID_${zv()}`});yield gi(ho.setApiTokensState({showAddTokenDialog:!1})),yield ki(200),yield gi(ho.setApiTokensState({apiTokensDataTenant:[...i,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield ki(200),yield gi(ho.setApiTokensLoader({key:lm.ADD_API_TOKEN,value:!1})),null==o||o(null)}function*vm({payload:e}){yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!0})),yield ki(200);const t=[Yy];yield gi(ho.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield gi(ho.setApiTokensLoader({key:lm.DELETE_API_TOKEN,value:!1}))}function*hm({payload:e}){var t;null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));const n=[Jy],o=[Yy];yield gi(ho.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:o})),yield ki(200),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*mm({payload:e}){var t;null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));const n=[Jy];yield gi(ho.setApiTokensState({apiTokensDataUser:n})),yield ki(200),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Am({payload:e}){var t;null!=e&&e.silentLoading||(yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!0})));const n=[Yy];yield gi(ho.setApiTokensState({apiTokensDataTenant:n})),yield ki(200),yield gi(ho.setApiTokensLoader({key:lm.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bm(){yield ga(ho.loadApiTokens,hm),yield ga(ho.loadUserApiTokens,mm),yield ga(ho.loadTenantApiTokens,Am),yield fa(ho.addTenantApiToken,Sm),yield pa(ho.deleteTenantApiToken,vm)}function*km({payload:e}){try{var t;yield gi(ho.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield bi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield hi(Ly.accountSettings.updateSettings,U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield gi(ho.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield gi(ho.setAccountSettingsState({loading:!1,error:Of(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Tm({payload:e}){yield gi(ho.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield hi(Ly.accountSettings.getSettings);yield gi(ho.setAccountSettingsState(U({},e,{loading:!1})))}catch(e){yield gi(ho.setAccountSettingsState({loading:!1,error:Of(e)}))}}function*Pm(){yield ga(ho.saveAccountSettings,km),yield ga(ho.loadAccountSettings,Tm)}function*Em({payload:e}){var t;yield gi(ho.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield bi((e=>e.auth)),{address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=U({address:o,timezone:i,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield gi(ho.setAccountSettingsState(U({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Im({payload:e}){yield gi(ho.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield gi(ho.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Lm(){yield ga(ho.saveAccountSettings,Em),yield ga(ho.loadAccountSettings,Im)}function*Om({payload:{tenantId:e,callback:t}}){yield gi(ho.setState({isLoading:!0}));try{yield hi(Ly.tenants.switchTenant,{tenantId:e}),yield hi(Yp),(null==t?void 0:t(!0))||(yield gi(ho.setState({isLoading:!1})))}catch(e){yield gi(ho.setState({isLoading:!1})),null==t||t(!1,e)}}function*wm({payload:e}){yield gi(ho.setTenantsState({loading:!0}));try{var t;const n=yield hi(Ly.tenants.getTenants);yield gi(ho.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 gi(ho.setTenantsState({loading:!1}))}}function*Um({payload:e}){yield gi(ho.setTenantsState({loading:!0}));try{var t;const n=yield hi(Ly.tenants.getSubTenants);yield gi(ho.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Cm({payload:e}){yield gi(ho.setTenantsState({loading:!0}));try{var t;const n=yield hi(Ly.tenants.getSubTenantsAsTree);yield gi(ho.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield gi(ho.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Dm(){yield fa(ho.loadTenants,wm),yield fa(ho.loadSubTenants,Um),yield fa(ho.switchTenant,Om),yield fa(ho.loadSubTenantsTree,Cm)}function*_m(){yield gi(ho.setTenantsState({loading:!0})),yield mt(),yield gi(ho.setTenantsState({tenants:vf,loading:!1}))}function*Rm(){yield fa(ho.loadTenants,_m)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(lm||(lm={}));const Nm=["callback"],Mm=["callback"],Fm=["callback"],Gm=["callback"],$m=["callback"];function*xm({payload:e}){var t;yield gi(ho.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Si([hi(Ly.roles.getRoles),hi(Ly.roles.getPermissions),hi(Ly.roles.getPermissionCategories)]),[t,n,o]=e;yield gi(ho.setRolesState({roles:t,permissions:n,permissionCategories:o,loading:!1}))}catch(e){yield gi(ho.setRolesState({error:Of(e),loading:!1}))}}function*Vm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Nm);yield gi(ho.setRolesState({saving:!0}));try{const e=yield hi(Ly.roles.addRole,n),o=yield hi(Ly.roles.getRoles);yield gi(ho.loadRolesAndPermissions({silentLoading:!0})),yield gi(ho.setRolesState({roles:o,saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setRolesState({error:Of(e),saving:!1})),null==t||t(null,e)}}function*jm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Mm);yield gi(ho.setRolesState({saving:!0}));try{yield hi(Ly.roles.deleteRole,n),yield gi(ho.loadRolesAndPermissions({silentLoading:!0})),yield gi(ho.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setRolesState({error:Of(e),saving:!1})),null==t||t(!1,e)}}function*Wm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Fm);yield gi(ho.setRolesState({saving:!0}));try{const e=yield hi(Ly.roles.updateRole,n);yield gi(ho.loadRolesAndPermissions({silentLoading:!0})),yield gi(ho.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setRolesState({error:Of(e),saving:!1})),null==t||t(null,e)}}function*Bm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Gm);yield gi(ho.setRolesState({saving:!0}));try{const e=yield hi(Ly.roles.attachPermissionsToRole,n);yield gi(ho.loadRolesAndPermissions({silentLoading:!0})),yield gi(ho.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setRolesState({error:Of(e),saving:!1})),null==t||t(null,e)}}function*Km(e){let{payload:{callback:t}}=e,n=Co(e.payload,$m);yield gi(ho.setRolesState({saving:!0}));try{const e=yield hi(Ly.roles.attachPermissionToRoles,n);yield gi(ho.loadRolesAndPermissions({silentLoading:!0})),yield gi(ho.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield gi(ho.setRolesState({error:Of(e),saving:!1})),null==t||t(null,e)}}function*zm(){yield ga(ho.loadRolesAndPermissions,xm),yield fa(ho.addRole,Vm),yield fa(ho.deleteRole,jm),yield fa(ho.updateRole,Wm),yield fa(ho.attachPermissionsToRole,Bm),yield fa(ho.attachPermissionToRoles,Km)}function*qm({payload:e}){var t;yield gi(ho.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield gi(ho.setRolesState({roles:Qy,loading:!1}))}catch(e){yield gi(ho.setRolesState({error:Of(e),loading:!1}))}}function*Hm(){yield ga(ho.loadRolesAndPermissions,qm)}const Jm=["callback"],Ym=["callback"],Qm=["callback"];function*Xm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Jm);yield gi(ho.setResetPhoneNumberState({loading:!0}));try{const e=yield hi(Ly.auth.resetPhoneNumber,n);yield gi(ho.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield gi(ho.setLoginState({email:n.email}))}catch(e){yield gi(ho.setResetPhoneNumberState({loading:!1,error:Of(e)})),null==t||t(null,e)}}function*Zm(e){let{payload:{callback:t}}=e,n=Co(e.payload,Ym);yield gi(ho.setResetPhoneNumberState({loading:!0}));try{const e=yield hi(Ly.auth.verifyResetPhoneNumber,n);yield gi(ho.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield gi(ho.setResetPhoneNumberState({loading:!1,error:Of(e)})),null==t||t(null,e)}}function*eA(e){let{payload:{callback:t}}=e,n=Co(e.payload,Qm);yield gi(ho.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:o}=yield bi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield hi(Ly.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield gi(ho.setLoginState({step:Pt.loginWithSmsOtc})),yield gi(ho.passwordlessPreLogin({type:qr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(o.loginUrl),yield gi(ho.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setResetPhoneNumberState({loading:!1,error:Of(e)})),null==t||t(null,e)}}function*tA(){yield ga(ho.resetPhoneNumber,Xm),yield ga(ho.verifyResetPhoneNumber,Zm),yield ga(ho.changePhoneNumber,eA)}function*nA(){yield gi(ho.setSessionsState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getCurrentUserSessions);yield gi(ho.setSessionsState({sessions:e,loading:!1}))}catch(e){yield gi(ho.setSessionsState({error:e,loading:!1}))}}function*oA(){yield gi(ho.setSessionsState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getCurrentUserSession);yield gi(ho.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield gi(ho.setSessionsState({error:e,loading:!1}))}}function*iA({payload:{id:e}}){yield gi(ho.setSessionsState({loading:!0,error:null}));try{yield hi(Ly.auth.deleteSessionForUser,e),yield gi(ho.loadUserSessions())}catch(e){yield gi(ho.setSessionsState({error:e,loading:!1}))}}function*aA({payload:{callback:e,userId:t}}){yield gi(ho.setSessionsState({loading:!0,error:null}));try{yield hi(Ly.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield gi(ho.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*rA(){yield gi(ho.setSessionsState({loading:!0,error:null}));try{yield hi(Ly.auth.deleteAllSessionsForUser),yield gi(ho.loadUserSessions())}catch(e){yield gi(ho.setSessionsState({error:e,loading:!1}))}}function*lA(){yield pa(ho.loadUserSessions,nA),yield pa(ho.deleteUserSession,iA),yield pa(ho.deleteAllUserSessions,rA),yield pa(ho.loadCurrentUserSession,oA),yield fa(ho.revokeUserSessions,aA)}function*sA(){yield gi(ho.setSessionsState({loading:!0,error:null})),yield gi(ho.setSessionsState({sessions:hf,loading:!1}))}function*cA({payload:{id:e}}){yield gi(ho.setSessionsState({loading:!0,error:null}));const t=(yield bi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield gi(ho.setSessionsState({sessions:t,loading:!1}))}function*uA(){yield gi(ho.setSessionsState({loading:!0,error:null}));const e=hf.filter((e=>e.current));yield gi(ho.setSessionsState({sessions:e,loading:!1}))}function*dA(){yield pa(ho.loadUserSessions,sA),yield pa(ho.deleteUserSession,cA),yield pa(ho.deleteAllUserSessions,uA)}const yA=["callback"],fA=["callback"];function*pA(){yield gi(ho.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getSessionConfigurations);yield gi(ho.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield gi(ho.setSessionsState({error:e,loading:!1}))}}function*gA({payload:e}){yield gi(ho.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Co(e,yA);yield hi(Ly.auth.createOrUpdateSessionConfigrations,n),yield gi(ho.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield gi(ho.setSessionsPolicyState({error:e,loading:!1}))}}function*SA(){yield ga(ho.loadSessionsPolicy,pA),yield pa(ho.createOrUpdateSessionsPolicy,gA)}function*vA(){yield gi(ho.setSessionsPolicyState({loading:!0,error:null}));const e=yield bi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:mf}));yield gi(ho.setSessionsPolicyState(U({},e,{loading:!1})))}function*hA({payload:e}){yield gi(ho.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Co(e,fA);null==t||t(!0),yield gi(ho.setSessionsPolicyState({configurations:n,loading:!1}))}function*mA(){yield ga(ho.loadSessionsPolicy,vA),yield pa(ho.createOrUpdateSessionsPolicy,hA)}const AA=["callback"],bA=["callback"],kA=["callback"],TA=["callback"],PA=["callback"],EA=["callback"],IA=["callback"],LA=["callback"],OA=()=>bi((e=>e.auth.restrictionsState.ipRestrictions)),wA=()=>bi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*UA(){yield gi(ho.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield hi(Ly.auth.getDomainRestrictionsConfig),t=(yield hi(Ly.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield gi(ho.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield gi(ho.setEmailDomainRestrictionsState({error:Of(e),loading:!1}))}}function*CA(e){let{payload:{callback:t}}=e,n=Co(e.payload,AA);yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null}));const o=yield wA();try{var i;yield hi(Ly.auth.createDomainRestriction,n);const e=(yield hi(Ly.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=o.data)?void 0:t.config.listType)}));yield gi(ho.setEmailDomainRestrictionsState({data:{config:(null==(i=o.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setEmailDomainRestrictionsState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*DA(e){let{payload:{callback:t}}=e,n=Co(e.payload,bA);yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield hi(Ly.auth.updateDomainRestrictionConfig,n),o=(yield hi(Ly.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield gi(ho.setEmailDomainRestrictionsState({data:{config:e,restrictions:o},saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setEmailDomainRestrictionsState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*_A({payload:{id:e}}){yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield wA();try{var n;yield hi(Ly.auth.deleteDomainRestriction,e);const o=(yield hi(Ly.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield gi(ho.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:o},saving:!1}))}catch(e){yield gi(ho.setEmailDomainRestrictionsState({saving:!1,error:Of(e)}))}}const RA=e=>{var t,n,o;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!=(o=null==e?void 0:e._offset)?o:0}};function*NA(){yield gi(ho.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield OA(),t=yield hi(Ly.auth.getIPRestrictionsConfig),n=RA({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:o,_metadata:{totalPages:i}}=yield hi(Ly.auth.getIPRestrictions,n);yield gi(ho.setIpRestrictionsState({data:{restrictions:o,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield gi(ho.setIpRestrictionsState({error:Of(e),loading:!1}))}}function*MA(){try{const{valid:e}=yield hi(Ly.auth.testCurrentIpInAllowList);yield gi(ho.setIpRestrictionsState({userIpValid:e}))}catch(e){yield gi(ho.setIpRestrictionsState({error:Of(e)}))}}function*FA({payload:{callback:e}}){yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield bi((e=>e.auth.userIp));yield Si([hi(Ly.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),hi(Ly.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield OA(),o=RA(n.pagination),{items:i,_metadata:{totalPages:a}}=yield hi(Ly.auth.getIPRestrictions,o);yield gi(ho.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:i},userIpValid:!0,pagination:o,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield gi(ho.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*GA(e){let{payload:{callback:t}}=e,n=Co(e.payload,kA);yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));const o=yield OA();try{var i,a;yield hi(Ly.auth.createIPRestriction,n);const e=yield OA(),r=RA(e.pagination),{items:l,_metadata:{totalPages:s}}=yield hi(Ly.auth.getIPRestrictions,r);yield MA(),yield gi(ho.setIpRestrictionsState({data:{config:null!=(i=null==(a=o.data)?void 0:a.config)?i:{isActive:!1,strategy:xn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setIpRestrictionsState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*$A(e){let{payload:{callback:t}}=e,n=Co(e.payload,TA);yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));try{yield hi(Ly.auth.updateIPRestrictionConfig,n);const e=yield OA(),o=yield hi(Ly.auth.getIPRestrictionsConfig),i=RA(U({},e.pagination,{_filter:o.strategy})),{items:a,_metadata:{totalPages:r}}=yield hi(Ly.auth.getIPRestrictions,i);yield MA(),yield gi(ho.setIpRestrictionsState({data:{config:o,restrictions:a},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setIpRestrictionsState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*xA({payload:{id:e,callback:t}}){yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));const n=yield OA();try{var o;yield hi(Ly.auth.deleteIPRestriction,e);const i=yield OA(),a=RA(i.pagination),{items:r,_metadata:{totalPages:l}}=yield hi(Ly.auth.getIPRestrictions,a);yield MA(),yield gi(ho.setIpRestrictionsState({data:{config:(null==(o=n.data)?void 0:o.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setIpRestrictionsState({saving:!1,error:Of(e)})),null==t||t(null,e)}}function*VA(){yield ga(ho.loadIpRestrictions,NA),yield ga(ho.loadEmailDomainRestrictions,UA),yield fa(ho.saveIpRestriction,GA),yield fa(ho.saveIpRestrictionsConfig,$A),yield fa(ho.deleteIpRestriction,xA),yield fa(ho.checkIfUserIpValid,MA),yield fa(ho.addCurrentUserIpAndActivate,FA),yield fa(ho.saveEmailDomainRestriction,CA),yield fa(ho.saveEmailDomainRestrictionsConfig,DA),yield fa(ho.deleteEmailDomainRestriction,_A)}function*jA(){yield gi(ho.setIpRestrictionsState({loading:!0,error:null})),yield gi(ho.setIpRestrictionsState({data:{restrictions:bf.filter((e=>e.strategy===Af.strategy)),config:Af},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*WA(){yield gi(ho.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield OA(),t=bf[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield gi(ho.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield gi(ho.setIpRestrictionsState({error:Of(e),loading:!1}))}}function*BA(e){var t,n,o;let{payload:{callback:i}}=e,a=Co(e.payload,PA);yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));const r=yield OA(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield gi(ho.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...l,U({},a,{createdAt:new Date,updatedAt:new Date,id:zv(),isActive:null==(o=a.isActive)||o,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*KA(e){var t,n,o;let{payload:{callback:i}}=e,a=Co(e.payload,EA);const r=yield OA();yield gi(ho.setIpRestrictionsState({saving:!0,error:null})),yield gi(ho.setIpRestrictionsState({data:{config:U({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(o=r.data)?void 0:o.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield gi(ho.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*zA({payload:{id:e,callback:t}}){var n;yield gi(ho.setIpRestrictionsState({saving:!0,error:null}));const o=yield OA();yield gi(ho.setIpRestrictionsState({data:{config:(null==(n=o.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:o.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*qA(){yield gi(ho.setEmailDomainRestrictionsState({loading:!0,error:null})),yield gi(ho.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*HA(e){var t,n;let{payload:{callback:o}}=e,i=Co(e.payload,IA);const a=yield wA();yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==o||o(!0),yield gi(ho.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],U({},i,{id:Date.now().toString()})]},saving:!1}))}function*JA(e){var t;let{payload:{callback:n}}=e,o=Co(e.payload,LA);const i=yield wA();yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield gi(ho.setEmailDomainRestrictionsState({data:{config:{active:o.active,blockPublicDomains:o.blockPublicDomains||!1,listType:o.type||xn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*YA({payload:{id:e}}){var t,n;const o=yield wA();yield gi(ho.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield gi(ho.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=o.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*QA(){yield ga(ho.loadIpRestrictions,jA),yield ga(ho.loadEmailDomainRestrictions,qA),yield fa(ho.saveIpRestriction,BA),yield fa(ho.saveIpRestrictionsConfig,KA),yield fa(ho.deleteIpRestriction,zA),yield fa(ho.checkIfUserIpValid,WA),yield fa(ho.saveEmailDomainRestriction,HA),yield fa(ho.saveEmailDomainRestrictionsConfig,JA),yield fa(ho.deleteEmailDomainRestriction,YA)}const XA=["callback"],ZA=["id"];function*eb(e){const{count:t}=yield hi(Ly.directory.countConfigurationUsers,e.id);return U({},e,{count:t})}function*tb(){yield gi(ho.setProvisioningState({loading:!0,error:null}));try{const e=yield hi(Ly.directory.getConfigs),t=yield Si(e.map((e=>eb(e))));yield gi(ho.setProvisioningState({connections:t,loading:!1}))}catch(e){yield gi(ho.setProvisioningState({error:Of(e),loading:!1}))}}function*nb(e){let{payload:{callback:t}}=e,n=Co(e.payload,XA);yield gi(ho.setProvisioningState({loading:!0,error:null}));try{const e=yield hi(Ly.directory.createConfiguration,n),o=yield hi(Ly.directory.getConfigs),i=yield Si(o.map((e=>eb(e))));yield gi(ho.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield gi(ho.setProvisioningState({error:Of(e),loading:!1}))}}function*ob(e){let{payload:{id:t}}=e,n=Co(e.payload,ZA);yield gi(ho.setProvisioningState({loading:!0,error:null}));try{yield hi(Ly.directory.updateConfiguration,t,n);const e=yield hi(Ly.directory.getConfigs),o=yield Si(e.map((e=>eb(e))));yield gi(ho.setProvisioningState({connections:o,loading:!1}))}catch(e){yield gi(ho.setProvisioningState({error:Of(e),loading:!1}))}}function*ib({payload:{id:e,callback:t}}){yield gi(ho.setProvisioningState({loading:!0,error:null}));try{yield hi(Ly.directory.deleteConfiguration,e);const n=yield hi(Ly.directory.getConfigs),o=yield Si(n.map((e=>eb(e))));yield gi(ho.setProvisioningState({connections:o,loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setProvisioningState({error:Of(e),loading:!1})),null==t||t(!1,e)}}function*ab(){yield ga(ho.loadProvisionConnections,tb),yield fa(ho.createProvisionConnection,nb),yield fa(ho.deleteProvisionConnection,ib),yield fa(ho.updateProvisionConnection,ob)}const rb=["callback","events"];function*lb(e){let{payload:{callback:t}}=e,n=Co(e.payload,rb);yield gi(ho.setImpersonateState({loading:!0}));try{yield hi(Ly.impersonate.impersonate,n),yield gi(ho.setImpersonateState({step:yo.success})),yield ki(1e3),yield jp(),yield gi(ho.resetImpersonateState()),null==t||t(!0)}catch(e){yield gi(ho.setImpersonateState({loading:!1,error:Of(e)}))}}function*sb(){yield ga(ho.impersonate,lb)}function*cb({payload:e}){const{callback:t,deviceId:n}=e;yield gi(ho.setPasskeysState({loading:!0}));try{yield hi(Ly.auth.deleteWebAuthnDevice,n);const{devices:e}=yield bi((e=>e.auth.passkeysState)),o=e.filter((e=>e.id!==n));yield gi(ho.setPasskeysState({devices:o,loading:!1})),null==t||t(!0)}catch(e){yield gi(ho.setPasskeysState({loading:!1,error:Of(e,null)})),null==t||t(null,e.message)}}function*ub(){yield gi(ho.setPasskeysState({loading:!0}));try{const{devices:e}=yield hi(Ly.auth.getWebAuthnDevices);yield gi(ho.setPasskeysState({devices:e,loading:!1}))}catch(e){yield gi(ho.setPasskeysState({loading:!1,error:Of(e,null)}))}}function*db(){yield fa(ho.loadWebAuthnDevices,ub),yield fa(ho.deleteWebAuthnDevice,cb)}const yb=["roleIds","userIds"],fb=()=>bi((e=>e.auth.groupsState));function*pb({payload:e}){const t=qv.GET_TEAM_USERS;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield hi(Ly.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield gi(ho.setGroupsState({teamUsers:n}))}catch(e){yield gi(ho.setUsersGroupsError({key:t,value:Of(e)}))}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*gb({payload:e}){const t=qv.GET_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield hi(Ly.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Hv.rolesAndUsers});yield gi(ho.setGroupsState({selectedGroup:n}))}catch(e){yield gi(ho.setUsersGroupsError({key:t,value:Of(e)}))}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*Sb(){const e=qv.GET_GROUPS,t=yield fb();yield gi(ho.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield hi(Ly.groups.getGroups,{_groupsRelations:Hv.rolesAndUsers});yield gi(ho.setGroupsState(U({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield gi(ho.setUsersGroupsError({key:e,value:Of(t)}))}finally{yield gi(ho.setUsersGroupsLoader({key:e,value:!1}))}}function*vb({payload:e}){const t=qv.CREATE_GROUP,{roleIds:n,userIds:o}=e,i=Co(e,yb);yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield hi(Ly.groups.createGroup,U({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=o&&o.length&&(yield gi(ho.addUsersToGroup({groupId:r.id,userIds:o}))),null!=n&&n.length&&(yield gi(ho.addRolesToGroup({groupId:r.id,roleIds:n}))),yield gi(ho.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*hb({payload:e}){const t=qv.UPDATE_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.updateGroup,e),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=qv.DELETE_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.deleteGroup,e.groupId),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(o=e.callback)||o.call(e,!1,n.message)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*Ab({payload:e}){const t=qv.ADD_ROLES_TO_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*bb({payload:e}){const t=qv.DELETE_ROLES_FROM_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*kb({payload:e}){const t=qv.ADD_USERS_TO_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;null==e||null==(o=e.callback)||o.call(e,!1),yield gi(ho.setUsersGroupsError({key:t,value:Of(n)}))}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb({payload:e}){const t=qv.DELETE_USERS_FROM_GROUP;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield hi(Ly.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield gi(ho.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var o;yield gi(ho.setUsersGroupsError({key:t,value:Of(n)})),null==e||null==(o=e.callback)||o.call(e,!1)}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*Pb(){const e=qv.GET_GROUP_CONFIGURATION;yield gi(ho.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield hi(Ly.groups.getGroupConfiguration);yield gi(ho.setGroupsState({groupsConfiguration:t}))}catch(t){yield gi(ho.setUsersGroupsError({key:e,value:Of(t)}))}finally{yield gi(ho.setUsersGroupsLoader({key:e,value:!1}))}}function*Eb({payload:e}){const t=qv.UPDATE_GROUP_CONFIGURATION;yield gi(ho.setUsersGroupsLoader({key:t,value:!0}));try{yield hi(Ly.groups.updateGroupConfiguration,e),yield gi(ho.getGroupConfiguration())}catch(e){yield gi(ho.setUsersGroupsError({key:t,value:Of(e)}))}finally{yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}}function*Ib(){yield pa(ho.loadGroups,Sb),yield pa(ho.getGroupById,gb),yield pa(ho.createGroup,vb),yield pa(ho.updateGroup,hb),yield pa(ho.deleteGroup,mb),yield pa(ho.addRolesToGroup,Ab),yield pa(ho.deleteRolesFromGroup,bb),yield pa(ho.addUsersToGroup,kb),yield pa(ho.deleteUsersFromGroup,Tb),yield pa(ho.getGroupConfiguration,Pb),yield pa(ho.updateGroupConfiguration,Eb),yield pa(ho.getTeamUsers,pb)}function*Lb(){const e=qv.GET_GROUPS;yield gi(ho.setUsersGroupsLoader({key:e,value:!0}));const t=Pf;yield gi(ho.setGroupsState({groups:t})),yield gi(ho.setUsersGroupsLoader({key:e,value:!1}))}function*Ob({payload:e}){var t;const n=qv.CREATE_GROUP,{groups:o}=yield fb();yield gi(ho.setUsersGroupsLoader({key:n,value:!0})),yield gi(ho.setGroupsState({groups:[U({},e,{id:`${e.name}ID`,managedBy:Ey.FRONTEGG}),...null!=o?o:[]]})),yield ki(500),null==e||null==(t=e.callback)||t.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:n,value:!1}))}function*wb({payload:e}){var t,n,o,i,a;const r=qv.UPDATE_GROUP,l=yield fb();yield gi(ho.setUsersGroupsLoader({key:r,value:!0})),yield gi(ho.setGroupsState({groups:null==l||null==(t=l.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Ey.FRONTEGG}):t})),selectedGroup:U({},null==l?void 0:l.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(o=null==e?void 0:e.color)?o:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield ki(500),null==e||null==(a=e.callback)||a.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:r,value:!1}))}function*Ub({payload:e}){var t,n;const o=qv.DELETE_GROUP,i=yield fb();yield gi(ho.setUsersGroupsLoader({key:o,value:!0})),yield gi(ho.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield ki(500),null==e||null==(n=e.callback)||n.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:o,value:!1}))}function*Cb({payload:e}){var t,n;const o=qv.ADD_ROLES_TO_GROUP,i=yield fb();yield gi(ho.setUsersGroupsLoader({key:o,value:!0})),yield gi(ho.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield ki(500),null==e||null==(n=e.callback)||n.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:o,value:!1}))}function*Db({payload:e}){var t,n;const o=qv.DELETE_ROLES_FROM_GROUP,i=yield fb();yield gi(ho.setUsersGroupsLoader({key:o,value:!0})),yield gi(ho.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield ki(500),null==e||null==(n=e.callback)||n.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:o,value:!1}))}function*_b({payload:e}){var t,n;const o=qv.ADD_USERS_TO_GROUP,i=yield fb();yield gi(ho.setUsersGroupsLoader({key:o,value:!0})),yield gi(ho.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield ki(500),null==e||null==(n=e.callback)||n.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:o,value:!1}))}function*Rb({payload:e}){var t,n;const o=qv.DELETE_USERS_FROM_GROUP,i=yield fb();yield gi(ho.setUsersGroupsLoader({key:o,value:!0})),yield gi(ho.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?U({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield ki(500),null==e||null==(n=e.callback)||n.call(e,!0),yield gi(ho.setUsersGroupsLoader({key:o,value:!1}))}function*Nb(){const e=qv.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield fb();yield gi(ho.setUsersGroupsLoader({key:e,value:!0})),t&&(yield gi(ho.setGroupsState({groupsConfiguration:U({},t)}))),yield gi(ho.setUsersGroupsLoader({key:e,value:!1}))}function*Mb({payload:e}){const t=qv.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield fb();yield gi(ho.setUsersGroupsLoader({key:t,value:!0})),n&&(yield gi(ho.setGroupsState({groupsConfiguration:U({},n,e)}))),yield gi(ho.setUsersGroupsLoader({key:t,value:!1}))}function*Fb(){yield pa(ho.loadGroups,Lb),yield pa(ho.createGroup,Ob),yield pa(ho.updateGroup,wb),yield pa(ho.deleteGroup,Ub),yield pa(ho.addRolesToGroup,Cb),yield pa(ho.deleteRolesFromGroup,Db),yield pa(ho.addUsersToGroup,_b),yield pa(ho.deleteUsersFromGroup,Rb),yield pa(ho.getGroupConfiguration,Nb),yield pa(ho.updateGroupConfiguration,Mb)}const Gb=(e,t=[])=>Object.entries(e).reduce(((e,[n,o])=>"object"==typeof o?[...e,...Gb(o,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:o}]),[]),$b=["callback"];function*xb(){yield gi(ho.setCustomLoginState({loading:!0}));try{const e=yield hi(Mc);yield gi(ho.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield gi(ho.setCustomLoginState({loading:!1,error:Of(e)}))}}function*Vb(e){let{payload:{callback:t}}=e,n=Co(e.payload,$b);try{yield gi(ho.setCustomLoginState({error:null,saving:!0}));const e=Gb(n);if(0===e.length)throw new Error("No changes to update");yield hi(Fc,{actions:e});const o=yield hi(Mc);yield gi(ho.setCustomLoginState({tenantMetadata:o,saving:!1})),null==t||t(!0)}catch(e){yield gi(ho.setCustomLoginState({error:Of(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*jb(){yield ga(ho.loadTenantMetadata,xb),yield ga(ho.updateTenantMetadata,Vb)}let Wb;function Bb(e,t,n){var o,i;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return U({},e,{children:t})}return U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>Bb(e,t,n))))?o:[]})}function Kb(e,t){var n;return U({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Kb(e,t))):[]})}!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.GET_PARENT_ACCOUNTS="GET_PARENT_ACCOUNTS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.GET_ACCOUNT_SETTINGS="GET_ACCOUNT_SETTINGS",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Wb||(Wb={}));const zb=(e,t,n)=>{var o,i;return e.tenantId===t?U({},e,{name:n}):U({},e,{children:null!=(o=null==e||null==(i=e.children)?void 0:i.map((e=>zb(e,t,n))))?o:[]})},qb=()=>bi((e=>e.auth.allAccountsState));function*Hb({payload:e}){const t=Wb.GET_TEAM_USERS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));try{const{items:n}=yield hi(Ly.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield gi(ho.setAllAccountsState({teamUsers:n}))}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*Jb({payload:e}){const t=Wb.GET_ACCOUNTS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{accounts:n}=yield qb(),{jwt:o,_limit:i,_offset:a}=e;try{var r;const{items:l,_links:s}=yield hi(Ly.tenants.searchSubTenants,{_offset:null!=a?a:0,_limit:null!=i?i:50,_subTenantId:null==e?void 0:e._subTenantId},{jwt:o}),c=Bb(n,null!=(r=null==e?void 0:e._subTenantId)?r:"",[...l.map((e=>U({},e,{children:[],loadMoreLink:null==s?void 0:s.next})))]);yield gi(ho.setAllAccountsState({accounts:U({},c)}))}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*Yb({payload:e}){const t=Wb.SEARCH_ACCOUNTS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{topAccount:n}=yield qb(),{jwt:o}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield hi(Ly.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:o});yield gi(ho.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*Qb({payload:e}){const t=Wb.GET_USER_JWT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:o}=e,{selectedAccount:i}=yield qb();try{const e=yield hi(Ly.users.GetUserJwt,{tenantId:n});yield gi(ho.setAllAccountsState({selectedAccount:U({},i,{userJwt:e})})),null==o||o(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==o||o(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*Xb(){const e=Wb.GET_USER_JWT;yield gi(ho.setAllAccountsLoader({key:e,value:!0}));const{tenantId:t}=yield bi((e=>e.auth.user)),{topAccount:n}=yield qb();try{const o=yield hi(Ly.users.GetUserJwt,{tenantId:t});yield gi(ho.setAllAccountsState({topAccount:U({},n,{userJwt:o})}))}catch(t){yield gi(ho.setAllAccountsError({key:e,value:Of(t)}))}finally{yield gi(ho.setAllAccountsLoader({key:e,value:!1}))}}function*Zb({payload:e}){const t=Wb.CREATE_SUB_ACCOUNT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{accounts:n}=yield qb(),{name:o,parentTenantId:i,tenantId:a,jwt:r,callback:l}=e;try{const e=Bb(n,null!=i?i:"",[U({},yield hi(Ly.subTenants.createSubTenant,{name:o,parentTenantId:i,tenantId:a},{jwt:r}))]);yield gi(ho.setAllAccountsState({accounts:U({},e)})),null==l||l(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==l||l(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*ek({payload:e}){const t=Wb.GET_PARENT_ACCOUNTS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{const e=yield hi(Ly.tenants.getParentTenants,{jwt:n});yield gi(ho.setAllAccountsState({parentsAccounts:e}))}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*tk({payload:e}){const t=Wb.DELETE_SUB_ACCOUNT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{accounts:n}=yield qb(),{jwt:o,tenantId:i,callback:a}=e;try{yield hi(Ly.subTenants.deleteSubTenant,i,{jwt:o});const e=Kb(n,i);yield gi(ho.setAllAccountsState({accounts:e})),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*nk({payload:e}){const t=Wb.DELETE_USERS_FROM_ACCOUNT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:o,jwt:i,callback:a}=e;try{yield hi(Ly.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:o},{jwt:i}),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*ok({payload:e}){const t=Wb.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:o,jwt:i,callback:a}=e;try{yield hi(Ly.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:o},{jwt:i}),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*ik({payload:e}){const t=Wb.ADD_USERS_TO_ACCOUNT;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:o,jwt:i,callback:a}=e;try{yield hi(Ly.subTenants.addUsersToSubTenant,{users:n,tenantId:o},{jwt:i}),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*ak({payload:e}){const t=Wb.GET_ACCOUNT_SETTINGS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{const e=yield hi(Ly.accountSettings.getSettings,{jwt:n});yield gi(ho.setAllAccountsState({accountSettings:e}))}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*rk({payload:e}){const t=Wb.UPDATE_SUB_ACCOUNT_SETTINGS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{accounts:n}=yield qb(),{jwt:o,name:i,callback:a,tenantId:r}=e;try{yield hi(Ly.subTenants.updateSubTenant,{tenantId:r},{name:i},{jwt:o});const e=zb(n,r,i);yield gi(ho.setAllAccountsState({accounts:e})),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*lk({payload:e}){const t=Wb.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{userId:n,allowAccess:o,jwt:i,callback:a}=e;try{yield hi(Ly.subTenants.updateSubAccountAccess,n,{allowAccess:o},{jwt:i}),null==a||a(!0)}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)})),null==a||a(!1)}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*sk({payload:e}){const t=Wb.GET_ACCOUNT_USERS;yield gi(ho.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield qb(),{jwt:o,_tenantId:i}=e;try{const{items:e,_metadata:a,_links:r}=yield hi(Ly.users.getUsersV3,{_offset:0,_limit:50,_tenantId:i},{jwt:o});yield gi(ho.setAllAccountsState({selectedAccount:U({},n,{users:e})}))}catch(e){yield gi(ho.setAllAccountsError({key:t,value:Of(e)}))}finally{yield gi(ho.setAllAccountsLoader({key:t,value:!1}))}}function*ck(){yield pa(ho.loadAccounts,Jb),yield pa(ho.searchAccounts,Yb),yield pa(ho.updateSubAccountAccessForUser,lk),yield pa(ho.getUserJwtForTopAccount,Xb),yield pa(ho.getUserJwtForSubAccount,Qb),yield pa(ho.getParentAccounts,ek),yield pa(ho.getAccountSettings,ak),yield pa(ho.createSubAccount,Zb),yield pa(ho.deleteSubAccount,tk),yield pa(ho.updateSubAccountSettings,rk),yield pa(ho.addUsersToAccount,ik),yield pa(ho.deleteUsersFromAccount,nk),yield pa(ho.setUserRolesForSubAccount,ok),yield pa(ho.getTeamUsers,Hb),yield pa(ho.getAccountUsers,sk)}var uk={sagas:function*(){yield Si([hi(xg),hi(Mv),hi(Gv),hi(Lv),hi(tA),hi(nS),hi(US),hi(MS),hi(jb),hi(fv),hi(xh),hi(Ib),hi(rm),hi(_f),hi(gm),hi(lp),hi(Pm),hi(Dm),hi(zm),hi(lA),hi(SA),hi(VA),hi(ab),hi(sb),hi(db),hi(ck)])},mockSagas:function*(){yield Si([hi(Wg),hi(cS),hi(xS),hi(kv),hi(Zh),hi(bm),hi(Ap),hi(dA),hi(Lm),hi(Rm),hi(mA),hi(QA),hi(Hm),hi(Fb)])},storeName:wt,initialState:uo,reducer:So,actions:ho};const dk=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>U({},t,{[e]:U({},t[e],n)})}),yk={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},fk={setAuditLogsState:dk("auditLogsState"),resetAuditLogsState:e=>U({},e,{auditLogsState:yk})},pk={exportAuditsCsv:st("auditLogs/exportAuditsCsv"),loadAuditLogs:st("auditLogs/loadAuditLogs",(e=>({payload:e})))},gk={loading:!0},Sk={setAuditsMetadataState:dk("auditsMetadataState"),resetAuditsMetadataState:e=>U({},e,{auditsMetadataState:gk})},vk={loadAuditsMetadata:st("auditLogs/loadAuditsMetadata")},hk={auditLogsState:yk,auditsMetadataState:gk},{reducer:mk,actions:Ak}=ut({name:Ct,initialState:hk,reducers:U({resetState:e=>U({},e,hk),setState:(e,{payload:t})=>U({},e,t)},fk,Sk)}),bk=U({},Ak,pk,vk),kk=e=>"createdAt"!==e.id,Tk={total:20,data:Array.from(Array(5).keys()).map((e=>U({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Pk={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=()=>bi((e=>e.auditLogs.auditLogsState)),Ik=()=>bi((e=>e.auditLogs.auditsMetadataState));function*Lk(){const e=yield Ek(),{columns:t}=yield Ik();try{const n=e.filter,o=e.sort.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});yield gi(bk.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Ly.audits.exportAudits(U({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},o,i))}catch(e){console.error("failed to export audits - ",e)}yield gi(bk.setAuditLogsState({isDownloadingCsv:!1}))}function*Ok({payload:e}){yield gi(bk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Ek(),{columns:n}=yield Ik();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield gi(bk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>U({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>U({},e,{[t.id]:t.value})),{});n||(yield gi(bk.loadAuditsMetadata()));const{data:p,total:g}=yield hi(Ly.audits.getAudits,U({offset:c,count:s},y,f));yield gi(bk.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield gi(bk.setAuditLogsState({loading:!1,error:Of(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*wk(){yield fa(bk.exportAuditsCsv,Lk),yield fa(bk.loadAuditLogs,Ok)}function*Uk({payload:e}){yield gi(bk.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Ek(),{columns:n}=yield Ik();try{var o,i,a,r,l;const s=null!=(o=e.pageSize)?o:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield gi(bk.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield gi(bk.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Tk;let o=n.filter((e=>t=>e.filter(kk).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];o=o.sort(((e,t)=>(n,o)=>n[e]>o[e]?t?-1:1:o[e]>n[e]?t?1:-1:0)(e,n))}return{data:o,total:o.length}})(u,d);yield gi(bk.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield gi(bk.setAuditLogsState({loading:!1,error:Of(t)})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Ck(){yield fa(bk.loadAuditLogs,Uk)}function*Dk(){yield gi(bk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield hi(Ly.metadata.getAuditsMetadata);yield gi(bk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield gi(bk.setAuditsMetadataState({error:e,loading:!1}))}}function*_k(){yield fa(bk.loadAuditsMetadata,Dk)}function*Rk(){yield gi(bk.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Pk;yield gi(bk.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield gi(bk.setAuditsMetadataState({error:e,loading:!1}))}}function*Nk(){yield fa(bk.loadAuditsMetadata,Rk)}var Mk={sagas:function*(){yield Si([hi(wk),hi(_k)])},mockSagas:function*(){yield Si([hi(Ck),hi(Nk)])},storeName:Ct,initialState:hk,reducer:mk,actions:bk};const Fk={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:Gk,actions:$k,reducer:xk}=ut({name:"audits",initialState:Fk,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=U({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),Vk=U({},$k,{initData:st(`${Gk}/initData`),loadAudits:st(`${Gk}/loadAudits`),removeFilter:st(`${Gk}/removeFilter`),filterData:st(`${Gk}/filterData`),exportCSV:st(`${Gk}/exportCSV`),deleteAudits:st(`${Gk}/deleteAudits`)}),jk=()=>bi((e=>e[Gk]));function*Wk(){const{sortBy:e,sortDirection:t}=yield jk();try{const n=yield hi(Ly.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield gi(Vk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield gi(Vk.loadItemFailedAction(t))}}function*Bk(){try{const e=yield hi(Ly.metadata.getAuditsMetadata);yield gi(Vk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield gi(Vk.loadItemFailedAction(t))}}const Kk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*zk({payload:e}){const{filters:t,sortBy:n,sortDirection:o,filter:i,offset:a,virtualScroll:r}=yield jk(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield jk():{rowsData:[]};try{const e=Kk(t),{data:l,total:d}=yield hi(Ly.audits.getAudits,U({},r&&{paginationMode:"virtual"},{sortDirection:o,sortBy:n,filter:i},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield gi(Vk.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield gi(Vk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield gi(Vk.loadItemFailedAction(t))}}function*qk(){yield gi(Vk.startLoading()),yield Si([Wk(),Bk(),zk({payload:{onlyOneLoad:!1},type:""})]),yield gi(Vk.finishLoading())}function*Hk({payload:e}){const{filters:t}=yield jk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const o=[...t.slice(0,n),...t.slice(n+1)];yield gi(Vk.setFilterData(o))}function*Jk({payload:e}){const{filters:t}=yield jk();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const o=[...t.slice(0,n),e,...t.slice(n+1)];yield gi(Vk.setFilterData(o))}function*Yk(){const{filters:e,sortBy:t,sortDirection:n,filter:o,headerProps:i}=yield jk(),a=Kk(e);yield gi(Vk.startDownloadingCsv());try{yield Ly.audits.exportAudits(U({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:o},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield gi(Vk.stopDownloadingCsv())}}function*Qk(){yield pa(Vk.initData,qk),yield pa(Vk.removeFilter,Hk),yield pa(Vk.filterData,Jk),yield pa([Vk.loadAudits,Vk.textSearch,Vk.onPageChange],zk),yield pa([Vk.setFilterData,Vk.setDataSorting,Vk.startRefresh],(()=>zk({payload:{appendMode:!1},type:""}))),yield pa(Vk.exportCSV,Yk)}const Xk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Zk={initData:()=>U({},Xk),setConnectivityState:(e,{payload:t})=>U({},e,t),cleanWebhookTestData:e=>U({},e,{testResult:void 0}),cleanWebhookLogsData:e=>U({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return U({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>U({},e,{error:void 0}),cleanSlackData:e=>U({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>U({},e,{retryResult:U({},e.retryResult,t)})}},eT={loadSlackActions:st("connectivity/loadSlackActions"),loadDataAction:st("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:st("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:st("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:st("connectivity/loadScope"),deleteWebhookConfigAction:st("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:st("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:st("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},tT={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:nT,actions:oT}=ut({name:Ut,initialState:tT,reducers:U({},Zk)}),iT=U({},oT,eT),aT={slack:Ly.connectivity.getSlackConfiguration,email:Ly.connectivity.getEmailConfiguration,sms:Ly.connectivity.getSMSConfiguration,webhook:Ly.connectivity.getWebhooksConfigurations,categories:Ly.connectivity.getCategories,channelMap:Ly.connectivity.getChannelMaps},rT={slack:Ly.connectivity.postSlackConfiguration,email:Ly.connectivity.postEmailConfiguration,sms:Ly.connectivity.postSMSConfiguration,webhook:Ly.connectivity.postWebhooksConfiguration},lT=["email","slack","sms","webhook"],sT={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"}},cT=["id"],uT=["id","enabled"],dT=["categories","channelMap"];function*yT(e){return yield hi(pT,{payload:{api:e},type:""})}function*fT({payload:e=lT}){yield gi(iT.setConnectivityState({isLoading:!0}));try{const t=yield Si([...e.map(yT),yield pT({payload:{api:"categories"},type:""}),yield function*(){return(yield Si(e.map((function*(e){return yield pT({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,o)=>U({},t,{[`${e[o]}`]:n})),{})}()]),n=yield pT({payload:{api:"webhook"},type:""}),o=t.reduce(((n,o,i)=>e[i]?t[t.length-1][e[i]].length?U({},n,{[`${e[i]}`]:o,list:[...n.list,{id:i,key:e[i],events:sT[e[i]].events(o),active:sT[e[i]].isActive(o),platform:sT[e[i]].title,image:sT[e[i]].image}]}):n:U({},n,{[`${dT[i-e.length]}`]:o})),{list:[],webhook:n});yield gi(iT.setConnectivityState(U({},o,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield gi(iT.setConnectivityState({isLoading:!1}))}}function*pT({payload:{api:e,params:t}}){try{return yield hi(aT[e],t)}catch(e){return}}function*gT(){try{yield gi(iT.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield hi(Ly.connectivity.getSlackChannels);yield gi(iT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield gi(iT.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*ST(e,t){const{connectivity:{list:n}}=yield bi(),o=n.find((({key:t})=>t===e));if(!o)return;const i=sT[e].isActive(t);i!==o.active&&(yield gi(iT.setConnectivityState({list:n.map((t=>t.key===e?U({},t,{active:i}):t))})))}function*vT({payload:{platform:e,data:t,callback:n}}){const{processIds:o}=yield bi((e=>e.connectivity));try{if(yield gi(iT.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...o]:o})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield bi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:o}=e;yield Si([...o.reduce(((e,t)=>{var o,i;return!t.id&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length||(null==n?void 0:n.find((e=>{let{id:n}=e,o=Co(e,cT);return n===t.id&&JSON.stringify(U({id:n},o))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield hi(rT.slack,e)})),...o.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield hi(Ly.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield bi(),{processIds:o}=yield bi((e=>e.connectivity)),i=n[t];if(!i)return;let a=[];try{a=yield Si([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield hi("email"===t?Ly.connectivity.postEmailConfiguration:Ly.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:o}=e,i=n[0],{id:a="",enabled:r}=i,l=Co(i,uT);return yield Si([yield hi("email"===t?Ly.connectivity.patchEmailConfiguration:Ly.connectivity.patchSMSConfiguration,{eventKey:o,enabled:r}),yield hi("email"===t?Ly.connectivity.putEmailSubscriptions:Ly.connectivity.putSMSSubscriptions,a,o,U({},l,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return hi("email"===t?Ly.connectivity.deleteEmailSubscriptions:Ly.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield pT({payload:{api:t},type:""});yield gi(iT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?o.filter((t=>t!==e.id)):o})),yield ST(t,e)}else yield gi(iT.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:o}))}({payload:t,type:e}):yield hi(rT[e],t),!["sms","email"].includes(e)){const i=yield pT({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield gi(iT.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?o.filter((e=>e!==i.id)):o})),yield ST(e,i),null==n||n(!0)}}catch(e){yield gi(iT.setConnectivityState({error:Of(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*hT({payload:e}){try{yield Ly.connectivity.postSlackCode(e)}catch{}yield gi(iT.setConnectivityState({error:void 0,isSaving:!1}))}function*mT(){const{slackChannels:e}=yield bi((e=>e.connectivity));try{yield gi(iT.setConnectivityState({slackChannels:U({},e,{isLoadingScope:!0})}));const{clientId:t}=yield hi(Ly.connectivity.getSlackScope);yield gi(iT.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield gi(iT.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*AT({payload:e}){const{callback:t,webhookId:n}=e,{processIds:o}=yield bi((e=>e.connectivity));try{yield gi(iT.setConnectivityState({isSaving:!0})),yield hi(Ly.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Of(e))}const i=yield pT({payload:{api:"webhook"},type:""});i&&(yield gi(iT.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?o.filter((e=>e!==i.id)):o}))),null==t||t(!0)}function*bT({payload:e}){try{yield gi(iT.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield hi(Ly.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield gi(iT.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield gi(iT.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield gi(iT.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*kT({payload:e}){try{const{statusCode:t}=yield hi(Ly.connectivity.postWebhookRetry,e);yield gi(iT.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield gi(iT.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*TT({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:o}=yield bi((e=>e.connectivity));try{yield gi(iT.setConnectivityState({webhookLogs:U({},o,{isLoading:!0})}));const i=yield hi(Ly.connectivity.getWebhookLog,e,n,t);yield gi(iT.setConnectivityState({error:void 0,webhookLogs:U({isLoading:!1},i)}))}catch(e){yield gi(iT.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var PT={sagas:function*(){yield fa(iT.loadDataAction,fT),yield pa(iT.loadSlackActions,gT),yield fa(iT.postDataAction,vT),yield fa(iT.postCodeAction,hT),yield fa(iT.loadScope,mT),yield fa(iT.deleteWebhookConfigAction,AT),yield fa(iT.postWebhookTestAction,bT),yield fa(iT.postWebhookRetryAction,kT),yield pa(iT.loadWebhookLogsAction,TT)},storeName:Ut,initialState:tT,reducer:nT,actions:iT};function ET(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}}function IT(e,t){return{prepare:e=>({payload:e}),reducer:(n,o)=>U({},n,{[e]:t(n[e],o)})}}function LT(e){return IT(e,((e,t)=>U({},e,{loading:t.payload})))}function OT(e){return IT(e,((e,t)=>U({},e,{error:t.payload,loading:!1})))}const wT={loading:!1,error:null,fetching:!0,plans:[]},{actions:UT,reducer:CT,name:DT}=ut({name:"subscriptions/plans",initialState:wT,reducers:U({},ET())}),_T=U({loadPlans:st(`${DT}/loadPlans`)},UT),RT={loading:!1,error:null,fetching:!0,config:null},NT=U({},ET()),{actions:MT,reducer:FT,name:GT}=ut({name:"subscriptions/config",initialState:RT,reducers:NT}),$T=U({loadPaymentConfiguration:st(`${GT}/loadPaymentConfiguration`)},MT),xT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},VT=U({},ET(),{setCancellationLoading:LT("cancellation"),setCancellationError:OT("cancellation"),setRenewalLoading:LT("renewal"),setRenewalError:OT("renewal")}),{reducer:jT,actions:WT,name:BT}=ut({name:"subscriptions/billing/subscription",initialState:xT,reducers:VT}),KT=U({load:st(`${BT}/loadSubscription`),cancelSubscription:st(`${BT}/cancelSubscription`),renewSubscription:st(`${BT}/renewSubscription`)},WT),zT={loading:!1,error:null,fetching:!0},qT=U({},ET()),{reducer:HT,actions:JT,name:YT}=ut({name:"subscriptions/billing/information",initialState:zT,reducers:qT}),QT=U({loadBillingInformation:st(`${YT}/loadBillingInformation`),cancelSubscription:KT.cancelSubscription,renewSubscription:KT.renewSubscription},JT),XT={loading:!1,error:null,fetching:!0},ZT=U({},ET(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,t.payload)}}),{reducer:eP,actions:tP,name:nP}=ut({name:"subscriptions/billing/payment",initialState:XT,reducers:ZT}),oP=U({loadPaymentMethod:st(`${nP}/loadPaymentMethod`),submitPaymentMethod:st(`${nP}/submitPaymentMethod`),submitPaymentMethodError:st(`${nP}/submitPaymentMethodError`),submitPaymentMethodSuccess:st(`${nP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:st(`${nP}/updateBillingDetails`,(e=>({payload:e})))},tP),iP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},aP=U({},ET(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>U({},e,{invoiceDownload:U({},e.invoiceDownload,t.payload)})}}),{reducer:rP,actions:lP,name:sP}=ut({name:"subscriptions/billing/invoices",initialState:iP,reducers:aP}),cP=U({loadInvoices:st(`${sP}/loadInvoices`),downloadInvoice:st(`${sP}/downloadInvoice`,(e=>({payload:e})))},lP),uP={information:zT,invoices:iP,paymentMethod:XT,subscription:xT},dP={invoices:cP,information:QT,paymentMethod:oP,subscription:KT},yP=je({invoices:rP,information:HT,paymentMethod:eP,subscription:jT}),fP={fetching:!0,loading:!1,error:null,confirmed:!1},pP=U({},ET()),{actions:gP,reducer:SP,name:vP}=ut({name:"subscriptions/checkout",initialState:fP,reducers:pP}),hP=U({loadCheckout:st(`${vP}/loadCheckout`),resetCheckout:st(`${vP}/resetCheckout`),submitCheckout:st(`${vP}/submitCheckout`),confirmCheckout:st(`${vP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:st(`${vP}/errorCheckout`,(e=>({payload:e})))},gP),mP={loading:!1,error:null,cardSetupIntentSecret:null},AP=U({},ET()),{reducer:bP,actions:kP,name:TP}=ut({name:"subscriptions/stripe",initialState:mP,reducers:AP}),PP=U({loadCustomer:st(`${TP}/loadCustomer`),createCardSetupIntentSecret:st(`${TP}/createCardSetupIntentSecret`)},kP),EP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:IP,reducer:LP,name:OP}=ut({name:"subscriptions/vendorPublicConfig",initialState:EP,reducers:U({},ET())}),wP=U({loadVendorPublicConfiguration:st(`${OP}/loadVendorPublicConfiguration`)},IP),UP={config:RT,plans:wT,checkout:fP,billing:uP,stripe:mP,vendorPublicConfig:EP},CP={config:$T,billing:dP,plans:_T,checkout:hP,stripe:PP,vendorPublicConfig:wP},DP=je({config:FT,billing:yP,plans:CT,checkout:SP,stripe:bP,vendorPublicConfig:LP});let _P,RP,NP;function MP({policy:e}){return{policy:NP.AT_PERIOD_END}}function FP(e){switch(e){case Td.ACTIVE:return RP.ACTIVE;case Td.INCOMPLETE:return RP.INCOMPLETE;case Td.CANCELED:return RP.CANCELED;case Td.EXPIRED:return RP.EXPIRED;case Td.TRIALING:return RP.TRIALING;default:return RP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(_P||(_P={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(RP||(RP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(NP||(NP={}));const GP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Td.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},$P=[{id:"prod_J60fUEvI7qV1eL",externalId:"prod_J60fUEvI7qV1eL",name:"Premium",description:"",price:{id:"price_1IToe8Ewsu4qiqnndAV76J69",externalId:"price_1IToe8Ewsu4qiqnndAV76J69",currency:"usd",amount:1e4},slug:"premium"},{id:"prod_J60duauCpXfcur",externalId:"prod_J60duauCpXfcur",name:"Free",description:"Totally free plan. Nothing to pay.",price:{id:"price_1ITocfEwsu4qiqnnnBHDx9fQ",externalId:"price_1ITocfEwsu4qiqnnnBHDx9fQ",currency:"usd",amount:0},slug:"free"}],xP=[{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-09-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""},{id:"in_1JbhYWEwsu4qiqnnrUh6hsHa",externalId:"in_1JbhYWEwsu4qiqnnrUh6hsHa",subscriptionId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",paymentDate:"2021-08-20T08:08:51.000Z",totalAmount:1e4,currency:"usd",paid:!0,receiptNumber:""}],VP=[{id:"id",externalId:"externalId",type:Pd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],jP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*WP(){yield fa(KT.load,BP),yield fa(KT.cancelSubscription,zP),yield fa(KT.renewSubscription,qP)}function*BP(){const e=yield bi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield XP(e)}function*KP(){yield gi(KT.setLoading(!0));try{const[e]=yield hi(Ly.subscriptions.getManagedSubscriptions);yield gi(KT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield gi(KT.setError(e))}}function*zP(){const{subscription:e}=yield bi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield gi(KT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield gi(KT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:o}=e||{};if(!n&&o===Td.ACTIVE)try{yield gi(KT.setCancellationLoading(!0)),yield hi(Ly.subscriptions.cancelManagedSubscription,t),yield KP(),yield gi(KT.setCancellationLoading(!1))}catch(e){yield gi(KT.setCancellationError(Of(e)))}}function*qP(){const{subscription:e}=yield bi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield gi(KT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield gi(KT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Ed.AT_PERIOD_END)try{yield gi(KT.setRenewalLoading(!0)),yield hi(Ly.subscriptions.renewManagedSubscription,t),yield KP(),yield gi(KT.setRenewalLoading(!1))}catch(e){yield gi(KT.setCancellationError(Of(e)))}}function*HP(){yield gi(KT.setLoading(!0)),yield ki(500),yield gi(KT.setState({subscription:GP,fetching:!1,loading:!1,error:null}))}function*JP(){yield fa(KT.load,HP)}function*YP(){yield fa(QT.loadBillingInformation,QP)}function*QP(){yield function*(e){const t=yield bi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield bi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield XP(n,!1):yield gi(QT.setError(t?"Not authorized":"Internal feature failure"))}()}function*XP(e,t){yield gi(QT.setLoading(!0));try{var n,o;const i=yield hi(Ly.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=i;let l,s=null;r?l=yield hi(Ly.subscriptions.getSubscriptionPlan,a):([,l]=yield Si([hi(KP),hi(Ly.subscriptions.getSubscriptionPlan,a)]),s=yield bi((e=>e.subscriptions.billing.subscription.subscription||null))),yield gi(QT.setState(U({loading:!1,fetching:!1,summary:i},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?RP.ACTIVE:FP(s.status),cancellation:s.cancellation&&MP(s.cancellation),trialEnd:s.trialEnd?s.trialEnd:null}}:{},l?{plan:{id:l.id,name:l.name,description:l.description,price:(null==(n=l.price)?void 0:n.amount)||0,currency:(null==(o=l.price)?void 0:o.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield gi(QT.setError(Of(e)))}}function*ZP(){yield function*(){var e,t;yield gi(QT.setLoading(!0)),yield ki(500),yield gi(QT.setState({loading:!1,fetching:!1,summary:{subscriptionId:GP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Id.Stripe,externallyManaged:!1,currentPlanId:$P[0].id,defaultPlanId:$P[0].id},plan:U({},$P[0],{price:null==(e=$P[0].price)?void 0:e.amount,currency:null==(t=$P[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*eE(){yield fa(QT.loadBillingInformation,ZP)}function*tE(){yield fa(oP.loadPaymentMethod,nE),yield fa(oP.submitPaymentMethod,iE),yield fa(oP.submitPaymentMethodError,aE),yield fa(oP.submitPaymentMethodSuccess,rE),yield fa(oP.updatePaymentMethodBillingDetails,oE)}function*nE(){yield gi(oP.setLoading(!0));try{const e=(yield hi(Ly.subscriptions.getPaymentMethods))[0];yield gi(oP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield gi(oP.setError(Of(e)))}}function*oE({payload:e}){yield gi(oP.setLoading(!0));const{id:t,email:n,address:o,callback:i}=e;try{yield hi(Ly.subscriptions.updatePaymentMethodBillingDetails,t,U({email:n},o)),yield hi(nE),null==i||i(!0)}catch(e){yield gi(oP.setError(Of(e))),null==i||i(!1)}yield gi(oP.setLoading(!1))}function*iE(){yield gi(oP.setLoading(!0))}function*aE({payload:e}){yield gi(oP.setError(e))}function*rE(){yield gi(oP.loadPaymentMethod())}function*lE(){yield gi(oP.setLoading(!0)),yield ki(500);const e=VP[0];yield gi(oP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*sE(){yield fa(oP.loadPaymentMethod,lE)}function*cE(){yield fa(cP.loadInvoices,uE),yield fa(cP.downloadInvoice,dE)}function*uE(){yield gi(cP.setLoading(!0));try{const e=(yield hi(Ly.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 gi(cP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield gi(cP.setError(Of(e)))}}function*dE({payload:e}){yield gi(cP.setInvoiceDownloadState({loading:!0,error:null}));try{yield hi(Ly.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield gi(cP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield gi(cP.setInvoiceDownloadState({loading:!1,error:Of(e,null)}))}}function*yE(){yield gi(cP.setLoading(!0)),yield ki(500),yield gi(cP.setState({loading:!1,fetching:!1,invoices:xP.map((e=>U({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield gi(cP.setLoading(!1))}function*fE(){yield fa(cP.loadInvoices,yE)}function*pE(){yield Si([hi(YP),hi(tE),hi(cE),hi(WP)])}function*gE(){yield Si([hi(eE),hi(sE),hi(fE),hi(JP)])}function*SE(){yield fa(hP.loadCheckout,vE),yield fa(hP.resetCheckout,hE),yield fa(hP.submitCheckout,mE),yield fa(hP.confirmCheckout,AE),yield fa(hP.errorCheckout,kE)}function*vE(){yield gi(hP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*hE(){yield gi(hP.setState({loading:!1,error:null,confirmed:!1}))}function*mE(){yield gi(hP.setState({loading:!0,error:null}))}function*AE({payload:{paymentMethodId:e,planId:t}}){const n=yield bi((e=>e.subscriptions.billing.subscription.subscription)),o=yield bi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===Td.TRIALING,a=!(null==o||!o.paymentMethodId);if(n){if(yield gi(hP.setState({loading:!0,error:null})),i&&a)return yield bE(),void(yield gi(KT.setState({subscription:U({},n,{status:Td.ACTIVE})})));try{yield hi(Ly.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Si([QP(),nE(),uE()]),yield bE()}catch(e){yield gi(hP.setState({loading:!1,error:Of(e)}))}}else yield gi(hP.setState({loading:!1,error:"Subscription not found"}))}function*bE(){yield gi(hP.setState({loading:!1,error:null,confirmed:!0}))}function*kE({payload:e}){yield gi(hP.setState({loading:!1,error:e}))}function*TE(){yield fa(hP.resetCheckout,hE)}function*PE(){yield fa(_T.loadPlans,EE)}function*EE(){yield gi(_T.setLoading(!0));try{const e=(yield hi(Ly.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 gi(_T.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield gi(_T.setError(Of(e)))}}function*IE(){yield gi(_T.setLoading(!0)),yield ki(500),yield gi(_T.setState({fetching:!1,loading:!1,plans:$P.map((e=>{var t,n;return U({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*LE(){yield fa(_T.loadPlans,IE)}function*OE(){yield fa($T.loadPaymentConfiguration,wE)}function*wE(){yield gi($T.setLoading(!0));try{(yield hi(Ly.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Id.Stripe))?yield function*(){yield gi($T.setLoading(!0));try{const e=yield hi(Ly.subscriptions.getStripePaymentProviderConfiguration);yield gi($T.setState({loading:!1,fetching:!1,config:{paymentProvider:_P.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield gi($T.setError(Of(e)))}}():yield gi($T.setError("Payment provider not configured"))}catch(e){yield gi($T.setError(Of(e)))}}function*UE(){yield gi($T.setLoading(!0)),yield ki(500),yield gi($T.setState({loading:!1,fetching:!1,config:{paymentProvider:_P.STRIPE,apiKey:""}}))}function*CE(){yield fa($T.loadPaymentConfiguration,UE)}function*DE(){yield fa(PP.createCardSetupIntentSecret,_E)}function*_E({payload:e}){yield gi(PP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield hi(Ly.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield gi(PP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield gi(PP.setError(Of(e)))}}function*RE(){yield fa(wP.loadVendorPublicConfiguration,NE)}function*NE(){yield gi(wP.setLoading(!0));try{const e=yield hi(Ly.subscriptions.getVendorPublicConfigurations);yield gi(wP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield gi(wP.setError(Of(e)))}}function*ME(){yield gi(wP.setLoading(!0)),yield ki(500),yield gi(wP.setState({fetching:!1,loading:!1,vendorPublicConfig:jP}))}function*FE(){yield fa(wP.loadVendorPublicConfiguration,ME)}var GE={sagas:function*(){yield Si([hi(pE),hi(SE),hi(PE),hi(OE),hi(DE),hi(RE)])},mockSagas:function*(){yield Si([hi(gE),hi(TE),hi(LE),hi(CE),hi(FE)])},reducer:DP,actions:CP,initialState:UP,storeName:"subscriptions"},$E={sagas:function*(){yield fa($f.loadVendorPublicInfo,xf)},storeName:Dt,initialState:Mf,reducer:Ff,actions:$f};const{reducer:xE}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Sa.setContext(t),U({},e,{context:t}))}}}),VE=(e,t,n=!1,o,i,a=!1,r="path")=>{let l=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var s,c,u,d,y,f,p,g,S,v;n||a||Sa.setContext(e.context);const t=ia(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=lt({middleware:h,preloadedState:{root:U({},e,{previewMode:n,urlStrategy:r}),[uk.storeName]:U({},uk.initialState,o,null!=(s=null==i?void 0:i.auth)?s:{},{routes:U({},uk.initialState.routes,null!=(c=null==o?void 0:o.routes)?c:{},null!=(u=null==i||null==(d=i.auth)?void 0:d.routes)?u:{})}),[Mk.storeName]:U({},Mk.initialState,null!=(y=null==i?void 0:i.auditLogs)?y:{},{auditLogsState:U({},Mk.initialState.auditLogsState,null!=(f=null==i||null==(p=i.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:U({},Mk.initialState.auditsMetadataState,null!=(g=null==i||null==(S=i.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[Gk]:U({},Fk,null!=(v=null==i?void 0:i.audits)?v:{}),[PT.storeName]:PT.initialState,[GE.storeName]:GE.initialState,[$E.storeName]:$E.initialState},reducer:je({root:xE,[uk.storeName]:uk.reducer,[Mk.storeName]:Mk.reducer,[Gk]:xk,[PT.storeName]:PT.reducer,[GE.storeName]:GE.reducer,[$E.storeName]:$E.reducer})});const m=function*(){yield Si([hi(uk.sagas),hi(Mk.sagas),hi(Qk),hi(PT.sagas),hi(GE.sagas),hi($E.sagas)])},A=function*(){yield Si([hi(uk.mockSagas),hi(Mk.mockSagas),hi(GE.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(ho.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var jE=n(714),WE=n.n(jE);function BE(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function KE(e){if(e.type)return e;if("#"===e.charAt(0))return KE(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const o=e.substring(t+1,e.length-1);let i,a;if("color"===n){if(a=o.split(" "),i=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else a=o.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:i}}function zE(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return-1!==t.indexOf("rgb")?o=o.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=-1!==t.indexOf("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function qE(e){if(0===e.indexOf("#"))return e;const{values:t}=KE(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 HE(e,t){return e=KE(e),t=BE(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,zE(e)}function JE(e,t){if(e=KE(e),t=BE(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 zE(e)}function YE(e,t){if(e=KE(e),t=BE(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 zE(e)}const QE=e=>{if(e)return{main:e,light:qE(YE(e,.4)),dark:qE(JE(e,.15)),hover:qE(JE(e,.15)),active:qE(JE(e,.2))}},XE=e=>{if(e)return{main:e,light:YE(e,.7),dark:JE(e,.2)}},ZE=(e,t)=>{var n,o,i,a,r,l,s,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?U({},t,{palette:{primary:U({},QE(null==e||null==(o=e.palette)?void 0:o.primary),{contrastText:null!=(i=null==e||null==(a=e.palette)?void 0:a.primaryText)?i:"#000000"}),secondary:U({},QE(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:U({},QE(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:U({},XE(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:U({},XE(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:U({},XE(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:U({},XE(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},eI={},tI={},nI={},oI={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 iI{constructor(){this._theme=eI,this._themeV2=tI,this._navigation=oI,this._localizations=nI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new iI;return n.set(e),iI._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,o,i,a,r,l;this._navigation=WE().all([null!=(t=oI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=WE().all([null!=(o=eI)?o:{},ZE(null==e?void 0:e.theme,eI)]),this._themeV2=WE().all([null!=(i=tI)?i:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=WE().all([null!=(r=nI)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=oI,this._theme=eI,this._themeV2=tI,this._localizations=nI}}}iI._instances={};var aI=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},rI=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=document.createElement(t);return Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),e.appendChild(o),o},lI=function(e){return new Promise((function(t,n){var o=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):o<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(o-=50)}),50)}))},sI=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 cI,uI,dI,yI,fI,pI,gI,SI,vI,hI,mI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(cI||(cI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(uI||(uI={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(dI||(dI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(yI||(yI={})),function(e){e.Invoices="invoices"}(fI||(fI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(pI||(pI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(gI||(gI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(SI||(SI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(vI||(vI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(hI||(hI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(mI||(mI={}));const AI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},bI={hidden:"hidden",edit:"edit"};var kI="6.103.0-alpha.0",TI={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"},PI=function(){function e(t,n){var o,i=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(kI),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(R().mark((function e(){var t,n,o,a,r;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=lr,i.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,i.options.metadata=null!=(n=null==r||null==(o=r.rows)||null==(a=o[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:iI.set(i.options.metadata,i.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i.options.hostedLoginBox||i.options.builderMode||"nextjs"===i.options.framework||i.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!i.options.previewMode&&!i.options.builderMode){e.next=4;break}jd.set(TI,i.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Wd();case 7:t=e.sent,i.options.overrideFeatureFlags&&Object.assign(t,i.options.overrideFeatureFlags),jd.set(t,i.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){i.updateLocalizations=e};var l=aI(n),s="frontegg-app-".concat(l);this.iframeRendering=a,this.name=l,this.options=U({},t,{contextOptions:U({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=s;var c,u,d=this.options.authOptions?U({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(o=this.options.authOptions)?void 0:o.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=VE({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);w.setInstance(l,this)}var t,n,o,i;return O(e,[{key:"initContainers",value:(i=D(R().mark((function e(t){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;iI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,o){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:T})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),o(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(o=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sa.setRequestSource(ma.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(),sI(t),Sa.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(R().mark((function e(t){var n;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,U({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),EI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=w.getInstance(o);e&&t?(Sa.setAccessToken(t),Sa.setUser(U({},n,{accessToken:t})),i.store.dispatch(ho.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(ho.loadTenants())):(Sa.setAccessToken(null),Sa.setUser(null),i.store.dispatch(ho.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),II=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}(),LI=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}(),OI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},wI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=VE({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new PI(this.options,t,!0),iI.set({},t)}var t;return O(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,lI(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}(),UI="modern",CI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[UI]},DI=function(){function e(t,n,o,i){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(o){if(this.store=o,!a&&o.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=VE({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=U({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new PI(this.options,t,!0,a),iI.set({},t)}var t;return O(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,o,i,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,o=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:o,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,lI(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 _I(e,t){return _I=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_I(e,t)}function RI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_I(e,t)}function NI(e,t){if(t&&("object"===E(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 MI(e){return MI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},MI(e)}function FI(){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 GI(e,t,n){return GI=FI()?Reflect.construct.bind():function(e,t,n){var o=[null];o.push.apply(o,t);var i=new(Function.bind.apply(e,o));return n&&_I(i,n.prototype),i},GI.apply(null,arguments)}function $I(e){var t="function"==typeof Map?new Map:void 0;return $I=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 GI(e,arguments,MI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_I(n,e)},$I(e)}function xI(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=MI(e);if(t){var i=MI(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return NI(this,n)}}var VI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new PI(e,t);if("undefined"!=typeof document){var o;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var a=function(e){RI(n,e);var t=xI(n);function n(){var e;P(this,n);for(var o=arguments.length,i=new Array(o),a=0;a<o;a++)i[a]=arguments[a];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return 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 o=rI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=rI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=rI(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=o.attachShadow({mode:"open"}),l=i.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=rI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=rI(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=rI(s,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:o,loginBoxContainer:i,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}($I(HTMLElement));customElements.define("frontegg-app",a)}null==(o=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||o.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),o}()}));
|