@frontegg/js 6.102.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/index.js +1 -1
- package/node/index.js +1 -1
- package/node/version.js +1 -1
- package/package.json +2 -2
- package/umd/frontegg.development.js +1622 -484
- 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 YI},AdminPortalRenderer:function(){return ZI},AppHolder:function(){return w},CheckoutDialog:function(){return QI},FronteggApp:function(){return HI},HostedLogin:function(){return JI},LoginBoxRenderer:function(){return nL},createElement:function(){return CI},defaultTheme:function(){return eL},formatName:function(){return wI},getThemeAdminByName:function(){return XI},getThemeByName:function(){return tL},initialize:function(){return dL},mockFlagsList:function(){return qI},restoreSearchParams:function(){return RI},waitThemeSetter:function(){return DI}});var e={};n.r(e),n.d(e,{Delete:function(){return Pa},Get:function(){return ba},Patch:function(){return ka},Post:function(){return Aa},PostDownload:function(){return Ia},Put:function(){return Ta},extractHeadersFromOptions:function(){return La},getBaseUrl:function(){return va},getMetadataHeaders:function(){return ha}});var t={};n.r(t),n.d(t,{getParentTenants:function(){return yr},getSubTenants:function(){return ur},getSubTenantsAsTree:function(){return dr},getTenants:function(){return cr},getTenantsUsersCount:function(){return fr},switchTenant:function(){return lr}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return xr},MachineToMachineAuthStrategy:function(){return Vr},OAuthLogout:function(){return ds},SocialLoginProviders:function(){return Gr},acceptInvitation:function(){return ss},activateAccount:function(){return is},bulkCreateIPRestriction:function(){return _r},changePhoneNumber:function(){return ec},changePhoneNumberWithVerification:function(){return Xl},checkIfAllowToRememberMfaDevice:function(){return El},createDomainRestriction:function(){return Or},createIPRestriction:function(){return Ur},createOrUpdateSessionConfigrations:function(){return dl},createSSOConfiguration:function(){return Rl},createSSOConfigurationByMetadata:function(){return Ml},createSSODomain:function(){return Fl},createSSOGroup:function(){return jl},createSamlGroup:function(){return Ys},createTenantAccessToken:function(){return ml},createUserAccessToken:function(){return hl},deleteAllSessionsForUser:function(){return fl},deleteDomainRestriction:function(){return Cr},deleteIPRestriction:function(){return Nr},deleteSSOConfiguration:function(){return _l},deleteSSODomain:function(){return $l},deleteSSOGroup:function(){return Bl},deleteSamlGroup:function(){return Xs},deleteSessionForUser:function(){return yl},deleteTenantAccessToken:function(){return Sl},deleteTenantApiToken:function(){return Pl},deleteUserAccessToken:function(){return vl},deleteUserApiToken:function(){return Il},deleteWebAuthnDevice:function(){return ac},disableMFAAuthenticatorApp:function(){return Is},disableMFASMS:function(){return Es},disableMFAWebAuthn:function(){return ws},disableMfa:function(){return Ps},enrollMFAAuthenticatorApp:function(){return hs},enrollMFAAuthenticatorAppForLogin:function(){return Rs},enrollMFASMS:function(){return bs},enrollMFASMSForLogin:function(){return Ms},enrollMFAWebAuthn:function(){return ks},enrollMFAWebAuthnForLogin:function(){return Gs},enrollMfa:function(){return Ss},exchangeOAuthTokens:function(){return Hl},forgotPassword:function(){return ys},generateLoginResponse:function(){return Hr},generateLoginResponseFromOAuthResponse:function(){return Yr},generateLoginResponseV2:function(){return Jr},getActivateAccountStrategy:function(){return os},getCaptchaPolicy:function(){return Ar},getCurrentUserSession:function(){return ll},getCurrentUserSessions:function(){return sl},getCustomSocialLoginProvidersV1:function(){return il},getDomainRestrictions:function(){return Lr},getDomainRestrictionsConfig:function(){return Er},getGlobalSecurityPolicy:function(){return gr},getIPRestrictions:function(){return Dr},getIPRestrictionsConfig:function(){return Rr},getLockoutPolicy:function(){return hr},getMFADevices:function(){return Cs},getMFAStrategiesConfig:function(){return lc},getMfaPolicy:function(){return pr},getOidcConfiguration:function(){return Zs},getPasswordConfigPolicy:function(){return Ir},getPasswordHistoryPolicy:function(){return kr},getSSOConfigurations:function(){return Dl},getSSODefaultRoles:function(){return xl},getSSOGroups:function(){return Kl},getSSOPublicConfiguration:function(){return el},getSamlConfiguration:function(){return js},getSamlRoles:function(){return qs},getSamlRolesGroups:function(){return Hs},getSamlVendorConfiguration:function(){return Bs},getSessionConfigurations:function(){return ul},getSocialLoginProviders:function(){return tl},getSocialLoginProvidersV2:function(){return nl},getTenantAccessTokensData:function(){return pl},getTenantApiTokensData:function(){return Al},getUserAccessTokensData:function(){return gl},getUserApiTokensData:function(){return bl},getUserById:function(){return Ll},getVendorConfig:function(){return al},getVendorLockoutPolicy:function(){return mr},getVendorMfaPolicy:function(){return Sr},getVendorPasswordHistoryPolicy:function(){return Tr},getVendorPublicAuthStrategiesConfig:function(){return sc},getWebAuthnDevices:function(){return oc},loadPasswordConfig:function(){return gs},login:function(){return ts},loginViaSocialLogin:function(){return ol},loginWithMfa:function(){return ns},logout:function(){return us},oidcPostLogin:function(){return es},oidcPostLoginV2:function(){return ql},passwordlessPostLogin:function(){return wl},passwordlessPreLogin:function(){return Ol},postLogin:function(){return Zr},preDisableMFASMS:function(){return Ls},preDisableMFAWebAuthn:function(){return Os},preEnrollMFAAuthenticatorApp:function(){return vs},preEnrollMFAAuthenticatorAppForLogin:function(){return Ds},preEnrollMFASMS:function(){return ms},preEnrollMFASMSForLogin:function(){return _s},preEnrollMFAWebAuthn:function(){return As},preEnrollMFAWebAuthnForLogin:function(){return $s},preLogin:function(){return Qr},preLoginV2:function(){return zl},preLoginWithIdpType:function(){return Xr},preVerifyMFASMSForLogin:function(){return Ns},preVerifyMFAWebAuthnForLogin:function(){return xs},recoverMfaToken:function(){return ps},refreshToken:function(){return ls},refreshTokenV2:function(){return cs},resendActivationEmail:function(){return as},resendInvitationEmail:function(){return rs},resetPassword:function(){return fs},resetPhoneNumber:function(){return Yl},revokeSessionsForUser:function(){return cl},saveLockoutPolicy:function(){return br},saveMfaPolicy:function(){return vr},savePasswordHistoryPolicy:function(){return Pr},setSSODefaultRoles:function(){return Vl},signUpUser:function(){return rl},silentOAuthRefreshToken:function(){return Jl},testCurrentIp:function(){return Fr},testCurrentIpInAllowList:function(){return $r},updateDomainRestrictionConfig:function(){return wr},updateIPRestrictionConfig:function(){return Mr},updateSSOConfiguration:function(){return Ul},updateSSOConfigurationByMetadata:function(){return Nl},updateSSOGroup:function(){return Wl},updateSamlConfiguration:function(){return Ws},updateSamlGroup:function(){return Qs},updateSamlRoles:function(){return Js},updateSamlVendorMetadata:function(){return Ks},updateTenantApiTokensData:function(){return Tl},updateUserApiTokensData:function(){return kl},validateSSODomain:function(){return Gl},validateSamlDomain:function(){return zs},verifyChangePhoneNumber:function(){return Zl},verifyInviteToken:function(){return Cl},verifyMFAAuthenticatorAppForLogin:function(){return Us},verifyMFASMSForLogin:function(){return Fs},verifyMFAWebAuthnForLogin:function(){return Vs},verifyMfa:function(){return Ts},verifyNewDeviceSession:function(){return rc},verifyResetPhoneNumber:function(){return Ql},webAuthnCreateNewDeviceSession:function(){return ic},webAuthnPostLogin:function(){return nc},webAuthnPreLogin:function(){return tc}});var a={};n.r(a),n.d(a,{addUser:function(){return gc},changePassword:function(){return yc},createInviteUserLink:function(){return vc},deleteInviteUserLink:function(){return mc},deleteUser:function(){return pc},getInviteLinkConfiguration:function(){return Ac},getInviteUserLink:function(){return bc},getProfile:function(){return cc},loadAvailablePermissions:function(){return Tc},loadAvailableRoles:function(){return kc},loadStats:function(){return Pc},loadUsers:function(){return fc},resendActivationLink:function(){return Ic},resendInvitationLink:function(){return Lc},resendInvitationLinkToAllTenants:function(){return Ec},updateInviteUserLink:function(){return hc},updateProfile:function(){return uc},updateProfileImage:function(){return dc},updateUser:function(){return Sc}});var r={};n.r(r),n.d(r,{getAdminBoxMetadata:function(){return wc},getAuditsMetadata:function(){return _c},getCurrentUserIpMetadata:function(){return Dc},getIpAdressMetadata:function(){return Mc},getNotificationsMetadata:function(){return Rc},getSamlMetadata:function(){return Uc},updateAdminBoxMetadata:function(){return Cc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Wc},getReport:function(){return xc},getReports:function(){return Gc},renderReport:function(){return Vc},scheduleReport:function(){return jc},sendReport:function(){return Bc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return Kc},markAllAsRead:function(){return Hc},updateNotificationIsPinned:function(){return qc},updateNotificationStatus:function(){return zc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Xc},getAudits:function(){return Yc},getAuditsStats:function(){return Qc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return yu},deleteEmailSubscriptions:function(){return uu},deleteSMSConfiguration:function(){return hu},deleteSMSSubscriptions:function(){return Su},deleteSlackConfiguration:function(){return au},deleteWebhooksConfiguration:function(){return Au},getCategories:function(){return Iu},getChannelMaps:function(){return Lu},getEmailConfiguration:function(){return su},getSMSConfiguration:function(){return fu},getSlackChannels:function(){return iu},getSlackConfiguration:function(){return tu},getSlackScope:function(){return nu},getWebhookLog:function(){return ku},getWebhooksConfigurations:function(){return mu},patchEmailConfiguration:function(){return cu},patchSMSConfiguration:function(){return pu},postEmailConfiguration:function(){return lu},postSMSConfiguration:function(){return gu},postSlackCode:function(){return ru},postSlackConfiguration:function(){return ou},postWebhookRetry:function(){return Pu},postWebhookTest:function(){return Tu},postWebhooksConfiguration:function(){return bu},putEmailSubscriptions:function(){return du},putSMSSubscriptions:function(){return vu}});var d={};n.r(d),n.d(d,{getPublicSettings:function(){return wu},getSettings:function(){return Ou},updateSettings:function(){return Eu}});var y={};n.r(y),n.d(y,{addRole:function(){return _u},attachPermissionToRoles:function(){return Gu},attachPermissionsToRole:function(){return Fu},deleteRole:function(){return Mu},getPermissionCategories:function(){return xu},getPermissions:function(){return $u},getRoles:function(){return Uu},updateRole:function(){return Nu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},PaymentMethodType:function(){return vd},ProviderType:function(){return md},TenantCreatedAction:function(){return Ad},TrialEndAction:function(){return bd},cancelManagedSubscription:function(){return Hu},cancelSubscription:function(){return Wu},createStripeCustomer:function(){return ld},createStripePaymentMethodSetupIntentSecret:function(){return ud},createSubscription:function(){return rd},createTenantConfiguration:function(){return fd},getManagedSubscription:function(){return zu},getManagedSubscriptions:function(){return qu},getPaymentMethod:function(){return od},getPaymentMethods:function(){return id},getPaymentProviders:function(){return gd},getStripeCustomer:function(){return sd},getStripePaymentProviderConfiguration:function(){return cd},getSubscription:function(){return ju},getSubscriptionInvoice:function(){return ed},getSubscriptionInvoicePdf:function(){return td},getSubscriptionInvoices:function(){return Zu},getSubscriptionPlan:function(){return Xu},getSubscriptionPlans:function(){return Qu},getSubscriptionSummaries:function(){return dd},getSubscriptions:function(){return Vu},getTenantConfiguration:function(){return yd},getVendorPublicConfigurations:function(){return pd},renewManagedSubscription:function(){return Ju},renewSubscription:function(){return Bu},updateManagedSubscription:function(){return Yu},updatePaymentMethodBillingDetails:function(){return ad},updateSubscription:function(){return Ku}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return kd}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return Ld},addUserToTenantAndSubTenants:function(){return Pd},addUsersToSubTenant:function(){return Rd},createSubTenant:function(){return wd},deleteSubTenant:function(){return Cd},loadAllUsers:function(){return Td},removeUserFromTenantAndSubTenants:function(){return Id},removeUserRolesFromSubTenants:function(){return Ed},setUserRolesForSubTenants:function(){return Od},updateSubAccountAccess:function(){return Dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return _d},loadFeatureFlags:function(){return Md}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},deleteConfiguration:function(){return Gd},getConfigs:function(){return Nd},updateConfiguration:function(){return Fd}});var h={};n.r(h),n.d(h,{impersonate:function(){return Vd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Jd},addUsersToGroup:function(){return Qd},createGroup:function(){return zd},deleteGroup:function(){return Hd},deleteRolesFromGroup:function(){return Yd},deleteUsersFromGroup:function(){return Xd},getGroupById:function(){return Wd},getGroupConfiguration:function(){return Zd},getGroups:function(){return Bd},getGroupsByIds:function(){return Kd},updateGroup:function(){return qd},updateGroupConfiguration:function(){return ey}});var b={};n.r(b),n.d(b,{GetUserJwt:function(){return ty},getUsersV3:function(){return ny}});var A={};n.r(A),n.d(A,{loadEntitlements:function(){return iy}});var k={};n.r(k),n.d(k,{AuthStrategyEnum:function(){return xr},ContextHolder:function(){return da},FeatureFlags:function(){return _d},FronteggApiError:function(){return Sa},FronteggContext:function(){return ya},FronteggFrameworks:function(){return pa},GroupManagedByEnum:function(){return Sy},GroupRelations:function(){return py},ISubscriptionCancellationPolicy:function(){return hd},ISubscriptionStatus:function(){return Sd},MFAStrategyEnum:function(){return ry},MachineToMachineAuthStrategy:function(){return Vr},PaginationOrderEnum:function(){return hy},PaymentMethodType:function(){return vd},ProviderType:function(){return md},RequestSource:function(){return ga},RestrictionType:function(){return xn},ScimConnectionSource:function(){return gy},SecondaryAuthStrategy:function(){return oy},SocialLoginProviders:function(){return Gr},SortByEnum:function(){return vy},TenantType:function(){return ly},UserManagedByEnum:function(){return sy},WebAuthnDeviceType:function(){return ay},api:function(){return my},countConfigurationUsers:function(){return xd},createConfiguration:function(){return $d},default:function(){return by},deleteConfiguration:function(){return Gd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return cy},fronteggHeaders:function(){return fa},fronteggRefreshTokenUrl:function(){return uy},fronteggSilentRefreshTokenUrl:function(){return dy},fronteggTenantsUrl:function(){return fy},fronteggUsersUrl:function(){return yy},getConfigs:function(){return Nd},loadFeatureFlags:function(){return Md},updateConfiguration:function(){return Fd}});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 WI},AccountPageFields:function(){return NI},DomainRestrictionsTabFields:function(){return jI},GeneralSettingsTabFields:function(){return xI},InviteUserModalFields:function(){return MI},IpRestrictionsTabFields:function(){return VI},Metadata:function(){return OI},PrivacyPageFields:function(){return _I},ProfilePageFields:function(){return UI},SecurityPageTabs:function(){return $I},SessionManagementTabFields:function(){return GI},SubscriptionsPageFields:function(){return FI},alpha:function(){return hI},fieldAppearance:function(){return BI},tabAppearance:function(){return KI}});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={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},ai=C({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},oi);let ri;!function(e){e.impersonating="impersonating",e.success="success"}(ri||(ri={}));const si={step:ri.impersonating,loading:!1},li={setImpersonateState:ft("impersonateState"),resetImpersonateState:yt("impersonateState",{impersonateState:si})},ci={impersonate:lt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ui,actions:di}=ut({name:wt,initialState:ai,reducers:C({resetState:e=>C({},e,oi),setState:(e,{payload:t})=>C({},e,t),setUser:("user",(e,{payload:t})=>C({},e,{user:t}))},_t,fn,$t,li,jt,zt,Yt,vn,nn,ni,Zt,sn,un,Qn,ei,bn,Tn,Ln,wn,Rn,Mn,$n,jn,Kn,Hn)});const yi=C({},di,Mt,gn,Gt,Wt,qt,Qt,hn,on,ii,en,ln,dn,Xn,{},An,Pn,En,Cn,Un,Nn,Gn,Wn,zn,ci,Jn);var fi=function(e){return"@@redux-saga/"+e},gi=fi("CANCEL_PROMISE"),pi=fi("CHANNEL_END"),Si=fi("IO"),vi=fi("MATCH"),hi=fi("MULTICAST"),mi=fi("SAGA_ACTION"),bi=fi("SELF_CANCELLATION"),Ai=fi("TASK"),ki=fi("TASK_CANCEL"),Ti=fi("TERMINATE"),Pi=fi("LOCATION");function Ii(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var Li=function(e){return null==e},Ei=function(e){return null!=e},Oi=function(e){return"function"==typeof e},wi=function(e){return"string"==typeof e},Ci=Array.isArray,Di=function(e){return e&&Oi(e.then)},Ri=function(e){return e&&Oi(e.next)&&Oi(e.throw)},Ui=function e(t){return t&&(wi(t)||Ni(t)||Oi(t)||Ci(t)&&t.every(e))},_i=function(e){return e&&Oi(e.take)&&Oi(e.close)},Mi=function(e){return Oi(e)&&e.hasOwnProperty("toString")},Ni=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Fi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[gi]=function(){clearTimeout(n)},i},$i=function(e){return function(){return e}},Gi=$i(!0),xi=function(){},Vi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var ji=function(e,t){C(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Wi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Bi=function(e){throw e},Ki=function(e){return{value:e,done:!0}};function zi(e,t,n){void 0===t&&(t=Bi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ki,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function qi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Hi=function(e){return Array.apply(null,new Array(e))},Ji=function(e){return function(t){return e(Object.defineProperty(t,mi,{value:!0}))}},Yi=function(e){return e===Ti},Qi=function(e){return e===ki},Xi=function(e){return Yi(e)||Qi(e)};function Zi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ci(e)?Hi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Xi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=xi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function eo(e){return{name:e.name||"anonymous",location:to(e)}}function to(e){return e[Pi]}var no=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},io="TAKE",oo="CALL",ao="FORK",ro="SELECT",so=function(e,t){var n;return(n={})[Si]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function lo(e,t){return void 0===e&&(e="*"),Ui(e)?(Ei(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),so(io,{pattern:e})):_i(n=e)&&n[hi]&&Ei(t)&&Ui(t)?so(io,{channel:e,pattern:t}):_i(e)?(Ei(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),so(io,{channel:e})):void 0;var n}function co(e,t){return Li(t)&&(t=e,e=void 0),so("PUT",{channel:e,action:t})}function uo(e){var t=so("ALL",e);return t.combinator=!0,t}function yo(e,t){var n,i=null;return Oi(e)?n=e:(Ci(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&wi(n)&&Oi(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function fo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(oo,yo(e,n))}function go(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ao,yo(e,n))}function po(e){return void 0===e&&(e=bi),so("CANCEL",e)}function So(e){void 0===e&&(e=Vi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return so(ro,{selector:e,args:n})}var vo=fo.bind(null,Fi);var ho=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},mo=[],bo=0;function Ao(e){try{Po(),e()}finally{Io()}}function ko(e){mo.push(e),bo||(Po(),Lo())}function To(e){try{return Po(),e()}finally{Lo()}}function Po(){bo++}function Io(){bo--}function Lo(){var e;for(Io();!bo&&void 0!==(e=mo.shift());)Ao(e)}var Eo=function(e){return function(t){return e.some((function(e){return Ro(e)(t)}))}},Oo=function(e){return function(t){return e(t)}},wo=function(e){return function(t){return t.type===String(e)}},Co=function(e){return function(t){return t.type===e}},Do=function(){return Gi};function Ro(e){var t="*"===e?Do:wi(e)?wo:Ci(e)?Eo:Mi(e)?wo:Oi(e)?Oo:Ni(e)?Co:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Uo={type:pi},_o=function(e){return e&&e.type===pi};function Mo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Uo)}))},(e={})[hi]=!0,e.put=function(e){if(!t)if(_o(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[vi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Do),t?e(Uo):(e[vi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Wi(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[mi]?s(e):ko((function(){s(e)}))},r}function No(e,t){var n=e[gi];Oi(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Fo,$o=0,Go=function(){return++$o};function xo(e){e.isRunning()&&e.cancel()}var Vo=((Fo={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!_o(e)||r?n(e):n(Ti)};try{o.take(s,Ei(a)?Ro(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Fo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;ko((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Di(t)?No(t,n):n(t)}))},Fo.ALL=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t);if(0!==r.length){var s=Zi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ci(t)?[]:{})},Fo.RACE=function(e,t,n,i){var o=i.digestEffect,a=$o,r=Object.keys(t),s=Ci(t)?Hi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Xi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=xi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},Fo.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(Di(l))return void No(l,n);if(Ri(l))return void Qo(e,l,s.context,$o,eo(a),!1,n);n(l)}catch(e){n(e,!0)}},Fo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Li(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Fo.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(Ri(o))return o;var a=!1;return zi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Di(o)})}))}catch(e){return zi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:eo(t)}(c,a);To((function(){var t=Qo(e,c,l.context,$o,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Fo.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Wi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ci(t)){if(0===t.length)return void n([]);var r=Zi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Fo.CANCEL=function(e,t,n,i){var o=i.task;t===bi?xo(o):Ci(t)?t.forEach(xo):xo(t),n()},Fo.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},Fo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=no());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Uo):e.isEmpty()?(n.push(i),i.cancel=function(){Wi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Uo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Uo)}}}}(t.buffer),a=Ro(i),r=function t(n){_o(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},Fo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Fo.FLUSH=function(e,t,n){t.flush(n)},Fo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Fo.SET_CONTEXT=function(e,t,n,i){var o=i.task;ji(o.context,t),n()},Fo);function jo(e,t){return e+"?"+t}function Wo(e){var t=e.name,n=e.location;return n?t+" "+jo(n.fileName,n.lineNumber):t}function Bo(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var Ko=null,zo=[],qo=function(e){e.crashedEffect=Ko,zo.push(e)},Ho=function(){Ko=null,zo.length=0},Jo=function(){var e,t,n=zo[0],i=zo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=to(e))?t.code+" "+jo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Wo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Wo(e.meta)})),[Bo(zo)]).join("\n")};function Yo(e,t,n,i,o,a,r){var s;void 0===r&&(r=xi);var l,c,u=0,d=null,y=[],f=Object.create(n),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||(Wi(o,t),t.cont=xi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=xi,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,qo({meta:o,cancelledTasks:y}),S.isRoot){var i=Jo();Ho(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ki?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Ai]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=g,s.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ki,!1))},s.cont=r,s.end=p,s.setContext=function(e){ji(f,e)},s.toPromise=function(){return d||(d=ho(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Qo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Di(t)?No(t,i):Ri(t)?Qo(e,t,c.context,n,o,!1,i):t&&t[Si]?(0,Vo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=xi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(ki))},status:0},c=Yo(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),Ho()):Qi(e)?(l.status=1,d.cancel(),o=Oi(t.return)?t.return(ki):{done:!0,value:ki}):o=Yi(e)?Oi(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=Go();function l(n,o){a||(a=!0,i.cancel=xi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Ko=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=xi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=xi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Xo(e,t){for(var n=e.channel,i=void 0===n?Mo():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?qi:u,y=arguments.length,f=new Array(y>2?y-2:0),g=2;g<y;g++)f[g-2]=arguments[g];var p,S=t.apply(void 0,f),v=Go();if(l&&(l.rootSagaStarted=l.rootSagaStarted||xi,l.effectTriggered=l.effectTriggered||xi,l.effectResolved=l.effectResolved||xi,l.effectRejected=l.effectRejected||xi,l.effectCancelled=l.effectCancelled||xi,l.actionDispatched=l.actionDispatched||xi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=We.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Vi;var m={channel:i,dispatch:Ji(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:p};return To((function(){var e=Qo(m,S,s,v,eo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Zo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Mo():a,s=n.sagaMonitor,l=Ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Xo.bind(null,C({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){ji(o,e)},c},ea=function(e){return{done:!0,value:e}},ta={};function na(e){return _i(e)?"channel":Mi(e)?String(e):Oi(e)?e.name:String(e)}function ia(e,t,n){var i,o,a,r=t;function s(t,n){if(r===ta)return ea(t);if(n&&!o)throw r=ta,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===ta?ea(t):a}return zi(s,(function(e){return s(null,e)}),n)}function oa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+na(e)+", "+t.name+")")}function aa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:lo(e)},l=function(e){return{done:!1,value:go.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:po(e)}},u=function(e){return a=e},d=function(e){return r=e};return ia({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+na(e)+", "+t.name+")")}function ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:lo(e)},s=function(e){return{done:!1,value:fo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return ia({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+na(e)+", "+t.name+")")}function sa(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:fo.apply(void 0,[n].concat(a))},l={done:!1,value:vo(t)};return ia({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:ta}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function la(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return go.apply(void 0,[oa,e,t].concat(i))}function ca(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return go.apply(void 0,[aa,e,t].concat(i))}function ua(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return go.apply(void 0,[ra,e,t].concat(i))}class da{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return da.instance||(da.instance=new da),da.instance}static setContext(e){da.getInstance().context=e}static setAccessToken(e){da.getInstance().accessToken=e}static setUser(e){da.getInstance().user=e}static setRequestSource(e){da.getInstance().requestSource=e}static setOnRedirectTo(e){da.getInstance().onRedirectTo=e}static setLogout(e,t){da.getInstance().logout=n=>{n?e(n):da.onRedirectTo(t)}}static getContext(){var e;return null!=(e=da.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return da.getInstance().accessToken}static getRequestSource(){return da.getInstance().requestSource}static getUser(){return da.getInstance().user}static onRedirectTo(e,t){return da.getInstance().onRedirectTo(e,t)}static logout(e){return da.getInstance().logout(e)}}da.instance=void 0;const ya={getContext:()=>da.getContext(),getAccessToken:()=>da.getAccessToken(),getUser:()=>da.getUser(),onRedirectTo:(e,t)=>da.onRedirectTo(e,t),logout:e=>da.logout(e)},fa={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source"};let ga,pa;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ga||(ga={})),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"}(pa||(pa={}));class Sa extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function va(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 ha(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[fa.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[fa.frameWork]=e.metadataHeaders.framework),i}const ma=async e=>{var t,n,i;const o=da.getContext(),a=await async function(e,t){var n;const i=ha(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:da.getAccessToken)(),a=da.getRequestSource();t&&(i[fa.contentType]=t),a&&(i[fa.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=va(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 Sa("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 Sa(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{}}},ba=async(e,t,n)=>ma(C({url:e,method:"GET",contentType:"application/json",params:t},n)),Aa=async(e,t,n)=>ma(C({url:e,method:"POST",contentType:"application/json",body:t},n)),ka=async(e,t,n)=>ma(C({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Ta=async(e,t,n)=>ma(C({url:e,method:"PUT",contentType:"application/json",body:t},n)),Pa=async(e,t,n)=>ma(C({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Ia=async(e,t,n,i)=>ma(C({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),La=(e={})=>C({},e.jwt?{Authorization:e.jwt}:{}),Ea={v1:"/identity/resources/users/webauthn/v1/devices"},Oa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},wa={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"}}},Ca={v1:"/identity/resources/configurations/v1"},Da={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ra={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ua={v1:"/identity/resources/permissions/v1"},_a={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"}},Ma={v1:"/identity/resources/roles/v1"},Na={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},Fa={v1:"/identity/resources/impersonation/v1"},$a={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ga={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},xa={v1:"/team/resources/members/v1"},Va={v1:"/team/resources/roles/v1"},ja={v1:"/team/resources/stats/v1"},Wa={v1:"/team/resources/profile"},Ba={v1:"/tenants/resources/account-settings/v1"},Ka={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"}},za={v1:"/tenants/resources/sub-tenants/v1"},qa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ha={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"}}}},Ja={v1:"/subscriptions/resources/payment-providers/v1"},Ya={v1:"/subscriptions/resources/subscriptions/v1"},Qa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Xa={v1:"/reports/engine/resources/triggers/v1"},Za="/notification",er="/audits",tr={v1:"/event/resources/configurations/v1"},nr="/webhook",ir="/oauth",or="/flags",ar="/directory/resources/v1/configurations/scim2",rr="/directory/resources/scim/temp",sr="/entitlements";async function lr(e){return Ta(`${wa.v1}/tenant`,e)}async function cr(){return ba(`${wa.v2}/me/tenants`)}async function ur(e){return ba(Ka.v1,void 0,{headers:La(e)})}async function dr(e){return ba(Ka.tree.v1,void 0,{headers:La(e)})}async function yr(e){return ba(Ka.parents.v1,void 0,{headers:La(e)})}async function fr(e,t){return Aa(`${_a.users.v1}/count`,e,{headers:La(t)})}async function gr(){return ba(Ca.v1)}async function pr(){return ba(`${Ca.v1}/mfa-policy`)}async function Sr(){return ba(`${Ca.v1}/mfa-policy/vendor`)}async function vr(e){return e.id?ka(`${Ca.v1}/mfa-policy`,e):Aa(`${Ca.v1}/mfa-policy`,e)}async function hr(){return ba(`${Ca.v1}/lockout-policy`)}async function mr(){return ba(`${Ca.v1}/lockout-policy/vendor`)}async function br(e){return e.id?ka(`${Ca.v1}/lockout-policy`,e):Aa(`${Ca.v1}/lockout-policy`,e)}async function Ar(){try{return await ba(`${Ca.v1}/captcha-policy/public`)}catch{return null}}async function kr(){return ba(`${Ca.v1}/password-history-policy`)}async function Tr(){return ba(`${Ca.v1}/password-history-policy/vendor`)}async function Pr(e){return e.id?ka(`${Ca.v1}/password-history-policy`,e):Aa(`${Ca.v1}/password-history-policy`,e)}async function Ir(){return ba(`${Ca.v1}/password`)}async function Lr(){return ba(`${Da.emailDomain.v1}`)}async function Er(){return ba(`${Da.emailDomain.v1}/config`)}async function Or(e){return Aa(`${Da.emailDomain.v1}`,e)}async function wr(e){return Aa(`${Da.emailDomain.v1}/config`,e)}async function Cr(e){return Pa(`${Da.emailDomain.v1}/${e}`)}async function Dr(e){return ba(`${Da.ip.v1}`,e)}async function Rr(){return ba(`${Da.ip.v1}/config`)}async function Ur(e){return Aa(`${Da.ip.v1}`,e)}async function _r(e){return Aa(`${Da.ip.v1}/bulk`,e)}async function Mr(e){return Aa(`${Da.ip.v1}/config`,e)}async function Nr(e){return Pa(`${Da.ip.v1}/${e}`)}async function Fr(){return Aa(`${Da.ip.v1}/verify`)}async function $r(){return Aa(`${Da.ip.v1}/verify/allow`)}let Gr,xr,Vr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Gr||(Gr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(xr||(xr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Vr||(Vr={}));class jr extends Error{constructor(e){super(e)}}const Wr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new jr("'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 Br extends Error{constructor(e){super(e)}}const Kr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(Wr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Wr(t)}})(e.split(".")[n]))}catch(e){throw new Br("Invalid token specified: "+e.message)}},zr=["type"],qr=["type"];async function Hr(e){if(!e.accessToken)return e;da.setAccessToken(e.accessToken);const t=await ba(`${wa.v2}/me`),n=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(n),n}async function Jr(e){if(!e.accessToken)return{user:e};da.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ba(`${wa.v2}/me`),cr()]),i=C({},e,e.accessToken?Kr(e.accessToken):{},t);return da.setUser(i),{user:i,tenants:n}}async function Yr(e){da.setAccessToken(e.id_token);const t=await ba(`${wa.v2}/me`),n=e.id_token?Kr(e.id_token):{},i=C({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return da.setUser(i),i}async function Qr(e){try{const{address:t}=await Aa(`${Oa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Xr(e){return Aa(`${Oa.v1}/user/saml/prelogin`,e)}async function Zr(e){return Hr(await Aa(`${Oa.v1}/user/saml/postlogin`,e))}async function es(e){return Hr(await Aa(`${Oa.v1}/user/oidc/postlogin`,e))}async function ts(e){return Hr(await Aa(`${Oa.v1}/user`,e))}async function ns(e){return Hr(await Aa(`${Oa.v1}/user/mfa/verify`,e))}async function is(e){return Aa(`${wa.v1}/activate`,e)}async function os(e){return ba(`${wa.v1}/activate/strategy`,e)}async function as(e){return Aa(`${wa.v1}/activate/reset`,e)}async function rs(e){return Aa(`${wa.v1}/invitation/reset`,e)}async function ss(e){return Aa(`${wa.v1}/invitation/accept`,e)}async function ls(){return Hr(await Aa(`${Oa.v1}/user/token/refresh`))}async function cs(){return Jr(await Aa(`${Oa.v1}/user/token/refresh`))}async function us(){return Aa(`${Oa.v1}/logout`)}async function ds(e){return ba(`${ir}/logout`,e)}async function ys(e){return Aa(`${wa.v1}/passwords/reset`,e)}async function fs(e){return Aa(`${wa.v1}/passwords/reset/verify`,e)}async function gs(e){return ba(`${wa.v1}/passwords/config`,e)}async function ps(e){return Aa(`${Oa.v1}/user/mfa/recover`,e)}async function Ss(){return Aa(`${wa.v1}/mfa/enroll`)}async function vs(){return Aa(`${wa.v1}/mfa/authenticator/enroll`)}async function hs(e){return Aa(`${wa.v1}/mfa/authenticator/enroll/verify`,e)}async function ms(e){return Aa(`${wa.v1}/mfa/sms/enroll`,e)}async function bs(e){return Aa(`${wa.v1}/mfa/sms/enroll/verify`,e)}async function As(){return Aa(`${wa.v1}/mfa/webauthn/enroll`)}async function ks(e){return Aa(`${wa.v1}/mfa/webauthn/enroll/verify`,e)}async function Ts(e){return Aa(`${wa.v1}/mfa/enroll/verify`,e)}async function Ps(e){return Aa(`${wa.v1}/mfa/disable`,e)}async function Is(e,t){return Aa(`${wa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Ls(e){return Aa(`${wa.v1}/mfa/sms/${e}/disable`)}async function Es(e,t){return Aa(`${wa.v1}/mfa/sms/${e}/disable/verify`,t)}async function Os(e){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable`)}async function ws(e,t){return Aa(`${wa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Cs(){return ba(`${wa.v1}/mfa/devices`)}async function Ds(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll`,e)}async function Rs(e){return Aa(`${Oa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Us(e,t){return Aa(`${Oa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function _s(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll`,e)}async function Ms(e){return Aa(`${Oa.v1}/user/mfa/sms/enroll/verify`,e)}async function Ns(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}`,t)}async function Fs(e,t){return Aa(`${Oa.v1}/user/mfa/sms/${e}/verify`,t)}async function $s(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll`,e)}async function Gs(e){return Aa(`${Oa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function xs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}`,t)}async function Vs(e,t){return Aa(`${Oa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function js(){return ba(`${Ga.v1}/saml/configurations`)}async function Ws(e){return Aa(`${Ga.v1}/saml/configurations`,e)}async function Bs(){return ba(`${Ga.v1}/saml/configurations/vendor-config`)}async function Ks(e){return Ta(`${Ga.v1}/saml/configurations/metadata`,e)}async function zs(){return Ta(`${Ga.v1}/saml/validations/domain`)}async function qs(){return ba(`${Ga.v1}/saml/configurations/roles/default`)}async function Hs(){return ba(`${Ga.v2}/saml/configurations/groups`)}async function Js({roleIds:e}){return Aa(`${Ga.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ys({roleIds:e,group:t}){return Aa(`${Ga.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Qs({roleIds:e,group:t,id:n}){return ka(`${Ga.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Xs({id:e}){return Pa(`${Ga.v2}/saml/configurations/groups/${e}`)}async function Zs(){return ba(`${Ga.v1}/oidc/configurations`)}async function el(){return ba(`${Ga.v2}/configurations/public`)}async function tl(){return ba(Ra.v1)}async function nl(){return ba(Ra.v2)}async function il(){return ba(Ra.custom.v1)}async function ol({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),Aa(`${Oa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function al(){return ba(`${Ca.v1}/public`)}async function rl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Aa(`${wa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Hr(n):void 0,userId:i,tenantId:o}}async function sl(){return ba(wa.sessions.currentUser.v1)}async function ll(){return ba(`${wa.sessions.currentUser.v1}/current`)}async function cl(e){return Aa(`${wa.sessions.v1}/revoke`,{userId:e})}async function ul(){return ba(wa.sessions.configurations.v1)}async function dl(e){await Aa(wa.sessions.configurations.v1,e)}async function yl(e){await Pa(`${wa.sessions.currentUser.v1}/${e}`)}async function fl(){await Pa(`${wa.sessions.currentUser.v1}/all`)}async function gl(){return ba(wa.accessTokens.v1)}async function pl(){return ba(_a.accessTokens.v1)}async function Sl({id:e}){return Pa(`${_a.accessTokens.v1}/${e}`)}async function vl({id:e}){return Pa(`${wa.accessTokens.v1}/${e}`)}async function hl(e){return Aa(wa.accessTokens.v1,e)}async function ml(e){return Aa(_a.accessTokens.v1,e)}async function bl(){return ba(wa.apiTokens.v1)}async function Al(){return ba(_a.apiTokens.v1)}async function kl(e){return Aa(wa.apiTokens.v1,e)}async function Tl(e){return Aa(_a.apiTokens.v2,e)}async function Pl({tokenId:e}){return Pa(`${_a.apiTokens.v1}/${e}`)}async function Il({tokenId:e}){return Pa(`${wa.apiTokens.v1}/${e}`)}async function Ll({userId:e}){return ba(`${wa.v1}/${e}`)}async function El(e){return ba(`${Ca.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Ol(e){let{type:t}=e,n=Ii(e,zr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function wl(e){let{type:t}=e,n=Ii(e,qr);return Aa(`${Oa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Cl({token:e}){return Aa(_a.invites.verify.v1,{token:e})}async function Dl(){return ba(`${Ga.v1}/configurations`)}async function Rl(e){return Aa(`${Ga.v1}/configurations`,e)}async function Ul(e,t){return ka(`${Ga.v1}/configurations/${e}`,t)}async function _l(e){return Pa(`${Ga.v1}/configurations/${e}`)}async function Ml(e){return Aa(`${Ga.v1}/configurations/metadata`,e)}async function Nl(e,t){return Ta(`${Ga.v1}/configurations/${e}/metadata`,t)}async function Fl(e,t){return Aa(`${Ga.v1}/configurations/${e}/domains`,t)}async function $l(e,t){return Pa(`${Ga.v1}/configurations/${e}/domains/${t}`)}async function Gl(e,t){return Ta(`${Ga.v1}/configurations/${e}/domains/${t}/validate`)}async function xl(e){return ba(`${Ga.v1}/configurations/${e}/roles`)}async function Vl(e,t){return Ta(`${Ga.v1}/configurations/${e}/roles`,t)}async function jl(e,t){return Aa(`${Ga.v1}/configurations/${e}/groups`,t)}async function Wl(e,{roleIds:t,group:n,id:i}){return ka(`${Ga.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Bl(e,t){return Pa(`${Ga.v1}/configurations/${e}/groups/${t}`)}async function Kl(e){return ba(`${Ga.v1}/configurations/${e}/groups`)}async function zl(e){return Aa(`${Oa.v2}/user/sso/prelogin`,e)}async function ql(e){return Hr(await Aa(`${Oa.v2}/user/oidc/postlogin`,e))}async function Hl(e){return Yr(await Aa(`${ir}/token`,e))}async function Jl(){return Yr(await Aa(`${ir}/authorize/silent`))}async function Yl(e){return Aa(`${wa.v1}/phone/reset`,e)}async function Ql(e){return Aa(`${wa.v1}/phone/reset/verify`,e)}async function Xl(e){return Aa(`${wa.v1}/phone`,e)}async function Zl(e){return Aa(`${wa.v1}/phone/verify`,e)}async function ec(e){return Ta(`${wa.v1}/phone/change`,e)}async function tc(e){return Aa(`${Oa.v1}/webauthn/prelogin`,e)}async function nc(e){return Aa(`${Oa.v1}/webauthn/postlogin`,e)}async function ic(){return Aa(Ea.v1)}async function oc(){return ba(Ea.v1)}async function ac(e){return Pa(`${Ea.v1}/${e}`)}async function rc(e){return Aa(`${Ea.v1}/verify`,e)}async function sc(){return ba(`${Ca.v1}/auth/strategies/public`)}async function lc(){return ba(`${Ca.v1}/mfa/strategies`)}async function cc(e){return ba(`${wa.v2}/me`,null!=e?e:{addRoles:!0})}async function uc(e){return Ta(`${wa.v2}/me`,e)}async function dc(e){return Ta(`${Wa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function yc(e){return Aa(`${wa.v1}/passwords/change`,e)}async function fc(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 ba(xa.v1,C({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function gc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function pc(e){return Pa(`${xa.v1}/${e.userId}`)}async function Sc(e){return Ta(xa.v1,e)}async function vc(e){return Aa(_a.invites.user.v1,C({},e))}async function hc(e){return ka(_a.invites.user.v1,C({},e))}async function mc(){return Pa(_a.invites.user.v1)}async function bc(){return ba(_a.invites.user.v1)}async function Ac(){return ba(_a.invites.configuration.v1)}async function kc(){return ba(Va.v1)}async function Tc(){return ba(Ua.v1)}async function Pc(){return ba(`${ja.v1}/members`)}async function Ic(e){return Aa(`${xa.v1}/${e.userId}/resendActivationEmail`,{})}async function Lc(e){return Aa(wa.v2,C({},e,{provider:"local"}))}async function Ec(e){return Aa(wa.invitation.resendAll.v1,C({},e))}async function Oc(e){var t,n;const i=await ba("/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 wc(){return ba("/metadata/admin-box")}async function Cc(e){return Aa("/metadata/admin-box",e)}async function Dc(){const e=await ba("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Rc=async()=>Oc({entityName:"notifications"}),Uc=async()=>Oc({entityName:"saml"}),_c=async()=>Oc({entityName:"audits"}),Mc=async e=>async function(e){const t=await ba(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Nc=["dataFilters"],Fc=["templateId","dataFilters"],$c=["dataFilters"];async function Gc(e){return ba(`${Qa.v2}/tenant-reports`,e)}async function xc(e){return ba(`${Qa.v2}/${e.id}/tenant-reports`)}async function Vc(e){let{dataFilters:t}=e,n=Ii(e,Nc);return{html:await ba(`${Xa.v1}/preview-report`,C({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function jc(e){let{templateId:t,dataFilters:n}=e,i=Ii(e,Fc);return Aa(`${Qa.v2}/${t}/tenant-reports`,C({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Wc(e){let{dataFilters:t}=e,n=Ii(e,$c);const i=await ba(`${Xa.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 Bc(e){return Aa(`${Xa.v1}/tenant-reports`,e)}async function Kc(e){return ba(Za,{params:e})}async function zc(e){return Ta(`${Za}/status`,{params:e})}async function qc(e){const{notificationId:t,pinStatus:n}=e;return Ta(`${Za}/${n}`,{notificationId:t})}async function Hc(){return Aa(`${Za}/status/mark-all-read`)}const Jc=["endpoint","headerProps"];async function Yc(e){return ba(er,e)}async function Qc(e){return ba(`${er}/stats`,e)}async function Xc(e){const{endpoint:t,headerProps:n}=e,i=Ii(e,Jc);return Ia(`${er}/export/${t}`,{properties:n},i)}const Zc=["eventKey"],eu=["eventKey"],tu=()=>ba(`${qa.v1}/slack`),nu=()=>ba(`${qa.v1}/slack/applications`),iu=()=>ba(`${qa.v1}/slack/channels`),ou=e=>e.id?ka(`${qa.v1}/slack/subscription/${e.id}`,e):Aa(`${qa.v1}/slack/subscriptions`,e),au=e=>Pa(`${qa.v1}/slack/subscriptions/${e.id}`),ru=e=>Aa(`${qa.v1}/slack/applications/registrations`,{code:e}),su=()=>ba(`${qa.v1}/emails`),lu=e=>{let{eventKey:t}=e,n=Ii(e,Zc);return Aa(`${qa.v1}/emails/${t}`,n)},cu=({eventKey:e,enabled:t})=>ka(`${qa.v1}/emails/${e}`,{enabled:t}),uu=(e,t)=>Pa(`${qa.v1}/emails/${e}/subscriptions/${t}`),du=(e,t,n)=>Ta(`${qa.v1}/emails/${t}/subscriptions/${e}`,n),yu=e=>Pa(`${qa.v1}/emails/${e}`),fu=()=>ba(`${qa.v2}/sms`),gu=e=>{let{eventKey:t}=e,n=Ii(e,eu);return Aa(`${qa.v2}/sms/${t}`,n)},pu=({eventKey:e,enabled:t})=>ka(`${qa.v2}/sms/${e}`,{enabled:t}),Su=(e,t)=>Pa(`${qa.v2}/sms/${e}/subscriptions/${t}`),vu=(e,t,n)=>Ta(`${qa.v2}/sms/${t}/subscriptions/${e}`,n),hu=e=>Pa(`${qa.v2}/sms/${e}`),mu=()=>ba(nr),bu=e=>e._id?ka(`${nr}/${e._id}`,e):Aa(`${nr}/custom`,e),Au=e=>Pa(`${nr}/${e}`),ku=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ba(`${nr}/logs/?${i.toString()}`)},Tu=e=>Aa(`${nr}/test`,e),Pu=e=>Aa(`${nr}/logs/${e}/retries`),Iu=()=>ba(`${tr.v1}/categories`),Lu=e=>ba(tr.v1,{channels:e});async function Eu(e,t){return Ta(Ba.v1,e,{headers:La(t)})}async function Ou(e){return ba(Ba.v1,void 0,{headers:La(e)})}async function wu(){return ba(`${Ba.v1}/public`)}const Cu=["roleId"],Du=["roleId"],Ru=["permissionId"];async function Uu(){return ba(Ma.v1)}async function _u(e){return Aa(Ma.v1,e)}async function Mu({roleId:e}){return Pa(`${Ma.v1}/${e}`)}async function Nu(e){let{roleId:t}=e,n=Ii(e,Cu);return ka(`${Ma.v1}/${t}`,n)}async function Fu(e){let{roleId:t}=e,n=Ii(e,Du);return Ta(`${Ma.v1}/${t}/permissions`,n)}async function $u(){return ba(Ua.v1)}async function Gu(e){let{permissionId:t}=e,n=Ii(e,Ru);return Ta(`${Ua.v1}/${t}/roles`,n)}async function xu(){return ba(`${Ua.v1}/categories`)}async function Vu(){return ba(Ha.subscriptions.v1)}async function ju(e){return ba(`${Ha.subscriptions.v1}/${e}`)}async function Wu(e){return Ta(`${Ha.subscriptions.v1}/${e}/cancellations/`,{})}async function Bu(e){return Ta(`${Ha.subscriptions.v1}/${e}/renewals/`,{})}async function Ku(e,{paymentMethodId:t,planId:n}){return Ta(`${Ha.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function zu(e){return ba(`${Ya.v1}/${e}`)}async function qu(){return ba(`${Ya.v1}`)}async function Hu(e){return Ta(`${Ya.v1}/${e}/cancellations/`,{})}async function Ju(e){return Ta(`${Ya.v1}/${e}/renewals/`,{})}async function Yu(e,{paymentMethodId:t,planId:n}){return Ta(`${Ya.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Qu(){return ba(Ha.plans.v1)}async function Xu(e){return ba(`${Ha.plans.v1}/${e}`)}async function Zu(){return ba(Ha.invoices.v1)}async function ed(e){return ba(`${Ha.invoices.v1}/${e}`)}async function td(e,t){return ba(`${Ha.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const nd=["email"];async function id(){return ba(Ha.paymentMethods.v1)}async function od(e){return ba(`${Ha.paymentMethods.v1}/${e}`)}async function ad(e,t){let{email:n}=t,i=Ii(t,nd);return ka(`${Ha.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function rd(e){return Aa(Ha.paymentProviders.stripe.subscriptions.v1,e)}async function sd(e){return ba(`${Ha.paymentProviders.stripe.customers.v1}/${e}`)}async function ld(e){return Aa(`${Ha.paymentProviders.stripe.customers.v1}`,e)}async function cd(){return ba(`${Ha.paymentProviders.stripe.publicConfigurations.v1}`)}async function ud(e){return Aa(`${Ha.paymentProviders.stripe.setupIntents.v1}`,e)}async function dd(e){return ba(`${Ha.summaries.v1}/${e}`)}async function yd(e){return ba(`${Ha.tenantConfiguration.v1}/${e}`)}async function fd(e){return Aa(`${Ha.tenantConfiguration.v1}`,e)}async function gd(){return ba(Ja.v1)}async function pd(){return ba(`${Ha.configurations.vendorPublicConfigurations.v1}`)}let Sd,vd,hd,md,bd,Ad;async function kd(){return ba("/vendors/public")}async function Td(e){return ba(Na.v1,e)}async function Pd(e){return Aa(Na.v1,e)}async function Id(e,t){return Pa(Na.v1,e,{headers:La(t)})}async function Ld(e,t,n){return Aa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Ed(e,t,n){return Pa(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function Od(e,t,n){return ka(`${Na.v1}/${e}/roles`,t,{headers:La(n)})}async function wd(e,t){return Aa(za.v1,e,{headers:La(t)})}async function Cd(e,t){return Pa(`${za.v1}/${e}`,void 0,{headers:La(t)})}async function Dd(e,t,n){return Ta(`${Na.v1}/${e}/access`,t,{headers:La(n)})}async function Rd(e,t){return Aa(`${Na.v2}/`,e,{headers:La(t)})}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Sd||(Sd={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(vd||(vd={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(hd||(hd={})),(md||(md={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(bd||(bd={})),function(e){e.CREATE="create_customer"}(Ad||(Ad={}));const Ud={flags:{}};class _d{constructor(){var e;this._flags={},this._flags=null!=(e=Ud.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new _d;return n.set(e),_d._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==Ud?void 0:Ud.flags)?t:{},null!=e?e:{})}}async function Md(){return ba(or)}async function Nd(){return ba(`${ar}`)}async function Fd(e,t){return ka(`${ar}/${e}`,t)}async function $d(e){return Aa(`${ar}`,e)}async function Gd(e){return Pa(`${ar}/${e}`)}async function xd(e){return ba(`${rr}/${e}/Users/count`)}async function Vd(e){return Aa(`${Fa.v1}`,e)}_d._instances={};const jd=["groupId"];async function Wd({groupId:e},t){return ba(`${$a.v1}/${e}`,C({},t))}async function Bd(e){return ba(`${$a.v1}`,C({},e))}async function Kd(e,t){return Aa(`${$a.getByIds.v1}`,e,{params:t})}async function zd(e){return Aa(`${$a.v1}`,e)}async function qd(e){let{groupId:t}=e,n=Ii(e,jd);return ka(`${$a.v1}/${t}`,n)}async function Hd(e){return Pa(`${$a.v1}/${e}`)}async function Jd(e,t){return Aa(`${$a.v1}/${e}/roles`,t)}async function Yd(e,t){return Pa(`${$a.v1}/${e}/roles`,t)}async function Qd(e,t){return Aa(`${$a.v1}/${e}/users`,t)}async function Xd(e,t){return Pa(`${$a.v1}/${e}/users`,t)}async function Zd(){return ba(`${$a.configurations.v1}`)}async function ey(e){return Aa(`${$a.configurations.v1}`,e)}async function ty(e){return Aa(`${wa.v3}/me/token`,e)}async function ny(e,t){return ba(wa.v3,e,{headers:La(t)})}async function iy(){return ba(sr)}let oy,ay,ry,sy,ly;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(oy||(oy={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(ay||(ay={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(ry||(ry={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(sy||(sy={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(ly||(ly={}));const cy=[/^(.*)\/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],uy=`${Oa.v1}/user/token/refresh`,dy=`${ir}/authorize/silent`,yy=`${wa.v2}/me`,fy=`${wa.v2}/me/tenants`;let gy,py,Sy,vy,hy;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(gy||(gy={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(py||(py={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Sy||(Sy={})),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"}(vy||(vy={})),function(e){e.ASC="ASC",e.DESC="DESC"}(hy||(hy={}));const my={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 by={fetch:e,ContextHolder:da,FronteggContext:ya,api:my,FronteggApiError:Sa,AuthStrategyEnum:xr,MachineToMachineAuthStrategy:Vr,SocialLoginProviders:Gr,ISubscriptionCancellationPolicy:hd,ISubscriptionStatus:Sd,PaymentMethodType:vd,ProviderType:md};let Ay,ky;!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"}(Ay||(Ay={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(ky||(ky={}));const Ty="input is invalid type",Py="undefined"!=typeof ArrayBuffer,Iy="0123456789abcdef".split(""),Ly=[-2147483648,8388608,32768,128],Ey=[24,16,8,0],Oy=[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],wy=["hex","array","digest","arrayBuffer"],Cy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Py&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Dy=function(e){return function(t){const n=new Uy(!0).update(t);return null==n?void 0:n[e]()}},Ry=function(e){return function(t,n){const i=new _y(t,!0).update(n);return null==i?void 0:i[e]()}};class Uy{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=()=>Uy.prototype.digest(),e?(Cy[0]=Cy[16]=Cy[1]=Cy[2]=Cy[3]=Cy[4]=Cy[5]=Cy[6]=Cy[7]=Cy[8]=Cy[9]=Cy[10]=Cy[11]=Cy[12]=Cy[13]=Cy[14]=Cy[15]=0,this.blocks=Cy):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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty);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]<<Ey[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<Ey[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<Ey[3&o++],s[o>>2]|=(128|i>>12&63)<<Ey[3&o++],s[o>>2]|=(128|i>>6&63)<<Ey[3&o++],s[o>>2]|=(128|63&i)<<Ey[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]|=Ly[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+Oy[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+Oy[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+Oy[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+Oy[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=Iy[e>>28&15]+Iy[e>>24&15]+Iy[e>>20&15]+Iy[e>>16&15]+Iy[e>>12&15]+Iy[e>>8&15]+Iy[e>>4&15]+Iy[15&e]+Iy[t>>28&15]+Iy[t>>24&15]+Iy[t>>20&15]+Iy[t>>16&15]+Iy[t>>12&15]+Iy[t>>8&15]+Iy[t>>4&15]+Iy[15&t]+Iy[n>>28&15]+Iy[n>>24&15]+Iy[n>>20&15]+Iy[n>>16&15]+Iy[n>>12&15]+Iy[n>>8&15]+Iy[n>>4&15]+Iy[15&n]+Iy[i>>28&15]+Iy[i>>24&15]+Iy[i>>20&15]+Iy[i>>16&15]+Iy[i>>12&15]+Iy[i>>8&15]+Iy[i>>4&15]+Iy[15&i]+Iy[o>>28&15]+Iy[o>>24&15]+Iy[o>>20&15]+Iy[o>>16&15]+Iy[o>>12&15]+Iy[o>>8&15]+Iy[o>>4&15]+Iy[15&o]+Iy[a>>28&15]+Iy[a>>24&15]+Iy[a>>20&15]+Iy[a>>16&15]+Iy[a>>12&15]+Iy[a>>8&15]+Iy[a>>4&15]+Iy[15&a]+Iy[r>>28&15]+Iy[r>>24&15]+Iy[r>>20&15]+Iy[r>>16&15]+Iy[r>>12&15]+Iy[r>>8&15]+Iy[r>>4&15]+Iy[15&r];return l+=Iy[s>>28&15]+Iy[s>>24&15]+Iy[s>>20&15]+Iy[s>>16&15]+Iy[s>>12&15]+Iy[s>>8&15]+Iy[s>>4&15]+Iy[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 _y extends Uy{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(Ty);if(null===e)throw new Error(Ty);if(Py&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Py&&ArrayBuffer.isView(e)))throw new Error(Ty)}var o;e.length>64&&(e=null==(o=new Uy(!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}Uy.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();Uy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Uy.prototype.finalize.call(this)}}}const My=function(){const e=Dy("hex");e.create=function(){return new Uy},e.update=function(t){return e.create().update(t)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Dy(n)}return e}();function Ny(e,t){const n=C({},e);return t.forEach((e=>{delete n[e]})),n}async function Fy(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=My.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function $y(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Ry("hex");e.create=function(e){return new _y(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<wy.length;++t){const n=wy[t];e[n]=Ry(n)}}();const Gy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*xy(e){const t=yield So((e=>e.root.appName));return _d.getFeatureFlags(e,t)}const Vy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},jy=C({},Vy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Wy=[{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"}],By={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},Ky=C({},By,{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}),zy={loading:!1,error:void 0,saving:!0,profile:By},qy={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"},Hy={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:xr.EmailAndPassword,machineToMachineAuthStrategy:Vr.ClientCredentials},Jy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Yy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Qy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Xy={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},Zy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},ef=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],tf={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Xy,roles:ef,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},nf=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],of={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:[Wy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},af={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:[Wy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Wy[0]],managedBy:Sy.FRONTEGG}]},rf={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},sf=[af,of],lf=[rf],cf=[{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}],uf=[{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"}],df={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},yf={isActive:!0,strategy:xn.ALLOW},ff=[{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"}],gf=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(C({},af,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},pf=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"}),Sf=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:gf(6),roles:[pf("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:Sy.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:gf(44),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:gf(8),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:gf(5),roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:gf(21),description:"BDR, AE, and inside sales",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:gf(23),description:"Dev success and customer success",roles:[pf("Admin")],managedBy:Sy.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:gf(10),description:"The marketing department",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:gf(4),description:"Human resources",roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:gf(3),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:gf(8),roles:[pf("Editor")],managedBy:Sy.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:gf(4),roles:[pf("Viewer")],managedBy:Sy.FRONTEGG}];let vf,hf,mf;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(vf||(vf={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(hf||(hf={})),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"}(mf||(mf={})),mf.profile,mf.privacy,mf.personalApiTokens,mf.account,mf.users,mf.groups,mf.security,mf.sso,mf.audits,mf.webhooks,mf.apiTokens,mf.roles,mf.subscriptions;const bf=["events","url"];function*Af(){yield co(yi.setSignUpState({loading:!0}));try{const e=yield fo(my.auth.getVendorConfig),[t]=(yield fo(my.auth.getVendorPublicAuthStrategiesConfig),yield fo(xy,["admin_portal_login_per_tenant"]));if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield co(yi.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*kf(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,bf);yield co(yi.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield So((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield fo(my.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:hf.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(da.setAccessToken(null==s?void 0:s.accessToken),da.setUser(s),!r&&s&&Ng(s)){const t=yield Gg(s);yield co(yi.setState(t)),a(e.loginUrl)}else yield co(yi.setSignUpState({loading:!1,shouldActivate:r,stage:pn.SignUpSuccess})),yield co(yi.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield co(yi.loadTenants()))}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setSignUpState({loading:!1,error:e.message}))}yield co(yi.setSignUpState({loading:!1}))}function*Tf(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield So((e=>e.auth.signUpState));yield co(yi.resetSignUpState()),yield co(yi.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Pf(){yield ua(yi.signUpUser,kf),yield ua(yi.resetSignUpStateSoft,Tf)}const If={setVendorState:(e,{payload:t})=>C({},e,t)},Lf={loadVendorPublicInfo:lt("vendor/loadVendorPublicInfo")},Ef={loading:!1},{reducer:Of,actions:wf}=ut({name:Rt,initialState:Ef,reducers:C({},If)}),Cf=C({},wf,Lf);function*Df(){yield co(Cf.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield my.vendor.getVendorPublicInfo();yield co(Cf.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield co(Cf.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Rf=["callback"],Uf=["callback"],_f=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"];function*$f(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield fo(my.auth.getGlobalSecurityPolicy);yield co(yi.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha()),yield co(yi.loadPublicAuthStrategiesPolicy())}function*Gf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorConfig),[t]=yield fo(xy,["admin_portal_login_per_tenant"]);if(t){const t=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield co(yi.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*xf(){yield co(yi.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPublicAuthStrategiesConfig);yield co(yi.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Vf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getMfaPolicy);yield co(yi.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*jf(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorMfaPolicy);yield co(yi.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Wf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Rf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveMfaPolicy,n);yield co(yi.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Bf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getLockoutPolicy);yield co(yi.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Uf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield fo(my.auth.saveLockoutPolicy,n);yield co(yi.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zf(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorLockoutPolicy);yield co(yi.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*qf(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCaptchaPolicy);yield co(yi.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Hf(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordHistoryPolicy);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Jf(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield fo(my.auth.getVendorPasswordHistoryPolicy);yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Yf(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_f);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield fo(my.auth.savePasswordHistoryPolicy,n);yield co(yi.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Qf(){yield co(yi.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield fo(my.auth.getPasswordConfigPolicy);yield co(yi.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Xf(){yield ua(yi.loadSecurityPolicy,$f),yield la(yi.saveSecurityPolicyMfa,Wf),yield la(yi.loadSecurityPolicyMfa,Vf),yield la(yi.loadSecurityPolicyVendorMfa,jf),yield la(yi.saveSecurityPolicyLockout,Kf),yield la(yi.loadSecurityPolicyLockout,Bf),yield la(yi.loadSecurityPolicyVendorLockout,zf),yield la(yi.loadSecurityPolicyCaptcha,qf),yield la(yi.saveSecurityPolicyPasswordHistory,Yf),yield la(yi.loadSecurityPolicyPasswordHistory,Hf),yield la(yi.loadSecurityPolicyVendorPasswordHistory,Jf),yield la(yi.loadVendorPasswordConfig,Qf),yield la(yi.loadPublicSecurityPolicy,Gf),yield la(yi.loadPublicAuthStrategiesPolicy,xf)}function*Zf(){yield co(yi.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield co(yi.setSecurityPolicyPublicState({policy:Hy,loading:!1}))}catch(e){yield co(yi.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*eg(){yield co(yi.setSecurityPolicyGlobalState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyGlobalState({policy:qy,loading:!1})),yield co(yi.loadSecurityPolicyMfa()),yield co(yi.loadSecurityPolicyVendorMfa()),yield co(yi.loadSecurityPolicyLockout()),yield co(yi.loadSecurityPolicyVendorLockout()),yield co(yi.loadSecurityPolicyPasswordHistory()),yield co(yi.loadSecurityPolicyVendorPasswordHistory()),yield co(yi.loadSecurityPolicyCaptcha())}function*tg(){yield co(yi.setSecurityPolicyMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:Jy,loading:!1}))}function*ng(){yield co(yi.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorMfaState({policy:Jy,loading:!1}))}function*ig(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,Mf);yield co(yi.setSecurityPolicyMfaState({saving:!0,error:null}));const o=C({},Yy,{id:null!=(t=i.id)?t:Yy.id,enforceMFAType:i.enforceMFAType});yield mt(),yield co(yi.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*og(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*ag(){yield co(yi.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorLockoutState({policy:Yy,loading:!1}))}function*rg(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Nf);yield co(yi.setSecurityPolicyLockoutState({saving:!0,error:null})),yield mt();const i=C({},Yy,n,{id:n.id?n.id:Yy.id});null==t||t(i),yield co(yi.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*sg(){yield co(yi.setSecurityPolicyLockoutState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyLockoutState({policy:Yy,loading:!1}))}function*lg(){yield co(yi.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:Qy,loading:!1}))}function*cg(){yield co(yi.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield mt(),yield co(yi.setSecurityPolicyVendorPasswordHistoryState({policy:Qy,loading:!1}))}function*ug(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ff);yield co(yi.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield mt();const i=C({},Qy,n,{id:n.id?n.id:Qy.id});null==t||t(i),yield co(yi.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*dg(){yield ua(yi.loadSecurityPolicy,eg),yield la(yi.loadPublicSecurityPolicy,Zf),yield la(yi.saveSecurityPolicyMfa,ig),yield la(yi.loadSecurityPolicyMfa,tg),yield la(yi.loadSecurityPolicyVendorMfa,ng),yield la(yi.saveSecurityPolicyLockout,rg),yield la(yi.loadSecurityPolicyLockout,og),yield la(yi.loadSecurityPolicyVendorLockout,ag),yield la(yi.loadSecurityPolicyCaptcha,sg),yield la(yi.saveSecurityPolicyPasswordHistory,ug),yield la(yi.loadSecurityPolicyPasswordHistory,lg),yield la(yi.loadSecurityPolicyVendorPasswordHistory,cg)}const yg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},fg=e=>{const{pathname:t}=new URL(e),n=yg(e);return n?t+n:t},gg=["callback"],pg=["callback"],Sg=["callback"],vg=["callback"],hg=["callback","events"],mg=["callback"],bg=["callback"],Ag=["callback"],kg=["callback"],Tg=["callback"],Pg=["callback"],Ig=["callback"],Lg=["callback"],Eg=["callback"],Og=["callback","deviceId"],wg=["callback","deviceId"],Cg=["callback","deviceId"],Dg=["callback","deviceId"],Rg={[xr.Code]:Pt.loginWithOtc,[xr.EmailAndPassword]:Pt.loginWithPassword,[xr.MagicLink]:Pt.magicLinkPreLoginSuccess,[xr.SmsCode]:Pt.loginWithSmsOtc};function*Ug(){const e=da.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield So((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c,customLoginAuthenticatedUrl:u}=t;try{var d,y;!u&&null!=(d=(y=da.getContext()).tenantResolver)&&d.call(y)&&(yield fo(Hg),u=yield So((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl})))}catch{}const f=window.localStorage.getItem(Et);f&&![a,r,s,l].includes(f)&&(c=f),window.localStorage.removeItem(Et),yield mt(200),co(yi.resetLoginState());const 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?fg(u):c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(g,{refresh:g.startsWith("http")})}function*_g(){let e;try{var t;const n=yield fo(my.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield co(yi.setState({ssoACS:e}))}function*Mg(){try{const{isActive:e}=yield fo(my.auth.getSSOPublicConfiguration);yield co(yi.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const Ng=e=>e.mfaRequired&&e.mfaToken?(da.setAccessToken(null),da.setUser(null),!0):(da.setAccessToken(e.accessToken),da.setUser(e),!1),Fg=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},$g=e=>{if(1===e.length){const[t]=e;if(t===ry.AuthenticatorApp)return an.authenticatorApp;if(t===ry.SMS)return an.smsSetPhoneNumber}return an.verify};function*Gg(e){let t=Pt.loginWithTwoFactor,n={};const{loginState:i}=yield So((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield fo(my.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Fg(e.mfaDevices)}:(n={step:$g(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*xg(e){var t;const{routes:n,loginState:i}=yield So((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Vg(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(jg):yield fo(Bg)}function*jg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Wg(){const{user:e}=yield So((e=>e.auth));if(null==e||!e.refreshToken)return da.setAccessToken(null),da.setUser(null),void(yield co(yi.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield fo(my.auth.exchangeOAuthTokens,t);yield co(yi.setState({user:n,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:null,isAuthenticated:!1}))}}function*Bg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*Kg(){try{const t=da.onRedirectTo,{routes:n,loginState:i}=yield So((e=>e.auth)),{user:o,tenants:a}=yield fo(my.auth.refreshTokenV2);if(Ng(o)){const e=yield Gg(o);yield co(yi.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield fo(ap))yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield xg(o);yield co(yi.setTenantsState({tenants:a,loading:!1})),yield co(yi.setState({user:o,isAuthenticated:!0,loginState:C({},i,{quickLoginToRegister:t,flow:n?It.RegisterQuickLogin:It.Login})})),yield zg(n)}}catch(e){da.setAccessToken(null),da.setUser(null),yield co(yi.setState({user:void 0,isAuthenticated:!1}))}}function*zg(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=da.onRedirectTo,{routes:o,loginState:a}=yield So((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield Ug())}function*qg({payload:{callback:e}}){try{const{ip:t}=yield fo(my.metadata.getCurrentUserIpMetadata);yield co(yi.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Hg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){const{routes:e}=yield So((e=>e.auth)),{applicationUrl:t,loginUrl:i}=yield fo(wu);var n;t&&i&&(yield co(yi.setState({routes:C({},e,{customLoginAuthenticatedUrl:i,customLoginUrl:null!=(n=e.loginUrl+yg(t))?n:""})})))}}catch{}}function*Jg({payload:e}){const t=[];e&&(yield co(yi.setState({isLoading:!0})),yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(xf)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Hg))),t.push(fo(Vg)),yield uo(t),yield co(yi.setState({isLoading:!1}))}function*Yg({accessToken:e,user:t}){if(!e)return void(yield co(yi.setState({user:void 0,isAuthenticated:!1})));const n=da.onRedirectTo,{routes:i}=yield So((e=>e.auth));if(Ng(t)){const e=yield Gg(t);yield co(yi.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Qg({payload:e}){const t=[];yield co(yi.loadSocialLoginsConfigurationV2()),t.push(fo(Af)),t.push(fo(Mg)),t.push(fo(Df)),t.push(fo(_g)),t.push(fo(Yg,e)),t.push(fo(Hg)),yield uo(t)}function*Xg({payload:e}){const{disableSilentRefresh:t}=yield So((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield fo(my.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield So((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield co(yi.setState({isLoading:!0}));const a=$y(),r=$y(),s=yield fo(Fy,r);localStorage.setItem(Ot,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;const c=yield Zg();c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${va(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*Zg(){try{var e,t;if(null!=(e=da.getContext())&&null!=(t=e.tenantResolver)&&t.call(e)){yield fo(Hg);const e=yield So((e=>e.auth.routes.customLoginAuthenticatedUrl));if(e)return yg(e)}}catch{}}function*ep({payload:e}){const t=localStorage.getItem(Ot)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield So((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;const a=yield Zg();a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield fo(my.auth.exchangeOAuthTokens,r);yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Ug()}}function*tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.changePhoneNumberWithVerification,n);yield co(yi.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Pt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*np(e){let{payload:{callback:t}}=e,n=Ii(e.payload,pg);try{yield co(yi.setLoginState({loading:!0})),yield fo(my.auth.verifyChangePhoneNumber,n),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1}))}}function*ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Sg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPreLogin,C({},n,{type:xr.SmsCode}));yield co(yi.setLoginState({step:Pt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*op(e){let{payload:{callback:t}}=e,n=Ii(e.payload,vg);try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));const o=yield fo(my.auth.passwordlessPreLogin,n),a=Rg[n.type];if(a===Pt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield co(yi.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield co(yi.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*ap(){const{publicAuthStrategyPolicy:e}=yield So((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===oy.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield fo(xy,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);return yield co(yi.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*rp(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,hg);try{yield co(yi.setLoginState({loading:!0}));const e=yield fo(my.auth.passwordlessPostLogin,i),a=da.onRedirectTo,{routes:r}=yield So((e=>e.auth));if(Ng(e)){const t=yield Gg(e);yield co(yi.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield So((e=>e.auth)),s=yield fo(my.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:vf.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield co(yi.setState({user:s})),yield co(yi.setLoginState({error:void 0})),yield co(yi.loadTenants()),yield co(yi.setState({isLoading:!1})),i.flow===It.Login?(yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield co(yi.setState({isAuthenticated:!0})),yield Ug()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield co(yi.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*sp({payload:e}){try{yield co(yi.setLoginState({loading:!0}));const{name:t}=yield fo(my.auth.verifyInviteToken,e);yield co(yi.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield co(yi.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield co(yi.setLoginState({loading:!1}))}}function*lp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield So((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield fo(my.auth.preLoginV2,{email:e});if(a){let e=a;if(r===ky.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield So((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield co(yi.setLoginState({step:Pt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield cp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*cp(e){let{callback:t}=e,n=Ii(e,mg);const i=yield So((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===xr.EmailAndPassword?(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t()):[xr.MagicLink,xr.Code,xr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield co(yi.passwordlessPreLogin(C({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield co(yi.setLoginState({step:Pt.loginWithPassword,loading:!1})),null==t||t())}function*up({payload:{callback:e}}){try{yield co(yi.setLoginState({loading:!0}));const{options:t}=yield fo(my.auth.webAuthnCreateNewDeviceSession);t.user.id=kt(t.user.id),t.challenge=kt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield co(yi.setLoginState({error:t.message})),null==e||e(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*dp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,bg);try{yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?ay.Platform:ay.CrossPlatform;yield fo(my.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setLoginState({loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ag);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const{options:e}=yield fo(my.auth.webAuthnPreLogin,n);e.challenge=kt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)}))),yield co(yi.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,kg);try{var i;yield co(yi.setPasskeysState({loading:!0})),yield co(yi.setLoginState({loading:!0}));const e=Tt(n.publicKey),o=yield fo(my.auth.webAuthnPostLogin,C({},e,{response:C({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(Ng(o)){const e=da.onRedirectTo,{routes:t}=yield So((e=>e.auth)),n=yield Gg(o);yield co(yi.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield fo(my.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield co(yi.loadTenants()),yield co(yi.setState({user:e,isAuthenticated:!0})),yield co(yi.setLoginState({error:void 0})),yield Ug(),null==t||t(!0)}}catch(e){yield co(yi.setLoginState({error:e.message})),null==t||t(null)}finally{yield co(yi.setPasskeysState({loading:!1})),yield co(yi.setLoginState({loading:!1}))}}function*gp({payload:e}){const{onRedirectTo:t,routes:n}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield co(yi.setLoginState({loading:!0}));try{const t=yield fo(my.auth.postLogin,e);da.setAccessToken(t.accessToken),da.setUser(t),yield co(yi.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Ug()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield co(yi.setLoginState({step:Pt.loginWithSSOFailed,loading:!1}))}}function*pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield co(yi.setLoginState({loading:!0}));try{const a=yield fo(my.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});da.setAccessToken(a.accessToken),da.setUser(a);const r=da.onRedirectTo,{routes:s}=yield So((e=>e.auth));if(Ng(a)){const e=yield Gg(a);yield co(yi.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield So((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield co(yi.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===It.Login?Pt.success:t.step,tenants:[],tenantsLoading:!0}})),yield co(yi.loadTenants()),n&&t.flow===It.Login&&((yield fo(ap))?(yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Ug())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){da.setAccessToken(null),da.setUser(null),null==o||o(!1,t),yield co(yi.setLoginState({email:e,error:t.message,loading:!1}))}}function*Sp({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield co(yi.setLoginState({loading:!0}));try{const o=yield fo(my.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield So((e=>e.auth)),r=a.flow===It.Login?Pt.success:a.step;yield co(yi.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield co(yi.loadTenants()),yield co(yi.setLoginState({error:void 0,loading:!1})),a.flow===It.Login&&((yield fo(ap))?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()),null==i||i(!0)}catch(e){yield co(yi.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*vp({payload:e}){yield co(yi.setLoginState({loading:!0}));try{var t;yield fo(my.auth.recoverMfaToken,e),yield co(yi.setLoginState({loading:!1,error:void 0,step:Pt.preLogin})),yield co(yi.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*hp({payload:e}){const{hostedLoginBox:t}=yield So((e=>e.auth));yield co(yi.setState({isLoading:!0}));try{t?yield fo(my.auth.OAuthLogout):yield fo(my.auth.logout)}catch{}yield co(yi.resetState()),yield co(yi.requestAuthorize(!0)),null==e||e()}function*mp({payload:e}){var t;try{yield fo(my.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*bp({user:e,tenants:t}){const n={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(n)),yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ap({user:e,tenants:t}){const{loginState:n}=yield So((e=>e.auth));yield co(yi.setUser(e)),yield co(yi.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield So((e=>e.auth.mfaState));if(n.flow===It.Login){const e=yield fo(ap);i===an.smsVerifyCode&&e?yield co(yi.setLoginState({step:Pt.promptPasskeys,loading:!1})):yield Ug()}yield co(yi.setState({isAuthenticated:!0}))}function*kp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Tg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preEnrollMFASMSForLogin,n);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Tp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Pg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFASMSForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Pp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Ig);yield co(yi.setLoginState({loading:!0}));try{var i;const e=yield fo(my.auth.preEnrollMFAWebAuthnForLogin,n),o=C({},e.options,{challenge:kt(e.options.challenge),user:C({},e.options.user,{id:kt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ip(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthnForLogin,C({},n,{options:e})),o=yield fo(my.auth.generateLoginResponseV2,i);yield bp(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Lp(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Eg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield fo(my.auth.generateLoginResponseV2,e);yield bp(i),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ep(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Og);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.preVerifyMFASMSForLogin,n,i);yield co(yi.setMfaState({otcToken:e.otcToken,step:an.smsVerifyCode,phoneNumber:e.phoneNumber})),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Op(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,wg);yield co(yi.setLoginState({loading:!0}));try{const e=yield fo(my.auth.verifyMFASMSForLogin,n,i),o=yield fo(my.auth.generateLoginResponseV2,e);yield Ap(o),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*wp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Cg);yield co(yi.setLoginState({loading:!0}));try{var o;const e=yield fo(my.auth.preVerifyMFAWebAuthnForLogin,n,i),a=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Cp(e){let{payload:{callback:t,deviceId:n}}=e,i=Ii(e.payload,Dg);yield co(yi.setLoginState({loading:!0}));try{const e=Tt(i.publicKey),o=yield fo(my.auth.verifyMFAWebAuthnForLogin,n,C({},i,{options:e})),a=yield fo(my.auth.generateLoginResponseV2,o);yield Ap(a),yield co(yi.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(){yield ua(yi.requestAuthorize,Jg),yield ua(yi.requestAuthorizeSSR,Qg),yield ua(yi.requestHostedLoginAuthorize,Xg),yield ua(yi.handleHostedLoginCallback,ep),yield ua(yi.preLogin,lp),yield ua(yi.postLogin,gp),yield ua(yi.login,pp),yield ua(yi.logout,hp),yield ua(yi.silentLogout,mp),yield ua(yi.loginWithMfa,Sp),yield ua(yi.recoverMfa,vp),yield ua(yi.quickSmsPasswordlessPreLogin,ip),yield ua(yi.changePhoneNumberWithVerification,tp),yield ua(yi.verifyChangePhoneNumber,np),yield ua(yi.passwordlessPreLogin,op),yield ua(yi.passwordlessPostLogin,rp),yield ua(yi.verifyInviteToken,sp),yield ua(yi.webAuthnPrelogin,yp),yield ua(yi.webAuthnPostLogin,fp),yield ua(yi.webAuthnCreateNewDeviceSession,up),yield ua(yi.webAuthnVerifyNewDeviceSession,dp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,qg),yield ua(yi.preEnrollMFASMSForLogin,kp),yield ua(yi.enrollMFASMSForLogin,Tp),yield ua(yi.preEnrollMFAWebAuthnForLogin,Pp),yield ua(yi.enrollMFAWebAuthnForLogin,Ip),yield ua(yi.enrollMFAAuthenticatorAppForLogin,Lp),yield ua(yi.preVerifyMFASMSForLogin,Ep),yield ua(yi.verifyMFASMSForLogin,Op),yield ua(yi.preVerifyMFAWebAuthnForLogin,wp),yield ua(yi.verifyMFAWebAuthnForLogin,Cp)}function*Rp({payload:e}){e&&(yield co(yi.setState({isLoading:!0})));const t=Ky;yield co(yi.loadTenants()),yield co(yi.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Up({payload:{callback:e}}){try{const{ip:t}=ff[0];yield co(yi.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*_p(){yield ua(yi.requestAuthorize,Rp),yield ua(yi.afterAuthNavigation,Ug),yield ua(yi.getUserIP,Up)}const Mp=["callback","samlVendor"],Np=["callback","samlVendor"];function*Fp(){try{var e,t;yield co(yi.setSSOState({loading:!0}));const n=yield fo(my.auth.getSamlConfiguration),i=yield fo(my.auth.getOidcConfiguration),o=yield fo(my.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield co(yi.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSSOState({error:e.message,loading:!1}))}}function*$p({payload:e}){const t=yield So((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield co(yi.setSSOState({error:void 0,[n]:!0}));try{const i=yield Gy(e[0]),o=yield fo(my.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield co(yi.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield co(yi.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Gp({payload:e}){const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield co(yi.setSSOState({error:void 0,[o]:!0}));try{const e=yield Gy(t),a=yield fo(my.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield co(yi.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*xp({payload:e}){const{callback:t,samlVendor:n}=e,i=Ii(e,Mp),o=yield So((e=>e.auth.ssoState.samlConfiguration)),a=C({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},o,a)})));if(yield co(yi.setSSOState({error:void 0,[r]:!0})),e.type===ky.Saml){var s,l;const e=yield fo(my.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=Ny(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield fo(my.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield co(yi.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Vp({payload:{callback:e}={}}){const t=yield So((e=>e.auth.ssoState.samlConfiguration));try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.validateSamlDomain),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*jp(){try{const e=yield fo(my.auth.getSamlRoles),t=yield fo(my.auth.getSamlRolesGroups);yield co(yi.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield co(yi.setSSOState({error:e.message}))}}function*Wp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield uo(e.map((e=>fo(my.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield co(yi.setSSOState({error:e.message}))}}(n)),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Bp({payload:{callback:e,id:t}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.deleteSamlGroup,{id:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Kp({payload:{group:e,roleIds:t,callback:n}}){try{yield co(yi.setSSOState({error:void 0,saving:!0})),yield fo(my.auth.createSamlGroup,{group:e,roleIds:t}),yield jp(),yield co(yi.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield co(yi.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*zp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield co(yi.setSSOState({loading:!0})),yield fo(my.auth.oidcPostLoginV2,t),yield fo(Vg),yield co(yi.setSSOState({loading:!1}))}catch(e){var n;yield co(yi.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*qp(){yield la(yi.loadSSOConfigurations,Fp),yield la(yi.saveSSOConfigurations,xp),yield la(yi.saveSSOConfigurationsFile,$p),yield la(yi.saveSSOConfigurationsFileWithCallback,Gp),yield la(yi.validateSSODomain,Vp),yield la(yi.loadSSOAuthorizationRoles,jp),yield la(yi.updateSSOAuthorizationRoles,Wp),yield la(yi.deleteSamlGroup,Bp),yield la(yi.createSamlGroup,Kp),yield la(yi.oidcPostlogin,zp)}function*Hp(){yield co(yi.setSSOState({loading:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:Xy,loading:!1,firstLoad:!1}))}function*Jp({payload:e}){const t="saving";yield co(yi.setSSOState({error:void 0,[t]:!0}));const n=C({},yield So((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield co(yi.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Yp({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=Ii(e,Np),r=tf.samlConfiguration,s=C({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield co(yi.setSSOState({samlConfiguration:C({},r,s)})));yield co(yi.setSSOState({error:void 0,[l]:!0})),yield mt(),s.acsUrl=null==Zy||null==(t=Zy.configuration)?void 0:t.acsUrl,s.spEntityId=null==Zy||null==(n=Zy.configuration)?void 0:n.spEntityId;const c=Ny(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield mt(),yield co(yi.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Qp({payload:{callback:e}={}}){const t=tf.samlConfiguration;yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({samlConfiguration:C({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Xp(){yield mt(),yield co(yi.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Zp({payload:{callback:e,authorizationRoles:t}}){yield co(yi.setSSOState({error:void 0,saving:!0})),yield mt(),yield co(yi.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*eS(){yield la(yi.loadSSOConfigurations,Hp),yield la(yi.saveSSOConfigurations,Yp),yield la(yi.saveSSOConfigurationsFile,Jp),yield la(yi.validateSSODomain,Qp),yield la(yi.loadSSOAuthorizationRoles,Xp),yield la(yi.updateSSOAuthorizationRoles,Zp)}const tS=["callback"],nS=["callback","ssoConfigId"],iS=["callback","ssoConfigId"],oS=["callback","ssoConfigId"];function*aS(){try{return yield fo(my.auth.getOidcConfiguration)}catch(e){return null}}function*rS(){try{return yield fo(my.metadata.getSamlMetadata)}catch(e){return null}}function*sS(){try{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield uo([fo(aS),fo(rS)]),n=yield fo(my.auth.getSSOConfigurations);yield co(yi.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield co(yi.setSSOError({key:Ay.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield co(yi.setSSOLoader({key:Ay.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*lS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=Ii(e,tS),i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield fo(my.auth.createSSOConfiguration,C({},n,{enabled:null!=(o=n.enabled)&&o}));yield co(yi.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!1}))}}function*cS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(t),o=yield fo(my.auth.createSSOConfigurationByMetadata,{metadata:e});yield co(yi.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*uS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,nS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*dS({payload:e}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Gy(i),a=yield fo(my.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield co(yi.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*yS({payload:e}){yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSOConfiguration,t),yield co(yi.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_CONFIGURATION,value:!1}))}}function*fS({payload:e}){const{callback:t,ssoConfigId:n}=e,i=Ii(e,iS);yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fo(my.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?C({},t,{domains:[...t.domains,e]}):t));yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_DOMAIN,value:!1}))}}function*gS({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?C({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.DELETE_SSO_DOMAIN,value:!1}))}}function*pS({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?C({},e,{domains:e.domains.map((e=>e.id===n?C({},e,{validated:!0}):e))}):e));yield co(yi.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield co(yi.setSSOError({key:Ay.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.VALIDATE_SSO_DOMAIN,value:!1}))}}function*SS({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield fo(my.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?C({},e,{roleIds:n}):e));yield co(yi.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield co(yi.setSSOError({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield co(yi.setSSOLoader({key:Ay.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*vS({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!0}));const o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{yield uo(t.map((e=>fo(my.auth.deleteSSOGroup,n,e)))),yield uo(e.map((e=>fo(my.auth.createSSOGroup,n,e))));const a=yield fo(my.auth.getSSOGroups,n),r=o.map((e=>e.id===n?C({},e,{groups:a}):e));yield co(yi.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*hS({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield uo(t.map((t=>fo(my.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield co(yi.setSSOError({key:Ay.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_GROUPS,value:!1}))}}function*mS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield So((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield fo(ba,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield fo(my.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield fo(my.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield co(yi.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bS({payload:e}){yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=Ii(e,oS),o=yield So((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield fo(my.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield fo(my.auth.createSSOConfiguration,i),a=[e,...o]),yield co(yi.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield co(yi.setSSOLoader({key:Ay.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*AS(){yield la(yi.loadSSOConfigurationsV2,sS),yield la(yi.saveSSOConfigurationV2,lS),yield la(yi.saveSSODomain,fS),yield la(yi.deleteSSODomain,gS),yield la(yi.validateSSODomainV2,pS),yield la(yi.updateSSOConfiguration,uS),yield la(yi.deleteSSOConfiguration,yS),yield la(yi.setSSOGroups,vS),yield la(yi.updateSSOGroups,hS),yield la(yi.setSSODefaultRoles,SS),yield la(yi.saveSSOConfigurationByMetadata,cS),yield la(yi.updateSSOConfigurationByMetadata,dS),yield la(yi.saveSSOConfigurationByUrl,mS),yield la(yi.saveSSOConfigurationByData,bS)}const kS=["callback","profilePictureUrl"],TS=["callback","profilePictureUrl"];function*PS(){yield co(yi.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return fo.apply(void 0,[sa,e,t,n].concat(o))}(3,2e3,my.teams.getProfile),t=yield So((e=>e.auth.user));yi.setUser(C({},t,e)),yield co(yi.setProfileState({profile:e,loading:!1}))}catch(e){yield co(yi.setProfileState({loading:!1,error:e.message}))}}function*IS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,kS);yield co(yi.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield So((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield fo(my.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=C({},e,i,{profilePictureUrl:o}),r=yield fo(my.teams.updateProfile,a),s=yield So((e=>e.auth.user));yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield co(yi.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*LS({payload:e}){yield co(yi.setProfileState({loading:!0}));try{var t;yield fo(my.teams.changePassword,e),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*ES(){yield ua(yi.loadProfile,PS),yield la(yi.saveProfile,IS),yield la(yi.changePassword,LS)}function*OS(){yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setUser(C({},Ky,By))),yield co(yi.setProfileState({loading:!1,profile:By}))}function*wS(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=Ii(e.payload,TS);yield co(yi.setProfileState({saving:!0,error:null}));const o=zy;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=Ky;yield mt(),yield co(yi.setUser(C({},s,r))),yield co(yi.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*CS({payload:e}){var t;yield co(yi.setProfileState({loading:!0})),yield mt(),yield co(yi.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*DS(){yield ua(yi.loadProfile,OS),yield la(yi.saveProfile,wS),yield la(yi.changePassword,CS)}const RS=["callback"],US=["callback"],_S=["callback"],MS=["deviceId","callback"],NS=["deviceId","callback"],FS=["callback"],$S=["deviceId"],GS=["deviceId"],xS=["callback"],VS=["deviceId"],jS=["callback"];function*WS(e){const{step:t}=yield So((e=>e.auth.mfaState));return{step:e.recoveryCode?an.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*BS(){yield co(yi.setMfaState({saving:!0}));try{const{qrCode:e}=yield fo(my.auth.enrollMfa);yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message}))}}function*KS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,RS);yield co(yi.setMfaState({saving:!0}));try{const e=yield So((e=>e.auth.user)),i=yield fo(my.auth.verifyMfa,n),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),yield co(yi.setUser(C({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*zS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,US);yield co(yi.setMfaState({loading:!0}));try{const e=yield fo(my.auth.loginWithMfa,n),i={step:an.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setState({user:e})),yield co(yi.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*qS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;yield fo(my.auth.disableMfa,e);const n=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*HS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t,n;const i=yield fo(my.auth.preEnrollMFAWebAuthn),o=C({},i.options,{challenge:kt(i.options.challenge),user:C({},i.options.user,{id:kt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*JS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,_S);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(n.publicKey),i=yield fo(my.auth.enrollMFAWebAuthn,C({},n,{options:e})),o=yield fo(my.auth.getMFADevices),a=yield WS(i);yield co(yi.setMfaState(C({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*YS(e){let{payload:{deviceId:t,callback:n}}=e;Ii(e.payload,MS),yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFAWebAuthn,t),o=C({},e.options,{challenge:kt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>C({},e,{id:kt(e.id)})))});yield co(yi.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*QS(e){let{payload:{deviceId:t,callback:n}}=e,i=Ii(e.payload,NS);yield co(yi.setMfaState({saving:!0}));try{const e=Tt(i.publicKey);yield fo(my.auth.disableMFAWebAuthn,t,C({},i,{options:e}));const o=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*XS({payload:e}){yield co(yi.setMfaState({saving:!0}));try{var t;const n=yield fo(my.auth.preEnrollMFASMS,e);yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:n.otcToken,phoneNumber:n.phoneNumber})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*ZS(e){let{payload:{callback:t}}=e,n=Ii(e.payload,FS);yield co(yi.setMfaState({saving:!0}));try{const e=yield fo(my.auth.enrollMFASMS,n),i=yield fo(my.auth.getMFADevices),o=yield WS(e);yield co(yi.setMfaState(C({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield co(yi.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*ev(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,$S);yield co(yi.setMfaState({saving:!0}));try{var i;const e=yield fo(my.auth.preDisableMFASMS,t);yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*tv(e){let{payload:{deviceId:t}}=e,n=Ii(e.payload,GS);yield co(yi.setMfaState({saving:!0}));try{var i;yield fo(my.auth.disableMFASMS,t,n);const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*nv(){yield co(yi.setMfaState({loading:!0}));try{yield So((e=>e.auth.user));const e=yield fo(my.auth.getMFADevices);yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*iv(){yield co(yi.setMfaState({loading:!0}));try{const e=(yield fo(my.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield co(yi.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield co(yi.setMfaState({loading:!1,error:e.message}))}}function*ov(){yield la(yi.enrollMfa,BS),yield la(yi.getMFADevices,nv),yield la(yi.getMFAStrategies,iv),yield la(yi.verifyMfa,KS),yield la(yi.disableMfa,qS),yield la(yi.verifyMfaAfterForce,zS),yield la(yi.preDisableMfaSms,ev),yield la(yi.disableMfaSms,tv),yield la(yi.preEnrollMfaSms,XS),yield la(yi.enrollMfaSms,ZS),yield la(yi.preEnrollMfaWebAuthn,HS),yield la(yi.enrollMfaWebAuthn,JS),yield la(yi.preDisableMfaWebAuthn,YS),yield la(yi.disableMfaWebAuthn,QS)}function*av(){yield co(yi.setMfaState({saving:!0})),yield co(yi.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*rv({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield co(yi.setMfaState(i)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xS);yield co(yi.setMfaState({loading:!0})),yield mt();const i=C({},n,{recoveryCode:"recoveryCode"}),o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield mt(),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*lv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,mfaDevices:C({},n,{authenticators:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*cv(e){let{}=e,t=Ii(e.payload,VS);yield co(yi.setMfaState({saving:!0}));try{var n;yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield co(yi.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*uv({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({loading:!1,error:void 0,mfaDevices:C({},n,{phones:[]})})),yield co(yi.setUser(C({},Ky))),null==(t=e.callback)||t.call(e,!0)}function*dv({payload:e}){var t;yield co(yi.setMfaState({saving:!0})),yield mt(),yield co(yi.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*yv(e){let{payload:{callback:t}}=e;Ii(e.payload,jS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield So((e=>e.auth.mfaState));yield co(yi.setMfaState({saving:!0})),yield mt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:an.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:C({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield co(yi.setMfaState(o)),yield co(yi.setUser(C({},Ky,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*fv(){yield la(yi.enrollMfa,av),yield la(yi.verifyMfa,rv),yield la(yi.disableMfa,lv),yield la(yi.verifyMfaAfterForce,sv),yield la(yi.preDisableMfaSms,cv),yield la(yi.disableMfaSms,uv),yield la(yi.preEnrollMfaSms,dv),yield la(yi.enrollMfaSms,yv)}const gv=["callback"];function*pv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{var t;yield fo(my.auth.forgotPassword,e),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*Sv(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gv);yield co(yi.setForgotPasswordState({loading:!0}));try{yield fo(my.auth.resetPassword,n),yield co(yi.setForgotPasswordState({loading:!1,error:void 0,step:Bt.success})),null==t||t(!0)}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*vv({payload:e}){yield co(yi.setForgotPasswordState({loading:!0}));try{const t=yield fo(my.auth.loadPasswordConfig,e);yield co(yi.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield co(yi.setForgotPasswordState({loading:!1,error:e.message}))}}function*hv(){yield ua(yi.forgotPassword,pv),yield ua(yi.resetPassword,Sv),yield ua(yi.loadPasswordConfig,vv)}let mv;!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"}(mv||(mv={}));const bv=["callback","events"],Av=["callback"],kv=["callback"];function*Tv({payload:{userId:e,token:t}}){yield co(yi.setActivateState({loading:!0,step:Nt.activating}));try{const{isAuthenticated:n}=yield So((e=>e.auth));n&&(yield co(yi.silentLogout()));const i=yield fo(my.auth.getActivateAccountStrategy,{userId:e,token:t});yield co(yi.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield co(yi.setActivateState({loading:!1,step:Nt.activatingForm})))}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Pv(e){let{payload:{callback:t,events:n}}=e,i=Ii(e.payload,bv);yield co(yi.setActivateState({loading:!0}));try{const e=da.onRedirectTo,{routes:a}=yield So((e=>e.auth)),r=yield fo(my.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(Ng(r)){yield co(yi.setActivateState({step:Nt.success}));const t=yield Gg(r);yield co(yi.setState(t)),yield vo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield co(yi.setActivateState({step:Nt.success}));const{user:e,tenants:t}=yield fo(my.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:vf.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield co(yi.setTenantsState({tenants:t,loading:!1})),yield co(yi.setState({user:e,isAuthenticated:!0})),yield vo(1e3),yield Ug(),yield co(yi.resetActivateState())}null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message}))}}function*Iv({payload:e}){const{callback:t}=e,n=Ii(e,Av);yield co(yi.setActivateStrategyState({loading:!0}));try{const e=yield fo(my.auth.getActivateAccountStrategy,n);yield co(yi.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield co(yi.setActivateStrategyState({loading:!1,error:e.message}))}}function*Lv({payload:e}){const{callback:t}=e,n=Ii(e,kv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.email})),yield co(yi.setActivateState({loading:!0}));try{yield fo(my.auth.resendActivationEmail,n),yield co(yi.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield co(yi.setActivateState({loading:!1,error:e.message})),yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Ev(){yield ua(yi.activateAccount,Pv),yield ua(yi.preActivateAccount,Tv),yield ua(yi.getActivateAccountStrategy,Iv),yield ua(yi.resendActivationEmail,Lv)}function*Ov({payload:e}){if(e.token&&e.userId)try{yield co(yi.setAcceptInvitationState({error:void 0,step:xt.pending})),yield fo(my.auth.acceptInvitation,e),yield co(yi.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:xt.success}}))}catch(e){yield co(yi.setAcceptInvitationState({step:xt.failed,error:e.message}))}else yield co(yi.setAcceptInvitationState({error:void 0,step:xt.invalid}))}function*wv(){yield ua(yi.acceptInvitation,Ov)}var Cv,Dv=new Uint8Array(16);function Rv(){if(!Cv&&!(Cv="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 Cv(Dv)}for(var Uv=/^(?:[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,_v=function(e){return"string"==typeof e&&Uv.test(e)},Mv=[],Nv=0;Nv<256;++Nv)Mv.push((Nv+256).toString(16).substr(1));var Fv=function(e,t,n){var i=(e=e||{}).random||(e.rng||Rv)();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=(Mv[e[t+0]]+Mv[e[t+1]]+Mv[e[t+2]]+Mv[e[t+3]]+"-"+Mv[e[t+4]]+Mv[e[t+5]]+"-"+Mv[e[t+6]]+Mv[e[t+7]]+"-"+Mv[e[t+8]]+Mv[e[t+9]]+"-"+Mv[e[t+10]]+Mv[e[t+11]]+Mv[e[t+12]]+Mv[e[t+13]]+Mv[e[t+14]]+Mv[e[t+15]]).toLowerCase();if(!_v(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let $v,Gv;!function(e){e.CREATE_GROUP="CREATE_GROUP",e.GET_GROUP="GET_GROUP",e.GET_GROUPS="GET_GROUPS",e.DELETE_GROUP="DELETE_GROUP",e.UPDATE_GROUP="UPDATE_GROUP",e.ADD_USERS_TO_GROUP="ADD_USERS_TO_GROUP",e.DELETE_USERS_FROM_GROUP="DELETE_USERS_FROM_GROUP",e.ADD_ROLES_TO_GROUP="ADD_ROLES_TO_GROUP",e.DELETE_ROLES_FROM_GROUP="DELETE_ROLES_FROM_GROUP",e.GET_GROUP_CONFIGURATION="GET_GROUP_CONFIGURATION",e.UPDATE_GROUP_CONFIGURATION="UPDATE_GROUP_CONFIGURATION",e.GET_TEAM_USERS="GET_TEAM_USERS"}($v||($v={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Gv||(Gv={}));const xv=["callback"],Vv=["roles"],jv=["callback"],Wv=["callback","profileImage"],Bv=["callback"],Kv=["callback","userId"],zv=["callback"],qv=["callback"],Hv=["callback"],Jv=["callback"],Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback","profileImage"],eh=["callback"],th=["callback"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=()=>So((e=>e.auth.teamState));function*sh(){try{const{groups:e}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.roles});return e}catch(e){return[]}}function*lh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield uo([fo(my.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions),fo(sh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return C({},e,{groups:n})}));yield co(yi.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*ch({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield uo([fo(my.subTenants.loadAllUsers,C({},c)),fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield co(yi.setTeamError({key:mv.USERS,value:e.message})),yield co(yi.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield co(yi.setTeamLoader({key:mv.USERS,value:!1}))}function*uh({payload:e}){yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield uo([fo(my.teams.loadAvailableRoles),fo(my.teams.loadAvailablePermissions)]);yield co(yi.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield co(yi.setTeamError({key:mv.ROLES_AND_PERMISSIONS,value:t.message}))}yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0}))}function*dh({payload:e}){const{callback:t}=e,n=Ii(e,xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield fo(my.teams.addUser,n),{roles:a}=e,r=C({},Ii(e,Vv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield co(yi.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*yh({payload:e}){const{callback:t}=e,n=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield co(yi.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield fo(my.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:[],silentLoading:e.emails.length>0};yield co(yi.loadUsers(r)),yield co(yi.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*fh({payload:e}){const{callback:t}=e,n=Ii(e,jv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield fo(my.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield co(yi.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*gh({payload:e}){const{callback:t}=e,n=Ii(e,Wv),{id:i}=n,o=yield rh(),a=o.users.find((e=>e.id===n.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:i||""})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?C({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield fo(my.teams.updateUser,n);null==t||t(e),yield co(yi.setTeamState({users:o.users.map((t=>t.id===e.id?C({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?C({},e,a):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*ph({payload:e}){const{callback:t}=e,n=Ii(e,Bv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.teams.deleteUser,n),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Sh({payload:e}){const{callback:t,userId:n}=e,i=Ii(e,Kv),o=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return C({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield co(yi.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[C({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield co(yi.setTeamState({addUserDialogState:C({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*vh({payload:e}){const{callback:t}=e,n=Ii(e,zv),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})}));try{yield fo(my.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*hh({payload:e}){const{callback:t}=e,n=Ii(e,qv);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield fo(my.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*mh({payload:e}){const{callback:t}=e,n=Ii(e,Hv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*bh({payload:e}){const{callback:t}=e,n=Ii(e,Jv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Ah({payload:e}){const{callback:t}=e,n=Ii(e,Yv);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email}));try{yield fo(my.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*kh(){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield fo(my.teams.getInviteLinkConfiguration);yield co(yi.setTeamState({inviteTokenState:C({},e)}))}catch(e){yield co(yi.setTeamError({key:mv.CONFIG_TOKEN_LINK,value:e.message}))}}function*Th(){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:!1}));try{yield fo(kh);const e=yield fo(my.teams.getInviteUserLink),{inviteTokenState:t}=yield rh();yield co(yi.setTeamState({inviteTokenState:C({},t,e)}))}catch(e){yield co(yi.setTeamError({key:mv.GET_TOKEN_LINK,value:e.message}))}}function*Ph({payload:{callback:e}}){yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield rh();try{const n=yield fo(my.teams.createInviteUserLink,{expiresInMinutes:43200});yield co(yi.setTeamState({inviteTokenState:C({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.CREATE_TOKEN_LINK,value:t.message}))}}function*Ih({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield rh();yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield fo(my.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield co(yi.setTeamState({inviteTokenState:C({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield co(yi.setTeamError({key:mv.UPDATE_TOKEN_LINK,value:t.message}))}}function*Lh({payload:e}){const{callback:t}=null!=e?e:{};yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:!1}));try{yield fo(my.teams.deleteInviteUserLink),yield co(yi.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield co(yi.setTeamError({key:mv.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Eh({payload:e}){yield co(yi.setTeamState({addUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Oh({payload:e}){const t=yield rh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*wh({payload:e}){yield co(yi.setTeamState({deleteUserDialogState:C({open:!0,loading:!1,error:!1},e)}))}function*Ch({payload:e}){const t=yield rh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield co(yi.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Dh(){yield ca(yi.loadUsers,lh),yield ca(yi.loadAllSubTenantsUsers,ch),yield ca(yi.loadRoles,uh),yield la(yi.addUser,dh),yield la(yi.addUsersBulk,yh),yield la(yi.addUserToSubTenants,fh),yield la(yi.updateUser,gh),yield la(yi.setUserRolesForSubTenants,Sh),yield la(yi.deleteUser,ph),yield la(yi.deleteUserFromSubTenants,vh),yield la(yi.resendActivationLink,hh),yield la(yi.resendInvitationLink,mh),yield la(yi.resendInvitationEmail,bh),yield la(yi.resendInvitationLinkToAllSubTenants,Ah),yield la(yi.getInvitationLink,Th),yield la(yi.createInvitationLink,Ph),yield la(yi.updateInvitationLink,Ih),yield la(yi.deleteInvitationLink,Lh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}function*Rh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield rh(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield co(yi.setTeamLoader({key:mv.USERS,value:!a})),yield co(yi.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield mt(),yield co(yi.setTeamState({users:sf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==r||r(sf)}function*Uh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield rh(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield co(yi.setTeamLoader({key:mv.USERS,value:!r})),yield co(yi.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield mt(),yield co(yi.setTeamState({allUsers:lf,totalPages:2,totalItems:10,roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.USERS,value:!1})),null==s||s(lf)}function*_h({payload:e}){var t;yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),yield mt(),yield co(yi.setTeamState({roles:ef,permissions:nf})),yield co(yi.setTeamLoader({key:mv.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:ef,permissions:nf})}function*Mh({payload:e}){const{callback:t}=e,n=Ii(e,Qv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,{groups:[]},n,{id:`${Fv()}`});null==t||t(o),yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Nh({payload:e}){const{callback:t}=e,n=Ii(e,Xv),i=yield rh();yield co(yi.setTeamState({addUserDialogState:C({},i.addUserDialogState,{loading:!0})})),yield mt();const o=C({},af,n,{id:`${Fv()}`});yield co(yi.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Fh({payload:e}){var t;const{callback:n}=e,i=Ii(e,Zv),{id:o}=i,a=yield rh(),r=a.users.find((e=>e.id===i.id));yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:o||""})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0})})),yield co(yi.setTeamState({addUserDialogState:C({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?C({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield mt();const s=C({},r,i);null==n||n(s),yield co(yi.setTeamState({users:a.users.map((e=>e.id===s.id?C({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield co(yi.setTeamLoader({key:mv.UPDATE_USER,value:!1}))}function*$h({payload:e}){const{callback:t}=e,n=Ii(e,eh),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Gh({payload:e}){const{callback:t}=e,n=Ii(e,th),i=yield rh();yield co(yi.setTeamState({deleteUserDialogState:C({},i.deleteUserDialogState,{loading:!0})})),yield mt(),null==t||t(!0),yield co(yi.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*xh({payload:e}){const{callback:t}=e,n=Ii(e,nh);yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:n.userId})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_ACTIVATE_LINK,value:!1}))}function*Vh({payload:e}){const{callback:t}=e,n=Ii(e,ih);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*jh({payload:e}){const{callback:t}=e,n=Ii(e,oh);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Wh({payload:e}){const{callback:t}=e,n=Ii(e,ah);yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:n.email})),yield mt(),null==t||t(!0),yield co(yi.setTeamLoader({key:mv.RESEND_INVITATION_LINK,value:!1}))}function*Bh(){yield ca(yi.loadUsers,Rh),yield ca(yi.loadAllSubTenantsUsers,Uh),yield ca(yi.loadRoles,_h),yield la(yi.addUser,Mh),yield la(yi.addUserToSubTenants,Nh),yield la(yi.updateUser,Fh),yield la(yi.deleteUser,$h),yield la(yi.deleteUserFromSubTenants,Gh),yield la(yi.resendActivationLink,xh),yield la(yi.resendInvitationLink,Vh),yield la(yi.resendInvitationEmail,jh),yield la(yi.resendInvitationLinkToAllSubTenants,Wh),yield la(yi.openAddUserDialog,Eh),yield la(yi.closeAddUserDialog,Oh),yield la(yi.openDeleteUserDialog,wh),yield la(yi.closeDeleteUserDialog,Ch)}const Kh=["authorizationUrl"],zh=["events","url"];function*qh(){try{yield co(yi.setSocialLoginsState({loading:!0}));const e=yield fo(my.auth.getSocialLoginProviders);yield co(yi.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Hh(){try{const e=yield So((e=>e.root.context));yield co(yi.setSocialLoginsState({loading:!0}));const t=yield fo(my.auth.getSocialLoginProvidersV2),{providers:n}=yield fo(my.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=Ii(t,Kh);const o=va(e,null!=n?n:"");return C({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield co(yi.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield co(yi.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Jh(e){let{payload:{events:t,url:n}}=e,i=Ii(e.payload,zh);try{yield co(yi.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield fo(my.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:hf.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:vf.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield co(yi.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield So((e=>e.auth));e?yield fo(Wg):yield fo(Kg)}(),localStorage.removeItem("register-quick-login"),yield co(yi.setSocialLoginsState({loading:!1}))}catch(e){var r;yield co(yi.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Yh({payload:e}){yield co(yi.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Qh(){yield ua(yi.loadSocialLoginsConfiguration,qh),yield ua(yi.loadSocialLoginsConfigurationV2,Hh),yield ua(yi.loginViaSocialLogin,Jh),yield ca(yi.setSocialLoginError,Yh)}let Xh;function*Zh({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield So((e=>e.auth.apiTokensState));try{let e,a;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield fo(my.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield fo(my.auth.updateUserApiTokensData,{description:t}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*em({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield So((e=>e.auth.apiTokensState));try{let e,r;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield fo(my.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield fo(my.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield co(yi.setApiTokensError({key:Xh.ADD_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*tm({payload:e}){const{apiTokensDataUser:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteUserAccessToken,{id:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield fo(my.auth.deleteUserApiToken,{tokenId:e}),yield co(yi.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*nm({payload:e}){const{apiTokensDataTenant:t}=yield So((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),n?(yield fo(my.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield fo(my.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield co(yi.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}catch(e){yield co(yi.setApiTokensError({key:Xh.DELETE_API_TOKEN,value:e.message})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}}function*im({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield uo([fo(my.auth.getUserApiTokensData),fo(my.auth.getTenantApiTokensData)]);yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*om({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=fo(my.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*am({payload:e}){null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=fo(my.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=fo(my.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield co(yi.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield co(yi.setApiTokensError({key:Xh.LOAD_API_TOKENS,value:t.message})),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*rm(){yield ua(yi.loadApiTokens,im),yield ua(yi.loadUserApiTokens,om),yield ua(yi.loadTenantApiTokens,am),yield la(yi.addUserApiToken,Zh),yield la(yi.addTenantApiToken,em),yield ca(yi.deleteTenantApiToken,nm),yield ca(yi.deleteUserApiToken,tm)}function*sm({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield So((e=>e.auth.apiTokensState)),a=C({},jy,{description:t,roleIds:n,clientId:`CLIENT_ID_${Fv()}`});yield co(yi.setApiTokensState({showAddTokenDialog:!1})),yield vo(200),yield co(yi.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*lm({payload:e}){yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!0})),yield vo(200);const t=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield co(yi.setApiTokensLoader({key:Xh.DELETE_API_TOKEN,value:!1}))}function*cm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy],i=[jy];yield co(yi.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*um({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[Vy];yield co(yi.setApiTokensState({apiTokensDataUser:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*dm({payload:e}){var t;null!=e&&e.silentLoading||(yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!0})));const n=[jy];yield co(yi.setApiTokensState({apiTokensDataTenant:n})),yield vo(200),yield co(yi.setApiTokensLoader({key:Xh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ym(){yield ua(yi.loadApiTokens,cm),yield ua(yi.loadUserApiTokens,um),yield ua(yi.loadTenantApiTokens,dm),yield la(yi.addTenantApiToken,sm),yield ca(yi.deleteTenantApiToken,lm)}function*fm({payload:e}){try{var t;yield co(yi.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield fo(my.accountSettings.updateSettings,C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield co(yi.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield fo(my.accountSettings.getSettings);yield co(yi.setAccountSettingsState(C({},e,{loading:!1})))}catch(e){yield co(yi.setAccountSettingsState({loading:!1,error:e.message}))}}function*pm(){yield ua(yi.saveAccountSettings,fm),yield ua(yi.loadAccountSettings,gm)}function*Sm({payload:e}){var t;yield co(yi.setAccountSettingsState({loading:!0})),yield mt();const{accountSettingsState:n}=yield So((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=C({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield co(yi.setAccountSettingsState(C({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*vm({payload:e}){yield co(yi.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield mt(),yield co(yi.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*hm(){yield ua(yi.saveAccountSettings,Sm),yield ua(yi.loadAccountSettings,vm)}function*mm({payload:{tenantId:e,callback:t}}){yield co(yi.setState({isLoading:!0}));try{yield fo(my.tenants.switchTenant,{tenantId:e}),yield fo(Vg),(null==t?void 0:t(!0))||(yield co(yi.setState({isLoading:!1})))}catch(e){yield co(yi.setState({isLoading:!1})),null==t||t(!1,e)}}function*bm({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getTenants);yield co(yi.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield co(yi.setTenantsState({loading:!1}))}}function*Am({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenants);yield co(yi.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*km({payload:e}){yield co(yi.setTenantsState({loading:!0}));try{var t;const n=yield fo(my.tenants.getSubTenantsAsTree);yield co(yi.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield co(yi.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Tm(){yield la(yi.loadTenants,bm),yield la(yi.loadSubTenants,Am),yield la(yi.switchTenant,mm),yield la(yi.loadSubTenantsTree,km)}function*Pm(){yield co(yi.setTenantsState({loading:!0})),yield mt(),yield co(yi.setTenantsState({tenants:cf,loading:!1}))}function*Im(){yield la(yi.loadTenants,Pm)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Xh||(Xh={}));const Lm=["callback"],Em=["callback"],Om=["callback"],wm=["callback"],Cm=["callback"];function*Dm({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield uo([fo(my.roles.getRoles),fo(my.roles.getPermissions),fo(my.roles.getPermissionCategories)]),[t,n,i]=e;yield co(yi.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Rm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Lm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.addRole,n),i=yield fo(my.roles.getRoles);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Um(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Em);yield co(yi.setRolesState({saving:!0}));try{yield fo(my.roles.deleteRole,n),yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*_m(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Om);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.updateRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Mm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,wm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionsToRole,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Nm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Cm);yield co(yi.setRolesState({saving:!0}));try{const e=yield fo(my.roles.attachPermissionToRoles,n);yield co(yi.loadRolesAndPermissions({silentLoading:!0})),yield co(yi.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield co(yi.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Fm(){yield ua(yi.loadRolesAndPermissions,Dm),yield la(yi.addRole,Rm),yield la(yi.deleteRole,Um),yield la(yi.updateRole,_m),yield la(yi.attachPermissionsToRole,Mm),yield la(yi.attachPermissionToRoles,Nm)}function*$m({payload:e}){var t;yield co(yi.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield co(yi.setRolesState({roles:Wy,loading:!1}))}catch(e){yield co(yi.setRolesState({error:e.message,loading:!1}))}}function*Gm(){yield ua(yi.loadRolesAndPermissions,$m)}const xm=["callback"],Vm=["callback"],jm=["callback"];function*Wm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,xm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.resetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Ht.VerifyResetPhoneNumber})),yield co(yi.setLoginState({email:n.email}))}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Bm(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Vm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const e=yield fo(my.auth.verifyResetPhoneNumber,n);yield co(yi.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Ht.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Km(e){let{payload:{callback:t}}=e,n=Ii(e.payload,jm);yield co(yi.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield So((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield fo(my.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield co(yi.setLoginState({step:Pt.loginWithSmsOtc})),yield co(yi.passwordlessPreLogin({type:xr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield co(yi.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*zm(){yield ua(yi.resetPhoneNumber,Wm),yield ua(yi.verifyResetPhoneNumber,Bm),yield ua(yi.changePhoneNumber,Km)}function*qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSessions);yield co(yi.setSessionsState({sessions:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Hm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getCurrentUserSession);yield co(yi.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Jm({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteSessionForUser,e),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Ym({payload:{callback:e,userId:t}}){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield co(yi.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Qm(){yield co(yi.setSessionsState({loading:!0,error:null}));try{yield fo(my.auth.deleteAllSessionsForUser),yield co(yi.loadUserSessions())}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*Xm(){yield ca(yi.loadUserSessions,qm),yield ca(yi.deleteUserSession,Jm),yield ca(yi.deleteAllUserSessions,Qm),yield ca(yi.loadCurrentUserSession,Hm),yield la(yi.revokeUserSessions,Ym)}function*Zm(){yield co(yi.setSessionsState({loading:!0,error:null})),yield co(yi.setSessionsState({sessions:uf,loading:!1}))}function*eb({payload:{id:e}}){yield co(yi.setSessionsState({loading:!0,error:null}));const t=(yield So((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield co(yi.setSessionsState({sessions:t,loading:!1}))}function*tb(){yield co(yi.setSessionsState({loading:!0,error:null}));const e=uf.filter((e=>e.current));yield co(yi.setSessionsState({sessions:e,loading:!1}))}function*nb(){yield ca(yi.loadUserSessions,Zm),yield ca(yi.deleteUserSession,eb),yield ca(yi.deleteAllUserSessions,tb)}const ib=["callback"],ob=["callback"];function*ab(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield fo(my.auth.getSessionConfigurations);yield co(yi.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield co(yi.setSessionsState({error:e,loading:!1}))}}function*rb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=Ii(e,ib);yield fo(my.auth.createOrUpdateSessionConfigrations,n),yield co(yi.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield co(yi.setSessionsPolicyState({error:e,loading:!1}))}}function*sb(){yield ua(yi.loadSessionsPolicy,ab),yield ca(yi.createOrUpdateSessionsPolicy,rb)}function*lb(){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const e=yield So((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:df}));yield co(yi.setSessionsPolicyState(C({},e,{loading:!1})))}function*cb({payload:e}){yield co(yi.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=Ii(e,ob);null==t||t(!0),yield co(yi.setSessionsPolicyState({configurations:n,loading:!1}))}function*ub(){yield ua(yi.loadSessionsPolicy,lb),yield ca(yi.createOrUpdateSessionsPolicy,cb)}const db=["callback"],yb=["callback"],fb=["callback"],gb=["callback"],pb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=()=>So((e=>e.auth.restrictionsState.ipRestrictions)),bb=()=>So((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Ab(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield fo(my.auth.getDomainRestrictionsConfig),t=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*kb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,db);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield bb();try{var o;yield fo(my.auth.createDomainRestriction,n);const e=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,yb);yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield fo(my.auth.updateDomainRestrictionConfig,n),i=(yield fo(my.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield co(yi.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Pb({payload:{id:e}}){yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield bb();try{var n;yield fo(my.auth.deleteDomainRestriction,e);const i=(yield fo(my.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield co(yi.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Ib=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*Lb(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=yield fo(my.auth.getIPRestrictionsConfig),n=Ib({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield fo(my.auth.getIPRestrictions,n);yield co(yi.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Eb(){try{const{valid:e}=yield fo(my.auth.testCurrentIpInAllowList);yield co(yi.setIpRestrictionsState({userIpValid:e}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message}))}}function*Ob({payload:{callback:e}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield So((e=>e.auth.userIp));yield uo([fo(my.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:xn.ALLOW}),fo(my.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield mb(),i=Ib(n.pagination),{items:o,_metadata:{totalPages:a}}=yield fo(my.auth.getIPRestrictions,i);yield co(yi.setIpRestrictionsState({data:{config:{isActive:!0,strategy:xn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield co(yi.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*wb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,fb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();try{var o,a;yield fo(my.auth.createIPRestriction,n);const e=yield mb(),r=Ib(e.pagination),{items:s,_metadata:{totalPages:l}}=yield fo(my.auth.getIPRestrictions,r);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:xn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Cb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,gb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));try{yield fo(my.auth.updateIPRestrictionConfig,n);const e=yield mb(),i=yield fo(my.auth.getIPRestrictionsConfig),o=Ib(C({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield fo(my.auth.getIPRestrictions,o);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Db({payload:{id:e,callback:t}}){yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const n=yield mb();try{var i;yield fo(my.auth.deleteIPRestriction,e);const o=yield mb(),a=Ib(o.pagination),{items:r,_metadata:{totalPages:s}}=yield fo(my.auth.getIPRestrictions,a);yield Eb(),yield co(yi.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Rb(){yield ua(yi.loadIpRestrictions,Lb),yield ua(yi.loadEmailDomainRestrictions,Ab),yield la(yi.saveIpRestriction,wb),yield la(yi.saveIpRestrictionsConfig,Cb),yield la(yi.deleteIpRestriction,Db),yield la(yi.checkIfUserIpValid,Eb),yield la(yi.addCurrentUserIpAndActivate,Ob),yield la(yi.saveEmailDomainRestriction,kb),yield la(yi.saveEmailDomainRestrictionsConfig,Tb),yield la(yi.deleteEmailDomainRestriction,Pb)}function*Ub(){yield co(yi.setIpRestrictionsState({loading:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{restrictions:ff.filter((e=>e.strategy===yf.strategy)),config:yf},totalPages:1,pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*_b(){yield co(yi.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield mb(),t=ff[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield co(yi.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield co(yi.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Mb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,pb);yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const r=yield mb(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield co(yi.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:xn.ALLOW},restrictions:[...s,C({},a,{createdAt:new Date,updatedAt:new Date,id:Fv(),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*Nb(e){var t,n,i;let{payload:{callback:o}}=e,a=Ii(e.payload,Sb);const r=yield mb();yield co(yi.setIpRestrictionsState({saving:!0,error:null})),yield co(yi.setIpRestrictionsState({data:{config:C({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield co(yi.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*Fb({payload:{id:e,callback:t}}){var n;yield co(yi.setIpRestrictionsState({saving:!0,error:null}));const i=yield mb();yield co(yi.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:xn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:xn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*$b(){yield co(yi.setEmailDomainRestrictionsState({loading:!0,error:null})),yield co(yi.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:xn.ALLOW}],config:{active:!0,listType:xn.ALLOW,blockPublicDomains:!1}}}))}function*Gb(e){var t,n;let{payload:{callback:i}}=e,o=Ii(e.payload,vb);const a=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==i||i(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],C({},o,{id:Date.now().toString()})]},saving:!1}))}function*xb(e){var t;let{payload:{callback:n}}=e,i=Ii(e.payload,hb);const o=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),null==n||n(!0),yield co(yi.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||xn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Vb({payload:{id:e}}){var t,n;const i=yield bb();yield co(yi.setEmailDomainRestrictionsState({saving:!0,error:null})),yield mt(),yield co(yi.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:xn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*jb(){yield ua(yi.loadIpRestrictions,Ub),yield ua(yi.loadEmailDomainRestrictions,$b),yield la(yi.saveIpRestriction,Mb),yield la(yi.saveIpRestrictionsConfig,Nb),yield la(yi.deleteIpRestriction,Fb),yield la(yi.checkIfUserIpValid,_b),yield la(yi.saveEmailDomainRestriction,Gb),yield la(yi.saveEmailDomainRestrictionsConfig,xb),yield la(yi.deleteEmailDomainRestriction,Vb)}const Wb=["callback"],Bb=["id"];function*Kb(e){const{count:t}=yield fo(my.directory.countConfigurationUsers,e.id);return C({},e,{count:t})}function*zb(){yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.getConfigs),t=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:t,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*qb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Wb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{const e=yield fo(my.directory.createConfiguration,n),i=yield fo(my.directory.getConfigs),o=yield uo(i.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Hb(e){let{payload:{id:t}}=e,n=Ii(e.payload,Bb);yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.updateConfiguration,t,n);const e=yield fo(my.directory.getConfigs),i=yield uo(e.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1}))}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1}))}}function*Jb({payload:{id:e,callback:t}}){yield co(yi.setProvisioningState({loading:!0,error:null}));try{yield fo(my.directory.deleteConfiguration,e);const n=yield fo(my.directory.getConfigs),i=yield uo(n.map((e=>Kb(e))));yield co(yi.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Yb(){yield ua(yi.loadProvisionConnections,zb),yield la(yi.createProvisionConnection,qb),yield la(yi.deleteProvisionConnection,Jb),yield la(yi.updateProvisionConnection,Hb)}const Qb=["callback","events"];function*Xb(e){let{payload:{callback:t}}=e,n=Ii(e.payload,Qb);yield co(yi.setImpersonateState({loading:!0}));try{yield fo(my.impersonate.impersonate,n),yield co(yi.setImpersonateState({step:ri.success})),yield vo(1e3),yield Ug(),yield co(yi.resetImpersonateState()),null==t||t(!0)}catch(e){yield co(yi.setImpersonateState({loading:!1,error:e.message}))}}function*Zb(){yield ua(yi.impersonate,Xb)}function*eA({payload:e}){const{callback:t,deviceId:n}=e;yield co(yi.setPasskeysState({loading:!0}));try{yield fo(my.auth.deleteWebAuthnDevice,n);const{devices:e}=yield So((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield co(yi.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*tA(){yield co(yi.setPasskeysState({loading:!0}));try{const{devices:e}=yield fo(my.auth.getWebAuthnDevices);yield co(yi.setPasskeysState({devices:e,loading:!1}))}catch(e){yield co(yi.setPasskeysState({loading:!1,error:e.message||null}))}}function*nA(){yield la(yi.loadWebAuthnDevices,tA),yield la(yi.deleteWebAuthnDevice,eA)}const iA=["roleIds","userIds"],oA=()=>So((e=>e.auth.groupsState));function*aA({payload:e}){const t=$v.GET_TEAM_USERS;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield fo(my.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield co(yi.setGroupsState({teamUsers:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*rA({payload:e}){const t=$v.GET_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield fo(my.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState({selectedGroup:n}))}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*sA(){const e=$v.GET_GROUPS,t=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield fo(my.groups.getGroups,{_groupsRelations:Gv.rolesAndUsers});yield co(yi.setGroupsState(C({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*lA({payload:e}){const t=$v.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=Ii(e,iA);yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield fo(my.groups.createGroup,C({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield co(yi.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield co(yi.addRolesToGroup({groupId:r.id,roleIds:n}))),yield co(yi.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*cA({payload:e}){const t=$v.UPDATE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.updateGroup,e),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*uA({payload:e}){const t=$v.DELETE_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteGroup,e.groupId),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*dA({payload:e}){const t=$v.ADD_ROLES_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*yA({payload:e}){const t=$v.DELETE_ROLES_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*fA({payload:e}){const t=$v.ADD_USERS_TO_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield co(yi.setUsersGroupsError({key:t,value:n.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*gA({payload:e}){const t=$v.DELETE_USERS_FROM_GROUP;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield fo(my.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield co(yi.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield co(yi.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*pA(){const e=$v.GET_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield fo(my.groups.getGroupConfiguration);yield co(yi.setGroupsState({groupsConfiguration:t}))}catch(t){yield co(yi.setUsersGroupsError({key:e,value:t.message}))}finally{yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}}function*SA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION;yield co(yi.setUsersGroupsLoader({key:t,value:!0}));try{yield fo(my.groups.updateGroupConfiguration,e),yield co(yi.getGroupConfiguration())}catch(e){yield co(yi.setUsersGroupsError({key:t,value:e.message}))}finally{yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}}function*vA(){yield ca(yi.loadGroups,sA),yield ca(yi.getGroupById,rA),yield ca(yi.createGroup,lA),yield ca(yi.updateGroup,cA),yield ca(yi.deleteGroup,uA),yield ca(yi.addRolesToGroup,dA),yield ca(yi.deleteRolesFromGroup,yA),yield ca(yi.addUsersToGroup,fA),yield ca(yi.deleteUsersFromGroup,gA),yield ca(yi.getGroupConfiguration,pA),yield ca(yi.updateGroupConfiguration,SA),yield ca(yi.getTeamUsers,aA)}function*hA(){const e=$v.GET_GROUPS;yield co(yi.setUsersGroupsLoader({key:e,value:!0}));const t=Sf;yield co(yi.setGroupsState({groups:t})),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*mA({payload:e}){var t;const n=$v.CREATE_GROUP,{groups:i}=yield oA();yield co(yi.setUsersGroupsLoader({key:n,value:!0})),yield co(yi.setGroupsState({groups:[C({},e,{id:`${e.name}ID`,managedBy:Sy.FRONTEGG}),...null!=i?i:[]]})),yield vo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield co(yi.setUsersGroupsLoader({key:n,value:!1}))}function*bA({payload:e}){var t,n,i,o,a;const r=$v.UPDATE_GROUP,s=yield oA();yield co(yi.setUsersGroupsLoader({key:r,value:!0})),yield co(yi.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:Sy.FRONTEGG}):t})),selectedGroup:C({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield vo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield co(yi.setUsersGroupsLoader({key:r,value:!1}))}function*AA({payload:e}){var t,n;const i=$v.DELETE_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*kA({payload:e}){var t,n;const i=$v.ADD_ROLES_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*TA({payload:e}){var t,n;const i=$v.DELETE_ROLES_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*PA({payload:e}){var t,n;const i=$v.ADD_USERS_TO_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*IA({payload:e}){var t,n;const i=$v.DELETE_USERS_FROM_GROUP,o=yield oA();yield co(yi.setUsersGroupsLoader({key:i,value:!0})),yield co(yi.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?C({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield vo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield co(yi.setUsersGroupsLoader({key:i,value:!1}))}function*LA(){const e=$v.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield oA();yield co(yi.setUsersGroupsLoader({key:e,value:!0})),t&&(yield co(yi.setGroupsState({groupsConfiguration:C({},t)}))),yield co(yi.setUsersGroupsLoader({key:e,value:!1}))}function*EA({payload:e}){const t=$v.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield oA();yield co(yi.setUsersGroupsLoader({key:t,value:!0})),n&&(yield co(yi.setGroupsState({groupsConfiguration:C({},n,e)}))),yield co(yi.setUsersGroupsLoader({key:t,value:!1}))}function*OA(){yield ca(yi.loadGroups,hA),yield ca(yi.createGroup,mA),yield ca(yi.updateGroup,bA),yield ca(yi.deleteGroup,AA),yield ca(yi.addRolesToGroup,kA),yield ca(yi.deleteRolesFromGroup,TA),yield ca(yi.addUsersToGroup,PA),yield ca(yi.deleteUsersFromGroup,IA),yield ca(yi.getGroupConfiguration,LA),yield ca(yi.updateGroupConfiguration,EA)}const wA=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...wA(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),CA=["callback"];function*DA(){yield co(yi.setCustomLoginState({loading:!0}));try{const e=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield co(yi.setCustomLoginState({loading:!1,error:e.message}))}}function*RA(e){let{payload:{callback:t}}=e,n=Ii(e.payload,CA);try{if(yield co(yi.setCustomLoginState({error:null,saving:!0})),!n.loginBox)throw new Error("no changes to update");const e=wA(n);if(0===e.length)throw new Error("no changes to update");yield fo(Cc,{actions:e});const i=yield fo(wc);yield co(yi.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield co(yi.setCustomLoginState({error:e.message,saving:!1})),null==t||t(null,e)}}function*UA(){yield ua(yi.loadTenantMetadata,DA),yield ua(yi.updateTenantMetadata,RA)}var _A={sagas:function*(){yield uo([fo(Dp),fo(Ev),fo(wv),fo(hv),fo(zm),fo(qp),fo(AS),fo(ES),fo(UA),fo(ov),fo(Dh),fo(vA),fo(Qh),fo(Pf),fo(rm),fo(Xf),fo(pm),fo(Tm),fo(Fm),fo(Xm),fo(sb),fo(Rb),fo(Yb),fo(Zb),fo(nA)])},mockSagas:function*(){yield uo([fo(_p),fo(eS),fo(DS),fo(fv),fo(Bh),fo(ym),fo(dg),fo(nb),fo(hm),fo(Im),fo(ub),fo(jb),fo(Gm),fo(OA)])},storeName:wt,initialState:ai,reducer:ui,actions:yi};const MA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>C({},t,{[e]:C({},t[e],n)})}),NA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},FA={setAuditLogsState:MA("auditLogsState"),resetAuditLogsState:e=>C({},e,{auditLogsState:NA})},$A={exportAuditsCsv:lt("auditLogs/exportAuditsCsv"),loadAuditLogs:lt("auditLogs/loadAuditLogs",(e=>({payload:e})))},GA={loading:!0},xA={setAuditsMetadataState:MA("auditsMetadataState"),resetAuditsMetadataState:e=>C({},e,{auditsMetadataState:GA})},VA={loadAuditsMetadata:lt("auditLogs/loadAuditsMetadata")},jA={auditLogsState:NA,auditsMetadataState:GA},{reducer:WA,actions:BA}=ut({name:Dt,initialState:jA,reducers:C({resetState:e=>C({},e,jA),setState:(e,{payload:t})=>C({},e,t)},FA,xA)}),KA=C({},BA,$A,VA),zA=e=>"createdAt"!==e.id,qA={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`})))},HA={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}]},JA=()=>So((e=>e.auditLogs.auditLogsState)),YA=()=>So((e=>e.auditLogs.auditsMetadataState));function*QA(){const e=yield JA(),{columns:t}=yield YA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});yield co(KA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield my.audits.exportAudits(C({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield co(KA.setAuditLogsState({isDownloadingCsv:!1}))}function*XA({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>C({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>C({},e,{[t.id]:t.value})),{});n||(yield co(KA.loadAuditsMetadata()));const{data:g,total:p}=yield fo(my.audits.getAudits,C({offset:c,count:l},y,f));yield co(KA.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 co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*ZA(){yield la(KA.exportAuditsCsv,QA),yield la(KA.loadAuditLogs,XA)}function*ek({payload:e}){yield co(KA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield JA(),{columns:n}=yield YA();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield co(KA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield co(KA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=qA;let i=n.filter((e=>t=>e.filter(zA).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield co(KA.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield co(KA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*tk(){yield la(KA.loadAuditLogs,ek)}function*nk(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield fo(my.metadata.getAuditsMetadata);yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ik(){yield la(KA.loadAuditsMetadata,nk)}function*ok(){yield co(KA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=HA;yield co(KA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield co(KA.setAuditsMetadataState({error:e,loading:!1}))}}function*ak(){yield la(KA.loadAuditsMetadata,ok)}var rk={sagas:function*(){yield uo([fo(ZA),fo(ik)])},mockSagas:function*(){yield uo([fo(tk),fo(ak)])},storeName:Dt,initialState:jA,reducer:WA,actions:KA};const sk={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:lk,actions:ck,reducer:uk}=ut({name:"audits",initialState:sk,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]})))}}}),dk=C({},ck,{initData:lt(`${lk}/initData`),loadAudits:lt(`${lk}/loadAudits`),removeFilter:lt(`${lk}/removeFilter`),filterData:lt(`${lk}/filterData`),exportCSV:lt(`${lk}/exportCSV`),deleteAudits:lt(`${lk}/deleteAudits`)}),yk=()=>So((e=>e[lk]));function*fk(){const{sortBy:e,sortDirection:t}=yield yk();try{const n=yield fo(my.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield co(dk.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield co(dk.loadItemFailedAction(t))}}function*gk(){try{const e=yield fo(my.metadata.getAuditsMetadata);yield co(dk.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield co(dk.loadItemFailedAction(t))}}const pk=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*Sk({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield yk(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield yk():{rowsData:[]};try{const e=pk(t),{data:s,total:d}=yield fo(my.audits.getAudits,C({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield co(dk.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield co(dk.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield co(dk.loadItemFailedAction(t))}}function*vk(){yield co(dk.startLoading()),yield uo([fk(),gk(),Sk({payload:{onlyOneLoad:!1},type:""})]),yield co(dk.finishLoading())}function*hk({payload:e}){const{filters:t}=yield yk(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield co(dk.setFilterData(i))}function*mk({payload:e}){const{filters:t}=yield yk();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield co(dk.setFilterData(i))}function*bk(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield yk(),a=pk(e);yield co(dk.startDownloadingCsv());try{yield my.audits.exportAudits(C({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield co(dk.stopDownloadingCsv())}}function*Ak(){yield ca(dk.initData,vk),yield ca(dk.removeFilter,hk),yield ca(dk.filterData,mk),yield ca([dk.loadAudits,dk.textSearch,dk.onPageChange],Sk),yield ca([dk.setFilterData,dk.setDataSorting,dk.startRefresh],(()=>Sk({payload:{appendMode:!1},type:""}))),yield ca(dk.exportCSV,bk)}const kk={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},Tk={initData:()=>C({},kk),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)})}},Pk={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}})))},Ik={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Lk,actions:Ek}=ut({name:Ct,initialState:Ik,reducers:C({},Tk)}),Ok=C({},Ek,Pk),wk={slack:my.connectivity.getSlackConfiguration,email:my.connectivity.getEmailConfiguration,sms:my.connectivity.getSMSConfiguration,webhook:my.connectivity.getWebhooksConfigurations,categories:my.connectivity.getCategories,channelMap:my.connectivity.getChannelMaps},Ck={slack:my.connectivity.postSlackConfiguration,email:my.connectivity.postEmailConfiguration,sms:my.connectivity.postSMSConfiguration,webhook:my.connectivity.postWebhooksConfiguration},Dk=["email","slack","sms","webhook"],Rk={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"}},Uk=["id"],_k=["id","enabled"],Mk=["categories","channelMap"];function*Nk(e){return yield fo($k,{payload:{api:e},type:""})}function*Fk({payload:e=Dk}){yield co(Ok.setConnectivityState({isLoading:!0}));try{const t=yield uo([...e.map(Nk),yield $k({payload:{api:"categories"},type:""}),yield function*(){return(yield uo(e.map((function*(e){return yield $k({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>C({},t,{[`${e[i]}`]:n})),{})}()]),n=yield $k({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?C({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:Rk[e[o]].events(i),active:Rk[e[o]].isActive(i),platform:Rk[e[o]].title,image:Rk[e[o]].image}]}):n:C({},n,{[`${Mk[o-e.length]}`]:i})),{list:[],webhook:n});yield co(Ok.setConnectivityState(C({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield co(Ok.setConnectivityState({isLoading:!1}))}}function*$k({payload:{api:e,params:t}}){try{return yield fo(wk[e],t)}catch(e){return}}function*Gk(){try{yield co(Ok.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield fo(my.connectivity.getSlackChannels);yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*xk(e,t){const{connectivity:{list:n}}=yield So(),i=n.find((({key:t})=>t===e));if(!i)return;const o=Rk[e].isActive(t);o!==i.active&&(yield co(Ok.setConnectivityState({list:n.map((t=>t.key===e?C({},t,{active:o}):t))})))}function*Vk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield So((e=>e.connectivity));try{if(yield co(Ok.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield So();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield uo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=Ii(e,Uk);return n===t.id&&JSON.stringify(C({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield fo(Ck.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield fo(my.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield So(),{processIds:i}=yield So((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield uo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield fo("email"===t?my.connectivity.postEmailConfiguration:my.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=Ii(o,_k);return yield uo([yield fo("email"===t?my.connectivity.patchEmailConfiguration:my.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield fo("email"===t?my.connectivity.putEmailSubscriptions:my.connectivity.putSMSSubscriptions,a,i,C({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return fo("email"===t?my.connectivity.deleteEmailSubscriptions:my.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield $k({payload:{api:t},type:""});yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield xk(t,e)}else yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield fo(Ck[e],t),!["sms","email"].includes(e)){const o=yield $k({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield xk(e,o),null==n||n(!0)}}catch(e){var o;yield co(Ok.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*jk({payload:e}){try{yield my.connectivity.postSlackCode(e)}catch{}yield co(Ok.setConnectivityState({error:void 0,isSaving:!1}))}function*Wk(){const{slackChannels:e}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({slackChannels:C({},e,{isLoadingScope:!0})}));const{clientId:t}=yield fo(my.connectivity.getSlackScope);yield co(Ok.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield co(Ok.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Bk({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({isSaving:!0})),yield fo(my.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield $k({payload:{api:"webhook"},type:""});o&&(yield co(Ok.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Kk({payload:e}){try{yield co(Ok.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield fo(my.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield co(Ok.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*zk({payload:e}){try{const{statusCode:t}=yield fo(my.connectivity.postWebhookRetry,e);yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield co(Ok.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*qk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield So((e=>e.connectivity));try{yield co(Ok.setConnectivityState({webhookLogs:C({},i,{isLoading:!0})}));const o=yield fo(my.connectivity.getWebhookLog,e,n,t);yield co(Ok.setConnectivityState({error:void 0,webhookLogs:C({isLoading:!1},o)}))}catch(e){yield co(Ok.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Hk={sagas:function*(){yield la(Ok.loadDataAction,Fk),yield ca(Ok.loadSlackActions,Gk),yield la(Ok.postDataAction,Vk),yield la(Ok.postCodeAction,jk),yield la(Ok.loadScope,Wk),yield la(Ok.deleteWebhookConfigAction,Bk),yield la(Ok.postWebhookTestAction,Kk),yield la(Ok.postWebhookRetryAction,zk),yield ca(Ok.loadWebhookLogsAction,qk)},storeName:Ct,initialState:Ik,reducer:Lk,actions:Ok};function Jk(){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 Yk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>C({},n,{[e]:t(n[e],i)})}}function Qk(e){return Yk(e,((e,t)=>C({},e,{loading:t.payload})))}function Xk(e){return Yk(e,((e,t)=>C({},e,{error:t.payload,loading:!1})))}const Zk={loading:!1,error:null,fetching:!0,plans:[]},{actions:eT,reducer:tT,name:nT}=ut({name:"subscriptions/plans",initialState:Zk,reducers:C({},Jk())}),iT=C({loadPlans:lt(`${nT}/loadPlans`)},eT),oT={loading:!1,error:null,fetching:!0,config:null},aT=C({},Jk()),{actions:rT,reducer:sT,name:lT}=ut({name:"subscriptions/config",initialState:oT,reducers:aT}),cT=C({loadPaymentConfiguration:lt(`${lT}/loadPaymentConfiguration`)},rT),uT={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},dT=C({},Jk(),{setCancellationLoading:Qk("cancellation"),setCancellationError:Xk("cancellation"),setRenewalLoading:Qk("renewal"),setRenewalError:Xk("renewal")}),{reducer:yT,actions:fT,name:gT}=ut({name:"subscriptions/billing/subscription",initialState:uT,reducers:dT}),pT=C({load:lt(`${gT}/loadSubscription`),cancelSubscription:lt(`${gT}/cancelSubscription`),renewSubscription:lt(`${gT}/renewSubscription`)},fT),ST={loading:!1,error:null,fetching:!0},vT=C({},Jk()),{reducer:hT,actions:mT,name:bT}=ut({name:"subscriptions/billing/information",initialState:ST,reducers:vT}),AT=C({loadBillingInformation:lt(`${bT}/loadBillingInformation`),cancelSubscription:pT.cancelSubscription,renewSubscription:pT.renewSubscription},mT),kT={loading:!1,error:null,fetching:!0},TT=C({},Jk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,t.payload)}}),{reducer:PT,actions:IT,name:LT}=ut({name:"subscriptions/billing/payment",initialState:kT,reducers:TT}),ET=C({loadPaymentMethod:lt(`${LT}/loadPaymentMethod`),submitPaymentMethod:lt(`${LT}/submitPaymentMethod`),submitPaymentMethodError:lt(`${LT}/submitPaymentMethodError`),submitPaymentMethodSuccess:lt(`${LT}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:lt(`${LT}/updateBillingDetails`,(e=>({payload:e})))},IT),OT={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},wT=C({},Jk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>C({},e,{invoiceDownload:C({},e.invoiceDownload,t.payload)})}}),{reducer:CT,actions:DT,name:RT}=ut({name:"subscriptions/billing/invoices",initialState:OT,reducers:wT}),UT=C({loadInvoices:lt(`${RT}/loadInvoices`),downloadInvoice:lt(`${RT}/downloadInvoice`,(e=>({payload:e})))},DT),_T={information:ST,invoices:OT,paymentMethod:kT,subscription:uT},MT={invoices:UT,information:AT,paymentMethod:ET,subscription:pT},NT=je({invoices:CT,information:hT,paymentMethod:PT,subscription:yT}),FT={fetching:!0,loading:!1,error:null,confirmed:!1},$T=C({},Jk()),{actions:GT,reducer:xT,name:VT}=ut({name:"subscriptions/checkout",initialState:FT,reducers:$T}),jT=C({loadCheckout:lt(`${VT}/loadCheckout`),resetCheckout:lt(`${VT}/resetCheckout`),submitCheckout:lt(`${VT}/submitCheckout`),confirmCheckout:lt(`${VT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:lt(`${VT}/errorCheckout`,(e=>({payload:e})))},GT),WT={loading:!1,error:null,cardSetupIntentSecret:null},BT=C({},Jk()),{reducer:KT,actions:zT,name:qT}=ut({name:"subscriptions/stripe",initialState:WT,reducers:BT}),HT=C({loadCustomer:lt(`${qT}/loadCustomer`),createCardSetupIntentSecret:lt(`${qT}/createCardSetupIntentSecret`)},zT),JT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:YT,reducer:QT,name:XT}=ut({name:"subscriptions/vendorPublicConfig",initialState:JT,reducers:C({},Jk())}),ZT=C({loadVendorPublicConfiguration:lt(`${XT}/loadVendorPublicConfiguration`)},YT),eP={config:oT,plans:Zk,checkout:FT,billing:_T,stripe:WT,vendorPublicConfig:JT},tP={config:cT,billing:MT,plans:iT,checkout:jT,stripe:HT,vendorPublicConfig:ZT},nP=je({config:sT,billing:NT,plans:tT,checkout:xT,stripe:KT,vendorPublicConfig:QT});let iP,oP,aP;function rP({policy:e}){return{policy:aP.AT_PERIOD_END}}function sP(e){switch(e){case Sd.ACTIVE:return oP.ACTIVE;case Sd.INCOMPLETE:return oP.INCOMPLETE;case Sd.CANCELED:return oP.CANCELED;case Sd.EXPIRED:return oP.EXPIRED;case Sd.TRIALING:return oP.TRIALING;default:return oP.EXPIRED}}!function(e){e.STRIPE="Stripe"}(iP||(iP={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(oP||(oP={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(aP||(aP={}));const lP={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Sd.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},cP=[{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"}],uP=[{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:""}],dP=[{id:"id",externalId:"externalId",type:vd.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],yP={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*fP(){yield la(pT.load,gP),yield la(pT.cancelSubscription,SP),yield la(pT.renewSubscription,vP)}function*gP(){const e=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield kP(e)}function*pP(){yield co(pT.setLoading(!0));try{const[e]=yield fo(my.subscriptions.getManagedSubscriptions);yield co(pT.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield co(pT.setError(e))}}function*SP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Sd.ACTIVE)try{yield co(pT.setCancellationLoading(!0)),yield fo(my.subscriptions.cancelManagedSubscription,t),yield pP(),yield co(pT.setCancellationLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*vP(){const{subscription:e}=yield So((e=>e.subscriptions.billing.subscription));if(!e)return void(yield co(pT.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield co(pT.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===hd.AT_PERIOD_END)try{yield co(pT.setRenewalLoading(!0)),yield fo(my.subscriptions.renewManagedSubscription,t),yield pP(),yield co(pT.setRenewalLoading(!1))}catch(e){yield co(pT.setCancellationError(e.message))}}function*hP(){yield co(pT.setLoading(!0)),yield vo(500),yield co(pT.setState({subscription:lP,fetching:!1,loading:!1,error:null}))}function*mP(){yield la(pT.load,hP)}function*bP(){yield la(AT.loadBillingInformation,AP)}function*AP(){yield function*(e){const t=yield So((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield So((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield kP(n,!1):yield co(AT.setError(t?"Not authorized":"Internal feature failure"))}()}function*kP(e,t){yield co(AT.setLoading(!0));try{var n,i;const o=yield fo(my.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield fo(my.subscriptions.getSubscriptionPlan,a):([,s]=yield uo([fo(pP),fo(my.subscriptions.getSubscriptionPlan,a)]),l=yield So((e=>e.subscriptions.billing.subscription.subscription||null))),yield co(AT.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?oP.ACTIVE:sP(l.status),cancellation:l.cancellation&&rP(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield co(AT.setError(e.message))}}function*TP(){yield function*(){var e,t;yield co(AT.setLoading(!0)),yield vo(500),yield co(AT.setState({loading:!1,fetching:!1,summary:{subscriptionId:lP.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:md.Stripe,externallyManaged:!1,currentPlanId:cP[0].id,defaultPlanId:cP[0].id},plan:C({},cP[0],{price:null==(e=cP[0].price)?void 0:e.amount,currency:null==(t=cP[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*PP(){yield la(AT.loadBillingInformation,TP)}function*IP(){yield la(ET.loadPaymentMethod,LP),yield la(ET.submitPaymentMethod,OP),yield la(ET.submitPaymentMethodError,wP),yield la(ET.submitPaymentMethodSuccess,CP),yield la(ET.updatePaymentMethodBillingDetails,EP)}function*LP(){yield co(ET.setLoading(!0));try{const e=(yield fo(my.subscriptions.getPaymentMethods))[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield co(ET.setError(e.message))}}function*EP({payload:e}){yield co(ET.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield fo(my.subscriptions.updatePaymentMethodBillingDetails,t,C({email:n},i)),yield fo(LP),null==o||o(!0)}catch(e){yield co(ET.setError(e.message)),null==o||o(!1)}yield co(ET.setLoading(!1))}function*OP(){yield co(ET.setLoading(!0))}function*wP({payload:e}){yield co(ET.setError(e))}function*CP(){yield co(ET.loadPaymentMethod())}function*DP(){yield co(ET.setLoading(!0)),yield vo(500);const e=dP[0];yield co(ET.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*RP(){yield la(ET.loadPaymentMethod,DP)}function*UP(){yield la(UT.loadInvoices,_P),yield la(UT.downloadInvoice,MP)}function*_P(){yield co(UT.setLoading(!0));try{const e=(yield fo(my.subscriptions.getSubscriptionInvoices)).map((e=>({id:e.id,externalId:e.externalId,subscriptionId:e.subscriptionId,paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2),currency:e.currency||"usd",paid:e.paid||!1,receiptNumber:e.receiptNumber})));yield co(UT.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield co(UT.setError(e.message))}}function*MP({payload:e}){yield co(UT.setInvoiceDownloadState({loading:!0,error:null}));try{yield fo(my.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield co(UT.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield co(UT.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*NP(){yield co(UT.setLoading(!0)),yield vo(500),yield co(UT.setState({loading:!1,fetching:!1,invoices:uP.map((e=>C({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield co(UT.setLoading(!1))}function*FP(){yield la(UT.loadInvoices,NP)}function*$P(){yield uo([fo(bP),fo(IP),fo(UP),fo(fP)])}function*GP(){yield uo([fo(PP),fo(RP),fo(FP),fo(mP)])}function*xP(){yield la(jT.loadCheckout,VP),yield la(jT.resetCheckout,jP),yield la(jT.submitCheckout,WP),yield la(jT.confirmCheckout,BP),yield la(jT.errorCheckout,zP)}function*VP(){yield co(jT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*jP(){yield co(jT.setState({loading:!1,error:null,confirmed:!1}))}function*WP(){yield co(jT.setState({loading:!0,error:null}))}function*BP({payload:{paymentMethodId:e,planId:t}}){const n=yield So((e=>e.subscriptions.billing.subscription.subscription)),i=yield So((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Sd.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield co(jT.setState({loading:!0,error:null})),o&&a)return yield KP(),void(yield co(pT.setState({subscription:C({},n,{status:Sd.ACTIVE})})));try{yield fo(my.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield uo([AP(),LP(),_P()]),yield KP()}catch(e){yield co(jT.setState({loading:!1,error:e.message}))}}else yield co(jT.setState({loading:!1,error:"Subscription not found"}))}function*KP(){yield co(jT.setState({loading:!1,error:null,confirmed:!0}))}function*zP({payload:e}){yield co(jT.setState({loading:!1,error:e}))}function*qP(){yield la(jT.resetCheckout,jP)}function*HP(){yield la(iT.loadPlans,JP)}function*JP(){yield co(iT.setLoading(!0));try{const e=(yield fo(my.subscriptions.getSubscriptionPlans)).map((e=>{var t,n;return{id:e.id,name:e.name,description:e.description,price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month",slug:e.slug}}));yield co(iT.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield co(iT.setError(e.message))}}function*YP(){yield co(iT.setLoading(!0)),yield vo(500),yield co(iT.setState({fetching:!1,loading:!1,plans:cP.map((e=>{var t,n;return C({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*QP(){yield la(iT.loadPlans,YP)}function*XP(){yield la(cT.loadPaymentConfiguration,ZP)}function*ZP(){yield co(cT.setLoading(!0));try{(yield fo(my.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===md.Stripe))?yield function*(){yield co(cT.setLoading(!0));try{const e=yield fo(my.subscriptions.getStripePaymentProviderConfiguration);yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield co(cT.setError(e.message))}}():yield co(cT.setError("Payment provider not configured"))}catch(e){yield co(cT.setError(e.message))}}function*eI(){yield co(cT.setLoading(!0)),yield vo(500),yield co(cT.setState({loading:!1,fetching:!1,config:{paymentProvider:iP.STRIPE,apiKey:""}}))}function*tI(){yield la(cT.loadPaymentConfiguration,eI)}function*nI(){yield la(HT.createCardSetupIntentSecret,iI)}function*iI({payload:e}){yield co(HT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield fo(my.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield co(HT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield co(HT.setError(e.message))}}function*oI(){yield la(ZT.loadVendorPublicConfiguration,aI)}function*aI(){yield co(ZT.setLoading(!0));try{const e=yield fo(my.subscriptions.getVendorPublicConfigurations);yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield co(ZT.setError(e.message))}}function*rI(){yield co(ZT.setLoading(!0)),yield vo(500),yield co(ZT.setState({fetching:!1,loading:!1,vendorPublicConfig:yP}))}function*sI(){yield la(ZT.loadVendorPublicConfiguration,rI)}var lI={sagas:function*(){yield uo([fo($P),fo(xP),fo(HP),fo(XP),fo(nI),fo(oI)])},mockSagas:function*(){yield uo([fo(GP),fo(qP),fo(QP),fo(tI),fo(sI)])},reducer:nP,actions:tP,initialState:eP,storeName:"subscriptions"},cI={sagas:function*(){yield la(Cf.loadVendorPublicInfo,Df)},storeName:Rt,initialState:Ef,reducer:Of,actions:Cf};const{reducer:uI}=ut({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(da.setContext(t),C({},e,{context:t}))}}}),dI=(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||da.setContext(e.context);const t=Zo(),h=[...rt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=st({middleware:h,preloadedState:{root:C({},e,{previewMode:n,urlStrategy:r}),[_A.storeName]:C({},_A.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:C({},_A.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[rk.storeName]:C({},rk.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:C({},rk.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:C({},rk.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[lk]:C({},sk,null!=(v=null==o?void 0:o.audits)?v:{}),[Hk.storeName]:Hk.initialState,[lI.storeName]:lI.initialState,[cI.storeName]:cI.initialState},reducer:je({root:uI,[_A.storeName]:_A.reducer,[rk.storeName]:rk.reducer,[lk]:uk,[Hk.storeName]:Hk.reducer,[lI.storeName]:lI.reducer,[cI.storeName]:cI.reducer})});const m=function*(){yield uo([fo(_A.sagas),fo(rk.sagas),fo(Ak),fo(Hk.sagas),fo(lI.sagas),fo(cI.sagas)])},b=function*(){yield uo([fo(_A.mockSagas),fo(rk.mockSagas),fo(lI.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(yi.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var yI=n(714),fI=n.n(yI);function gI(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function pI(e){if(e.type)return e;if("#"===e.charAt(0))return pI(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 SI(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 vI(e){if(0===e.indexOf("#"))return e;const{values:t}=pI(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 hI(e,t){return e=pI(e),t=gI(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SI(e)}function mI(e,t){if(e=pI(e),t=gI(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 SI(e)}function bI(e,t){if(e=pI(e),t=gI(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 SI(e)}const AI=e=>{if(e)return{main:e,light:vI(bI(e,.4)),dark:vI(mI(e,.15)),hover:vI(mI(e,.15)),active:vI(mI(e,.2))}},kI=e=>{if(e)return{main:e,light:bI(e,.7),dark:mI(e,.2)}},TI=(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({},AI(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({},AI(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({},AI(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:C({},kI(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:C({},kI(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:C({},kI(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:C({},kI(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},PI={},II={},LI={},EI={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 OI{constructor(){this._theme=PI,this._themeV2=II,this._navigation=EI,this._localizations=LI}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OI;return n.set(e),OI._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=fI().all([null!=(t=EI)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fI().all([null!=(i=PI)?i:{},TI(null==e?void 0:e.theme,PI)]),this._themeV2=fI().all([null!=(o=II)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fI().all([null!=(r=LI)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=EI,this._theme=PI,this._themeV2=II,this._localizations=LI}}}OI._instances={};var wI=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},CI=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},DI=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)}))},RI=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 UI,_I,MI,NI,FI,$I,GI,xI,VI,jI,WI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(UI||(UI={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(_I||(_I={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(MI||(MI={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(NI||(NI={})),function(e){e.Invoices="invoices"}(FI||(FI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}($I||($I={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(GI||(GI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(xI||(xI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(VI||(VI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(jI||(jI={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(WI||(WI={}));const BI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},KI={hidden:"hidden",edit:"edit"};var zI="6.102.0",qI={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts":"on"},HI=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(zI),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=ba,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:OI.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}_d.set(qI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Md();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),_d.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=wI(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=dI({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;OI.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:T})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=R(_().mark((function e(){return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=R(_().mark((function e(){var t;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return da.setRequestSource(ga.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(),RI(t),da.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=R(_().mark((function e(t){var n;return _().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,C({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),JI=function(){function e(){P(this,e)}return O(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(da.setAccessToken(t),da.setUser(C({},n,{accessToken:t})),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(yi.loadTenants())):(da.setAccessToken(null),da.setUser(null),o.store.dispatch(yi.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),YI=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}(),QI=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}(),XI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},ZI=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=dI({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 HI(this.options,t,!0),OI.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,DI(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}(),eL="modern",tL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[eL]},nL=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=dI({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 HI(this.options,t,!0,a),OI.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,DI(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 iL(e,t){return iL=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},iL(e,t)}function oL(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&&iL(e,t)}function aL(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 rL(e){return rL=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},rL(e)}function sL(){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 lL(e,t,n){return lL=sL()?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&&iL(o,n.prototype),o},lL.apply(null,arguments)}function cL(e){var t="function"==typeof Map?new Map:void 0;return cL=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 lL(e,arguments,rL(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),iL(n,e)},cL(e)}function uL(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=rL(e);if(t){var o=rL(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return aL(this,n)}}var dL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new HI(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){oL(n,e);var t=uL(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=CI(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=CI(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=CI(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=CI(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=CI(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=CI(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}(cL(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}()}));
|