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