@frontegg/js 6.75.0-alpha.1 → 6.75.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((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 l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):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 l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(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 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},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,i){var o=t&&t.prototype instanceof p?t:p,a=Object.create(o.prototype),l=new O(i||[]);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 g={};function p(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(E([])));b&&b!==n&&a.call(b,s)&&(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,l,s){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,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 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 l=I(r,n);if(l){if(l===g)continue;return l}}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 s=f(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.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 w(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 E(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,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,s,(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=E,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(w),!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 l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)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),w(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;w(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(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 xT},AdminPortalRenderer:function(){return WT},AppHolder:function(){return L},CheckoutDialog:function(){return VT},FronteggApp:function(){return $T},HostedLogin:function(){return FT},LoginBoxRenderer:function(){return BT},defaultTheme:function(){return KT},getThemeAdminByName:function(){return jT},getThemeByName:function(){return GT},initialize:function(){return eP}});var e={};n.r(e),n.d(e,{Delete:function(){return oa},Get:function(){return ea},Patch:function(){return na},Post:function(){return ta},PostDownload:function(){return aa},Put:function(){return ia},getBaseUrl:function(){return Xo}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Va},getSubTenantsAsTree:function(){return ja},getTenants:function(){return xa},switchTenant:function(){return Fa}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return gr},MachineToMachineAuthStrategy:function(){return pr},OAuthLogout:function(){return xr},SocialLoginProviders:function(){return fr},acceptInvitation:function(){return Mr},activateAccount:function(){return Dr},bulkCreateIPRestriction:function(){return sr},changePhoneNumber:function(){return ws},changePhoneNumberWithVerification:function(){return Is},checkIfAllowToRememberMfaDevice:function(){return es},createDomainRestriction:function(){return nr},createIPRestriction:function(){return lr},createOrUpdateSessionConfigrations:function(){return Fl},createSSOConfiguration:function(){return as},createSSOConfigurationByMetadata:function(){return ss},createSSODomain:function(){return us},createSSOGroup:function(){return ps},createSamlGroup:function(){return Pl},createTenantAccessToken:function(){return zl},createUserAccessToken:function(){return Bl},deleteAllSessionsForUser:function(){return Vl},deleteDomainRestriction:function(){return or},deleteIPRestriction:function(){return ur},deleteSSOConfiguration:function(){return ls},deleteSSODomain:function(){return ds},deleteSSOGroup:function(){return vs},deleteSamlGroup:function(){return Ll},deleteSessionForUser:function(){return xl},deleteTenantAccessToken:function(){return Kl},deleteTenantApiToken:function(){return Ql},deleteUserAccessToken:function(){return Gl},deleteUserApiToken:function(){return Xl},disableMFAAuthenticatorApp:function(){return Zr},disableMFASMS:function(){return tl},disableMFAWebAuthn:function(){return il},disableMfa:function(){return Xr},enrollMFAAuthenticatorApp:function(){return zr},enrollMFAAuthenticatorAppForLogin:function(){return rl},enrollMFASMS:function(){return Hr},enrollMFASMSForLogin:function(){return cl},enrollMFAWebAuthn:function(){return Yr},enrollMFAWebAuthnForLogin:function(){return fl},enrollMfa:function(){return Gr},exchangeOAuthTokens:function(){return As},forgotPassword:function(){return Vr},generateLoginResponse:function(){return kr},generateLoginResponseFromOAuthResponse:function(){return Pr},generateLoginResponseV2:function(){return Tr},getActivateAccountStrategy:function(){return Rr},getCaptchaPolicy:function(){return Ja},getCurrentUserSession:function(){return Ml},getCurrentUserSessions:function(){return Ul},getDomainRestrictions:function(){return er},getDomainRestrictionsConfig:function(){return tr},getGlobalSecurityPolicy:function(){return Wa},getIPRestrictions:function(){return ar},getIPRestrictionsConfig:function(){return rr},getLockoutPolicy:function(){return za},getMFADevices:function(){return ol},getMFAStrategiesConfig:function(){return Us},getMfaPolicy:function(){return Ka},getOidcConfiguration:function(){return wl},getPasswordConfigPolicy:function(){return Za},getPasswordHistoryPolicy:function(){return Ya},getSSOConfigurations:function(){return os},getSSODefaultRoles:function(){return fs},getSSOGroups:function(){return hs},getSSOPublicConfiguration:function(){return Ol},getSamlConfiguration:function(){return Sl},getSamlRoles:function(){return Al},getSamlRolesGroups:function(){return kl},getSamlVendorConfiguration:function(){return hl},getSessionConfigurations:function(){return $l},getSocialLoginProviders:function(){return El},getSocialLoginProvidersV2:function(){return Cl},getTenantAccessTokensData:function(){return Wl},getTenantApiTokensData:function(){return Hl},getUserAccessTokensData:function(){return jl},getUserApiTokensData:function(){return ql},getUserById:function(){return Zl},getVendorConfig:function(){return Rl},getVendorLockoutPolicy:function(){return qa},getVendorMfaPolicy:function(){return Ga},getVendorPasswordHistoryPolicy:function(){return Qa},getVendorPublicAuthStrategiesConfig:function(){return _s},getWebAuthnDevices:function(){return Ds},loadPasswordConfig:function(){return Wr},login:function(){return Er},loginViaSocialLogin:function(){return Dl},loginWithMfa:function(){return Cr},logout:function(){return Fr},oidcPostLogin:function(){return Or},oidcPostLoginV2:function(){return bs},passwordlessPostLogin:function(){return ns},passwordlessPreLogin:function(){return ts},postLogin:function(){return wr},preDisableMFASMS:function(){return el},preDisableMFAWebAuthn:function(){return nl},preEnrollMFAAuthenticatorApp:function(){return Br},preEnrollMFAAuthenticatorAppForLogin:function(){return al},preEnrollMFASMS:function(){return qr},preEnrollMFASMSForLogin:function(){return sl},preEnrollMFAWebAuthn:function(){return Jr},preEnrollMFAWebAuthnForLogin:function(){return yl},preLogin:function(){return Ir},preLoginV2:function(){return ms},preLoginWithIdpType:function(){return Lr},preVerifyMFASMSForLogin:function(){return ul},preVerifyMFAWebAuthnForLogin:function(){return gl},recoverMfaToken:function(){return Kr},refreshToken:function(){return Nr},refreshTokenV2:function(){return $r},resendActivationEmail:function(){return _r},resendInvitationEmail:function(){return Ur},resetPassword:function(){return jr},resetPhoneNumber:function(){return Ts},revokeSessionsForUser:function(){return Nl},saveLockoutPolicy:function(){return Ha},saveMfaPolicy:function(){return Ba},savePasswordHistoryPolicy:function(){return Xa},setSSODefaultRoles:function(){return gs},signUpUser:function(){return _l},silentOAuthRefreshToken:function(){return ks},testCurrentIp:function(){return dr},testCurrentIpInAllowList:function(){return yr},updateDomainRestrictionConfig:function(){return ir},updateIPRestrictionConfig:function(){return cr},updateSSOConfiguration:function(){return rs},updateSSOConfigurationByMetadata:function(){return cs},updateSSOGroup:function(){return Ss},updateSamlConfiguration:function(){return vl},updateSamlGroup:function(){return Il},updateSamlRoles:function(){return Tl},updateSamlVendorMetadata:function(){return ml},updateTenantApiTokensData:function(){return Yl},updateUserApiTokensData:function(){return Jl},validateSSODomain:function(){return ys},validateSamlDomain:function(){return bl},verifyChangePhoneNumber:function(){return Ls},verifyInviteToken:function(){return is},verifyMFAAuthenticatorAppForLogin:function(){return ll},verifyMFASMSForLogin:function(){return dl},verifyMFAWebAuthnForLogin:function(){return pl},verifyMfa:function(){return Qr},verifyNewDeviceSession:function(){return Rs},verifyResetPhoneNumber:function(){return Ps},webAuthnCreateNewDeviceSession:function(){return Cs},webAuthnPostLogin:function(){return Es},webAuthnPreLogin:function(){return Os}});var a={};n.r(a),n.d(a,{addUser:function(){return Vs},changePassword:function(){return Fs},createInviteUserLink:function(){return Ks},deleteInviteUserLink:function(){return Bs},deleteUser:function(){return js},getInviteLinkConfiguration:function(){return qs},getInviteUserLink:function(){return zs},getProfile:function(){return Ms},loadAvailablePermissions:function(){return Js},loadAvailableRoles:function(){return Hs},loadStats:function(){return Ys},loadUsers:function(){return xs},resendActivationLink:function(){return Qs},resendInvitationLink:function(){return Xs},resendInvitationLinkToAllTenants:function(){return Zs},updateInviteUserLink:function(){return Gs},updateProfile:function(){return Ns},updateProfileImage:function(){return $s},updateUser:function(){return Ws}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return oc},getCurrentUserIpMetadata:function(){return tc},getIpAdressMetadata:function(){return ac},getNotificationsMetadata:function(){return nc},getSamlMetadata:function(){return ic}});var l={};n.r(l),n.d(l,{downloadReport:function(){return fc},getReport:function(){return uc},getReports:function(){return cc},renderReport:function(){return dc},scheduleReport:function(){return yc},sendReport:function(){return gc}});var s={};n.r(s),n.d(s,{getNotifications:function(){return pc},markAllAsRead:function(){return hc},updateNotificationIsPinned:function(){return vc},updateNotificationStatus:function(){return Sc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return kc},getAudits:function(){return bc},getAuditsStats:function(){return Ac}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Nc},deleteEmailSubscriptions:function(){return Uc},deleteSMSConfiguration:function(){return Wc},deleteSMSSubscriptions:function(){return Vc},deleteSlackConfiguration:function(){return Ec},deleteWebhooksConfiguration:function(){return Bc},getCategories:function(){return Jc},getChannelMaps:function(){return Yc},getEmailConfiguration:function(){return Dc},getSMSConfiguration:function(){return $c},getSlackChannels:function(){return wc},getSlackConfiguration:function(){return Ic},getSlackScope:function(){return Lc},getWebhookLog:function(){return zc},getWebhooksConfigurations:function(){return Kc},patchEmailConfiguration:function(){return _c},patchSMSConfiguration:function(){return xc},postEmailConfiguration:function(){return Rc},postSMSConfiguration:function(){return Fc},postSlackCode:function(){return Cc},postSlackConfiguration:function(){return Oc},postWebhookRetry:function(){return Hc},postWebhookTest:function(){return qc},postWebhooksConfiguration:function(){return Gc},putEmailSubscriptions:function(){return Mc},putSMSSubscriptions:function(){return jc}});var d={};n.r(d),n.d(d,{getSettings:function(){return Xc},updateSettings:function(){return Qc}});var y={};n.r(y),n.d(y,{addRole:function(){return iu},attachPermissionToRoles:function(){return su},attachPermissionsToRole:function(){return ru},deleteRole:function(){return ou},getPermissionCategories:function(){return cu},getPermissions:function(){return lu},getRoles:function(){return nu},updateRole:function(){return au}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return ju},ISubscriptionStatus:function(){return xu},PaymentMethodType:function(){return Vu},ProviderType:function(){return Wu},TenantCreatedAction:function(){return Gu},TrialEndAction:function(){return Ku},cancelManagedSubscription:function(){return vu},cancelSubscription:function(){return yu},createStripeCustomer:function(){return Du},createStripePaymentMethodSetupIntentSecret:function(){return _u},createSubscription:function(){return Eu},createTenantConfiguration:function(){return Nu},getManagedSubscription:function(){return pu},getManagedSubscriptions:function(){return Su},getPaymentMethod:function(){return wu},getPaymentMethods:function(){return Lu},getPaymentProviders:function(){return $u},getStripeCustomer:function(){return Cu},getStripePaymentProviderConfiguration:function(){return Ru},getSubscription:function(){return du},getSubscriptionInvoice:function(){return Tu},getSubscriptionInvoicePdf:function(){return Pu},getSubscriptionInvoices:function(){return ku},getSubscriptionPlan:function(){return Au},getSubscriptionPlans:function(){return bu},getSubscriptionSummaries:function(){return Uu},getSubscriptions:function(){return uu},getTenantConfiguration:function(){return Mu},getVendorPublicConfigurations:function(){return Fu},renewManagedSubscription:function(){return hu},renewSubscription:function(){return fu},updateManagedSubscription:function(){return mu},updatePaymentMethodBillingDetails:function(){return Ou},updateSubscription:function(){return gu}});var g={};n.r(g),n.d(g,{getVendorPublicInfo:function(){return Yu}});var p={};n.r(p),n.d(p,{addUserRolesForSubTenants:function(){return ed},addUserToTenantAndSubTenants:function(){return Xu},loadAllUsers:function(){return Qu},removeUserFromTenantAndSubTenants:function(){return Zu},removeUserRolesFromSubTenants:function(){return td},setUserRolesForSubTenants:function(){return nd}});var S={};n.r(S),n.d(S,{loadFeatureFlags:function(){return id}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return sd},createConfiguration:function(){return rd},deleteConfiguration:function(){return ld},getConfigs:function(){return od},updateConfiguration:function(){return ad}});var h={};n.r(h),n.d(h,{impersonate:function(){return cd}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return gr},ContextHolder:function(){return Jo},FronteggApiError:function(){return Qo},FronteggContext:function(){return Yo},ISubscriptionCancellationPolicy:function(){return ju},ISubscriptionStatus:function(){return xu},MFAStrategyEnum:function(){return qu},MachineToMachineAuthStrategy:function(){return pr},PaymentMethodType:function(){return Vu},ProviderType:function(){return Wu},RestrictionType:function(){return Mn},ScimConnectionSource:function(){return Sd},SecondaryAuthStrategy:function(){return Bu},SocialLoginProviders:function(){return fr},TenantType:function(){return Ju},UserManagedByEnum:function(){return Hu},WebAuthnDeviceType:function(){return zu},api:function(){return vd},countConfigurationUsers:function(){return sd},createConfiguration:function(){return rd},default:function(){return hd},deleteConfiguration:function(){return ld},fetch:function(){return e},fronteggAuthApiRoutes:function(){return dd},fronteggLogoutApiRoutes:function(){return ud},fronteggRefreshTokenUrl:function(){return yd},fronteggSilentRefreshTokenUrl:function(){return fd},fronteggTenantsUrl:function(){return pd},fronteggUsersUrl:function(){return gd},getConfigs:function(){return od},loadFeatureFlags:function(){return id},updateConfiguration:function(){return ad}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e){return k="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},k(e)}function T(e){var t=function(e,t){if("object"!==k(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==k(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===k(t)?t:String(t)}function P(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,T(i.key),i)}}function I(e,t,n){return t&&P(e.prototype,t),n&&P(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return LT},DomainRestrictionsTabFields:function(){return RT},GeneralSettingsTabFields:function(){return CT},InviteUserModalFields:function(){return IT},IpRestrictionsTabFields:function(){return DT},Metadata:function(){return hT},PrivacyPageFields:function(){return PT},ProfilePageFields:function(){return TT},SecurityPageTabs:function(){return OT},SessionManagementTabFields:function(){return ET},SsoPageTabs:function(){return _T},SubscriptionsPageFields:function(){return wT},alpha:function(){return sT},fieldAppearance:function(){return UT},tabAppearance:function(){return MT}});var L=function(){function e(){A(this,e)}return I(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function w(){return w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},w.apply(this,arguments)}function O(e,t,n,i,o,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(i,o)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){O(a,i,o,r,l,"next",e)}function l(e){O(a,i,o,r,l,"throw",e)}r(void 0)}))}}L._apps={};var C=n(841),D=n.n(C);function R(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function _(e){return!!e&&!!e[me]}function U(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)===be}(e)||Array.isArray(e)||!!e[he]||!!e.constructor[he]||V(e)||j(e))}function M(e,t,n){void 0===n&&(n=!1),0===N(e)?(n?Object.keys:Ae)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function N(e){var t=e[me];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:V(e)?2:j(e)?3:0}function $(e,t){return 2===N(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function F(e,t,n){var i=N(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function x(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function V(e){return ge&&e instanceof Map}function j(e){return pe&&e instanceof Set}function W(e){return e.o||e.t}function K(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ke(e);delete t[me];for(var n=Ae(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 G(e,t){return void 0===t&&(t=!1),z(e)||_(e)||!U(e)||(N(e)>1&&(e.set=e.add=e.clear=e.delete=B),Object.freeze(e),t&&M(e,(function(e,t){return G(t,!0)}),!0)),e}function B(){R(2)}function z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function q(e){var t=Te[e];return t||R(18,e),t}function H(){return ye}function J(e,t){t&&(q("Patches"),e.u=[],e.s=[],e.v=t)}function Y(e){Q(e),e.p.forEach(Z),e.p=null}function Q(e){e===ye&&(ye=e.l)}function X(e){return ye={p:[],l:ye,h:e,m:!0,_:0}}function Z(e){var t=e[me];0===t.i||1===t.i?t.j():t.O=!0}function ee(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||q("ES5").S(t,e,i),i?(n[me].P&&(Y(t),R(4)),U(e)&&(e=te(t,e),t.l||ie(t,e)),t.u&&q("Patches").M(n[me].t,e,t.u,t.s)):e=te(t,n,[]),Y(t),t.u&&t.v(t.u,t.s),e!==ve?e:void 0}function te(e,t,n){if(z(t))return t;var i=t[me];if(!i)return M(t,(function(o,a){return ne(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ie(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=K(i.k):i.o;M(3===i.i?new Set(o):o,(function(t,a){return ne(e,i,o,t,a,n)})),ie(e,o,!1),n&&e.u&&q("Patches").R(i,n,e.u,e.s)}return i.o}function ne(e,t,n,i,o,a){if(_(o)){var r=te(e,o,a&&t&&3!==t.i&&!$(t.D,i)?a.concat(i):void 0);if(F(n,i,r),!_(r))return;e.m=!1}if(U(o)&&!z(o)){if(!e.h.F&&e._<1)return;te(e,o),t&&t.A.l||ie(e,o)}}function ie(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&G(t,n)}function oe(e,t){var n=e[me];return(n?W(n):e)[t]}function ae(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 re(e){e.P||(e.P=!0,e.l&&re(e.l))}function le(e){e.o||(e.o=K(e.t))}function se(e,t,n){var i=V(t)?q("MapSet").N(t,n):j(t)?q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:H(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Pe;n&&(o=[i],a=Ie);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):q("ES5").J(t,n);return(n?n.A:H()).p.push(i),i}function ce(e){return _(e)||R(22,e),function e(t){if(!U(t))return t;var n,i=t[me],o=N(t);if(i){if(!i.P&&(i.i<4||!q("ES5").K(i)))return i.t;i.I=!0,n=ue(t,o),i.I=!1}else n=ue(t,o);return M(n,(function(t,o){i&&function(e,t){return 2===N(e)?e.get(t):e[t]}(i.t,t)===o||F(n,t,e(o))})),3===o?new Set(n):n}(e)}function ue(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return K(e)}var de,ye,fe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ge="undefined"!=typeof Map,pe="undefined"!=typeof Set,Se="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ve=fe?Symbol.for("immer-nothing"):((de={})["immer-nothing"]=!0,de),he=fe?Symbol.for("immer-draftable"):"__$immer_draftable",me=fe?Symbol.for("immer-state"):"__$immer_state",be=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ae="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ke=Object.getOwnPropertyDescriptors||function(e){var t={};return Ae(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Te={},Pe={get:function(e,t){if(t===me)return e;var n=W(e);if(!$(n,t))return function(e,t,n){var i,o=ae(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||!U(i)?i:i===oe(e.t,t)?(le(e),e.o[t]=se(e.A.h,i,e)):i},has:function(e,t){return t in W(e)},ownKeys:function(e){return Reflect.ownKeys(W(e))},set:function(e,t,n){var i=ae(W(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=oe(W(e),t),a=null==o?void 0:o[me];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(x(n,o)&&(void 0!==n||$(e.t,t)))return!0;le(e),re(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!==oe(e.t,t)||t in e.t?(e.D[t]=!1,le(e),re(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=W(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){R(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){R(12)}},Ie={};M(Pe,(function(e,t){Ie[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ie.deleteProperty=function(e,t){return Ie.set.call(this,e,t,void 0)},Ie.set=function(e,t,n){return Pe.set.call(this,e[0],t,n,e[0])};var Le=function(){function e(e){var t=this;this.g=Se,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),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&R(6),void 0!==i&&"function"!=typeof i&&R(7),U(e)){var l=X(t),s=se(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Y(l):Q(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return J(l,i),ee(e,l)}),(function(e){throw Y(l),e})):(J(l,i),ee(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ve&&(r=void 0),t.F&&G(r,!0),i){var u=[],d=[];q("Patches").M(e,r,u,d),i(u,d)}return r}R(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){U(e)||R(8),_(e)&&(e=ce(e));var t=X(this),n=se(this,e,void 0);return n[me].C=!0,Q(t),n},t.finishDraft=function(e,t){var n=(e&&e[me]).A;return J(n,t),ee(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Se&&R(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=q("Patches").$;return _(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),we=new Le,Oe=we.produce,Ee=(we.produceWithPatches.bind(we),we.setAutoFreeze.bind(we),we.setUseProxies.bind(we),we.applyPatches.bind(we),we.createDraft.bind(we),we.finishDraft.bind(we),Oe);function Ce(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _e(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Ue="function"==typeof Symbol&&Symbol.observable||"@@observable",Me=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ne={INIT:"@@redux/INIT"+Me(),REPLACE:"@@redux/REPLACE"+Me(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Me()}};function $e(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Fe(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Fe)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(_e(3));return a}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(s)throw new Error(_e(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(_e(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!$e(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(s)throw new Error(_e(9));try{s=!0,a=o(a,e)}finally{s=!1}for(var t=r=l,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(_e(10));o=e,y({type:Ne.REPLACE})}function g(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_e(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ue]=function(){return this},e}return y({type:Ne.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ue]=g,i}function xe(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:Ne.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:Ne.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},l=0;l<r.length;l++){var s=r[l],c=n[s],u=e[s],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(_e(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Ve(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function je(){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(_e(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Ve.apply(void 0,a)(n.dispatch),Re(Re({},n),{},{dispatch:i})}}}function We(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 Ke=We();Ke.withExtraArgument=We;var Ge,Be=Ke,ze=(Ge=function(e,t){return Ge=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])},Ge(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}Ge(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),qe=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},He=Object.defineProperty,Je=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ye=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,Xe=function(e,t,n){return t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ze=function(e,t){for(var n in t||(t={}))Ye.call(t,n)&&Xe(e,n,t[n]);if(Je)for(var i=0,o=Je(t);i<o.length;i++)n=o[i],Qe.call(t,n)&&Xe(e,n,t[n]);return e},et="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ve:Ve.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var tt=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 ze(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,qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,qe([void 0],e.concat(this))))},t}(Array);function nt(e){return U(e)?Ee(e,(function(){})):e}function it(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new tt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Be):i.push(Be.withExtraArgument(n.extraArgument))),i}function ot(e){var t,n=function(e){return it(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,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=xe(a)}var g=l;"function"==typeof g&&(g=g(n));var p=je.apply(void 0,g),S=Ve;c&&(S=et(Ze({trace:!1},"object"==typeof c&&c)));var v=[p];return Array.isArray(f)?v=qe([p],f):"function"==typeof f&&(v=f(v)),Fe(t,d,S.apply(void 0,v))}function at(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 Ze(Ze({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 rt(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 lt(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:nt(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?rt(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Ze(Ze({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?rt(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return nt(e())};else{var c=nt(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=qe([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 i;if(_(e))return void 0===(i=n(e,t))?e:i;if(U(e))return Ee(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,l[c]=n,s[e]=i?at(c,i):at(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 st="listenerMiddleware";at(st+"/add"),at(st+"/removeAll"),at(st+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[me];return Pe.get(t,e)},set:function(t){var n=this[me];Pe.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][me];if(!o.P)switch(o.i){case 5:i(o)&&re(o);break;case 4:n(o)&&re(o)}}}function n(e){for(var t=e.t,n=e.k,i=Ae(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==me){var r=t[a];if(void 0===r&&!$(t,a))return!0;var l=n[a],s=l&&l[me];if(s?s.t!==r:!x(l,r))return!0}}var c=!!t[me];return i.length!==Ae(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){Te[e]||(Te[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=ke(n);delete a[me];for(var r=Ae(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)}(i,t),a={i:i?5:4,A:n?n.A:H(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,me,{value:a,writable:!0}),o},S:function(e,n,o){o?_(n)&&n[me].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[me];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)M(a,(function(t){t!==me&&(void 0!==o[t]||$(o,t)?r[t]||e(a[t]):(r[t]=!0,re(n)))})),M(o,(function(e){void 0!==a[e]||$(a,e)||(r[e]=!1,re(n))}));else if(5===l){if(i(n)&&(re(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!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 ct=(e,t)=>n=>w({},n,{[e]:t[e]}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>w({},t,{[e]:w({},t[e],n)})}),dt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return w({},n,{[e]:w({},n[e],{[t]:w({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),yt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return w({},t,{[e]:w({},t[e],{loaders:w({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return w({},t,{[e]:w({},t[e],{errors:w({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),gt=(e=500)=>new Promise((t=>setTimeout(t,e))),pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",St=new Uint8Array(256);for(let e=0;e<pt.length;e++)St[pt.charCodeAt(e)]=e;const vt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=St[e.charCodeAt(i)],a=St[e.charCodeAt(i+1)],r=St[e.charCodeAt(i+2)],l=St[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},ht=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(ht(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+=pt[t[i]>>2],o+=pt[(3&t[i])<<4|t[i+1]>>4],o+=pt[(15&t[i+1])<<2|t[i+2]>>6],o+=pt[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]=ht(e[n]);return t}return e};let mt,bt,At;!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"}(mt||(mt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(bt||(bt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(At||(At={}));const kt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Tt="HOSTED_LOGIN_VERIFIER_KEY",Pt="auth",It="connectivity",Lt="auditLogs",wt="vendor",Ot={flow:bt.Login,step:mt.preLogin,loading:!1,email:"",tenants:[]},Et={setLoginState:ut("loginState"),resetLoginState:ct("loginState",{loginState:Ot})},Ct={requestAuthorize:at("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:at("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:at("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:at("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:at("auth/afterAuthNavigation"),preLogin:at("auth/preLogin",(e=>({payload:e}))),postLogin:at("auth/postLogin",(e=>({payload:e}))),login:at("auth/login",(e=>({payload:e}))),loginWithMfa:at("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:at("auth/recoverMfa",(e=>({payload:e}))),logout:at("auth/logout",(e=>({payload:e}))),silentLogout:at("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:at("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:at("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:at("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:at("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:at("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:at("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:at("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:at("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:at("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:at("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:at("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:at("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:at("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:at("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:at("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:at("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:at("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:at("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:at("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:at("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:at("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Dt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Dt||(Dt={}));const Rt={step:Dt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},_t={setActivateState:ut("activateState"),resetActivateState:ct("activateState",{activateState:Rt}),setActivateStrategyState:dt("activateState","activationStrategy")},Ut={activateAccount:at("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:at("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:at("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:at("auth/resendActivationEmail",(e=>({payload:e})))};let Mt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Mt||(Mt={}));const Nt={step:Mt.validate},$t={setAcceptInvitationState:ut("acceptInvitationState"),resetAcceptInvitationState:ct("acceptInvitationState",{acceptInvitationState:Nt})},Ft={acceptInvitation:at("auth/acceptInvitation",(e=>({payload:e})))};let xt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(xt||(xt={}));const Vt={step:xt.forgotPassword,loading:!1,email:"",passwordConfig:null},jt={setForgotPasswordState:ut("forgotPasswordState"),resetForgotPasswordState:ct("forgotPasswordState",{forgotPasswordState:Vt})},Wt={forgotPassword:at("auth/forgotPassword",(e=>({payload:e}))),resetPassword:at("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:at("auth/loadPasswordConfig",(e=>({payload:e})))};let Kt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Kt||(Kt={}));const Gt={step:Kt.ResetPhoneNumber,loading:!1},Bt={setResetPhoneNumberState:ut("resetPhoneNumberState"),resetResetPhoneNumberState:ct("resetPhoneNumberState",{resetPhoneNumberState:Gt})},zt={resetPhoneNumber:at("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:at("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:at("auth/changePhoneNumber",(e=>({payload:e})))},qt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Ht={setSSOLoader:yt("ssoState"),setSSOError:ft("ssoState"),setSSOState:ut("ssoState"),resetSSOState:ct("ssoState",{ssoState:qt})},Jt={loadSSOConfigurationsV2:at("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:at("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:at("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:at("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:at("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:at("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:at("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:at("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:at("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:at("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:at("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:at("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:at("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:at("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:at("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:at("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:at("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:at("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:at("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:at("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:at("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:at("auth/oidcPostlogin",(e=>({payload:e})))},Yt={loading:!1,error:null},Qt={setProfileState:ut("profileState"),resetProfileState:ct("profileState",{profileState:Yt})},Xt={loadProfile:at("auth/loadProfile"),saveProfile:at("auth/saveProfile",(e=>({payload:e}))),changePassword:at("auth/changePassword",(e=>({payload:e})))};let Zt;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(Zt||(Zt={}));const en={step:Zt.verify,loading:!1,saving:!1},tn={setMfaState:ut("mfaState"),resetMfaState:ct("mfaState",{mfaState:en})},nn={enrollMfa:at("auth/enrollMfa"),getMFADevices:at("auth/getMFADevices"),getMFAStrategies:at("auth/getMFAStrategies"),verifyMfa:at("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:at("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:at("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:at("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:at("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:at("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:at("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:at("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:at("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:at("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:at("auth/disableMfaWebAuthn",(e=>({payload:e})))},on={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}},an={setTeamLoader:yt("teamState"),setTeamError:ft("teamState"),setTeamState:ut("teamState"),resetTeamState:ct("teamState",{teamState:on})},rn={loadUsers:at("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:at("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:at("auth/loadRoles",(e=>({payload:e}))),addUser:at("auth/addUser",(e=>({payload:e}))),addUsersBulk:at("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:at("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:at("auth/updateUser",(e=>({payload:e}))),deleteUser:at("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:at("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:at("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:at("auth/lockUser",(e=>({payload:e}))),resendActivationLink:at("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:at("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:at("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:at("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:at("auth/getInvitationLink"),createInvitationLink:at("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:at("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:at("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:at("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:at("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:at("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:at("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:at("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:at("auth/closeLockUserDialog",(e=>({payload:e})))},ln={firstLoad:!0,loading:!1,error:""},sn={setSocialLoginsState:ut("socialLoginState"),resetSocialLoginsState:ct("socialLoginState",{socialLoginState:ln})},cn={loadSocialLoginsConfiguration:at("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:at("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:at("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:at("auth/setSocialLoginError",(e=>({payload:e})))};let un;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(un||(un={}));const dn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:un.SignUp},yn={setSignUpState:ut("signUpState"),resetSignUpState:ct("signUpState",{signUpState:dn})},fn={signUpUser:at("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:at("auth/resetSignUpStateSoft")},gn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},pn={setApiTokensLoader:yt("apiTokensState"),setApiTokensError:ft("apiTokensState"),setApiTokensState:ut("apiTokensState"),resetApiTokensState:ct("apiTokensState",{apiTokensState:gn})},Sn={loadApiTokens:at("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:at("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:at("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:at("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:at("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:at("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:at("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:at("auth/deleteTenantApiToken",(e=>({payload:e})))},vn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},hn={setSecurityPolicyState:ut("securityPolicyState"),setSecurityPolicyGlobalState:dt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:dt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:dt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:dt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:dt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:dt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:dt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:dt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:dt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:dt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:dt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ct("securityPolicyState",{securityPolicyState:vn})},mn={loadSecurityPolicy:at("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:at("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:at("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:at("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:at("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:at("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:at("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:at("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:at("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:at("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:at("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:at("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:at("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:at("auth/loadPublicAuthStrategiesPolicy")},bn={loading:!1},An={setAccountSettingsState:ut("accountSettingsState"),resetAccountSettingsState:ct("accountSettingsState",{accountSettingsState:bn})},kn={loadAccountSettings:at("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:at("auth/saveAccountSettings",(e=>({payload:e})))},Tn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Pn={setTenantsState:ut("tenantsState"),resetTenantsState:ct("tenantsState",{tenantsState:Tn})},In={switchTenant:at("auth/switchTenant",(e=>({payload:e}))),loadTenants:at("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:at("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:at("auth/loadSubTenantsTree",(e=>({payload:e})))},Ln={loading:!1,roles:[],permissions:[],permissionCategories:[]},wn={setRolesState:ut("rolesState"),resetRolesState:ct("rolesState",{rolesState:Ln})},On={loadRolesAndPermissions:at("auth/loadRoles",(e=>({payload:e}))),addRole:at("auth/addRole",(e=>({payload:e}))),updateRole:at("auth/updateRole",(e=>({payload:e}))),deleteRole:at("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:at("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:at("auth/attachPermissionToRoles",(e=>({payload:e})))},En={loading:!1,sessions:[]},Cn={setSessionsState:ut("sessionsState"),resetSessionsState:ct("sessionsState",{sessionsState:En})},Dn={loadUserSessions:at("auth/loadUserSessions"),loadCurrentUserSession:at("auth/loadCurrentUserSession"),deleteUserSession:at("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:at("auth/deleteAllUserSessions"),revokeUserSessions:at("auth/revokeUserSessions",(e=>({payload:e})))},Rn={loading:!1,configurations:{}},_n={setSessionsPolicyState:ut("sessionsPolicyState"),resetSessionsPolicyState:ct("sessionsPolicyState",{sessionsPolicyState:Rn})},Un={loadSessionsPolicy:at("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:at("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Mn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Mn||(Mn={}));const Nn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Mn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},$n={setRestrictionsState:ut("restrictionsState"),setIpRestrictionsState:dt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:dt("restrictionsState","emailDomainRestrictions")},Fn={checkIfUserIpValid:at("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:at("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:at("auth/loadIpRestrictions"),saveIpRestriction:at("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:at("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:at("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:at("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:at("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:at("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:at("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},xn={loading:!1},Vn={setProvisioningState:ut("provisioningState"),resetProvisioningState:ct("provisioningState",{provisioningState:xn})},jn={loadProvisionConnections:at("auth/loadProvisionConnections"),createProvisionConnection:at("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:at("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:at("auth/updateProvisionConnection",(e=>({payload:e})))},Wn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:dn,loginState:Ot,activateState:Rt,acceptInvitationState:Nt,forgotPasswordState:Vt,ssoState:qt,profileState:Yt,mfaState:en,teamState:on,socialLoginState:ln,apiTokensState:gn,securityPolicyState:vn,accountSettingsState:bn,tenantsState:Tn,rolesState:Ln,resetPhoneNumberState:Gt,sessionsState:En,sessionsPolicyState:Rn,restrictionsState:Nn,provisioningState:xn},Kn=w({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Wn);let Gn;!function(e){e.impersonating="impersonating",e.success="success"}(Gn||(Gn={}));const Bn={step:Gn.impersonating,loading:!1},zn={setImpersonateState:ut("impersonateState"),resetImpersonateState:ct("impersonateState",{impersonateState:Bn})},qn={impersonate:at("impersonation/impersonate",(e=>({payload:e})))},{reducer:Hn,actions:Jn}=lt({name:Pt,initialState:Kn,reducers:w({resetState:e=>w({},e,Wn),setState:(e,{payload:t})=>w({},e,t),setUser:("user",(e,{payload:t})=>w({},e,{user:t}))},Et,sn,_t,zn,$t,jt,Bt,yn,Qt,Ht,tn,an,pn,hn,An,Pn,wn,Cn,_n,$n,Vn)});const Yn=w({},Jn,Ct,cn,Ut,Ft,Wt,zt,fn,Xt,Jt,nn,rn,Sn,mn,kn,In,On,Dn,Un,Fn,jn,qn);var Qn=function(e){return"@@redux-saga/"+e},Xn=Qn("CANCEL_PROMISE"),Zn=Qn("CHANNEL_END"),ei=Qn("IO"),ti=Qn("MATCH"),ni=Qn("MULTICAST"),ii=Qn("SAGA_ACTION"),oi=Qn("SELF_CANCELLATION"),ai=Qn("TASK"),ri=Qn("TASK_CANCEL"),li=Qn("TERMINATE"),si=Qn("LOCATION");function ci(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 ui=function(e){return null==e},di=function(e){return null!=e},yi=function(e){return"function"==typeof e},fi=function(e){return"string"==typeof e},gi=Array.isArray,pi=function(e){return e&&yi(e.then)},Si=function(e){return e&&yi(e.next)&&yi(e.throw)},vi=function e(t){return t&&(fi(t)||bi(t)||yi(t)||gi(t)&&t.every(e))},hi=function(e){return e&&yi(e.take)&&yi(e.close)},mi=function(e){return yi(e)&&e.hasOwnProperty("toString")},bi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Ai=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[Xn]=function(){clearTimeout(n)},i},ki=function(e){return function(){return e}},Ti=ki(!0),Pi=function(){},Ii=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Li=function(e,t){w(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 Oi=function(e){throw e},Ei=function(e){return{value:e,done:!0}};function Ci(e,t,n){void 0===t&&(t=Oi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Ei,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Di(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Ri=function(e){return Array.apply(null,new Array(e))},_i=function(e){return function(t){return e(Object.defineProperty(t,ii,{value:!0}))}},Ui=function(e){return e===li},Mi=function(e){return e===ri},Ni=function(e){return Ui(e)||Mi(e)};function $i(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=gi(e)?Ri(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||Ni(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=Pi,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Fi(e){return{name:e.name||"anonymous",location:xi(e)}}function xi(e){return e[si]}var Vi=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++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},ji="TAKE",Wi="CALL",Ki="FORK",Gi="SELECT",Bi=function(e,t){var n;return(n={})[ei]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function zi(e,t){return void 0===e&&(e="*"),vi(e)?(di(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Bi(ji,{pattern:e})):hi(n=e)&&n[ni]&&di(t)&&vi(t)?Bi(ji,{channel:e,pattern:t}):hi(e)?(di(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Bi(ji,{channel:e})):void 0;var n}function qi(e,t){return ui(t)&&(t=e,e=void 0),Bi("PUT",{channel:e,action:t})}function Hi(e){var t=Bi("ALL",e);return t.combinator=!0,t}function Ji(e,t){var n,i=null;return yi(e)?n=e:(gi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&fi(n)&&yi(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Yi(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 Bi(Wi,Ji(e,n))}function Qi(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 Bi(Ki,Ji(e,n))}function Xi(e){return void 0===e&&(e=oi),Bi("CANCEL",e)}function Zi(e){void 0===e&&(e=Ii);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Bi(Gi,{selector:e,args:n})}var eo=Yi.bind(null,Ai);var to=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},no=[],io=0;function oo(e){try{lo(),e()}finally{so()}}function ao(e){no.push(e),io||(lo(),co())}function ro(e){try{return lo(),e()}finally{co()}}function lo(){io++}function so(){io--}function co(){var e;for(so();!io&&void 0!==(e=no.shift());)oo(e)}var uo=function(e){return function(t){return e.some((function(e){return So(e)(t)}))}},yo=function(e){return function(t){return e(t)}},fo=function(e){return function(t){return t.type===String(e)}},go=function(e){return function(t){return t.type===e}},po=function(){return Ti};function So(e){var t="*"===e?po:fi(e)?fo:gi(e)?uo:mi(e)?fo:yi(e)?yo:bi(e)?go:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var vo={type:Zn},ho=function(e){return e&&e.type===Zn};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(vo)}))},(e={})[ni]=!0,e.put=function(e){if(!t)if(ho(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[ti](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=po),t?e(vo):(e[ti]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),wi(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[ii]?l(e):ao((function(){l(e)}))},r}function bo(e,t){var n=e[Xn];yi(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ao,ko=0,To=function(){return++ko};function Po(e){e.isRunning()&&e.cancel()}var Io=((Ao={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!ho(e)||r?n(e):n(li)};try{o.take(l,di(a)?So(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Ao.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;ao((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&pi(t)?bo(t,n):n(t)}))},Ao.ALL=function(e,t,n,i){var o=i.digestEffect,a=ko,r=Object.keys(t);if(0!==r.length){var l=$i(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(gi(t)?[]:{})},Ao.RACE=function(e,t,n,i){var o=i.digestEffect,a=ko,r=Object.keys(t),l=gi(t)?Ri(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Ni(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=Pi,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},Ao.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(pi(s))return void bo(s,n);if(Si(s))return void Mo(e,s,l.context,ko,Fi(a),!1,n);n(s)}catch(e){n(e,!0)}},Ao.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){ui(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ao.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(Si(o))return o;var a=!1;return Ci((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!pi(o)})}))}catch(e){return Ci((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Fi(t)}(c,a);ro((function(){var t=Mo(e,c,s.context,ko,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Ao.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(gi(t)){if(0===t.length)return void n([]);var r=$i(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ao.CANCEL=function(e,t,n,i){var o=i.task;t===oi?Po(o):gi(t)?t.forEach(Po):Po(t),n()},Ao.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)}},Ao.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Vi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(vo):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(vo):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])(vo)}}}}(t.buffer),a=So(i),r=function t(n){ho(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},Ao.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Ao.FLUSH=function(e,t,n){t.flush(n)},Ao.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Ao.SET_CONTEXT=function(e,t,n,i){var o=i.task;Li(o.context,t),n()},Ao);function Lo(e,t){return e+"?"+t}function wo(e){var t=e.name,n=e.location;return n?t+" "+Lo(n.fileName,n.lineNumber):t}function Oo(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 Eo=null,Co=[],Do=function(e){e.crashedEffect=Eo,Co.push(e)},Ro=function(){Eo=null,Co.length=0},_o=function(){var e,t,n=Co[0],i=Co.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=xi(e))?t.code+" "+Lo(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)})),[Oo(Co)]).join("\n")};function Uo(e,t,n,i,o,a,r){var l;void 0===r&&(r=Pi);var s,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}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(wi(o,t),t.cont=Pi,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=Pi,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,p);function p(t,n){if(n){if(u=2,Do({meta:o,cancelledTasks:y}),S.isRoot){var i=_o();Ro(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===ri?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={})[ai]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=g,l.cancel=function(){0===u&&(u=1,g.cancelAll(),p(ri,!1))},l.cont=r,l.end=p,l.setContext=function(e){Li(f,e)},l.toPromise=function(){return d||(d=to(),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 Mo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){pi(t)?bo(t,i):Si(t)?Mo(e,t,c.context,n,o,!1,i):t&&t[ei]?(0,Io[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Pi;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(ri))},status:0},c=Uo(e,s,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),Ro()):Mi(e)?(s.status=1,d.cancel(),o=yi(t.return)?t.return(ri):{done:!0,value:ri}):o=Ui(e)?yi(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=To();function s(n,o){a||(a=!0,i.cancel=Pi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Eo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=Pi,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=Pi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function No(e,t){for(var n=e.channel,i=void 0===n?mo():n,o=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?Di: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=To();if(s&&(s.rootSagaStarted=s.rootSagaStarted||Pi,s.effectTriggered=s.effectTriggered||Pi,s.effectResolved=s.effectResolved||Pi,s.effectRejected=s.effectRejected||Pi,s.effectCancelled=s.effectCancelled||Pi,s.actionDispatched=s.actionDispatched||Pi,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ve.apply(void 0,c);p=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else p=Ii;var m={channel:i,dispatch:_i(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:p};return ro((function(){var e=Mo(m,S,l,v,Fi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var $o=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,l=n.sagaMonitor,s=ci(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=No.bind(null,w({},s,{context:o,channel:r,dispatch:i,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){Li(o,e)},c},Fo=function(e){return{done:!0,value:e}},xo={};function Vo(e){return hi(e)?"channel":mi(e)?String(e):yi(e)?e.name:String(e)}function jo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===xo)return Fo(t);if(n&&!o)throw r=xo,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===xo?Fo(t):a}return Ci(l,(function(e){return l(null,e)}),n)}function Wo(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:zi(e)},l=function(e){return{done:!1,value:Qi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Vo(e)+", "+t.name+")")}function Ko(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,l={done:!1,value:zi(e)},s=function(e){return{done:!1,value:Qi.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:Xi(e)}},u=function(e){return a=e},d=function(e){return r=e};return jo({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("+Vo(e)+", "+t.name+")")}function Go(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:zi(e)},l=function(e){return{done:!1,value:Yi.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Vo(e)+", "+t.name+")")}function Bo(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 l={done:!1,value:Yi.apply(void 0,[n].concat(a))},s={done:!1,value:eo(t)};return jo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:xo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Qi.apply(void 0,[Wo,e,t].concat(i))}function qo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Qi.apply(void 0,[Ko,e,t].concat(i))}function Ho(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 Qi.apply(void 0,[Go,e,t].concat(i))}class Jo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return Jo.instance||(Jo.instance=new Jo),Jo.instance}static setContext(e){Jo.getInstance().context=e}static setAccessToken(e){Jo.getInstance().accessToken=e}static setUser(e){Jo.getInstance().user=e}static setOnRedirectTo(e){Jo.getInstance().onRedirectTo=e}static setLogout(e,t){Jo.getInstance().logout=n=>{n?e(n):Jo.onRedirectTo(t)}}static getContext(){var e;return null!=(e=Jo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Jo.getInstance().accessToken}static getUser(){return Jo.getInstance().user}static onRedirectTo(e,t){return Jo.getInstance().onRedirectTo(e,t)}static logout(e){return Jo.getInstance().logout(e)}}Jo.instance=void 0;const Yo={getContext:()=>Jo.getContext(),getAccessToken:()=>Jo.getAccessToken(),getUser:()=>Jo.getUser(),onRedirectTo:(e,t)=>Jo.onRedirectTo(e,t),logout:e=>Jo.logout(e)};class Qo extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function Xo(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const Zo=async e=>{var t,n,i;const o=Jo.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Jo.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=Xo(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),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:w({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.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 Qo("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Qo(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},ea=async(e,t,n)=>Zo(w({url:e,method:"GET",contentType:"application/json",params:t},n)),ta=async(e,t,n)=>Zo(w({url:e,method:"POST",contentType:"application/json",body:t},n)),na=async(e,t,n)=>Zo(w({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ia=async(e,t,n)=>Zo(w({url:e,method:"PUT",contentType:"application/json",body:t},n)),oa=async(e,t,n)=>Zo(w({url:e,method:"DELETE",contentType:"application/json",body:t},n)),aa=async(e,t,n,i)=>Zo(w({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ra={v1:"/identity/resources/users/webauthn/v1/devices"},la={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},sa={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ca={v1:"/identity/resources/configurations/v1"},ua={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},da={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ya={v1:"/identity/resources/permissions/v1"},fa={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"}}},ga={v1:"/identity/resources/roles/v1"},pa={v1:"/identity/resources/sub-tenants/users/v1"},Sa={v1:"/identity/resources/impersonation/v1"},va={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},ha={v1:"/team/resources/members/v1"},ma={v1:"/team/resources/roles/v1"},ba={v1:"/team/resources/stats/v1"},Aa={v1:"/team/resources/profile"},ka={v1:"/tenants/resources/account-settings/v1"},Ta={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Pa={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ia={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"}}}},La={v1:"/subscriptions/resources/payment-providers/v1"},wa={v1:"/subscriptions/resources/subscriptions/v1"},Oa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ea={v1:"/reports/engine/resources/triggers/v1"},Ca="/notification",Da="/audits",Ra={v1:"/event/resources/configurations/v1"},_a="/webhook",Ua="/oauth",Ma="/flags",Na="/directory/resources/v1/configurations/scim2",$a="/directory/resources/scim/temp";async function Fa(e){return ia(`${sa.v1}/tenant`,e)}async function xa(){return ea(`${sa.v2}/me/tenants`)}async function Va(){return ea(Ta.v1)}async function ja(){return ea(Ta.tree.v1)}async function Wa(){return ea(ca.v1)}async function Ka(){return ea(`${ca.v1}/mfa-policy`)}async function Ga(){return ea(`${ca.v1}/mfa-policy/vendor`)}async function Ba(e){return e.id?na(`${ca.v1}/mfa-policy`,e):ta(`${ca.v1}/mfa-policy`,e)}async function za(){return ea(`${ca.v1}/lockout-policy`)}async function qa(){return ea(`${ca.v1}/lockout-policy/vendor`)}async function Ha(e){return e.id?na(`${ca.v1}/lockout-policy`,e):ta(`${ca.v1}/lockout-policy`,e)}async function Ja(){try{return await ea(`${ca.v1}/captcha-policy/public`)}catch{return null}}async function Ya(){return ea(`${ca.v1}/password-history-policy`)}async function Qa(){return ea(`${ca.v1}/password-history-policy/vendor`)}async function Xa(e){return e.id?na(`${ca.v1}/password-history-policy`,e):ta(`${ca.v1}/password-history-policy`,e)}async function Za(){return ea(`${ca.v1}/password`)}async function er(){return ea(`${ua.emailDomain.v1}`)}async function tr(){return ea(`${ua.emailDomain.v1}/config`)}async function nr(e){return ta(`${ua.emailDomain.v1}`,e)}async function ir(e){return ta(`${ua.emailDomain.v1}/config`,e)}async function or(e){return oa(`${ua.emailDomain.v1}/${e}`)}async function ar(e){return ea(`${ua.ip.v1}`,e)}async function rr(){return ea(`${ua.ip.v1}/config`)}async function lr(e){return ta(`${ua.ip.v1}`,e)}async function sr(e){return ta(`${ua.ip.v1}/bulk`,e)}async function cr(e){return ta(`${ua.ip.v1}/config`,e)}async function ur(e){return oa(`${ua.ip.v1}/${e}`)}async function dr(){return ta(`${ua.ip.v1}/verify`)}async function yr(){return ta(`${ua.ip.v1}/verify/allow`)}let fr,gr,pr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(fr||(fr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(gr||(gr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(pr||(pr={}));class Sr extends Error{constructor(e){super(e)}}const vr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Sr("'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 hr extends Error{constructor(e){super(e)}}const mr=(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(vr(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 vr(t)}})(e.split(".")[n]))}catch(e){throw new hr("Invalid token specified: "+e.message)}},br=["type"],Ar=["type"];async function kr(e){if(!e.accessToken)return e;Jo.setAccessToken(e.accessToken);const t=await ea(`${sa.v2}/me`),n=w({},e,e.accessToken?mr(e.accessToken):{},t);return Jo.setUser(n),n}async function Tr(e){if(!e.accessToken)return{user:e};Jo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ea(`${sa.v2}/me`),xa()]),i=w({},e,e.accessToken?mr(e.accessToken):{},t);return Jo.setUser(i),{user:i,tenants:n}}async function Pr(e){Jo.setAccessToken(e.id_token);const t=await ea(`${sa.v2}/me`),n=e.id_token?mr(e.id_token):{},i=w({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return Jo.setUser(i),i}async function Ir(e){try{const{address:t}=await ta(`${la.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Lr(e){return ta(`${la.v1}/user/saml/prelogin`,e)}async function wr(e){return kr(await ta(`${la.v1}/user/saml/postlogin`,e))}async function Or(e){return kr(await ta(`${la.v1}/user/oidc/postlogin`,e))}async function Er(e){return kr(await ta(`${la.v1}/user`,e))}async function Cr(e){return kr(await ta(`${la.v1}/user/mfa/verify`,e))}async function Dr(e){return ta(`${sa.v1}/activate`,e)}async function Rr(e){return ea(`${sa.v1}/activate/strategy`,e)}async function _r(e){return ta(`${sa.v1}/activate/reset`,e)}async function Ur(e){return ta(`${sa.v1}/invitation/reset`,e)}async function Mr(e){return ta(`${sa.v1}/invitation/accept`,e)}async function Nr(){return kr(await ta(`${la.v1}/user/token/refresh`))}async function $r(){return Tr(await ta(`${la.v1}/user/token/refresh`))}async function Fr(){return ta(`${la.v1}/logout`)}async function xr(e){return ea(`${Ua}/logout`,e)}async function Vr(e){return ta(`${sa.v1}/passwords/reset`,e)}async function jr(e){return ta(`${sa.v1}/passwords/reset/verify`,e)}async function Wr(e){return ea(`${sa.v1}/passwords/config`,e)}async function Kr(e){return ta(`${la.v1}/user/mfa/recover`,e)}async function Gr(){return ta(`${sa.v1}/mfa/enroll`)}async function Br(){return ta(`${sa.v1}/mfa/authenticator/enroll`)}async function zr(e){return ta(`${sa.v1}/mfa/authenticator/enroll/verify`,e)}async function qr(e){return ta(`${sa.v1}/mfa/sms/enroll`,e)}async function Hr(e){return ta(`${sa.v1}/mfa/sms/enroll/verify`,e)}async function Jr(){return ta(`${sa.v1}/mfa/webauthn/enroll`)}async function Yr(e){return ta(`${sa.v1}/mfa/webauthn/enroll/verify`,e)}async function Qr(e){return ta(`${sa.v1}/mfa/enroll/verify`,e)}async function Xr(e){return ta(`${sa.v1}/mfa/disable`,e)}async function Zr(e,t){return ta(`${sa.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function el(e){return ta(`${sa.v1}/mfa/sms/${e}/disable`)}async function tl(e,t){return ta(`${sa.v1}/mfa/sms/${e}/disable/verify`,t)}async function nl(e){return ta(`${sa.v1}/mfa/webauthn/${e}/disable`)}async function il(e,t){return ta(`${sa.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function ol(){return ea(`${sa.v1}/mfa/devices`)}async function al(e){return ta(`${la.v1}/user/mfa/authenticator/enroll`,e)}async function rl(e){return ta(`${la.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ll(e,t){return ta(`${la.v1}/user/mfa/authenticator/${e}/verify`,t)}async function sl(e){return ta(`${la.v1}/user/mfa/sms/enroll`,e)}async function cl(e){return ta(`${la.v1}/user/mfa/sms/enroll/verify`,e)}async function ul(e,t){return ta(`${la.v1}/user/mfa/sms/${e}`,t)}async function dl(e,t){return ta(`${la.v1}/user/mfa/sms/${e}/verify`,t)}async function yl(e){return ta(`${la.v1}/user/mfa/webauthn/enroll`,e)}async function fl(e){return ta(`${la.v1}/user/mfa/webauthn/enroll/verify`,e)}async function gl(e,t){return ta(`${la.v1}/user/mfa/webauthn/${e}`,t)}async function pl(e,t){return ta(`${la.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Sl(){return ea(`${va.v1}/saml/configurations`)}async function vl(e){return ta(`${va.v1}/saml/configurations`,e)}async function hl(){return ea(`${va.v1}/saml/configurations/vendor-config`)}async function ml(e){return ia(`${va.v1}/saml/configurations/metadata`,e)}async function bl(){return ia(`${va.v1}/saml/validations/domain`)}async function Al(){return ea(`${va.v1}/saml/configurations/roles/default`)}async function kl(){return ea(`${va.v2}/saml/configurations/groups`)}async function Tl({roleIds:e}){return ta(`${va.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Pl({roleIds:e,group:t}){return ta(`${va.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Il({roleIds:e,group:t,id:n}){return na(`${va.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Ll({id:e}){return oa(`${va.v2}/saml/configurations/groups/${e}`)}async function wl(){return ea(`${va.v1}/oidc/configurations`)}async function Ol(){return ea(`${va.v2}/configurations/public`)}async function El(){return ea(da.v1)}async function Cl(){return ea(da.v2)}async function Dl({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),ta(`${la.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function Rl(){return ea(`${ca.v1}/public`)}async function _l(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await ta(`${sa.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await kr(n):void 0,userId:i,tenantId:o}}async function Ul(){return ea(sa.sessions.currentUser.v1)}async function Ml(){return ea(`${sa.sessions.currentUser.v1}/current`)}async function Nl(e){return ta(`${sa.sessions.v1}/revoke`,{userId:e})}async function $l(){return ea(sa.sessions.configurations.v1)}async function Fl(e){await ta(sa.sessions.configurations.v1,e)}async function xl(e){await oa(`${sa.sessions.currentUser.v1}/${e}`)}async function Vl(){await oa(`${sa.sessions.currentUser.v1}/all`)}async function jl(){return ea(sa.accessTokens.v1)}async function Wl(){return ea(fa.accessTokens.v1)}async function Kl({id:e}){return oa(`${fa.accessTokens.v1}/${e}`)}async function Gl({id:e}){return oa(`${sa.accessTokens.v1}/${e}`)}async function Bl(e){return ta(sa.accessTokens.v1,e)}async function zl(e){return ta(fa.accessTokens.v1,e)}async function ql(){return ea(sa.apiTokens.v1)}async function Hl(){return ea(fa.apiTokens.v1)}async function Jl(e){return ta(sa.apiTokens.v1,e)}async function Yl(e){return ta(fa.apiTokens.v2,e)}async function Ql({tokenId:e}){return oa(`${fa.apiTokens.v1}/${e}`)}async function Xl({tokenId:e}){return oa(`${sa.apiTokens.v1}/${e}`)}async function Zl({userId:e}){return ea(`${sa.v1}/${e}`)}async function es(e){return ea(`${ca.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ts(e){let{type:t}=e,n=ci(e,br);return ta(`${la.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function ns(e){let{type:t}=e,n=ci(e,Ar);return ta(`${la.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function is({token:e}){return ta(fa.invites.verify.v1,{token:e})}async function os(){return ea(`${va.v1}/configurations`)}async function as(e){return ta(`${va.v1}/configurations`,e)}async function rs(e,t){return na(`${va.v1}/configurations/${e}`,t)}async function ls(e){return oa(`${va.v1}/configurations/${e}`)}async function ss(e){return ta(`${va.v1}/configurations/metadata`,e)}async function cs(e,t){return ia(`${va.v1}/configurations/${e}/metadata`,t)}async function us(e,t){return ta(`${va.v1}/configurations/${e}/domains`,t)}async function ds(e,t){return oa(`${va.v1}/configurations/${e}/domains/${t}`)}async function ys(e,t){return ia(`${va.v1}/configurations/${e}/domains/${t}/validate`)}async function fs(e){return ea(`${va.v1}/configurations/${e}/roles`)}async function gs(e,t){return ia(`${va.v1}/configurations/${e}/roles`,t)}async function ps(e,t){return ta(`${va.v1}/configurations/${e}/groups`,t)}async function Ss(e,{roleIds:t,group:n,id:i}){return na(`${va.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function vs(e,t){return oa(`${va.v1}/configurations/${e}/groups/${t}`)}async function hs(e){return ea(`${va.v1}/configurations/${e}/groups`)}async function ms(e){return ta(`${la.v2}/user/sso/prelogin`,e)}async function bs(e){return kr(await ta(`${la.v2}/user/oidc/postlogin`,e))}async function As(e){return Pr(await ta(`${Ua}/token`,e))}async function ks(){return Pr(await ta(`${Ua}/authorize/silent`))}async function Ts(e){return ta(`${sa.v1}/phone/reset`,e)}async function Ps(e){return ta(`${sa.v1}/phone/reset/verify`,e)}async function Is(e){return ta(`${sa.v1}/phone`,e)}async function Ls(e){return ta(`${sa.v1}/phone/verify`,e)}async function ws(e){return ia(`${sa.v1}/phone/change`,e)}async function Os(e){return ta(`${la.v1}/webauthn/prelogin`,e)}async function Es(e){return ta(`${la.v1}/webauthn/postlogin`,e)}async function Cs(){return ta(ra.v1)}async function Ds(){return ea(ra.v1)}async function Rs(e){return ta(`${ra.v1}/verify`,e)}async function _s(){return ea(`${ca.v1}/auth/strategies/public`)}async function Us(){return ea(`${ca.v1}/mfa/strategies`)}async function Ms(e){return ea(`${sa.v2}/me`,null!=e?e:{addRoles:!0})}async function Ns(e){return ia(`${sa.v2}/me`,e)}async function $s(e){return ia(`${Aa.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Fs(e){return ta(`${sa.v1}/passwords/change`,e)}async function xs(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>w({},e,{[t.id]:t.value})),{}),s=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 ea(ha.v1,w({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Vs(e){return ta(sa.v2,w({},e,{provider:"local"}))}async function js(e){return oa(`${ha.v1}/${e.userId}`)}async function Ws(e){return ia(ha.v1,e)}async function Ks(e){return ta(fa.invites.user.v1,w({},e))}async function Gs(e){return na(fa.invites.user.v1,w({},e))}async function Bs(){return oa(fa.invites.user.v1)}async function zs(){return ea(fa.invites.user.v1)}async function qs(){return ea(fa.invites.configuration.v1)}async function Hs(){return ea(ma.v1)}async function Js(){return ea(ya.v1)}async function Ys(){return ea(`${ba.v1}/members`)}async function Qs(e){return ta(`${ha.v1}/${e.userId}/resendActivationEmail`,{})}async function Xs(e){return ta(sa.v2,w({},e,{provider:"local"}))}async function Zs(e){return ta(sa.invitation.resendAll.v1,w({},e))}async function ec(e){var t,n;const i=await ea("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function tc(){const e=await ea("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const nc=async()=>ec({entityName:"notifications"}),ic=async()=>ec({entityName:"saml"}),oc=async()=>ec({entityName:"audits"}),ac=async e=>async function(e){const t=await ea(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),rc=["dataFilters"],lc=["templateId","dataFilters"],sc=["dataFilters"];async function cc(e){return ea(`${Oa.v2}/tenant-reports`,e)}async function uc(e){return ea(`${Oa.v2}/${e.id}/tenant-reports`)}async function dc(e){let{dataFilters:t}=e,n=ci(e,rc);return{html:await ea(`${Ea.v1}/preview-report`,w({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function yc(e){let{templateId:t,dataFilters:n}=e,i=ci(e,lc);return ta(`${Oa.v2}/${t}/tenant-reports`,w({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function fc(e){let{dataFilters:t}=e,n=ci(e,sc);const i=await ea(`${Ea.v1}/preview-report`,w({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),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 gc(e){return ta(`${Ea.v1}/tenant-reports`,e)}async function pc(e){return ea(Ca,{params:e})}async function Sc(e){return ia(`${Ca}/status`,{params:e})}async function vc(e){const{notificationId:t,pinStatus:n}=e;return ia(`${Ca}/${n}`,{notificationId:t})}async function hc(){return ta(`${Ca}/status/mark-all-read`)}const mc=["endpoint","headerProps"];async function bc(e){return ea(Da,e)}async function Ac(e){return ea(`${Da}/stats`,e)}async function kc(e){const{endpoint:t,headerProps:n}=e,i=ci(e,mc);return aa(`${Da}/export/${t}`,{properties:n},i)}const Tc=["eventKey"],Pc=["eventKey"],Ic=()=>ea(`${Pa.v1}/slack`),Lc=()=>ea(`${Pa.v1}/slack/applications`),wc=()=>ea(`${Pa.v1}/slack/channels`),Oc=e=>e.id?na(`${Pa.v1}/slack/subscription/${e.id}`,e):ta(`${Pa.v1}/slack/subscriptions`,e),Ec=e=>oa(`${Pa.v1}/slack/subscriptions/${e.id}`),Cc=e=>ta(`${Pa.v1}/slack/applications/registrations`,{code:e}),Dc=()=>ea(`${Pa.v1}/emails`),Rc=e=>{let{eventKey:t}=e,n=ci(e,Tc);return ta(`${Pa.v1}/emails/${t}`,n)},_c=({eventKey:e,enabled:t})=>na(`${Pa.v1}/emails/${e}`,{enabled:t}),Uc=(e,t)=>oa(`${Pa.v1}/emails/${e}/subscriptions/${t}`),Mc=(e,t,n)=>ia(`${Pa.v1}/emails/${t}/subscriptions/${e}`,n),Nc=e=>oa(`${Pa.v1}/emails/${e}`),$c=()=>ea(`${Pa.v2}/sms`),Fc=e=>{let{eventKey:t}=e,n=ci(e,Pc);return ta(`${Pa.v2}/sms/${t}`,n)},xc=({eventKey:e,enabled:t})=>na(`${Pa.v2}/sms/${e}`,{enabled:t}),Vc=(e,t)=>oa(`${Pa.v2}/sms/${e}/subscriptions/${t}`),jc=(e,t,n)=>ia(`${Pa.v2}/sms/${t}/subscriptions/${e}`,n),Wc=e=>oa(`${Pa.v2}/sms/${e}`),Kc=()=>ea(_a),Gc=e=>e._id?na(`${_a}/${e._id}`,e):ta(`${_a}/custom`,e),Bc=e=>oa(`${_a}/${e}`),zc=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ea(`${_a}/logs/?${i.toString()}`)},qc=e=>ta(`${_a}/test`,e),Hc=e=>ta(`${_a}/logs/${e}/retries`),Jc=()=>ea(`${Ra.v1}/categories`),Yc=e=>ea(Ra.v1,{channels:e});async function Qc(e){return ia(ka.v1,e)}async function Xc(){return ea(ka.v1)}const Zc=["roleId"],eu=["roleId"],tu=["permissionId"];async function nu(){return ea(ga.v1)}async function iu(e){return ta(ga.v1,e)}async function ou({roleId:e}){return oa(`${ga.v1}/${e}`)}async function au(e){let{roleId:t}=e,n=ci(e,Zc);return na(`${ga.v1}/${t}`,n)}async function ru(e){let{roleId:t}=e,n=ci(e,eu);return ia(`${ga.v1}/${t}/permissions`,n)}async function lu(){return ea(ya.v1)}async function su(e){let{permissionId:t}=e,n=ci(e,tu);return ia(`${ya.v1}/${t}/roles`,n)}async function cu(){return ea(`${ya.v1}/categories`)}async function uu(){return ea(Ia.subscriptions.v1)}async function du(e){return ea(`${Ia.subscriptions.v1}/${e}`)}async function yu(e){return ia(`${Ia.subscriptions.v1}/${e}/cancellations/`,{})}async function fu(e){return ia(`${Ia.subscriptions.v1}/${e}/renewals/`,{})}async function gu(e,{paymentMethodId:t,planId:n}){return ia(`${Ia.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function pu(e){return ea(`${wa.v1}/${e}`)}async function Su(){return ea(`${wa.v1}`)}async function vu(e){return ia(`${wa.v1}/${e}/cancellations/`,{})}async function hu(e){return ia(`${wa.v1}/${e}/renewals/`,{})}async function mu(e,{paymentMethodId:t,planId:n}){return ia(`${wa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function bu(){return ea(Ia.plans.v1)}async function Au(e){return ea(`${Ia.plans.v1}/${e}`)}async function ku(){return ea(Ia.invoices.v1)}async function Tu(e){return ea(`${Ia.invoices.v1}/${e}`)}async function Pu(e,t){return ea(`${Ia.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Iu=["email"];async function Lu(){return ea(Ia.paymentMethods.v1)}async function wu(e){return ea(`${Ia.paymentMethods.v1}/${e}`)}async function Ou(e,t){let{email:n}=t,i=ci(t,Iu);return na(`${Ia.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Eu(e){return ta(Ia.paymentProviders.stripe.subscriptions.v1,e)}async function Cu(e){return ea(`${Ia.paymentProviders.stripe.customers.v1}/${e}`)}async function Du(e){return ta(`${Ia.paymentProviders.stripe.customers.v1}`,e)}async function Ru(){return ea(`${Ia.paymentProviders.stripe.publicConfigurations.v1}`)}async function _u(e){return ta(`${Ia.paymentProviders.stripe.setupIntents.v1}`,e)}async function Uu(e){return ea(`${Ia.summaries.v1}/${e}`)}async function Mu(e){return ea(`${Ia.tenantConfiguration.v1}/${e}`)}async function Nu(e){return ta(`${Ia.tenantConfiguration.v1}`,e)}async function $u(){return ea(La.v1)}async function Fu(){return ea(`${Ia.configurations.vendorPublicConfigurations.v1}`)}let xu,Vu,ju,Wu,Ku,Gu,Bu,zu,qu,Hu,Ju;async function Yu(){return ea("/vendors/public")}async function Qu(e){return ea(pa.v1,e)}async function Xu(e){return ta(pa.v1,e)}async function Zu(e){return oa(pa.v1,e)}async function ed(e,t){return ta(`${pa.v1}/${e}/roles`,t)}async function td(e,t){return oa(`${pa.v1}/${e}/roles`,t)}async function nd(e,t){return na(`${pa.v1}/${e}/roles`,t)}async function id(){return ea(Ma)}async function od(){return ea(`${Na}`)}async function ad(e,t){return na(`${Na}/${e}`,t)}async function rd(e){return ta(`${Na}`,e)}async function ld(e){return oa(`${Na}/${e}`)}async function sd(e){return ea(`${$a}/${e}/Users/count`)}async function cd(e){return ta(`${Sa.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(xu||(xu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Vu||(Vu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(ju||(ju={})),(Wu||(Wu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(Ku||(Ku={})),function(e){e.CREATE="create_customer"}(Gu||(Gu={})),function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Bu||(Bu={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(zu||(zu={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(qu||(qu={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Hu||(Hu={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Ju||(Ju={}));const ud=[`${la.v1}/logout`,`${Ua}/logout`],dd=[...ud,`${la.v1}/user/saml/postlogin`,`${la.v2}/user/oidc/postlogin`,`${la.v1}/user`,`${la.v1}/user/mfa/verify`,`${la.v1}/user/token/refresh`,`${sa.v1}`,`${sa.v1}/signUp`,`${la.v1}/passwordless/magiclink/postlogin`,`${la.v1}/passwordless/code/postlogin`,`${la.v1}/passwordless/smscode/postlogin`,`${sa.v1}/activate`,`${sa.v1}/invitation/accept`,`${Ua}/token`,`${Ua}/authorize/silent`],yd=`${la.v1}/user/token/refresh`,fd=`${Ua}/authorize/silent`,gd=`${sa.v2}/me`,pd=`${sa.v2}/me/tenants`;let Sd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Sd||(Sd={}));const vd={auth:o,teams:a,metadata:r,reports:l,connectivity:u,notifications:s,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:g,subTenants:p,featureFlags:S,directory:v,impersonate:h};var hd={fetch:e,ContextHolder:Jo,FronteggContext:Yo,api:vd,FronteggApiError:Qo,AuthStrategyEnum:gr,MachineToMachineAuthStrategy:pr,SocialLoginProviders:fr,ISubscriptionCancellationPolicy:ju,ISubscriptionStatus:xu,PaymentMethodType:Vu,ProviderType:Wu};let md,bd;function Ad(e,t){const n=w({},e);return t.forEach((e=>{delete n[e]})),n}async function kd(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Td(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(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"}(md||(md={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(bd||(bd={}));const Pd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),Id={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Ld=w({},Id,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),wd=[{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"}],Od={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},Ed=w({},Od,{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}),Cd={loading:!1,error:void 0,saving:!0,profile:Od},Dd={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"},Rd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:gr.EmailAndPassword,machineToMachineAuthStrategy:pr.ClientCredentials},_d={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Ud={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Md={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Nd={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},$d={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Fd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],xd={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Nd,roles:Fd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Vd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],jd={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:[wd[0]]},Wd={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:[wd[1]]},Kd={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Gd=[Wd,jd],Bd=[Kd],zd=[{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}],qd=[{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"}],Hd={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Jd={isActive:!0,strategy:Mn.ALLOW},Yd=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Mn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Mn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Mn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Mn.BLOCK,description:"IP 4"}];let Qd,Xd,Zd;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Qd||(Qd={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Xd||(Xd={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription"}(Zd||(Zd={})),Zd.profile,Zd.privacy,Zd.personalApiTokens,Zd.account,Zd.users,Zd.security,Zd.sso,Zd.audits,Zd.webhooks,Zd.apiTokens,Zd.roles,Zd.subscriptions;const ey=["events","url"];function*ty(){yield qi(Yn.setSignUpState({loading:!0}));try{const e=yield Yi(vd.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield qi(Yn.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield qi(Yn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*ny(e){let{payload:{events:t,url:n}}=e,i=ci(e.payload,ey);yield qi(Yn.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield Zi((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield Yi(vd.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:Xd.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(Jo.setAccessToken(null==l?void 0:l.accessToken),Jo.setUser(l),!r&&l&&pf(l)){const t=yield hf(l);yield qi(Yn.setState(t)),a(e.loginUrl)}else yield qi(Yn.setSignUpState({loading:!1,shouldActivate:r,stage:un.SignUpSuccess})),yield qi(Yn.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield qi(Yn.loadTenants()))}catch(e){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setSignUpState({loading:!1,error:e.message}))}yield qi(Yn.setSignUpState({loading:!1}))}function*iy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Zi((e=>e.auth.signUpState));yield qi(Yn.resetSignUpState()),yield qi(Yn.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*oy(){yield Ho(Yn.signUpUser,ny),yield Ho(Yn.resetSignUpStateSoft,iy)}const ay={setVendorState:(e,{payload:t})=>w({},e,t)},ry={loadVendorPublicInfo:at("vendor/loadVendorPublicInfo")},ly={loading:!1},{reducer:sy,actions:cy}=lt({name:wt,initialState:ly,reducers:w({},ay)}),uy=w({},cy,ry);function*dy(){yield qi(uy.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield vd.vendor.getVendorPublicInfo();yield qi(uy.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield qi(uy.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const yy=["callback"],fy=["callback"],gy=["callback"],py=["callback"],Sy=["callback"],vy=["callback"];function*hy(){yield qi(Yn.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getGlobalSecurityPolicy);yield qi(Yn.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield qi(Yn.loadSecurityPolicyMfa()),yield qi(Yn.loadSecurityPolicyVendorMfa()),yield qi(Yn.loadSecurityPolicyLockout()),yield qi(Yn.loadSecurityPolicyVendorLockout()),yield qi(Yn.loadSecurityPolicyVendorPasswordHistory()),yield qi(Yn.loadSecurityPolicyCaptcha()),yield qi(Yn.loadPublicAuthStrategiesPolicy())}function*my(){yield qi(Yn.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getVendorConfig);yield qi(Yn.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*by(){yield qi(Yn.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getVendorPublicAuthStrategiesConfig);yield qi(Yn.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*Ay(){yield qi(Yn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getMfaPolicy);yield qi(Yn.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*ky(){yield qi(Yn.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getVendorMfaPolicy);yield qi(Yn.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Ty(e){let{payload:{callback:t}}=e,n=ci(e.payload,yy);yield qi(Yn.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Yi(vd.auth.saveMfaPolicy,n);yield qi(Yn.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Py(){yield qi(Yn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getLockoutPolicy);yield qi(Yn.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Iy(e){let{payload:{callback:t}}=e,n=ci(e.payload,fy);yield qi(Yn.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Yi(vd.auth.saveLockoutPolicy,n);yield qi(Yn.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Ly(){yield qi(Yn.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getVendorLockoutPolicy);yield qi(Yn.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*wy(){yield qi(Yn.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getCaptchaPolicy);yield qi(Yn.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Oy(){yield qi(Yn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getPasswordHistoryPolicy);yield qi(Yn.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Ey(){yield qi(Yn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getVendorPasswordHistoryPolicy);yield qi(Yn.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Cy(e){let{payload:{callback:t}}=e,n=ci(e.payload,gy);yield qi(Yn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Yi(vd.auth.savePasswordHistoryPolicy,n);yield qi(Yn.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Dy(){yield qi(Yn.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getPasswordConfigPolicy);yield qi(Yn.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Ry(){yield Ho(Yn.loadSecurityPolicy,hy),yield zo(Yn.saveSecurityPolicyMfa,Ty),yield zo(Yn.loadSecurityPolicyMfa,Ay),yield zo(Yn.loadSecurityPolicyVendorMfa,ky),yield zo(Yn.saveSecurityPolicyLockout,Iy),yield zo(Yn.loadSecurityPolicyLockout,Py),yield zo(Yn.loadSecurityPolicyVendorLockout,Ly),yield zo(Yn.loadSecurityPolicyCaptcha,wy),yield zo(Yn.saveSecurityPolicyPasswordHistory,Cy),yield zo(Yn.loadSecurityPolicyPasswordHistory,Oy),yield zo(Yn.loadSecurityPolicyVendorPasswordHistory,Ey),yield zo(Yn.loadVendorPasswordConfig,Dy),yield zo(Yn.loadPublicSecurityPolicy,my),yield zo(Yn.loadPublicAuthStrategiesPolicy,by)}function*_y(){yield qi(Yn.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield qi(Yn.setSecurityPolicyPublicState({policy:Rd,loading:!1}))}catch(e){yield qi(Yn.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Uy(){yield qi(Yn.setSecurityPolicyGlobalState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyGlobalState({policy:Dd,loading:!1})),yield qi(Yn.loadSecurityPolicyMfa()),yield qi(Yn.loadSecurityPolicyVendorMfa()),yield qi(Yn.loadSecurityPolicyLockout()),yield qi(Yn.loadSecurityPolicyVendorLockout()),yield qi(Yn.loadSecurityPolicyPasswordHistory()),yield qi(Yn.loadSecurityPolicyVendorPasswordHistory()),yield qi(Yn.loadSecurityPolicyCaptcha())}function*My(){yield qi(Yn.setSecurityPolicyMfaState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyMfaState({policy:_d,loading:!1}))}function*Ny(){yield qi(Yn.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyVendorMfaState({policy:_d,loading:!1}))}function*$y(e){var t;let{payload:{callback:n}}=e,i=ci(e.payload,py);yield qi(Yn.setSecurityPolicyMfaState({saving:!0,error:null}));const o=w({},Ud,{id:null!=(t=i.id)?t:Ud.id,enforceMFAType:i.enforceMFAType});yield gt(),yield qi(Yn.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Fy(){yield qi(Yn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyLockoutState({policy:Ud,loading:!1}))}function*xy(){yield qi(Yn.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyVendorLockoutState({policy:Ud,loading:!1}))}function*Vy(e){let{payload:{callback:t}}=e,n=ci(e.payload,Sy);yield qi(Yn.setSecurityPolicyLockoutState({saving:!0,error:null})),yield gt();const i=w({},Ud,n,{id:n.id?n.id:Ud.id});null==t||t(i),yield qi(Yn.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*jy(){yield qi(Yn.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyLockoutState({policy:Ud,loading:!1}))}function*Wy(){yield qi(Yn.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyPasswordHistoryState({policy:Md,loading:!1}))}function*Ky(){yield qi(Yn.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield gt(),yield qi(Yn.setSecurityPolicyVendorPasswordHistoryState({policy:Md,loading:!1}))}function*Gy(e){let{payload:{callback:t}}=e,n=ci(e.payload,vy);yield qi(Yn.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield gt();const i=w({},Md,n,{id:n.id?n.id:Md.id});null==t||t(i),yield qi(Yn.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*By(){yield Ho(Yn.loadSecurityPolicy,Uy),yield zo(Yn.loadPublicSecurityPolicy,_y),yield zo(Yn.saveSecurityPolicyMfa,$y),yield zo(Yn.loadSecurityPolicyMfa,My),yield zo(Yn.loadSecurityPolicyVendorMfa,Ny),yield zo(Yn.saveSecurityPolicyLockout,Vy),yield zo(Yn.loadSecurityPolicyLockout,Fy),yield zo(Yn.loadSecurityPolicyVendorLockout,xy),yield zo(Yn.loadSecurityPolicyCaptcha,jy),yield zo(Yn.saveSecurityPolicyPasswordHistory,Gy),yield zo(Yn.loadSecurityPolicyPasswordHistory,Wy),yield zo(Yn.loadSecurityPolicyVendorPasswordHistory,Ky)}const zy=["callback"],qy=["callback"],Hy=["callback"],Jy=["callback"],Yy=["callback","events"],Qy=["callback"],Xy=["callback"],Zy=["callback"],ef=["callback"],tf=["callback"],nf=["callback"],of=["callback"],af=["callback"],rf=["callback"],lf=["callback","deviceId"],sf=["callback","deviceId"],cf=["callback","deviceId"],uf=["callback","deviceId"],df={[gr.Code]:mt.loginWithOtc,[gr.EmailAndPassword]:mt.loginWithPassword,[gr.MagicLink]:mt.magicLinkPreLoginSuccess,[gr.SmsCode]:mt.loginWithSmsOtc};function*yf(){var e;const t=Jo.onRedirectTo,{routes:n,includeQueryParam:i}=yield Zi((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(kt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(kt),yield eo(200),qi(Yn.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*ff(){let e;try{var t;const n=yield Yi(vd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield qi(Yn.setState({ssoACS:e}))}function*gf(){try{const{isActive:e}=yield Yi(vd.auth.getSSOPublicConfiguration);yield qi(Yn.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const pf=e=>e.mfaRequired&&e.mfaToken?(Jo.setAccessToken(null),Jo.setUser(null),!0):(Jo.setAccessToken(e.accessToken),Jo.setUser(e),!1),Sf=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 Zt.authenticatorApp;if(t)return Zt.smsVerifyCode}return Zt.verify},vf=e=>{if(1===e.length){const[t]=e;if(t===qu.AuthenticatorApp)return Zt.authenticatorApp;if(t===qu.SMS)return Zt.smsSetPhoneNumber}return Zt.verify};function*hf(e){let t=mt.loginWithTwoFactor,n={};const{loginState:i}=yield Zi((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Yi(vd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Sf(e.mfaDevices)}:(n={step:vf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=mt.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:bt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:w({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*mf(e){var t;const{routes:n,loginState:i}=yield Zi((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*bf(){const{hostedLoginBox:e}=yield Zi((e=>e.auth));e?yield Yi(Af):yield Yi(Tf)}function*Af(){const{user:e}=yield Zi((e=>e.auth));if(null==e||!e.refreshToken)return Jo.setAccessToken(null),Jo.setUser(null),void(yield qi(Yn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Yi(vd.auth.exchangeOAuthTokens,t);yield qi(Yn.setState({user:n,isAuthenticated:!0})),yield qi(Yn.loadTenants())}catch(e){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setState({user:null,isAuthenticated:!1}))}}function*kf(){const{user:e}=yield Zi((e=>e.auth));if(null==e||!e.refreshToken)return Jo.setAccessToken(null),Jo.setUser(null),void(yield qi(Yn.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Yi(vd.auth.exchangeOAuthTokens,t);yield qi(Yn.setState({user:n,isAuthenticated:!0})),yield qi(Yn.loadTenants())}catch(e){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setState({user:null,isAuthenticated:!1}))}}function*Tf(){try{const t=Jo.onRedirectTo,{routes:n,loginState:i}=yield Zi((e=>e.auth)),{user:o,tenants:a}=yield Yi(vd.auth.refreshTokenV2);if(pf(o)){const e=yield hf(o);yield qi(Yn.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 mf(o);yield qi(Yn.setTenantsState({tenants:a,loading:!1})),yield qi(Yn.setState({user:o,isAuthenticated:!0,loginState:w({},i,{quickLoginToRegister:t,flow:n?bt.RegisterQuickLogin:bt.Login})})),yield If(n)}}catch(e){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setState({user:void 0,isAuthenticated:!1}))}}function*Pf(){try{const t=Jo.onRedirectTo,{routes:n,loginState:i}=yield Zi((e=>e.auth)),{user:o,tenants:a}=yield Yi(vd.auth.refreshTokenV2);if(pf(o)){const e=yield hf(o);yield qi(Yn.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 mf(o);yield qi(Yn.setTenantsState({tenants:a,loading:!1})),yield qi(Yn.setState({user:o,isAuthenticated:!0,loginState:w({},i,{quickLoginToRegister:t,flow:n?bt.RegisterQuickLogin:bt.Login})})),yield If(n)}}catch(e){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setState({user:void 0,isAuthenticated:!1}))}}function*If(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Jo.onRedirectTo,{routes:o,loginState:a}=yield Zi((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||l.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):l.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 yf())}function*Lf({payload:{callback:e}}){try{const{ip:t}=yield Yi(vd.metadata.getCurrentUserIpMetadata);yield qi(Yn.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*wf({payload:e}){const t=[];e&&(yield qi(Yn.setState({isLoading:!0})),yield qi(Yn.loadSocialLoginsConfigurationV2()),t.push(Yi(ty)),t.push(Yi(by)),t.push(Yi(gf)),t.push(Yi(dy)),t.push(Yi(ff))),t.push(Yi(bf)),yield Hi(t),yield qi(Yn.setState({isLoading:!1}))}function*Of({accessToken:e,user:t}){if(!e)return void(yield qi(Yn.setState({user:void 0,isAuthenticated:!1})));const n=Jo.onRedirectTo,{routes:i}=yield Zi((e=>e.auth));if(pf(t)){const e=yield hf(t);yield qi(Yn.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*Ef({payload:e}){const t=[];yield qi(Yn.loadSocialLoginsConfigurationV2()),t.push(Yi(ty)),t.push(Yi(gf)),t.push(Yi(dy)),t.push(Yi(ff)),t.push(Yi(Of,e)),yield Hi(t)}function*Cf({payload:e}){const{disableSilentRefresh:t}=yield Zi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield Yi(vd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield qi(Yn.setState({user:e,isAuthenticated:!0})),yield qi(Yn.loadTenants()),yield qi(Yn.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Zi((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 qi(Yn.setState({isLoading:!0}));const a=Td(),r=Td(),l=yield Yi(kd,r);localStorage.setItem(Tt,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${Xo(n,"/oauth/authorize")}/oauth/authorize`,u=w({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);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*Df({payload:e}){const t=localStorage.getItem(Tt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Zi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Yi(vd.auth.exchangeOAuthTokens,a);yield qi(Yn.setState({user:e,isAuthenticated:!0})),yield qi(Yn.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield yf()}}function*Rf(e){let{payload:{callback:t}}=e,n=ci(e.payload,zy);try{yield qi(Yn.setLoginState({loading:!0}));const e=yield Yi(vd.auth.changePhoneNumberWithVerification,n);yield qi(Yn.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:mt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1}))}}function*_f(e){let{payload:{callback:t}}=e,n=ci(e.payload,qy);try{yield qi(Yn.setLoginState({loading:!0})),yield Yi(vd.auth.verifyChangePhoneNumber,n),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1}))}}function*Uf(e){let{payload:{callback:t}}=e,n=ci(e.payload,Hy);try{yield qi(Yn.setLoginState({loading:!0}));const e=yield Yi(vd.auth.passwordlessPreLogin,w({},n,{type:gr.SmsCode}));yield qi(Yn.setLoginState({step:mt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Mf(e){let{payload:{callback:t}}=e,n=ci(e.payload,Jy);try{const{onRedirectTo:e,routes:i}=yield Zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield qi(Yn.setLoginState({loading:!0}));const o=yield Yi(vd.auth.passwordlessPreLogin,n),a=df[n.type];if(a===mt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield qi(Yn.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Kt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield qi(Yn.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Nf(e){let{payload:{callback:t,events:n}}=e,i=ci(e.payload,Yy);try{yield qi(Yn.setLoginState({loading:!0}));const e=yield Yi(vd.auth.passwordlessPostLogin,i),a=Jo.onRedirectTo,{routes:r}=yield Zi((e=>e.auth));if(pf(e)){const t=yield hf(e);yield qi(Yn.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Zi((e=>e.auth)),l=yield Yi(vd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:Qd.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield qi(Yn.setState({user:l,isAuthenticated:!0})),yield qi(Yn.setLoginState({error:void 0})),yield qi(Yn.loadTenants()),i.flow===bt.Login?yield yf():a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield qi(Yn.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*$f({payload:e}){try{yield qi(Yn.setLoginState({loading:!0}));const{name:t}=yield Yi(vd.auth.verifyInviteToken,e);yield qi(Yn.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield qi(Yn.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*Ff({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield qi(Yn.setLoginState({loading:!0}));try{const o=yield Zi((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield Yi(vd.auth.preLoginV2,{email:e});if(a){if(r===bd.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Zi((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield qi(Yn.setLoginState({step:mt.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield xf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield xf({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*xf(e){let{callback:t}=e,n=ci(e,Qy);const i=yield Zi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield qi(Yn.setLoginState({step:mt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===gr.EmailAndPassword?(yield qi(Yn.setLoginState({step:mt.loginWithPassword,loading:!1})),null==t||t()):[gr.MagicLink,gr.Code,gr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield qi(Yn.passwordlessPreLogin(w({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield qi(Yn.setLoginState({step:mt.loginWithPassword,loading:!1})),null==t||t())}function*Vf({payload:{callback:e}}){try{yield qi(Yn.setLoginState({loading:!0}));const{options:t}=yield Yi(vd.auth.webAuthnCreateNewDeviceSession);t.user.id=vt(t.user.id),t.challenge=vt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield qi(Yn.setLoginState({error:t.message})),null==e||e(null)}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*jf(e){let{payload:{callback:t}}=e,n=ci(e.payload,Xy);try{yield qi(Yn.setLoginState({loading:!0}));const e=ht(n.publicKey);yield Yi(vd.auth.verifyNewDeviceSession,{id:e.id,response:e.response}),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({error:e.message})),null==t||t(null)}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*Wf(e){let{payload:{callback:t}}=e,n=ci(e.payload,Zy);try{var i;yield qi(Yn.setLoginState({loading:!0}));const{options:e}=yield Yi(vd.auth.webAuthnPreLogin,n);e.challenge=vt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>w({},e,{id:vt(e.id)}))),yield qi(Yn.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield qi(Yn.setLoginState({error:e.message})),null==t||t(null)}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*Kf(e){let{payload:{callback:t}}=e,n=ci(e.payload,ef);try{var i;yield qi(Yn.setLoginState({loading:!0}));const e=ht(n.publicKey),o=yield Yi(vd.auth.webAuthnPostLogin,w({},e,{response:w({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(pf(o)){const e=Jo.onRedirectTo,{routes:t}=yield Zi((e=>e.auth)),n=yield hf(o);yield qi(Yn.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield Yi(vd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield qi(Yn.loadTenants()),yield qi(Yn.setState({user:e,isAuthenticated:!0})),yield qi(Yn.setLoginState({error:void 0})),yield yf(),null==t||t(!0)}}catch(e){yield qi(Yn.setLoginState({error:e.message})),null==t||t(null)}finally{yield qi(Yn.setLoginState({loading:!1}))}}function*Gf({payload:e}){const{onRedirectTo:t,routes:n}=yield Zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield qi(Yn.setLoginState({loading:!0}));try{const t=yield Yi(vd.auth.postLogin,e);Jo.setAccessToken(t.accessToken),Jo.setUser(t),yield qi(Yn.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield yf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield qi(Yn.setLoginState({step:mt.loginWithSSOFailed,loading:!1}))}}function*Bf({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield qi(Yn.setLoginState({loading:!0}));try{const a=yield Yi(vd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});Jo.setAccessToken(a.accessToken),Jo.setUser(a);const r=Jo.onRedirectTo,{routes:l}=yield Zi((e=>e.auth));if(pf(a)){const e=yield hf(a);yield qi(Yn.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Zi((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield qi(Yn.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===bt.Login?mt.success:t.step,tenants:[],tenantsLoading:!0}})),yield qi(Yn.loadTenants()),n&&t.flow===bt.Login&&(yield yf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Jo.setAccessToken(null),Jo.setUser(null),yield qi(Yn.setLoginState({email:e,error:t.message,loading:!1}))}}function*zf({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield qi(Yn.setLoginState({loading:!0}));try{const o=yield Yi(vd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield Zi((e=>e.auth)),r=a.flow===bt.Login?mt.success:a.step;yield qi(Yn.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 qi(Yn.loadTenants()),yield qi(Yn.setLoginState({error:void 0,loading:!1})),a.flow===bt.Login&&(yield yf()),null==i||i(!0)}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*qf({payload:e}){yield qi(Yn.setLoginState({loading:!0}));try{yield Yi(vd.auth.recoverMfaToken,e),yield qi(Yn.setLoginState({loading:!1,error:void 0,step:mt.preLogin})),yield qi(Yn.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield qi(Yn.setLoginState({error:e.message,loading:!1}))}}function*Hf({payload:e}){const{hostedLoginBox:t}=yield Zi((e=>e.auth));yield qi(Yn.setState({isLoading:!0}));try{t?yield Yi(vd.auth.OAuthLogout):yield Yi(vd.auth.logout)}catch{}yield qi(Yn.resetState()),yield qi(Yn.requestAuthorize(!0)),null==e||e()}function*Jf({payload:e}){var t;try{yield Yi(vd.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*Yf({user:e,tenants:t}){const n={step:Zt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield qi(Yn.setMfaState(n)),yield qi(Yn.setUser(e)),yield qi(Yn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Qf({user:e,tenants:t}){const{loginState:n}=yield Zi((e=>e.auth));yield qi(Yn.setUser(e)),yield qi(Yn.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===bt.Login&&(yield yf()),yield qi(Yn.setState({isAuthenticated:!0}))}function*Xf(e){let{payload:{callback:t}}=e,n=ci(e.payload,tf);yield qi(Yn.setLoginState({loading:!0}));try{const e=yield Yi(vd.auth.preEnrollMFASMSForLogin,n);yield qi(Yn.setMfaState({otcToken:e.otcToken,step:Zt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Zf(e){let{payload:{callback:t}}=e,n=ci(e.payload,nf);yield qi(Yn.setLoginState({loading:!0}));try{const e=yield Yi(vd.auth.enrollMFASMSForLogin,n),i=yield Yi(vd.auth.generateLoginResponseV2,e);yield Yf(i),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*eg(e){let{payload:{callback:t}}=e,n=ci(e.payload,of);yield qi(Yn.setLoginState({loading:!0}));try{var i;const e=yield Yi(vd.auth.preEnrollMFAWebAuthnForLogin,n),o=w({},e.options,{challenge:vt(e.options.challenge),user:w({},e.options.user,{id:vt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>w({},e,{id:vt(e.id)})))});yield qi(Yn.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*tg(e){let{payload:{callback:t}}=e,n=ci(e.payload,af);yield qi(Yn.setLoginState({loading:!0}));try{const e=ht(n.publicKey),i=yield Yi(vd.auth.enrollMFAWebAuthnForLogin,w({},n,{options:e})),o=yield Yi(vd.auth.generateLoginResponseV2,i);yield Yf(o),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*ng(e){let{payload:{callback:t}}=e,n=ci(e.payload,rf);yield qi(Yn.setLoginState({loading:!0}));try{const e=yield Yi(vd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield Yi(vd.auth.generateLoginResponseV2,e);yield Yf(i),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*ig(e){let{payload:{callback:t,deviceId:n}}=e,i=ci(e.payload,lf);yield qi(Yn.setLoginState({loading:!0}));try{const e=yield Yi(vd.auth.preVerifyMFASMSForLogin,n,i);yield qi(Yn.setMfaState({otcToken:e.otcToken,step:Zt.smsVerifyCode,phoneNumber:e.phoneNumber})),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*og(e){let{payload:{callback:t,deviceId:n}}=e,i=ci(e.payload,sf);yield qi(Yn.setLoginState({loading:!0}));try{const e=yield Yi(vd.auth.verifyMFASMSForLogin,n,i),o=yield Yi(vd.auth.generateLoginResponseV2,e);yield Qf(o),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*ag(e){let{payload:{callback:t,deviceId:n}}=e,i=ci(e.payload,cf);yield qi(Yn.setLoginState({loading:!0}));try{var o;const e=yield Yi(vd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=w({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>w({},e,{id:vt(e.id)})))});yield qi(Yn.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*rg(e){let{payload:{callback:t,deviceId:n}}=e,i=ci(e.payload,uf);yield qi(Yn.setLoginState({loading:!0}));try{const e=ht(i.publicKey),o=yield Yi(vd.auth.verifyMFAWebAuthnForLogin,n,w({},i,{options:e})),a=yield Yi(vd.auth.generateLoginResponseV2,o);yield Qf(a),yield qi(Yn.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*lg(){yield Ho(Yn.requestAuthorize,wf),yield Ho(Yn.requestAuthorizeSSR,Ef),yield Ho(Yn.requestHostedLoginAuthorize,Cf),yield Ho(Yn.handleHostedLoginCallback,Df),yield Ho(Yn.preLogin,Ff),yield Ho(Yn.postLogin,Gf),yield Ho(Yn.login,Bf),yield Ho(Yn.logout,Hf),yield Ho(Yn.silentLogout,Jf),yield Ho(Yn.loginWithMfa,zf),yield Ho(Yn.recoverMfa,qf),yield Ho(Yn.quickSmsPasswordlessPreLogin,Uf),yield Ho(Yn.changePhoneNumberWithVerification,Rf),yield Ho(Yn.verifyChangePhoneNumber,_f),yield Ho(Yn.passwordlessPreLogin,Mf),yield Ho(Yn.passwordlessPostLogin,Nf),yield Ho(Yn.verifyInviteToken,$f),yield Ho(Yn.webAuthnPrelogin,Wf),yield Ho(Yn.webAuthnPostLogin,Kf),yield Ho(Yn.webAuthnCreateNewDeviceSession,Vf),yield Ho(Yn.webAuthnVerifyNewDeviceSession,jf),yield Ho(Yn.afterAuthNavigation,yf),yield Ho(Yn.getUserIP,Lf),yield Ho(Yn.preEnrollMFASMSForLogin,Xf),yield Ho(Yn.enrollMFASMSForLogin,Zf),yield Ho(Yn.preEnrollMFAWebAuthnForLogin,eg),yield Ho(Yn.enrollMFAWebAuthnForLogin,tg),yield Ho(Yn.enrollMFAAuthenticatorAppForLogin,ng),yield Ho(Yn.preVerifyMFASMSForLogin,ig),yield Ho(Yn.verifyMFASMSForLogin,og),yield Ho(Yn.preVerifyMFAWebAuthnForLogin,ag),yield Ho(Yn.verifyMFAWebAuthnForLogin,rg)}function*sg({payload:e}){e&&(yield qi(Yn.setState({isLoading:!0})));const t=Ed;yield qi(Yn.loadTenants()),yield qi(Yn.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*cg({payload:{callback:e}}){try{const{ip:t}=Yd[0];yield qi(Yn.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*ug(){yield Ho(Yn.requestAuthorize,sg),yield Ho(Yn.afterAuthNavigation,yf),yield Ho(Yn.getUserIP,cg)}const dg=["callback","samlVendor"],yg=["callback","samlVendor"];function*fg(){try{var e,t;yield qi(Yn.setSSOState({loading:!0}));const n=yield Yi(vd.auth.getSamlConfiguration),i=yield Yi(vd.auth.getOidcConfiguration),o=yield Yi(vd.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 qi(Yn.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield qi(Yn.setSSOState({error:e.message,loading:!1}))}}function*gg({payload:e}){const t=yield Zi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield qi(Yn.setSSOState({error:void 0,[n]:!0}));try{const i=yield Pd(e[0]),o=yield Yi(vd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield qi(Yn.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield qi(Yn.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*pg({payload:e}){const{configFile:t,callback:n}=e,i=yield Zi((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield qi(Yn.setSSOState({error:void 0,[o]:!0}));try{const e=yield Pd(t),a=yield Yi(vd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield qi(Yn.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield qi(Yn.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Sg({payload:e}){const{callback:t,samlVendor:n}=e,i=ci(e,dg),o=yield Zi((e=>e.auth.ssoState.samlConfiguration)),a=w({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield qi(Yn.setSSOState({samlConfiguration:w({},o,a)})));if(yield qi(Yn.setSSOState({error:void 0,[r]:!0})),e.type===bd.Saml){var l,s;const e=yield Yi(vd.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 i=Ad(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 Yi(vd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield qi(Yn.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*vg({payload:{callback:e}={}}){const t=yield Zi((e=>e.auth.ssoState.samlConfiguration));try{yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield Yi(vd.auth.validateSamlDomain),yield qi(Yn.setSSOState({samlConfiguration:w({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield qi(Yn.setSSOState({samlConfiguration:w({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*hg(){try{const e=yield Yi(vd.auth.getSamlRoles),t=yield Yi(vd.auth.getSamlRolesGroups);yield qi(Yn.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield qi(Yn.setSSOState({error:e.message}))}}function*mg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield Yi(vd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Hi(e.map((e=>Yi(vd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield qi(Yn.setSSOState({error:e.message}))}}(n)),yield hg(),yield qi(Yn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield qi(Yn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*bg({payload:{callback:e,id:t}}){try{yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield Yi(vd.auth.deleteSamlGroup,{id:t}),yield hg(),yield qi(Yn.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield qi(Yn.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Ag({payload:{group:e,roleIds:t,callback:n}}){try{yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield Yi(vd.auth.createSamlGroup,{group:e,roleIds:t}),yield hg(),yield qi(Yn.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield qi(Yn.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*kg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield qi(Yn.setSSOState({loading:!0})),yield Yi(vd.auth.oidcPostLoginV2,t),yield Yi(bf),yield qi(Yn.setSSOState({loading:!1}))}catch(e){var n;yield qi(Yn.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*Tg(){yield zo(Yn.loadSSOConfigurations,fg),yield zo(Yn.saveSSOConfigurations,Sg),yield zo(Yn.saveSSOConfigurationsFile,gg),yield zo(Yn.saveSSOConfigurationsFileWithCallback,pg),yield zo(Yn.validateSSODomain,vg),yield zo(Yn.loadSSOAuthorizationRoles,hg),yield zo(Yn.updateSSOAuthorizationRoles,mg),yield zo(Yn.deleteSamlGroup,bg),yield zo(Yn.createSamlGroup,Ag),yield zo(Yn.oidcPostlogin,kg)}function*Pg(){yield qi(Yn.setSSOState({loading:!0})),yield gt(),yield qi(Yn.setSSOState({samlConfiguration:Nd,loading:!1,firstLoad:!1}))}function*Ig({payload:e}){const t="saving";yield qi(Yn.setSSOState({error:void 0,[t]:!0}));const n=w({},yield Zi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield qi(Yn.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Lg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=ci(e,yg),r=xd.samlConfiguration,l=w({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield qi(Yn.setSSOState({samlConfiguration:w({},r,l)})));yield qi(Yn.setSSOState({error:void 0,[s]:!0})),yield gt(),l.acsUrl=null==$d||null==(t=$d.configuration)?void 0:t.acsUrl,l.spEntityId=null==$d||null==(n=$d.configuration)?void 0:n.spEntityId;const c=Ad(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==o?void 0:o.toLowerCase(),yield gt(),yield qi(Yn.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*wg({payload:{callback:e}={}}){const t=xd.samlConfiguration;yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield gt(),yield qi(Yn.setSSOState({samlConfiguration:w({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Og(){yield gt(),yield qi(Yn.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Eg({payload:{callback:e,authorizationRoles:t}}){yield qi(Yn.setSSOState({error:void 0,saving:!0})),yield gt(),yield qi(Yn.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Cg(){yield zo(Yn.loadSSOConfigurations,Pg),yield zo(Yn.saveSSOConfigurations,Lg),yield zo(Yn.saveSSOConfigurationsFile,Ig),yield zo(Yn.validateSSODomain,wg),yield zo(Yn.loadSSOAuthorizationRoles,Og),yield zo(Yn.updateSSOAuthorizationRoles,Eg)}const Dg=["callback"],Rg=["callback","ssoConfigId"],_g=["callback","ssoConfigId"];function*Ug(){try{return yield Yi(vd.auth.getOidcConfiguration)}catch(e){return null}}function*Mg(){try{return yield Yi(vd.metadata.getSamlMetadata)}catch(e){return null}}function*Ng(){try{yield qi(Yn.setSSOLoader({key:md.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Hi([Yi(Ug),Yi(Mg)]),n=yield Yi(vd.auth.getSSOConfigurations);yield qi(Yn.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield qi(Yn.setSSOError({key:md.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield qi(Yn.setSSOLoader({key:md.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*$g({payload:e}){yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ci(e,Dg),i=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Yi(vd.auth.createSSOConfiguration,w({},n,{enabled:null!=(o=n.enabled)&&o}));yield qi(Yn.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield qi(Yn.setSSOError({key:md.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Fg({payload:e}){yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Pd(t),o=yield Yi(vd.auth.createSSOConfigurationByMetadata,{metadata:e});yield qi(Yn.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield qi(Yn.setSSOError({key:md.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*xg({payload:e}){yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=ci(e,Rg),o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Yi(vd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield qi(Yn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield qi(Yn.setSSOError({key:md.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Vg({payload:e}){yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Pd(i),a=yield Yi(vd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield qi(Yn.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield qi(Yn.setSSOError({key:md.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*jg({payload:e}){yield qi(Yn.setSSOLoader({key:md.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Yi(vd.auth.deleteSSOConfiguration,t),yield qi(Yn.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield qi(Yn.setSSOError({key:md.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Wg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=ci(e,_g);yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_DOMAIN,value:!0}));const o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Yi(vd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?w({},t,{domains:[...t.domains,e]}):t));yield qi(Yn.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield qi(Yn.setSSOError({key:md.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_DOMAIN,value:!1}))}}function*Kg({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield qi(Yn.setSSOLoader({key:md.DELETE_SSO_DOMAIN,value:!0}));const o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Yi(vd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?w({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield qi(Yn.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield qi(Yn.setSSOError({key:md.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.DELETE_SSO_DOMAIN,value:!1}))}}function*Gg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield qi(Yn.setSSOLoader({key:md.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Yi(vd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?w({},e,{domains:e.domains.map((e=>e.id===n?w({},e,{validated:!0}):e))}):e));yield qi(Yn.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield qi(Yn.setSSOError({key:md.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Bg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Yi(vd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?w({},e,{roleIds:n}):e));yield qi(Yn.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield qi(Yn.setSSOError({key:md.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield qi(Yn.setSSOLoader({key:md.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*zg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_GROUPS,value:!0}));const o=yield Zi((e=>e.auth.ssoState.ssoConfigurations));try{yield Hi(t.map((e=>Yi(vd.auth.deleteSSOGroup,n,e)))),yield Hi(e.map((e=>Yi(vd.auth.createSSOGroup,n,e))));const a=yield Yi(vd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?w({},e,{groups:a}):e));yield qi(Yn.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield qi(Yn.setSSOError({key:md.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_GROUPS,value:!1}))}}function*qg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Hi(t.map((t=>Yi(vd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield qi(Yn.setSSOError({key:md.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield qi(Yn.setSSOLoader({key:md.SAVE_SSO_GROUPS,value:!1}))}}function*Hg(){yield zo(Yn.loadSSOConfigurationsV2,Ng),yield zo(Yn.saveSSOConfigurationV2,$g),yield zo(Yn.saveSSODomain,Wg),yield zo(Yn.deleteSSODomain,Kg),yield zo(Yn.validateSSODomainV2,Gg),yield zo(Yn.updateSSOConfiguration,xg),yield zo(Yn.deleteSSOConfiguration,jg),yield zo(Yn.setSSOGroups,zg),yield zo(Yn.updateSSOGroups,qg),yield zo(Yn.setSSODefaultRoles,Bg),yield zo(Yn.saveSSOConfigurationByMetadata,Fg),yield zo(Yn.updateSSOConfigurationByMetadata,Vg)}const Jg=["callback","profilePictureUrl"],Yg=["callback","profilePictureUrl"];function*Qg(){yield qi(Yn.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 Yi.apply(void 0,[Bo,e,t,n].concat(o))}(3,2e3,vd.teams.getProfile),t=yield Zi((e=>e.auth.user));Yn.setUser(w({},t,e)),yield qi(Yn.setProfileState({profile:e,loading:!1}))}catch(e){yield qi(Yn.setProfileState({loading:!1,error:e.message}))}}function*Xg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ci(e.payload,Jg);yield qi(Yn.setProfileState({saving:!0,error:null}));try{const e=yield Zi((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 Yi(vd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=w({},e,i,{profilePictureUrl:o}),r=yield Yi(vd.teams.updateProfile,a),l=yield Zi((e=>e.auth.user));yield qi(Yn.setUser(w({},l,r))),yield qi(Yn.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield qi(Yn.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Zg({payload:e}){yield qi(Yn.setProfileState({loading:!0}));try{var t;yield Yi(vd.teams.changePassword,e),yield qi(Yn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield qi(Yn.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*ep(){yield Ho(Yn.loadProfile,Qg),yield zo(Yn.saveProfile,Xg),yield zo(Yn.changePassword,Zg)}function*tp(){yield qi(Yn.setProfileState({loading:!0})),yield gt(),yield qi(Yn.setUser(w({},Ed,Od))),yield qi(Yn.setProfileState({loading:!1,profile:Od}))}function*np(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=ci(e.payload,Yg);yield qi(Yn.setProfileState({saving:!0,error:null}));const o=Cd;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=w({},o.profile,i,{profilePictureUrl:a}),l=Ed;yield gt(),yield qi(Yn.setUser(w({},l,r))),yield qi(Yn.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*ip({payload:e}){var t;yield qi(Yn.setProfileState({loading:!0})),yield gt(),yield qi(Yn.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*op(){yield Ho(Yn.loadProfile,tp),yield zo(Yn.saveProfile,np),yield zo(Yn.changePassword,ip)}const ap=["callback"],rp=["callback"],lp=["callback"],sp=["deviceId","callback"],cp=["deviceId","callback"],up=["callback"],dp=["deviceId"],yp=["deviceId"],fp=["callback"],gp=["deviceId"],pp=["callback"];function*Sp(e){const{step:t}=yield Zi((e=>e.auth.mfaState));return{step:e.recoveryCode?Zt.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*vp(){yield qi(Yn.setMfaState({saving:!0}));try{const{qrCode:e}=yield Yi(vd.auth.enrollMfa);yield qi(Yn.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message}))}}function*hp(e){let{payload:{callback:t}}=e,n=ci(e.payload,ap);yield qi(Yn.setMfaState({saving:!0}));try{const e=yield Zi((e=>e.auth.user)),i=yield Yi(vd.auth.verifyMfa,n),o=yield Yi(vd.auth.getMFADevices),a=yield Sp(i);yield qi(Yn.setMfaState(w({},a,{mfaDevices:o}))),yield qi(Yn.setUser(w({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*mp(e){let{payload:{callback:t}}=e,n=ci(e.payload,rp);yield qi(Yn.setMfaState({loading:!0}));try{const e=yield Yi(vd.auth.loginWithMfa,n),i={step:Zt.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield qi(Yn.setMfaState(i)),yield qi(Yn.setState({user:e})),yield qi(Yn.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield qi(Yn.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*bp({payload:e}){yield qi(Yn.setMfaState({saving:!0}));try{var t;yield Yi(vd.auth.disableMfa,e);const n=yield Yi(vd.auth.getMFADevices);yield qi(Yn.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield qi(Yn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ap({payload:e}){yield qi(Yn.setMfaState({saving:!0}));try{var t,n;const i=yield Yi(vd.auth.preEnrollMFAWebAuthn),o=w({},i.options,{challenge:vt(i.options.challenge),user:w({},i.options.user,{id:vt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>w({},e,{id:vt(e.id)})))});yield qi(Yn.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield qi(Yn.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*kp(e){let{payload:{callback:t}}=e,n=ci(e.payload,lp);yield qi(Yn.setMfaState({saving:!0}));try{const e=ht(n.publicKey),i=yield Yi(vd.auth.enrollMFAWebAuthn,w({},n,{options:e})),o=yield Yi(vd.auth.getMFADevices),a=yield Sp(i);yield qi(Yn.setMfaState(w({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Tp(e){let{payload:{deviceId:t,callback:n}}=e;ci(e.payload,sp),yield qi(Yn.setMfaState({saving:!0}));try{var i;const e=yield Yi(vd.auth.preDisableMFAWebAuthn,t),o=w({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>w({},e,{id:vt(e.id)})))});yield qi(Yn.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Pp(e){let{payload:{deviceId:t,callback:n}}=e,i=ci(e.payload,cp);yield qi(Yn.setMfaState({saving:!0}));try{const e=ht(i.publicKey);yield Yi(vd.auth.disableMFAWebAuthn,t,w({},i,{options:e}));const o=yield Yi(vd.auth.getMFADevices);yield qi(Yn.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*Ip({payload:e}){yield qi(Yn.setMfaState({saving:!0}));try{var t;const n=yield Yi(vd.auth.preEnrollMFASMS,e);yield qi(Yn.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 qi(Yn.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lp(e){let{payload:{callback:t}}=e,n=ci(e.payload,up);yield qi(Yn.setMfaState({saving:!0}));try{const e=yield Yi(vd.auth.enrollMFASMS,n),i=yield Yi(vd.auth.getMFADevices),o=yield Sp(e);yield qi(Yn.setMfaState(w({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*wp(e){let{payload:{deviceId:t}}=e,n=ci(e.payload,dp);yield qi(Yn.setMfaState({saving:!0}));try{var i;const e=yield Yi(vd.auth.preDisableMFASMS,t);yield qi(Yn.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 qi(Yn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Op(e){let{payload:{deviceId:t}}=e,n=ci(e.payload,yp);yield qi(Yn.setMfaState({saving:!0}));try{var i;yield Yi(vd.auth.disableMFASMS,t,n);const e=yield Yi(vd.auth.getMFADevices);yield qi(Yn.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Ep(){yield qi(Yn.setMfaState({loading:!0}));try{yield Zi((e=>e.auth.user));const e=yield Yi(vd.auth.getMFADevices);yield qi(Yn.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield qi(Yn.setMfaState({loading:!1,error:e.message}))}}function*Cp(){yield qi(Yn.setMfaState({loading:!0}));try{const e=(yield Yi(vd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield qi(Yn.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield qi(Yn.setMfaState({loading:!1,error:e.message}))}}function*Dp(){yield zo(Yn.enrollMfa,vp),yield zo(Yn.getMFADevices,Ep),yield zo(Yn.getMFAStrategies,Cp),yield zo(Yn.verifyMfa,hp),yield zo(Yn.disableMfa,bp),yield zo(Yn.verifyMfaAfterForce,mp),yield zo(Yn.preDisableMfaSms,wp),yield zo(Yn.disableMfaSms,Op),yield zo(Yn.preEnrollMfaSms,Ip),yield zo(Yn.enrollMfaSms,Lp),yield zo(Yn.preEnrollMfaWebAuthn,Ap),yield zo(Yn.enrollMfaWebAuthn,kp),yield zo(Yn.preDisableMfaWebAuthn,Tp),yield zo(Yn.disableMfaWebAuthn,Pp)}function*Rp(){yield qi(Yn.setMfaState({saving:!0})),yield qi(Yn.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*_p({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield Zi((e=>e.auth.mfaState));yield qi(Yn.setMfaState({saving:!0})),yield gt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:Zt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:w({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield qi(Yn.setMfaState(i)),yield qi(Yn.setUser(w({},Ed,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Up(e){let{payload:{callback:t}}=e,n=ci(e.payload,fp);yield qi(Yn.setMfaState({loading:!0})),yield gt();const i=w({},n,{recoveryCode:"recoveryCode"}),o={step:Zt.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield qi(Yn.setMfaState(o)),yield gt(),yield qi(Yn.setUser(w({},Ed,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Mp({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Zi((e=>e.auth.mfaState));yield qi(Yn.setMfaState({saving:!0})),yield gt(),yield qi(Yn.setMfaState({saving:!1,error:void 0,mfaDevices:w({},n,{authenticators:[]})})),yield qi(Yn.setUser(w({},Ed))),null==(t=e.callback)||t.call(e,!0)}function*Np(e){let{}=e,t=ci(e.payload,gp);yield qi(Yn.setMfaState({saving:!0}));try{var n;yield qi(Yn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield qi(Yn.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*$p({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Zi((e=>e.auth.mfaState));yield qi(Yn.setMfaState({saving:!0})),yield gt(),yield qi(Yn.setMfaState({loading:!1,error:void 0,mfaDevices:w({},n,{phones:[]})})),yield qi(Yn.setUser(w({},Ed))),null==(t=e.callback)||t.call(e,!0)}function*Fp({payload:e}){var t;yield qi(Yn.setMfaState({saving:!0})),yield gt(),yield qi(Yn.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*xp(e){let{payload:{callback:t}}=e;ci(e.payload,pp);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield Zi((e=>e.auth.mfaState));yield qi(Yn.setMfaState({saving:!0})),yield gt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:Zt.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:w({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield qi(Yn.setMfaState(o)),yield qi(Yn.setUser(w({},Ed,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Vp(){yield zo(Yn.enrollMfa,Rp),yield zo(Yn.verifyMfa,_p),yield zo(Yn.disableMfa,Mp),yield zo(Yn.verifyMfaAfterForce,Up),yield zo(Yn.preDisableMfaSms,Np),yield zo(Yn.disableMfaSms,$p),yield zo(Yn.preEnrollMfaSms,Fp),yield zo(Yn.enrollMfaSms,xp)}const jp=["callback"];function*Wp({payload:e}){yield qi(Yn.setForgotPasswordState({loading:!0}));try{yield Yi(vd.auth.forgotPassword,e),yield qi(Yn.setForgotPasswordState({loading:!1,error:void 0,step:xt.success}))}catch(e){yield qi(Yn.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*Kp(e){let{payload:{callback:t}}=e,n=ci(e.payload,jp);yield qi(Yn.setForgotPasswordState({loading:!0}));try{yield Yi(vd.auth.resetPassword,n),yield qi(Yn.setForgotPasswordState({loading:!1,error:void 0,step:xt.success})),null==t||t(!0)}catch(e){yield qi(Yn.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*Gp({payload:e}){yield qi(Yn.setForgotPasswordState({loading:!0}));try{const t=yield Yi(vd.auth.loadPasswordConfig,e);yield qi(Yn.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield qi(Yn.setForgotPasswordState({loading:!1,error:e.message}))}}function*Bp(){yield Ho(Yn.forgotPassword,Wp),yield Ho(Yn.resetPassword,Kp),yield Ho(Yn.loadPasswordConfig,Gp)}let zp;!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"}(zp||(zp={}));const qp=["callback","events"],Hp=["callback"],Jp=["callback"];function*Yp({payload:{userId:e,token:t}}){yield qi(Yn.setActivateState({loading:!0,step:Dt.activating}));try{const{isAuthenticated:n}=yield Zi((e=>e.auth));n&&(yield qi(Yn.silentLogout()));const i=yield Yi(vd.auth.getActivateAccountStrategy,{userId:e,token:t});yield qi(Yn.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield qi(Yn.setActivateState({loading:!1,step:Dt.activatingForm})))}catch(e){yield qi(Yn.setActivateState({loading:!1,error:e.message}))}}function*Qp(e){let{payload:{callback:t,events:n}}=e,i=ci(e.payload,qp);yield qi(Yn.setActivateState({loading:!0}));try{const e=Jo.onRedirectTo,{routes:a}=yield Zi((e=>e.auth)),r=yield Yi(vd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(pf(r)){yield qi(Yn.setActivateState({step:Dt.success}));const t=yield hf(r);yield qi(Yn.setState(t)),yield eo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield qi(Yn.setActivateState({step:Dt.success}));const{user:e,tenants:t}=yield Yi(vd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:Qd.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield qi(Yn.setTenantsState({tenants:t,loading:!1})),yield qi(Yn.setState({user:e,isAuthenticated:!0})),yield eo(1e3),yield yf(),yield qi(Yn.resetActivateState())}null==t||t(!0)}catch(e){yield qi(Yn.setActivateState({loading:!1,error:e.message}))}}function*Xp({payload:e}){const{callback:t}=e,n=ci(e,Hp);yield qi(Yn.setActivateStrategyState({loading:!0}));try{const e=yield Yi(vd.auth.getActivateAccountStrategy,n);yield qi(Yn.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield qi(Yn.setActivateStrategyState({loading:!1,error:e.message}))}}function*Zp({payload:e}){const{callback:t}=e,n=ci(e,Jp);yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:n.email})),yield qi(Yn.setActivateState({loading:!0}));try{yield Yi(vd.auth.resendActivationEmail,n),yield qi(Yn.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield qi(Yn.setActivateState({loading:!1,error:e.message})),yield qi(Yn.setTeamError({key:zp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:!1}))}function*eS(){yield Ho(Yn.activateAccount,Qp),yield Ho(Yn.preActivateAccount,Yp),yield Ho(Yn.getActivateAccountStrategy,Xp),yield Ho(Yn.resendActivationEmail,Zp)}function*tS({payload:e}){if(e.token&&e.userId)try{yield qi(Yn.setAcceptInvitationState({error:void 0,step:Mt.pending})),yield Yi(vd.auth.acceptInvitation,e),yield qi(Yn.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Mt.success}}))}catch(e){yield qi(Yn.setAcceptInvitationState({step:Mt.failed,error:e.message}))}else yield qi(Yn.setAcceptInvitationState({error:void 0,step:Mt.invalid}))}function*nS(){yield Ho(Yn.acceptInvitation,tS)}var iS,oS=new Uint8Array(16);function aS(){if(!iS&&!(iS="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 iS(oS)}for(var rS=/^(?:[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,lS=function(e){return"string"==typeof e&&rS.test(e)},sS=[],cS=0;cS<256;++cS)sS.push((cS+256).toString(16).substr(1));var uS=function(e,t,n){var i=(e=e||{}).random||(e.rng||aS)();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=(sS[e[t+0]]+sS[e[t+1]]+sS[e[t+2]]+sS[e[t+3]]+"-"+sS[e[t+4]]+sS[e[t+5]]+"-"+sS[e[t+6]]+sS[e[t+7]]+"-"+sS[e[t+8]]+sS[e[t+9]]+"-"+sS[e[t+10]]+sS[e[t+11]]+sS[e[t+12]]+sS[e[t+13]]+sS[e[t+14]]+sS[e[t+15]]).toLowerCase();if(!lS(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const dS=["callback"],yS=["roles"],fS=["callback"],gS=["callback","profileImage"],pS=["callback"],SS=["callback","userId"],vS=["callback"],hS=["callback"],mS=["callback"],bS=["callback"],AS=["callback"],kS=["callback"],TS=["callback"],PS=["callback","profileImage"],IS=["callback"],LS=["callback"],wS=["callback"],OS=["callback"],ES=["callback"],CS=["callback"],DS=()=>Zi((e=>e.auth.teamState));function*RS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield DS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield qi(Yn.setTeamLoader({key:zp.USERS,value:!a})),yield qi(Yn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Hi([Yi(vd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),Yi(vd.teams.loadAvailableRoles),Yi(vd.teams.loadAvailablePermissions)]);yield qi(Yn.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield qi(Yn.setTeamError({key:zp.USERS,value:e.message})),yield qi(Yn.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield qi(Yn.setTeamLoader({key:zp.USERS,value:!1}))}function*_S({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield DS(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield qi(Yn.setTeamLoader({key:zp.USERS,value:!r})),yield qi(Yn.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Hi([Yi(vd.subTenants.loadAllUsers,w({},c)),Yi(vd.teams.loadAvailableRoles),Yi(vd.teams.loadAvailablePermissions)]);yield qi(Yn.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield qi(Yn.setTeamError({key:zp.USERS,value:e.message})),yield qi(Yn.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield qi(Yn.setTeamLoader({key:zp.USERS,value:!1}))}function*US({payload:e}){yield qi(Yn.setTeamLoader({key:zp.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Hi([Yi(vd.teams.loadAvailableRoles),Yi(vd.teams.loadAvailablePermissions)]);yield qi(Yn.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 qi(Yn.setTeamError({key:zp.ROLES_AND_PERMISSIONS,value:t.message}))}yield qi(Yn.setTeamLoader({key:zp.ROLES_AND_PERMISSIONS,value:!0}))}function*MS({payload:e}){const{callback:t}=e,n=ci(e,dS),i=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})}));try{const e=yield Yi(vd.teams.addUser,n),{roles:o}=e,a=w({},ci(e,yS),{roleIds:o.map((e=>e.id))});null==t||t(a),yield qi(Yn.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*NS({payload:e}){const{callback:t}=e,n=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield qi(Yn.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Yi(vd.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 qi(Yn.loadUsers(r)),yield qi(Yn.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*$S({payload:e}){const{callback:t}=e,n=ci(e,fS),i=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})}));try{yield Yi(vd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Yi(vd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield qi(Yn.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*FS({payload:e}){const{callback:t}=e,n=ci(e,gS),{id:i}=n,o=yield DS(),a=o.users.find((e=>e.id===n.id));yield qi(Yn.setTeamLoader({key:zp.UPDATE_USER,value:i||""})),yield qi(Yn.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0})})),yield qi(Yn.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?w({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Yi(vd.teams.updateUser,n);null==t||t(e),yield qi(Yn.setTeamState({users:o.users.map((t=>t.id===e.id?w({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield qi(Yn.setTeamLoader({key:zp.UPDATE_USER,value:!1}))}catch(e){yield qi(Yn.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?w({},e,a):e))})),yield qi(Yn.setTeamLoader({key:zp.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*xS({payload:e}){const{callback:t}=e,n=ci(e,pS),i=yield DS();yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})}));try{yield Yi(vd.teams.deleteUser,n),null==t||t(!0),yield qi(Yn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*VS({payload:e}){const{callback:t,userId:n}=e,i=ci(e,SS),o=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!0})}));try{yield Yi(vd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return w({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield qi(Yn.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[w({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield qi(Yn.setTeamState({addUserDialogState:w({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*jS({payload:e}){const{callback:t}=e,n=ci(e,vS),i=yield DS();yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})}));try{yield Yi(vd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield qi(Yn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*WS({payload:e}){const{callback:t}=e,n=ci(e,hS);yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Yi(vd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield qi(Yn.setTeamError({key:zp.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:!1}))}function*KS({payload:e}){const{callback:t}=e,n=ci(e,mS);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email}));try{yield Yi(vd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield qi(Yn.setTeamError({key:zp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*GS({payload:e}){const{callback:t}=e,n=ci(e,bS);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email}));try{yield Yi(vd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield qi(Yn.setTeamError({key:zp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*BS({payload:e}){const{callback:t}=e,n=ci(e,AS);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email}));try{yield Yi(vd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield qi(Yn.setTeamError({key:zp.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*zS(){yield qi(Yn.setTeamError({key:zp.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Yi(vd.teams.getInviteLinkConfiguration);yield qi(Yn.setTeamState({inviteTokenState:w({},e)}))}catch(e){yield qi(Yn.setTeamError({key:zp.CONFIG_TOKEN_LINK,value:e.message}))}}function*qS(){yield qi(Yn.setTeamError({key:zp.GET_TOKEN_LINK,value:!1}));try{yield Yi(zS);const e=yield Yi(vd.teams.getInviteUserLink),{inviteTokenState:t}=yield DS();yield qi(Yn.setTeamState({inviteTokenState:w({},t,e)}))}catch(e){yield qi(Yn.setTeamError({key:zp.GET_TOKEN_LINK,value:e.message}))}}function*HS({payload:{callback:e}}){yield qi(Yn.setTeamError({key:zp.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield DS();try{const n=yield Yi(vd.teams.createInviteUserLink,{expiresInMinutes:43200});yield qi(Yn.setTeamState({inviteTokenState:w({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield qi(Yn.setTeamError({key:zp.CREATE_TOKEN_LINK,value:t.message}))}}function*JS({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield DS();yield qi(Yn.setTeamError({key:zp.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Yi(vd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield qi(Yn.setTeamState({inviteTokenState:w({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield qi(Yn.setTeamError({key:zp.UPDATE_TOKEN_LINK,value:t.message}))}}function*YS({payload:e}){const{callback:t}=null!=e?e:{};yield qi(Yn.setTeamError({key:zp.DELETE_TOKEN_LINK,value:!1}));try{yield Yi(vd.teams.deleteInviteUserLink),yield qi(Yn.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield qi(Yn.setTeamError({key:zp.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*QS({payload:e}){yield qi(Yn.setTeamState({addUserDialogState:w({open:!0,loading:!1,error:!1},e)}))}function*XS({payload:e}){const t=yield DS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield qi(Yn.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*ZS({payload:e}){yield qi(Yn.setTeamState({deleteUserDialogState:w({open:!0,loading:!1,error:!1},e)}))}function*ev({payload:e}){const t=yield DS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield qi(Yn.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*tv(){yield qo(Yn.loadUsers,RS),yield qo(Yn.loadAllSubTenantsUsers,_S),yield qo(Yn.loadRoles,US),yield zo(Yn.addUser,MS),yield zo(Yn.addUsersBulk,NS),yield zo(Yn.addUserToSubTenants,$S),yield zo(Yn.updateUser,FS),yield zo(Yn.setUserRolesForSubTenants,VS),yield zo(Yn.deleteUser,xS),yield zo(Yn.deleteUserFromSubTenants,jS),yield zo(Yn.resendActivationLink,WS),yield zo(Yn.resendInvitationLink,KS),yield zo(Yn.resendInvitationEmail,GS),yield zo(Yn.resendInvitationLinkToAllSubTenants,BS),yield zo(Yn.getInvitationLink,qS),yield zo(Yn.createInvitationLink,HS),yield zo(Yn.updateInvitationLink,JS),yield zo(Yn.deleteInvitationLink,YS),yield zo(Yn.openAddUserDialog,QS),yield zo(Yn.closeAddUserDialog,XS),yield zo(Yn.openDeleteUserDialog,ZS),yield zo(Yn.closeDeleteUserDialog,ev)}function*nv({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield DS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield qi(Yn.setTeamLoader({key:zp.USERS,value:!a})),yield qi(Yn.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield gt(),yield qi(Yn.setTeamState({users:Gd,totalPages:2,totalItems:10,roles:Fd,permissions:Vd})),yield qi(Yn.setTeamLoader({key:zp.USERS,value:!1})),null==r||r(Gd)}function*iv({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield DS(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield qi(Yn.setTeamLoader({key:zp.USERS,value:!r})),yield qi(Yn.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield gt(),yield qi(Yn.setTeamState({allUsers:Bd,totalPages:2,totalItems:10,roles:Fd,permissions:Vd})),yield qi(Yn.setTeamLoader({key:zp.USERS,value:!1})),null==l||l(Bd)}function*ov({payload:e}){var t;yield qi(Yn.setTeamLoader({key:zp.ROLES_AND_PERMISSIONS,value:!0})),yield gt(),yield qi(Yn.setTeamState({roles:Fd,permissions:Vd})),yield qi(Yn.setTeamLoader({key:zp.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Fd,permissions:Vd})}function*av({payload:e}){const{callback:t}=e,n=ci(e,kS),i=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})})),yield gt();const o=w({},Wd,n,{id:`${uS()}`});null==t||t(o),yield qi(Yn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*rv({payload:e}){const{callback:t}=e,n=ci(e,TS),i=yield DS();yield qi(Yn.setTeamState({addUserDialogState:w({},i.addUserDialogState,{loading:!0})})),yield gt();const o=w({},Wd,n,{id:`${uS()}`});yield qi(Yn.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*lv({payload:e}){var t;const{callback:n}=e,i=ci(e,PS),{id:o}=i,a=yield DS(),r=a.users.find((e=>e.id===i.id));yield qi(Yn.setTeamLoader({key:zp.UPDATE_USER,value:o||""})),yield qi(Yn.setTeamState({addUserDialogState:w({},a.addUserDialogState,{loading:!0})})),yield qi(Yn.setTeamState({addUserDialogState:w({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?w({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield gt();const l=w({},r,i);null==n||n(l),yield qi(Yn.setTeamState({users:a.users.map((e=>e.id===l.id?w({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield qi(Yn.setTeamLoader({key:zp.UPDATE_USER,value:!1}))}function*sv({payload:e}){const{callback:t}=e,n=ci(e,IS),i=yield DS();yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*cv({payload:e}){const{callback:t}=e,n=ci(e,LS),i=yield DS();yield qi(Yn.setTeamState({deleteUserDialogState:w({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*uv({payload:e}){const{callback:t}=e,n=ci(e,wS);yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:n.userId})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamLoader({key:zp.RESEND_ACTIVATE_LINK,value:!1}))}function*dv({payload:e}){const{callback:t}=e,n=ci(e,OS);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*yv({payload:e}){const{callback:t}=e,n=ci(e,ES);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*fv({payload:e}){const{callback:t}=e,n=ci(e,CS);yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield qi(Yn.setTeamLoader({key:zp.RESEND_INVITATION_LINK,value:!1}))}function*gv(){yield qo(Yn.loadUsers,nv),yield qo(Yn.loadAllSubTenantsUsers,iv),yield qo(Yn.loadRoles,ov),yield zo(Yn.addUser,av),yield zo(Yn.addUserToSubTenants,rv),yield zo(Yn.updateUser,lv),yield zo(Yn.deleteUser,sv),yield zo(Yn.deleteUserFromSubTenants,cv),yield zo(Yn.resendActivationLink,uv),yield zo(Yn.resendInvitationLink,dv),yield zo(Yn.resendInvitationEmail,yv),yield zo(Yn.resendInvitationLinkToAllSubTenants,fv),yield zo(Yn.openAddUserDialog,QS),yield zo(Yn.closeAddUserDialog,XS),yield zo(Yn.openDeleteUserDialog,ZS),yield zo(Yn.closeDeleteUserDialog,ev)}const pv=["authorizationUrl"],Sv=["events","url"];function*vv(){try{yield qi(Yn.setSocialLoginsState({loading:!0}));const e=yield Yi(vd.auth.getSocialLoginProviders);yield qi(Yn.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield qi(Yn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*hv(){try{const e=yield Zi((e=>e.root.context));yield qi(Yn.setSocialLoginsState({loading:!0}));const t=(yield Yi(vd.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=ci(t,pv);const o=Xo(e,null!=n?n:"");return w({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield qi(Yn.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield qi(Yn.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*mv(e){let{payload:{events:t,url:n}}=e,i=ci(e.payload,Sv);try{yield qi(Yn.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield Yi(vd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Xd.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Qd.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield qi(Yn.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Zi((e=>e.auth));e?yield Yi(kf):yield Yi(Pf)}(),localStorage.removeItem("register-quick-login"),yield qi(Yn.setSocialLoginsState({loading:!1}))}catch(e){var r;yield qi(Yn.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*bv({payload:e}){yield qi(Yn.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Av(){yield Ho(Yn.loadSocialLoginsConfiguration,vv),yield Ho(Yn.loadSocialLoginsConfigurationV2,hv),yield Ho(Yn.loginViaSocialLogin,mv),yield qo(Yn.setSocialLoginError,bv)}let kv;function*Tv({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Zi((e=>e.auth.apiTokensState));try{let e,a;yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield Yi(vd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield Yi(vd.auth.updateUserApiTokensData,{description:t}),yield qi(Yn.setApiTokensState({showAddTokenDialog:!1})),yield eo(200),yield qi(Yn.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield qi(Yn.setApiTokensError({key:kv.ADD_API_TOKEN,value:e.message})),yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Pv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Zi((e=>e.auth.apiTokensState));try{let e,r;yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield Yi(vd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield Yi(vd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield qi(Yn.setApiTokensState({showAddTokenDialog:!1})),yield eo(200),yield qi(Yn.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield qi(Yn.setApiTokensError({key:kv.ADD_API_TOKEN,value:e.message})),yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*Iv({payload:e}){const{apiTokensDataUser:t}=yield Zi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!0})),n?(yield Yi(vd.auth.deleteUserAccessToken,{id:e}),yield qi(Yn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Yi(vd.auth.deleteUserApiToken,{tokenId:e}),yield qi(Yn.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!1}))}catch(e){yield qi(Yn.setApiTokensError({key:kv.DELETE_API_TOKEN,value:e.message})),yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!1}))}}function*Lv({payload:e}){const{apiTokensDataTenant:t}=yield Zi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!0})),n?(yield Yi(vd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Yi(vd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield qi(Yn.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!1}))}catch(e){yield qi(Yn.setApiTokensError({key:kv.DELETE_API_TOKEN,value:e.message})),yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!1}))}}function*wv({payload:e}){null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Hi([Yi(vd.auth.getUserApiTokensData),Yi(vd.auth.getTenantApiTokensData)]);yield qi(Yn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield qi(Yn.setApiTokensError({key:kv.LOAD_API_TOKENS,value:t.message})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Ov({payload:e}){null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Yi(vd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Yi(vd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield qi(Yn.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield qi(Yn.setApiTokensError({key:kv.LOAD_API_TOKENS,value:t.message})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Ev({payload:e}){null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Yi(vd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Yi(vd.auth.getTenantAccessTokensData))?n:[],l=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield qi(Yn.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield qi(Yn.setApiTokensError({key:kv.LOAD_API_TOKENS,value:t.message})),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Cv(){yield Ho(Yn.loadApiTokens,wv),yield Ho(Yn.loadUserApiTokens,Ov),yield Ho(Yn.loadTenantApiTokens,Ev),yield zo(Yn.addUserApiToken,Tv),yield zo(Yn.addTenantApiToken,Pv),yield qo(Yn.deleteTenantApiToken,Lv),yield qo(Yn.deleteUserApiToken,Iv)}function*Dv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Zi((e=>e.auth.apiTokensState)),a=w({},Ld,{description:t,roleIds:n,clientId:`CLIENT_ID_${uS()}`});yield qi(Yn.setApiTokensState({showAddTokenDialog:!1})),yield eo(200),yield qi(Yn.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield eo(200),yield qi(Yn.setApiTokensLoader({key:kv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Rv({payload:e}){yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!0})),yield eo(200);const t=[Ld];yield qi(Yn.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield qi(Yn.setApiTokensLoader({key:kv.DELETE_API_TOKEN,value:!1}))}function*_v({payload:e}){var t;null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));const n=[Id],i=[Ld];yield qi(Yn.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield eo(200),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Uv({payload:e}){var t;null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));const n=[Id];yield qi(Yn.setApiTokensState({apiTokensDataUser:n})),yield eo(200),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Mv({payload:e}){var t;null!=e&&e.silentLoading||(yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!0})));const n=[Ld];yield qi(Yn.setApiTokensState({apiTokensDataTenant:n})),yield eo(200),yield qi(Yn.setApiTokensLoader({key:kv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Nv(){yield Ho(Yn.loadApiTokens,_v),yield Ho(Yn.loadUserApiTokens,Uv),yield Ho(Yn.loadTenantApiTokens,Mv),yield zo(Yn.addTenantApiToken,Dv),yield qo(Yn.deleteTenantApiToken,Rv)}function*$v({payload:e}){try{var t;yield qi(Yn.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Zi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield Yi(vd.accountSettings.updateSettings,w({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield qi(Yn.setAccountSettingsState(w({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield qi(Yn.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Fv({payload:e}){yield qi(Yn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Yi(vd.accountSettings.getSettings);yield qi(Yn.setAccountSettingsState(w({},e,{loading:!1})))}catch(e){yield qi(Yn.setAccountSettingsState({loading:!1,error:e.message}))}}function*xv(){yield Ho(Yn.saveAccountSettings,$v),yield Ho(Yn.loadAccountSettings,Fv)}function*Vv({payload:e}){var t;yield qi(Yn.setAccountSettingsState({loading:!0})),yield gt();const{accountSettingsState:n}=yield Zi((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=w({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield qi(Yn.setAccountSettingsState(w({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*jv({payload:e}){yield qi(Yn.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield gt(),yield qi(Yn.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Wv(){yield Ho(Yn.saveAccountSettings,Vv),yield Ho(Yn.loadAccountSettings,jv)}function*Kv({payload:{tenantId:e,callback:t}}){yield qi(Yn.setState({isLoading:!0}));try{yield Yi(vd.tenants.switchTenant,{tenantId:e}),yield Yi(bf),(null==t?void 0:t(!0))||(yield qi(Yn.setState({isLoading:!1})))}catch(e){yield qi(Yn.setState({isLoading:!1})),null==t||t(!1,e)}}function*Gv({payload:e}){yield qi(Yn.setTenantsState({loading:!0}));try{var t;const n=yield Yi(vd.tenants.getTenants);yield qi(Yn.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 qi(Yn.setTenantsState({loading:!1}))}}function*Bv({payload:e}){yield qi(Yn.setTenantsState({loading:!0}));try{var t;const n=yield Yi(vd.tenants.getSubTenants);yield qi(Yn.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield qi(Yn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*zv({payload:e}){yield qi(Yn.setTenantsState({loading:!0}));try{var t;const n=yield Yi(vd.tenants.getSubTenantsAsTree);yield qi(Yn.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield qi(Yn.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*qv(){yield zo(Yn.loadTenants,Gv),yield zo(Yn.loadSubTenants,Bv),yield zo(Yn.switchTenant,Kv),yield zo(Yn.loadSubTenantsTree,zv)}function*Hv(){yield qi(Yn.setTenantsState({loading:!0})),yield gt(),yield qi(Yn.setTenantsState({tenants:zd,loading:!1}))}function*Jv(){yield zo(Yn.loadTenants,Hv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(kv||(kv={}));const Yv=["callback"],Qv=["callback"],Xv=["callback"],Zv=["callback"],eh=["callback"];function*th({payload:e}){var t;yield qi(Yn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Hi([Yi(vd.roles.getRoles),Yi(vd.roles.getPermissions),Yi(vd.roles.getPermissionCategories)]),[t,n,i]=e;yield qi(Yn.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield qi(Yn.setRolesState({error:e.message,loading:!1}))}}function*nh(e){let{payload:{callback:t}}=e,n=ci(e.payload,Yv);yield qi(Yn.setRolesState({saving:!0}));try{const e=yield Yi(vd.roles.addRole,n),i=yield Yi(vd.roles.getRoles);yield qi(Yn.loadRolesAndPermissions({silentLoading:!0})),yield qi(Yn.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*ih(e){let{payload:{callback:t}}=e,n=ci(e.payload,Qv);yield qi(Yn.setRolesState({saving:!0}));try{yield Yi(vd.roles.deleteRole,n),yield qi(Yn.loadRolesAndPermissions({silentLoading:!0})),yield qi(Yn.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*oh(e){let{payload:{callback:t}}=e,n=ci(e.payload,Xv);yield qi(Yn.setRolesState({saving:!0}));try{const e=yield Yi(vd.roles.updateRole,n);yield qi(Yn.loadRolesAndPermissions({silentLoading:!0})),yield qi(Yn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*ah(e){let{payload:{callback:t}}=e,n=ci(e.payload,Zv);yield qi(Yn.setRolesState({saving:!0}));try{const e=yield Yi(vd.roles.attachPermissionsToRole,n);yield qi(Yn.loadRolesAndPermissions({silentLoading:!0})),yield qi(Yn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*rh(e){let{payload:{callback:t}}=e,n=ci(e.payload,eh);yield qi(Yn.setRolesState({saving:!0}));try{const e=yield Yi(vd.roles.attachPermissionToRoles,n);yield qi(Yn.loadRolesAndPermissions({silentLoading:!0})),yield qi(Yn.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield qi(Yn.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*lh(){yield Ho(Yn.loadRolesAndPermissions,th),yield zo(Yn.addRole,nh),yield zo(Yn.deleteRole,ih),yield zo(Yn.updateRole,oh),yield zo(Yn.attachPermissionsToRole,ah),yield zo(Yn.attachPermissionToRoles,rh)}function*sh({payload:e}){var t;yield qi(Yn.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield qi(Yn.setRolesState({roles:wd,loading:!1}))}catch(e){yield qi(Yn.setRolesState({error:e.message,loading:!1}))}}function*ch(){yield Ho(Yn.loadRolesAndPermissions,sh)}const uh=["callback"],dh=["callback"],yh=["callback"];function*fh(e){let{payload:{callback:t}}=e,n=ci(e.payload,uh);yield qi(Yn.setResetPhoneNumberState({loading:!0}));try{const e=yield Yi(vd.auth.resetPhoneNumber,n);yield qi(Yn.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Kt.VerifyResetPhoneNumber})),yield qi(Yn.setLoginState({email:n.email}))}catch(e){yield qi(Yn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*gh(e){let{payload:{callback:t}}=e,n=ci(e.payload,dh);yield qi(Yn.setResetPhoneNumberState({loading:!0}));try{const e=yield Yi(vd.auth.verifyResetPhoneNumber,n);yield qi(Yn.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Kt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield qi(Yn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*ph(e){let{payload:{callback:t}}=e,n=ci(e.payload,yh);yield qi(Yn.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Zi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Yi(vd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield qi(Yn.setLoginState({step:mt.loginWithSmsOtc})),yield qi(Yn.passwordlessPreLogin({type:gr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield qi(Yn.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Sh(){yield Ho(Yn.resetPhoneNumber,fh),yield Ho(Yn.verifyResetPhoneNumber,gh),yield Ho(Yn.changePhoneNumber,ph)}function*vh(){yield qi(Yn.setSessionsState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getCurrentUserSessions);yield qi(Yn.setSessionsState({sessions:e,loading:!1}))}catch(e){yield qi(Yn.setSessionsState({error:e,loading:!1}))}}function*hh(){yield qi(Yn.setSessionsState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getCurrentUserSession);yield qi(Yn.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield qi(Yn.setSessionsState({error:e,loading:!1}))}}function*mh({payload:{id:e}}){yield qi(Yn.setSessionsState({loading:!0,error:null}));try{yield Yi(vd.auth.deleteSessionForUser,e),yield qi(Yn.loadUserSessions())}catch(e){yield qi(Yn.setSessionsState({error:e,loading:!1}))}}function*bh({payload:{callback:e,userId:t}}){yield qi(Yn.setSessionsState({loading:!0,error:null}));try{yield Yi(vd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield qi(Yn.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Ah(){yield qi(Yn.setSessionsState({loading:!0,error:null}));try{yield Yi(vd.auth.deleteAllSessionsForUser),yield qi(Yn.loadUserSessions())}catch(e){yield qi(Yn.setSessionsState({error:e,loading:!1}))}}function*kh(){yield qo(Yn.loadUserSessions,vh),yield qo(Yn.deleteUserSession,mh),yield qo(Yn.deleteAllUserSessions,Ah),yield qo(Yn.loadCurrentUserSession,hh),yield zo(Yn.revokeUserSessions,bh)}function*Th(){yield qi(Yn.setSessionsState({loading:!0,error:null})),yield qi(Yn.setSessionsState({sessions:qd,loading:!1}))}function*Ph({payload:{id:e}}){yield qi(Yn.setSessionsState({loading:!0,error:null}));const t=(yield Zi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield qi(Yn.setSessionsState({sessions:t,loading:!1}))}function*Ih(){yield qi(Yn.setSessionsState({loading:!0,error:null}));const e=qd.filter((e=>e.current));yield qi(Yn.setSessionsState({sessions:e,loading:!1}))}function*Lh(){yield qo(Yn.loadUserSessions,Th),yield qo(Yn.deleteUserSession,Ph),yield qo(Yn.deleteAllUserSessions,Ih)}const wh=["callback"],Oh=["callback"];function*Eh(){yield qi(Yn.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getSessionConfigurations);yield qi(Yn.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield qi(Yn.setSessionsState({error:e,loading:!1}))}}function*Ch({payload:e}){yield qi(Yn.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ci(e,wh);yield Yi(vd.auth.createOrUpdateSessionConfigrations,n),yield qi(Yn.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield qi(Yn.setSessionsPolicyState({error:e,loading:!1}))}}function*Dh(){yield Ho(Yn.loadSessionsPolicy,Eh),yield qo(Yn.createOrUpdateSessionsPolicy,Ch)}function*Rh(){yield qi(Yn.setSessionsPolicyState({loading:!0,error:null}));const e=yield Zi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:Hd}));yield qi(Yn.setSessionsPolicyState(w({},e,{loading:!1})))}function*_h({payload:e}){yield qi(Yn.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ci(e,Oh);null==t||t(!0),yield qi(Yn.setSessionsPolicyState({configurations:n,loading:!1}))}function*Uh(){yield Ho(Yn.loadSessionsPolicy,Rh),yield qo(Yn.createOrUpdateSessionsPolicy,_h)}const Mh=["callback"],Nh=["callback"],$h=["callback"],Fh=["callback"],xh=["callback"],Vh=["callback"],jh=["callback"],Wh=["callback"],Kh=()=>Zi((e=>e.auth.restrictionsState.ipRestrictions)),Gh=()=>Zi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Bh(){yield qi(Yn.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Yi(vd.auth.getDomainRestrictionsConfig),t=(yield Yi(vd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield qi(Yn.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield qi(Yn.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*zh(e){let{payload:{callback:t}}=e,n=ci(e.payload,Mh);yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Gh();try{var o;yield Yi(vd.auth.createDomainRestriction,n);const e=(yield Yi(vd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield qi(Yn.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 qi(Yn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qh(e){let{payload:{callback:t}}=e,n=ci(e.payload,Nh);yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Yi(vd.auth.updateDomainRestrictionConfig,n),i=(yield Yi(vd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield qi(Yn.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hh({payload:{id:e}}){yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Gh();try{var n;yield Yi(vd.auth.deleteDomainRestriction,e);const i=(yield Yi(vd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield qi(Yn.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Mn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield qi(Yn.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Jh=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Mn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Yh(){yield qi(Yn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Kh(),t=yield Yi(vd.auth.getIPRestrictionsConfig),n=Jh({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Yi(vd.auth.getIPRestrictions,n);yield qi(Yn.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield qi(Yn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Qh(){try{const{valid:e}=yield Yi(vd.auth.testCurrentIpInAllowList);yield qi(Yn.setIpRestrictionsState({userIpValid:e}))}catch(e){yield qi(Yn.setIpRestrictionsState({error:e.message}))}}function*Xh({payload:{callback:e}}){yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Zi((e=>e.auth.userIp));yield Hi([Yi(vd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Mn.ALLOW}),Yi(vd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Kh(),i=Jh(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Yi(vd.auth.getIPRestrictions,i);yield qi(Yn.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Mn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield qi(Yn.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Zh(e){let{payload:{callback:t}}=e,n=ci(e.payload,$h);yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Kh();try{var o,a;yield Yi(vd.auth.createIPRestriction,n);const e=yield Kh(),r=Jh(e.pagination),{items:l,_metadata:{totalPages:s}}=yield Yi(vd.auth.getIPRestrictions,r);yield Qh(),yield qi(Yn.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Mn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*em(e){let{payload:{callback:t}}=e,n=ci(e.payload,Fh);yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));try{yield Yi(vd.auth.updateIPRestrictionConfig,n);const e=yield Kh(),i=yield Yi(vd.auth.getIPRestrictionsConfig),o=Jh(w({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Yi(vd.auth.getIPRestrictions,o);yield Qh(),yield qi(Yn.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tm({payload:{id:e,callback:t}}){yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));const n=yield Kh();try{var i;yield Yi(vd.auth.deleteIPRestriction,e);const o=yield Kh(),a=Jh(o.pagination),{items:r,_metadata:{totalPages:l}}=yield Yi(vd.auth.getIPRestrictions,a);yield Qh(),yield qi(Yn.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Mn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nm(){yield Ho(Yn.loadIpRestrictions,Yh),yield Ho(Yn.loadEmailDomainRestrictions,Bh),yield zo(Yn.saveIpRestriction,Zh),yield zo(Yn.saveIpRestrictionsConfig,em),yield zo(Yn.deleteIpRestriction,tm),yield zo(Yn.checkIfUserIpValid,Qh),yield zo(Yn.addCurrentUserIpAndActivate,Xh),yield zo(Yn.saveEmailDomainRestriction,zh),yield zo(Yn.saveEmailDomainRestrictionsConfig,qh),yield zo(Yn.deleteEmailDomainRestriction,Hh)}function*im(){yield qi(Yn.setIpRestrictionsState({loading:!0,error:null})),yield qi(Yn.setIpRestrictionsState({data:{restrictions:Yd.filter((e=>e.strategy===Jd.strategy)),config:Jd},totalPages:1,pagination:{_filter:Mn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*om(){yield qi(Yn.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Kh(),t=Yd[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield qi(Yn.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield qi(Yn.setIpRestrictionsState({error:e.message,loading:!1}))}}function*am(e){var t,n,i;let{payload:{callback:o}}=e,a=ci(e.payload,xh);yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));const r=yield Kh(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield qi(Yn.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Mn.ALLOW},restrictions:[...l,w({},a,{createdAt:new Date,updatedAt:new Date,id:uS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Mn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*rm(e){var t,n,i;let{payload:{callback:o}}=e,a=ci(e.payload,Vh);const r=yield Kh();yield qi(Yn.setIpRestrictionsState({saving:!0,error:null})),yield qi(Yn.setIpRestrictionsState({data:{config:w({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Mn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield qi(Yn.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*lm({payload:{id:e,callback:t}}){var n;yield qi(Yn.setIpRestrictionsState({saving:!0,error:null}));const i=yield Kh();yield qi(Yn.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Mn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Mn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*sm(){yield qi(Yn.setEmailDomainRestrictionsState({loading:!0,error:null})),yield qi(Yn.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Mn.ALLOW}],config:{active:!0,listType:Mn.ALLOW,blockPublicDomains:!1}}}))}function*cm(e){var t,n;let{payload:{callback:i}}=e,o=ci(e.payload,jh);const a=yield Gh();yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==i||i(!0),yield qi(Yn.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],w({},o,{id:Date.now().toString()})]},saving:!1}))}function*um(e){var t;let{payload:{callback:n}}=e,i=ci(e.payload,Wh);const o=yield Gh();yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==n||n(!0),yield qi(Yn.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Mn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*dm({payload:{id:e}}){var t,n;const i=yield Gh();yield qi(Yn.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),yield qi(Yn.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Mn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*ym(){yield Ho(Yn.loadIpRestrictions,im),yield Ho(Yn.loadEmailDomainRestrictions,sm),yield zo(Yn.saveIpRestriction,am),yield zo(Yn.saveIpRestrictionsConfig,rm),yield zo(Yn.deleteIpRestriction,lm),yield zo(Yn.checkIfUserIpValid,om),yield zo(Yn.saveEmailDomainRestriction,cm),yield zo(Yn.saveEmailDomainRestrictionsConfig,um),yield zo(Yn.deleteEmailDomainRestriction,dm)}const fm=["callback"],gm=["id"];function*pm(e){const{count:t}=yield Yi(vd.directory.countConfigurationUsers,e.id);return w({},e,{count:t})}function*Sm(){yield qi(Yn.setProvisioningState({loading:!0,error:null}));try{const e=yield Yi(vd.directory.getConfigs),t=yield Hi(e.map((e=>pm(e))));yield qi(Yn.setProvisioningState({connections:t,loading:!1}))}catch(e){yield qi(Yn.setProvisioningState({error:e.message,loading:!1}))}}function*vm(e){let{payload:{callback:t}}=e,n=ci(e.payload,fm);yield qi(Yn.setProvisioningState({loading:!0,error:null}));try{const e=yield Yi(vd.directory.createConfiguration,n),i=yield Yi(vd.directory.getConfigs),o=yield Hi(i.map((e=>pm(e))));yield qi(Yn.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield qi(Yn.setProvisioningState({error:e.message,loading:!1}))}}function*hm(e){let{payload:{id:t}}=e,n=ci(e.payload,gm);yield qi(Yn.setProvisioningState({loading:!0,error:null}));try{yield Yi(vd.directory.updateConfiguration,t,n);const e=yield Yi(vd.directory.getConfigs),i=yield Hi(e.map((e=>pm(e))));yield qi(Yn.setProvisioningState({connections:i,loading:!1}))}catch(e){yield qi(Yn.setProvisioningState({error:e.message,loading:!1}))}}function*mm({payload:{id:e,callback:t}}){yield qi(Yn.setProvisioningState({loading:!0,error:null}));try{yield Yi(vd.directory.deleteConfiguration,e);const n=yield Yi(vd.directory.getConfigs),i=yield Hi(n.map((e=>pm(e))));yield qi(Yn.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield qi(Yn.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*bm(){yield Ho(Yn.loadProvisionConnections,Sm),yield zo(Yn.createProvisionConnection,vm),yield zo(Yn.deleteProvisionConnection,mm),yield zo(Yn.updateProvisionConnection,hm)}const Am=["callback","events"];function*km(e){let{payload:{callback:t}}=e,n=ci(e.payload,Am);yield qi(Yn.setImpersonateState({loading:!0}));try{yield Yi(vd.impersonate.impersonate,n),yield qi(Yn.setImpersonateState({step:Gn.success})),yield eo(1e3),yield yf(),yield qi(Yn.resetImpersonateState()),null==t||t(!0)}catch(e){yield qi(Yn.setImpersonateState({loading:!1,error:e.message}))}}function*Tm(){yield Ho(Yn.impersonate,km)}var Pm={sagas:function*(){yield Hi([Yi(lg),Yi(eS),Yi(nS),Yi(Bp),Yi(Sh),Yi(Tg),Yi(Hg),Yi(ep),Yi(Dp),Yi(tv),Yi(Av),Yi(oy),Yi(Cv),Yi(Ry),Yi(xv),Yi(qv),Yi(lh),Yi(kh),Yi(Dh),Yi(nm),Yi(bm),Yi(Tm)])},mockSagas:function*(){yield Hi([Yi(ug),Yi(Cg),Yi(op),Yi(Vp),Yi(gv),Yi(Nv),Yi(By),Yi(Lh),Yi(Wv),Yi(Jv),Yi(Uh),Yi(ym),Yi(ch)])},storeName:Pt,initialState:Kn,reducer:Hn,actions:Yn};const Im=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>w({},t,{[e]:w({},t[e],n)})}),Lm={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},wm={setAuditLogsState:Im("auditLogsState"),resetAuditLogsState:e=>w({},e,{auditLogsState:Lm})},Om={exportAuditsCsv:at("auditLogs/exportAuditsCsv"),loadAuditLogs:at("auditLogs/loadAuditLogs",(e=>({payload:e})))},Em={loading:!0},Cm={setAuditsMetadataState:Im("auditsMetadataState"),resetAuditsMetadataState:e=>w({},e,{auditsMetadataState:Em})},Dm={loadAuditsMetadata:at("auditLogs/loadAuditsMetadata")},Rm={auditLogsState:Lm,auditsMetadataState:Em},{reducer:_m,actions:Um}=lt({name:Lt,initialState:Rm,reducers:w({resetState:e=>w({},e,Rm),setState:(e,{payload:t})=>w({},e,t)},wm,Cm)}),Mm=w({},Um,Om,Dm),Nm=e=>"createdAt"!==e.id,$m={total:20,data:Array.from(Array(5).keys()).map((e=>w({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Fm={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}]},xm=()=>Zi((e=>e.auditLogs.auditLogsState)),Vm=()=>Zi((e=>e.auditLogs.auditsMetadataState));function*jm(){const e=yield xm(),{columns:t}=yield Vm();try{const n=e.filter,i=e.sort.reduce(((e,t)=>w({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>w({},e,{[t.id]:t.value})),{});yield qi(Mm.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield vd.audits.exportAudits(w({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield qi(Mm.setAuditLogsState({isDownloadingCsv:!1}))}function*Wm({payload:e}){yield qi(Mm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield xm(),{columns:n}=yield Vm();try{var i,o,a,r,l;const s=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 qi(Mm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>w({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>w({},e,{[t.id]:t.value})),{});n||(yield qi(Mm.loadAuditsMetadata()));const{data:g,total:p}=yield Yi(vd.audits.getAudits,w({offset:c,count:s},y,f));yield qi(Mm.setAuditLogsState({loading:!1,logs:null!=g?g:[],totalPages:+Math.ceil(p/s)})),null==e||null==(l=e.callback)||l.call(e,!0)}catch(t){var s;yield qi(Mm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Km(){yield zo(Mm.exportAuditsCsv,jm),yield zo(Mm.loadAuditLogs,Wm)}function*Gm({payload:e}){yield qi(Mm.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield xm(),{columns:n}=yield Vm();try{var i,o,a,r,l;const s=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 qi(Mm.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield qi(Mm.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=$m;let i=n.filter((e=>t=>e.filter(Nm).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 qi(Mm.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 qi(Mm.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Bm(){yield zo(Mm.loadAuditLogs,Gm)}function*zm(){yield qi(Mm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Yi(vd.metadata.getAuditsMetadata);yield qi(Mm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield qi(Mm.setAuditsMetadataState({error:e,loading:!1}))}}function*qm(){yield zo(Mm.loadAuditsMetadata,zm)}function*Hm(){yield qi(Mm.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Fm;yield qi(Mm.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield qi(Mm.setAuditsMetadataState({error:e,loading:!1}))}}function*Jm(){yield zo(Mm.loadAuditsMetadata,Hm)}var Ym={sagas:function*(){yield Hi([Yi(Km),Yi(qm)])},mockSagas:function*(){yield Hi([Yi(Bm),Yi(Jm)])},storeName:Lt,initialState:Rm,reducer:_m,actions:Mm};const Qm={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:Xm,actions:Zm,reducer:eb}=lt({name:"audits",initialState:Qm,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=w({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),tb=w({},Zm,{initData:at(`${Xm}/initData`),loadAudits:at(`${Xm}/loadAudits`),removeFilter:at(`${Xm}/removeFilter`),filterData:at(`${Xm}/filterData`),exportCSV:at(`${Xm}/exportCSV`),deleteAudits:at(`${Xm}/deleteAudits`)}),nb=()=>Zi((e=>e[Xm]));function*ib(){const{sortBy:e,sortDirection:t}=yield nb();try{const n=yield Yi(vd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield qi(tb.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield qi(tb.loadItemFailedAction(t))}}function*ob(){try{const e=yield Yi(vd.metadata.getAuditsMetadata);yield qi(tb.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield qi(tb.loadItemFailedAction(t))}}const ab=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*rb({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield nb(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield nb():{rowsData:[]};try{const e=ab(t),{data:l,total:d}=yield Yi(vd.audits.getAudits,w({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield qi(tb.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield qi(tb.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield qi(tb.loadItemFailedAction(t))}}function*lb(){yield qi(tb.startLoading()),yield Hi([ib(),ob(),rb({payload:{onlyOneLoad:!1},type:""})]),yield qi(tb.finishLoading())}function*sb({payload:e}){const{filters:t}=yield nb(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield qi(tb.setFilterData(i))}function*cb({payload:e}){const{filters:t}=yield nb();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 qi(tb.setFilterData(i))}function*ub(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield nb(),a=ab(e);yield qi(tb.startDownloadingCsv());try{yield vd.audits.exportAudits(w({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield qi(tb.stopDownloadingCsv())}}function*db(){yield qo(tb.initData,lb),yield qo(tb.removeFilter,sb),yield qo(tb.filterData,cb),yield qo([tb.loadAudits,tb.textSearch,tb.onPageChange],rb),yield qo([tb.setFilterData,tb.setDataSorting,tb.startRefresh],(()=>rb({payload:{appendMode:!1},type:""}))),yield qo(tb.exportCSV,ub)}const yb={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},fb={initData:()=>w({},yb),setConnectivityState:(e,{payload:t})=>w({},e,t),cleanWebhookTestData:e=>w({},e,{testResult:void 0}),cleanWebhookLogsData:e=>w({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return w({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>w({},e,{error:void 0}),cleanSlackData:e=>w({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>w({},e,{retryResult:w({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>w({},e,{retryResult:w({},e.retryResult,t)})}},gb={loadSlackActions:at("connectivity/loadSlackActions"),loadDataAction:at("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:at("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:at("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:at("connectivity/loadScope"),deleteWebhookConfigAction:at("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:at("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:at("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},pb={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:Sb,actions:vb}=lt({name:It,initialState:pb,reducers:w({},fb)}),hb=w({},vb,gb),mb={slack:vd.connectivity.getSlackConfiguration,email:vd.connectivity.getEmailConfiguration,sms:vd.connectivity.getSMSConfiguration,webhook:vd.connectivity.getWebhooksConfigurations,categories:vd.connectivity.getCategories,channelMap:vd.connectivity.getChannelMaps},bb={slack:vd.connectivity.postSlackConfiguration,email:vd.connectivity.postEmailConfiguration,sms:vd.connectivity.postSMSConfiguration,webhook:vd.connectivity.postWebhooksConfiguration},Ab=["email","slack","sms","webhook"],kb={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"}},Tb=["id"],Pb=["id","enabled"],Ib=["categories","channelMap"];function*Lb(e){return yield Yi(Ob,{payload:{api:e},type:""})}function*wb({payload:e=Ab}){yield qi(hb.setConnectivityState({isLoading:!0}));try{const t=yield Hi([...e.map(Lb),yield Ob({payload:{api:"categories"},type:""}),yield function*(){return(yield Hi(e.map((function*(e){return yield Ob({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>w({},t,{[`${e[i]}`]:n})),{})}()]),n=yield Ob({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?w({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:kb[e[o]].events(i),active:kb[e[o]].isActive(i),platform:kb[e[o]].title,image:kb[e[o]].image}]}):n:w({},n,{[`${Ib[o-e.length]}`]:i})),{list:[],webhook:n});yield qi(hb.setConnectivityState(w({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield qi(hb.setConnectivityState({isLoading:!1}))}}function*Ob({payload:{api:e,params:t}}){try{return yield Yi(mb[e],t)}catch(e){return}}function*Eb(){try{yield qi(hb.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Yi(vd.connectivity.getSlackChannels);yield qi(hb.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield qi(hb.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*Cb(e,t){const{connectivity:{list:n}}=yield Zi(),i=n.find((({key:t})=>t===e));if(!i)return;const o=kb[e].isActive(t);o!==i.active&&(yield qi(hb.setConnectivityState({list:n.map((t=>t.key===e?w({},t,{active:o}):t))})))}function*Db({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Zi((e=>e.connectivity));try{if(yield qi(hb.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Zi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Hi([...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=ci(e,Tb);return n===t.id&&JSON.stringify(w({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Yi(bb.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Yi(vd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Zi(),{processIds:i}=yield Zi((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Hi([...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 Yi("email"===t?vd.connectivity.postEmailConfiguration:vd.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,l=ci(o,Pb);return yield Hi([yield Yi("email"===t?vd.connectivity.patchEmailConfiguration:vd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Yi("email"===t?vd.connectivity.putEmailSubscriptions:vd.connectivity.putSMSSubscriptions,a,i,w({},l,{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 Yi("email"===t?vd.connectivity.deleteEmailSubscriptions:vd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield Ob({payload:{api:t},type:""});yield qi(hb.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield Cb(t,e)}else yield qi(hb.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Yi(bb[e],t),!["sms","email"].includes(e)){const o=yield Ob({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield qi(hb.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield Cb(e,o),null==n||n(!0)}}catch(e){var o;yield qi(hb.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*Rb({payload:e}){try{yield vd.connectivity.postSlackCode(e)}catch{}yield qi(hb.setConnectivityState({error:void 0,isSaving:!1}))}function*_b(){const{slackChannels:e}=yield Zi((e=>e.connectivity));try{yield qi(hb.setConnectivityState({slackChannels:w({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Yi(vd.connectivity.getSlackScope);yield qi(hb.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield qi(hb.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*Ub({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Zi((e=>e.connectivity));try{yield qi(hb.setConnectivityState({isSaving:!0})),yield Yi(vd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield Ob({payload:{api:"webhook"},type:""});o&&(yield qi(hb.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*Mb({payload:e}){try{yield qi(hb.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Yi(vd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield qi(hb.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield qi(hb.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield qi(hb.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*Nb({payload:e}){try{const{statusCode:t}=yield Yi(vd.connectivity.postWebhookRetry,e);yield qi(hb.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield qi(hb.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*$b({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Zi((e=>e.connectivity));try{yield qi(hb.setConnectivityState({webhookLogs:w({},i,{isLoading:!0})}));const o=yield Yi(vd.connectivity.getWebhookLog,e,n,t);yield qi(hb.setConnectivityState({error:void 0,webhookLogs:w({isLoading:!1},o)}))}catch(e){yield qi(hb.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var Fb={sagas:function*(){yield zo(hb.loadDataAction,wb),yield qo(hb.loadSlackActions,Eb),yield zo(hb.postDataAction,Db),yield zo(hb.postCodeAction,Rb),yield zo(hb.loadScope,_b),yield zo(hb.deleteWebhookConfigAction,Ub),yield zo(hb.postWebhookTestAction,Mb),yield zo(hb.postWebhookRetryAction,Nb),yield qo(hb.loadWebhookLogsAction,$b)},storeName:It,initialState:pb,reducer:Sb,actions:hb};function xb(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,t.payload)}}}function Vb(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>w({},n,{[e]:t(n[e],i)})}}function jb(e){return Vb(e,((e,t)=>w({},e,{loading:t.payload})))}function Wb(e){return Vb(e,((e,t)=>w({},e,{error:t.payload,loading:!1})))}const Kb={loading:!1,error:null,fetching:!0,plans:[]},{actions:Gb,reducer:Bb,name:zb}=lt({name:"subscriptions/plans",initialState:Kb,reducers:w({},xb())}),qb=w({loadPlans:at(`${zb}/loadPlans`)},Gb),Hb={loading:!1,error:null,fetching:!0,config:null},Jb=w({},xb()),{actions:Yb,reducer:Qb,name:Xb}=lt({name:"subscriptions/config",initialState:Hb,reducers:Jb}),Zb=w({loadPaymentConfiguration:at(`${Xb}/loadPaymentConfiguration`)},Yb),eA={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},tA=w({},xb(),{setCancellationLoading:jb("cancellation"),setCancellationError:Wb("cancellation"),setRenewalLoading:jb("renewal"),setRenewalError:Wb("renewal")}),{reducer:nA,actions:iA,name:oA}=lt({name:"subscriptions/billing/subscription",initialState:eA,reducers:tA}),aA=w({load:at(`${oA}/loadSubscription`),cancelSubscription:at(`${oA}/cancelSubscription`),renewSubscription:at(`${oA}/renewSubscription`)},iA),rA={loading:!1,error:null,fetching:!0},lA=w({},xb()),{reducer:sA,actions:cA,name:uA}=lt({name:"subscriptions/billing/information",initialState:rA,reducers:lA}),dA=w({loadBillingInformation:at(`${uA}/loadBillingInformation`),cancelSubscription:aA.cancelSubscription,renewSubscription:aA.renewSubscription},cA),yA={loading:!1,error:null,fetching:!0},fA=w({},xb(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,t.payload)}}),{reducer:gA,actions:pA,name:SA}=lt({name:"subscriptions/billing/payment",initialState:yA,reducers:fA}),vA=w({loadPaymentMethod:at(`${SA}/loadPaymentMethod`),submitPaymentMethod:at(`${SA}/submitPaymentMethod`),submitPaymentMethodError:at(`${SA}/submitPaymentMethodError`),submitPaymentMethodSuccess:at(`${SA}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:at(`${SA}/updateBillingDetails`,(e=>({payload:e})))},pA),hA={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},mA=w({},xb(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>w({},e,{invoiceDownload:w({},e.invoiceDownload,t.payload)})}}),{reducer:bA,actions:AA,name:kA}=lt({name:"subscriptions/billing/invoices",initialState:hA,reducers:mA}),TA=w({loadInvoices:at(`${kA}/loadInvoices`),downloadInvoice:at(`${kA}/downloadInvoice`,(e=>({payload:e})))},AA),PA={information:rA,invoices:hA,paymentMethod:yA,subscription:eA},IA={invoices:TA,information:dA,paymentMethod:vA,subscription:aA},LA=xe({invoices:bA,information:sA,paymentMethod:gA,subscription:nA}),wA={fetching:!0,loading:!1,error:null,confirmed:!1},OA=w({},xb()),{actions:EA,reducer:CA,name:DA}=lt({name:"subscriptions/checkout",initialState:wA,reducers:OA}),RA=w({loadCheckout:at(`${DA}/loadCheckout`),resetCheckout:at(`${DA}/resetCheckout`),submitCheckout:at(`${DA}/submitCheckout`),confirmCheckout:at(`${DA}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:at(`${DA}/errorCheckout`,(e=>({payload:e})))},EA),_A={loading:!1,error:null,cardSetupIntentSecret:null},UA=w({},xb()),{reducer:MA,actions:NA,name:$A}=lt({name:"subscriptions/stripe",initialState:_A,reducers:UA}),FA=w({loadCustomer:at(`${$A}/loadCustomer`),createCardSetupIntentSecret:at(`${$A}/createCardSetupIntentSecret`)},NA),xA={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:VA,reducer:jA,name:WA}=lt({name:"subscriptions/vendorPublicConfig",initialState:xA,reducers:w({},xb())}),KA=w({loadVendorPublicConfiguration:at(`${WA}/loadVendorPublicConfiguration`)},VA),GA={config:Hb,plans:Kb,checkout:wA,billing:PA,stripe:_A,vendorPublicConfig:xA},BA={config:Zb,billing:IA,plans:qb,checkout:RA,stripe:FA,vendorPublicConfig:KA},zA=xe({config:Qb,billing:LA,plans:Bb,checkout:CA,stripe:MA,vendorPublicConfig:jA});let qA,HA,JA;function YA({policy:e}){return{policy:JA.AT_PERIOD_END}}function QA(e){switch(e){case xu.ACTIVE:return HA.ACTIVE;case xu.INCOMPLETE:return HA.INCOMPLETE;case xu.CANCELED:return HA.CANCELED;case xu.EXPIRED:return HA.EXPIRED;case xu.TRIALING:return HA.TRIALING;default:return HA.EXPIRED}}!function(e){e.STRIPE="Stripe"}(qA||(qA={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(HA||(HA={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(JA||(JA={}));const XA={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:xu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},ZA=[{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"}],ek=[{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:""}],tk=[{id:"id",externalId:"externalId",type:Vu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],nk={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*ik(){yield zo(aA.load,ok),yield zo(aA.cancelSubscription,rk),yield zo(aA.renewSubscription,lk)}function*ok(){const e=yield Zi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield yk(e)}function*ak(){yield qi(aA.setLoading(!0));try{const[e]=yield Yi(vd.subscriptions.getManagedSubscriptions);yield qi(aA.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield qi(aA.setError(e))}}function*rk(){const{subscription:e}=yield Zi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield qi(aA.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield qi(aA.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===xu.ACTIVE)try{yield qi(aA.setCancellationLoading(!0)),yield Yi(vd.subscriptions.cancelManagedSubscription,t),yield ak(),yield qi(aA.setCancellationLoading(!1))}catch(e){yield qi(aA.setCancellationError(e.message))}}function*lk(){const{subscription:e}=yield Zi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield qi(aA.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield qi(aA.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===ju.AT_PERIOD_END)try{yield qi(aA.setRenewalLoading(!0)),yield Yi(vd.subscriptions.renewManagedSubscription,t),yield ak(),yield qi(aA.setRenewalLoading(!1))}catch(e){yield qi(aA.setCancellationError(e.message))}}function*sk(){yield qi(aA.setLoading(!0)),yield eo(500),yield qi(aA.setState({subscription:XA,fetching:!1,loading:!1,error:null}))}function*ck(){yield zo(aA.load,sk)}function*uk(){yield zo(dA.loadBillingInformation,dk)}function*dk(){yield function*(e){const t=yield Zi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Zi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield yk(n,!1):yield qi(dA.setError(t?"Not authorized":"Internal feature failure"))}()}function*yk(e,t){yield qi(dA.setLoading(!0));try{var n,i;const o=yield Yi(vd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield Yi(vd.subscriptions.getSubscriptionPlan,a):([,l]=yield Hi([Yi(ak),Yi(vd.subscriptions.getSubscriptionPlan,a)]),s=yield Zi((e=>e.subscriptions.billing.subscription.subscription||null))),yield qi(dA.setState(w({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?HA.ACTIVE:QA(s.status),cancellation:s.cancellation&&YA(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==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield qi(dA.setError(e.message))}}function*fk(){yield function*(){var e,t;yield qi(dA.setLoading(!0)),yield eo(500),yield qi(dA.setState({loading:!1,fetching:!1,summary:{subscriptionId:XA.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Wu.Stripe,externallyManaged:!1,currentPlanId:ZA[0].id,defaultPlanId:ZA[0].id},plan:w({},ZA[0],{price:null==(e=ZA[0].price)?void 0:e.amount,currency:null==(t=ZA[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*gk(){yield zo(dA.loadBillingInformation,fk)}function*pk(){yield zo(vA.loadPaymentMethod,Sk),yield zo(vA.submitPaymentMethod,hk),yield zo(vA.submitPaymentMethodError,mk),yield zo(vA.submitPaymentMethodSuccess,bk),yield zo(vA.updatePaymentMethodBillingDetails,vk)}function*Sk(){yield qi(vA.setLoading(!0));try{const e=(yield Yi(vd.subscriptions.getPaymentMethods))[0];yield qi(vA.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield qi(vA.setError(e.message))}}function*vk({payload:e}){yield qi(vA.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Yi(vd.subscriptions.updatePaymentMethodBillingDetails,t,w({email:n},i)),yield Yi(Sk),null==o||o(!0)}catch(e){yield qi(vA.setError(e.message)),null==o||o(!1)}yield qi(vA.setLoading(!1))}function*hk(){yield qi(vA.setLoading(!0))}function*mk({payload:e}){yield qi(vA.setError(e))}function*bk(){yield qi(vA.loadPaymentMethod())}function*Ak(){yield qi(vA.setLoading(!0)),yield eo(500);const e=tk[0];yield qi(vA.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*kk(){yield zo(vA.loadPaymentMethod,Ak)}function*Tk(){yield zo(TA.loadInvoices,Pk),yield zo(TA.downloadInvoice,Ik)}function*Pk(){yield qi(TA.setLoading(!0));try{const e=(yield Yi(vd.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 qi(TA.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield qi(TA.setError(e.message))}}function*Ik({payload:e}){yield qi(TA.setInvoiceDownloadState({loading:!0,error:null}));try{yield Yi(vd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield qi(TA.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield qi(TA.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*Lk(){yield qi(TA.setLoading(!0)),yield eo(500),yield qi(TA.setState({loading:!1,fetching:!1,invoices:ek.map((e=>w({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield qi(TA.setLoading(!1))}function*wk(){yield zo(TA.loadInvoices,Lk)}function*Ok(){yield Hi([Yi(uk),Yi(pk),Yi(Tk),Yi(ik)])}function*Ek(){yield Hi([Yi(gk),Yi(kk),Yi(wk),Yi(ck)])}function*Ck(){yield zo(RA.loadCheckout,Dk),yield zo(RA.resetCheckout,Rk),yield zo(RA.submitCheckout,_k),yield zo(RA.confirmCheckout,Uk),yield zo(RA.errorCheckout,Nk)}function*Dk(){yield qi(RA.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*Rk(){yield qi(RA.setState({loading:!1,error:null,confirmed:!1}))}function*_k(){yield qi(RA.setState({loading:!0,error:null}))}function*Uk({payload:{paymentMethodId:e,planId:t}}){const n=yield Zi((e=>e.subscriptions.billing.subscription.subscription)),i=yield Zi((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===xu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield qi(RA.setState({loading:!0,error:null})),o&&a)return yield Mk(),void(yield qi(aA.setState({subscription:w({},n,{status:xu.ACTIVE})})));try{yield Yi(vd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Hi([dk(),Sk(),Pk()]),yield Mk()}catch(e){yield qi(RA.setState({loading:!1,error:e.message}))}}else yield qi(RA.setState({loading:!1,error:"Subscription not found"}))}function*Mk(){yield qi(RA.setState({loading:!1,error:null,confirmed:!0}))}function*Nk({payload:e}){yield qi(RA.setState({loading:!1,error:e}))}function*$k(){yield zo(RA.resetCheckout,Rk)}function*Fk(){yield zo(qb.loadPlans,xk)}function*xk(){yield qi(qb.setLoading(!0));try{const e=(yield Yi(vd.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 qi(qb.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield qi(qb.setError(e.message))}}function*Vk(){yield qi(qb.setLoading(!0)),yield eo(500),yield qi(qb.setState({fetching:!1,loading:!1,plans:ZA.map((e=>{var t,n;return w({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*jk(){yield zo(qb.loadPlans,Vk)}function*Wk(){yield zo(Zb.loadPaymentConfiguration,Kk)}function*Kk(){yield qi(Zb.setLoading(!0));try{(yield Yi(vd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Wu.Stripe))?yield function*(){yield qi(Zb.setLoading(!0));try{const e=yield Yi(vd.subscriptions.getStripePaymentProviderConfiguration);yield qi(Zb.setState({loading:!1,fetching:!1,config:{paymentProvider:qA.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield qi(Zb.setError(e.message))}}():yield qi(Zb.setError("Payment provider not configured"))}catch(e){yield qi(Zb.setError(e.message))}}function*Gk(){yield qi(Zb.setLoading(!0)),yield eo(500),yield qi(Zb.setState({loading:!1,fetching:!1,config:{paymentProvider:qA.STRIPE,apiKey:""}}))}function*Bk(){yield zo(Zb.loadPaymentConfiguration,Gk)}function*zk(){yield zo(FA.createCardSetupIntentSecret,qk)}function*qk({payload:e}){yield qi(FA.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Yi(vd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield qi(FA.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield qi(FA.setError(e.message))}}function*Hk(){yield zo(KA.loadVendorPublicConfiguration,Jk)}function*Jk(){yield qi(KA.setLoading(!0));try{const e=yield Yi(vd.subscriptions.getVendorPublicConfigurations);yield qi(KA.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield qi(KA.setError(e.message))}}function*Yk(){yield qi(KA.setLoading(!0)),yield eo(500),yield qi(KA.setState({fetching:!1,loading:!1,vendorPublicConfig:nk}))}function*Qk(){yield zo(KA.loadVendorPublicConfiguration,Yk)}var Xk={sagas:function*(){yield Hi([Yi(Ok),Yi(Ck),Yi(Fk),Yi(Wk),Yi(zk),Yi(Hk)])},mockSagas:function*(){yield Hi([Yi(Ek),Yi($k),Yi(jk),Yi(Bk),Yi(Qk)])},reducer:zA,actions:BA,initialState:GA,storeName:"subscriptions"},Zk={sagas:function*(){yield zo(uy.loadVendorPublicInfo,dy)},storeName:wt,initialState:ly,reducer:sy,actions:uy};const{reducer:eT}=lt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Jo.setContext(t),w({},e,{context:t}))}}}),tT=(e,t,n=!1,i,o,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,g,p,S,v;n||a||Jo.setContext(e.context);const t=$o(),h=[...it({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=ot({middleware:h,preloadedState:{root:w({},e,{previewMode:n,urlStrategy:r}),[Pm.storeName]:w({},Pm.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:w({},Pm.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Ym.storeName]:w({},Ym.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:w({},Ym.initialState.auditLogsState,null!=(f=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?f:{}),auditsMetadataState:w({},Ym.initialState.auditsMetadataState,null!=(p=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?p:{})}),[Xm]:w({},Qm,null!=(v=null==o?void 0:o.audits)?v:{}),[Fb.storeName]:Fb.initialState,[Xk.storeName]:Xk.initialState,[Zk.storeName]:Zk.initialState},reducer:xe({root:eT,[Pm.storeName]:Pm.reducer,[Ym.storeName]:Ym.reducer,[Xm]:eb,[Fb.storeName]:Fb.reducer,[Xk.storeName]:Xk.reducer,[Zk.storeName]:Zk.reducer})});const m=function*(){yield Hi([Yi(Pm.sagas),Yi(Ym.sagas),Yi(db),Yi(Fb.sagas),Yi(Xk.sagas),Yi(Zk.sagas)])},b=function*(){yield Hi([Yi(Pm.mockSagas),Yi(Ym.mockSagas),Yi(Xk.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(Yn.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var nT=n(714),iT=n.n(nT);function oT(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function aT(e){if(e.type)return e;if("#"===e.charAt(0))return aT(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 rT(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 lT(e){if(0===e.indexOf("#"))return e;const{values:t}=aT(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 sT(e,t){return e=aT(e),t=oT(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,rT(e)}function cT(e,t){if(e=aT(e),t=oT(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 rT(e)}function uT(e,t){if(e=aT(e),t=oT(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 rT(e)}const dT=e=>{if(e)return{main:e,light:lT(uT(e,.4)),dark:lT(cT(e,.15)),hover:lT(cT(e,.15)),active:lT(cT(e,.2))}},yT=e=>{if(e)return{main:e,light:uT(e,.7),dark:cT(e,.2)}},fT=(e,t)=>{var n,i,o,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)?w({},t,{palette:{primary:w({},dT(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:w({},dT(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:w({},dT(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:w({},yT(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:w({},yT(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:w({},yT(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:w({},yT(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},gT={},pT={},ST={},vT={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class hT{constructor(){this._theme=gT,this._themeV2=pT,this._navigation=vT,this._localizations=ST}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new hT;return n.set(e),hT._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,l;this._navigation=iT().all([null!=(t=vT)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=iT().all([null!=(i=gT)?i:{},fT(null==e?void 0:e.theme,gT)]),this._themeV2=iT().all([null!=(o=pT)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=iT().all([null!=(r=ST)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=vT,this._theme=gT,this._themeV2=pT,this._localizations=ST}}}hT._instances={};var mT={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},bT=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},AT=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},kT=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let TT,PT,IT,LT,wT,OT,ET,CT,DT,RT,_T;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(TT||(TT={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(PT||(PT={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(IT||(IT={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(LT||(LT={})),function(e){e.Invoices="invoices"}(wT||(wT={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(OT||(OT={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(ET||(ET={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(CT||(CT={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(DT||(DT={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(RT||(RT={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(_T||(_T={}));const UT={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},MT={hidden:"hidden",edit:"edit"};var NT="6.75.0-alpha.1",$T=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(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(NT),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.flags={},this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=E(D().mark((function e(){var t,n,i,o,a;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ea,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.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:hT.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=E(D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=E(D().mark((function e(){return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}l.flags=mT,e.next=13;break;case 4:return e.prev=4,e.next=7,id();case 7:l.flags=e.sent,e.next=13;break;case 10:e.prev=10,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 13:case"end":return e.stop()}}),e,null,[[4,10]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=bT(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=w({},t,{contextOptions:w({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?w({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:tT({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),L.setInstance(c,this)}var t,n,i,o;return I(e,[{key:"initContainers",value:(o=E(D().mark((function e(t){return D().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;hT.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:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=E(D().mark((function e(){return D().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=E(D().mark((function e(){var t;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=E(D().mark((function e(t){var n;return D().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,w({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),FT=function(){function e(){A(this,e)}return I(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=L.getInstance(i);e&&t?(Jo.setAccessToken(t),Jo.setUser(w({},n,{accessToken:t})),o.store.dispatch(Yn.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(Yn.loadTenants())):(Jo.setAccessToken(null),Jo.setUser(null),o.store.dispatch(Yn.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),xT=function(){function e(){A(this,e)}return I(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).hideAdminPortal()}}]),e}(),VT=function(){function e(){A(this,e)}return I(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";L.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).hideCheckoutDialog()}}]),e}(),jT=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},WT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:tT({context:a},this,!0,void 0,void 0,!0),this.options=w({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new $T(this.options,t,!0),hT.set({},t)}var t;return I(e,[{key:"render",value:(t=E(D().mark((function e(t){var n,i,o,a,r=this;return D().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,kT(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}(),KT="modern",GT=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[KT]},BT=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:tT({context:a},this,!0,void 0,void 0,!0),this.options=w({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new $T(this.options,t,!0),hT.set({},t)}var t;return I(e,[{key:"render",value:(t=E(D().mark((function e(t){var n,i,o,a,r=this;return D().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,kT(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 zT(e,t){return zT=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},zT(e,t)}function qT(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&&zT(e,t)}function HT(e,t){if(t&&("object"===k(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 JT(e){return JT=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},JT(e)}function YT(){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 QT(e,t,n){return QT=YT()?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&&zT(o,n.prototype),o},QT.apply(null,arguments)}function XT(e){var t="function"==typeof Map?new Map:void 0;return XT=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 QT(e,arguments,JT(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),zT(n,e)},XT(e)}function ZT(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=JT(e);if(t){var o=JT(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return HT(this,n)}}var eP=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new $T(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){qT(n,e);var t=ZT(n);function n(){var e;A(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 I(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=L.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=AT(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=AT(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=AT(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=AT(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=AT(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=AT(s,"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}(XT(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((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 l(e,n,s){(s=s||{}).arrayMerge=s.arrayMerge||o,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?s.arrayMerge(e,n,s):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 l;var n=t.customMerge(e);return"function"==typeof n?n:l}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,s):i(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 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},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,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),l=new O(i||[]);return r(a,"_invoke",{value:P(e,n,l)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,s)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,l,s){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,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 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 l=I(r,n);if(l){if(l===p)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var s=f(e,t,n);if("normal"===s.type){if(i=n.done?"completed":"suspendedYield",s.arg===p)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i="completed",n.method="throw",n.arg=s.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[s];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:D}}function D(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,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,s,(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 l=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(l&&s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return WP},AdminPortalRenderer:function(){return BP},AppHolder:function(){return L},CheckoutDialog:function(){return jP},FronteggApp:function(){return xP},HostedLogin:function(){return VP},LoginBoxRenderer:function(){return HP},createElement:function(){return TP},defaultTheme:function(){return zP},formatName:function(){return kP},getThemeAdminByName:function(){return KP},getThemeByName:function(){return qP},initialize:function(){return iI},mockFlagsList:function(){return GP},waitThemeSetter:function(){return PP}});var e={};n.r(e),n.d(e,{Delete:function(){return pa},Get:function(){return ua},Patch:function(){return ya},Post:function(){return da},PostDownload:function(){return ga},Put:function(){return fa},getBaseUrl:function(){return sa}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Qa},getSubTenantsAsTree:function(){return Xa},getTenants:function(){return Ya},switchTenant:function(){return Ja}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return Ir},MachineToMachineAuthStrategy:function(){return Lr},OAuthLogout:function(){return Yr},SocialLoginProviders:function(){return Pr},acceptInvitation:function(){return zr},activateAccount:function(){return Wr},bulkCreateIPRestriction:function(){return mr},changePhoneNumber:function(){return $s},changePhoneNumberWithVerification:function(){return Ns},checkIfAllowToRememberMfaDevice:function(){return ds},createDomainRestriction:function(){return fr},createIPRestriction:function(){return hr},createOrUpdateSessionConfigrations:function(){return Jl},createSSOConfiguration:function(){return Ss},createSSOConfigurationByMetadata:function(){return ms},createSSODomain:function(){return As},createSSOGroup:function(){return Ls},createSamlGroup:function(){return Ml},createTenantAccessToken:function(){return is},createUserAccessToken:function(){return ns},deleteAllSessionsForUser:function(){return Ql},deleteDomainRestriction:function(){return gr},deleteIPRestriction:function(){return Ar},deleteSSOConfiguration:function(){return hs},deleteSSODomain:function(){return ks},deleteSSOGroup:function(){return Os},deleteSamlGroup:function(){return Fl},deleteSessionForUser:function(){return Yl},deleteTenantAccessToken:function(){return es},deleteTenantApiToken:function(){return ss},deleteUserAccessToken:function(){return ts},deleteUserApiToken:function(){return cs},disableMFAAuthenticatorApp:function(){return ul},disableMFASMS:function(){return yl},disableMFAWebAuthn:function(){return pl},disableMfa:function(){return cl},enrollMFAAuthenticatorApp:function(){return il},enrollMFAAuthenticatorAppForLogin:function(){return vl},enrollMFASMS:function(){return al},enrollMFASMSForLogin:function(){return bl},enrollMFAWebAuthn:function(){return ll},enrollMFAWebAuthnForLogin:function(){return Pl},enrollMfa:function(){return tl},exchangeOAuthTokens:function(){return Us},forgotPassword:function(){return Qr},generateLoginResponse:function(){return Rr},generateLoginResponseFromOAuthResponse:function(){return Mr},generateLoginResponseV2:function(){return _r},getActivateAccountStrategy:function(){return jr},getCaptchaPolicy:function(){return rr},getCurrentUserSession:function(){return zl},getCurrentUserSessions:function(){return Bl},getDomainRestrictions:function(){return dr},getDomainRestrictionsConfig:function(){return yr},getGlobalSecurityPolicy:function(){return Za},getIPRestrictions:function(){return Sr},getIPRestrictionsConfig:function(){return vr},getLockoutPolicy:function(){return ir},getMFADevices:function(){return gl},getMFAStrategiesConfig:function(){return Bs},getMfaPolicy:function(){return er},getOidcConfiguration:function(){return $l},getPasswordConfigPolicy:function(){return ur},getPasswordHistoryPolicy:function(){return lr},getSSOConfigurations:function(){return gs},getSSODefaultRoles:function(){return Ps},getSSOGroups:function(){return ws},getSSOPublicConfiguration:function(){return Gl},getSamlConfiguration:function(){return El},getSamlRoles:function(){return Ul},getSamlRolesGroups:function(){return Rl},getSamlVendorConfiguration:function(){return wl},getSessionConfigurations:function(){return Hl},getSocialLoginProviders:function(){return xl},getSocialLoginProvidersV2:function(){return Vl},getTenantAccessTokensData:function(){return Zl},getTenantApiTokensData:function(){return as},getUserAccessTokensData:function(){return Xl},getUserApiTokensData:function(){return os},getUserById:function(){return us},getVendorConfig:function(){return jl},getVendorLockoutPolicy:function(){return or},getVendorMfaPolicy:function(){return tr},getVendorPasswordHistoryPolicy:function(){return sr},getVendorPublicAuthStrategiesConfig:function(){return Ks},getWebAuthnDevices:function(){return Ws},loadPasswordConfig:function(){return Zr},login:function(){return xr},loginViaSocialLogin:function(){return Wl},loginWithMfa:function(){return Vr},logout:function(){return Jr},oidcPostLogin:function(){return Gr},oidcPostLoginV2:function(){return Cs},passwordlessPostLogin:function(){return fs},passwordlessPreLogin:function(){return ys},postLogin:function(){return $r},preDisableMFASMS:function(){return dl},preDisableMFAWebAuthn:function(){return fl},preEnrollMFAAuthenticatorApp:function(){return nl},preEnrollMFAAuthenticatorAppForLogin:function(){return Sl},preEnrollMFASMS:function(){return ol},preEnrollMFASMSForLogin:function(){return ml},preEnrollMFAWebAuthn:function(){return rl},preEnrollMFAWebAuthnForLogin:function(){return Tl},preLogin:function(){return Nr},preLoginV2:function(){return Ds},preLoginWithIdpType:function(){return Fr},preVerifyMFASMSForLogin:function(){return Al},preVerifyMFAWebAuthnForLogin:function(){return Il},recoverMfaToken:function(){return el},refreshToken:function(){return qr},refreshTokenV2:function(){return Hr},resendActivationEmail:function(){return Kr},resendInvitationEmail:function(){return Br},resetPassword:function(){return Xr},resetPhoneNumber:function(){return _s},revokeSessionsForUser:function(){return ql},saveLockoutPolicy:function(){return ar},saveMfaPolicy:function(){return nr},savePasswordHistoryPolicy:function(){return cr},setSSODefaultRoles:function(){return Is},signUpUser:function(){return Kl},silentOAuthRefreshToken:function(){return Rs},testCurrentIp:function(){return kr},testCurrentIpInAllowList:function(){return Tr},updateDomainRestrictionConfig:function(){return pr},updateIPRestrictionConfig:function(){return br},updateSSOConfiguration:function(){return vs},updateSSOConfigurationByMetadata:function(){return bs},updateSSOGroup:function(){return Es},updateSamlConfiguration:function(){return Ol},updateSamlGroup:function(){return Nl},updateSamlRoles:function(){return _l},updateSamlVendorMetadata:function(){return Dl},updateTenantApiTokensData:function(){return ls},updateUserApiTokensData:function(){return rs},validateSSODomain:function(){return Ts},validateSamlDomain:function(){return Cl},verifyChangePhoneNumber:function(){return Fs},verifyInviteToken:function(){return ps},verifyMFAAuthenticatorAppForLogin:function(){return hl},verifyMFASMSForLogin:function(){return kl},verifyMFAWebAuthnForLogin:function(){return Ll},verifyMfa:function(){return sl},verifyNewDeviceSession:function(){return js},verifyResetPhoneNumber:function(){return Ms},webAuthnCreateNewDeviceSession:function(){return Vs},webAuthnPostLogin:function(){return xs},webAuthnPreLogin:function(){return Gs}});var a={};n.r(a),n.d(a,{addUser:function(){return Qs},changePassword:function(){return Js},createInviteUserLink:function(){return ec},deleteInviteUserLink:function(){return nc},deleteUser:function(){return Xs},getInviteLinkConfiguration:function(){return oc},getInviteUserLink:function(){return ic},getProfile:function(){return zs},loadAvailablePermissions:function(){return rc},loadAvailableRoles:function(){return ac},loadStats:function(){return lc},loadUsers:function(){return Ys},resendActivationLink:function(){return sc},resendInvitationLink:function(){return cc},resendInvitationLinkToAllTenants:function(){return uc},updateInviteUserLink:function(){return tc},updateProfile:function(){return qs},updateProfileImage:function(){return Hs},updateUser:function(){return Zs}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return gc},getCurrentUserIpMetadata:function(){return yc},getIpAdressMetadata:function(){return Sc},getNotificationsMetadata:function(){return fc},getSamlMetadata:function(){return pc}});var l={};n.r(l),n.d(l,{downloadReport:function(){return Pc},getReport:function(){return Ac},getReports:function(){return bc},renderReport:function(){return kc},scheduleReport:function(){return Tc},sendReport:function(){return Ic}});var s={};n.r(s),n.d(s,{getNotifications:function(){return Lc},markAllAsRead:function(){return wc},updateNotificationIsPinned:function(){return Oc},updateNotificationStatus:function(){return Ec}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Rc},getAudits:function(){return Cc},getAuditsStats:function(){return Uc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return qc},deleteEmailSubscriptions:function(){return Bc},deleteSMSConfiguration:function(){return Zc},deleteSMSSubscriptions:function(){return Qc},deleteSlackConfiguration:function(){return xc},deleteWebhooksConfiguration:function(){return nu},getCategories:function(){return ru},getChannelMaps:function(){return lu},getEmailConfiguration:function(){return Wc},getSMSConfiguration:function(){return Hc},getSlackChannels:function(){return $c},getSlackConfiguration:function(){return Nc},getSlackScope:function(){return Fc},getWebhookLog:function(){return iu},getWebhooksConfigurations:function(){return eu},patchEmailConfiguration:function(){return Kc},patchSMSConfiguration:function(){return Yc},postEmailConfiguration:function(){return jc},postSMSConfiguration:function(){return Jc},postSlackCode:function(){return Vc},postSlackConfiguration:function(){return Gc},postWebhookRetry:function(){return au},postWebhookTest:function(){return ou},postWebhooksConfiguration:function(){return tu},putEmailSubscriptions:function(){return zc},putSMSSubscriptions:function(){return Xc}});var d={};n.r(d),n.d(d,{getSettings:function(){return cu},updateSettings:function(){return su}});var y={};n.r(y),n.d(y,{addRole:function(){return pu},attachPermissionToRoles:function(){return mu},attachPermissionsToRole:function(){return vu},deleteRole:function(){return gu},getPermissionCategories:function(){return bu},getPermissions:function(){return hu},getRoles:function(){return fu},updateRole:function(){return Su}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return Xu},ISubscriptionStatus:function(){return Yu},PaymentMethodType:function(){return Qu},ProviderType:function(){return Zu},TenantCreatedAction:function(){return td},TrialEndAction:function(){return ed},cancelManagedSubscription:function(){return Ou},cancelSubscription:function(){return Tu},createStripeCustomer:function(){return Wu},createStripePaymentMethodSetupIntentSecret:function(){return Ku},createSubscription:function(){return xu},createTenantConfiguration:function(){return qu},getManagedSubscription:function(){return Lu},getManagedSubscriptions:function(){return Eu},getPaymentMethod:function(){return $u},getPaymentMethods:function(){return Fu},getPaymentProviders:function(){return Hu},getStripeCustomer:function(){return Vu},getStripePaymentProviderConfiguration:function(){return ju},getSubscription:function(){return ku},getSubscriptionInvoice:function(){return _u},getSubscriptionInvoicePdf:function(){return Mu},getSubscriptionInvoices:function(){return Ru},getSubscriptionPlan:function(){return Uu},getSubscriptionPlans:function(){return Cu},getSubscriptionSummaries:function(){return Bu},getSubscriptions:function(){return Au},getTenantConfiguration:function(){return zu},getVendorPublicConfigurations:function(){return Ju},renewManagedSubscription:function(){return wu},renewSubscription:function(){return Pu},updateManagedSubscription:function(){return Du},updatePaymentMethodBillingDetails:function(){return Gu},updateSubscription:function(){return Iu}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return nd}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return rd},addUserToTenantAndSubTenants:function(){return od},loadAllUsers:function(){return id},removeUserFromTenantAndSubTenants:function(){return ad},removeUserRolesFromSubTenants:function(){return ld},setUserRolesForSubTenants:function(){return sd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return ud},loadFeatureFlags:function(){return dd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return Sd},createConfiguration:function(){return pd},deleteConfiguration:function(){return gd},getConfigs:function(){return yd},updateConfiguration:function(){return fd}});var h={};n.r(h),n.d(h,{impersonate:function(){return vd}});var m={};n.r(m),n.d(m,{AuthStrategyEnum:function(){return Ir},ContextHolder:function(){return aa},FeatureFlags:function(){return ud},FronteggApiError:function(){return la},FronteggContext:function(){return ra},ISubscriptionCancellationPolicy:function(){return Xu},ISubscriptionStatus:function(){return Yu},MFAStrategyEnum:function(){return bd},MachineToMachineAuthStrategy:function(){return Lr},PaymentMethodType:function(){return Qu},ProviderType:function(){return Zu},RestrictionType:function(){return Fn},ScimConnectionSource:function(){return wd},SecondaryAuthStrategy:function(){return hd},SocialLoginProviders:function(){return Pr},TenantType:function(){return kd},UserManagedByEnum:function(){return Ad},WebAuthnDeviceType:function(){return md},api:function(){return Dd},countConfigurationUsers:function(){return Sd},createConfiguration:function(){return pd},default:function(){return Cd},deleteConfiguration:function(){return gd},fetch:function(){return e},fronteggAuthApiRoutes:function(){return Pd},fronteggLogoutApiRoutes:function(){return Td},fronteggRefreshTokenUrl:function(){return Id},fronteggSilentRefreshTokenUrl:function(){return Ld},fronteggTenantsUrl:function(){return Od},fronteggUsersUrl:function(){return Ed},getConfigs:function(){return yd},loadFeatureFlags:function(){return dd},updateConfiguration:function(){return fd}});var b={};function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e){return k="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},k(e)}function T(e){var t=function(e,t){if("object"!==k(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==k(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===k(t)?t:String(t)}function P(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,T(i.key),i)}}function I(e,t,n){return t&&P(e.prototype,t),n&&P(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(b),n.d(b,{AccountPageFields:function(){return OP},DomainRestrictionsTabFields:function(){return _P},GeneralSettingsTabFields:function(){return UP},InviteUserModalFields:function(){return EP},IpRestrictionsTabFields:function(){return RP},Metadata:function(){return AP},PrivacyPageFields:function(){return LP},ProfilePageFields:function(){return IP},SecurityPageTabs:function(){return DP},SessionManagementTabFields:function(){return CP},SsoPageTabs:function(){return MP},SubscriptionsPageFields:function(){return wP},alpha:function(){return dP},fieldAppearance:function(){return NP},tabAppearance:function(){return FP}});var L=function(){function e(){A(this,e)}return I(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},E.apply(this,arguments)}function O(e,t,n,i,o,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(i,o)}function w(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){O(a,i,o,r,l,"next",e)}function l(e){O(a,i,o,r,l,"throw",e)}r(void 0)}))}}L._apps={};var D=n(841),C=n.n(D);function U(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 R(e){return!!e&&!!e[me]}function _(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)===be}(e)||Array.isArray(e)||!!e[he]||!!e.constructor[he]||x(e)||V(e))}function M(e,t,n){void 0===n&&(n=!1),0===N(e)?(n?Object.keys:Ae)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function N(e){var t=e[me];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:x(e)?2:V(e)?3:0}function F(e,t){return 2===N(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $(e,t,n){var i=N(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function G(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function x(e){return pe&&e instanceof Map}function V(e){return ge&&e instanceof Set}function W(e){return e.o||e.t}function j(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=ke(e);delete t[me];for(var n=Ae(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 K(e,t){return void 0===t&&(t=!1),z(e)||R(e)||!_(e)||(N(e)>1&&(e.set=e.add=e.clear=e.delete=B),Object.freeze(e),t&&M(e,(function(e,t){return K(t,!0)}),!0)),e}function B(){U(2)}function z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function q(e){var t=Te[e];return t||U(18,e),t}function H(){return ye}function J(e,t){t&&(q("Patches"),e.u=[],e.s=[],e.v=t)}function Y(e){Q(e),e.p.forEach(Z),e.p=null}function Q(e){e===ye&&(ye=e.l)}function X(e){return ye={p:[],l:ye,h:e,m:!0,_:0}}function Z(e){var t=e[me];0===t.i||1===t.i?t.j():t.O=!0}function ee(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||q("ES5").S(t,e,i),i?(n[me].P&&(Y(t),U(4)),_(e)&&(e=te(t,e),t.l||ie(t,e)),t.u&&q("Patches").M(n[me].t,e,t.u,t.s)):e=te(t,n,[]),Y(t),t.u&&t.v(t.u,t.s),e!==ve?e:void 0}function te(e,t,n){if(z(t))return t;var i=t[me];if(!i)return M(t,(function(o,a){return ne(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ie(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=j(i.k):i.o;M(3===i.i?new Set(o):o,(function(t,a){return ne(e,i,o,t,a,n)})),ie(e,o,!1),n&&e.u&&q("Patches").R(i,n,e.u,e.s)}return i.o}function ne(e,t,n,i,o,a){if(R(o)){var r=te(e,o,a&&t&&3!==t.i&&!F(t.D,i)?a.concat(i):void 0);if($(n,i,r),!R(r))return;e.m=!1}if(_(o)&&!z(o)){if(!e.h.F&&e._<1)return;te(e,o),t&&t.A.l||ie(e,o)}}function ie(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&K(t,n)}function oe(e,t){var n=e[me];return(n?W(n):e)[t]}function ae(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 re(e){e.P||(e.P=!0,e.l&&re(e.l))}function le(e){e.o||(e.o=j(e.t))}function se(e,t,n){var i=x(t)?q("MapSet").N(t,n):V(t)?q("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:H(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Pe;n&&(o=[i],a=Ie);var r=Proxy.revocable(o,a),l=r.revoke,s=r.proxy;return i.k=s,i.j=l,s}(t,n):q("ES5").J(t,n);return(n?n.A:H()).p.push(i),i}function ce(e){return R(e)||U(22,e),function e(t){if(!_(t))return t;var n,i=t[me],o=N(t);if(i){if(!i.P&&(i.i<4||!q("ES5").K(i)))return i.t;i.I=!0,n=ue(t,o),i.I=!1}else n=ue(t,o);return M(n,(function(t,o){i&&function(e,t){return 2===N(e)?e.get(t):e[t]}(i.t,t)===o||$(n,t,e(o))})),3===o?new Set(n):n}(e)}function ue(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return j(e)}var de,ye,fe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),pe="undefined"!=typeof Map,ge="undefined"!=typeof Set,Se="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ve=fe?Symbol.for("immer-nothing"):((de={})["immer-nothing"]=!0,de),he=fe?Symbol.for("immer-draftable"):"__$immer_draftable",me=fe?Symbol.for("immer-state"):"__$immer_state",be=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Ae="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,ke=Object.getOwnPropertyDescriptors||function(e){var t={};return Ae(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Te={},Pe={get:function(e,t){if(t===me)return e;var n=W(e);if(!F(n,t))return function(e,t,n){var i,o=ae(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||!_(i)?i:i===oe(e.t,t)?(le(e),e.o[t]=se(e.A.h,i,e)):i},has:function(e,t){return t in W(e)},ownKeys:function(e){return Reflect.ownKeys(W(e))},set:function(e,t,n){var i=ae(W(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=oe(W(e),t),a=null==o?void 0:o[me];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(G(n,o)&&(void 0!==n||F(e.t,t)))return!0;le(e),re(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!==oe(e.t,t)||t in e.t?(e.D[t]=!1,le(e),re(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=W(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(){U(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){U(12)}},Ie={};M(Pe,(function(e,t){Ie[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ie.deleteProperty=function(e,t){return Ie.set.call(this,e,t,void 0)},Ie.set=function(e,t,n){return Pe.set.call(this,e[0],t,n,e[0])};var Le=function(){function e(e){var t=this;this.g=Se,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),l=1;l<i;l++)r[l-1]=arguments[l];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&U(6),void 0!==i&&"function"!=typeof i&&U(7),_(e)){var l=X(t),s=se(t,e,void 0),c=!0;try{r=n(s),c=!1}finally{c?Y(l):Q(l)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return J(l,i),ee(e,l)}),(function(e){throw Y(l),e})):(J(l,i),ee(r,l))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ve&&(r=void 0),t.F&&K(r,!0),i){var u=[],d=[];q("Patches").M(e,r,u,d),i(u,d)}return r}U(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){_(e)||U(8),R(e)&&(e=ce(e));var t=X(this),n=se(this,e,void 0);return n[me].C=!0,Q(t),n},t.finishDraft=function(e,t){var n=(e&&e[me]).A;return J(n,t),ee(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Se&&U(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=q("Patches").$;return R(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ee=new Le,Oe=Ee.produce,we=(Ee.produceWithPatches.bind(Ee),Ee.setAutoFreeze.bind(Ee),Ee.setUseProxies.bind(Ee),Ee.applyPatches.bind(Ee),Ee.createDraft.bind(Ee),Ee.finishDraft.bind(Ee),Oe);function De(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ce(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 Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(n),!0).forEach((function(t){De(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ce(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(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 _e="function"==typeof Symbol&&Symbol.observable||"@@observable",Me=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ne={INIT:"@@redux/INIT"+Me(),REPLACE:"@@redux/REPLACE"+Me(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Me()}};function Fe(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 $e(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Re(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Re(1));return n($e)(e,t)}if("function"!=typeof e)throw new Error(Re(2));var o=e,a=t,r=[],l=r,s=!1;function c(){l===r&&(l=r.slice())}function u(){if(s)throw new Error(Re(3));return a}function d(e){if("function"!=typeof e)throw new Error(Re(4));if(s)throw new Error(Re(5));var t=!0;return c(),l.push(e),function(){if(t){if(s)throw new Error(Re(6));t=!1,c();var n=l.indexOf(e);l.splice(n,1),r=null}}}function y(e){if(!Fe(e))throw new Error(Re(7));if(void 0===e.type)throw new Error(Re(8));if(s)throw new Error(Re(9));try{s=!0,a=o(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(Re(10));o=e,y({type:Ne.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Re(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[_e]=function(){return this},e}return y({type:Ne.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[_e]=p,i}function Ge(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:Ne.INIT}))throw new Error(Re(12));if(void 0===n(void 0,{type:Ne.PROBE_UNKNOWN_ACTION()}))throw new Error(Re(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},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(Re(14));o[s]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function xe(){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 Ve(){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(Re(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=xe.apply(void 0,a)(n.dispatch),Ue(Ue({},n),{},{dispatch:i})}}}function We(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 je=We();je.withExtraArgument=We;var Ke,Be=je,ze=(Ke=function(e,t){return Ke=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])},Ke(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}Ke(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),qe=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},He=Object.defineProperty,Je=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Ye=Object.prototype.hasOwnProperty,Qe=Object.prototype.propertyIsEnumerable,Xe=function(e,t,n){return t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ze=function(e,t){for(var n in t||(t={}))Ye.call(t,n)&&Xe(e,n,t[n]);if(Je)for(var i=0,o=Je(t);i<o.length;i++)n=o[i],Qe.call(t,n)&&Xe(e,n,t[n]);return e},et="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?xe:xe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var tt=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 ze(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,qe([void 0],e[0].concat(this)))):new(t.bind.apply(t,qe([void 0],e.concat(this))))},t}(Array);function nt(e){return _(e)?we(e,(function(){})):e}function it(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new tt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Be):i.push(Be.withExtraArgument(n.extraArgument))),i}function ot(e){var t,n=function(e){return it(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,l=void 0===r?n():r,s=i.devTools,c=void 0===s||s,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=Ge(a)}var p=l;"function"==typeof p&&(p=p(n));var g=Ve.apply(void 0,p),S=xe;c&&(S=et(Ze({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=qe([g],f):"function"==typeof f&&(v=f(v)),$e(t,d,S.apply(void 0,v))}function at(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 Ze(Ze({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 rt(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 lt(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:nt(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},l={},s={};function c(){var t="function"==typeof e.extraReducers?rt(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,s=t[2],c=void 0===s?void 0:s,u=Ze(Ze({},o),l);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?rt(t):[t,n,i],r=a[0],l=a[1],s=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return nt(e())};else{var c=nt(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=qe([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 i;if(R(e))return void 0===(i=n(e,t))?e:i;if(_(e))return we(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,l[c]=n,s[e]=i?at(c,i):at(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 st="listenerMiddleware";at(st+"/add"),at(st+"/removeAll"),at(st+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[me];return Pe.get(t,e)},set:function(t){var n=this[me];Pe.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][me];if(!o.P)switch(o.i){case 5:i(o)&&re(o);break;case 4:n(o)&&re(o)}}}function n(e){for(var t=e.t,n=e.k,i=Ae(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==me){var r=t[a];if(void 0===r&&!F(t,a))return!0;var l=n[a],s=l&&l[me];if(s?s.t!==r:!G(l,r))return!0}}var c=!!t[me];return i.length!==Ae(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){Te[e]||(Te[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=ke(n);delete a[me];for(var r=Ae(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)}(i,t),a={i:i?5:4,A:n?n.A:H(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,me,{value:a,writable:!0}),o},S:function(e,n,o){o?R(n)&&n[me].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[me];if(n){var o=n.t,a=n.k,r=n.D,l=n.i;if(4===l)M(a,(function(t){t!==me&&(void 0!==o[t]||F(o,t)?r[t]||e(a[t]):(r[t]=!0,re(n)))})),M(o,(function(e){void 0!==a[e]||F(a,e)||(r[e]=!1,re(n))}));else if(5===l){if(i(n)&&(re(n),r.length=!0),a.length<o.length)for(var s=a.length;s<o.length;s++)r[s]=!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 ct=(e,t)=>n=>E({},n,{[e]:t[e]}),ut=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),dt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return E({},n,{[e]:E({},n[e],{[t]:E({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),yt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{loaders:E({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{errors:E({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),pt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),gt=(e,t,n)=>i=>{var o;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(o=i[e])?void 0:o[t],n)})})},St=(e=500)=>new Promise((t=>setTimeout(t,e))),vt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ht=new Uint8Array(256);for(let e=0;e<vt.length;e++)ht[vt.charCodeAt(e)]=e;const mt=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,l,s=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=ht[e.charCodeAt(i)],a=ht[e.charCodeAt(i+1)],r=ht[e.charCodeAt(i+2)],l=ht[e.charCodeAt(i+3)],c[s++]=o<<2|a>>4,c[s++]=(15&a)<<4|r>>2,c[s++]=(3&r)<<6|63&l;return c.buffer},bt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(bt(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+=vt[t[i]>>2],o+=vt[(3&t[i])<<4|t[i+1]>>4],o+=vt[(15&t[i+1])<<2|t[i+2]>>6],o+=vt[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]=bt(e[n]);return t}return e};let At,kt,Tt;!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"}(At||(At={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(kt||(kt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Tt||(Tt={}));const Pt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",It="HOSTED_LOGIN_VERIFIER_KEY",Lt="auth",Et="connectivity",Ot="auditLogs",wt="vendor",Dt={flow:kt.Login,step:At.preLogin,loading:!1,email:"",tenants:[]},Ct={setLoginState:ut("loginState"),resetLoginState:ct("loginState",{loginState:Dt})},Ut={requestAuthorize:at("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:at("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:at("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:at("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:at("auth/afterAuthNavigation"),preLogin:at("auth/preLogin",(e=>({payload:e}))),postLogin:at("auth/postLogin",(e=>({payload:e}))),login:at("auth/login",(e=>({payload:e}))),loginWithMfa:at("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:at("auth/recoverMfa",(e=>({payload:e}))),logout:at("auth/logout",(e=>({payload:e}))),silentLogout:at("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:at("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:at("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:at("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:at("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:at("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:at("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:at("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:at("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:at("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:at("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:at("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:at("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:at("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:at("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:at("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:at("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:at("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:at("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:at("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:at("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:at("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Rt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Rt||(Rt={}));const _t={step:Rt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Mt={setActivateState:ut("activateState"),resetActivateState:ct("activateState",{activateState:_t}),setActivateStrategyState:dt("activateState","activationStrategy")},Nt={activateAccount:at("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:at("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:at("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:at("auth/resendActivationEmail",(e=>({payload:e})))};let Ft;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Ft||(Ft={}));const $t={step:Ft.validate},Gt={setAcceptInvitationState:ut("acceptInvitationState"),resetAcceptInvitationState:ct("acceptInvitationState",{acceptInvitationState:$t})},xt={acceptInvitation:at("auth/acceptInvitation",(e=>({payload:e})))};let Vt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Vt||(Vt={}));const Wt={step:Vt.forgotPassword,loading:!1,email:"",passwordConfig:null},jt={setForgotPasswordState:ut("forgotPasswordState"),resetForgotPasswordState:ct("forgotPasswordState",{forgotPasswordState:Wt})},Kt={forgotPassword:at("auth/forgotPassword",(e=>({payload:e}))),resetPassword:at("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:at("auth/loadPasswordConfig",(e=>({payload:e})))};let Bt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Bt||(Bt={}));const zt={step:Bt.ResetPhoneNumber,loading:!1},qt={setResetPhoneNumberState:ut("resetPhoneNumberState"),resetResetPhoneNumberState:ct("resetPhoneNumberState",{resetPhoneNumberState:zt})},Ht={resetPhoneNumber:at("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:at("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:at("auth/changePhoneNumber",(e=>({payload:e})))},Jt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Yt={setSSOLoader:yt("ssoState"),setSSOError:ft("ssoState"),setSSOState:ut("ssoState"),resetSSOState:ct("ssoState",{ssoState:Jt})},Qt={loadSSOConfigurationsV2:at("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:at("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:at("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:at("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:at("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:at("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:at("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:at("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:at("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:at("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:at("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:at("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:at("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:at("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:at("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:at("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:at("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:at("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:at("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:at("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:at("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:at("auth/oidcPostlogin",(e=>({payload:e})))},Xt={loading:!1,error:null},Zt={setProfileState:ut("profileState"),resetProfileState:ct("profileState",{profileState:Xt})},en={loadProfile:at("auth/loadProfile"),saveProfile:at("auth/saveProfile",(e=>({payload:e}))),changePassword:at("auth/changePassword",(e=>({payload:e})))};let tn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(tn||(tn={}));const nn={step:tn.verify,loading:!1,saving:!1},on={setMfaState:ut("mfaState"),resetMfaState:ct("mfaState",{mfaState:nn})},an={enrollMfa:at("auth/enrollMfa"),getMFADevices:at("auth/getMFADevices"),getMFAStrategies:at("auth/getMFAStrategies"),verifyMfa:at("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:at("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:at("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:at("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:at("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:at("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:at("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:at("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:at("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:at("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:at("auth/disableMfaWebAuthn",(e=>({payload:e})))},rn={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}},ln={setTeamLoader:yt("teamState"),setTeamError:ft("teamState"),setTeamState:ut("teamState"),resetTeamState:ct("teamState",{teamState:rn})},sn={loadUsers:at("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:at("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:at("auth/loadRoles",(e=>({payload:e}))),addUser:at("auth/addUser",(e=>({payload:e}))),addUsersBulk:at("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:at("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:at("auth/updateUser",(e=>({payload:e}))),deleteUser:at("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:at("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:at("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:at("auth/lockUser",(e=>({payload:e}))),resendActivationLink:at("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:at("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:at("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:at("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:at("auth/getInvitationLink"),createInvitationLink:at("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:at("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:at("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:at("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:at("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:at("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:at("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:at("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:at("auth/closeLockUserDialog",(e=>({payload:e})))},cn={firstLoad:!0,loading:!1,error:""},un={setSocialLoginsState:ut("socialLoginState"),resetSocialLoginsState:ct("socialLoginState",{socialLoginState:cn})},dn={loadSocialLoginsConfiguration:at("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:at("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:at("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:at("auth/setSocialLoginError",(e=>({payload:e})))};let yn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(yn||(yn={}));const fn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:yn.SignUp},pn={setSignUpState:ut("signUpState"),resetSignUpState:ct("signUpState",{signUpState:fn})},gn={signUpUser:at("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:at("auth/resetSignUpStateSoft")},Sn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},vn={setApiTokensLoader:yt("apiTokensState"),setApiTokensError:ft("apiTokensState"),setApiTokensState:ut("apiTokensState"),resetApiTokensState:ct("apiTokensState",{apiTokensState:Sn})},hn={loadApiTokens:at("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:at("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:at("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:at("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:at("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:at("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:at("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:at("auth/deleteTenantApiToken",(e=>({payload:e})))},mn={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}},bn={setSecurityPolicyState:ut("securityPolicyState"),setSecurityPolicyGlobalState:dt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:dt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:dt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:dt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:dt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:dt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:dt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:dt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:dt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:dt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:dt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ct("securityPolicyState",{securityPolicyState:mn})},An={loadSecurityPolicy:at("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:at("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:at("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:at("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:at("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:at("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:at("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:at("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:at("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:at("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:at("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:at("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:at("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:at("auth/loadPublicAuthStrategiesPolicy")},kn={loading:!1},Tn={setAccountSettingsState:ut("accountSettingsState"),resetAccountSettingsState:ct("accountSettingsState",{accountSettingsState:kn})},Pn={loadAccountSettings:at("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:at("auth/saveAccountSettings",(e=>({payload:e})))},In={tenants:[],subTenants:[],loading:!0,tenantTree:null},Ln={setTenantsState:ut("tenantsState"),resetTenantsState:ct("tenantsState",{tenantsState:In})},En={switchTenant:at("auth/switchTenant",(e=>({payload:e}))),loadTenants:at("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:at("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:at("auth/loadSubTenantsTree",(e=>({payload:e})))},On={loading:!1,roles:[],permissions:[],permissionCategories:[]},wn={setRolesState:ut("rolesState"),resetRolesState:ct("rolesState",{rolesState:On})},Dn={loadRolesAndPermissions:at("auth/loadRoles",(e=>({payload:e}))),addRole:at("auth/addRole",(e=>({payload:e}))),updateRole:at("auth/updateRole",(e=>({payload:e}))),deleteRole:at("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:at("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:at("auth/attachPermissionToRoles",(e=>({payload:e})))},Cn={loading:!1,sessions:[]},Un={setSessionsState:ut("sessionsState"),resetSessionsState:ct("sessionsState",{sessionsState:Cn})},Rn={loadUserSessions:at("auth/loadUserSessions"),loadCurrentUserSession:at("auth/loadCurrentUserSession"),deleteUserSession:at("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:at("auth/deleteAllUserSessions"),revokeUserSessions:at("auth/revokeUserSessions",(e=>({payload:e})))},_n={loading:!1,configurations:{}},Mn={setSessionsPolicyState:ut("sessionsPolicyState"),resetSessionsPolicyState:ct("sessionsPolicyState",{sessionsPolicyState:_n})},Nn={loadSessionsPolicy:at("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:at("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Fn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Fn||(Fn={}));const $n={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Fn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Gn={setRestrictionsState:ut("restrictionsState"),setIpRestrictionsState:dt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:dt("restrictionsState","emailDomainRestrictions")},xn={checkIfUserIpValid:at("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:at("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:at("auth/loadIpRestrictions"),saveIpRestriction:at("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:at("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:at("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:at("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:at("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:at("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:at("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Vn={loading:!1},Wn={setProvisioningState:ut("provisioningState"),resetProvisioningState:ct("provisioningState",{provisioningState:Vn})},jn={loadProvisionConnections:at("auth/loadProvisionConnections"),createProvisionConnection:at("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:at("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:at("auth/updateProvisionConnection",(e=>({payload:e})))},Kn={devices:[]},Bn={setPasskeysState:ut("passkeysState"),resetPasskeysState:ct("passkeysState",{passkeysState:Kn})},zn={loadWebAuthnDevices:at("auth/loadWebAuthnDevices")},qn={loaders:{},errors:{},groups:[],groupsConfiguration:{enabled:!1,rolesEnabled:!1}},Hn={setUsersGroupsLoader:yt("groupsState"),setUsersGroupsError:ft("groupsState"),setGroupsState:ut("groupsState"),resetUsersGroupsState:ct("groupsState",{groupsState:qn})},Jn={loadGroups:at("auth/loadUsersGroups"),getGroupById:at("auth/getGroupById",(e=>({payload:e}))),createGroup:at("auth/createGroup",(e=>({payload:e}))),updateGroup:at("auth/updateGroup",(e=>({payload:e}))),deleteGroup:at("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:at("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:at("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:at("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:at("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:at("auth/getGroupConfiguration"),updateGroupConfiguration:at("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:at("auth/getUsers",(e=>({payload:e})))},Yn={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}},Qn={setGroupsDialogsState:ut("groupsDialogsState"),resetGroupsDialogsState:ct("groupsState",{groupsDialogsState:Yn}),openAddGroupDialog:gt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:gt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:pt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:gt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:pt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:gt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:gt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:gt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:pt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:gt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Xn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:fn,loginState:Dt,activateState:_t,acceptInvitationState:$t,forgotPasswordState:Wt,ssoState:Jt,profileState:Xt,mfaState:nn,teamState:rn,groupsState:qn,groupsDialogsState:Yn,socialLoginState:cn,apiTokensState:Sn,securityPolicyState:mn,accountSettingsState:kn,tenantsState:In,rolesState:On,resetPhoneNumberState:zt,sessionsState:Cn,sessionsPolicyState:_n,restrictionsState:$n,provisioningState:Vn,passkeysState:Kn},Zn=E({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Xn);let ei;!function(e){e.impersonating="impersonating",e.success="success"}(ei||(ei={}));const ti={step:ei.impersonating,loading:!1},ni={setImpersonateState:ut("impersonateState"),resetImpersonateState:ct("impersonateState",{impersonateState:ti})},ii={impersonate:at("impersonation/impersonate",(e=>({payload:e})))},{reducer:oi,actions:ai}=lt({name:Lt,initialState:Zn,reducers:E({resetState:e=>E({},e,Xn),setState:(e,{payload:t})=>E({},e,t),setUser:("user",(e,{payload:t})=>E({},e,{user:t}))},Ct,un,Mt,ni,Gt,jt,qt,pn,Zt,Yt,on,ln,Hn,Qn,vn,bn,Tn,Ln,wn,Un,Mn,Gn,Wn,Bn)});const ri=E({},ai,Ut,dn,Nt,xt,Kt,Ht,gn,en,Qt,an,sn,Jn,{},hn,An,Pn,En,Dn,Rn,Nn,xn,jn,ii,zn);var li=function(e){return"@@redux-saga/"+e},si=li("CANCEL_PROMISE"),ci=li("CHANNEL_END"),ui=li("IO"),di=li("MATCH"),yi=li("MULTICAST"),fi=li("SAGA_ACTION"),pi=li("SELF_CANCELLATION"),gi=li("TASK"),Si=li("TASK_CANCEL"),vi=li("TERMINATE"),hi=li("LOCATION");function mi(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 bi=function(e){return null==e},Ai=function(e){return null!=e},ki=function(e){return"function"==typeof e},Ti=function(e){return"string"==typeof e},Pi=Array.isArray,Ii=function(e){return e&&ki(e.then)},Li=function(e){return e&&ki(e.next)&&ki(e.throw)},Ei=function e(t){return t&&(Ti(t)||Di(t)||ki(t)||Pi(t)&&t.every(e))},Oi=function(e){return e&&ki(e.take)&&ki(e.close)},wi=function(e){return ki(e)&&e.hasOwnProperty("toString")},Di=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Ci=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[si]=function(){clearTimeout(n)},i},Ui=function(e){return function(){return e}},Ri=Ui(!0),_i=function(){},Mi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Ni=function(e,t){E(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Fi(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var $i=function(e){throw e},Gi=function(e){return{value:e,done:!0}};function xi(e,t,n){void 0===t&&(t=$i),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:Gi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function Vi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Wi=function(e){return Array.apply(null,new Array(e))},ji=function(e){return function(t){return e(Object.defineProperty(t,fi,{value:!0}))}},Ki=function(e){return e===vi},Bi=function(e){return e===Si},zi=function(e){return Ki(e)||Bi(e)};function qi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Pi(e)?Wi(o):{},l={};return i.forEach((function(e){var i=function(i,l){n||(l||zi(i)?(t.cancel(),t(i,l)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=_i,l[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return l[e].cancel()})))},l}function Hi(e){return{name:e.name||"anonymous",location:Ji(e)}}function Ji(e){return e[hi]}var Yi=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++},l=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},s=function(){for(var e=[];i;)e.push(l());return e};return{isEmpty:function(){return 0==i},put:function(l){var c;if(i<e)r(l);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=l,a=o=(o+1)%e;break;case 4:c=2*e,n=s(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(l)}},take:l,flush:s}}(e,4)},Qi="TAKE",Xi="CALL",Zi="FORK",eo="SELECT",to=function(e,t){var n;return(n={})[ui]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function no(e,t){return void 0===e&&(e="*"),Ei(e)?(Ai(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),to(Qi,{pattern:e})):Oi(n=e)&&n[yi]&&Ai(t)&&Ei(t)?to(Qi,{channel:e,pattern:t}):Oi(e)?(Ai(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),to(Qi,{channel:e})):void 0;var n}function io(e,t){return bi(t)&&(t=e,e=void 0),to("PUT",{channel:e,action:t})}function oo(e){var t=to("ALL",e);return t.combinator=!0,t}function ao(e,t){var n,i=null;return ki(e)?n=e:(Pi(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&Ti(n)&&ki(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function ro(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return to(Xi,ao(e,n))}function lo(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 to(Zi,ao(e,n))}function so(e){return void 0===e&&(e=pi),to("CANCEL",e)}function co(e){void 0===e&&(e=Mi);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return to(eo,{selector:e,args:n})}var uo=ro.bind(null,Ci);var yo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},fo=[],po=0;function go(e){try{ho(),e()}finally{mo()}}function So(e){fo.push(e),po||(ho(),bo())}function vo(e){try{return ho(),e()}finally{bo()}}function ho(){po++}function mo(){po--}function bo(){var e;for(mo();!po&&void 0!==(e=fo.shift());)go(e)}var Ao=function(e){return function(t){return e.some((function(e){return Lo(e)(t)}))}},ko=function(e){return function(t){return e(t)}},To=function(e){return function(t){return t.type===String(e)}},Po=function(e){return function(t){return t.type===e}},Io=function(){return Ri};function Lo(e){var t="*"===e?Io:Ti(e)?To:Pi(e)?Ao:wi(e)?To:ki(e)?ko:Di(e)?Po:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Eo={type:ci},Oo=function(e){return e&&e.type===ci};function wo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Eo)}))},(e={})[yi]=!0,e.put=function(e){if(!t)if(Oo(e))a();else for(var o=n=i,r=0,l=o.length;r<l;r++){var s=o[r];s[di](e)&&(s.cancel(),s(e))}},e.take=function(e,n){var a;void 0===n&&(n=Io),t?e(Eo):(e[di]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Fi(i,e))}))},e.close=a,e),l=r.put;return r.put=function(e){e[fi]?l(e):So((function(){l(e)}))},r}function Do(e,t){var n=e[si];ki(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Co,Uo=0,Ro=function(){return++Uo};function _o(e){e.isRunning()&&e.cancel()}var Mo=((Co={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,l=function(e){e instanceof Error?n(e,!0):!Oo(e)||r?n(e):n(vi)};try{o.take(l,Ai(a)?Lo(a):null)}catch(e){return void n(e,!0)}n.cancel=l.cancel},Co.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;So((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Ii(t)?Do(t,n):n(t)}))},Co.ALL=function(e,t,n,i){var o=i.digestEffect,a=Uo,r=Object.keys(t);if(0!==r.length){var l=qi(t,n);r.forEach((function(e){o(t[e],a,l[e],e)}))}else n(Pi(t)?[]:{})},Co.RACE=function(e,t,n,i){var o=i.digestEffect,a=Uo,r=Object.keys(t),l=Pi(t)?Wi(r.length):{},s={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||zi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,l[e]=t,n(l)))};t.cancel=_i,s[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return s[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,s[e],e)}))},Co.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=i.task;try{var s=a.apply(o,r);if(Ii(s))return void Do(s,n);if(Li(s))return void Bo(e,s,l.context,Uo,Hi(a),!1,n);n(s)}catch(e){n(e,!0)}},Co.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){bi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Co.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,l=t.detached,s=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(Li(o))return o;var a=!1;return xi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Ii(o)})}))}catch(e){return xi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Hi(t)}(c,a);vo((function(){var t=Bo(e,c,s.context,Uo,u,l,void 0);l?n(t):t.isRunning()?(s.queue.addTask(t),n(t)):t.isAborted()?s.queue.abort(t.error()):n(t)}))},Co.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()&&Fi(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Pi(t)){if(0===t.length)return void n([]);var r=qi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Co.CANCEL=function(e,t,n,i){var o=i.task;t===pi?_o(o):Pi(t)?t.forEach(_o):_o(t),n()},Co.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)}},Co.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Yi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Eo):e.isEmpty()?(n.push(i),i.cancel=function(){Fi(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Eo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Eo)}}}}(t.buffer),a=Lo(i),r=function t(n){Oo(n)||e.channel.take(t,a),o.put(n)},l=o.close;o.close=function(){r.cancel(),l()},e.channel.take(r,a),n(o)},Co.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Co.FLUSH=function(e,t,n){t.flush(n)},Co.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Co.SET_CONTEXT=function(e,t,n,i){var o=i.task;Ni(o.context,t),n()},Co);function No(e,t){return e+"?"+t}function Fo(e){var t=e.name,n=e.location;return n?t+" "+No(n.fileName,n.lineNumber):t}function $o(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 Go=null,xo=[],Vo=function(e){e.crashedEffect=Go,xo.push(e)},Wo=function(){Go=null,xo.length=0},jo=function(){var e,t,n=xo[0],i=xo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Ji(e))?t.code+" "+No(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+Fo(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+Fo(e.meta)})),[$o(xo)]).join("\n")};function Ko(e,t,n,i,o,a,r){var l;void 0===r&&(r=_i);var s,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),s(),n(e,!0)}function l(t){o.push(t),t.cont=function(l,s){a||(Fi(o,t),t.cont=_i,s?r(l):(t===e&&(i=l),o.length||(a=!0,n(i))))}}function s(){a||(a=!0,o.forEach((function(e){e.cont=_i,e.cancel()})),o=[])}return l(e),{addTask:l,cancelAll:s,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,Vo({meta:o,cancelledTasks:y}),S.isRoot){var i=jo();Wo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Si?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={})[gi]=!0,l.id=i,l.meta=o,l.isRoot=a,l.context=f,l.joiners=[],l.queue=p,l.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Si,!1))},l.cont=r,l.end=g,l.setContext=function(e){Ni(f,e)},l.toPromise=function(){return d||(d=yo(),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 Bo(e,t,n,i,o,a,r){var l=e.finalizeRunEffect((function(t,n,i){Ii(t)?Do(t,i):Li(t)?Bo(e,t,c.context,n,o,!1,i):t&&t[ui]?(0,Mo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=_i;var s={meta:o,cancel:function(){0===s.status&&(s.status=1,d(Si))},status:0},c=Ko(e,s,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),Wo()):Bi(e)?(s.status=1,d.cancel(),o=ki(t.return)?t.return(Si):{done:!0,value:Si}):o=Ki(e)?ki(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==s.status&&(s.status=3),s.cont(o.value)):y(o.value,i,d)}catch(e){if(1===s.status)throw e;s.status=2,s.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=Ro();function s(n,o){a||(a=!0,i.cancel=_i,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){Go=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),s.cancel=_i,i.cancel=function(){a||(a=!0,s.cancel(),s.cancel=_i,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},l(t,r,s)}}function zo(e,t){for(var n=e.channel,i=void 0===n?wo():n,o=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?Vi: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=Ro();if(s&&(s.rootSagaStarted=s.rootSagaStarted||_i,s.effectTriggered=s.effectTriggered||_i,s.effectResolved=s.effectResolved||_i,s.effectRejected=s.effectRejected||_i,s.effectCancelled=s.effectCancelled||_i,s.actionDispatched=s.actionDispatched||_i,s.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=xe.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=Mi;var m={channel:i,dispatch:ji(o),getState:a,sagaMonitor:s,onError:d,finalizeRunEffect:g};return vo((function(){var e=Bo(m,S,l,v,Hi(t),!0,void 0);return s&&s.effectResolved(v,e),e}))}var qo=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?wo():a,l=n.sagaMonitor,s=mi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=zo.bind(null,E({},s,{context:o,channel:r,dispatch:i,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){Ni(o,e)},c},Ho=function(e){return{done:!0,value:e}},Jo={};function Yo(e){return Oi(e)?"channel":wi(e)?String(e):ki(e)?e.name:String(e)}function Qo(e,t,n){var i,o,a,r=t;function l(t,n){if(r===Jo)return Ho(t);if(n&&!o)throw r=Jo,n;i&&i(t);var l=n?e[o](n):e[r]();return r=l.nextState,a=l.effect,i=l.stateUpdater,o=l.errorState,r===Jo?Ho(t):a}return xi(l,(function(e){return l(null,e)}),n)}function Xo(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:no(e)},l=function(e){return{done:!1,value:lo.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Qo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeEvery("+Yo(e)+", "+t.name+")")}function Zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,l={done:!1,value:no(e)},s=function(e){return{done:!1,value:lo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:so(e)}},u=function(e){return a=e},d=function(e){return r=e};return Qo({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("+Yo(e)+", "+t.name+")")}function ea(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:no(e)},l=function(e){return{done:!1,value:ro.apply(void 0,[t].concat(i,[e]))}},s=function(e){return a=e};return Qo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:s}},q2:function(){return{nextState:"q1",effect:l(a)}}},"q1","takeLeading("+Yo(e)+", "+t.name+")")}function ta(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 l={done:!1,value:ro.apply(void 0,[n].concat(a))},s={done:!1,value:uo(t)};return Qo({q1:function(){return{nextState:"q2",effect:l,errorState:"q10"}},q2:function(){return{nextState:Jo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:s}}},"q1","retry("+n.name+")")}function na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return lo.apply(void 0,[Xo,e,t].concat(i))}function ia(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return lo.apply(void 0,[Zo,e,t].concat(i))}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];return lo.apply(void 0,[ea,e,t].concat(i))}class aa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return aa.instance||(aa.instance=new aa),aa.instance}static setContext(e){aa.getInstance().context=e}static setAccessToken(e){aa.getInstance().accessToken=e}static setUser(e){aa.getInstance().user=e}static setOnRedirectTo(e){aa.getInstance().onRedirectTo=e}static setLogout(e,t){aa.getInstance().logout=n=>{n?e(n):aa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=aa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return aa.getInstance().accessToken}static getUser(){return aa.getInstance().user}static onRedirectTo(e,t){return aa.getInstance().onRedirectTo(e,t)}static logout(e){return aa.getInstance().logout(e)}}aa.instance=void 0;const ra={getContext:()=>aa.getContext(),getAccessToken:()=>aa.getAccessToken(),getUser:()=>aa.getUser(),onRedirectTo:(e,t)=>aa.onRedirectTo(e,t),logout:e=>aa.logout(e)};class la extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function sa(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const ca=async e=>{var t,n,i;const o=aa.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:aa.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];return e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=sa(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),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:E({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.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 la("Error request is too large",l.status);let e;try{e=await l.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${l.status} - ${l.statusText}`),l.status>=400&&l.status<500&&["warn"].includes(null!=(s=o.logLevel)?s:"")?console.warn(e):500===l.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new la(e,l.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await l.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await l.text()}try{return await l.json()}catch(e){return{}}},ua=async(e,t,n)=>ca(E({url:e,method:"GET",contentType:"application/json",params:t},n)),da=async(e,t,n)=>ca(E({url:e,method:"POST",contentType:"application/json",body:t},n)),ya=async(e,t,n)=>ca(E({url:e,method:"PATCH",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>ca(E({url:e,method:"PUT",contentType:"application/json",body:t},n)),pa=async(e,t,n)=>ca(E({url:e,method:"DELETE",contentType:"application/json",body:t},n)),ga=async(e,t,n,i)=>ca(E({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),Sa={v1:"/identity/resources/users/webauthn/v1/devices"},va={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ha={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ma={v1:"/identity/resources/configurations/v1"},ba={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Aa={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2"},ka={v1:"/identity/resources/permissions/v1"},Ta={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"}}},Pa={v1:"/identity/resources/roles/v1"},Ia={v1:"/identity/resources/sub-tenants/users/v1"},La={v1:"/identity/resources/impersonation/v1"},Ea={configurations:{v1:"/identity/resources/groups/v1/config"},v1:"/identity/resources/groups/v1",roles:"/roles",users:"/users"},Oa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},wa={v1:"/team/resources/members/v1"},Da={v1:"/team/resources/roles/v1"},Ca={v1:"/team/resources/stats/v1"},Ua={v1:"/team/resources/profile"},Ra={v1:"/tenants/resources/account-settings/v1"},_a={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Ma={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Na={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"}}}},Fa={v1:"/subscriptions/resources/payment-providers/v1"},$a={v1:"/subscriptions/resources/subscriptions/v1"},Ga={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},xa={v1:"/reports/engine/resources/triggers/v1"},Va="/notification",Wa="/audits",ja={v1:"/event/resources/configurations/v1"},Ka="/webhook",Ba="/oauth",za="/flags",qa="/directory/resources/v1/configurations/scim2",Ha="/directory/resources/scim/temp";async function Ja(e){return fa(`${ha.v1}/tenant`,e)}async function Ya(){return ua(`${ha.v2}/me/tenants`)}async function Qa(){return ua(_a.v1)}async function Xa(){return ua(_a.tree.v1)}async function Za(){return ua(ma.v1)}async function er(){return ua(`${ma.v1}/mfa-policy`)}async function tr(){return ua(`${ma.v1}/mfa-policy/vendor`)}async function nr(e){return e.id?ya(`${ma.v1}/mfa-policy`,e):da(`${ma.v1}/mfa-policy`,e)}async function ir(){return ua(`${ma.v1}/lockout-policy`)}async function or(){return ua(`${ma.v1}/lockout-policy/vendor`)}async function ar(e){return e.id?ya(`${ma.v1}/lockout-policy`,e):da(`${ma.v1}/lockout-policy`,e)}async function rr(){try{return await ua(`${ma.v1}/captcha-policy/public`)}catch{return null}}async function lr(){return ua(`${ma.v1}/password-history-policy`)}async function sr(){return ua(`${ma.v1}/password-history-policy/vendor`)}async function cr(e){return e.id?ya(`${ma.v1}/password-history-policy`,e):da(`${ma.v1}/password-history-policy`,e)}async function ur(){return ua(`${ma.v1}/password`)}async function dr(){return ua(`${ba.emailDomain.v1}`)}async function yr(){return ua(`${ba.emailDomain.v1}/config`)}async function fr(e){return da(`${ba.emailDomain.v1}`,e)}async function pr(e){return da(`${ba.emailDomain.v1}/config`,e)}async function gr(e){return pa(`${ba.emailDomain.v1}/${e}`)}async function Sr(e){return ua(`${ba.ip.v1}`,e)}async function vr(){return ua(`${ba.ip.v1}/config`)}async function hr(e){return da(`${ba.ip.v1}`,e)}async function mr(e){return da(`${ba.ip.v1}/bulk`,e)}async function br(e){return da(`${ba.ip.v1}/config`,e)}async function Ar(e){return pa(`${ba.ip.v1}/${e}`)}async function kr(){return da(`${ba.ip.v1}/verify`)}async function Tr(){return da(`${ba.ip.v1}/verify/allow`)}let Pr,Ir,Lr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Pr||(Pr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Ir||(Ir={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Lr||(Lr={}));class Er extends Error{constructor(e){super(e)}}const Or="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Er("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class wr extends Error{constructor(e){super(e)}}const Dr=(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(Or(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 Or(t)}})(e.split(".")[n]))}catch(e){throw new wr("Invalid token specified: "+e.message)}},Cr=["type"],Ur=["type"];async function Rr(e){if(!e.accessToken)return e;aa.setAccessToken(e.accessToken);const t=await ua(`${ha.v2}/me`),n=E({},e,e.accessToken?Dr(e.accessToken):{},t);return aa.setUser(n),n}async function _r(e){if(!e.accessToken)return{user:e};aa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ua(`${ha.v2}/me`),Ya()]),i=E({},e,e.accessToken?Dr(e.accessToken):{},t);return aa.setUser(i),{user:i,tenants:n}}async function Mr(e){aa.setAccessToken(e.id_token);const t=await ua(`${ha.v2}/me`),n=e.id_token?Dr(e.id_token):{},i=E({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return aa.setUser(i),i}async function Nr(e){try{const{address:t}=await da(`${va.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Fr(e){return da(`${va.v1}/user/saml/prelogin`,e)}async function $r(e){return Rr(await da(`${va.v1}/user/saml/postlogin`,e))}async function Gr(e){return Rr(await da(`${va.v1}/user/oidc/postlogin`,e))}async function xr(e){return Rr(await da(`${va.v1}/user`,e))}async function Vr(e){return Rr(await da(`${va.v1}/user/mfa/verify`,e))}async function Wr(e){return da(`${ha.v1}/activate`,e)}async function jr(e){return ua(`${ha.v1}/activate/strategy`,e)}async function Kr(e){return da(`${ha.v1}/activate/reset`,e)}async function Br(e){return da(`${ha.v1}/invitation/reset`,e)}async function zr(e){return da(`${ha.v1}/invitation/accept`,e)}async function qr(){return Rr(await da(`${va.v1}/user/token/refresh`))}async function Hr(){return _r(await da(`${va.v1}/user/token/refresh`))}async function Jr(){return da(`${va.v1}/logout`)}async function Yr(e){return ua(`${Ba}/logout`,e)}async function Qr(e){return da(`${ha.v1}/passwords/reset`,e)}async function Xr(e){return da(`${ha.v1}/passwords/reset/verify`,e)}async function Zr(e){return ua(`${ha.v1}/passwords/config`,e)}async function el(e){return da(`${va.v1}/user/mfa/recover`,e)}async function tl(){return da(`${ha.v1}/mfa/enroll`)}async function nl(){return da(`${ha.v1}/mfa/authenticator/enroll`)}async function il(e){return da(`${ha.v1}/mfa/authenticator/enroll/verify`,e)}async function ol(e){return da(`${ha.v1}/mfa/sms/enroll`,e)}async function al(e){return da(`${ha.v1}/mfa/sms/enroll/verify`,e)}async function rl(){return da(`${ha.v1}/mfa/webauthn/enroll`)}async function ll(e){return da(`${ha.v1}/mfa/webauthn/enroll/verify`,e)}async function sl(e){return da(`${ha.v1}/mfa/enroll/verify`,e)}async function cl(e){return da(`${ha.v1}/mfa/disable`,e)}async function ul(e,t){return da(`${ha.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function dl(e){return da(`${ha.v1}/mfa/sms/${e}/disable`)}async function yl(e,t){return da(`${ha.v1}/mfa/sms/${e}/disable/verify`,t)}async function fl(e){return da(`${ha.v1}/mfa/webauthn/${e}/disable`)}async function pl(e,t){return da(`${ha.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function gl(){return ua(`${ha.v1}/mfa/devices`)}async function Sl(e){return da(`${va.v1}/user/mfa/authenticator/enroll`,e)}async function vl(e){return da(`${va.v1}/user/mfa/authenticator/enroll/verify`,e)}async function hl(e,t){return da(`${va.v1}/user/mfa/authenticator/${e}/verify`,t)}async function ml(e){return da(`${va.v1}/user/mfa/sms/enroll`,e)}async function bl(e){return da(`${va.v1}/user/mfa/sms/enroll/verify`,e)}async function Al(e,t){return da(`${va.v1}/user/mfa/sms/${e}`,t)}async function kl(e,t){return da(`${va.v1}/user/mfa/sms/${e}/verify`,t)}async function Tl(e){return da(`${va.v1}/user/mfa/webauthn/enroll`,e)}async function Pl(e){return da(`${va.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Il(e,t){return da(`${va.v1}/user/mfa/webauthn/${e}`,t)}async function Ll(e,t){return da(`${va.v1}/user/mfa/webauthn/${e}/verify`,t)}async function El(){return ua(`${Oa.v1}/saml/configurations`)}async function Ol(e){return da(`${Oa.v1}/saml/configurations`,e)}async function wl(){return ua(`${Oa.v1}/saml/configurations/vendor-config`)}async function Dl(e){return fa(`${Oa.v1}/saml/configurations/metadata`,e)}async function Cl(){return fa(`${Oa.v1}/saml/validations/domain`)}async function Ul(){return ua(`${Oa.v1}/saml/configurations/roles/default`)}async function Rl(){return ua(`${Oa.v2}/saml/configurations/groups`)}async function _l({roleIds:e}){return da(`${Oa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ml({roleIds:e,group:t}){return da(`${Oa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Nl({roleIds:e,group:t,id:n}){return ya(`${Oa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Fl({id:e}){return pa(`${Oa.v2}/saml/configurations/groups/${e}`)}async function $l(){return ua(`${Oa.v1}/oidc/configurations`)}async function Gl(){return ua(`${Oa.v2}/configurations/public`)}async function xl(){return ua(Aa.v1)}async function Vl(){return ua(Aa.v2)}async function Wl({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:l}){const s={};return t&&(s.code=t),n&&(s.id_token=n),i&&(s.redirectUri=i),o&&(s.code_verifier=o),l&&(s.state=l),da(`${va.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:s})}async function jl(){return ua(`${ma.v1}/public`)}async function Kl(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await da(`${ha.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Rr(n):void 0,userId:i,tenantId:o}}async function Bl(){return ua(ha.sessions.currentUser.v1)}async function zl(){return ua(`${ha.sessions.currentUser.v1}/current`)}async function ql(e){return da(`${ha.sessions.v1}/revoke`,{userId:e})}async function Hl(){return ua(ha.sessions.configurations.v1)}async function Jl(e){await da(ha.sessions.configurations.v1,e)}async function Yl(e){await pa(`${ha.sessions.currentUser.v1}/${e}`)}async function Ql(){await pa(`${ha.sessions.currentUser.v1}/all`)}async function Xl(){return ua(ha.accessTokens.v1)}async function Zl(){return ua(Ta.accessTokens.v1)}async function es({id:e}){return pa(`${Ta.accessTokens.v1}/${e}`)}async function ts({id:e}){return pa(`${ha.accessTokens.v1}/${e}`)}async function ns(e){return da(ha.accessTokens.v1,e)}async function is(e){return da(Ta.accessTokens.v1,e)}async function os(){return ua(ha.apiTokens.v1)}async function as(){return ua(Ta.apiTokens.v1)}async function rs(e){return da(ha.apiTokens.v1,e)}async function ls(e){return da(Ta.apiTokens.v2,e)}async function ss({tokenId:e}){return pa(`${Ta.apiTokens.v1}/${e}`)}async function cs({tokenId:e}){return pa(`${ha.apiTokens.v1}/${e}`)}async function us({userId:e}){return ua(`${ha.v1}/${e}`)}async function ds(e){return ua(`${ma.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function ys(e){let{type:t}=e,n=mi(e,Cr);return da(`${va.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function fs(e){let{type:t}=e,n=mi(e,Ur);return da(`${va.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function ps({token:e}){return da(Ta.invites.verify.v1,{token:e})}async function gs(){return ua(`${Oa.v1}/configurations`)}async function Ss(e){return da(`${Oa.v1}/configurations`,e)}async function vs(e,t){return ya(`${Oa.v1}/configurations/${e}`,t)}async function hs(e){return pa(`${Oa.v1}/configurations/${e}`)}async function ms(e){return da(`${Oa.v1}/configurations/metadata`,e)}async function bs(e,t){return fa(`${Oa.v1}/configurations/${e}/metadata`,t)}async function As(e,t){return da(`${Oa.v1}/configurations/${e}/domains`,t)}async function ks(e,t){return pa(`${Oa.v1}/configurations/${e}/domains/${t}`)}async function Ts(e,t){return fa(`${Oa.v1}/configurations/${e}/domains/${t}/validate`)}async function Ps(e){return ua(`${Oa.v1}/configurations/${e}/roles`)}async function Is(e,t){return fa(`${Oa.v1}/configurations/${e}/roles`,t)}async function Ls(e,t){return da(`${Oa.v1}/configurations/${e}/groups`,t)}async function Es(e,{roleIds:t,group:n,id:i}){return ya(`${Oa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Os(e,t){return pa(`${Oa.v1}/configurations/${e}/groups/${t}`)}async function ws(e){return ua(`${Oa.v1}/configurations/${e}/groups`)}async function Ds(e){return da(`${va.v2}/user/sso/prelogin`,e)}async function Cs(e){return Rr(await da(`${va.v2}/user/oidc/postlogin`,e))}async function Us(e){return Mr(await da(`${Ba}/token`,e))}async function Rs(){return Mr(await da(`${Ba}/authorize/silent`))}async function _s(e){return da(`${ha.v1}/phone/reset`,e)}async function Ms(e){return da(`${ha.v1}/phone/reset/verify`,e)}async function Ns(e){return da(`${ha.v1}/phone`,e)}async function Fs(e){return da(`${ha.v1}/phone/verify`,e)}async function $s(e){return fa(`${ha.v1}/phone/change`,e)}async function Gs(e){return da(`${va.v1}/webauthn/prelogin`,e)}async function xs(e){return da(`${va.v1}/webauthn/postlogin`,e)}async function Vs(){return da(Sa.v1)}async function Ws(){return ua(Sa.v1)}async function js(e){return da(`${Sa.v1}/verify`,e)}async function Ks(){return ua(`${ma.v1}/auth/strategies/public`)}async function Bs(){return ua(`${ma.v1}/mfa/strategies`)}async function zs(e){return ua(`${ha.v2}/me`,null!=e?e:{addRoles:!0})}async function qs(e){return fa(`${ha.v2}/me`,e)}async function Hs(e){return fa(`${Ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Js(e){return da(`${ha.v1}/passwords/change`,e)}async function Ys(e){var t,n,i,o,a,r;const l=(e.filter||[]).reduce(((e,t)=>E({},e,{[t.id]:t.value})),{}),s=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 ua(wa.v1,E({pageOffset:e.pageOffset,pageSize:e.pageSize},l,s))}async function Qs(e){return da(ha.v2,E({},e,{provider:"local"}))}async function Xs(e){return pa(`${wa.v1}/${e.userId}`)}async function Zs(e){return fa(wa.v1,e)}async function ec(e){return da(Ta.invites.user.v1,E({},e))}async function tc(e){return ya(Ta.invites.user.v1,E({},e))}async function nc(){return pa(Ta.invites.user.v1)}async function ic(){return ua(Ta.invites.user.v1)}async function oc(){return ua(Ta.invites.configuration.v1)}async function ac(){return ua(Da.v1)}async function rc(){return ua(ka.v1)}async function lc(){return ua(`${Ca.v1}/members`)}async function sc(e){return da(`${wa.v1}/${e.userId}/resendActivationEmail`,{})}async function cc(e){return da(ha.v2,E({},e,{provider:"local"}))}async function uc(e){return da(ha.invitation.resendAll.v1,E({},e))}async function dc(e){var t,n;const i=await ua("/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 yc(){const e=await ua("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const fc=async()=>dc({entityName:"notifications"}),pc=async()=>dc({entityName:"saml"}),gc=async()=>dc({entityName:"audits"}),Sc=async e=>async function(e){const t=await ua(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vc=["dataFilters"],hc=["templateId","dataFilters"],mc=["dataFilters"];async function bc(e){return ua(`${Ga.v2}/tenant-reports`,e)}async function Ac(e){return ua(`${Ga.v2}/${e.id}/tenant-reports`)}async function kc(e){let{dataFilters:t}=e,n=mi(e,vc);return{html:await ua(`${xa.v1}/preview-report`,E({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Tc(e){let{templateId:t,dataFilters:n}=e,i=mi(e,hc);return da(`${Ga.v2}/${t}/tenant-reports`,E({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Pc(e){let{dataFilters:t}=e,n=mi(e,mc);const i=await ua(`${xa.v1}/preview-report`,E({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),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 Ic(e){return da(`${xa.v1}/tenant-reports`,e)}async function Lc(e){return ua(Va,{params:e})}async function Ec(e){return fa(`${Va}/status`,{params:e})}async function Oc(e){const{notificationId:t,pinStatus:n}=e;return fa(`${Va}/${n}`,{notificationId:t})}async function wc(){return da(`${Va}/status/mark-all-read`)}const Dc=["endpoint","headerProps"];async function Cc(e){return ua(Wa,e)}async function Uc(e){return ua(`${Wa}/stats`,e)}async function Rc(e){const{endpoint:t,headerProps:n}=e,i=mi(e,Dc);return ga(`${Wa}/export/${t}`,{properties:n},i)}const _c=["eventKey"],Mc=["eventKey"],Nc=()=>ua(`${Ma.v1}/slack`),Fc=()=>ua(`${Ma.v1}/slack/applications`),$c=()=>ua(`${Ma.v1}/slack/channels`),Gc=e=>e.id?ya(`${Ma.v1}/slack/subscription/${e.id}`,e):da(`${Ma.v1}/slack/subscriptions`,e),xc=e=>pa(`${Ma.v1}/slack/subscriptions/${e.id}`),Vc=e=>da(`${Ma.v1}/slack/applications/registrations`,{code:e}),Wc=()=>ua(`${Ma.v1}/emails`),jc=e=>{let{eventKey:t}=e,n=mi(e,_c);return da(`${Ma.v1}/emails/${t}`,n)},Kc=({eventKey:e,enabled:t})=>ya(`${Ma.v1}/emails/${e}`,{enabled:t}),Bc=(e,t)=>pa(`${Ma.v1}/emails/${e}/subscriptions/${t}`),zc=(e,t,n)=>fa(`${Ma.v1}/emails/${t}/subscriptions/${e}`,n),qc=e=>pa(`${Ma.v1}/emails/${e}`),Hc=()=>ua(`${Ma.v2}/sms`),Jc=e=>{let{eventKey:t}=e,n=mi(e,Mc);return da(`${Ma.v2}/sms/${t}`,n)},Yc=({eventKey:e,enabled:t})=>ya(`${Ma.v2}/sms/${e}`,{enabled:t}),Qc=(e,t)=>pa(`${Ma.v2}/sms/${e}/subscriptions/${t}`),Xc=(e,t,n)=>fa(`${Ma.v2}/sms/${t}/subscriptions/${e}`,n),Zc=e=>pa(`${Ma.v2}/sms/${e}`),eu=()=>ua(Ka),tu=e=>e._id?ya(`${Ka}/${e._id}`,e):da(`${Ka}/custom`,e),nu=e=>pa(`${Ka}/${e}`),iu=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ua(`${Ka}/logs/?${i.toString()}`)},ou=e=>da(`${Ka}/test`,e),au=e=>da(`${Ka}/logs/${e}/retries`),ru=()=>ua(`${ja.v1}/categories`),lu=e=>ua(ja.v1,{channels:e});async function su(e){return fa(Ra.v1,e)}async function cu(){return ua(Ra.v1)}const uu=["roleId"],du=["roleId"],yu=["permissionId"];async function fu(){return ua(Pa.v1)}async function pu(e){return da(Pa.v1,e)}async function gu({roleId:e}){return pa(`${Pa.v1}/${e}`)}async function Su(e){let{roleId:t}=e,n=mi(e,uu);return ya(`${Pa.v1}/${t}`,n)}async function vu(e){let{roleId:t}=e,n=mi(e,du);return fa(`${Pa.v1}/${t}/permissions`,n)}async function hu(){return ua(ka.v1)}async function mu(e){let{permissionId:t}=e,n=mi(e,yu);return fa(`${ka.v1}/${t}/roles`,n)}async function bu(){return ua(`${ka.v1}/categories`)}async function Au(){return ua(Na.subscriptions.v1)}async function ku(e){return ua(`${Na.subscriptions.v1}/${e}`)}async function Tu(e){return fa(`${Na.subscriptions.v1}/${e}/cancellations/`,{})}async function Pu(e){return fa(`${Na.subscriptions.v1}/${e}/renewals/`,{})}async function Iu(e,{paymentMethodId:t,planId:n}){return fa(`${Na.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Lu(e){return ua(`${$a.v1}/${e}`)}async function Eu(){return ua(`${$a.v1}`)}async function Ou(e){return fa(`${$a.v1}/${e}/cancellations/`,{})}async function wu(e){return fa(`${$a.v1}/${e}/renewals/`,{})}async function Du(e,{paymentMethodId:t,planId:n}){return fa(`${$a.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cu(){return ua(Na.plans.v1)}async function Uu(e){return ua(`${Na.plans.v1}/${e}`)}async function Ru(){return ua(Na.invoices.v1)}async function _u(e){return ua(`${Na.invoices.v1}/${e}`)}async function Mu(e,t){return ua(`${Na.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Nu=["email"];async function Fu(){return ua(Na.paymentMethods.v1)}async function $u(e){return ua(`${Na.paymentMethods.v1}/${e}`)}async function Gu(e,t){let{email:n}=t,i=mi(t,Nu);return ya(`${Na.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function xu(e){return da(Na.paymentProviders.stripe.subscriptions.v1,e)}async function Vu(e){return ua(`${Na.paymentProviders.stripe.customers.v1}/${e}`)}async function Wu(e){return da(`${Na.paymentProviders.stripe.customers.v1}`,e)}async function ju(){return ua(`${Na.paymentProviders.stripe.publicConfigurations.v1}`)}async function Ku(e){return da(`${Na.paymentProviders.stripe.setupIntents.v1}`,e)}async function Bu(e){return ua(`${Na.summaries.v1}/${e}`)}async function zu(e){return ua(`${Na.tenantConfiguration.v1}/${e}`)}async function qu(e){return da(`${Na.tenantConfiguration.v1}`,e)}async function Hu(){return ua(Fa.v1)}async function Ju(){return ua(`${Na.configurations.vendorPublicConfigurations.v1}`)}let Yu,Qu,Xu,Zu,ed,td;async function nd(){return ua("/vendors/public")}async function id(e){return ua(Ia.v1,e)}async function od(e){return da(Ia.v1,e)}async function ad(e){return pa(Ia.v1,e)}async function rd(e,t){return da(`${Ia.v1}/${e}/roles`,t)}async function ld(e,t){return pa(`${Ia.v1}/${e}/roles`,t)}async function sd(e,t){return ya(`${Ia.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Yu||(Yu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qu||(Qu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Xu||(Xu={})),(Zu||(Zu={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(ed||(ed={})),function(e){e.CREATE="create_customer"}(td||(td={}));const cd={flags:{}};class ud{constructor(){this._flags=cd.flags}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new ud;return n.set(e),ud._instances[t]=n,n}static getFeatureFlags(e){const t=this.getInstance();return e.map((e=>"on"===(null==t?void 0:t._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t,n;this._flags=E({},null!=(t=null==cd?void 0:cd.flags)?t:{},null!=(n=null==e?void 0:e.flags)?n:{})}}async function dd(){return ua(za)}async function yd(){return ua(`${qa}`)}async function fd(e,t){return ya(`${qa}/${e}`,t)}async function pd(e){return da(`${qa}`,e)}async function gd(e){return pa(`${qa}/${e}`)}async function Sd(e){return ua(`${Ha}/${e}/Users/count`)}async function vd(e){return da(`${La.v1}`,e)}let hd,md,bd,Ad,kd;ud._instances={},function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(hd||(hd={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(md||(md={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(bd||(bd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Ad||(Ad={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(kd||(kd={}));const Td=[`${va.v1}/logout`,`${Ba}/logout`],Pd=[...Td,`${va.v1}/user/saml/postlogin`,`${va.v2}/user/oidc/postlogin`,`${va.v1}/user`,`${va.v1}/user/mfa/verify`,`${va.v1}/user/token/refresh`,`${ha.v1}`,`${ha.v1}/signUp`,`${va.v1}/passwordless/magiclink/postlogin`,`${va.v1}/passwordless/code/postlogin`,`${va.v1}/passwordless/smscode/postlogin`,`${ha.v1}/activate`,`${ha.v1}/invitation/accept`,`${Ba}/token`,`${Ba}/authorize/silent`],Id=`${va.v1}/user/token/refresh`,Ld=`${Ba}/authorize/silent`,Ed=`${ha.v2}/me`,Od=`${ha.v2}/me/tenants`;let wd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(wd||(wd={}));const Dd={auth:o,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};var Cd={fetch:e,ContextHolder:aa,FronteggContext:ra,api:Dd,FronteggApiError:la,AuthStrategyEnum:Ir,MachineToMachineAuthStrategy:Lr,SocialLoginProviders:Pr,ISubscriptionCancellationPolicy:Xu,ISubscriptionStatus:Yu,PaymentMethodType:Qu,ProviderType:Zu};let Ud,Rd;function _d(e,t){const n=E({},e);return t.forEach((e=>{delete n[e]})),n}async function Md(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Nd(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(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"}(Ud||(Ud={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Rd||(Rd={}));const Fd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n})),$d={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Gd=E({},$d,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),xd=[{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"}],Vd={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},Wd=E({},Vd,{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}),jd={loading:!1,error:void 0,saving:!0,profile:Vd},Kd={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"},Bd={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Ir.EmailAndPassword,machineToMachineAuthStrategy:Lr.ClientCredentials},zd={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},qd={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Hd={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Jd={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},Yd={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Qd=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],Xd={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Jd,roles:Qd,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Zd=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],ey={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:[xd[0]]},ty={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:[xd[1]]},ny={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},iy=[ty,ey],oy=[ny],ay=[{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}],ry=[{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"}],ly={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},sy={isActive:!0,strategy:Fn.ALLOW},cy=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Fn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Fn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Fn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Fn.BLOCK,description:"IP 4"}],uy=[{id:"id",name:"group-name",color:"#36373c",description:"group-description",users:[{id:"23cb3a62-324f-4e5f-8738-c474046d52f0",name:"kkk",email:"kiyec12603@gmail.com",profilePictureUrl:null,createdAt:new Date}],roles:[{id:"916577c9-c5cc-4312-9725-450be7ede15f",name:"Admin"},{id:"916577c9-c5cc-4312-9725-43be7ede15f",name:"Read"},{id:"916577c9-c5cc-4312-9725-43be723e15f",name:"View"},{id:"916577c9-c5cc-4312-9725-43be7ede15f",name:"Readonly"}]},{id:"id2",name:"another-group-name",color:"#36373c",description:"group-description",users:[{id:"23cb3a62-324f-4e5f-8738-c474046d52f0",name:"Patrick Lopez",email:"lopez@gmail.com",profilePictureUrl:null,createdAt:new Date,activatedForTenant:!0},{id:"23cb62-324fe-4e5f-8738-c474046d52f0",name:"John Mayer",email:"mayer@gmail.com",profilePictureUrl:null,createdAt:new Date},{id:"23cb62-324fe-4e5f-8738-c47106d5232",name:"Michael Jackson",email:"michael@gmail.com",activatedForTenant:!0,profilePictureUrl:null,createdAt:new Date},{id:"23cb62-324fe-4e5f-8728-c4710d5232",name:"Clara Maria",email:"claramaria@gmail.com",profilePictureUrl:null,activatedForTenant:!0,createdAt:new Date},{id:"23cb62-324fe-4e5f-8728-c4710d5232",name:"Lara Smith",email:"lara@gmail.com",activatedForTenant:!0,profilePictureUrl:null,createdAt:new Date},{id:"23cb62-324fe-4e5f-8728-c4710d5232",name:"Met Wives",email:"wives@gmail.com",profilePictureUrl:null,createdAt:new Date},{id:"23cb62-324fe-4e5f-8728-c4710d5232",name:"Karin Lopez",email:"karin@gmail.com",activatedForTenant:!0,profilePictureUrl:null,createdAt:new Date},{id:"23c163-324fe-4e5f-8728-c4710d5232",name:"Betty Smith",email:"betty@gmail.com",activatedForTenant:!0,profilePictureUrl:null,createdAt:new Date}],roles:[{id:"916577c9-c5cc-4312-9725-450be7ede15f",name:"Admin"}],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}'}];let dy,yy,fy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(dy||(dy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(yy||(yy={})),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"}(fy||(fy={})),fy.profile,fy.privacy,fy.personalApiTokens,fy.account,fy.users,fy.groups,fy.security,fy.sso,fy.audits,fy.webhooks,fy.apiTokens,fy.roles,fy.subscriptions;const py=["events","url"];function*gy(){yield io(ri.setSignUpState({loading:!0}));try{const e=yield ro(Dd.auth.getVendorConfig),{allowSignups:t,allowNotVerifiedUsersLogin:n}=e;yield io(ri.setSignUpState({loading:!1,allowSignUps:t,allowNotVerifiedUsersLogin:n,firstLoad:!1})),yield io(ri.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield io(ri.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Sy(e){let{payload:{events:t,url:n}}=e,i=mi(e.payload,py);yield io(ri.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield co((e=>e.auth)),{shouldActivate:r,user:l,tenantId:s,userId:c}=yield ro(Dd.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:yy.PASSWORD,id:c,tenantId:s,createdAt:new Date})}if(aa.setAccessToken(null==l?void 0:l.accessToken),aa.setUser(l),!r&&l&&wf(l)){const t=yield Uf(l);yield io(ri.setState(t)),a(e.loginUrl)}else yield io(ri.setSignUpState({loading:!1,shouldActivate:r,stage:yn.SignUpSuccess})),yield io(ri.setState({user:l,isAuthenticated:!(null==l||!l.accessToken)})),r||(yield io(ri.loadTenants()))}catch(e){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setSignUpState({loading:!1,error:e.message}))}yield io(ri.setSignUpState({loading:!1}))}function*vy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield co((e=>e.auth.signUpState));yield io(ri.resetSignUpState()),yield io(ri.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*hy(){yield oa(ri.signUpUser,Sy),yield oa(ri.resetSignUpStateSoft,vy)}const my={setVendorState:(e,{payload:t})=>E({},e,t)},by={loadVendorPublicInfo:at("vendor/loadVendorPublicInfo")},Ay={loading:!1},{reducer:ky,actions:Ty}=lt({name:wt,initialState:Ay,reducers:E({},my)}),Py=E({},Ty,by);function*Iy(){yield io(Py.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Dd.vendor.getVendorPublicInfo();yield io(Py.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield io(Py.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const Ly=["callback"],Ey=["callback"],Oy=["callback"],wy=["callback"],Dy=["callback"],Cy=["callback"];function*Uy(){yield io(ri.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getGlobalSecurityPolicy);yield io(ri.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield io(ri.loadSecurityPolicyMfa()),yield io(ri.loadSecurityPolicyVendorMfa()),yield io(ri.loadSecurityPolicyLockout()),yield io(ri.loadSecurityPolicyVendorLockout()),yield io(ri.loadSecurityPolicyVendorPasswordHistory()),yield io(ri.loadSecurityPolicyCaptcha()),yield io(ri.loadPublicAuthStrategiesPolicy())}function*Ry(){yield io(ri.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getVendorConfig);yield io(ri.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*_y(){yield io(ri.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getVendorPublicAuthStrategiesConfig);yield io(ri.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*My(){yield io(ri.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getMfaPolicy);yield io(ri.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Ny(){yield io(ri.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getVendorMfaPolicy);yield io(ri.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*Fy(e){let{payload:{callback:t}}=e,n=mi(e.payload,Ly);yield io(ri.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield ro(Dd.auth.saveMfaPolicy,n);yield io(ri.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield io(ri.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*$y(){yield io(ri.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getLockoutPolicy);yield io(ri.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*Gy(e){let{payload:{callback:t}}=e,n=mi(e.payload,Ey);yield io(ri.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield ro(Dd.auth.saveLockoutPolicy,n);yield io(ri.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield io(ri.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xy(){yield io(ri.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getVendorLockoutPolicy);yield io(ri.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Vy(){yield io(ri.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getCaptchaPolicy);yield io(ri.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*Wy(){yield io(ri.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getPasswordHistoryPolicy);yield io(ri.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*jy(){yield io(ri.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getVendorPasswordHistoryPolicy);yield io(ri.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Ky(e){let{payload:{callback:t}}=e,n=mi(e.payload,Oy);yield io(ri.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield ro(Dd.auth.savePasswordHistoryPolicy,n);yield io(ri.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield io(ri.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*By(){yield io(ri.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getPasswordConfigPolicy);yield io(ri.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*zy(){yield oa(ri.loadSecurityPolicy,Uy),yield na(ri.saveSecurityPolicyMfa,Fy),yield na(ri.loadSecurityPolicyMfa,My),yield na(ri.loadSecurityPolicyVendorMfa,Ny),yield na(ri.saveSecurityPolicyLockout,Gy),yield na(ri.loadSecurityPolicyLockout,$y),yield na(ri.loadSecurityPolicyVendorLockout,xy),yield na(ri.loadSecurityPolicyCaptcha,Vy),yield na(ri.saveSecurityPolicyPasswordHistory,Ky),yield na(ri.loadSecurityPolicyPasswordHistory,Wy),yield na(ri.loadSecurityPolicyVendorPasswordHistory,jy),yield na(ri.loadVendorPasswordConfig,By),yield na(ri.loadPublicSecurityPolicy,Ry),yield na(ri.loadPublicAuthStrategiesPolicy,_y)}function*qy(){yield io(ri.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield io(ri.setSecurityPolicyPublicState({policy:Bd,loading:!1}))}catch(e){yield io(ri.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Hy(){yield io(ri.setSecurityPolicyGlobalState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyGlobalState({policy:Kd,loading:!1})),yield io(ri.loadSecurityPolicyMfa()),yield io(ri.loadSecurityPolicyVendorMfa()),yield io(ri.loadSecurityPolicyLockout()),yield io(ri.loadSecurityPolicyVendorLockout()),yield io(ri.loadSecurityPolicyPasswordHistory()),yield io(ri.loadSecurityPolicyVendorPasswordHistory()),yield io(ri.loadSecurityPolicyCaptcha())}function*Jy(){yield io(ri.setSecurityPolicyMfaState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyMfaState({policy:zd,loading:!1}))}function*Yy(){yield io(ri.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyVendorMfaState({policy:zd,loading:!1}))}function*Qy(e){var t;let{payload:{callback:n}}=e,i=mi(e.payload,wy);yield io(ri.setSecurityPolicyMfaState({saving:!0,error:null}));const o=E({},qd,{id:null!=(t=i.id)?t:qd.id,enforceMFAType:i.enforceMFAType});yield St(),yield io(ri.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Xy(){yield io(ri.setSecurityPolicyLockoutState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyLockoutState({policy:qd,loading:!1}))}function*Zy(){yield io(ri.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyVendorLockoutState({policy:qd,loading:!1}))}function*ef(e){let{payload:{callback:t}}=e,n=mi(e.payload,Dy);yield io(ri.setSecurityPolicyLockoutState({saving:!0,error:null})),yield St();const i=E({},qd,n,{id:n.id?n.id:qd.id});null==t||t(i),yield io(ri.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*tf(){yield io(ri.setSecurityPolicyLockoutState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyLockoutState({policy:qd,loading:!1}))}function*nf(){yield io(ri.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyPasswordHistoryState({policy:Hd,loading:!1}))}function*of(){yield io(ri.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield St(),yield io(ri.setSecurityPolicyVendorPasswordHistoryState({policy:Hd,loading:!1}))}function*af(e){let{payload:{callback:t}}=e,n=mi(e.payload,Cy);yield io(ri.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield St();const i=E({},Hd,n,{id:n.id?n.id:Hd.id});null==t||t(i),yield io(ri.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*rf(){yield oa(ri.loadSecurityPolicy,Hy),yield na(ri.loadPublicSecurityPolicy,qy),yield na(ri.saveSecurityPolicyMfa,Qy),yield na(ri.loadSecurityPolicyMfa,Jy),yield na(ri.loadSecurityPolicyVendorMfa,Yy),yield na(ri.saveSecurityPolicyLockout,ef),yield na(ri.loadSecurityPolicyLockout,Xy),yield na(ri.loadSecurityPolicyVendorLockout,Zy),yield na(ri.loadSecurityPolicyCaptcha,tf),yield na(ri.saveSecurityPolicyPasswordHistory,af),yield na(ri.loadSecurityPolicyPasswordHistory,nf),yield na(ri.loadSecurityPolicyVendorPasswordHistory,of)}const lf=["callback"],sf=["callback"],cf=["callback"],uf=["callback"],df=["callback","events"],yf=["callback"],ff=["callback"],pf=["callback"],gf=["callback"],Sf=["callback"],vf=["callback"],hf=["callback"],mf=["callback"],bf=["callback"],Af=["callback","deviceId"],kf=["callback","deviceId"],Tf=["callback","deviceId"],Pf=["callback","deviceId"],If={[Ir.Code]:At.loginWithOtc,[Ir.EmailAndPassword]:At.loginWithPassword,[Ir.MagicLink]:At.magicLinkPreLoginSuccess,[Ir.SmsCode]:At.loginWithSmsOtc};function*Lf(){var e;const t=aa.onRedirectTo,{routes:n,includeQueryParam:i}=yield co((e=>e.auth)),{loginUrl:o,logoutUrl:a,socialLoginCallbackUrl:r,activateUrl:l}=n;let{authenticatedUrl:s}=n;const c=window.localStorage.getItem(Pt);c&&![o,a,r,l].includes(c)&&(s=c),window.localStorage.removeItem(Pt),yield St(200),io(ri.resetLoginState());const u=new URL(null==(e=window)?void 0:e.location.href);let d=s;var y;u.searchParams.get("redirectUrl")?d=null!=(y=u.searchParams.get("redirectUrl"))?y:s:i&&(d+=window.location.search),t(d,{refresh:d.startsWith("http")})}function*Ef(){let e;try{var t;const n=yield ro(Dd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield io(ri.setState({ssoACS:e}))}function*Of(){try{const{isActive:e}=yield ro(Dd.auth.getSSOPublicConfiguration);yield io(ri.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const wf=e=>e.mfaRequired&&e.mfaToken?(aa.setAccessToken(null),aa.setUser(null),!0):(aa.setAccessToken(e.accessToken),aa.setUser(e),!1),Df=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 tn.authenticatorApp;if(t)return tn.smsVerifyCode}return tn.verify},Cf=e=>{if(1===e.length){const[t]=e;if(t===bd.AuthenticatorApp)return tn.authenticatorApp;if(t===bd.SMS)return tn.smsSetPhoneNumber}return tn.verify};function*Uf(e){let t=At.loginWithTwoFactor,n={};const{loginState:i}=yield co((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield ro(Dd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Df(e.mfaDevices)}:(n={step:Cf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=At.forceTwoFactor);let r={};const l=localStorage.getItem("register-quick-login");return l&&(r={quickLoginToRegister:l,flow:kt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:E({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Rf(e){var t;const{routes:n,loginState:i}=yield co((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*_f(){const{hostedLoginBox:e}=yield co((e=>e.auth));e?yield ro(Mf):yield ro(Ff)}function*Mf(){const{user:e}=yield co((e=>e.auth));if(null==e||!e.refreshToken)return aa.setAccessToken(null),aa.setUser(null),void(yield io(ri.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ro(Dd.auth.exchangeOAuthTokens,t);yield io(ri.setState({user:n,isAuthenticated:!0})),yield io(ri.loadTenants())}catch(e){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setState({user:null,isAuthenticated:!1}))}}function*Nf(){const{user:e}=yield co((e=>e.auth));if(null==e||!e.refreshToken)return aa.setAccessToken(null),aa.setUser(null),void(yield io(ri.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ro(Dd.auth.exchangeOAuthTokens,t);yield io(ri.setState({user:n,isAuthenticated:!0})),yield io(ri.loadTenants())}catch(e){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setState({user:null,isAuthenticated:!1}))}}function*Ff(){try{const t=aa.onRedirectTo,{routes:n,loginState:i}=yield co((e=>e.auth)),{user:o,tenants:a}=yield ro(Dd.auth.refreshTokenV2);if(wf(o)){const e=yield Uf(o);yield io(ri.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 Rf(o);yield io(ri.setTenantsState({tenants:a,loading:!1})),yield io(ri.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?kt.RegisterQuickLogin:kt.Login})})),yield Gf(n)}}catch(e){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setState({user:void 0,isAuthenticated:!1}))}}function*$f(){try{const t=aa.onRedirectTo,{routes:n,loginState:i}=yield co((e=>e.auth)),{user:o,tenants:a}=yield ro(Dd.auth.refreshTokenV2);if(wf(o)){const e=yield Uf(o);yield io(ri.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield ro(Yf))yield io(ri.setLoginState({step:At.promptPasskeys,loading:!1})),yield io(ri.setTenantsState({tenants:a,loading:!1})),yield io(ri.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 Rf(o);yield io(ri.setTenantsState({tenants:a,loading:!1})),yield io(ri.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?kt.RegisterQuickLogin:kt.Login})})),yield Gf(n)}}catch(e){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setState({user:void 0,isAuthenticated:!1}))}}function*Gf(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=aa.onRedirectTo,{routes:o,loginState:a}=yield co((e=>e.auth)),r=n.searchParams.get("invitationToken"),l=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||l.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):l.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 Lf())}function*xf({payload:{callback:e}}){try{const{ip:t}=yield ro(Dd.metadata.getCurrentUserIpMetadata);yield io(ri.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Vf({payload:e}){const t=[];e&&(yield io(ri.setState({isLoading:!0})),yield io(ri.loadSocialLoginsConfigurationV2()),t.push(ro(gy)),t.push(ro(_y)),t.push(ro(Of)),t.push(ro(Iy)),t.push(ro(Ef))),t.push(ro(_f)),yield oo(t),yield io(ri.setState({isLoading:!1}))}function*Wf({accessToken:e,user:t}){if(!e)return void(yield io(ri.setState({user:void 0,isAuthenticated:!1})));const n=aa.onRedirectTo,{routes:i}=yield co((e=>e.auth));if(wf(t)){const e=yield Uf(t);yield io(ri.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*jf({payload:e}){const t=[];yield io(ri.loadSocialLoginsConfigurationV2()),t.push(ro(gy)),t.push(ro(Of)),t.push(ro(Iy)),t.push(ro(Ef)),t.push(ro(Wf,e)),yield oo(t)}function*Kf({payload:e}){const{disableSilentRefresh:t}=yield co((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield ro(Dd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield io(ri.setState({user:e,isAuthenticated:!0})),yield io(ri.loadTenants()),yield io(ri.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield co((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 io(ri.setState({isLoading:!0}));const a=Nd(),r=Nd(),l=yield ro(Md,r);localStorage.setItem(It,r);const s=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${sa(n,"/oauth/authorize")}/oauth/authorize`,u=E({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:s,code_challenge:l,code_challenge_method:"S256",nonce:a},e);i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*Bf({payload:e}){const t=localStorage.getItem(It)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield co((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield ro(Dd.auth.exchangeOAuthTokens,a);yield io(ri.setState({user:e,isAuthenticated:!0})),yield io(ri.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Lf()}}function*zf(e){let{payload:{callback:t}}=e,n=mi(e.payload,lf);try{yield io(ri.setLoginState({loading:!0}));const e=yield ro(Dd.auth.changePhoneNumberWithVerification,n);yield io(ri.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:At.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1}))}}function*qf(e){let{payload:{callback:t}}=e,n=mi(e.payload,sf);try{yield io(ri.setLoginState({loading:!0})),yield ro(Dd.auth.verifyChangePhoneNumber,n),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1}))}}function*Hf(e){let{payload:{callback:t}}=e,n=mi(e.payload,cf);try{yield io(ri.setLoginState({loading:!0}));const e=yield ro(Dd.auth.passwordlessPreLogin,E({},n,{type:Ir.SmsCode}));yield io(ri.setLoginState({step:At.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Jf(e){let{payload:{callback:t}}=e,n=mi(e.payload,uf);try{const{onRedirectTo:e,routes:i}=yield co((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield io(ri.setLoginState({loading:!0}));const o=yield ro(Dd.auth.passwordlessPreLogin,n),a=If[n.type];if(a===At.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield io(ri.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:Bt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield io(ri.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*Yf(){const{publicAuthStrategyPolicy:e}=yield co((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>!(null==e||!e.secondaryAuthStrategies.some((({isActive:e,strategy:t})=>e&&t===hd.Passkeys))))(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=(r=["show-passkeys"],ud.getFeatureFlags(r));var r;if(!a||!n||i||o)return!1;{const{devices:e}=yield ro(Dd.auth.getWebAuthnDevices);return yield io(ri.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Qf(e){let{payload:{callback:t,events:n}}=e,i=mi(e.payload,df);try{yield io(ri.setLoginState({loading:!0}));const e=yield ro(Dd.auth.passwordlessPostLogin,i),a=aa.onRedirectTo,{routes:r}=yield co((e=>e.auth));if(wf(e)){const t=yield Uf(e);yield io(ri.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield co((e=>e.auth)),l=yield ro(Dd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:l.email,origin:dy.PASSWORDLESS,id:l.id,tenantId:l.tenantId,createdAt:new Date,name:l.name})),l.id&&localStorage.setItem("userId",l.id),yield io(ri.setState({user:l})),yield io(ri.setLoginState({error:void 0})),yield io(ri.loadTenants()),yield io(ri.setState({isLoading:!1})),i.flow===kt.Login?(yield ro(Yf))?(yield io(ri.setLoginState({step:At.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield io(ri.setState({isAuthenticated:!0})),yield Lf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield io(ri.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield io(ri.setLoginState({loading:!1}))}}function*Xf({payload:e}){try{yield io(ri.setLoginState({loading:!0}));const{name:t}=yield ro(Dd.auth.verifyInviteToken,e);yield io(ri.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield io(ri.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield io(ri.setLoginState({loading:!1}))}}function*Zf({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield io(ri.setLoginState({loading:!0}));try{const o=yield co((({auth:{onRedirectTo:e}})=>e));let{address:a,idpType:r}=yield ro(Dd.auth.preLoginV2,{email:e});if(a){if(r===Rd.Oidc&&!a.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield co((({auth:{routes:e}})=>({routes:e})));a+=`&redirect_uri=${window.location.origin}${e}`}yield io(ri.setLoginState({step:At.redirectToSSO,loading:!1,ssoRedirectUrl:a})),setTimeout((()=>{o(a,{refresh:!0})}),2e3)}else yield ep({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield ep({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*ep(e){let{callback:t}=e,n=mi(e,yf);const i=yield co((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield io(ri.setLoginState({step:At.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Ir.EmailAndPassword?(yield io(ri.setLoginState({step:At.loginWithPassword,loading:!1})),null==t||t()):[Ir.MagicLink,Ir.Code,Ir.SmsCode].includes(null==i?void 0:i.authStrategy)?yield io(ri.passwordlessPreLogin(E({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield io(ri.setLoginState({step:At.loginWithPassword,loading:!1})),null==t||t())}function*tp({payload:{callback:e}}){try{yield io(ri.setLoginState({loading:!0}));const{options:t}=yield ro(Dd.auth.webAuthnCreateNewDeviceSession);t.user.id=mt(t.user.id),t.challenge=mt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield io(ri.setLoginState({error:t.message})),null==e||e(null)}finally{yield io(ri.setLoginState({loading:!1}))}}function*np(e){let{payload:{callback:t}}=e,n=mi(e.payload,ff);try{yield io(ri.setLoginState({loading:!0}));const e=bt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?md.Platform:md.CrossPlatform;yield ro(Dd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield io(ri.setLoginState({error:e.message})),null==t||t(null)}finally{yield io(ri.setLoginState({loading:!1}))}}function*ip(e){let{payload:{callback:t}}=e,n=mi(e.payload,pf);try{var i;yield io(ri.setLoginState({loading:!0}));const{options:e}=yield ro(Dd.auth.webAuthnPreLogin,n);e.challenge=mt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>E({},e,{id:mt(e.id)}))),yield io(ri.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield io(ri.setLoginState({error:e.message})),null==t||t(null)}finally{yield io(ri.setLoginState({loading:!1}))}}function*op(e){let{payload:{callback:t}}=e,n=mi(e.payload,gf);try{var i;yield io(ri.setLoginState({loading:!0}));const e=bt(n.publicKey),o=yield ro(Dd.auth.webAuthnPostLogin,E({},e,{response:E({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(wf(o)){const e=aa.onRedirectTo,{routes:t}=yield co((e=>e.auth)),n=yield Uf(o);yield io(ri.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield ro(Dd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield io(ri.loadTenants()),yield io(ri.setState({user:e,isAuthenticated:!0})),yield io(ri.setLoginState({error:void 0})),yield Lf(),null==t||t(!0)}}catch(e){yield io(ri.setLoginState({error:e.message})),null==t||t(null)}finally{yield io(ri.setLoginState({loading:!1}))}}function*ap({payload:e}){const{onRedirectTo:t,routes:n}=yield co((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield io(ri.setLoginState({loading:!0}));try{const t=yield ro(Dd.auth.postLogin,e);aa.setAccessToken(t.accessToken),aa.setUser(t),yield io(ri.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Lf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield io(ri.setLoginState({step:At.loginWithSSOFailed,loading:!1}))}}function*rp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield io(ri.setLoginState({loading:!0}));try{const a=yield ro(Dd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});aa.setAccessToken(a.accessToken),aa.setUser(a);const r=aa.onRedirectTo,{routes:l}=yield co((e=>e.auth));if(wf(a)){const e=yield Uf(a);yield io(ri.setState(e)),r(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield co((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield io(ri.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===kt.Login?At.success:t.step,tenants:[],tenantsLoading:!0}})),yield io(ri.loadTenants()),n&&t.flow===kt.Login&&((yield ro(Yf))?(yield io(ri.setLoginState({step:At.promptPasskeys,loading:!1})),r(l.loginUrl,{preserveQueryParams:!0})):yield Lf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){aa.setAccessToken(null),aa.setUser(null),yield io(ri.setLoginState({email:e,error:t.message,loading:!1}))}}function*lp({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield io(ri.setLoginState({loading:!0}));try{const o=yield ro(Dd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield co((e=>e.auth)),r=a.flow===kt.Login?At.success:a.step;yield io(ri.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 io(ri.loadTenants()),yield io(ri.setLoginState({error:void 0,loading:!1})),a.flow===kt.Login&&((yield ro(Yf))?yield io(ri.setLoginState({step:At.promptPasskeys,loading:!1})):yield Lf()),null==i||i(!0)}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*sp({payload:e}){yield io(ri.setLoginState({loading:!0}));try{yield ro(Dd.auth.recoverMfaToken,e),yield io(ri.setLoginState({loading:!1,error:void 0,step:At.preLogin})),yield io(ri.setState({user:void 0,isAuthenticated:!1}))}catch(e){yield io(ri.setLoginState({error:e.message,loading:!1}))}}function*cp({payload:e}){const{hostedLoginBox:t}=yield co((e=>e.auth));yield io(ri.setState({isLoading:!0}));try{t?yield ro(Dd.auth.OAuthLogout):yield ro(Dd.auth.logout)}catch{}yield io(ri.resetState()),yield io(ri.requestAuthorize(!0)),null==e||e()}function*up({payload:e}){var t;try{yield ro(Dd.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*dp({user:e,tenants:t}){const n={step:tn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield io(ri.setMfaState(n)),yield io(ri.setUser(e)),yield io(ri.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*yp({user:e,tenants:t}){const{loginState:n}=yield co((e=>e.auth));yield io(ri.setUser(e)),yield io(ri.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id),n.flow===kt.Login&&((yield ro(Yf))?yield io(ri.setLoginState({step:At.promptPasskeys,loading:!1})):yield Lf()),yield io(ri.setState({isAuthenticated:!0}))}function*fp(e){let{payload:{callback:t}}=e,n=mi(e.payload,Sf);yield io(ri.setLoginState({loading:!0}));try{const e=yield ro(Dd.auth.preEnrollMFASMSForLogin,n);yield io(ri.setMfaState({otcToken:e.otcToken,step:tn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*pp(e){let{payload:{callback:t}}=e,n=mi(e.payload,vf);yield io(ri.setLoginState({loading:!0}));try{const e=yield ro(Dd.auth.enrollMFASMSForLogin,n),i=yield ro(Dd.auth.generateLoginResponseV2,e);yield dp(i),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*gp(e){let{payload:{callback:t}}=e,n=mi(e.payload,hf);yield io(ri.setLoginState({loading:!0}));try{var i;const e=yield ro(Dd.auth.preEnrollMFAWebAuthnForLogin,n),o=E({},e.options,{challenge:mt(e.options.challenge),user:E({},e.options.user,{id:mt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>E({},e,{id:mt(e.id)})))});yield io(ri.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Sp(e){let{payload:{callback:t}}=e,n=mi(e.payload,mf);yield io(ri.setLoginState({loading:!0}));try{const e=bt(n.publicKey),i=yield ro(Dd.auth.enrollMFAWebAuthnForLogin,E({},n,{options:e})),o=yield ro(Dd.auth.generateLoginResponseV2,i);yield dp(o),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*vp(e){let{payload:{callback:t}}=e,n=mi(e.payload,bf);yield io(ri.setLoginState({loading:!0}));try{const e=yield ro(Dd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield ro(Dd.auth.generateLoginResponseV2,e);yield dp(i),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*hp(e){let{payload:{callback:t,deviceId:n}}=e,i=mi(e.payload,Af);yield io(ri.setLoginState({loading:!0}));try{const e=yield ro(Dd.auth.preVerifyMFASMSForLogin,n,i);yield io(ri.setMfaState({otcToken:e.otcToken,step:tn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*mp(e){let{payload:{callback:t,deviceId:n}}=e,i=mi(e.payload,kf);yield io(ri.setLoginState({loading:!0}));try{const e=yield ro(Dd.auth.verifyMFASMSForLogin,n,i),o=yield ro(Dd.auth.generateLoginResponseV2,e);yield yp(o),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*bp(e){let{payload:{callback:t,deviceId:n}}=e,i=mi(e.payload,Tf);yield io(ri.setLoginState({loading:!0}));try{var o;const e=yield ro(Dd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=E({},e.options,{challenge:mt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>E({},e,{id:mt(e.id)})))});yield io(ri.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Ap(e){let{payload:{callback:t,deviceId:n}}=e,i=mi(e.payload,Pf);yield io(ri.setLoginState({loading:!0}));try{const e=bt(i.publicKey),o=yield ro(Dd.auth.verifyMFAWebAuthnForLogin,n,E({},i,{options:e})),a=yield ro(Dd.auth.generateLoginResponseV2,o);yield yp(a),yield io(ri.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*kp(){yield oa(ri.requestAuthorize,Vf),yield oa(ri.requestAuthorizeSSR,jf),yield oa(ri.requestHostedLoginAuthorize,Kf),yield oa(ri.handleHostedLoginCallback,Bf),yield oa(ri.preLogin,Zf),yield oa(ri.postLogin,ap),yield oa(ri.login,rp),yield oa(ri.logout,cp),yield oa(ri.silentLogout,up),yield oa(ri.loginWithMfa,lp),yield oa(ri.recoverMfa,sp),yield oa(ri.quickSmsPasswordlessPreLogin,Hf),yield oa(ri.changePhoneNumberWithVerification,zf),yield oa(ri.verifyChangePhoneNumber,qf),yield oa(ri.passwordlessPreLogin,Jf),yield oa(ri.passwordlessPostLogin,Qf),yield oa(ri.verifyInviteToken,Xf),yield oa(ri.webAuthnPrelogin,ip),yield oa(ri.webAuthnPostLogin,op),yield oa(ri.webAuthnCreateNewDeviceSession,tp),yield oa(ri.webAuthnVerifyNewDeviceSession,np),yield oa(ri.afterAuthNavigation,Lf),yield oa(ri.getUserIP,xf),yield oa(ri.preEnrollMFASMSForLogin,fp),yield oa(ri.enrollMFASMSForLogin,pp),yield oa(ri.preEnrollMFAWebAuthnForLogin,gp),yield oa(ri.enrollMFAWebAuthnForLogin,Sp),yield oa(ri.enrollMFAAuthenticatorAppForLogin,vp),yield oa(ri.preVerifyMFASMSForLogin,hp),yield oa(ri.verifyMFASMSForLogin,mp),yield oa(ri.preVerifyMFAWebAuthnForLogin,bp),yield oa(ri.verifyMFAWebAuthnForLogin,Ap)}function*Tp({payload:e}){e&&(yield io(ri.setState({isLoading:!0})));const t=Wd;yield io(ri.loadTenants()),yield io(ri.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Pp({payload:{callback:e}}){try{const{ip:t}=cy[0];yield io(ri.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Ip(){yield oa(ri.requestAuthorize,Tp),yield oa(ri.afterAuthNavigation,Lf),yield oa(ri.getUserIP,Pp)}const Lp=["callback","samlVendor"],Ep=["callback","samlVendor"];function*Op(){try{var e,t;yield io(ri.setSSOState({loading:!0}));const n=yield ro(Dd.auth.getSamlConfiguration),i=yield ro(Dd.auth.getOidcConfiguration),o=yield ro(Dd.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 io(ri.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield io(ri.setSSOState({error:e.message,loading:!1}))}}function*wp({payload:e}){const t=yield co((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield io(ri.setSSOState({error:void 0,[n]:!0}));try{const i=yield Fd(e[0]),o=yield ro(Dd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield io(ri.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield io(ri.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Dp({payload:e}){const{configFile:t,callback:n}=e,i=yield co((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield io(ri.setSSOState({error:void 0,[o]:!0}));try{const e=yield Fd(t),a=yield ro(Dd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield io(ri.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield io(ri.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Cp({payload:e}){const{callback:t,samlVendor:n}=e,i=mi(e,Lp),o=yield co((e=>e.auth.ssoState.samlConfiguration)),a=E({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield io(ri.setSSOState({samlConfiguration:E({},o,a)})));if(yield io(ri.setSSOState({error:void 0,[r]:!0})),e.type===Rd.Saml){var l,s;const e=yield ro(Dd.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 i=_d(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 ro(Dd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield io(ri.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield io(ri.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Up({payload:{callback:e}={}}){const t=yield co((e=>e.auth.ssoState.samlConfiguration));try{yield io(ri.setSSOState({error:void 0,saving:!0})),yield ro(Dd.auth.validateSamlDomain),yield io(ri.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield io(ri.setSSOState({samlConfiguration:E({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Rp(){try{const e=yield ro(Dd.auth.getSamlRoles),t=yield ro(Dd.auth.getSamlRolesGroups);yield io(ri.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield io(ri.setSSOState({error:e.message}))}}function*_p({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield io(ri.setSSOState({error:void 0,saving:!0})),yield ro(Dd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield oo(e.map((e=>ro(Dd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield io(ri.setSSOState({error:e.message}))}}(n)),yield Rp(),yield io(ri.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield io(ri.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Mp({payload:{callback:e,id:t}}){try{yield io(ri.setSSOState({error:void 0,saving:!0})),yield ro(Dd.auth.deleteSamlGroup,{id:t}),yield Rp(),yield io(ri.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield io(ri.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*Np({payload:{group:e,roleIds:t,callback:n}}){try{yield io(ri.setSSOState({error:void 0,saving:!0})),yield ro(Dd.auth.createSamlGroup,{group:e,roleIds:t}),yield Rp(),yield io(ri.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield io(ri.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Fp({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield io(ri.setSSOState({loading:!0})),yield ro(Dd.auth.oidcPostLoginV2,t),yield ro(_f),yield io(ri.setSSOState({loading:!1}))}catch(e){var n;yield io(ri.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*$p(){yield na(ri.loadSSOConfigurations,Op),yield na(ri.saveSSOConfigurations,Cp),yield na(ri.saveSSOConfigurationsFile,wp),yield na(ri.saveSSOConfigurationsFileWithCallback,Dp),yield na(ri.validateSSODomain,Up),yield na(ri.loadSSOAuthorizationRoles,Rp),yield na(ri.updateSSOAuthorizationRoles,_p),yield na(ri.deleteSamlGroup,Mp),yield na(ri.createSamlGroup,Np),yield na(ri.oidcPostlogin,Fp)}function*Gp(){yield io(ri.setSSOState({loading:!0})),yield St(),yield io(ri.setSSOState({samlConfiguration:Jd,loading:!1,firstLoad:!1}))}function*xp({payload:e}){const t="saving";yield io(ri.setSSOState({error:void 0,[t]:!0}));const n=E({},yield co((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield io(ri.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Vp({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=mi(e,Ep),r=Xd.samlConfiguration,l=E({},r,a);let s="saving";if((null==l?void 0:l.enabled)!==r.enabled&&(s="loading"),null==l||!l.domain)return void(yield io(ri.setSSOState({samlConfiguration:E({},r,l)})));yield io(ri.setSSOState({error:void 0,[s]:!0})),yield St(),l.acsUrl=null==Yd||null==(t=Yd.configuration)?void 0:t.acsUrl,l.spEntityId=null==Yd||null==(n=Yd.configuration)?void 0:n.spEntityId;const c=_d(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==o?void 0:o.toLowerCase(),yield St(),yield io(ri.setSSOState({samlConfiguration:c,error:void 0,[s]:!1})),null==i||i(!0)}function*Wp({payload:{callback:e}={}}){const t=Xd.samlConfiguration;yield io(ri.setSSOState({error:void 0,saving:!0})),yield St(),yield io(ri.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*jp(){yield St(),yield io(ri.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Kp({payload:{callback:e,authorizationRoles:t}}){yield io(ri.setSSOState({error:void 0,saving:!0})),yield St(),yield io(ri.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Bp(){yield na(ri.loadSSOConfigurations,Gp),yield na(ri.saveSSOConfigurations,Vp),yield na(ri.saveSSOConfigurationsFile,xp),yield na(ri.validateSSODomain,Wp),yield na(ri.loadSSOAuthorizationRoles,jp),yield na(ri.updateSSOAuthorizationRoles,Kp)}const zp=["callback"],qp=["callback","ssoConfigId"],Hp=["callback","ssoConfigId"];function*Jp(){try{return yield ro(Dd.auth.getOidcConfiguration)}catch(e){return null}}function*Yp(){try{return yield ro(Dd.metadata.getSamlMetadata)}catch(e){return null}}function*Qp(){try{yield io(ri.setSSOLoader({key:Ud.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield oo([ro(Jp),ro(Yp)]),n=yield ro(Dd.auth.getSSOConfigurations);yield io(ri.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield io(ri.setSSOError({key:Ud.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield io(ri.setSSOLoader({key:Ud.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Xp({payload:e}){yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=mi(e,zp),i=yield co((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield ro(Dd.auth.createSSOConfiguration,E({},n,{enabled:null!=(o=n.enabled)&&o}));yield io(ri.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield io(ri.setSSOError({key:Ud.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Zp({payload:e}){yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield co((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fd(t),o=yield ro(Dd.auth.createSSOConfigurationByMetadata,{metadata:e});yield io(ri.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield io(ri.setSSOError({key:Ud.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*eg({payload:e}){yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=mi(e,qp),o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ro(Dd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield io(ri.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield io(ri.setSSOError({key:Ud.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*tg({payload:e}){yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Fd(i),a=yield ro(Dd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield io(ri.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield io(ri.setSSOError({key:Ud.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*ng({payload:e}){yield io(ri.setSSOLoader({key:Ud.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield co((e=>e.auth.ssoState.ssoConfigurations));try{yield ro(Dd.auth.deleteSSOConfiguration,t),yield io(ri.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield io(ri.setSSOError({key:Ud.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.DELETE_SSO_CONFIGURATION,value:!1}))}}function*ig({payload:e}){const{callback:t,ssoConfigId:n}=e,i=mi(e,Hp);yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_DOMAIN,value:!0}));const o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ro(Dd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?E({},t,{domains:[...t.domains,e]}):t));yield io(ri.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield io(ri.setSSOError({key:Ud.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_DOMAIN,value:!1}))}}function*og({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield io(ri.setSSOLoader({key:Ud.DELETE_SSO_DOMAIN,value:!0}));const o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{yield ro(Dd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?E({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield io(ri.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield io(ri.setSSOError({key:Ud.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.DELETE_SSO_DOMAIN,value:!1}))}}function*ag({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield io(ri.setSSOLoader({key:Ud.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{yield ro(Dd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?E({},e,{domains:e.domains.map((e=>e.id===n?E({},e,{validated:!0}):e))}):e));yield io(ri.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield io(ri.setSSOError({key:Ud.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.VALIDATE_SSO_DOMAIN,value:!1}))}}function*rg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield co((e=>e.auth.ssoState.ssoConfigurations));try{yield ro(Dd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?E({},e,{roleIds:n}):e));yield io(ri.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield io(ri.setSSOError({key:Ud.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield io(ri.setSSOLoader({key:Ud.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*lg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_GROUPS,value:!0}));const o=yield co((e=>e.auth.ssoState.ssoConfigurations));try{yield oo(t.map((e=>ro(Dd.auth.deleteSSOGroup,n,e)))),yield oo(e.map((e=>ro(Dd.auth.createSSOGroup,n,e))));const a=yield ro(Dd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?E({},e,{groups:a}):e));yield io(ri.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield io(ri.setSSOError({key:Ud.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_GROUPS,value:!1}))}}function*sg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield oo(t.map((t=>ro(Dd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield io(ri.setSSOError({key:Ud.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield io(ri.setSSOLoader({key:Ud.SAVE_SSO_GROUPS,value:!1}))}}function*cg(){yield na(ri.loadSSOConfigurationsV2,Qp),yield na(ri.saveSSOConfigurationV2,Xp),yield na(ri.saveSSODomain,ig),yield na(ri.deleteSSODomain,og),yield na(ri.validateSSODomainV2,ag),yield na(ri.updateSSOConfiguration,eg),yield na(ri.deleteSSOConfiguration,ng),yield na(ri.setSSOGroups,lg),yield na(ri.updateSSOGroups,sg),yield na(ri.setSSODefaultRoles,rg),yield na(ri.saveSSOConfigurationByMetadata,Zp),yield na(ri.updateSSOConfigurationByMetadata,tg)}const ug=["callback","profilePictureUrl"],dg=["callback","profilePictureUrl"];function*yg(){yield io(ri.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 ro.apply(void 0,[ta,e,t,n].concat(o))}(3,2e3,Dd.teams.getProfile),t=yield co((e=>e.auth.user));ri.setUser(E({},t,e)),yield io(ri.setProfileState({profile:e,loading:!1}))}catch(e){yield io(ri.setProfileState({loading:!1,error:e.message}))}}function*fg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=mi(e.payload,ug);yield io(ri.setProfileState({saving:!0,error:null}));try{const e=yield co((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 ro(Dd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=E({},e,i,{profilePictureUrl:o}),r=yield ro(Dd.teams.updateProfile,a),l=yield co((e=>e.auth.user));yield io(ri.setUser(E({},l,r))),yield io(ri.setProfileState({profile:r,saving:!1})),null==t||t(a)}catch(e){yield io(ri.setProfileState({saving:!1,error:e.message})),null==t||t(null,e)}}function*pg({payload:e}){yield io(ri.setProfileState({loading:!0}));try{var t;yield ro(Dd.teams.changePassword,e),yield io(ri.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield io(ri.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*gg(){yield oa(ri.loadProfile,yg),yield na(ri.saveProfile,fg),yield na(ri.changePassword,pg)}function*Sg(){yield io(ri.setProfileState({loading:!0})),yield St(),yield io(ri.setUser(E({},Wd,Vd))),yield io(ri.setProfileState({loading:!1,profile:Vd}))}function*vg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=mi(e.payload,dg);yield io(ri.setProfileState({saving:!0,error:null}));const o=jd;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=E({},o.profile,i,{profilePictureUrl:a}),l=Wd;yield St(),yield io(ri.setUser(E({},l,r))),yield io(ri.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*hg({payload:e}){var t;yield io(ri.setProfileState({loading:!0})),yield St(),yield io(ri.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*mg(){yield oa(ri.loadProfile,Sg),yield na(ri.saveProfile,vg),yield na(ri.changePassword,hg)}const bg=["callback"],Ag=["callback"],kg=["callback"],Tg=["deviceId","callback"],Pg=["deviceId","callback"],Ig=["callback"],Lg=["deviceId"],Eg=["deviceId"],Og=["callback"],wg=["deviceId"],Dg=["callback"];function*Cg(e){const{step:t}=yield co((e=>e.auth.mfaState));return{step:e.recoveryCode?tn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Ug(){yield io(ri.setMfaState({saving:!0}));try{const{qrCode:e}=yield ro(Dd.auth.enrollMfa);yield io(ri.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message}))}}function*Rg(e){let{payload:{callback:t}}=e,n=mi(e.payload,bg);yield io(ri.setMfaState({saving:!0}));try{const e=yield co((e=>e.auth.user)),i=yield ro(Dd.auth.verifyMfa,n),o=yield ro(Dd.auth.getMFADevices),a=yield Cg(i);yield io(ri.setMfaState(E({},a,{mfaDevices:o}))),yield io(ri.setUser(E({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*_g(e){let{payload:{callback:t}}=e,n=mi(e.payload,Ag);yield io(ri.setMfaState({loading:!0}));try{const e=yield ro(Dd.auth.loginWithMfa,n),i={step:tn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield io(ri.setMfaState(i)),yield io(ri.setState({user:e})),yield io(ri.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield io(ri.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Mg({payload:e}){yield io(ri.setMfaState({saving:!0}));try{var t;yield ro(Dd.auth.disableMfa,e);const n=yield ro(Dd.auth.getMFADevices);yield io(ri.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield io(ri.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ng({payload:e}){yield io(ri.setMfaState({saving:!0}));try{var t,n;const i=yield ro(Dd.auth.preEnrollMFAWebAuthn),o=E({},i.options,{challenge:mt(i.options.challenge),user:E({},i.options.user,{id:mt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>E({},e,{id:mt(e.id)})))});yield io(ri.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield io(ri.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*Fg(e){let{payload:{callback:t}}=e,n=mi(e.payload,kg);yield io(ri.setMfaState({saving:!0}));try{const e=bt(n.publicKey),i=yield ro(Dd.auth.enrollMFAWebAuthn,E({},n,{options:e})),o=yield ro(Dd.auth.getMFADevices),a=yield Cg(i);yield io(ri.setMfaState(E({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*$g(e){let{payload:{deviceId:t,callback:n}}=e;mi(e.payload,Tg),yield io(ri.setMfaState({saving:!0}));try{var i;const e=yield ro(Dd.auth.preDisableMFAWebAuthn,t),o=E({},e.options,{challenge:mt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>E({},e,{id:mt(e.id)})))});yield io(ri.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*Gg(e){let{payload:{deviceId:t,callback:n}}=e,i=mi(e.payload,Pg);yield io(ri.setMfaState({saving:!0}));try{const e=bt(i.publicKey);yield ro(Dd.auth.disableMFAWebAuthn,t,E({},i,{options:e}));const o=yield ro(Dd.auth.getMFADevices);yield io(ri.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*xg({payload:e}){yield io(ri.setMfaState({saving:!0}));try{var t;const n=yield ro(Dd.auth.preEnrollMFASMS,e);yield io(ri.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 io(ri.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*Vg(e){let{payload:{callback:t}}=e,n=mi(e.payload,Ig);yield io(ri.setMfaState({saving:!0}));try{const e=yield ro(Dd.auth.enrollMFASMS,n),i=yield ro(Dd.auth.getMFADevices),o=yield Cg(e);yield io(ri.setMfaState(E({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield io(ri.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Wg(e){let{payload:{deviceId:t}}=e,n=mi(e.payload,Lg);yield io(ri.setMfaState({saving:!0}));try{var i;const e=yield ro(Dd.auth.preDisableMFASMS,t);yield io(ri.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 io(ri.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*jg(e){let{payload:{deviceId:t}}=e,n=mi(e.payload,Eg);yield io(ri.setMfaState({saving:!0}));try{var i;yield ro(Dd.auth.disableMFASMS,t,n);const e=yield ro(Dd.auth.getMFADevices);yield io(ri.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield io(ri.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*Kg(){yield io(ri.setMfaState({loading:!0}));try{yield co((e=>e.auth.user));const e=yield ro(Dd.auth.getMFADevices);yield io(ri.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield io(ri.setMfaState({loading:!1,error:e.message}))}}function*Bg(){yield io(ri.setMfaState({loading:!0}));try{const e=(yield ro(Dd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield io(ri.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield io(ri.setMfaState({loading:!1,error:e.message}))}}function*zg(){yield na(ri.enrollMfa,Ug),yield na(ri.getMFADevices,Kg),yield na(ri.getMFAStrategies,Bg),yield na(ri.verifyMfa,Rg),yield na(ri.disableMfa,Mg),yield na(ri.verifyMfaAfterForce,_g),yield na(ri.preDisableMfaSms,Wg),yield na(ri.disableMfaSms,jg),yield na(ri.preEnrollMfaSms,xg),yield na(ri.enrollMfaSms,Vg),yield na(ri.preEnrollMfaWebAuthn,Ng),yield na(ri.enrollMfaWebAuthn,Fg),yield na(ri.preDisableMfaWebAuthn,$g),yield na(ri.disableMfaWebAuthn,Gg)}function*qg(){yield io(ri.setMfaState({saving:!0})),yield io(ri.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Hg({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield co((e=>e.auth.mfaState));yield io(ri.setMfaState({saving:!0})),yield St();const n={token:"token",recoveryCode:"recoveryCode"},i={step:tn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield io(ri.setMfaState(i)),yield io(ri.setUser(E({},Wd,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*Jg(e){let{payload:{callback:t}}=e,n=mi(e.payload,Og);yield io(ri.setMfaState({loading:!0})),yield St();const i=E({},n,{recoveryCode:"recoveryCode"}),o={step:tn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield io(ri.setMfaState(o)),yield St(),yield io(ri.setUser(E({},Wd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*Yg({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield co((e=>e.auth.mfaState));yield io(ri.setMfaState({saving:!0})),yield St(),yield io(ri.setMfaState({saving:!1,error:void 0,mfaDevices:E({},n,{authenticators:[]})})),yield io(ri.setUser(E({},Wd))),null==(t=e.callback)||t.call(e,!0)}function*Qg(e){let{}=e,t=mi(e.payload,wg);yield io(ri.setMfaState({saving:!0}));try{var n;yield io(ri.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield io(ri.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*Xg({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield co((e=>e.auth.mfaState));yield io(ri.setMfaState({saving:!0})),yield St(),yield io(ri.setMfaState({loading:!1,error:void 0,mfaDevices:E({},n,{phones:[]})})),yield io(ri.setUser(E({},Wd))),null==(t=e.callback)||t.call(e,!0)}function*Zg({payload:e}){var t;yield io(ri.setMfaState({saving:!0})),yield St(),yield io(ri.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*eS(e){let{payload:{callback:t}}=e;mi(e.payload,Dg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield co((e=>e.auth.mfaState));yield io(ri.setMfaState({saving:!0})),yield St();const i={token:"token",recoveryCode:"recoveryCode"},o={step:tn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield io(ri.setMfaState(o)),yield io(ri.setUser(E({},Wd,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*tS(){yield na(ri.enrollMfa,qg),yield na(ri.verifyMfa,Hg),yield na(ri.disableMfa,Yg),yield na(ri.verifyMfaAfterForce,Jg),yield na(ri.preDisableMfaSms,Qg),yield na(ri.disableMfaSms,Xg),yield na(ri.preEnrollMfaSms,Zg),yield na(ri.enrollMfaSms,eS)}const nS=["callback"];function*iS({payload:e}){yield io(ri.setForgotPasswordState({loading:!0}));try{yield ro(Dd.auth.forgotPassword,e),yield io(ri.setForgotPasswordState({loading:!1,error:void 0,step:Vt.success}))}catch(e){yield io(ri.setForgotPasswordState({loading:!1,error:e.message||"Unknown error occurred"}))}}function*oS(e){let{payload:{callback:t}}=e,n=mi(e.payload,nS);yield io(ri.setForgotPasswordState({loading:!0}));try{yield ro(Dd.auth.resetPassword,n),yield io(ri.setForgotPasswordState({loading:!1,error:void 0,step:Vt.success})),null==t||t(!0)}catch(e){yield io(ri.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1)}}function*aS({payload:e}){yield io(ri.setForgotPasswordState({loading:!0}));try{const t=yield ro(Dd.auth.loadPasswordConfig,e);yield io(ri.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield io(ri.setForgotPasswordState({loading:!1,error:e.message}))}}function*rS(){yield oa(ri.forgotPassword,iS),yield oa(ri.resetPassword,oS),yield oa(ri.loadPasswordConfig,aS)}let lS;!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"}(lS||(lS={}));const sS=["callback","events"],cS=["callback"],uS=["callback"];function*dS({payload:{userId:e,token:t}}){yield io(ri.setActivateState({loading:!0,step:Rt.activating}));try{const{isAuthenticated:n}=yield co((e=>e.auth));n&&(yield io(ri.silentLogout()));const i=yield ro(Dd.auth.getActivateAccountStrategy,{userId:e,token:t});yield io(ri.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield io(ri.setActivateState({loading:!1,step:Rt.activatingForm})))}catch(e){yield io(ri.setActivateState({loading:!1,error:e.message}))}}function*yS(e){let{payload:{callback:t,events:n}}=e,i=mi(e.payload,sS);yield io(ri.setActivateState({loading:!0}));try{const e=aa.onRedirectTo,{routes:a}=yield co((e=>e.auth)),r=yield ro(Dd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(wf(r)){yield io(ri.setActivateState({step:Rt.success}));const t=yield Uf(r);yield io(ri.setState(t)),yield uo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield io(ri.setActivateState({step:Rt.success}));const{user:e,tenants:t}=yield ro(Dd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:dy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield io(ri.setTenantsState({tenants:t,loading:!1})),yield io(ri.setState({user:e,isAuthenticated:!0})),yield uo(1e3),yield Lf(),yield io(ri.resetActivateState())}null==t||t(!0)}catch(e){yield io(ri.setActivateState({loading:!1,error:e.message}))}}function*fS({payload:e}){const{callback:t}=e,n=mi(e,cS);yield io(ri.setActivateStrategyState({loading:!0}));try{const e=yield ro(Dd.auth.getActivateAccountStrategy,n);yield io(ri.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield io(ri.setActivateStrategyState({loading:!1,error:e.message}))}}function*pS({payload:e}){const{callback:t}=e,n=mi(e,uS);yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:n.email})),yield io(ri.setActivateState({loading:!0}));try{yield ro(Dd.auth.resendActivationEmail,n),yield io(ri.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield io(ri.setActivateState({loading:!1,error:e.message})),yield io(ri.setTeamError({key:lS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:!1}))}function*gS(){yield oa(ri.activateAccount,yS),yield oa(ri.preActivateAccount,dS),yield oa(ri.getActivateAccountStrategy,fS),yield oa(ri.resendActivationEmail,pS)}function*SS({payload:e}){if(e.token&&e.userId)try{yield io(ri.setAcceptInvitationState({error:void 0,step:Ft.pending})),yield ro(Dd.auth.acceptInvitation,e),yield io(ri.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Ft.success}}))}catch(e){yield io(ri.setAcceptInvitationState({step:Ft.failed,error:e.message}))}else yield io(ri.setAcceptInvitationState({error:void 0,step:Ft.invalid}))}function*vS(){yield oa(ri.acceptInvitation,SS)}var hS,mS=new Uint8Array(16);function bS(){if(!hS&&!(hS="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 hS(mS)}for(var AS=/^(?:[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,kS=function(e){return"string"==typeof e&&AS.test(e)},TS=[],PS=0;PS<256;++PS)TS.push((PS+256).toString(16).substr(1));var IS=function(e,t,n){var i=(e=e||{}).random||(e.rng||bS)();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=(TS[e[t+0]]+TS[e[t+1]]+TS[e[t+2]]+TS[e[t+3]]+"-"+TS[e[t+4]]+TS[e[t+5]]+"-"+TS[e[t+6]]+TS[e[t+7]]+"-"+TS[e[t+8]]+TS[e[t+9]]+"-"+TS[e[t+10]]+TS[e[t+11]]+TS[e[t+12]]+TS[e[t+13]]+TS[e[t+14]]+TS[e[t+15]]).toLowerCase();if(!kS(n))throw TypeError("Stringified UUID is invalid");return n}(i)};const LS=["callback"],ES=["roles"],OS=["callback"],wS=["callback","profileImage"],DS=["callback"],CS=["callback","userId"],US=["callback"],RS=["callback"],_S=["callback"],MS=["callback"],NS=["callback"],FS=["callback"],$S=["callback"],GS=["callback","profileImage"],xS=["callback"],VS=["callback"],WS=["callback"],jS=["callback"],KS=["callback"],BS=["callback"],zS=()=>co((e=>e.auth.teamState));function*qS({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield zS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield io(ri.setTeamLoader({key:lS.USERS,value:!a})),yield io(ri.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield oo([ro(Dd.teams.loadUsers,{pageSize:s,pageOffset:c,filter:u,sort:d}),ro(Dd.teams.loadAvailableRoles),ro(Dd.teams.loadAvailablePermissions)]);yield io(ri.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield io(ri.setTeamError({key:lS.USERS,value:e.message})),yield io(ri.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield io(ri.setTeamLoader({key:lS.USERS,value:!1}))}function*HS({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield zS(),c={_limit:(null!=(t=e._limit)?t:s.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:s.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:s.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:s.allUsersQueryParams._order)||"DESC"};yield io(ri.setTeamLoader({key:lS.USERS,value:!r})),yield io(ri.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield oo([ro(Dd.subTenants.loadAllUsers,E({},c)),ro(Dd.teams.loadAvailableRoles),ro(Dd.teams.loadAvailablePermissions)]);yield io(ri.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==l||l(e)}catch(e){yield io(ri.setTeamError({key:lS.USERS,value:e.message})),yield io(ri.setTeamState({totalPages:0,users:[]})),null==l||l(null,e)}yield io(ri.setTeamLoader({key:lS.USERS,value:!1}))}function*JS({payload:e}){yield io(ri.setTeamLoader({key:lS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield oo([ro(Dd.teams.loadAvailableRoles),ro(Dd.teams.loadAvailablePermissions)]);yield io(ri.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 io(ri.setTeamError({key:lS.ROLES_AND_PERMISSIONS,value:t.message}))}yield io(ri.setTeamLoader({key:lS.ROLES_AND_PERMISSIONS,value:!0}))}function*YS({payload:e}){const{callback:t}=e,n=mi(e,LS),i=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{const e=yield ro(Dd.teams.addUser,n),{roles:o}=e,a=E({},mi(e,ES),{roleIds:o.map((e=>e.id))});null==t||t(a),yield io(ri.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*QS({payload:e}){const{callback:t}=e,n=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield io(ri.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield ro(Dd.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 io(ri.loadUsers(r)),yield io(ri.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*XS({payload:e}){const{callback:t}=e,n=mi(e,OS),i=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{yield ro(Dd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield ro(Dd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield io(ri.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*ZS({payload:e}){const{callback:t}=e,n=mi(e,wS),{id:i}=n,o=yield zS(),a=o.users.find((e=>e.id===n.id));yield io(ri.setTeamLoader({key:lS.UPDATE_USER,value:i||""})),yield io(ri.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})})),yield io(ri.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?E({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield ro(Dd.teams.updateUser,n);null==t||t(e),yield io(ri.setTeamState({users:o.users.map((t=>t.id===e.id?E({},t,e,{createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield io(ri.setTeamLoader({key:lS.UPDATE_USER,value:!1}))}catch(e){yield io(ri.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?E({},e,a):e))})),yield io(ri.setTeamLoader({key:lS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*ev({payload:e}){const{callback:t}=e,n=mi(e,DS),i=yield zS();yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ro(Dd.teams.deleteUser,n),null==t||t(!0),yield io(ri.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*tv({payload:e}){const{callback:t,userId:n}=e,i=mi(e,CS),o=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})}));try{yield ro(Dd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return E({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield io(ri.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[E({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield io(ri.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*nv({payload:e}){const{callback:t}=e,n=mi(e,US),i=yield zS();yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ro(Dd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield io(ri.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*iv({payload:e}){const{callback:t}=e,n=mi(e,RS);yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield ro(Dd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield io(ri.setTeamError({key:lS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:!1}))}function*ov({payload:e}){const{callback:t}=e,n=mi(e,_S);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email}));try{yield ro(Dd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield io(ri.setTeamError({key:lS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*av({payload:e}){const{callback:t}=e,n=mi(e,MS);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email}));try{yield ro(Dd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield io(ri.setTeamError({key:lS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*rv({payload:e}){const{callback:t}=e,n=mi(e,NS);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email}));try{yield ro(Dd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield io(ri.setTeamError({key:lS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*lv(){yield io(ri.setTeamError({key:lS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield ro(Dd.teams.getInviteLinkConfiguration);yield io(ri.setTeamState({inviteTokenState:E({},e)}))}catch(e){yield io(ri.setTeamError({key:lS.CONFIG_TOKEN_LINK,value:e.message}))}}function*sv(){yield io(ri.setTeamError({key:lS.GET_TOKEN_LINK,value:!1}));try{yield ro(lv);const e=yield ro(Dd.teams.getInviteUserLink),{inviteTokenState:t}=yield zS();yield io(ri.setTeamState({inviteTokenState:E({},t,e)}))}catch(e){yield io(ri.setTeamError({key:lS.GET_TOKEN_LINK,value:e.message}))}}function*cv({payload:{callback:e}}){yield io(ri.setTeamError({key:lS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield zS();try{const n=yield ro(Dd.teams.createInviteUserLink,{expiresInMinutes:43200});yield io(ri.setTeamState({inviteTokenState:E({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield io(ri.setTeamError({key:lS.CREATE_TOKEN_LINK,value:t.message}))}}function*uv({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield zS();yield io(ri.setTeamError({key:lS.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield ro(Dd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield io(ri.setTeamState({inviteTokenState:E({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield io(ri.setTeamError({key:lS.UPDATE_TOKEN_LINK,value:t.message}))}}function*dv({payload:e}){const{callback:t}=null!=e?e:{};yield io(ri.setTeamError({key:lS.DELETE_TOKEN_LINK,value:!1}));try{yield ro(Dd.teams.deleteInviteUserLink),yield io(ri.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield io(ri.setTeamError({key:lS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*yv({payload:e}){yield io(ri.setTeamState({addUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*fv({payload:e}){const t=yield zS(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield io(ri.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*pv({payload:e}){yield io(ri.setTeamState({deleteUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*gv({payload:e}){const t=yield zS(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield io(ri.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Sv(){yield ia(ri.loadUsers,qS),yield ia(ri.loadAllSubTenantsUsers,HS),yield ia(ri.loadRoles,JS),yield na(ri.addUser,YS),yield na(ri.addUsersBulk,QS),yield na(ri.addUserToSubTenants,XS),yield na(ri.updateUser,ZS),yield na(ri.setUserRolesForSubTenants,tv),yield na(ri.deleteUser,ev),yield na(ri.deleteUserFromSubTenants,nv),yield na(ri.resendActivationLink,iv),yield na(ri.resendInvitationLink,ov),yield na(ri.resendInvitationEmail,av),yield na(ri.resendInvitationLinkToAllSubTenants,rv),yield na(ri.getInvitationLink,sv),yield na(ri.createInvitationLink,cv),yield na(ri.updateInvitationLink,uv),yield na(ri.deleteInvitationLink,dv),yield na(ri.openAddUserDialog,yv),yield na(ri.closeAddUserDialog,fv),yield na(ri.openDeleteUserDialog,pv),yield na(ri.closeDeleteUserDialog,gv)}function*vv({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,l=yield zS(),s=null!=(t=e.pageSize)?t:l.pageSize,c=null!=(n=e.pageOffset)?n:l.pageOffset,u=null!=(i=e.filter)?i:l.filter,d=null!=(o=e.sort)?o:l.sort;yield io(ri.setTeamLoader({key:lS.USERS,value:!a})),yield io(ri.setTeamState({pageSize:s,pageOffset:c,filter:u,sort:d})),yield St(),yield io(ri.setTeamState({users:iy,totalPages:2,totalItems:10,roles:Qd,permissions:Zd})),yield io(ri.setTeamLoader({key:lS.USERS,value:!1})),null==r||r(iy)}function*hv({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:l}=e,s=yield zS(),c=null!=(t=e._limit)?t:s.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:s.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:s.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:s.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:s.allUsersQueryParams._order;yield io(ri.setTeamLoader({key:lS.USERS,value:!r})),yield io(ri.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield St(),yield io(ri.setTeamState({allUsers:oy,totalPages:2,totalItems:10,roles:Qd,permissions:Zd})),yield io(ri.setTeamLoader({key:lS.USERS,value:!1})),null==l||l(oy)}function*mv({payload:e}){var t;yield io(ri.setTeamLoader({key:lS.ROLES_AND_PERMISSIONS,value:!0})),yield St(),yield io(ri.setTeamState({roles:Qd,permissions:Zd})),yield io(ri.setTeamLoader({key:lS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Qd,permissions:Zd})}function*bv({payload:e}){const{callback:t}=e,n=mi(e,FS),i=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield St();const o=E({},ty,n,{id:`${IS()}`});null==t||t(o),yield io(ri.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Av({payload:e}){const{callback:t}=e,n=mi(e,$S),i=yield zS();yield io(ri.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield St();const o=E({},ty,n,{id:`${IS()}`});yield io(ri.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*kv({payload:e}){var t;const{callback:n}=e,i=mi(e,GS),{id:o}=i,a=yield zS(),r=a.users.find((e=>e.id===i.id));yield io(ri.setTeamLoader({key:lS.UPDATE_USER,value:o||""})),yield io(ri.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0})})),yield io(ri.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?E({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield St();const l=E({},r,i);null==n||n(l),yield io(ri.setTeamState({users:a.users.map((e=>e.id===l.id?E({},e,l,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield io(ri.setTeamLoader({key:lS.UPDATE_USER,value:!1}))}function*Tv({payload:e}){const{callback:t}=e,n=mi(e,xS),i=yield zS();yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield St(),null==t||t(!0),yield io(ri.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Pv({payload:e}){const{callback:t}=e,n=mi(e,VS),i=yield zS();yield io(ri.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield St(),null==t||t(!0),yield io(ri.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Iv({payload:e}){const{callback:t}=e,n=mi(e,WS);yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:n.userId})),yield St(),null==t||t(!0),yield io(ri.setTeamLoader({key:lS.RESEND_ACTIVATE_LINK,value:!1}))}function*Lv({payload:e}){const{callback:t}=e,n=mi(e,jS);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email})),yield St(),null==t||t(!0),yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*Ev({payload:e}){const{callback:t}=e,n=mi(e,KS);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email})),yield St(),null==t||t(!0),yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*Ov({payload:e}){const{callback:t}=e,n=mi(e,BS);yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:n.email})),yield St(),null==t||t(!0),yield io(ri.setTeamLoader({key:lS.RESEND_INVITATION_LINK,value:!1}))}function*wv(){yield ia(ri.loadUsers,vv),yield ia(ri.loadAllSubTenantsUsers,hv),yield ia(ri.loadRoles,mv),yield na(ri.addUser,bv),yield na(ri.addUserToSubTenants,Av),yield na(ri.updateUser,kv),yield na(ri.deleteUser,Tv),yield na(ri.deleteUserFromSubTenants,Pv),yield na(ri.resendActivationLink,Iv),yield na(ri.resendInvitationLink,Lv),yield na(ri.resendInvitationEmail,Ev),yield na(ri.resendInvitationLinkToAllSubTenants,Ov),yield na(ri.openAddUserDialog,yv),yield na(ri.closeAddUserDialog,fv),yield na(ri.openDeleteUserDialog,pv),yield na(ri.closeDeleteUserDialog,gv)}const Dv=["authorizationUrl"],Cv=["events","url"];function*Uv(){try{yield io(ri.setSocialLoginsState({loading:!0}));const e=yield ro(Dd.auth.getSocialLoginProviders);yield io(ri.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield io(ri.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*Rv(){try{const e=yield co((e=>e.root.context));yield io(ri.setSocialLoginsState({loading:!0}));const t=(yield ro(Dd.auth.getSocialLoginProvidersV2)).map((t=>{let{authorizationUrl:n}=t,i=mi(t,Dv);const o=sa(e,null!=n?n:"");return E({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield io(ri.setSocialLoginsState({socialLoginsConfigV2:t,loading:!1,firstLoad:!1}))}catch(e){yield io(ri.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*_v(e){let{payload:{events:t,url:n}}=e,i=mi(e.payload,Cv);try{yield io(ri.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:l,tenantId:s,name:c}=yield ro(Dd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:yy.SOCIAL_LOGIN,createdAt:new Date,id:l,socialProvider:i.provider,tenantId:s}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:dy.SOCIAL_LOGIN,createdAt:new Date,id:l,url:n,tenantId:s,name:c})),l&&localStorage.setItem("userId",l),yield io(ri.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield co((e=>e.auth));e?yield ro(Nf):yield ro($f)}(),localStorage.removeItem("register-quick-login"),yield io(ri.setSocialLoginsState({loading:!1}))}catch(e){var r;yield io(ri.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*Mv({payload:e}){yield io(ri.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Nv(){yield oa(ri.loadSocialLoginsConfiguration,Uv),yield oa(ri.loadSocialLoginsConfigurationV2,Rv),yield oa(ri.loginViaSocialLogin,_v),yield ia(ri.setSocialLoginError,Mv)}let Fv;function*$v({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield co((e=>e.auth.apiTokensState));try{let e,a;yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield ro(Dd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield ro(Dd.auth.updateUserApiTokensData,{description:t}),yield io(ri.setApiTokensState({showAddTokenDialog:!1})),yield uo(200),yield io(ri.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield io(ri.setApiTokensError({key:Fv.ADD_API_TOKEN,value:e.message})),yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Gv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield co((e=>e.auth.apiTokensState));try{let e,r;yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield ro(Dd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield ro(Dd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield io(ri.setApiTokensState({showAddTokenDialog:!1})),yield uo(200),yield io(ri.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield io(ri.setApiTokensError({key:Fv.ADD_API_TOKEN,value:e.message})),yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*xv({payload:e}){const{apiTokensDataUser:t}=yield co((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!0})),n?(yield ro(Dd.auth.deleteUserAccessToken,{id:e}),yield io(ri.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield ro(Dd.auth.deleteUserApiToken,{tokenId:e}),yield io(ri.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!1}))}catch(e){yield io(ri.setApiTokensError({key:Fv.DELETE_API_TOKEN,value:e.message})),yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!1}))}}function*Vv({payload:e}){const{apiTokensDataTenant:t}=yield co((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!0})),n?(yield ro(Dd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield ro(Dd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield io(ri.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!1}))}catch(e){yield io(ri.setApiTokensError({key:Fv.DELETE_API_TOKEN,value:e.message})),yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!1}))}}function*Wv({payload:e}){null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield oo([ro(Dd.auth.getUserApiTokensData),ro(Dd.auth.getTenantApiTokensData)]);yield io(ri.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield io(ri.setApiTokensError({key:Fv.LOAD_API_TOKENS,value:t.message})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*jv({payload:e}){null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ro(Dd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=ro(Dd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield io(ri.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield io(ri.setApiTokensError({key:Fv.LOAD_API_TOKENS,value:t.message})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Kv({payload:e}){null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ro(Dd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=ro(Dd.auth.getTenantAccessTokensData))?n:[],l=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield io(ri.setApiTokensState({apiTokensDataTenant:null!=l?l:[]})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield io(ri.setApiTokensError({key:Fv.LOAD_API_TOKENS,value:t.message})),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Bv(){yield oa(ri.loadApiTokens,Wv),yield oa(ri.loadUserApiTokens,jv),yield oa(ri.loadTenantApiTokens,Kv),yield na(ri.addUserApiToken,$v),yield na(ri.addTenantApiToken,Gv),yield ia(ri.deleteTenantApiToken,Vv),yield ia(ri.deleteUserApiToken,xv)}function*zv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield co((e=>e.auth.apiTokensState)),a=E({},Gd,{description:t,roleIds:n,clientId:`CLIENT_ID_${IS()}`});yield io(ri.setApiTokensState({showAddTokenDialog:!1})),yield uo(200),yield io(ri.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield uo(200),yield io(ri.setApiTokensLoader({key:Fv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*qv({payload:e}){yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!0})),yield uo(200);const t=[Gd];yield io(ri.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield io(ri.setApiTokensLoader({key:Fv.DELETE_API_TOKEN,value:!1}))}function*Hv({payload:e}){var t;null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));const n=[$d],i=[Gd];yield io(ri.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield uo(200),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Jv({payload:e}){var t;null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));const n=[$d];yield io(ri.setApiTokensState({apiTokensDataUser:n})),yield uo(200),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Yv({payload:e}){var t;null!=e&&e.silentLoading||(yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!0})));const n=[Gd];yield io(ri.setApiTokensState({apiTokensDataTenant:n})),yield uo(200),yield io(ri.setApiTokensLoader({key:Fv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Qv(){yield oa(ri.loadApiTokens,Hv),yield oa(ri.loadUserApiTokens,Jv),yield oa(ri.loadTenantApiTokens,Yv),yield na(ri.addTenantApiToken,zv),yield ia(ri.deleteTenantApiToken,qv)}function*Xv({payload:e}){try{var t;yield io(ri.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield co((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=yield ro(Dd.accountSettings.updateSettings,E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e));yield io(ri.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield io(ri.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Zv({payload:e}){yield io(ri.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield ro(Dd.accountSettings.getSettings);yield io(ri.setAccountSettingsState(E({},e,{loading:!1})))}catch(e){yield io(ri.setAccountSettingsState({loading:!1,error:e.message}))}}function*eh(){yield oa(ri.saveAccountSettings,Xv),yield oa(ri.loadAccountSettings,Zv)}function*th({payload:e}){var t;yield io(ri.setAccountSettingsState({loading:!0})),yield St();const{accountSettingsState:n}=yield co((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s}=n,c=E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:l,logo:s},e);yield io(ri.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*nh({payload:e}){yield io(ri.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield St(),yield io(ri.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*ih(){yield oa(ri.saveAccountSettings,th),yield oa(ri.loadAccountSettings,nh)}function*oh({payload:{tenantId:e,callback:t}}){yield io(ri.setState({isLoading:!0}));try{yield ro(Dd.tenants.switchTenant,{tenantId:e}),yield ro(_f),(null==t?void 0:t(!0))||(yield io(ri.setState({isLoading:!1})))}catch(e){yield io(ri.setState({isLoading:!1})),null==t||t(!1,e)}}function*ah({payload:e}){yield io(ri.setTenantsState({loading:!0}));try{var t;const n=yield ro(Dd.tenants.getTenants);yield io(ri.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 io(ri.setTenantsState({loading:!1}))}}function*rh({payload:e}){yield io(ri.setTenantsState({loading:!0}));try{var t;const n=yield ro(Dd.tenants.getSubTenants);yield io(ri.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield io(ri.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*lh({payload:e}){yield io(ri.setTenantsState({loading:!0}));try{var t;const n=yield ro(Dd.tenants.getSubTenantsAsTree);yield io(ri.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield io(ri.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*sh(){yield na(ri.loadTenants,ah),yield na(ri.loadSubTenants,rh),yield na(ri.switchTenant,oh),yield na(ri.loadSubTenantsTree,lh)}function*ch(){yield io(ri.setTenantsState({loading:!0})),yield St(),yield io(ri.setTenantsState({tenants:ay,loading:!1}))}function*uh(){yield na(ri.loadTenants,ch)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(Fv||(Fv={}));const dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=["callback"];function*Sh({payload:e}){var t;yield io(ri.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield oo([ro(Dd.roles.getRoles),ro(Dd.roles.getPermissions),ro(Dd.roles.getPermissionCategories)]),[t,n,i]=e;yield io(ri.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield io(ri.setRolesState({error:e.message,loading:!1}))}}function*vh(e){let{payload:{callback:t}}=e,n=mi(e.payload,dh);yield io(ri.setRolesState({saving:!0}));try{const e=yield ro(Dd.roles.addRole,n),i=yield ro(Dd.roles.getRoles);yield io(ri.loadRolesAndPermissions({silentLoading:!0})),yield io(ri.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield io(ri.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*hh(e){let{payload:{callback:t}}=e,n=mi(e.payload,yh);yield io(ri.setRolesState({saving:!0}));try{yield ro(Dd.roles.deleteRole,n),yield io(ri.loadRolesAndPermissions({silentLoading:!0})),yield io(ri.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield io(ri.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*mh(e){let{payload:{callback:t}}=e,n=mi(e.payload,fh);yield io(ri.setRolesState({saving:!0}));try{const e=yield ro(Dd.roles.updateRole,n);yield io(ri.loadRolesAndPermissions({silentLoading:!0})),yield io(ri.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield io(ri.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*bh(e){let{payload:{callback:t}}=e,n=mi(e.payload,ph);yield io(ri.setRolesState({saving:!0}));try{const e=yield ro(Dd.roles.attachPermissionsToRole,n);yield io(ri.loadRolesAndPermissions({silentLoading:!0})),yield io(ri.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield io(ri.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Ah(e){let{payload:{callback:t}}=e,n=mi(e.payload,gh);yield io(ri.setRolesState({saving:!0}));try{const e=yield ro(Dd.roles.attachPermissionToRoles,n);yield io(ri.loadRolesAndPermissions({silentLoading:!0})),yield io(ri.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield io(ri.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*kh(){yield oa(ri.loadRolesAndPermissions,Sh),yield na(ri.addRole,vh),yield na(ri.deleteRole,hh),yield na(ri.updateRole,mh),yield na(ri.attachPermissionsToRole,bh),yield na(ri.attachPermissionToRoles,Ah)}function*Th({payload:e}){var t;yield io(ri.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield io(ri.setRolesState({roles:xd,loading:!1}))}catch(e){yield io(ri.setRolesState({error:e.message,loading:!1}))}}function*Ph(){yield oa(ri.loadRolesAndPermissions,Th)}const Ih=["callback"],Lh=["callback"],Eh=["callback"];function*Oh(e){let{payload:{callback:t}}=e,n=mi(e.payload,Ih);yield io(ri.setResetPhoneNumberState({loading:!0}));try{const e=yield ro(Dd.auth.resetPhoneNumber,n);yield io(ri.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Bt.VerifyResetPhoneNumber})),yield io(ri.setLoginState({email:n.email}))}catch(e){yield io(ri.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*wh(e){let{payload:{callback:t}}=e,n=mi(e.payload,Lh);yield io(ri.setResetPhoneNumberState({loading:!0}));try{const e=yield ro(Dd.auth.verifyResetPhoneNumber,n);yield io(ri.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Bt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield io(ri.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Dh(e){let{payload:{callback:t}}=e,n=mi(e.payload,Eh);yield io(ri.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield co((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ro(Dd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield io(ri.setLoginState({step:At.loginWithSmsOtc})),yield io(ri.passwordlessPreLogin({type:Ir.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield io(ri.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Ch(){yield oa(ri.resetPhoneNumber,Oh),yield oa(ri.verifyResetPhoneNumber,wh),yield oa(ri.changePhoneNumber,Dh)}function*Uh(){yield io(ri.setSessionsState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getCurrentUserSessions);yield io(ri.setSessionsState({sessions:e,loading:!1}))}catch(e){yield io(ri.setSessionsState({error:e,loading:!1}))}}function*Rh(){yield io(ri.setSessionsState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getCurrentUserSession);yield io(ri.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield io(ri.setSessionsState({error:e,loading:!1}))}}function*_h({payload:{id:e}}){yield io(ri.setSessionsState({loading:!0,error:null}));try{yield ro(Dd.auth.deleteSessionForUser,e),yield io(ri.loadUserSessions())}catch(e){yield io(ri.setSessionsState({error:e,loading:!1}))}}function*Mh({payload:{callback:e,userId:t}}){yield io(ri.setSessionsState({loading:!0,error:null}));try{yield ro(Dd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield io(ri.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Nh(){yield io(ri.setSessionsState({loading:!0,error:null}));try{yield ro(Dd.auth.deleteAllSessionsForUser),yield io(ri.loadUserSessions())}catch(e){yield io(ri.setSessionsState({error:e,loading:!1}))}}function*Fh(){yield ia(ri.loadUserSessions,Uh),yield ia(ri.deleteUserSession,_h),yield ia(ri.deleteAllUserSessions,Nh),yield ia(ri.loadCurrentUserSession,Rh),yield na(ri.revokeUserSessions,Mh)}function*$h(){yield io(ri.setSessionsState({loading:!0,error:null})),yield io(ri.setSessionsState({sessions:ry,loading:!1}))}function*Gh({payload:{id:e}}){yield io(ri.setSessionsState({loading:!0,error:null}));const t=(yield co((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield io(ri.setSessionsState({sessions:t,loading:!1}))}function*xh(){yield io(ri.setSessionsState({loading:!0,error:null}));const e=ry.filter((e=>e.current));yield io(ri.setSessionsState({sessions:e,loading:!1}))}function*Vh(){yield ia(ri.loadUserSessions,$h),yield ia(ri.deleteUserSession,Gh),yield ia(ri.deleteAllUserSessions,xh)}const Wh=["callback"],jh=["callback"];function*Kh(){yield io(ri.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getSessionConfigurations);yield io(ri.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield io(ri.setSessionsState({error:e,loading:!1}))}}function*Bh({payload:e}){yield io(ri.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=mi(e,Wh);yield ro(Dd.auth.createOrUpdateSessionConfigrations,n),yield io(ri.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield io(ri.setSessionsPolicyState({error:e,loading:!1}))}}function*zh(){yield oa(ri.loadSessionsPolicy,Kh),yield ia(ri.createOrUpdateSessionsPolicy,Bh)}function*qh(){yield io(ri.setSessionsPolicyState({loading:!0,error:null}));const e=yield co((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:ly}));yield io(ri.setSessionsPolicyState(E({},e,{loading:!1})))}function*Hh({payload:e}){yield io(ri.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=mi(e,jh);null==t||t(!0),yield io(ri.setSessionsPolicyState({configurations:n,loading:!1}))}function*Jh(){yield oa(ri.loadSessionsPolicy,qh),yield ia(ri.createOrUpdateSessionsPolicy,Hh)}const Yh=["callback"],Qh=["callback"],Xh=["callback"],Zh=["callback"],em=["callback"],tm=["callback"],nm=["callback"],im=["callback"],om=()=>co((e=>e.auth.restrictionsState.ipRestrictions)),am=()=>co((e=>e.auth.restrictionsState.emailDomainRestrictions));function*rm(){yield io(ri.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield ro(Dd.auth.getDomainRestrictionsConfig),t=(yield ro(Dd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield io(ri.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield io(ri.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*lm(e){let{payload:{callback:t}}=e,n=mi(e.payload,Yh);yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield am();try{var o;yield ro(Dd.auth.createDomainRestriction,n);const e=(yield ro(Dd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield io(ri.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 io(ri.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*sm(e){let{payload:{callback:t}}=e,n=mi(e.payload,Qh);yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield ro(Dd.auth.updateDomainRestrictionConfig,n),i=(yield ro(Dd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield io(ri.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield io(ri.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*cm({payload:{id:e}}){yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield am();try{var n;yield ro(Dd.auth.deleteDomainRestriction,e);const i=(yield ro(Dd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield io(ri.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Fn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield io(ri.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const um=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Fn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*dm(){yield io(ri.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield om(),t=yield ro(Dd.auth.getIPRestrictionsConfig),n=um({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield ro(Dd.auth.getIPRestrictions,n);yield io(ri.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield io(ri.setIpRestrictionsState({error:e.message,loading:!1}))}}function*ym(){try{const{valid:e}=yield ro(Dd.auth.testCurrentIpInAllowList);yield io(ri.setIpRestrictionsState({userIpValid:e}))}catch(e){yield io(ri.setIpRestrictionsState({error:e.message}))}}function*fm({payload:{callback:e}}){yield io(ri.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield co((e=>e.auth.userIp));yield oo([ro(Dd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Fn.ALLOW}),ro(Dd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield om(),i=um(n.pagination),{items:o,_metadata:{totalPages:a}}=yield ro(Dd.auth.getIPRestrictions,i);yield io(ri.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Fn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield io(ri.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*pm(e){let{payload:{callback:t}}=e,n=mi(e.payload,Xh);yield io(ri.setIpRestrictionsState({saving:!0,error:null}));const i=yield om();try{var o,a;yield ro(Dd.auth.createIPRestriction,n);const e=yield om(),r=um(e.pagination),{items:l,_metadata:{totalPages:s}}=yield ro(Dd.auth.getIPRestrictions,r);yield ym(),yield io(ri.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Fn.ALLOW},restrictions:l},pagination:r,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield io(ri.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*gm(e){let{payload:{callback:t}}=e,n=mi(e.payload,Zh);yield io(ri.setIpRestrictionsState({saving:!0,error:null}));try{yield ro(Dd.auth.updateIPRestrictionConfig,n);const e=yield om(),i=yield ro(Dd.auth.getIPRestrictionsConfig),o=um(E({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield ro(Dd.auth.getIPRestrictions,o);yield ym(),yield io(ri.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield io(ri.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Sm({payload:{id:e,callback:t}}){yield io(ri.setIpRestrictionsState({saving:!0,error:null}));const n=yield om();try{var i;yield ro(Dd.auth.deleteIPRestriction,e);const o=yield om(),a=um(o.pagination),{items:r,_metadata:{totalPages:l}}=yield ro(Dd.auth.getIPRestrictions,a);yield ym(),yield io(ri.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Fn.ALLOW},restrictions:r},pagination:a,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield io(ri.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*vm(){yield oa(ri.loadIpRestrictions,dm),yield oa(ri.loadEmailDomainRestrictions,rm),yield na(ri.saveIpRestriction,pm),yield na(ri.saveIpRestrictionsConfig,gm),yield na(ri.deleteIpRestriction,Sm),yield na(ri.checkIfUserIpValid,ym),yield na(ri.addCurrentUserIpAndActivate,fm),yield na(ri.saveEmailDomainRestriction,lm),yield na(ri.saveEmailDomainRestrictionsConfig,sm),yield na(ri.deleteEmailDomainRestriction,cm)}function*hm(){yield io(ri.setIpRestrictionsState({loading:!0,error:null})),yield io(ri.setIpRestrictionsState({data:{restrictions:cy.filter((e=>e.strategy===sy.strategy)),config:sy},totalPages:1,pagination:{_filter:Fn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*mm(){yield io(ri.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield om(),t=cy[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield io(ri.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield io(ri.setIpRestrictionsState({error:e.message,loading:!1}))}}function*bm(e){var t,n,i;let{payload:{callback:o}}=e,a=mi(e.payload,em);yield io(ri.setIpRestrictionsState({saving:!0,error:null}));const r=yield om(),l=r.data.restrictions.filter((e=>e.ip!==a.ip));yield io(ri.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Fn.ALLOW},restrictions:[...l,E({},a,{createdAt:new Date,updatedAt:new Date,id:IS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Fn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Am(e){var t,n,i;let{payload:{callback:o}}=e,a=mi(e.payload,tm);const r=yield om();yield io(ri.setIpRestrictionsState({saving:!0,error:null})),yield io(ri.setIpRestrictionsState({data:{config:E({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Fn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield io(ri.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*km({payload:{id:e,callback:t}}){var n;yield io(ri.setIpRestrictionsState({saving:!0,error:null}));const i=yield om();yield io(ri.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Fn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Fn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*Tm(){yield io(ri.setEmailDomainRestrictionsState({loading:!0,error:null})),yield io(ri.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Fn.ALLOW}],config:{active:!0,listType:Fn.ALLOW,blockPublicDomains:!1}}}))}function*Pm(e){var t,n;let{payload:{callback:i}}=e,o=mi(e.payload,nm);const a=yield am();yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null})),yield St(),null==i||i(!0),yield io(ri.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],E({},o,{id:Date.now().toString()})]},saving:!1}))}function*Im(e){var t;let{payload:{callback:n}}=e,i=mi(e.payload,im);const o=yield am();yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null})),yield St(),null==n||n(!0),yield io(ri.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Fn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Lm({payload:{id:e}}){var t,n;const i=yield am();yield io(ri.setEmailDomainRestrictionsState({saving:!0,error:null})),yield St(),yield io(ri.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Fn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Em(){yield oa(ri.loadIpRestrictions,hm),yield oa(ri.loadEmailDomainRestrictions,Tm),yield na(ri.saveIpRestriction,bm),yield na(ri.saveIpRestrictionsConfig,Am),yield na(ri.deleteIpRestriction,km),yield na(ri.checkIfUserIpValid,mm),yield na(ri.saveEmailDomainRestriction,Pm),yield na(ri.saveEmailDomainRestrictionsConfig,Im),yield na(ri.deleteEmailDomainRestriction,Lm)}const Om=["callback"],wm=["id"];function*Dm(e){const{count:t}=yield ro(Dd.directory.countConfigurationUsers,e.id);return E({},e,{count:t})}function*Cm(){yield io(ri.setProvisioningState({loading:!0,error:null}));try{const e=yield ro(Dd.directory.getConfigs),t=yield oo(e.map((e=>Dm(e))));yield io(ri.setProvisioningState({connections:t,loading:!1}))}catch(e){yield io(ri.setProvisioningState({error:e.message,loading:!1}))}}function*Um(e){let{payload:{callback:t}}=e,n=mi(e.payload,Om);yield io(ri.setProvisioningState({loading:!0,error:null}));try{const e=yield ro(Dd.directory.createConfiguration,n),i=yield ro(Dd.directory.getConfigs),o=yield oo(i.map((e=>Dm(e))));yield io(ri.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield io(ri.setProvisioningState({error:e.message,loading:!1}))}}function*Rm(e){let{payload:{id:t}}=e,n=mi(e.payload,wm);yield io(ri.setProvisioningState({loading:!0,error:null}));try{yield ro(Dd.directory.updateConfiguration,t,n);const e=yield ro(Dd.directory.getConfigs),i=yield oo(e.map((e=>Dm(e))));yield io(ri.setProvisioningState({connections:i,loading:!1}))}catch(e){yield io(ri.setProvisioningState({error:e.message,loading:!1}))}}function*_m({payload:{id:e,callback:t}}){yield io(ri.setProvisioningState({loading:!0,error:null}));try{yield ro(Dd.directory.deleteConfiguration,e);const n=yield ro(Dd.directory.getConfigs),i=yield oo(n.map((e=>Dm(e))));yield io(ri.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield io(ri.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*Mm(){yield oa(ri.loadProvisionConnections,Cm),yield na(ri.createProvisionConnection,Um),yield na(ri.deleteProvisionConnection,_m),yield na(ri.updateProvisionConnection,Rm)}const Nm=["callback","events"];function*Fm(e){let{payload:{callback:t}}=e,n=mi(e.payload,Nm);yield io(ri.setImpersonateState({loading:!0}));try{yield ro(Dd.impersonate.impersonate,n),yield io(ri.setImpersonateState({step:ei.success})),yield uo(1e3),yield Lf(),yield io(ri.resetImpersonateState()),null==t||t(!0)}catch(e){yield io(ri.setImpersonateState({loading:!1,error:e.message}))}}function*$m(){yield oa(ri.impersonate,Fm)}function*Gm(){const{devices:e}=yield ro(Dd.auth.getWebAuthnDevices);yield io(ri.setPasskeysState({devices:null!=e?e:[]}))}function*xm(){yield na(ri.loadWebAuthnDevices,Gm)}const Vm=["groupId"];async function Wm({groupId:e},t){return ua(`${Ea.v1}/${e}`,E({},t))}async function jm(e){return ua(`${Ea.v1}`,E({},e))}async function Km(e){return da(`${Ea.v1}`,e)}async function Bm(e){let{groupId:t}=e,n=mi(e,Vm);return ya(`${Ea.v1}/${t}`,n)}async function zm(e){return pa(`${Ea.v1}/${e}`)}async function qm(e,t){return da(`${Ea.v1}/${e}${Ea.roles}`,t)}async function Hm(e,t){return pa(`${Ea.v1}/${e}${Ea.roles}`,t)}async function Jm(e,t){return da(`${Ea.v1}/${e}${Ea.users}`,t)}async function Ym(e,t){return pa(`${Ea.v1}/${e}${Ea.users}`,t)}async function Qm(){return ua(`${Ea.configurations.v1}`)}async function Xm(e){return da(`${Ea.configurations.v1}`,e)}let Zm,eb;!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"}(Zm||(Zm={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(eb||(eb={}));const tb=["roleIds","userIds"],nb=()=>co((e=>e.auth.groupsState));function*ib({payload:e}){const t=Zm.GET_TEAM_USERS;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield ro(Dd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield io(ri.setGroupsState({teamUsers:n}))}catch(e){yield io(ri.setUsersGroupsError({key:t,value:e.message}))}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*ob({payload:e}){const t=Zm.GET_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield ro(Wm,{groupId:e.groupId},{_groupsRelations:"users"});yield io(ri.setGroupsState({selectedGroup:n}))}catch(e){yield io(ri.setUsersGroupsError({key:t,value:e.message}))}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*ab(){const e=Zm.GET_GROUPS,t=yield nb();yield io(ri.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield ro(jm,{_groupsRelations:eb.rolesAndUsers});yield io(ri.setGroupsState(E({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield io(ri.setUsersGroupsError({key:e,value:t.message}))}finally{yield io(ri.setUsersGroupsLoader({key:e,value:!1}))}}function*rb({payload:e}){const t=Zm.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=mi(e,tb);yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield ro(Km,E({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield io(ri.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield io(ri.addRolesToGroup({groupId:r.id,roleIds:n}))),yield io(ri.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*lb({payload:e}){const t=Zm.UPDATE_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(Bm,e),yield io(ri.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*sb({payload:e}){const t=Zm.DELETE_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(zm,e.groupId),yield io(ri.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*cb({payload:e}){const t=Zm.ADD_ROLES_TO_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(qm,e.groupId,{roleIds:e.roleIds}),yield io(ri.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*ub({payload:e}){const t=Zm.DELETE_ROLES_FROM_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(Hm,e.groupId,{roleIds:e.roleIds}),yield io(ri.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*db({payload:e}){const t=Zm.ADD_USERS_TO_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(Jm,e.groupId,{userIds:e.userIds}),yield io(ri.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 io(ri.setUsersGroupsError({key:t,value:n.message}))}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*yb({payload:e}){const t=Zm.DELETE_USERS_FROM_GROUP;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ro(Ym,e.groupId,{userIds:e.userIds}),yield io(ri.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield io(ri.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*fb(){const e=Zm.GET_GROUP_CONFIGURATION;yield io(ri.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield ro(Qm);yield io(ri.setGroupsState({groupsConfiguration:t}))}catch(t){yield io(ri.setUsersGroupsError({key:e,value:t.message}))}finally{yield io(ri.setUsersGroupsLoader({key:e,value:!1}))}}function*pb({payload:e}){const t=Zm.UPDATE_GROUP_CONFIGURATION;yield io(ri.setUsersGroupsLoader({key:t,value:!0}));try{yield ro(Xm,e),yield io(ri.getGroupConfiguration())}catch(e){yield io(ri.setUsersGroupsError({key:t,value:e.message}))}finally{yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}}function*gb(){yield ia(ri.loadGroups,ab),yield ia(ri.getGroupById,ob),yield ia(ri.createGroup,rb),yield ia(ri.updateGroup,lb),yield ia(ri.deleteGroup,sb),yield ia(ri.addRolesToGroup,cb),yield ia(ri.deleteRolesFromGroup,ub),yield ia(ri.addUsersToGroup,db),yield ia(ri.deleteUsersFromGroup,yb),yield ia(ri.getGroupConfiguration,fb),yield ia(ri.updateGroupConfiguration,pb),yield ia(ri.getTeamUsers,ib)}function*Sb(){const e=Zm.GET_GROUPS;yield io(ri.setUsersGroupsLoader({key:e,value:!0}));const t=uy;yield io(ri.setGroupsState({groups:t})),yield io(ri.setUsersGroupsLoader({key:e,value:!1}))}function*vb({payload:e}){const t=Zm.CREATE_GROUP,{groups:n}=yield nb();yield io(ri.setUsersGroupsLoader({key:t,value:!0})),yield io(ri.setGroupsState({groups:[...null!=n?n:[],E({},e,{id:`${e.name}ID`})]})),yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}function*hb({payload:e}){var t;const n=Zm.UPDATE_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:""}):t}))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*mb({payload:e}){var t;const n=Zm.DELETE_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*bb({payload:e}){var t;const n=Zm.ADD_ROLES_TO_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*Ab({payload:e}){var t;const n=Zm.DELETE_ROLES_FROM_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*kb({payload:e}){var t;const n=Zm.ADD_USERS_TO_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*Tb({payload:e}){var t;const n=Zm.DELETE_USERS_FROM_GROUP,i=yield nb();yield io(ri.setUsersGroupsLoader({key:n,value:!0})),yield io(ri.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield io(ri.setUsersGroupsLoader({key:n,value:!1}))}function*Pb(){const e=Zm.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield nb();yield io(ri.setUsersGroupsLoader({key:e,value:!0})),t&&(yield io(ri.setGroupsState({groupsConfiguration:E({},t)}))),yield io(ri.setUsersGroupsLoader({key:e,value:!1}))}function*Ib({payload:e}){const t=Zm.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield nb();yield io(ri.setUsersGroupsLoader({key:t,value:!0})),n&&(yield io(ri.setGroupsState({groupsConfiguration:E({},n,e)}))),yield io(ri.setUsersGroupsLoader({key:t,value:!1}))}function*Lb(){yield ia(ri.loadGroups,Sb),yield ia(ri.createGroup,vb),yield ia(ri.updateGroup,hb),yield ia(ri.deleteGroup,mb),yield ia(ri.addRolesToGroup,bb),yield ia(ri.deleteRolesFromGroup,Ab),yield ia(ri.addUsersToGroup,kb),yield ia(ri.deleteUsersFromGroup,Tb),yield ia(ri.getGroupConfiguration,Pb),yield ia(ri.updateGroupConfiguration,Ib)}var Eb={sagas:function*(){yield oo([ro(kp),ro(gS),ro(vS),ro(rS),ro(Ch),ro($p),ro(cg),ro(gg),ro(zg),ro(Sv),ro(gb),ro(Nv),ro(hy),ro(Bv),ro(zy),ro(eh),ro(sh),ro(kh),ro(Fh),ro(zh),ro(vm),ro(Mm),ro($m),ro(xm)])},mockSagas:function*(){yield oo([ro(Ip),ro(Bp),ro(mg),ro(tS),ro(wv),ro(Qv),ro(rf),ro(Vh),ro(ih),ro(uh),ro(Jh),ro(Em),ro(Ph),ro(Lb)])},storeName:Lt,initialState:Zn,reducer:oi,actions:ri};const Ob=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),wb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Db={setAuditLogsState:Ob("auditLogsState"),resetAuditLogsState:e=>E({},e,{auditLogsState:wb})},Cb={exportAuditsCsv:at("auditLogs/exportAuditsCsv"),loadAuditLogs:at("auditLogs/loadAuditLogs",(e=>({payload:e})))},Ub={loading:!0},Rb={setAuditsMetadataState:Ob("auditsMetadataState"),resetAuditsMetadataState:e=>E({},e,{auditsMetadataState:Ub})},_b={loadAuditsMetadata:at("auditLogs/loadAuditsMetadata")},Mb={auditLogsState:wb,auditsMetadataState:Ub},{reducer:Nb,actions:Fb}=lt({name:Ot,initialState:Mb,reducers:E({resetState:e=>E({},e,Mb),setState:(e,{payload:t})=>E({},e,t)},Db,Rb)}),$b=E({},Fb,Cb,_b),Gb=e=>"createdAt"!==e.id,xb={total:20,data:Array.from(Array(5).keys()).map((e=>E({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Vb={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}]},Wb=()=>co((e=>e.auditLogs.auditLogsState)),jb=()=>co((e=>e.auditLogs.auditsMetadataState));function*Kb(){const e=yield Wb(),{columns:t}=yield jb();try{const n=e.filter,i=e.sort.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});yield io($b.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Dd.audits.exportAudits(E({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield io($b.setAuditLogsState({isDownloadingCsv:!1}))}function*Bb({payload:e}){yield io($b.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Wb(),{columns:n}=yield jb();try{var i,o,a,r,l;const s=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 io($b.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});n||(yield io($b.loadAuditsMetadata()));const{data:p,total:g}=yield ro(Dd.audits.getAudits,E({offset:c,count:s},y,f));yield io($b.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 io($b.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*zb(){yield na($b.exportAuditsCsv,Kb),yield na($b.loadAuditLogs,Bb)}function*qb({payload:e}){yield io($b.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield Wb(),{columns:n}=yield jb();try{var i,o,a,r,l;const s=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 io($b.setAuditLogsState({pageSize:s,pageOffset:c,filter:u,sort:d})),n||(yield io($b.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=xb;let i=n.filter((e=>t=>e.filter(Gb).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 io($b.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 io($b.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(s=e.callback)||s.call(e,null,t)}}function*Hb(){yield na($b.loadAuditLogs,qb)}function*Jb(){yield io($b.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield ro(Dd.metadata.getAuditsMetadata);yield io($b.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield io($b.setAuditsMetadataState({error:e,loading:!1}))}}function*Yb(){yield na($b.loadAuditsMetadata,Jb)}function*Qb(){yield io($b.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Vb;yield io($b.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield io($b.setAuditsMetadataState({error:e,loading:!1}))}}function*Xb(){yield na($b.loadAuditsMetadata,Qb)}var Zb={sagas:function*(){yield oo([ro(zb),ro(Yb)])},mockSagas:function*(){yield oo([ro(Hb),ro(Xb)])},storeName:Ot,initialState:Mb,reducer:Nb,actions:$b};const eA={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:tA,actions:nA,reducer:iA}=lt({name:"audits",initialState:eA,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=E({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),oA=E({},nA,{initData:at(`${tA}/initData`),loadAudits:at(`${tA}/loadAudits`),removeFilter:at(`${tA}/removeFilter`),filterData:at(`${tA}/filterData`),exportCSV:at(`${tA}/exportCSV`),deleteAudits:at(`${tA}/deleteAudits`)}),aA=()=>co((e=>e[tA]));function*rA(){const{sortBy:e,sortDirection:t}=yield aA();try{const n=yield ro(Dd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield io(oA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield io(oA.loadItemFailedAction(t))}}function*lA(){try{const e=yield ro(Dd.metadata.getAuditsMetadata);yield io(oA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield io(oA.loadItemFailedAction(t))}}const sA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*cA({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield aA(),{appendMode:l=r,onlyOneLoad:s=!0,offset:c}=e||{},{rowsData:u}=l?yield aA():{rowsData:[]};try{const e=sA(t),{data:l,total:d}=yield ro(Dd.audits.getAudits,E({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield io(oA.loadAuditsSuccess({rowsData:[...u,...l],total:d})),s&&(yield io(oA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield io(oA.loadItemFailedAction(t))}}function*uA(){yield io(oA.startLoading()),yield oo([rA(),lA(),cA({payload:{onlyOneLoad:!1},type:""})]),yield io(oA.finishLoading())}function*dA({payload:e}){const{filters:t}=yield aA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield io(oA.setFilterData(i))}function*yA({payload:e}){const{filters:t}=yield aA();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 io(oA.setFilterData(i))}function*fA(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield aA(),a=sA(e);yield io(oA.startDownloadingCsv());try{yield Dd.audits.exportAudits(E({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield io(oA.stopDownloadingCsv())}}function*pA(){yield ia(oA.initData,uA),yield ia(oA.removeFilter,dA),yield ia(oA.filterData,yA),yield ia([oA.loadAudits,oA.textSearch,oA.onPageChange],cA),yield ia([oA.setFilterData,oA.setDataSorting,oA.startRefresh],(()=>cA({payload:{appendMode:!1},type:""}))),yield ia(oA.exportCSV,fA)}const gA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},SA={initData:()=>E({},gA),setConnectivityState:(e,{payload:t})=>E({},e,t),cleanWebhookTestData:e=>E({},e,{testResult:void 0}),cleanWebhookLogsData:e=>E({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return E({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>E({},e,{error:void 0}),cleanSlackData:e=>E({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,t)})}},vA={loadSlackActions:at("connectivity/loadSlackActions"),loadDataAction:at("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:at("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:at("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:at("connectivity/loadScope"),deleteWebhookConfigAction:at("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:at("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:at("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},hA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:mA,actions:bA}=lt({name:Et,initialState:hA,reducers:E({},SA)}),AA=E({},bA,vA),kA={slack:Dd.connectivity.getSlackConfiguration,email:Dd.connectivity.getEmailConfiguration,sms:Dd.connectivity.getSMSConfiguration,webhook:Dd.connectivity.getWebhooksConfigurations,categories:Dd.connectivity.getCategories,channelMap:Dd.connectivity.getChannelMaps},TA={slack:Dd.connectivity.postSlackConfiguration,email:Dd.connectivity.postEmailConfiguration,sms:Dd.connectivity.postSMSConfiguration,webhook:Dd.connectivity.postWebhooksConfiguration},PA=["email","slack","sms","webhook"],IA={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"}},LA=["id"],EA=["id","enabled"],OA=["categories","channelMap"];function*wA(e){return yield ro(CA,{payload:{api:e},type:""})}function*DA({payload:e=PA}){yield io(AA.setConnectivityState({isLoading:!0}));try{const t=yield oo([...e.map(wA),yield CA({payload:{api:"categories"},type:""}),yield function*(){return(yield oo(e.map((function*(e){return yield CA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>E({},t,{[`${e[i]}`]:n})),{})}()]),n=yield CA({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?E({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:IA[e[o]].events(i),active:IA[e[o]].isActive(i),platform:IA[e[o]].title,image:IA[e[o]].image}]}):n:E({},n,{[`${OA[o-e.length]}`]:i})),{list:[],webhook:n});yield io(AA.setConnectivityState(E({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield io(AA.setConnectivityState({isLoading:!1}))}}function*CA({payload:{api:e,params:t}}){try{return yield ro(kA[e],t)}catch(e){return}}function*UA(){try{yield io(AA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield ro(Dd.connectivity.getSlackChannels);yield io(AA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield io(AA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*RA(e,t){const{connectivity:{list:n}}=yield co(),i=n.find((({key:t})=>t===e));if(!i)return;const o=IA[e].isActive(t);o!==i.active&&(yield io(AA.setConnectivityState({list:n.map((t=>t.key===e?E({},t,{active:o}):t))})))}function*_A({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield co((e=>e.connectivity));try{if(yield io(AA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield co();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield oo([...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=mi(e,LA);return n===t.id&&JSON.stringify(E({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield ro(TA.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield ro(Dd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield co(),{processIds:i}=yield co((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield oo([...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 ro("email"===t?Dd.connectivity.postEmailConfiguration:Dd.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,l=mi(o,EA);return yield oo([yield ro("email"===t?Dd.connectivity.patchEmailConfiguration:Dd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield ro("email"===t?Dd.connectivity.putEmailSubscriptions:Dd.connectivity.putSMSSubscriptions,a,i,E({},l,{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 ro("email"===t?Dd.connectivity.deleteEmailSubscriptions:Dd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield CA({payload:{api:t},type:""});yield io(AA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield RA(t,e)}else yield io(AA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield ro(TA[e],t),!["sms","email"].includes(e)){const o=yield CA({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield io(AA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield RA(e,o),null==n||n(!0)}}catch(e){var o;yield io(AA.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*MA({payload:e}){try{yield Dd.connectivity.postSlackCode(e)}catch{}yield io(AA.setConnectivityState({error:void 0,isSaving:!1}))}function*NA(){const{slackChannels:e}=yield co((e=>e.connectivity));try{yield io(AA.setConnectivityState({slackChannels:E({},e,{isLoadingScope:!0})}));const{clientId:t}=yield ro(Dd.connectivity.getSlackScope);yield io(AA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield io(AA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*FA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield co((e=>e.connectivity));try{yield io(AA.setConnectivityState({isSaving:!0})),yield ro(Dd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield CA({payload:{api:"webhook"},type:""});o&&(yield io(AA.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*$A({payload:e}){try{yield io(AA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield ro(Dd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield io(AA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield io(AA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield io(AA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*GA({payload:e}){try{const{statusCode:t}=yield ro(Dd.connectivity.postWebhookRetry,e);yield io(AA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield io(AA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*xA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield co((e=>e.connectivity));try{yield io(AA.setConnectivityState({webhookLogs:E({},i,{isLoading:!0})}));const o=yield ro(Dd.connectivity.getWebhookLog,e,n,t);yield io(AA.setConnectivityState({error:void 0,webhookLogs:E({isLoading:!1},o)}))}catch(e){yield io(AA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var VA={sagas:function*(){yield na(AA.loadDataAction,DA),yield ia(AA.loadSlackActions,UA),yield na(AA.postDataAction,_A),yield na(AA.postCodeAction,MA),yield na(AA.loadScope,NA),yield na(AA.deleteWebhookConfigAction,FA),yield na(AA.postWebhookTestAction,$A),yield na(AA.postWebhookRetryAction,GA),yield ia(AA.loadWebhookLogsAction,xA)},storeName:Et,initialState:hA,reducer:mA,actions:AA};function WA(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}}function jA(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>E({},n,{[e]:t(n[e],i)})}}function KA(e){return jA(e,((e,t)=>E({},e,{loading:t.payload})))}function BA(e){return jA(e,((e,t)=>E({},e,{error:t.payload,loading:!1})))}const zA={loading:!1,error:null,fetching:!0,plans:[]},{actions:qA,reducer:HA,name:JA}=lt({name:"subscriptions/plans",initialState:zA,reducers:E({},WA())}),YA=E({loadPlans:at(`${JA}/loadPlans`)},qA),QA={loading:!1,error:null,fetching:!0,config:null},XA=E({},WA()),{actions:ZA,reducer:ek,name:tk}=lt({name:"subscriptions/config",initialState:QA,reducers:XA}),nk=E({loadPaymentConfiguration:at(`${tk}/loadPaymentConfiguration`)},ZA),ik={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},ok=E({},WA(),{setCancellationLoading:KA("cancellation"),setCancellationError:BA("cancellation"),setRenewalLoading:KA("renewal"),setRenewalError:BA("renewal")}),{reducer:ak,actions:rk,name:lk}=lt({name:"subscriptions/billing/subscription",initialState:ik,reducers:ok}),sk=E({load:at(`${lk}/loadSubscription`),cancelSubscription:at(`${lk}/cancelSubscription`),renewSubscription:at(`${lk}/renewSubscription`)},rk),ck={loading:!1,error:null,fetching:!0},uk=E({},WA()),{reducer:dk,actions:yk,name:fk}=lt({name:"subscriptions/billing/information",initialState:ck,reducers:uk}),pk=E({loadBillingInformation:at(`${fk}/loadBillingInformation`),cancelSubscription:sk.cancelSubscription,renewSubscription:sk.renewSubscription},yk),gk={loading:!1,error:null,fetching:!0},Sk=E({},WA(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}),{reducer:vk,actions:hk,name:mk}=lt({name:"subscriptions/billing/payment",initialState:gk,reducers:Sk}),bk=E({loadPaymentMethod:at(`${mk}/loadPaymentMethod`),submitPaymentMethod:at(`${mk}/submitPaymentMethod`),submitPaymentMethodError:at(`${mk}/submitPaymentMethodError`),submitPaymentMethodSuccess:at(`${mk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:at(`${mk}/updateBillingDetails`,(e=>({payload:e})))},hk),Ak={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},kk=E({},WA(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{invoiceDownload:E({},e.invoiceDownload,t.payload)})}}),{reducer:Tk,actions:Pk,name:Ik}=lt({name:"subscriptions/billing/invoices",initialState:Ak,reducers:kk}),Lk=E({loadInvoices:at(`${Ik}/loadInvoices`),downloadInvoice:at(`${Ik}/downloadInvoice`,(e=>({payload:e})))},Pk),Ek={information:ck,invoices:Ak,paymentMethod:gk,subscription:ik},Ok={invoices:Lk,information:pk,paymentMethod:bk,subscription:sk},wk=Ge({invoices:Tk,information:dk,paymentMethod:vk,subscription:ak}),Dk={fetching:!0,loading:!1,error:null,confirmed:!1},Ck=E({},WA()),{actions:Uk,reducer:Rk,name:_k}=lt({name:"subscriptions/checkout",initialState:Dk,reducers:Ck}),Mk=E({loadCheckout:at(`${_k}/loadCheckout`),resetCheckout:at(`${_k}/resetCheckout`),submitCheckout:at(`${_k}/submitCheckout`),confirmCheckout:at(`${_k}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:at(`${_k}/errorCheckout`,(e=>({payload:e})))},Uk),Nk={loading:!1,error:null,cardSetupIntentSecret:null},Fk=E({},WA()),{reducer:$k,actions:Gk,name:xk}=lt({name:"subscriptions/stripe",initialState:Nk,reducers:Fk}),Vk=E({loadCustomer:at(`${xk}/loadCustomer`),createCardSetupIntentSecret:at(`${xk}/createCardSetupIntentSecret`)},Gk),Wk={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:jk,reducer:Kk,name:Bk}=lt({name:"subscriptions/vendorPublicConfig",initialState:Wk,reducers:E({},WA())}),zk=E({loadVendorPublicConfiguration:at(`${Bk}/loadVendorPublicConfiguration`)},jk),qk={config:QA,plans:zA,checkout:Dk,billing:Ek,stripe:Nk,vendorPublicConfig:Wk},Hk={config:nk,billing:Ok,plans:YA,checkout:Mk,stripe:Vk,vendorPublicConfig:zk},Jk=Ge({config:ek,billing:wk,plans:HA,checkout:Rk,stripe:$k,vendorPublicConfig:Kk});let Yk,Qk,Xk;function Zk({policy:e}){return{policy:Xk.AT_PERIOD_END}}function eT(e){switch(e){case Yu.ACTIVE:return Qk.ACTIVE;case Yu.INCOMPLETE:return Qk.INCOMPLETE;case Yu.CANCELED:return Qk.CANCELED;case Yu.EXPIRED:return Qk.EXPIRED;case Yu.TRIALING:return Qk.TRIALING;default:return Qk.EXPIRED}}!function(e){e.STRIPE="Stripe"}(Yk||(Yk={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(Qk||(Qk={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Xk||(Xk={}));const tT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Yu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},nT=[{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"}],iT=[{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:""}],oT=[{id:"id",externalId:"externalId",type:Qu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],aT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*rT(){yield na(sk.load,lT),yield na(sk.cancelSubscription,cT),yield na(sk.renewSubscription,uT)}function*lT(){const e=yield co((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield gT(e)}function*sT(){yield io(sk.setLoading(!0));try{const[e]=yield ro(Dd.subscriptions.getManagedSubscriptions);yield io(sk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield io(sk.setError(e))}}function*cT(){const{subscription:e}=yield co((e=>e.subscriptions.billing.subscription));if(!e)return void(yield io(sk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield io(sk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Yu.ACTIVE)try{yield io(sk.setCancellationLoading(!0)),yield ro(Dd.subscriptions.cancelManagedSubscription,t),yield sT(),yield io(sk.setCancellationLoading(!1))}catch(e){yield io(sk.setCancellationError(e.message))}}function*uT(){const{subscription:e}=yield co((e=>e.subscriptions.billing.subscription));if(!e)return void(yield io(sk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield io(sk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Xu.AT_PERIOD_END)try{yield io(sk.setRenewalLoading(!0)),yield ro(Dd.subscriptions.renewManagedSubscription,t),yield sT(),yield io(sk.setRenewalLoading(!1))}catch(e){yield io(sk.setCancellationError(e.message))}}function*dT(){yield io(sk.setLoading(!0)),yield uo(500),yield io(sk.setState({subscription:tT,fetching:!1,loading:!1,error:null}))}function*yT(){yield na(sk.load,dT)}function*fT(){yield na(pk.loadBillingInformation,pT)}function*pT(){yield function*(e){const t=yield co((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield co((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield gT(n,!1):yield io(pk.setError(t?"Not authorized":"Internal feature failure"))}()}function*gT(e,t){yield io(pk.setLoading(!0));try{var n,i;const o=yield ro(Dd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let l,s=null;r?l=yield ro(Dd.subscriptions.getSubscriptionPlan,a):([,l]=yield oo([ro(sT),ro(Dd.subscriptions.getSubscriptionPlan,a)]),s=yield co((e=>e.subscriptions.billing.subscription.subscription||null))),yield io(pk.setState(E({loading:!1,fetching:!1,summary:o},s?{subscription:{id:s.id,externalId:s.externalId,startDate:s.startDate,currentPeriodStart:s.currentPeriodStart,currentPeriodEnd:s.currentPeriodEnd,status:t?Qk.ACTIVE:eT(s.status),cancellation:s.cancellation&&Zk(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==(i=l.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:l.slug}}:{})))}catch(e){yield io(pk.setError(e.message))}}function*ST(){yield function*(){var e,t;yield io(pk.setLoading(!0)),yield uo(500),yield io(pk.setState({loading:!1,fetching:!1,summary:{subscriptionId:tT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:Zu.Stripe,externallyManaged:!1,currentPlanId:nT[0].id,defaultPlanId:nT[0].id},plan:E({},nT[0],{price:null==(e=nT[0].price)?void 0:e.amount,currency:null==(t=nT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*vT(){yield na(pk.loadBillingInformation,ST)}function*hT(){yield na(bk.loadPaymentMethod,mT),yield na(bk.submitPaymentMethod,AT),yield na(bk.submitPaymentMethodError,kT),yield na(bk.submitPaymentMethodSuccess,TT),yield na(bk.updatePaymentMethodBillingDetails,bT)}function*mT(){yield io(bk.setLoading(!0));try{const e=(yield ro(Dd.subscriptions.getPaymentMethods))[0];yield io(bk.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield io(bk.setError(e.message))}}function*bT({payload:e}){yield io(bk.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield ro(Dd.subscriptions.updatePaymentMethodBillingDetails,t,E({email:n},i)),yield ro(mT),null==o||o(!0)}catch(e){yield io(bk.setError(e.message)),null==o||o(!1)}yield io(bk.setLoading(!1))}function*AT(){yield io(bk.setLoading(!0))}function*kT({payload:e}){yield io(bk.setError(e))}function*TT(){yield io(bk.loadPaymentMethod())}function*PT(){yield io(bk.setLoading(!0)),yield uo(500);const e=oT[0];yield io(bk.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*IT(){yield na(bk.loadPaymentMethod,PT)}function*LT(){yield na(Lk.loadInvoices,ET),yield na(Lk.downloadInvoice,OT)}function*ET(){yield io(Lk.setLoading(!0));try{const e=(yield ro(Dd.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 io(Lk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield io(Lk.setError(e.message))}}function*OT({payload:e}){yield io(Lk.setInvoiceDownloadState({loading:!0,error:null}));try{yield ro(Dd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield io(Lk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield io(Lk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*wT(){yield io(Lk.setLoading(!0)),yield uo(500),yield io(Lk.setState({loading:!1,fetching:!1,invoices:iT.map((e=>E({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield io(Lk.setLoading(!1))}function*DT(){yield na(Lk.loadInvoices,wT)}function*CT(){yield oo([ro(fT),ro(hT),ro(LT),ro(rT)])}function*UT(){yield oo([ro(vT),ro(IT),ro(DT),ro(yT)])}function*RT(){yield na(Mk.loadCheckout,_T),yield na(Mk.resetCheckout,MT),yield na(Mk.submitCheckout,NT),yield na(Mk.confirmCheckout,FT),yield na(Mk.errorCheckout,GT)}function*_T(){yield io(Mk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*MT(){yield io(Mk.setState({loading:!1,error:null,confirmed:!1}))}function*NT(){yield io(Mk.setState({loading:!0,error:null}))}function*FT({payload:{paymentMethodId:e,planId:t}}){const n=yield co((e=>e.subscriptions.billing.subscription.subscription)),i=yield co((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Yu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield io(Mk.setState({loading:!0,error:null})),o&&a)return yield $T(),void(yield io(sk.setState({subscription:E({},n,{status:Yu.ACTIVE})})));try{yield ro(Dd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield oo([pT(),mT(),ET()]),yield $T()}catch(e){yield io(Mk.setState({loading:!1,error:e.message}))}}else yield io(Mk.setState({loading:!1,error:"Subscription not found"}))}function*$T(){yield io(Mk.setState({loading:!1,error:null,confirmed:!0}))}function*GT({payload:e}){yield io(Mk.setState({loading:!1,error:e}))}function*xT(){yield na(Mk.resetCheckout,MT)}function*VT(){yield na(YA.loadPlans,WT)}function*WT(){yield io(YA.setLoading(!0));try{const e=(yield ro(Dd.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 io(YA.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield io(YA.setError(e.message))}}function*jT(){yield io(YA.setLoading(!0)),yield uo(500),yield io(YA.setState({fetching:!1,loading:!1,plans:nT.map((e=>{var t,n;return E({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*KT(){yield na(YA.loadPlans,jT)}function*BT(){yield na(nk.loadPaymentConfiguration,zT)}function*zT(){yield io(nk.setLoading(!0));try{(yield ro(Dd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===Zu.Stripe))?yield function*(){yield io(nk.setLoading(!0));try{const e=yield ro(Dd.subscriptions.getStripePaymentProviderConfiguration);yield io(nk.setState({loading:!1,fetching:!1,config:{paymentProvider:Yk.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield io(nk.setError(e.message))}}():yield io(nk.setError("Payment provider not configured"))}catch(e){yield io(nk.setError(e.message))}}function*qT(){yield io(nk.setLoading(!0)),yield uo(500),yield io(nk.setState({loading:!1,fetching:!1,config:{paymentProvider:Yk.STRIPE,apiKey:""}}))}function*HT(){yield na(nk.loadPaymentConfiguration,qT)}function*JT(){yield na(Vk.createCardSetupIntentSecret,YT)}function*YT({payload:e}){yield io(Vk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield ro(Dd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield io(Vk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield io(Vk.setError(e.message))}}function*QT(){yield na(zk.loadVendorPublicConfiguration,XT)}function*XT(){yield io(zk.setLoading(!0));try{const e=yield ro(Dd.subscriptions.getVendorPublicConfigurations);yield io(zk.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield io(zk.setError(e.message))}}function*ZT(){yield io(zk.setLoading(!0)),yield uo(500),yield io(zk.setState({fetching:!1,loading:!1,vendorPublicConfig:aT}))}function*eP(){yield na(zk.loadVendorPublicConfiguration,ZT)}var tP={sagas:function*(){yield oo([ro(CT),ro(RT),ro(VT),ro(BT),ro(JT),ro(QT)])},mockSagas:function*(){yield oo([ro(UT),ro(xT),ro(KT),ro(HT),ro(eP)])},reducer:Jk,actions:Hk,initialState:qk,storeName:"subscriptions"},nP={sagas:function*(){yield na(Py.loadVendorPublicInfo,Iy)},storeName:wt,initialState:Ay,reducer:ky,actions:Py};const{reducer:iP}=lt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(aa.setContext(t),E({},e,{context:t}))}}}),oP=(e,t,n=!1,i,o,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||aa.setContext(e.context);const t=qo(),h=[...it({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=ot({middleware:h,preloadedState:{root:E({},e,{previewMode:n,urlStrategy:r}),[Eb.storeName]:E({},Eb.initialState,i,null!=(s=null==o?void 0:o.auth)?s:{},{routes:E({},Eb.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[Zb.storeName]:E({},Zb.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:E({},Zb.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:E({},Zb.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[tA]:E({},eA,null!=(v=null==o?void 0:o.audits)?v:{}),[VA.storeName]:VA.initialState,[tP.storeName]:tP.initialState,[nP.storeName]:nP.initialState},reducer:Ge({root:iP,[Eb.storeName]:Eb.reducer,[Zb.storeName]:Zb.reducer,[tA]:iA,[VA.storeName]:VA.reducer,[tP.storeName]:tP.reducer,[nP.storeName]:nP.reducer})});const m=function*(){yield oo([ro(Eb.sagas),ro(Zb.sagas),ro(pA),ro(VA.sagas),ro(tP.sagas),ro(nP.sagas)])},b=function*(){yield oo([ro(Eb.mockSagas),ro(Zb.mockSagas),ro(tP.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(ri.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel}return l.store};var aP=n(714),rP=n.n(aP);function lP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function sP(e){if(e.type)return e;if("#"===e.charAt(0))return sP(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 cP(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 uP(e){if(0===e.indexOf("#"))return e;const{values:t}=sP(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 dP(e,t){return e=sP(e),t=lP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,cP(e)}function yP(e,t){if(e=sP(e),t=lP(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 cP(e)}function fP(e,t){if(e=sP(e),t=lP(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 cP(e)}const pP=e=>{if(e)return{main:e,light:uP(fP(e,.4)),dark:uP(yP(e,.15)),hover:uP(yP(e,.15)),active:uP(yP(e,.2))}},gP=e=>{if(e)return{main:e,light:fP(e,.7),dark:yP(e,.2)}},SP=(e,t)=>{var n,i,o,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)?E({},t,{palette:{primary:E({},pP(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:E({},pP(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(l=null==e||null==(s=e.palette)?void 0:s.secondaryText)?l:"#000000"}),danger:E({},pP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:E({},gP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:E({},gP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:E({},gP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:E({},gP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},vP={},hP={},mP={},bP={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class AP{constructor(){this._theme=vP,this._themeV2=hP,this._navigation=bP,this._localizations=mP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new AP;return n.set(e),AP._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,l;this._navigation=rP().all([null!=(t=bP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=rP().all([null!=(i=vP)?i:{},SP(null==e?void 0:e.theme,vP)]),this._themeV2=rP().all([null!=(o=hP)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=rP().all([null!=(r=mP)?r:{},null!=(l=null==e?void 0:e.localizations)?l:{}])}catch(e){this._navigation=bP,this._theme=vP,this._themeV2=hP,this._localizations=mP}}}AP._instances={};var kP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},TP=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},PP=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let IP,LP,EP,OP,wP,DP,CP,UP,RP,_P,MP;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(IP||(IP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(LP||(LP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(EP||(EP={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(OP||(OP={})),function(e){e.Invoices="invoices"}(wP||(wP={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(DP||(DP={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(CP||(CP={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(UP||(UP={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(RP||(RP={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(_P||(_P={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(MP||(MP={}));const NP={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},FP={hidden:"hidden",edit:"edit"};var $P="6.75.0-alpha.3",GP={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on"},xP=function(){function e(t,n){var i,o,a,r,l=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A(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($P),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=w(C().mark((function e(){var t,n,i,o,a;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ua,l.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:a=e.sent,l.options.metadata=null!=(n=null==a||null==(i=a.rows)||null==(o=i[0])?void 0:o.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:AP.set(l.options.metadata,l.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=w(C().mark((function e(){return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:l.options.hostedLoginBox||l.options.builderMode||"nextjs"===l.options.framework||l.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=w(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!l.options.previewMode&&!l.options.builderMode){e.next=4;break}ud.set({flags:GP}),e.next=14;break;case 4:return e.prev=4,e.next=7,dd();case 7:t=e.sent,ud.set({flags:t}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 14:case"end":return e.stop()}}),e,null,[[4,11]])}))),this.updateLocalizationsSetter=function(e){l.updateLocalizations=e};var c=kP(n),u="frontegg-app-".concat(c);this.iframeRendering=s,this.name=c,this.options=E({},t,{contextOptions:E({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=u;var d=this.options.authOptions?E({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.store=null!=(o=this.options.store)?o:oP({context:this.options.contextOptions},this,this.options.previewMode,d,{auth:null!=(a=this.options.authOptions)?a:{},audits:null!=(r=this.options.auditsOptions)?r:{}},!1,this.options.urlStrategy),L.setInstance(c,this)}var t,n,i,o;return I(e,[{key:"initContainers",value:(o=w(C().mark((function e(t){return C().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;AP.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:m,FronteggTypes:b})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=w(C().mark((function e(){return C().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=w(C().mark((function e(){var t;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=w(C().mark((function e(t){var n;return C().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,E({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),VP=function(){function e(){A(this,e)}return I(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=L.getInstance(i);e&&t?(aa.setAccessToken(t),aa.setUser(E({},n,{accessToken:t})),o.store.dispatch(ri.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ri.loadTenants())):(aa.setAccessToken(null),aa.setUser(null),o.store.dispatch(ri.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),WP=function(){function e(){A(this,e)}return I(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).hideAdminPortal()}}]),e}(),jP=function(){function e(){A(this,e)}return I(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";L.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";L.getInstance(e).hideCheckoutDialog()}}]),e}(),KP=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},BP=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:oP({context:a},this,!0,void 0,void 0,!0),this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a},o),this.app=new xP(this.options,t,!0),AP.set({},t)}var t;return I(e,[{key:"render",value:(t=w(C().mark((function e(t){var n,i,o,a,r=this;return C().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,PP(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}(),zP="modern",qP=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[zP]},HP=function(){function e(t,n,i,o){A(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var a={baseUrl:"preview"};this.store=null!=i?i:oP({context:a},this,!0,void 0,void 0,!0),this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:a,onRedirectTo:function(){console.debug("path")}},o),this.app=new xP(this.options,t,!0),AP.set({},t)}var t;return I(e,[{key:"render",value:(t=w(C().mark((function e(t){var n,i,o,a,r=this;return C().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,PP(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 JP(e,t){return JP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},JP(e,t)}function YP(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&&JP(e,t)}function QP(e,t){if(t&&("object"===k(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 XP(e){return XP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},XP(e)}function ZP(){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 eI(e,t,n){return eI=ZP()?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&&JP(o,n.prototype),o},eI.apply(null,arguments)}function tI(e){var t="function"==typeof Map?new Map:void 0;return tI=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 eI(e,arguments,XP(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),JP(n,e)},tI(e)}function nI(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=XP(e);if(t){var o=XP(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return QP(this,n)}}var iI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new xP(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){YP(n,e);var t=nI(n);function n(){var e;A(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 I(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=L.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=TP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=TP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=TP(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),s=a.attachShadow({mode:"open"}),c=TP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=TP(l,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=TP(s,"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}(tI(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}()}));