@frontegg/js 6.190.0-alpha.0 → 6.190.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see frontegg.production.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(()=>(()=>{var e={6987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const a=n(3651),i=n(9082);t.createConditionEvaluator=function(e){const t=(0,i.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:o}=t(e.condition.value);if(!n||void 0===o)return()=>!1;const r=(0,a.useOperation)(e.condition.op,o);return t=>{const n=t[e.condition.attribute];if(void 0===n||!r)return!1;const{isValid:a}=r(n);return e.condition.negate?!a:a}}},2898:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(6987),t),i(n(7371),t)},7371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3840:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const a=n(2380);t.evaluateFeatureFlag=function(e,t){if(!e.on)return{treatment:e.offTreatment};const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,a.createRuleEvaluator)({rule:e})(t)===a.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},6095:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3840),t)},9314:(e,t,n)=>{"use strict";t.wJ=t.tE=void 0;n(6095),n(521),n(2380),n(2379);var a=n(5535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return a.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return a.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const o=n(2379),r=n(6610);i(n(6610),t),i(n(7226),t),t.BooleanOperationsMapper={[o.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},6610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},7226:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const a=n(2379);t.singleBooleanSanitizer=e=>{const t=void 0!==e.boolean&&(e=>"boolean"==typeof e)(e.boolean)?{boolean:e.boolean}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.BooleanSanitizersMapper={[a.OperationEnum.Is]:t.singleBooleanSanitizer}},3651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const a=n(5943),i=n(1610),o=n(9004),r=n(195),s={...a.StringOperationsMapper,...i.NumericOperationsMapper,...o.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},9082:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const a=n(195),i=n(2903),o=n(6886),r=n(1610),s={...i.StringSanitizersMapper,...r.NumericSanitizersMapper,...o.DateSanitizersMapper,...a.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},9004:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const o=n(2379),r=n(4569);i(n(4569),t),i(n(5931),t),t.DateOperationsMapper={[o.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[o.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[o.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[o.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},4569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useDateBetweenOperation=t.useDateOnOrBeforeOperation=t.useDateOnOrAfterOperation=t.useDateOnOperation=void 0,t.useDateOnOperation=function(e){return t=>({isValid:t.getTime()===e.date.getTime()})},t.useDateOnOrAfterOperation=function(e){return t=>({isValid:t.getTime()>=e.date.getTime()})},t.useDateOnOrBeforeOperation=function(e){return t=>({isValid:t.getTime()<=e.date.getTime()})},t.useDateBetweenOperation=function(e){return t=>({isValid:t.getTime()>=e.start.getTime()&&t.getTime()<=e.end.getTime()})}},6886:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const a=n(2379);t.sanitizeDateValue=e=>new Date(e),t.isValidDate=e=>e instanceof Date&&!isNaN(e),t.sanitizeSingleDate=e=>{const n=e.date?(0,t.sanitizeDateValue)(e.date):void 0,a=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!a,sanitizedValue:a}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,a=e.end?(0,t.sanitizeDateValue)(e.end):void 0,i=n&&a&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(a)?{start:n,end:a}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.DateSanitizersMapper={[a.OperationEnum.On]:t.sanitizeSingleDate,[a.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[a.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[a.OperationEnum.BetweenDate]:t.sanitizeDateRange}},5931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1610:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const o=n(2379),r=n(9217);t.NumericOperationsMapper={[o.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[o.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[o.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[o.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[o.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[o.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},i(n(9217),t),i(n(9326),t),i(n(1764),t)},9217:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useBetweenNumericOperation=t.useLesserThanEqualOperation=t.useLesserThanOperation=t.useGreaterThanEqualOperation=t.useGreaterThanOperation=t.useEqualsOperation=void 0,t.useEqualsOperation=function(e){return t=>({isValid:t===e.number})},t.useGreaterThanOperation=function(e){return t=>({isValid:t>e.number})},t.useGreaterThanEqualOperation=function(e){return t=>({isValid:t>=e.number})},t.useLesserThanOperation=function(e){return t=>({isValid:t<e.number})},t.useLesserThanEqualOperation=function(e){return t=>({isValid:t<=e.number})},t.useBetweenNumericOperation=function(e){return t=>({isValid:t>=e.start&&t<=e.end})}},9326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const a=n(2379),i=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&i(e.number)?{number:e.number}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeNumericRange=e=>{const t=void 0!==e.start&&void 0!==e.end&&i(e.start)&&i(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[a.OperationEnum.Equal]:t.sanitizeSingleNumber,[a.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[a.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[a.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[a.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[a.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},1764:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5943:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const o=n(2379),r=n(2431);i(n(2431),t),i(n(2097),t),t.StringOperationsMapper={[o.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[o.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[o.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[o.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[o.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},2431:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useMatchesOperation=t.useInListOperation=t.useContainsOperation=t.useEndsWithOperation=t.useStartsWithOperation=void 0,t.useStartsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.startsWith(e)))})},t.useEndsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.endsWith(e)))})},t.useContainsOperation=function(e){return t=>({isValid:e.list.some((e=>t.includes(e)))})},t.useInListOperation=function(e){return t=>({isValid:e.list.includes(t)})},t.useMatchesOperation=function(e){return t=>{let n;try{n=new RegExp(e.string)}catch(e){return{isValid:!1}}return{isValid:n.test(t)}}}},2903:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const a=n(2379),i=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&i(e.string)?{string:e.string}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeListString=e=>{const t=void 0!==e.list&&e.list.every((e=>i(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[a.OperationEnum.Matches]:t.sanitizeSingleString,[a.OperationEnum.Contains]:t.sanitizeListString,[a.OperationEnum.StartsWith]:t.sanitizeListString,[a.OperationEnum.EndsWith]:t.sanitizeListString,[a.OperationEnum.InList]:t.sanitizeListString}},2097:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2379:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3982),t)},3982:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperationEnum=void 0,(n=t.OperationEnum||(t.OperationEnum={})).InList="in_list",n.StartsWith="starts_with",n.EndsWith="ends_with",n.Contains="contains",n.Matches="matches",n.Equal="equal",n.GreaterThan="greater_than",n.GreaterThanEqual="greater_than_equal",n.LesserThan="lower_than",n.LesserThanEqual="lower_than_equal",n.BetweenNumeric="between_numeric",n.Is="is",n.On="on",n.BetweenDate="between_date",n.OnOrAfter="on_or_after",n.OnOrBefore="on_or_before"},521:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3603),t)},3603:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluatePlan=void 0;const a=n(2380);t.evaluatePlan=function(e,t){const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,a.createRuleEvaluator)({rule:e})(t)===a.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},2380:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(2930),t),i(n(1304),t)},1304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const a=n(2930),i=n(2898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,i.createConditionEvaluator)({condition:e})(t)))?a.RuleEvaluationResultEnum.Treatable:a.RuleEvaluationResultEnum.Insufficient}},2930:(e,t)=>{"use strict";var n,a;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(a=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",a.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},5535:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3779),t),i(n(1038),t),i(n(5113),t),i(n(4848),t)},5640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.directEntitlementEvalutor=void 0;const a=n(5113);t.directEntitlementEvalutor=function(e,t,n={}){const i=t.features[e];let o=!1;return i&&null!==i.expireTime&&(o=i.expireTime!==a.NO_EXPIRATION_TIME&&i.expireTime<Date.now(),!o)?{isEntitled:!0}:{isEntitled:!1,justification:o?a.NotEntitledJustification.BUNDLE_EXPIRED:a.NotEntitledJustification.MISSING_FEATURE}}},9838:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.featureFlagEvaluator=void 0;const a=n(5113),i=n(6095),o=n(4668),r=n(2380);t.featureFlagEvaluator=function(e,t,n={}){const s=t.features[e];if(s&&s.featureFlag){const e=(0,o.prepareAttributes)(n),{treatment:t}=(0,i.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE}}},4529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIsEntitledEvaluators=void 0;const a=n(5640),i=n(9838),o=n(3751);t.getIsEntitledEvaluators=function(){return[a.directEntitlementEvalutor,i.featureFlagEvaluator,o.planTargetingRulesEvalutor]}},3751:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.planTargetingRulesEvalutor=void 0;const a=n(5113),i=n(4668),o=n(2380),r=n(521);t.planTargetingRulesEvalutor=function(e,t,n={}){const s=t.features[e];if(s&&s.planIds&&s.planIds.length>0){const e=(0,i.prepareAttributes)(n),a=t.plans;for(const t of s.planIds){const n=a[t];if(n){const{treatment:t}=(0,r.evaluatePlan)(n,e);if(t===o.TreatmentEnum.True)return{isEntitled:!0}}}}return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE}}},3779:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(7850),t)},7850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToFeature=void 0;const a=n(5113),i=n(4848),o=n(4529);t.evaluateIsEntitledToFeature=function(e,t,n={}){if(!t)return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE};const r=[];for(const a of(0,o.getIsEntitledEvaluators)())if(r.push(a(e,t,n)),!(0,i.shouldContinue)(r))break;return(0,i.getResult)(r)}},1038:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(519),t)},519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=void 0;const a=n(7850),i=n(5113),o=n(4848),r=n(4852);t.evaluateIsEntitledToPermissions=function(e,t,n){if(!t)return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};if(!(0,r.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const s=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!s.length)return{isEntitled:!0};const l=[];for(const e of s)if(l.push((0,a.evaluateIsEntitledToFeature)(e,t,n)),!(0,o.shouldContinue)(l))break;return(0,o.getResult)(l)}},5113:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NO_EXPIRATION_TIME=t.NotEntitledJustification=void 0,(n=t.NotEntitledJustification||(t.NotEntitledJustification={})).MISSING_FEATURE="MISSING_FEATURE",n.MISSING_PERMISSION="MISSING_PERMISSION",n.BUNDLE_EXPIRED="BUNDLE_EXPIRED",t.NO_EXPIRATION_TIME=-1},4668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const a=n(193);function i(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function o(e,t){return Object.keys(e).reduce(((n,a)=>(n[`${t}${a}`]=e[a],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,a.flatten)(r);return{...n,...o(t?t(r):i(r),"frontegg."),...o(s,"jwt.")}},t.defaultFronteggAttributesMapper=i,t.modifyObjectKeysWithPrefix=o},1882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldContinue=t.getResult=void 0;const a=n(5113);t.getResult=function(e){let t=!1;for(const n of e){if(n.isEntitled)return n;n.justification===a.NotEntitledJustification.BUNDLE_EXPIRED&&(t=!0)}return{isEntitled:!1,justification:t?a.NotEntitledJustification.BUNDLE_EXPIRED:a.NotEntitledJustification.MISSING_FEATURE}},t.shouldContinue=function(e){return e.every((({isEntitled:e})=>!e))}},193:(e,t)=>{"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatten=void 0,t.flatten=function(e,t){const a=(null==(t=t||{})?void 0:t.delimiter)||".",i=null==t?void 0:t.maxDepth,o=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const d=n[c],u=(null==t?void 0:t.safe)&&Array.isArray(d),y=Object.prototype.toString.call(d),f=(p=d)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+a+o(c):o(c);if(!u&&!f&&g&&Object.keys(d).length&&(!(null==t?void 0:t.maxDepth)||i&&l<i))return e(d,S,l+1);r[S]=d}))}(e),r}},4848:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(4852),t),i(n(4668),t),i(n(1882),t)},4852:(e,t)=>{"use strict";function n(e){return new RegExp("^"+e.replace(/\./g,"\\.").replace(/\*/g,".*")+"$","gs")}Object.defineProperty(t,"__esModule",{value:!0}),t.createPermissionCheckRegex=t.checkPermission=void 0,t.checkPermission=function(e,t){return Object.keys(e).some((e=>n(e).test(t)))},t.createPermissionCheckRegex=n},9714: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 a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return a(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=a;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var i={};return n.isMergeableObject(e)&&o(e).forEach((function(t){i[t]=a(e[t],n)})),o(t).forEach((function(o){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(r(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(o,n)(e[o],t[o],n):i[o]=a(t[o],n))})),i}(e,n,l):a(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},9378:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var a,i,o;if(Array.isArray(t)){if((a=t.length)!=n.length)return!1;for(i=a;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((a=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=a;0!=i--;){var r=o[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},7609:(e,t,n)=>{var a=n(7425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function y(e,t,n,a){var i=t&&t.prototype instanceof g?t:g,o=Object.create(i.prototype),s=new _(a||[]);return r(o,"_invoke",{value:I(e,n,s)}),o}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={};u(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(L([])));b&&b!==n&&o.call(b,l)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,r,s,l){var c=f(e[i],e,r);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==a(u)&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(u).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var i;r(this,"_invoke",{value:function(e,a){function o(){return new t((function(t,i){n(e,a,t,i)}))}return i=i?i.then(o,o):o()}})}function I(e,t,n){var a="suspendedStart";return function(i,o){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var r=n.delegate;if(r){var s=k(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var l=f(e,t,n);if("normal"===l.type){if(a=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a="completed",n.method="throw",n.arg=l.arg)}}}function k(e,t){var n=t.method,a=e.iterator[n];if(void 0===a)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(a,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function O(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function L(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:w}}function w(){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=u(v,d,"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,u(e,d,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},T(E.prototype),u(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,a,i,o){void 0===o&&(o=Promise);var r=new E(y(e,n,a,i),o);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(A),u(A,d,"Generator"),u(A,l,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var a in t)n.push(a);return n.reverse(),function e(){for(;n.length;){var a=n.pop();if(a in t)return e.value=a,e.done=!1,e}return e.done=!0,e}},t.values=L,_.prototype={constructor:_,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(P),!e)for(var t in this)"t"===t.charAt(0)&&o.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,a){return r.type="throw",r.arg=e,t.next=n,a&&(t.method="next",t.arg=void 0),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),l=o.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(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 a=n.completion;if("throw"===a.type){var i=a.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},7425: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},2841:(e,t,n)=>{var a=n(7609)();e.exports=a;try{regeneratorRuntime=a}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}}},t={};function n(a){var i=t[a];if(void 0!==i)return i.exports;var o=t[a]={exports:{}};return e[a].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";n.r(a),n.d(a,{AdminPortal:()=>xw,AdminPortalRenderer:()=>Bw,AppHolder:()=>D,CheckoutDialog:()=>Vw,FronteggApp:()=>Gw,HostedLogin:()=>$w,LoginBoxRenderer:()=>Kw,createElement:()=>mw,defaultTheme:()=>Ww,formatName:()=>hw,getThemeAdminByName:()=>jw,getThemeByName:()=>zw,initialize:()=>tU,mockFlagsList:()=>Fw,restoreSearchParams:()=>Aw,waitThemeSetter:()=>bw});var e={};n.r(e),n.d(e,{Delete:()=>jr,Get:()=>Gr,Patch:()=>xr,Post:()=>$r,PostDownload:()=>Br,Put:()=>Vr,extractHeadersFromOptions:()=>Wr,getBaseUrl:()=>Cr,getMetadataHeaders:()=>Nr,getScopedTenant:()=>Mr});var t={};n.r(t),n.d(t,{FeatureFlags:()=>Hr,loadFeatureFlags:()=>qr});var i={};n.r(i),n.d(i,{GetUserJwt:()=>Jr,getCurrentUserTenantsV1:()=>ts,getCurrentUserTenantsV3:()=>es,getUsersGroups:()=>Zr,getUsersRoles:()=>Qr,getUsersV2:()=>Yr,getUsersV3:()=>Xr,sendResetBreachedPasswordEmails:()=>ns,updateUserProfileV2:()=>as});var o={};n.r(o),n.d(o,{getHierarchyMetadata:()=>Ss,getParentTenants:()=>ys,getParentTenantsById:()=>fs,getSubTenants:()=>ds,getSubTenantsAsTree:()=>us,getTenants:()=>cs,getTenantsUsersCount:()=>ps,searchSubTenants:()=>gs,switchTenant:()=>ls});var r={};n.r(r),n.d(r,{loadEntitlementsV2:()=>Ys});var s={};n.r(s),n.d(s,{AuthStrategyEnum:()=>Oa,MachineToMachineAuthStrategy:()=>Pa,OAuthLogout:()=>Pl,SocialLoginProviders:()=>ka,acceptInvitation:()=>Tl,activateAccount:()=>vl,activateAccountV2:()=>hl,bulkCreateIPRestriction:()=>Fs,changePhoneNumber:()=>Ud,changePhoneNumberWithVerification:()=>Ld,checkIfAllowToRememberMfaDevice:()=>Qc,createDomainRestriction:()=>Us,createIPRestriction:()=>Ms,createOrUpdateSessionConfigrations:()=>Mc,createSSOConfiguration:()=>id,createSSOConfigurationByMetadata:()=>sd,createSSOConfigurationByMetadataUrl:()=>cd,createSSODomain:()=>ud,createSSOGroup:()=>vd,createSamlGroup:()=>bc,createTenantAccessToken:()=>Wc,createUserAccessToken:()=>Bc,deleteAllSessionsForUser:()=>Gc,deleteDomainRestriction:()=>Rs,deleteIPRestriction:()=>$s,deleteSSOConfiguration:()=>rd,deleteSSODomain:()=>yd,deleteSSOGroup:()=>md,deleteSamlGroup:()=>Tc,deleteSessionForUser:()=>Fc,deleteTenantAccessToken:()=>Vc,deleteTenantApiToken:()=>Jc,deleteUserAccessToken:()=>jc,deleteUserApiToken:()=>Yc,deleteWebAuthnDevice:()=>Fd,disableMFAAuthenticatorApp:()=>Vl,disableMFASMS:()=>Bl,disableMFAWebAuthn:()=>zl,disableMfa:()=>xl,enrollMFAAuthenticatorApp:()=>Cl,enrollMFAAuthenticatorAppForLogin:()=>ql,enrollMFAAuthenticatorAppForLoginV2:()=>Jl,enrollMFASMS:()=>Ml,enrollMFASMSForLogin:()=>tc,enrollMFASMSForLoginV2:()=>nc,enrollMFAWebAuthn:()=>Gl,enrollMFAWebAuthnForLogin:()=>sc,enrollMFAWebAuthnForLoginV2:()=>lc,enrollMfa:()=>Dl,exchangeOAuthTokens:()=>kd,exchangeOAuthTokensV2:()=>Ed,forgotPassword:()=>_l,generateLoginResponse:()=>nl,generateLoginResponseFromOAuthResponse:()=>sl,generateLoginResponseFromOAuthResponseV2:()=>ll,generateLoginResponseV2:()=>al,generateLoginResponseV3:()=>rl,generateStepupSession:()=>Kd,getActivateAccountStrategy:()=>ml,getCaptchaPolicy:()=>Is,getCurrentUserSession:()=>Rc,getCurrentUserSessions:()=>Dc,getCurrentUserTenantsFunction:()=>ss,getCustomSocialLoginProvidersV1:()=>_c,getDomainRestrictions:()=>Ls,getDomainRestrictionsConfig:()=>ws,getGlobalSecurityPolicy:()=>vs,getIPRestrictions:()=>Cs,getIPRestrictionsConfig:()=>Ns,getLockoutPolicy:()=>As,getMFADevices:()=>Kl,getMFAStrategiesConfig:()=>Vd,getMeAndEntitlements:()=>zd,getMeV2:()=>Bd,getMfaPolicy:()=>hs,getOidcConfiguration:()=>Ec,getPasswordConfigPolicy:()=>_s,getPasswordHistoryPolicy:()=>ks,getPublicAuthStrategiesConfigForAuthenticatedUser:()=>xd,getSSOConfigurations:()=>ad,getSSODefaultRoles:()=>gd,getSSOGroups:()=>bd,getSSOPublicConfiguration:()=>Ic,getSamlConfiguration:()=>yc,getSamlRoles:()=>vc,getSamlRolesGroups:()=>hc,getSamlVendorConfiguration:()=>pc,getSessionConfigurations:()=>Nc,getSocialLoginProviders:()=>kc,getSocialLoginProvidersV2:()=>Oc,getSocialLoginProvidersV2ForAuthenticatedUser:()=>Pc,getTabTenantFromSessionStorage:()=>rs,getTenantAccessTokensData:()=>xc,getTenantApiTokensData:()=>Kc,getUserAccessTokensData:()=>$c,getUserApiTokensData:()=>zc,getUserAuthorization:()=>jd,getUserById:()=>Xc,getVendorConfig:()=>wc,getVendorLockoutPolicy:()=>Ts,getVendorMfaPolicy:()=>ms,getVendorPasswordHistoryPolicy:()=>Os,getVendorPublicAuthStrategiesConfig:()=>$d,getWebAuthnDevices:()=>Md,loadPasswordConfig:()=>wl,login:()=>fl,loginViaSocialLogin:()=>Lc,loginWithMfa:()=>gl,loginWithMfaV2:()=>Sl,loginv2:()=>pl,logout:()=>Ol,oidcPostLogin:()=>yl,oidcPostLoginV2:()=>Td,passwordlessPostLogin:()=>td,passwordlessPostLoginV2:()=>ed,passwordlessPreLogin:()=>Zc,postLogin:()=>ul,preDisableMFASMS:()=>jl,preDisableMFAWebAuthn:()=>Wl,preEnrollMFAAuthenticatorApp:()=>Rl,preEnrollMFAAuthenticatorAppForLogin:()=>Hl,preEnrollMFASMS:()=>Nl,preEnrollMFASMSForLogin:()=>ec,preEnrollMFAWebAuthn:()=>Fl,preEnrollMFAWebAuthnForLogin:()=>rc,preLogin:()=>cl,preLoginV2:()=>Ad,preLoginWithIdpType:()=>dl,preVerifyMFAEmailCode:()=>Xl,preVerifyMFASMSForLogin:()=>ac,preVerifyMFAWebAuthnForLogin:()=>cc,recoverMfaToken:()=>Ul,refreshToken:()=>El,refreshTokenV2:()=>Il,refreshTokenV3:()=>kl,removeTabTenantFromSessionStorage:()=>os,resendActivationEmail:()=>bl,resendInvitationEmail:()=>Al,resetPassword:()=>Ll,resetPhoneNumber:()=>Pd,revokeSessionsForUser:()=>Cc,saveLockoutPolicy:()=>Es,saveMfaPolicy:()=>bs,savePasswordHistoryPolicy:()=>Ps,setSSODefaultRoles:()=>Sd,setTabTenantInSessionStorage:()=>is,signUpUser:()=>Uc,silentOAuthRefreshToken:()=>Od,silentOAuthRefreshTokenV2:()=>Id,testCurrentIp:()=>xs,testCurrentIpInAllowList:()=>Vs,updateDomainRestrictionConfig:()=>Ds,updateIPRestrictionConfig:()=>Gs,updateSSOConfiguration:()=>od,updateSSOConfigurationByMetadata:()=>ld,updateSSOConfigurationByMetadataUrl:()=>dd,updateSSOGroup:()=>hd,updateSamlConfiguration:()=>fc,updateSamlGroup:()=>Ac,updateSamlRoles:()=>mc,updateSamlVendorMetadata:()=>gc,updateTenantApiTokensData:()=>qc,updateUserApiTokensData:()=>Hc,validateSSODomain:()=>fd,validateSSODomainV2:()=>pd,validateSamlDomain:()=>Sc,verifyChangePhoneNumber:()=>wd,verifyInviteToken:()=>nd,verifyMFAAuthenticatorAppForLogin:()=>Yl,verifyMFAEmailCode:()=>Ql,verifyMFAEmailCodeV2:()=>Zl,verifyMFASMSForLogin:()=>ic,verifyMFASMSForLoginV2:()=>oc,verifyMFAWebAuthnForLogin:()=>dc,verifyMFAWebAuthnForLoginV2:()=>uc,verifyMfa:()=>$l,verifyNewDeviceSession:()=>Gd,verifyResetPhoneNumber:()=>_d,webAuthnCreateNewDeviceSession:()=>Nd,webAuthnPostLogin:()=>Rd,webAuthnPostLoginV2:()=>Cd,webAuthnPreLogin:()=>Dd});var l={};n.r(l),n.d(l,{addUser:()=>Qd,changePassword:()=>Yd,createInviteUserLink:()=>iu,deleteInviteUserLink:()=>ru,deleteUser:()=>Zd,getInviteLinkConfiguration:()=>lu,getInviteUserLink:()=>su,getProfile:()=>Hd,getTemporaryUserConfiguration:()=>au,loadAvailablePermissions:()=>du,loadAvailableRoles:()=>cu,loadStats:()=>uu,loadUsers:()=>Xd,resendActivationLink:()=>yu,resendInvitationLink:()=>fu,resendInvitationLinkToAllTenants:()=>pu,setPermanentUser:()=>nu,updateInviteUserLink:()=>ou,updateProfile:()=>qd,updateProfileImage:()=>Jd,updateUser:()=>eu,updateUserExpirationTime:()=>tu});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:()=>Su,getAuditsMetadata:()=>Au,getCurrentUserIpMetadata:()=>hu,getIpAdressMetadata:()=>Tu,getNotificationsMetadata:()=>mu,getSamlMetadata:()=>bu,updateAdminBoxMetadata:()=>vu});var d={};n.r(d),n.d(d,{downloadReport:()=>wu,getReport:()=>Pu,getReports:()=>Ou,renderReport:()=>_u,scheduleReport:()=>Lu,sendReport:()=>Uu});var u={};n.r(u),n.d(u,{getNotifications:()=>Du,markAllAsRead:()=>Nu,updateNotificationIsPinned:()=>Cu,updateNotificationStatus:()=>Ru});var y={};n.r(y),n.d(y,{exportAudits:()=>$u,getAudits:()=>Fu,getAuditsStats:()=>Gu});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:()=>Zu,deleteEmailSubscriptions:()=>Xu,deleteSMSConfiguration:()=>oy,deleteSMSSubscriptions:()=>ay,deleteSlackConfiguration:()=>Ku,deleteWebhooksConfiguration:()=>ly,getCategories:()=>yy,getChannelMaps:()=>fy,getEmailConfiguration:()=>qu,getSMSConfiguration:()=>ey,getSlackChannels:()=>Wu,getSlackConfiguration:()=>ju,getSlackScope:()=>Bu,getWebhookLog:()=>cy,getWebhooksConfigurations:()=>ry,patchEmailConfiguration:()=>Yu,patchSMSConfiguration:()=>ny,postEmailConfiguration:()=>Ju,postSMSConfiguration:()=>ty,postSlackCode:()=>Hu,postSlackConfiguration:()=>zu,postWebhookRetry:()=>uy,postWebhookTest:()=>dy,postWebhooksConfiguration:()=>sy,putEmailSubscriptions:()=>Qu,putSMSSubscriptions:()=>iy});var p={};n.r(p),n.d(p,{getPublicSettings:()=>Sy,getSettings:()=>gy,updateSettings:()=>py});var g={};n.r(g),n.d(g,{addRole:()=>Ay,addRoleV2:()=>_y,attachPermissionToRoles:()=>Oy,attachPermissionsToRole:()=>Iy,deleteRole:()=>Ty,getPermissionCategories:()=>Py,getPermissions:()=>ky,getRoles:()=>by,updateRole:()=>Ey});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:()=>sf,ISubscriptionStatus:()=>of,PaymentMethodType:()=>rf,ProviderType:()=>lf,TenantCreatedAction:()=>df,TrialEndAction:()=>cf,cancelManagedSubscription:()=>My,cancelSubscription:()=>Uy,createStripeCustomer:()=>Yy,createStripePaymentMethodSetupIntentSecret:()=>Qy,createSubscription:()=>qy,createTenantConfiguration:()=>tf,getManagedSubscription:()=>Cy,getManagedSubscriptions:()=>Ny,getPaymentMethod:()=>Ky,getPaymentMethods:()=>zy,getPaymentProviders:()=>nf,getStripeCustomer:()=>Jy,getStripePaymentProviderConfiguration:()=>Xy,getSubscription:()=>wy,getSubscriptionInvoice:()=>jy,getSubscriptionInvoicePdf:()=>By,getSubscriptionInvoices:()=>Vy,getSubscriptionPlan:()=>xy,getSubscriptionPlans:()=>$y,getSubscriptionSummaries:()=>Zy,getSubscriptions:()=>Ly,getTenantConfiguration:()=>ef,getVendorPublicConfigurations:()=>af,renewManagedSubscription:()=>Fy,renewSubscription:()=>Dy,updateManagedSubscription:()=>Gy,updatePaymentMethodBillingDetails:()=>Hy,updateSubscription:()=>Ry});var v={};n.r(v),n.d(v,{assignUserToApplications:()=>gf,getApplicationsData:()=>pf,getTenantsApplications:()=>ff,getUserApplicationsId:()=>uf,getUsersApplicationsId:()=>yf,getUsersOfApplications:()=>vf,unassignUserFromApplications:()=>Sf});var h={};n.r(h),n.d(h,{getVendorPublicInfo:()=>hf});var m={};n.r(m),n.d(m,{addUserRolesForSubTenants:()=>Tf,addUserToTenantAndSubTenants:()=>bf,addUsersToSubTenant:()=>wf,createSubTenant:()=>kf,deleteSubTenant:()=>Of,loadAllUsers:()=>mf,removeUserFromTenantAndSubTenants:()=>Af,removeUserRolesFromSubTenants:()=>Ef,setUserRolesForSubTenants:()=>If,updateSubAccountAccess:()=>Lf,updateSubTenant:()=>Pf,updateSubTenantManagement:()=>_f});var b={};n.r(b),n.d(b,{countConfigurationUsers:()=>Nf,createConfiguration:()=>Rf,deleteConfiguration:()=>Cf,getConfigs:()=>Uf,updateConfiguration:()=>Df});var A={};n.r(A),n.d(A,{impersonate:()=>Mf});var T={};n.r(T),n.d(T,{addRolesToGroup:()=>Wf,addUsersToGroup:()=>Kf,createGroup:()=>Vf,deleteGroup:()=>Bf,deleteRolesFromGroup:()=>zf,deleteUsersFromGroup:()=>Hf,getGroupById:()=>Gf,getGroupConfiguration:()=>qf,getGroups:()=>$f,getGroupsByIds:()=>xf,updateGroup:()=>jf,updateGroupConfiguration:()=>Jf});var E={};n.r(E),n.d(E,{getInsights:()=>Xf,getRecommendations:()=>Yf});var I={};n.r(I),n.d(I,{createPhoneNumber:()=>Zf,deletePhoneNumber:()=>ep,getUserPhoneNumbers:()=>Qf,preVerifyPhoneNumber:()=>tp,verifyDeletePhoneNumber:()=>ap,verifyPhoneNumber:()=>np});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:()=>Qs,ApplicationAccessType:()=>Ep,AuthStrategyEnum:()=>Oa,ContextHolder:()=>Wo,FeatureFlags:()=>Hr,FronteggApiError:()=>Ko,FronteggContext:()=>zo,FronteggFrameworks:()=>ya,GetUsersFilterPreset:()=>ga,GroupManagedByEnum:()=>vp,GroupRelations:()=>Sp,ISubscriptionCancellationPolicy:()=>sf,ISubscriptionStatus:()=>of,InsightCode:()=>mp,LOAD_AUTHORIZATION_FF:()=>Js,MFAStrategyEnum:()=>qs,MachineToMachineAuthStrategy:()=>Pa,NotEntitledJustification:()=>Xs,PaginationOrderEnum:()=>fa,PaymentMethodType:()=>rf,PermissionAssignmentTypeEnum:()=>sp,ProviderType:()=>lf,RecommendationActionKey:()=>bp,RecommendationCode:()=>hp,RecommendationSeverity:()=>Ap,RequestSource:()=>ua,RestrictionType:()=>Kn,ScimConnectionSource:()=>gp,SecondaryAuthStrategy:()=>Ks,SecurityCategory:()=>Tp,SocialLoginProviders:()=>ka,SortByEnum:()=>pa,TenantSortByEnum:()=>op,TenantType:()=>rp,UserManagedByEnum:()=>ip,WebAuthnDeviceType:()=>Hs,api:()=>Ip,countConfigurationUsers:()=>Nf,createConfiguration:()=>Rf,default:()=>kp,deleteConfiguration:()=>Cf,fetch:()=>e,fronteggAuthApiRoutesRegex:()=>lp,fronteggEntitlementsV2Url:()=>pp,fronteggHeaders:()=>da,fronteggRefreshTokenUrl:()=>cp,fronteggSilentRefreshTokenUrl:()=>dp,fronteggTenantsUrl:()=>yp,fronteggTenantsV3Url:()=>fp,fronteggUsersUrl:()=>up,getConfigs:()=>Uf,getCurrentUserTenantsFunction:()=>ss,getTabTenantFromSessionStorage:()=>rs,loadFeatureFlags:()=>qr,providersArray:()=>Sa,setTabTenantInSessionStorage:()=>is,updateConfiguration:()=>Df});var O={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e){return _="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)}function L(e){var t=function(e,t){if("object"!==_(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!==_(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===_(t)?t:String(t)}function w(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,L(a.key),a)}}function U(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(O),n.d(O,{AccountDetailsPageTabs:()=>Rw,AccountPageFields:()=>Ow,DomainRestrictionsTabFields:()=>Dw,GeneralSettingsTabFields:()=>ww,InviteUserModalFields:()=>kw,IpRestrictionsTabFields:()=>Uw,Metadata:()=>vw,PrivacyPageFields:()=>Iw,ProfilePageFields:()=>Ew,SecurityPageTabs:()=>_w,SessionManagementTabFields:()=>Lw,SignupFields:()=>Tw,SubscriptionsPageFields:()=>Pw,alpha:()=>dw,fieldAppearance:()=>Cw,tabAppearance:()=>Nw});var D=function(){function e(){P(this,e)}return U(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 R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,o,r,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t,n,a,i,o,r){try{var s=e[o](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(a,i)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(a,i){var o=e.apply(t,n);function r(e){N(o,a,i,r,s,"next",e)}function s(e){N(o,a,i,r,s,"throw",e)}r(void 0)}))}}D._apps={};var F=n(2841),G=n.n(F);function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},$.apply(this,arguments)}function x(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];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 V(e){return!!e&&!!e[Pe]}function j(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)===_e}(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor[Oe]||q(e)||J(e))}function B(e,t,n){void 0===n&&(n=!1),0===W(e)?(n?Object.keys:Le)(e).forEach((function(a){n&&"symbol"==typeof a||t(a,e[a],e)})):e.forEach((function(n,a){return t(a,n,e)}))}function W(e){var t=e[Pe];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:q(e)?2:J(e)?3:0}function z(e,t){return 2===W(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function K(e,t,n){var a=W(e);2===a?e.set(t,n):3===a?(e.delete(t),e.add(n)):e[t]=n}function H(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function q(e){return Te&&e instanceof Map}function J(e){return Ee&&e instanceof Set}function Y(e){return e.o||e.t}function X(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=we(e);delete t[Pe];for(var n=Le(t),a=0;a<n.length;a++){var i=n[a],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),ee(e)||V(e)||!j(e)||(W(e)>1&&(e.set=e.add=e.clear=e.delete=Z),Object.freeze(e),t&&B(e,(function(e,t){return Q(t,!0)}),!0)),e}function Z(){x(2)}function ee(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function te(e){var t=Ue[e];return t||x(18,e),t}function ne(){return be}function ae(e,t){t&&(te("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(se),e.p=null}function oe(e){e===be&&(be=e.l)}function re(e){return be={p:[],l:be,h:e,m:!0,_:0}}function se(e){var t=e[Pe];0===t.i||1===t.i?t.j():t.O=!0}function le(e,t){t._=t.p.length;var n=t.p[0],a=void 0!==e&&e!==n;return t.h.g||te("ES5").S(t,e,a),a?(n[Pe].P&&(ie(t),x(4)),j(e)&&(e=ce(t,e),t.l||ue(t,e)),t.u&&te("Patches").M(n[Pe].t,e,t.u,t.s)):e=ce(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function ce(e,t,n){if(ee(t))return t;var a=t[Pe];if(!a)return B(t,(function(i,o){return de(e,a,t,i,o,n)}),!0),t;if(a.A!==e)return t;if(!a.P)return ue(e,a.t,!0),a.t;if(!a.I){a.I=!0,a.A._--;var i=4===a.i||5===a.i?a.o=X(a.k):a.o;B(3===a.i?new Set(i):i,(function(t,o){return de(e,a,i,t,o,n)})),ue(e,i,!1),n&&e.u&&te("Patches").R(a,n,e.u,e.s)}return a.o}function de(e,t,n,a,i,o){if(V(i)){var r=ce(e,i,o&&t&&3!==t.i&&!z(t.D,a)?o.concat(a):void 0);if(K(n,a,r),!V(r))return;e.m=!1}if(j(i)&&!ee(i)){if(!e.h.F&&e._<1)return;ce(e,i),t&&t.A.l||ue(e,i)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Q(t,n)}function ye(e,t){var n=e[Pe];return(n?Y(n):e)[t]}function fe(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var a=Object.getOwnPropertyDescriptor(n,t);if(a)return a;n=Object.getPrototypeOf(n)}}function pe(e){e.P||(e.P=!0,e.l&&pe(e.l))}function ge(e){e.o||(e.o=X(e.t))}function Se(e,t,n){var a=q(t)?te("MapSet").N(t,n):J(t)?te("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),a={i:n?1:0,A:t?t.A:ne(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=a,o=De;n&&(i=[a],o=Re);var r=Proxy.revocable(i,o),s=r.revoke,l=r.proxy;return a.k=l,a.j=s,l}(t,n):te("ES5").J(t,n);return(n?n.A:ne()).p.push(a),a}function ve(e){return V(e)||x(22,e),function e(t){if(!j(t))return t;var n,a=t[Pe],i=W(t);if(a){if(!a.P&&(a.i<4||!te("ES5").K(a)))return a.t;a.I=!0,n=he(t,i),a.I=!1}else n=he(t,i);return B(n,(function(t,i){a&&function(e,t){return 2===W(e)?e.get(t):e[t]}(a.t,t)===i||K(n,t,e(i))})),3===i?new Set(n):n}(e)}function he(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return X(e)}var me,be,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Te="undefined"!=typeof Map,Ee="undefined"!=typeof Set,Ie="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((me={})["immer-nothing"]=!0,me),Oe=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Pe=Ae?Symbol.for("immer-state"):"__$immer_state",_e=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Le="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,we=Object.getOwnPropertyDescriptors||function(e){var t={};return Le(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ue={},De={get:function(e,t){if(t===Pe)return e;var n=Y(e);if(!z(n,t))return function(e,t,n){var a,i=fe(t,n);return i?"value"in i?i.value:null===(a=i.get)||void 0===a?void 0:a.call(e.k):void 0}(e,n,t);var a=n[t];return e.I||!j(a)?a:a===ye(e.t,t)?(ge(e),e.o[t]=Se(e.A.h,a,e)):a},has:function(e,t){return t in Y(e)},ownKeys:function(e){return Reflect.ownKeys(Y(e))},set:function(e,t,n){var a=fe(Y(e),t);if(null==a?void 0:a.set)return a.set.call(e.k,n),!0;if(!e.P){var i=ye(Y(e),t),o=null==i?void 0:i[Pe];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(H(n,i)&&(void 0!==n||z(e.t,t)))return!0;ge(e),pe(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!==ye(e.t,t)||t in e.t?(e.D[t]=!1,ge(e),pe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Y(e),a=Reflect.getOwnPropertyDescriptor(n,t);return a?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:a.enumerable,value:n[t]}:a},defineProperty:function(){x(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){x(12)}},Re={};B(De,(function(e,t){Re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Re.deleteProperty=function(e,t){return Re.set.call(this,e,t,void 0)},Re.set=function(e,t,n){return De.set.call(this,e[0],t,n,e[0])};var Ce=function(){function e(e){var t=this;this.g=Ie,this.F=!0,this.produce=function(e,n,a){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var a=arguments.length,r=Array(a>1?a-1:0),s=1;s<a;s++)r[s-1]=arguments[s];return o.produce(e,(function(e){var a;return(a=n).call.apply(a,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&x(6),void 0!==a&&"function"!=typeof a&&x(7),j(e)){var s=re(t),l=Se(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?ie(s):oe(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ae(s,a),le(e,s)}),(function(e){throw ie(s),e})):(ae(s,a),le(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&Q(r,!0),a){var d=[],u=[];te("Patches").M(e,r,d,u),a(d,u)}return r}x(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var a=arguments.length,i=Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var a,i,o=t.produce(e,n,(function(e,t){a=e,i=t}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(e){return[e,a,i]})):[o,a,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){j(e)||x(8),V(e)&&(e=ve(e));var t=re(this),n=Se(this,e,void 0);return n[Pe].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Pe]).A;return ae(n,t),le(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ie&&x(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var a=t[n];if(0===a.path.length&&"replace"===a.op){e=a.value;break}}n>-1&&(t=t.slice(n+1));var i=te("Patches").$;return V(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ne=new Ce,Me=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseProxies.bind(Ne),Ne.applyPatches.bind(Ne),Ne.createDraft.bind(Ne),Ne.finishDraft.bind(Ne);const Fe=Me;function Ge(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach((function(t){Ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ve(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 je="function"==typeof Symbol&&Symbol.observable||"@@observable",Be=function(){return Math.random().toString(36).substring(7).split("").join(".")},We={INIT:"@@redux/INIT"+Be(),REPLACE:"@@redux/REPLACE"+Be(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Be()}};function ze(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 Ke(e,t,n){var a;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ve(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ve(1));return n(Ke)(e,t)}if("function"!=typeof e)throw new Error(Ve(2));var i=e,o=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function d(){if(l)throw new Error(Ve(3));return o}function u(e){if("function"!=typeof e)throw new Error(Ve(4));if(l)throw new Error(Ve(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ve(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!ze(e))throw new Error(Ve(7));if(void 0===e.type)throw new Error(Ve(8));if(l)throw new Error(Ve(9));try{l=!0,o=i(o,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ve(10));i=e,y({type:We.REPLACE})}function p(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ve(11));function n(){e.next&&e.next(d())}return n(),{unsubscribe:t(n)}}})[je]=function(){return this},e}return y({type:We.INIT}),(a={dispatch:y,subscribe:u,getState:d,replaceReducer:f})[je]=p,a}function He(e){for(var t=Object.keys(e),n={},a=0;a<t.length;a++){var i=t[a];"function"==typeof e[i]&&(n[i]=e[i])}var o,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:We.INIT}))throw new Error(Ve(12));if(void 0===n(void 0,{type:We.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(13))}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var a=!1,i={},s=0;s<r.length;s++){var l=r[s],c=n[l],d=e[l],u=c(d,t);if(void 0===u)throw t&&t.type,new Error(Ve(14));i[l]=u,a=a||u!==d}return(a=a||r.length!==Object.keys(e).length)?i:e}}function qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Je(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),a=function(){throw new Error(Ve(15))},i={getState:n.getState,dispatch:function(){return a.apply(void 0,arguments)}},o=t.map((function(e){return e(i)}));return a=qe.apply(void 0,o)(n.dispatch),xe(xe({},n),{},{dispatch:a})}}}function Ye(e){return function(t){var n=t.dispatch,a=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,a,e):t(i)}}}}var Xe=Ye();Xe.withExtraArgument=Ye;const Qe=Xe;var Ze,et=(Ze=function(e,t){return Ze=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])},Ze(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}Ze(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),tt=function(e,t){for(var n=0,a=t.length,i=e.length;n<a;n++,i++)e[i]=t[n];return e},nt=Object.defineProperty,at=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,rt=function(e,t,n){return t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},st=function(e,t){for(var n in t||(t={}))it.call(t,n)&&rt(e,n,t[n]);if(at)for(var a=0,i=at(t);a<i.length;a++)n=i[a],ot.call(t,n)&&rt(e,n,t[n]);return e},lt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ct=function(e){function t(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return et(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,tt([void 0],e[0].concat(this)))):new(t.bind.apply(t,tt([void 0],e.concat(this))))},t}(Array);function dt(e){return j(e)?Fe(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,a=(e.immutableCheck,e.serializableCheck,new ct);return n&&(function(e){return"boolean"==typeof e}(n)?a.push(Qe):a.push(Qe.withExtraArgument(n.extraArgument))),a}function yt(e){var t,n=function(e){return ut(e)},a=e||{},i=a.reducer,o=void 0===i?void 0:i,r=a.middleware,s=void 0===r?n():r,l=a.devTools,c=void 0===l||l,d=a.preloadedState,u=void 0===d?void 0:d,y=a.enhancers,f=void 0===y?void 0:y;if("function"==typeof o)t=o;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}(o))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=He(o)}var p=s;"function"==typeof p&&(p=p(n));var g=Je.apply(void 0,p),S=qe;c&&(S=lt(st({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=tt([g],f):"function"==typeof f&&(v=f(v)),Ke(t,u,S.apply(void 0,v))}function ft(e,t){function n(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return st(st({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function pt(e){var t,n={},a=[],i={addCase:function(e,t){var a="string"==typeof e?e:e.type;if(a in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[a]=t,i},addMatcher:function(e,t){return a.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,a,t]}function gt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,a="function"==typeof e.initialState?e.initialState:dt(e.initialState),i=e.reducers||{},o=Object.keys(i),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?pt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,o=t[1],r=void 0===o?[]:o,l=t[2],c=void 0===l?void 0:l,d=st(st({},i),s);return function(e,t,n,a){void 0===n&&(n=[]);var i,o="function"==typeof t?pt(t):[t,n,a],r=o[0],s=o[1],l=o[2];if(function(e){return"function"==typeof e}(e))i=function(){return dt(e())};else{var c=dt(e);i=function(){return c}}function d(e,t){void 0===e&&(e=i());var n=tt([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var a;if(V(e))return void 0===(a=n(e,t))?e:a;if(j(e))return Fe(e,(function(e){return n(e,t)}));if(void 0===(a=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return a}return e}),e)}return d.getInitialState=i,d}(a,d,r,c)}return o.forEach((function(e){var n,a,o=i[e],c=t+"/"+e;"reducer"in o?(n=o.reducer,a=o.prepare):n=o,r[e]=n,s[c]=n,l[e]=a?ft(c,a):ft(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var St="listenerMiddleware";ft(St+"/add"),ft(St+"/removeAll"),ft(St+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Pe];return De.get(t,e)},set:function(t){var n=this[Pe];De.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][Pe];if(!i.P)switch(i.i){case 5:a(i)&&pe(i);break;case 4:n(i)&&pe(i)}}}function n(e){for(var t=e.t,n=e.k,a=Le(n),i=a.length-1;i>=0;i--){var o=a[i];if(o!==Pe){var r=t[o];if(void 0===r&&!z(t,o))return!0;var s=n[o],l=s&&s[Pe];if(l?l.t!==r:!H(s,r))return!0}}var c=!!t[Pe];return a.length!==Le(t).length+(c?0:1)}function a(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 a=0;a<t.length;a++)if(!t.hasOwnProperty(a))return!0;return!1}var i={};!function(e,t){Ue[e]||(Ue[e]=t)}("ES5",{J:function(t,n){var a=Array.isArray(t),i=function(t,n){if(t){for(var a=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(a,""+i,e(i,!0));return a}var o=we(n);delete o[Pe];for(var r=Le(o),s=0;s<r.length;s++){var l=r[s];o[l]=e(l,t||!!o[l].enumerable)}return Object.create(Object.getPrototypeOf(n),o)}(a,t),o={i:a?5:4,A:n?n.A:ne(),P:!1,I:!1,D:{},l:n,t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Pe,{value:o,writable:!0}),i},S:function(e,n,i){i?V(n)&&n[Pe].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Pe];if(n){var i=n.t,o=n.k,r=n.D,s=n.i;if(4===s)B(o,(function(t){t!==Pe&&(void 0!==i[t]||z(i,t)?r[t]||e(o[t]):(r[t]=!0,pe(n)))})),B(i,(function(e){void 0!==o[e]||z(o,e)||(r[e]=!1,pe(n))}));else if(5===s){if(a(n)&&(pe(n),r.length=!0),o.length<i.length)for(var l=o.length;l<i.length;l++)r[l]=!1;else for(var c=i.length;c<o.length;c++)r[c]=!0;for(var d=Math.min(o.length,i.length),u=0;u<d;u++)o.hasOwnProperty(u)||(r[u]=!0),void 0===r[u]&&e(o[u])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):a(e)}})}();const vt=(e,t)=>n=>$({},n,{[e]:t[e]}),ht=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>$({},t,{[e]:$({},t[e],n)})}),mt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:a})=>{var i;return $({},n,{[e]:$({},n[e],{[t]:$({},null==n||null==(i=n[e])?void 0:i[t],a)})})}}),bt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var a,i;return $({},t,{[e]:$({},t[e],{loaders:$({},null==(a=t[e])?void 0:a.loaders,{[n.key]:null==(i=n.value)||i})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var a;return $({},t,{[e]:$({},t[e],{errors:$({},t[e].errors,{[n.key]:null==(a=n.value)||a})})})}}),Tt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(a,{payload:i})=>{var o;return $({},a,{[e]:$({},a[e],{[t]:$({},null==a||null==(o=a[e])?void 0:o[t],i,n)})})}}),Et=(e,t,n)=>a=>{var i;return $({},a,{[e]:$({},a[e],{[t]:$({},null==a||null==(i=a[e])?void 0:i[t],n)})})},It=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Ot=new Uint8Array(256);for(let e=0;e<kt.length;e++)Ot[kt.charCodeAt(e)]=e;const Pt=e=>{const t=.75*e.length,n=e.length;let a,i,o,r,s,l=0;const c=new Uint8Array(t);for(a=0;a<n;a+=4)i=Ot[e.charCodeAt(a)],o=Ot[e.charCodeAt(a+1)],r=Ot[e.charCodeAt(a+2)],s=Ot[e.charCodeAt(a+3)],c[l++]=i<<2|o>>4,c[l++]=(15&o)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},_t=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(_t(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let a,i="";for(a=0;a<n;a+=3)i+=kt[t[a]>>2],i+=kt[(3&t[a])<<4|t[a+1]>>4],i+=kt[(15&t[a+1])<<2|t[a+2]>>6],i+=kt[63&t[a+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=_t(e[n]);return t}return e};let Lt,wt,Ut,Dt;!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",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(Lt||(Lt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(wt||(wt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ut||(Ut={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Dt||(Dt={}));const Rt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ct="HOSTED_LOGIN_VERIFIER_KEY",Nt="auth",Mt="connectivity",Ft="auditLogs",Gt="vendor",$t={flow:wt.Login,step:Lt.preLogin,loading:!1,email:"",tenants:[]},xt={setLoginState:ht("loginState"),resetLoginState:vt("loginState",{loginState:$t})},Vt={requestAuthorize:ft("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ft("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ft("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:ft("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:ft("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ft("auth/afterAuthNavigation"),preLogin:ft("auth/preLogin",(e=>({payload:e}))),postLogin:ft("auth/postLogin",(e=>({payload:e}))),login:ft("auth/login",(e=>({payload:e}))),loginWithMfa:ft("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ft("auth/recoverMfa",(e=>({payload:e}))),logout:ft("auth/logout",(e=>({payload:e}))),silentLogout:ft("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ft("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ft("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ft("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ft("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ft("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ft("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ft("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ft("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ft("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ft("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ft("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ft("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ft("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ft("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ft("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ft("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ft("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ft("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ft("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ft("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ft("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ft("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ft("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ft("auth/resetBreachedPassword",(e=>({payload:e})))};let jt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(jt||(jt={}));const Bt={step:jt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Wt={setActivateState:ht("activateState"),resetActivateState:vt("activateState",{activateState:Bt}),setActivateStrategyState:mt("activateState","activationStrategy")},zt={activateAccount:ft("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ft("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ft("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ft("auth/resendActivationEmail",(e=>({payload:e})))};let Kt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Kt||(Kt={}));const Ht={step:Kt.validate},qt={setAcceptInvitationState:ht("acceptInvitationState"),resetAcceptInvitationState:vt("acceptInvitationState",{acceptInvitationState:Ht})},Jt={acceptInvitation:ft("auth/acceptInvitation",(e=>({payload:e})))};let Yt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Yt||(Yt={}));const Xt={step:Yt.forgotPassword,loading:!1,email:"",passwordConfig:null},Qt={setForgotPasswordState:ht("forgotPasswordState"),resetForgotPasswordState:vt("forgotPasswordState",{forgotPasswordState:Xt})},Zt={forgotPassword:ft("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ft("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ft("auth/loadPasswordConfig",(e=>({payload:e})))};let en;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(en||(en={}));const tn={step:en.ResetPhoneNumber,loading:!1},nn={setResetPhoneNumberState:ht("resetPhoneNumberState"),resetResetPhoneNumberState:vt("resetPhoneNumberState",{resetPhoneNumberState:tn})},an={resetPhoneNumber:ft("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ft("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ft("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},rn={setSSOLoader:bt("ssoState"),setSSOError:At("ssoState"),setSSOState:ht("ssoState"),resetSSOState:vt("ssoState",{ssoState:on})},sn={loadSSOConfigurationsV2:ft("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ft("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ft("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ft("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ft("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ft("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ft("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ft("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ft("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ft("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ft("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ft("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ft("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ft("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ft("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ft("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ft("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ft("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ft("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ft("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ft("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ft("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ft("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ft("auth/oidcPostlogin",(e=>({payload:e})))},ln={loading:!1,error:null},cn={setProfileState:ht("profileState"),resetProfileState:vt("profileState",{profileState:ln})},dn={loadProfile:ft("auth/loadProfile"),saveProfile:ft("auth/saveProfile",(e=>({payload:e}))),changePassword:ft("auth/changePassword",(e=>({payload:e})))};let un;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode",e.noMFAEnrolledStepUp="noMFAEnrolledStepUp"}(un||(un={}));const yn={step:un.verify,loading:!1,saving:!1},fn={setMfaState:ht("mfaState"),resetMfaState:vt("mfaState",{mfaState:yn})},pn={enrollMfa:ft("auth/enrollMfa"),getMFADevices:ft("auth/getMFADevices"),getMFAStrategies:ft("auth/getMFAStrategies"),verifyMfa:ft("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ft("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ft("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ft("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ft("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ft("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ft("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ft("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ft("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ft("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ft("auth/disableMfaWebAuthn",(e=>({payload:e})))},gn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},Sn={setTeamLoader:bt("teamState"),setTeamError:At("teamState"),setTeamState:ht("teamState"),resetTeamState:vt("teamState",{teamState:gn})},vn={loadUsersV2:ft("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ft("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ft("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ft("auth/loadRoles",(e=>({payload:e}))),addUser:ft("auth/addUser",(e=>({payload:e}))),addUsersBulk:ft("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ft("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ft("auth/updateUser",(e=>({payload:e}))),deleteUser:ft("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ft("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ft("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ft("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ft("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ft("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ft("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ft("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getTemporaryUsersConfig:ft("auth/getTemporaryUsersConfig"),updateUserExpirationTime:ft("auth/updateUserExpirationTime",(e=>({payload:e}))),setUserAsPermanent:ft("auth/setUserAsPermanent",(e=>({payload:e}))),getInvitationLink:ft("auth/getInvitationLink"),createInvitationLink:ft("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ft("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ft("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ft("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ft("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ft("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ft("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ft("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ft("auth/closeLockUserDialog",(e=>({payload:e})))},hn={firstLoad:!0,loading:!1,error:""},mn={setSocialLoginsState:ht("socialLoginState"),resetSocialLoginsState:vt("socialLoginState",{socialLoginState:hn})},bn={loadSocialLoginsConfiguration:ft("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ft("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:ft("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ft("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const Tn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},En={setSignUpState:ht("signUpState"),resetSignUpState:vt("signUpState",{signUpState:Tn})},In={signUpUser:ft("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ft("auth/resetSignUpStateSoft")},kn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},On={setApiTokensLoader:bt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:ht("apiTokensState"),resetApiTokensState:vt("apiTokensState",{apiTokensState:kn})},Pn={loadApiTokens:ft("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ft("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ft("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ft("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ft("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ft("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ft("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ft("auth/deleteTenantApiToken",(e=>({payload:e})))},_n={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}},Ln={setSecurityPolicyState:ht("securityPolicyState"),setSecurityPolicyGlobalState:mt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:mt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:mt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:mt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:mt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:mt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:mt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:mt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:mt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:mt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:mt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:vt("securityPolicyState",{securityPolicyState:_n})},wn={loadSecurityPolicy:ft("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ft("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ft("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ft("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ft("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ft("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ft("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ft("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ft("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ft("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ft("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ft("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ft("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ft("auth/loadPublicAuthStrategiesPolicy")},Un={loading:!1},Dn={setAccountSettingsState:ht("accountSettingsState"),resetAccountSettingsState:vt("accountSettingsState",{accountSettingsState:Un})},Rn={loadAccountSettings:ft("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ft("auth/saveAccountSettings",(e=>({payload:e})))},Cn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Nn={setTenantsState:ht("tenantsState"),resetTenantsState:vt("tenantsState",{tenantsState:Cn})},Mn={switchTenant:ft("auth/switchTenant",(e=>({payload:e}))),loadTenants:ft("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ft("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ft("auth/loadSubTenantsTree",(e=>({payload:e})))},Fn={loaders:{},errors:{},roles:[],permissions:[],permissionCategories:[]},Gn={setRolesState:ht("rolesState"),resetRolesState:vt("rolesState",{rolesState:Fn}),setRolesStateLoader:bt("rolesState"),setRolesStateError:At("rolesState")},$n={loadRolesAndPermissions:ft("auth/loadRoles",(e=>({payload:e}))),addRole:ft("auth/addRole",(e=>({payload:e}))),addRoleV2:ft("auth/addRoleV2",(e=>({payload:e}))),updateRole:ft("auth/updateRole",(e=>({payload:e}))),deleteRole:ft("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ft("auth/attachPermissionsToRole",(e=>({payload:e})))},xn={loading:!1,sessions:[]},Vn={setSessionsState:ht("sessionsState"),resetSessionsState:vt("sessionsState",{sessionsState:xn})},jn={loadUserSessions:ft("auth/loadUserSessions"),loadCurrentUserSession:ft("auth/loadCurrentUserSession"),deleteUserSession:ft("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ft("auth/deleteAllUserSessions"),revokeUserSessions:ft("auth/revokeUserSessions",(e=>({payload:e})))},Bn={loading:!1,configurations:{}},Wn={setSessionsPolicyState:ht("sessionsPolicyState"),resetSessionsPolicyState:vt("sessionsPolicyState",{sessionsPolicyState:Bn})},zn={loadSessionsPolicy:ft("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ft("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Kn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Kn||(Kn={}));const Hn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Kn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},qn={setRestrictionsState:ht("restrictionsState"),setIpRestrictionsState:mt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:mt("restrictionsState","emailDomainRestrictions")},Jn={checkIfUserIpValid:ft("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ft("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ft("auth/loadIpRestrictions"),saveIpRestriction:ft("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ft("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ft("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ft("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ft("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ft("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ft("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Yn={loading:!1},Xn={setProvisioningState:ht("provisioningState"),resetProvisioningState:vt("provisioningState",{provisioningState:Yn})},Qn={loadProvisionConnections:ft("auth/loadProvisionConnections"),createProvisionConnection:ft("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ft("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ft("auth/updateProvisionConnection",(e=>({payload:e})))},Zn={devices:[],loading:!1,error:null},ea={setPasskeysState:ht("passkeysState"),resetPasskeysState:vt("passkeysState",{passkeysState:Zn})},ta={loadWebAuthnDevices:ft("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ft("auth/deleteWebAuthnDevice",(e=>({payload:e})))},na={loaders:{},errors:{},groups:[],groupsConfiguration:{}},aa={setUsersGroupsLoader:bt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:ht("groupsState"),resetUsersGroupsState:vt("groupsState",{groupsState:na})},ia={loadGroups:ft("auth/loadUsersGroups"),getGroupById:ft("auth/getGroupById",(e=>({payload:e}))),createGroup:ft("auth/createGroup",(e=>({payload:e}))),updateGroup:ft("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ft("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ft("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ft("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ft("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ft("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ft("auth/getGroupConfiguration"),updateGroupConfiguration:ft("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ft("auth/getUsers",(e=>({payload:e})))},oa={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}},ra={setGroupsDialogsState:ht("groupsDialogsState"),resetGroupsDialogsState:vt("groupsState",{groupsDialogsState:oa}),openAddGroupDialog:Et("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Et("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Et("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Et("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Et("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Et("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Et("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},sa={loading:!0,error:null},la={setCustomLoginState:ht("customLoginState"),resetCustomLoginState:vt("customLoginState",{customLoginState:sa})},ca={loadTenantMetadata:ft("auth/loadTenantMetadata"),updateTenantMetadata:ft("auth/updateTenantMetadata",(e=>({payload:e})))},da={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ua,ya,fa,pa,ga;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ua||(ua={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(ya||(ya={})),function(e){e.ASC="ASC",e.DESC="DESC"}(fa||(fa={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(pa||(pa={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(ga||(ga={}));const Sa=["local","saml","google","github","facebook","microsoft","scim2","slack"],va={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:fa.DESC,_sortBy:pa.name},usersPageOffset:0,accountSettings:{}}},ha={setAllAccountsLoader:bt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:ht("allAccountsState"),setSelectedAccountState:mt("allAccountsState","selectedAccount"),resetAllAccountsState:vt("allAccountsState",{allAccountsState:va})},ma={loadAccounts:ft("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ft("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ft("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ft("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ft("auth/updateAccount",(e=>({payload:e}))),updateSubAccountManagement:ft("auth/updateSubAccountManagement",(e=>({payload:e}))),deleteSubAccount:ft("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ft("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ft("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ft("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ft("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ft("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ft("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:ft("auth/setRootAccountData"),setSelectedSubAccountData:ft("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ft("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},ba={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},disableSubAccountManagementDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1},enableSubAccountManagementDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},Aa={setAllAccountDialogsState:ht("allAccountsDialogsState"),resetAllAccountDialogsState:vt("allAccountsDialogsState",{allAccountsDialogsState:ba}),openCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Et("allAccountsDialogsState","createSubAccountDialog",ba.createSubAccountDialog),openUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Et("allAccountsDialogsState","updateSubAccountDialog",ba.updateSubAccountDialog),openDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Et("allAccountsDialogsState","deleteSubAccountDialog",ba.deleteSubAccountDialog),openDisableSubAccountManagementDialog:Tt("allAccountsDialogsState","disableSubAccountManagementDialog",{open:!0}),closeDisableSubAccountManagementDialog:Et("allAccountsDialogsState","disableSubAccountManagementDialog",ba.disableSubAccountManagementDialog),openEnableSubAccountManagementDialog:Tt("allAccountsDialogsState","enableSubAccountManagementDialog",{open:!0}),closeEnableSubAccountManagementDialog:Et("allAccountsDialogsState","enableSubAccountManagementDialog",ba.enableSubAccountManagementDialog),openAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Et("allAccountsDialogsState","addUsersToAccountDialog",ba.addUsersToAccountDialog),openDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Et("allAccountsDialogsState","deleteUserFromAccountDialog",ba.deleteUserFromAccountDialog),openEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Et("allAccountsDialogsState","editUserRolesDialog",ba.editUserRolesDialog)},Ta={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ea={setSecurityCenterState:ht("securityCenterState"),resetSecurityCenterState:vt("securityCenterState",{securityCenterState:Ta}),setSecurityCenterStateLoader:bt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ia={loadRecommendations:ft("auth/loadRecommendations"),loadInsights:ft("auth/loadInsights"),sendResetBreachedPasswordEmail:ft("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ft("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ft("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ft("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ft("auth/loadInactiveUsers",(e=>({payload:e})))};let ka,Oa,Pa;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ka||(ka={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Oa||(Oa={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Pa||(Pa={}));const _a={[Oa.Code]:Lt.loginWithOtc,[Oa.EmailAndPassword]:Lt.loginWithPassword,[Oa.MagicLink]:Lt.magicLinkPreLoginSuccess,[Oa.SmsCode]:Lt.loginWithSmsOtc},La={loading:!1,error:null,phoneNumbers:void 0},wa={setSmsState:ht("smsState"),resetSmsState:vt("smsState",{smsState:La})},Ua={loadPhoneNumbers:ft("auth/loadPhoneNumbers"),setUpPhoneNumber:ft("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:ft("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:ft("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:ft("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:ft("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Da={loading:!1,mfaDevices:void 0,mfaToken:""},Ra={setStepUpState:ht("stepUpState"),resetStepUpState:vt("stepUpState",{stepUpState:Da})},Ca={stepUpHostedLogin:ft("auth/stepUpHostedLogin",(e=>({payload:e}))),generateStepUpSession:ft("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:ft("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:ft("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:ft("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:ft("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:ft("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:ft("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:ft("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Na={setApplicationsState:ht("applicationsState")},Ma={loadUserApplications:ft("auth/loadUserApplications"),loadAccountApplications:ft("auth/loadAccountApplications"),assignUserToApps:ft("auth/assignUserToApps",(e=>({payload:e}))),unassignUserFromApps:ft("auth/unassignUserFromApps",(e=>({payload:e})))},Fa={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Tn,loginState:$t,stepUpState:Da,activateState:Bt,acceptInvitationState:Ht,forgotPasswordState:Xt,ssoState:on,profileState:ln,customLoginState:sa,applicationsState:{loading:!0,fetching:!0,error:null,userApplications:[],accountApplications:[]},mfaState:yn,teamState:gn,groupsState:na,groupsDialogsState:oa,socialLoginState:hn,apiTokensState:kn,securityPolicyState:_n,accountSettingsState:Un,tenantsState:Cn,rolesState:Fn,resetPhoneNumberState:tn,sessionsState:xn,sessionsPolicyState:Bn,restrictionsState:Hn,provisioningState:Yn,passkeysState:Zn,allAccountsState:va,allAccountsDialogsState:ba,securityCenterState:Ta,smsState:La},Ga=$({routes:{authenticatedUrl:"/",loginUrl:"/account/login",stepUpUrl:"/account/step-up",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",openAppUrl:"/account/redirect"},onRedirectTo:()=>{}},Fa);let $a;!function(e){e.impersonating="impersonating",e.success="success"}($a||($a={}));const xa={step:$a.impersonating,loading:!1},Va={setImpersonateState:ht("impersonateState"),resetImpersonateState:vt("impersonateState",{impersonateState:xa})},ja={impersonate:ft("impersonation/impersonate",(e=>({payload:e})))},{reducer:Ba,actions:Wa}=gt({name:Nt,initialState:Ga,reducers:$({resetState:e=>$({},e,Fa),setState:(e,{payload:t})=>$({},e,t),setUser:("user",(e,{payload:t})=>$({},e,{user:t})),setEntitlements:mt("user","entitlements")},xt,Ra,mn,Wt,Va,qt,Qt,nn,En,cn,Na,la,rn,fn,Sn,aa,ra,On,Ln,Dn,Nn,Gn,Vn,Wn,qn,Xn,ea,ha,Aa,Ea,wa)});const za=$({loadEntitlements:ft("auth/loadEntitlements",(e=>({payload:e})))},Wa,Vt,Ca,bn,zt,Jt,Zt,an,In,dn,ca,Ma,sn,pn,vn,ia,{},Pn,wn,Rn,Mn,$n,jn,zn,Jn,Qn,ja,ta,ma,Ia,Ua);var Ka=function(e){return"@@redux-saga/"+e},Ha=Ka("CANCEL_PROMISE"),qa=Ka("CHANNEL_END"),Ja=Ka("IO"),Ya=Ka("MATCH"),Xa=Ka("MULTICAST"),Qa=Ka("SAGA_ACTION"),Za=Ka("SELF_CANCELLATION"),ei=Ka("TASK"),ti=Ka("TASK_CANCEL"),ni=Ka("TERMINATE"),ai=Ka("LOCATION");function ii(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}var oi=function(e){return null==e},ri=function(e){return null!=e},si=function(e){return"function"==typeof e},li=function(e){return"string"==typeof e},ci=Array.isArray,di=function(e){return e&&si(e.then)},ui=function(e){return e&&si(e.next)&&si(e.throw)},yi=function e(t){return t&&(li(t)||gi(t)||si(t)||ci(t)&&t.every(e))},fi=function(e){return e&&si(e.take)&&si(e.close)},pi=function(e){return si(e)&&e.hasOwnProperty("toString")},gi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype};const Si=function(e,t){var n;void 0===t&&(t=!0);var a=new Promise((function(a){n=setTimeout(a,Math.min(2147483647,e),t)}));return a[Ha]=function(){clearTimeout(n)},a};var vi=function(e){return function(){return e}},hi=vi(!0),mi=function(){},bi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Ai=function(e,t){$(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ti(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ei=function(e){throw e},Ii=function(e){return{value:e,done:!0}};function ki(e,t,n){void 0===t&&(t=Ei),void 0===n&&(n="iterator");var a={meta:{name:n},next:e,throw:t,return:Ii,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(a[Symbol.iterator]=function(){return a}),a}function Oi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Pi=function(e){return Array.apply(null,new Array(e))},_i=function(e){return function(t){return e(Object.defineProperty(t,Qa,{value:!0}))}},Li=function(e){return e===ni},wi=function(e){return e===ti},Ui=function(e){return Li(e)||wi(e)};function Di(e,t){var n,a=Object.keys(e),i=a.length,o=0,r=ci(e)?Pi(i):{},s={};return a.forEach((function(e){var a=function(a,s){n||(s||Ui(a)?(t.cancel(),t(a,s)):(r[e]=a,++o===i&&(n=!0,t(r))))};a.cancel=mi,s[e]=a})),t.cancel=function(){n||(n=!0,a.forEach((function(e){return s[e].cancel()})))},s}function Ri(e){return{name:e.name||"anonymous",location:Ci(e)}}function Ci(e){return e[ai]}var Ni=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),a=0,i=0,o=0,r=function(t){n[i]=t,i=(i+1)%e,a++},s=function(){if(0!=a){var t=n[o];return n[o]=null,a--,o=(o+1)%e,t}},l=function(){for(var e=[];a;)e.push(s());return e};return{isEmpty:function(){return 0==a},put:function(s){var c;if(a<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=s,o=i=(i+1)%e;break;case 4:c=2*e,n=l(),a=n.length,i=n.length,o=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Mi="TAKE",Fi="CALL",Gi="FORK",$i="SELECT",xi=function(e,t){var n;return(n={})[Ja]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Vi(e,t){return void 0===e&&(e="*"),yi(e)?(ri(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),xi(Mi,{pattern:e})):fi(n=e)&&n[Xa]&&ri(t)&&yi(t)?xi(Mi,{channel:e,pattern:t}):fi(e)?(ri(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),xi(Mi,{channel:e})):void 0;var n}function ji(e,t){return oi(t)&&(t=e,e=void 0),xi("PUT",{channel:e,action:t})}function Bi(e){var t=xi("ALL",e);return t.combinator=!0,t}function Wi(e,t){var n,a=null;return si(e)?n=e:(ci(e)?(a=e[0],n=e[1]):(a=e.context,n=e.fn),a&&li(n)&&si(a[n])&&(n=a[n])),{context:a,fn:n,args:t}}function zi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi(Fi,Wi(e,n))}function Ki(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi(Gi,Wi(e,n))}function Hi(e){return void 0===e&&(e=Za),xi("CANCEL",e)}function qi(e){void 0===e&&(e=bi);for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi($i,{selector:e,args:n})}var Ji=zi.bind(null,Si);const Yi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e};var Xi=[],Qi=0;function Zi(e){try{no(),e()}finally{ao()}}function eo(e){Xi.push(e),Qi||(no(),io())}function to(e){try{return no(),e()}finally{io()}}function no(){Qi++}function ao(){Qi--}function io(){var e;for(ao();!Qi&&void 0!==(e=Xi.shift());)Zi(e)}var oo=function(e){return function(t){return e.some((function(e){return uo(e)(t)}))}},ro=function(e){return function(t){return e(t)}},so=function(e){return function(t){return t.type===String(e)}},lo=function(e){return function(t){return t.type===e}},co=function(){return hi};function uo(e){var t="*"===e?co:li(e)?so:ci(e)?oo:pi(e)?so:si(e)?ro:gi(e)?lo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var yo={type:qa},fo=function(e){return e&&e.type===qa};function po(){var e,t,n,a,i,o,r=(t=!1,a=n=[],i=function(){a===n&&(a=n.slice())},o=function(){t=!0;var e=n=a;a=[],e.forEach((function(e){e(yo)}))},(e={})[Xa]=!0,e.put=function(e){if(!t)if(fo(e))o();else for(var i=n=a,r=0,s=i.length;r<s;r++){var l=i[r];l[Ya](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var o;void 0===n&&(n=co),t?e(yo):(e[Ya]=n,i(),a.push(e),e.cancel=(o=!1,function(){o||(o=!0,i(),Ti(a,e))}))},e.close=o,e),s=r.put;return r.put=function(e){e[Qa]?s(e):eo((function(){s(e)}))},r}function go(e,t){var n=e[Ha];si(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var So,vo=0,ho=function(){return++vo};function mo(e){e.isRunning()&&e.cancel()}var bo=((So={}).TAKE=function(e,t,n){var a=t.channel,i=void 0===a?e.channel:a,o=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!fo(e)||r?n(e):n(ni)};try{i.take(s,ri(o)?uo(o):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},So.PUT=function(e,t,n){var a=t.channel,i=t.action,o=t.resolve;eo((function(){var t;try{t=(a?a.put:e.dispatch)(i)}catch(e){return void n(e,!0)}o&&di(t)?go(t,n):n(t)}))},So.ALL=function(e,t,n,a){var i=a.digestEffect,o=vo,r=Object.keys(t);if(0!==r.length){var s=Di(t,n);r.forEach((function(e){i(t[e],o,s[e],e)}))}else n(ci(t)?[]:{})},So.RACE=function(e,t,n,a){var i=a.digestEffect,o=vo,r=Object.keys(t),s=ci(t)?Pi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,a){c||(a||Ui(t)?(n.cancel(),n(t,a)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=mi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||i(t[e],o,l[e],e)}))},So.CALL=function(e,t,n,a){var i=t.context,o=t.fn,r=t.args,s=a.task;try{var l=o.apply(i,r);if(di(l))return void go(l,n);if(ui(l))return void wo(e,l,s.context,vo,Ri(o),!1,n);n(l)}catch(e){n(e,!0)}},So.CPS=function(e,t,n){var a=t.context,i=t.fn,o=t.args;try{var r=function(e,t){oi(e)?n(t):n(e,!0)};i.apply(a,o.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},So.FORK=function(e,t,n,a){var i=t.context,o=t.fn,r=t.args,s=t.detached,l=a.task,c=function(e){var t=e.context,n=e.fn,a=e.args;try{var i=n.apply(t,a);if(ui(i))return i;var o=!1;return ki((function(e){return o?{value:e,done:!0}:(o=!0,{value:i,done:!di(i)})}))}catch(e){return ki((function(){throw e}))}}({context:i,fn:o,args:r}),d=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ri(t)}(c,o);to((function(){var t=wo(e,c,l.context,vo,d,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},So.JOIN=function(e,t,n,a){var i=a.task,o=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Ti(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ci(t)){if(0===t.length)return void n([]);var r=Di(t,n);t.forEach((function(e,t){o(e,r[t])}))}else o(t,n)},So.CANCEL=function(e,t,n,a){var i=a.task;t===Za?mo(i):ci(t)?t.forEach(mo):mo(t),n()},So.SELECT=function(e,t,n){var a=t.selector,i=t.args;try{n(a.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},So.ACTION_CHANNEL=function(e,t,n){var a=t.pattern,i=function(e){void 0===e&&(e=Ni());var t=!1,n=[];return{take:function(a){t&&e.isEmpty()?a(yo):e.isEmpty()?(n.push(a),a.cancel=function(){Ti(n,a)}):a(e.take())},put:function(a){if(!t){if(0===n.length)return e.put(a);n.shift()(a)}},flush:function(n){t&&e.isEmpty()?n(yo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var a=0,i=e.length;a<i;a++)(0,e[a])(yo)}}}}(t.buffer),o=uo(a),r=function t(n){fo(n)||e.channel.take(t,o),i.put(n)},s=i.close;i.close=function(){r.cancel(),s()},e.channel.take(r,o),n(i)},So.CANCELLED=function(e,t,n,a){n(a.task.isCancelled())},So.FLUSH=function(e,t,n){t.flush(n)},So.GET_CONTEXT=function(e,t,n,a){n(a.task.context[t])},So.SET_CONTEXT=function(e,t,n,a){var i=a.task;Ai(i.context,t),n()},So);function Ao(e,t){return e+"?"+t}function To(e){var t=e.name,n=e.location;return n?t+" "+Ao(n.fileName,n.lineNumber):t}function Eo(e){var t,n,a,i=(t=function(e){return e.cancelledTasks},n=e,(a=[]).concat.apply(a,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var Io=null,ko=[],Oo=function(e){e.crashedEffect=Io,ko.push(e)},Po=function(){Io=null,ko.length=0},_o=function(){var e,t,n=ko[0],a=ko.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Ci(e))?t.code+" "+Ao(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+To(n.meta)+(i?" \n when executing effect "+i:"")].concat(a.map((function(e){return" created by "+To(e.meta)})),[Eo(ko)]).join("\n")};function Lo(e,t,n,a,i,o,r){var s;void 0===r&&(r=mi);var l,c,d=0,u=null,y=[],f=Object.create(n),p=function(e,t,n){var a,i=[],o=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){i.push(t),t.cont=function(s,l){o||(Ti(i,t),t.cont=mi,l?r(s):(t===e&&(a=s),i.length||(o=!0,n(a))))}}function l(){o||(o=!0,i.forEach((function(e){e.cont=mi,e.cancel()})),i=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(d=2,Oo({meta:i,cancelledTasks:y}),S.isRoot){var a=_o();Po(),e.onError(t,{sagaStack:a})}c=t,u&&u.reject(t)}else t===ti?d=1:1!==d&&(d=3),l=t,u&&u.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[ei]=!0,s.id=a,s.meta=i,s.isRoot=o,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===d&&(d=1,p.cancelAll(),g(ti,!1))},s.cont=r,s.end=g,s.setContext=function(e){Ai(f,e)},s.toPromise=function(){return u||(u=Yi(),2===d?u.reject(c):0!==d&&u.resolve(l)),u.promise},s.isRunning=function(){return 0===d},s.isCancelled=function(){return 1===d||0===d&&1===t.status},s.isAborted=function(){return 2===d},s.result=function(){return l},s.error=function(){return c},s);return S}function wo(e,t,n,a,i,o,r){var s=e.finalizeRunEffect((function(t,n,a){di(t)?go(t,a):ui(t)?wo(e,t,c.context,n,i,!1,a):t&&t[Ja]?(0,bo[t.type])(e,t.payload,a,d):a(t)}));u.cancel=mi;var l={meta:i,cancel:function(){0===l.status&&(l.status=1,u(ti))},status:0},c=Lo(e,l,n,a,i,o,r),d={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),u(),c;function u(e,n){try{var i;n?(i=t.throw(e),Po()):wi(e)?(l.status=1,u.cancel(),i=si(t.return)?t.return(ti):{done:!0,value:ti}):i=Li(e)?si(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==l.status&&(l.status=3),l.cont(i.value)):y(i.value,a,u)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,a,i){void 0===i&&(i="");var o,r=ho();function l(n,i){o||(o=!0,a.cancel=mi,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){Io=e}(t),a(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),l.cancel=mi,a.cancel=function(){o||(o=!0,l.cancel(),l.cancel=mi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Uo(e,t){for(var n=e.channel,a=void 0===n?po():n,i=e.dispatch,o=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,d=e.onError,u=void 0===d?Oi:d,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=ho();if(l&&(l.rootSagaStarted=l.rootSagaStarted||mi,l.effectTriggered=l.effectTriggered||mi,l.effectResolved=l.effectResolved||mi,l.effectRejected=l.effectRejected||mi,l.effectCancelled=l.effectCancelled||mi,l.actionDispatched=l.actionDispatched||mi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=qe.apply(void 0,c);g=function(e){return function(t,n,a){return h((function(t){return e(t,n,a)}))(t)}}}else g=bi;var m={channel:a,dispatch:_i(i),getState:o,sagaMonitor:l,onError:u,finalizeRunEffect:g};return to((function(){var e=wo(m,S,s,v,Ri(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}const Do=function(e){var t,n=void 0===e?{}:e,a=n.context,i=void 0===a?{}:a,o=n.channel,r=void 0===o?po():o,s=n.sagaMonitor,l=ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,a=e.dispatch;return t=Uo.bind(null,$({},l,{context:i,channel:r,dispatch:a,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Ai(i,e)},c};var Ro=function(e){return{done:!0,value:e}},Co={};function No(e){return fi(e)?"channel":pi(e)?String(e):si(e)?e.name:String(e)}function Mo(e,t,n){var a,i,o,r=t;function s(t,n){if(r===Co)return Ro(t);if(n&&!i)throw r=Co,n;a&&a(t);var s=n?e[i](n):e[r]();return r=s.nextState,o=s.effect,a=s.stateUpdater,i=s.errorState,r===Co?Ro(t):o}return ki(s,(function(e){return s(null,e)}),n)}function Fo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:Ki.apply(void 0,[t].concat(a,[e]))}},l=function(e){return o=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeEvery("+No(e)+", "+t.name+")")}function Go(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r,s={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Ki.apply(void 0,[t].concat(a,[e]))}},c=function(e){return{done:!1,value:Hi(e)}},d=function(e){return o=e},u=function(e){return r=e};return Mo({q1:function(){return{nextState:"q2",effect:s,stateUpdater:u}},q2:function(){return o?{nextState:"q3",effect:c(o)}:{nextState:"q1",effect:l(r),stateUpdater:d}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:d}}},"q1","takeLatest("+No(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:zi.apply(void 0,[t].concat(a,[e]))}},l=function(e){return o=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeLeading("+No(e)+", "+t.name+")")}function xo(e,t,n){for(var a=e,i=arguments.length,o=new Array(i>3?i-3:0),r=3;r<i;r++)o[r-3]=arguments[r];var s={done:!1,value:zi.apply(void 0,[n].concat(o))},l={done:!1,value:Ji(t)};return Mo({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Co}},q10:function(e){if((a-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Vo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[Fo,e,t].concat(a))}function jo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[Go,e,t].concat(a))}function Bo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[$o,e,t].concat(a))}class Wo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null,this.sessionContext=void 0}static getInstance(){return Wo.instance||(Wo.instance=new Wo),Wo.instance}static setContext(e){Wo.getInstance().context=e}static setAccessToken(e){Wo.getInstance().accessToken=e}static setUser(e){Wo.getInstance().user=e}static setRequestSource(e){Wo.getInstance().requestSource=e}static setOnRedirectTo(e){Wo.getInstance().onRedirectTo=e}static setLogout(e,t){Wo.getInstance().logout=n=>{n?e(n):Wo.onRedirectTo(t)}}static setEntitlementsOptions(e){Wo.getInstance().entitlementsOptions=e}static setSessionContext(e){Wo.getInstance().sessionContext=e}static setAppName(e){Wo.getInstance().appName=e}static getContext(){var e;return null!=(e=Wo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Wo.getInstance().accessToken}static getRequestSource(){return Wo.getInstance().requestSource}static getUser(){return Wo.getInstance().user}static onRedirectTo(e,t){return Wo.getInstance().onRedirectTo(e,t)}static logout(e){return Wo.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Wo.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Wo.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Wo.getInstance().appName}}Wo.instance=void 0;const zo={getContext:()=>Wo.getContext(),getAccessToken:()=>Wo.getAccessToken(),getUser:()=>Wo.getUser(),onRedirectTo:(e,t)=>Wo.onRedirectTo(e,t),logout:e=>Wo.logout(e)};class Ko extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ho={v1:"/identity/resources/users/webauthn/v1/devices"},qo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Jo={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v1:"/identity/resources/users/v1/me/tenants",v3:"/identity/resources/users/v3/me/tenants"}},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"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"},temporary:{v1:"/identity/resources/users/temporary/v1",configuration:{v1:"/identity/resources/users/temporary/v1/configuration"}}},Yo={v1:"/identity/resources/configurations/v1"},Xo={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Qo={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Zo={v1:"/identity/resources/permissions/v1"},er={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},tr={v1:"/identity/resources/roles/v1",v2:"/identity/resources/roles/v2"},nr={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},ar={v1:"/identity/resources/impersonation/v1"},ir={v1:"/identity/resources/applications/v1"},or={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},rr={v1:"/identity/resources/users/phone-numbers/v1"},sr={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},lr={v1:"/team/resources/members/v1"},cr={v1:"/team/resources/roles/v1"},dr={v1:"/team/resources/stats/v1"},ur={v1:"/team/resources/profile"},yr={v1:"/tenants/resources/account-settings/v1"},fr={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},pr={v1:"/tenants/resources/sub-tenants/v1"},gr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Sr={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"}}}},vr={v1:"/subscriptions/resources/payment-providers/v1"},hr={v1:"/subscriptions/resources/subscriptions/v1"},mr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},br={v1:"/reports/engine/resources/triggers/v1"},Ar="/notification",Tr="/audits",Er={v1:"/event/resources/configurations/v1"},Ir="/webhook",kr="/oauth",Or="/flags",Pr="/directory/resources/v1/configurations/scim2",_r="/directory/resources/scim/temp",Lr="/entitlements/api/v2/user-entitlements",wr={v1:"/security-center/resources/recommendations/v1"},Ur={v1:"/security-center/resources/insights/v1"},Dr="/applications/resources/applications/v1",Rr={v1:"/applications/resources/applications/tenant-assignments/v1"};function Cr(e,t,n=!0){let a;a="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",o="frontegg"===i&&!n;return a.endsWith("/")||(a+="/"),a.endsWith(i)||o||(a+=i),a}function Nr(e){var t,n;const a={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(a[da.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(a[da.frameWork]=e.metadataHeaders.framework),a}function Mr(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Fr=async e=>{var t,n,a;const i=Wo.getContext(),o=await async function(e,t){var n;const a=Nr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Wo.getAccessToken)(),o=Wo.getRequestSource(),r=Mr();t&&(a[da.contentType]=t),o&&(a[da.source]=o),i&&(a.Authorization=`Bearer ${i}`),r&&(a[da.scopedTenant]=r);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return e.appId&&t.push({key:"frontegg-requested-application-id",value:e.appId}),t}(e))a[`${t.key}`]=`${t.value}`;return a}(i,e.contentType),r=await async function(e,t,n){const a=Cr(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const a=Object.keys(t);for(const e of a){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let o=t.startsWith("http")?t:`${a}${t}`;const r=Object.keys(i).length>0;return i&&r&&(o+=`?${new URLSearchParams(i)}`),o}(i,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:$({},o,e.headers),credentials:null!=(n=null!=(a=e.credentials)?a:i.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Ko("Error request is too large",s.status);let e,t=!0;try{e=await s.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=i.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Ko(t?e:"We're facing some difficulties, Please try again",s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},Gr=async(e,t,n)=>Fr($({url:e,method:"GET",contentType:"application/json",params:t},n)),$r=async(e,t,n)=>Fr($({url:e,method:"POST",contentType:"application/json",body:t},n)),xr=async(e,t,n)=>Fr($({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Vr=async(e,t,n)=>Fr($({url:e,method:"PUT",contentType:"application/json",body:t},n)),jr=async(e,t,n)=>Fr($({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Br=async(e,t,n,a)=>Fr($({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},a)),Wr=(e={})=>$({},e.jwt?{Authorization:e.jwt}:{}),zr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Kr={flags:{}};class Hr{constructor(){var e;this._flags={},this._flags=null!=(e=Kr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Hr;return n.set(e),Hr._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=$({},null!=(t=null==Kr?void 0:Kr.flags)?t:{},null!=e?e:{})}}async function qr(){return Gr(Or)}async function Jr(e){return $r(`${Jo.v3}/me/token`,e)}async function Yr(e,t){return Gr(Jo.v2,e,{headers:Wr(t)})}async function Xr(e,t){return Gr(Jo.v3,e,{headers:Wr(t)})}async function Qr(e,t){return Gr(Jo.roles.v3,$({},e,{ids:e.ids.join(",")}),{headers:Wr(t)})}async function Zr(e,t){return Gr(Jo.groups.v3,$({},e,{ids:e.ids.join(",")}),{headers:Wr(t)})}async function es(e){return Gr(Jo.tenants.me.v3,void 0,{headers:Wr(e)})}async function ts(e){return Gr(Jo.tenants.me.v1,void 0,{headers:Wr(e)})}async function ns(){return $r(Jo.passwords.resetBreachedPasswords.v1)}async function as(e){return Vr(`${Jo.v2}/me`,e)}function is(e){e&&sessionStorage.setItem(zr,e)}function os(){sessionStorage.removeItem(zr)}function rs(){return Wo.isSessionPerTenantEnabled()?sessionStorage.getItem(zr):null}function ss(){const[e]=Hr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Wo.getAppName()||"");return Wo.isSessionPerTenantEnabled()||e?ts:es}async function ls(e){return Wo.isSessionPerTenantEnabled()&&is(e.tenantId),Vr(`${Jo.v1}/tenant`,e)}async function cs(){return Gr(`${Jo.v2}/me/tenants`)}async function ds(e){return Gr(fr.v1,void 0,{headers:Wr(e)})}async function us(e){return Gr(fr.tree.v1,void 0,{headers:Wr(e)})}async function ys(e){return Gr(fr.parents.v1,void 0,{headers:Wr(e)})}async function fs(e,t){return Gr(`${fr.parents.v1}/${e}`,void 0,{headers:Wr(t)})}async function ps(e,t){return $r(`${er.users.v1}/count`,e,{headers:Wr(t)})}async function gs(e,t){return Gr(fr.v2,e,{headers:Wr(t)})}async function Ss(e,t){return Gr(fr.metadata.v2,$({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Wr(t)})}async function vs(){return Gr(Yo.v1)}async function hs(){return Gr(`${Yo.v1}/mfa-policy`)}async function ms(){return Gr(`${Yo.v1}/mfa-policy/vendor`)}async function bs(e){return e.id?xr(`${Yo.v1}/mfa-policy`,e):$r(`${Yo.v1}/mfa-policy`,e)}async function As(){return Gr(`${Yo.v1}/lockout-policy`)}async function Ts(){return Gr(`${Yo.v1}/lockout-policy/vendor`)}async function Es(e){return e.id?xr(`${Yo.v1}/lockout-policy`,e):$r(`${Yo.v1}/lockout-policy`,e)}async function Is(){try{return await Gr(`${Yo.v1}/captcha-policy/public`)}catch{return null}}async function ks(){return Gr(`${Yo.v1}/password-history-policy`)}async function Os(){return Gr(`${Yo.v1}/password-history-policy/vendor`)}async function Ps(e){return e.id?xr(`${Yo.v1}/password-history-policy`,e):$r(`${Yo.v1}/password-history-policy`,e)}async function _s(){return Gr(`${Yo.v1}/password`)}async function Ls(){return Gr(`${Xo.emailDomain.v1}`)}async function ws(){return Gr(`${Xo.emailDomain.v1}/config`)}async function Us(e){return $r(`${Xo.emailDomain.v1}`,e)}async function Ds(e){return $r(`${Xo.emailDomain.v1}/config`,e)}async function Rs(e){return jr(`${Xo.emailDomain.v1}/${e}`)}async function Cs(e){return Gr(`${Xo.ip.v1}`,e)}async function Ns(){return Gr(`${Xo.ip.v1}/config`)}async function Ms(e){return $r(`${Xo.ip.v1}`,e)}async function Fs(e){return $r(`${Xo.ip.v1}/bulk`,e)}async function Gs(e){return $r(`${Xo.ip.v1}/config`,e)}async function $s(e){return jr(`${Xo.ip.v1}/${e}`)}async function xs(){return $r(`${Xo.ip.v1}/verify`)}async function Vs(){return $r(`${Xo.ip.v1}/verify/allow`)}Hr._instances={};class js extends Error{constructor(e){super(e)}}const Bs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new js("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,a,i=0,o=0;a=t.charAt(o++);~a&&(e=i%4?64*e+a:a,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);return n};class Ws extends Error{constructor(e){super(e)}}const zs=(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(Bs(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 Bs(t)}})(e.split(".")[n]))}catch(e){throw new Ws("Invalid token specified: "+e.message)}};let Ks,Hs,qs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Ks||(Ks={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Hs||(Hs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(qs||(qs={}));const Js="admin_portal_should_load_authorization";async function Ys(){return Gr(Lr)}let Xs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Xs||(Xs={}));const Qs="admin_portal_entitlements",Zs=["type"],el=["type"],tl=["type"];async function nl(e){if(!e.accessToken)return e;Wo.setAccessToken(e.accessToken);const t=await zd(),n=$({},e,e.accessToken?zs(e.accessToken):{},t);return Wo.setUser(n),n}async function al(e){if(!e.accessToken)return{user:e};Wo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([zd(),cs()]),a=$({},e,e.accessToken?zs(e.accessToken):{},t);return Wo.setUser(a),{user:a,tenants:n}}function il(){if(!Wo.shouldLoadEntitlements())return!1;const[e]=Hr.getFeatureFlags([Qs],Wo.getAppName()||"");return e}function ol(){const[e]=Hr.getFeatureFlags([Js],Wo.getAppName()||"");return e}async function rl(e){const{accessToken:t}=e;if(!t)return{user:e};Wo.setAccessToken(t);const[n,a]=await Promise.all([zd(),ss()()]),i=$({},e,t?zs(t):{},n);return Wo.isSessionPerTenantEnabled()&&is(i.tenantId),Wo.setUser(i),{user:i,tenants:a.tenants,activeTenant:a.activeTenant}}async function sl(e){Wo.setAccessToken(e.id_token);const t=await zd(),n=e.id_token?zs(e.id_token):{},a=$({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Wo.setUser(a),a}async function ll(e){Wo.setAccessToken(e.id_token);const[t,n]=await Promise.all([zd(),ss()()]),a=e.id_token?zs(e.id_token):{},i=$({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},a,t,{expiresIn:e.expires_in||300});return Wo.isSessionPerTenantEnabled()&&is(i.tenantId),Wo.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function cl(e){try{const{address:t}=await $r(`${qo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function dl(e){return $r(`${qo.v1}/user/saml/prelogin`,e)}async function ul(e){return nl(await $r(`${qo.v1}/user/saml/postlogin`,e))}async function yl(e){return nl(await $r(`${qo.v1}/user/oidc/postlogin`,e))}async function fl(e){return nl(await $r(`${qo.v1}/user`,e))}async function pl(e){return rl(await $r(`${qo.v1}/user`,e))}async function gl(e){return nl(await $r(`${qo.v1}/user/mfa/verify`,e))}async function Sl(e){return rl(await $r(`${qo.v1}/user/mfa/verify`,e))}async function vl(e){return $r(`${Jo.v1}/activate`,e)}async function hl(e){return rl(await $r(`${Jo.v1}/activate`,e))}async function ml(e){return Gr(`${Jo.v1}/activate/strategy`,e)}async function bl(e){return $r(`${Jo.v1}/activate/reset`,e)}async function Al(e){return $r(`${Jo.v1}/invitation/reset`,e)}async function Tl(e){return $r(`${Jo.v1}/invitation/accept`,e)}async function El(){const e=rs();return nl(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function Il(){const e=rs();return al(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function kl(){const e=rs();return rl(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function Ol(){return $r(`${qo.v1}/logout`)}async function Pl(e){return Gr(`${kr}/logout`,e)}async function _l(e){return $r(`${Jo.v1}/passwords/reset`,e)}async function Ll(e){return $r(`${Jo.v1}/passwords/reset/verify`,e)}async function wl(e){return Gr(`${Jo.v1}/passwords/config`,e)}async function Ul(e){return $r(`${qo.v1}/user/mfa/recover`,e)}async function Dl(){return $r(`${Jo.v1}/mfa/enroll`)}async function Rl(){return $r(`${Jo.v1}/mfa/authenticator/enroll`)}async function Cl(e){return $r(`${Jo.v1}/mfa/authenticator/enroll/verify`,e)}async function Nl(e){return $r(`${Jo.v1}/mfa/sms/enroll`,e)}async function Ml(e){return $r(`${Jo.v1}/mfa/sms/enroll/verify`,e)}async function Fl(){return $r(`${Jo.v1}/mfa/webauthn/enroll`)}async function Gl(e){return $r(`${Jo.v1}/mfa/webauthn/enroll/verify`,e)}async function $l(e){return $r(`${Jo.v1}/mfa/enroll/verify`,e)}async function xl(e){return $r(`${Jo.v1}/mfa/disable`,e)}async function Vl(e,t){return $r(`${Jo.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function jl(e){return $r(`${Jo.v1}/mfa/sms/${e}/disable`)}async function Bl(e,t){return $r(`${Jo.v1}/mfa/sms/${e}/disable/verify`,t)}async function Wl(e){return $r(`${Jo.v1}/mfa/webauthn/${e}/disable`)}async function zl(e,t){return $r(`${Jo.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Kl(){return Gr(`${Jo.v1}/mfa/devices`)}async function Hl(e){return $r(`${qo.v1}/user/mfa/authenticator/enroll`,e)}async function ql(e){return $r(`${qo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Jl(e){return rl(await $r(`${qo.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Yl(e,t){return $r(`${qo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Xl(e){return $r(`${qo.v1}/user/mfa/emailcode`,e)}async function Ql(e){return $r(`${qo.v1}/user/mfa/emailcode/verify`,e)}async function Zl(e){return rl(await $r(`${qo.v1}/user/mfa/emailcode/verify`,e))}async function ec(e){return $r(`${qo.v1}/user/mfa/sms/enroll`,e)}async function tc(e){return $r(`${qo.v1}/user/mfa/sms/enroll/verify`,e)}async function nc(e){return rl(await $r(`${qo.v1}/user/mfa/sms/enroll/verify`,e))}async function ac(e,t){return $r(`${qo.v1}/user/mfa/sms/${e}`,t)}async function ic(e,t){return $r(`${qo.v1}/user/mfa/sms/${e}/verify`,t)}async function oc(e,t){return rl(await $r(`${qo.v1}/user/mfa/sms/${e}/verify`,t))}async function rc(e){return $r(`${qo.v1}/user/mfa/webauthn/enroll`,e)}async function sc(e){return $r(`${qo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function lc(e){return rl(await $r(`${qo.v1}/user/mfa/webauthn/enroll/verify`,e))}async function cc(e,t){return $r(`${qo.v1}/user/mfa/webauthn/${e}`,t)}async function dc(e,t){return $r(`${qo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function uc(e,t){return rl(await $r(`${qo.v1}/user/mfa/webauthn/${e}/verify`,t))}async function yc(){return Gr(`${sr.v1}/saml/configurations`)}async function fc(e){return $r(`${sr.v1}/saml/configurations`,e)}async function pc(){return Gr(`${sr.v1}/saml/configurations/vendor-config`)}async function gc(e){return Vr(`${sr.v1}/saml/configurations/metadata`,e)}async function Sc(){return Vr(`${sr.v1}/saml/validations/domain`)}async function vc(){return Gr(`${sr.v1}/saml/configurations/roles/default`)}async function hc(){return Gr(`${sr.v2}/saml/configurations/groups`)}async function mc({roleIds:e}){return $r(`${sr.v1}/saml/configurations/roles/default`,{roleIds:e})}async function bc({roleIds:e,group:t}){return $r(`${sr.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Ac({roleIds:e,group:t,id:n}){return xr(`${sr.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Tc({id:e}){return jr(`${sr.v2}/saml/configurations/groups/${e}`)}async function Ec(){return Gr(`${sr.v1}/oidc/configurations`)}async function Ic(){return Gr(`${sr.v2}/configurations/public`)}async function kc(){return Gr(Qo.v1)}async function Oc(){return Gr(Qo.v2)}async function Pc(){return Gr(`${Qo.v2}/authenticated`)}async function _c(){return Gr(Qo.custom.v1)}async function Lc({provider:e,code:t,idToken:n,redirectUri:a,codeVerifier:i,metadata:o,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),a&&(l.redirectUri=a),i&&(l.code_verifier=i),s&&(l.state=s),$r(`${qo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:r},{params:l})}async function wc(){return Gr(`${Yo.v1}/public`)}async function Uc(e){const{shouldActivate:t,authResponse:n,userId:a,tenantId:i}=await $r(`${Jo.v1}/signUp`,e),o={shouldActivate:t,userId:a,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:a}=await rl(n);return $({},o,{user:e,tenants:t,activeTenant:a})}return o}async function Dc(){return Gr(Jo.sessions.currentUser.v1)}async function Rc(){return Gr(`${Jo.sessions.currentUser.v1}/current`)}async function Cc(e){return $r(`${Jo.sessions.v1}/revoke`,{userId:e})}async function Nc(){return Gr(Jo.sessions.configurations.v1)}async function Mc(e){await $r(Jo.sessions.configurations.v1,e)}async function Fc(e){await jr(`${Jo.sessions.currentUser.v1}/${e}`)}async function Gc(){await jr(`${Jo.sessions.currentUser.v1}/all`)}async function $c(){return Gr(Jo.accessTokens.v1)}async function xc(){return Gr(er.accessTokens.v1)}async function Vc({id:e}){return jr(`${er.accessTokens.v1}/${e}`)}async function jc({id:e}){return jr(`${Jo.accessTokens.v1}/${e}`)}async function Bc(e){return $r(Jo.accessTokens.v1,e)}async function Wc(e){return $r(er.accessTokens.v1,e)}async function zc(){return Gr(Jo.apiTokens.v1)}async function Kc(){return Gr(er.apiTokens.v1)}async function Hc(e){return $r(Jo.apiTokens.v1,e)}async function qc(e){return $r(er.apiTokens.v2,e)}async function Jc({tokenId:e}){return jr(`${er.apiTokens.v1}/${e}`)}async function Yc({tokenId:e}){return jr(`${Jo.apiTokens.v1}/${e}`)}async function Xc({userId:e}){return Gr(`${Jo.v1}/${e}`)}async function Qc(e){return Gr(`${Yo.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Zc(e){let{type:t}=e,n=ii(e,Zs);return $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function ed(e){let{type:t}=e,n=ii(e,el);return rl(await $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function td(e){let{type:t}=e,n=ii(e,tl);return $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function nd({token:e}){return $r(er.invites.verify.v1,{token:e})}async function ad(){return Gr(`${sr.v1}/configurations`)}async function id(e){return $r(`${sr.v1}/configurations`,e)}async function od(e,t){return xr(`${sr.v1}/configurations/${e}`,t)}async function rd(e){return jr(`${sr.v1}/configurations/${e}`)}async function sd(e){return $r(`${sr.v1}/configurations/metadata`,e)}async function ld(e,t){return Vr(`${sr.v1}/configurations/${e}/metadata`,t)}async function cd(e){return $r(`${sr.v1}/configurations/metadata-url`,e)}async function dd(e,t){return Vr(`${sr.v1}/configurations/${e}/metadata-url`,t)}async function ud(e,t){return $r(`${sr.v1}/configurations/${e}/domains`,t)}async function yd(e,t){return jr(`${sr.v1}/configurations/${e}/domains/${t}`)}async function fd(e,t){return Vr(`${sr.v1}/configurations/${e}/domains/${t}/validate`)}async function pd(e,t){return Vr(`${sr.v2}/configurations/${e}/domains/${t}/validate`)}async function gd(e){return Gr(`${sr.v1}/configurations/${e}/roles`)}async function Sd(e,t){return Vr(`${sr.v1}/configurations/${e}/roles`,t)}async function vd(e,t){return $r(`${sr.v1}/configurations/${e}/groups`,t)}async function hd(e,{roleIds:t,group:n,id:a}){return xr(`${sr.v1}/configurations/${e}/groups/${a}`,{group:n,roleIds:t})}async function md(e,t){return jr(`${sr.v1}/configurations/${e}/groups/${t}`)}async function bd(e){return Gr(`${sr.v1}/configurations/${e}/groups`)}async function Ad(e){return $r(`${qo.v2}/user/sso/prelogin`,e)}async function Td(e){return nl(await $r(`${qo.v2}/user/oidc/postlogin`,e))}async function Ed(e){return ll(await $r(`${kr}/token`,e))}async function Id(){const e=rs();return ll(await $r(`${kr}/authorize/silent`,{tenantId:e}))}async function kd(e){return sl(await $r(`${kr}/token`,e))}async function Od(){const e=rs();return sl(await $r(`${kr}/authorize/silent`,{tenantId:e}))}async function Pd(e){return $r(`${Jo.v1}/phone/reset`,e)}async function _d(e){return $r(`${Jo.v1}/phone/reset/verify`,e)}async function Ld(e){return $r(`${Jo.v1}/phone`,e)}async function wd(e){return $r(`${Jo.v1}/phone/verify`,e)}async function Ud(e){return Vr(`${Jo.v1}/phone/change`,e)}async function Dd(e){return $r(`${qo.v1}/webauthn/prelogin`,e)}async function Rd(e){return $r(`${qo.v1}/webauthn/postlogin`,e)}async function Cd(e){return rl(await $r(`${qo.v1}/webauthn/postlogin`,e))}async function Nd(){return $r(Ho.v1)}async function Md(){return Gr(Ho.v1)}async function Fd(e){return jr(`${Ho.v1}/${e}`)}async function Gd(e){return $r(`${Ho.v1}/verify`,e)}async function $d(){return Gr(`${Yo.v1}/auth/strategies/public`)}async function xd(){return Gr(`${Yo.v1}/auth/strategies`)}async function Vd(){return Gr(`${Yo.v1}/mfa/strategies`)}async function jd(){return Gr(`${Jo.authorization.v1}`)}async function Bd(){return Gr(`${Jo.v2}/me`)}const Wd=async()=>{try{return await Ys()}catch(e){}};async function zd(){const e=[{action:Bd,shouldLoad:!0},{action:Wd,shouldLoad:il()},{action:jd,shouldLoad:ol()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,a]=await Promise.all(e),i=rs();return i&&(t.tenantId=i),$({},t,null!=a?a:{},{entitlements:n})}async function Kd(e){const t=await $r(`${qo.v1}/user/step-up/generate`,e);return t.accessToken?rl(t):t}async function Hd(e){return Gr(`${Jo.v2}/me`,null!=e?e:{addRoles:!0})}async function qd(e){return Vr(`${Jo.v2}/me`,e)}async function Jd(e){return Vr(`${ur.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Yd(e){return $r(`${Jo.v1}/passwords/change`,e)}async function Xd(e){var t,n,a,i,o,r;const s=(e.filter||[]).reduce(((e,t)=>$({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(a=e.sort)||null==(i=a[0])?void 0:i.id)?n:"name",sortDirection:null!=(o=e.sort)&&null!=(r=o[0])&&r.desc?"desc":"asc"}:null;return Gr(lr.v1,$({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Qd(e){return $r(Jo.v2,$({},e,{provider:"local"}))}async function Zd(e){return jr(`${lr.v1}/${e.userId}`)}async function eu(e){return Vr(lr.v1,e)}async function tu(e){const{userId:t,expirationInSeconds:n}=e;return Vr(`${Jo.temporary.v1}/${t}`,{expirationInSeconds:n})}async function nu(e){return jr(`${Jo.temporary.v1}/${e}`)}async function au(){return Gr(Jo.temporary.configuration.v1)}async function iu(e){return $r(er.invites.user.v1,$({},e))}async function ou(e){return xr(er.invites.user.v1,$({},e))}async function ru(){return jr(er.invites.user.v1)}async function su(){return Gr(er.invites.user.v1)}async function lu(){return Gr(er.invites.configuration.v1)}async function cu(){return Gr(cr.v1)}async function du(){return Gr(Zo.v1)}async function uu(){return Gr(`${dr.v1}/members`)}async function yu(e){return $r(`${lr.v1}/${e.userId}/resendActivationEmail`,{})}async function fu(e){return $r(Jo.v2,$({},e,{provider:"local"}))}async function pu(e){return $r(Jo.invitation.resendAll.v1,$({},e))}async function gu(e){var t,n;const a=await Gr("/metadata",e);if(null!=a&&null!=(t=a.rows)&&t[0])return null==a||null==(n=a.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Su(){return Gr("/metadata/admin-box")}async function vu(e){return $r("/metadata/admin-box",e)}async function hu(){const e=await Gr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const mu=async()=>gu({entityName:"notifications"}),bu=async()=>gu({entityName:"saml"}),Au=async()=>gu({entityName:"audits"}),Tu=async e=>async function(e){const t=await Gr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Eu=["dataFilters"],Iu=["templateId","dataFilters"],ku=["dataFilters"];async function Ou(e){return Gr(`${mr.v2}/tenant-reports`,e)}async function Pu(e){return Gr(`${mr.v2}/${e.id}/tenant-reports`)}async function _u(e){let{dataFilters:t}=e,n=ii(e,Eu);return{html:await Gr(`${br.v1}/preview-report`,$({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lu(e){let{templateId:t,dataFilters:n}=e,a=ii(e,Iu);return $r(`${mr.v2}/${t}/tenant-reports`,$({},a,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function wu(e){let{dataFilters:t}=e,n=ii(e,ku);const a=await Gr(`${br.v1}/preview-report`,$({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",o="html";"pdf"===n.responseType?(i="application/pdf",o="pdf"):"image"===n.responseType&&(i="image/jpeg",o="jpg");const r=new Blob([a],{type:i}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${o}`),l.click(),setTimeout(l.remove.bind(l))}async function Uu(e){return $r(`${br.v1}/tenant-reports`,e)}async function Du(e){return Gr(Ar,{params:e})}async function Ru(e){return Vr(`${Ar}/status`,{params:e})}async function Cu(e){const{notificationId:t,pinStatus:n}=e;return Vr(`${Ar}/${n}`,{notificationId:t})}async function Nu(){return $r(`${Ar}/status/mark-all-read`)}const Mu=["endpoint","headerProps"];async function Fu(e){return Gr(Tr,e)}async function Gu(e){return Gr(`${Tr}/stats`,e)}async function $u(e){const{endpoint:t,headerProps:n}=e,a=ii(e,Mu);return Br(`${Tr}/export/${t}`,{properties:n},a)}const xu=["eventKey"],Vu=["eventKey"],ju=()=>Gr(`${gr.v1}/slack`),Bu=()=>Gr(`${gr.v1}/slack/applications`),Wu=()=>Gr(`${gr.v1}/slack/channels`),zu=e=>e.id?xr(`${gr.v1}/slack/subscription/${e.id}`,e):$r(`${gr.v1}/slack/subscriptions`,e),Ku=e=>jr(`${gr.v1}/slack/subscriptions/${e.id}`),Hu=e=>$r(`${gr.v1}/slack/applications/registrations`,{code:e}),qu=()=>Gr(`${gr.v1}/emails`),Ju=e=>{let{eventKey:t}=e,n=ii(e,xu);return $r(`${gr.v1}/emails/${t}`,n)},Yu=({eventKey:e,enabled:t})=>xr(`${gr.v1}/emails/${e}`,{enabled:t}),Xu=(e,t)=>jr(`${gr.v1}/emails/${e}/subscriptions/${t}`),Qu=(e,t,n)=>Vr(`${gr.v1}/emails/${t}/subscriptions/${e}`,n),Zu=e=>jr(`${gr.v1}/emails/${e}`),ey=()=>Gr(`${gr.v2}/sms`),ty=e=>{let{eventKey:t}=e,n=ii(e,Vu);return $r(`${gr.v2}/sms/${t}`,n)},ny=({eventKey:e,enabled:t})=>xr(`${gr.v2}/sms/${e}`,{enabled:t}),ay=(e,t)=>jr(`${gr.v2}/sms/${e}/subscriptions/${t}`),iy=(e,t,n)=>Vr(`${gr.v2}/sms/${t}/subscriptions/${e}`,n),oy=e=>jr(`${gr.v2}/sms/${e}`),ry=()=>Gr(Ir),sy=e=>e._id?xr(`${Ir}/${e._id}`,e):$r(`${Ir}/custom`,e),ly=e=>jr(`${Ir}/${e}`),cy=(e,t=0,n=10)=>{const a=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Gr(`${Ir}/logs/?${a.toString()}`)},dy=e=>$r(`${Ir}/test`,e),uy=e=>$r(`${Ir}/logs/${e}/retries`),yy=()=>Gr(`${Er.v1}/categories`),fy=e=>Gr(Er.v1,{channels:e});async function py(e,t){return Vr(yr.v1,e,{headers:Wr(t)})}async function gy(e){return Gr(yr.v1,void 0,{headers:Wr(e)})}async function Sy(){return Gr(`${yr.v1}/public`)}const vy=["roleId"],hy=["roleId"],my=["permissionId"];async function by(){return Gr(tr.v1)}async function Ay(e){return $r(tr.v1,e)}async function Ty({roleId:e}){return jr(`${tr.v1}/${e}`)}async function Ey(e){let{roleId:t}=e,n=ii(e,vy);return xr(`${tr.v1}/${t}`,n)}async function Iy(e){let{roleId:t}=e,n=ii(e,hy);return Vr(`${tr.v1}/${t}/permissions`,n)}async function ky(){return Gr(Zo.v1)}async function Oy(e){let{permissionId:t}=e,n=ii(e,my);return Vr(`${Zo.v1}/${t}/roles`,n)}async function Py(){return Gr(`${Zo.v1}/categories`)}async function _y(e){return $r(tr.v2,e)}async function Ly(){return Gr(Sr.subscriptions.v1)}async function wy(e){return Gr(`${Sr.subscriptions.v1}/${e}`)}async function Uy(e){return Vr(`${Sr.subscriptions.v1}/${e}/cancellations/`,{})}async function Dy(e){return Vr(`${Sr.subscriptions.v1}/${e}/renewals/`,{})}async function Ry(e,{paymentMethodId:t,planId:n}){return Vr(`${Sr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(e){return Gr(`${hr.v1}/${e}`)}async function Ny(){return Gr(`${hr.v1}`)}async function My(e){return Vr(`${hr.v1}/${e}/cancellations/`,{})}async function Fy(e){return Vr(`${hr.v1}/${e}/renewals/`,{})}async function Gy(e,{paymentMethodId:t,planId:n}){return Vr(`${hr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function $y(){return Gr(Sr.plans.v1)}async function xy(e){return Gr(`${Sr.plans.v1}/${e}`)}async function Vy(){return Gr(Sr.invoices.v1)}async function jy(e){return Gr(`${Sr.invoices.v1}/${e}`)}async function By(e,t){return Gr(`${Sr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Wy=["email"];async function zy(){return Gr(Sr.paymentMethods.v1)}async function Ky(e){return Gr(`${Sr.paymentMethods.v1}/${e}`)}async function Hy(e,t){let{email:n}=t,a=ii(t,Wy);return xr(`${Sr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:a})}async function qy(e){return $r(Sr.paymentProviders.stripe.subscriptions.v1,e)}async function Jy(e){return Gr(`${Sr.paymentProviders.stripe.customers.v1}/${e}`)}async function Yy(e){return $r(`${Sr.paymentProviders.stripe.customers.v1}`,e)}async function Xy(){return Gr(`${Sr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Qy(e){return $r(`${Sr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Zy(e){return Gr(`${Sr.summaries.v1}/${e}`)}async function ef(e){return Gr(`${Sr.tenantConfiguration.v1}/${e}`)}async function tf(e){return $r(`${Sr.tenantConfiguration.v1}`,e)}async function nf(){return Gr(vr.v1)}async function af(){return Gr(`${Sr.configurations.vendorPublicConfigurations.v1}`)}let of,rf,sf,lf,cf,df;async function uf({userId:e}){return Gr(`${ir.v1}/${e}/apps`)}async function yf({userIds:e}){return Gr(`${ir.v1}/users-apps`,{userIds:e.join(",")})}async function ff(){return Gr(Rr.v1)}async function pf({appIds:e,includeFreeAccess:t=!0}){return Gr(Dr,{ids:e.join(","),_includeFreeAccess:t})}async function gf(e){return $r(`${ir.v1}/apps-user`,e)}async function Sf(e){return jr(`${ir.v1}/user-apps`,e)}async function vf({appIds:e}){return Gr(`${ir.v1}/apps-users`,{appIds:e.join(",")})}async function hf(){return Gr("/vendors/public")}async function mf(e){return Gr(nr.v1,e)}async function bf(e){return $r(nr.v1,e)}async function Af(e,t){return jr(nr.v1,e,{headers:Wr(t)})}async function Tf(e,t,n){return $r(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function Ef(e,t,n){return jr(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function If(e,t,n){return xr(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function kf(e,t){return $r(pr.v1,e,{headers:Wr(t)})}async function Of(e,t){return jr(`${pr.v1}/${e}`,void 0,{headers:Wr(t)})}async function Pf({tenantId:e},t,n){return xr(`${pr.v1}/${e}`,t,{headers:Wr(n)})}async function _f({tenantId:e},t,n){return Vr(`${pr.v1}/${e}/management`,t,{headers:Wr(n)})}async function Lf(e,t,n){return Vr(`${nr.v1}/${e}/access`,t,{headers:Wr(n)})}async function wf(e,t){return $r(`${nr.v2}/`,e,{headers:Wr(t)})}async function Uf(){return Gr(`${Pr}`)}async function Df(e,t){return xr(`${Pr}/${e}`,t)}async function Rf(e){return $r(`${Pr}`,e)}async function Cf(e){return jr(`${Pr}/${e}`)}async function Nf(e){return Gr(`${_r}/${e}/Users/count`)}async function Mf(e){return $r(`${ar.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(of||(of={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(rf||(rf={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(sf||(sf={})),(lf||(lf={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(cf||(cf={})),function(e){e.CREATE="create_customer"}(df||(df={}));const Ff=["groupId"];async function Gf({groupId:e},t){return Gr(`${or.v1}/${e}`,$({},t))}async function $f(e){return Gr(`${or.v1}`,$({},e))}async function xf(e,t){return $r(`${or.getByIds.v1}`,e,{params:t})}async function Vf(e){return $r(`${or.v1}`,e)}async function jf(e){let{groupId:t}=e,n=ii(e,Ff);return xr(`${or.v1}/${t}`,n)}async function Bf(e){return jr(`${or.v1}/${e}`)}async function Wf(e,t){return $r(`${or.v1}/${e}/roles`,t)}async function zf(e,t){return jr(`${or.v1}/${e}/roles`,t)}async function Kf(e,t){return $r(`${or.v1}/${e}/users`,t)}async function Hf(e,t){return jr(`${or.v1}/${e}/users`,t)}async function qf(){return Gr(`${or.configurations.v1}`)}async function Jf(e){return $r(`${or.configurations.v1}`,e)}async function Yf(){return Gr(wr.v1)}async function Xf(){return Gr(Ur.v1)}async function Qf(e){return Gr(`${rr.v1}`,e)}async function Zf(e){return $r(`${rr.v1}`,e)}async function ep(e){return jr(`${rr.v1}/${e}`)}async function tp(e){return $r(`${rr.v1}/preverify`,e)}async function np(e){return $r(`${rr.v1}/verify`,e)}async function ap(e,t){return $r(`${rr.v1}/${e}/delete/verify`,t)}let ip,op,rp,sp;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ip||(ip={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(op||(op={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(rp||(rp={})),function(e){e.NEVER="NEVER",e.ALWAYS="ALWAYS",e.ASSIGNABLE="ASSIGNABLE"}(sp||(sp={}));const lp=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],cp=`${qo.v1}/user/token/refresh`,dp=`${kr}/authorize/silent`,up=`${Jo.v2}/me`,yp=`${Jo.v2}/me/tenants`,fp=`${Jo.v3}/me/tenants`,pp=Lr;let gp,Sp,vp,hp,mp,bp,Ap,Tp,Ep;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(gp||(gp={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Sp||(Sp={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(vp||(vp={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(hp||(hp={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(mp||(mp={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(bp||(bp={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Ap||(Ap={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Tp||(Tp={})),function(e){e.FREE_ACCESS="FREE_ACCESS",e.MANAGED_ACCESS="MANAGED_ACCESS"}(Ep||(Ep={}));const Ip={auth:s,teams:l,metadata:c,reports:d,connectivity:f,notifications:u,audits:y,tenants:o,accountSettings:p,roles:g,subscriptions:S,vendor:h,subTenants:m,featureFlags:t,directory:b,impersonate:A,groups:T,users:i,entitlements:r,securityCenter:E,userPhoneNumbers:I,applications:v},kp={fetch:e,ContextHolder:Wo,FronteggContext:zo,api:Ip,FronteggApiError:Ko,AuthStrategyEnum:Oa,MachineToMachineAuthStrategy:Pa,SocialLoginProviders:ka,ISubscriptionCancellationPolicy:sf,ISubscriptionStatus:of,PaymentMethodType:rf,ProviderType:lf};let Op,Pp;!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"}(Op||(Op={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Pp||(Pp={}));const _p="input is invalid type",Lp="undefined"!=typeof ArrayBuffer,wp="0123456789abcdef".split(""),Up=[-2147483648,8388608,32768,128],Dp=[24,16,8,0],Rp=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Cp=["hex","array","digest","arrayBuffer"],Np=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Lp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Mp=function(e){return function(t){const n=new Gp(!0).update(t);return null==n?void 0:n[e]()}},Fp=function(e){return function(t,n){const a=new $p(t,!0).update(n);return null==a?void 0:a[e]()}};class Gp{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>Gp.prototype.digest(),e?(Np[0]=Np[16]=Np[1]=Np[2]=Np[3]=Np[4]=Np[5]=Np[6]=Np[7]=Np[8]=Np[9]=Np[10]=Np[11]=Np[12]=Np[13]=Np[14]=Np[15]=0,this.blocks=Np):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(_p);if(null===e)throw new Error(_p);if(Lp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Lp&&ArrayBuffer.isView(e)))throw new Error(_p);t=!0}let a,i,o=0;const r=e.length,s=this.blocks;for(;o<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(i=this.start;o<r&&i<64;++o)s[i>>2]|=e[o]<<Dp[3&i++];else for(i=this.start;o<r&&i<64;++o)a=e.charCodeAt(o),a<128?s[i>>2]|=a<<Dp[3&i++]:a<2048?(s[i>>2]|=(192|a>>6)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]):a<55296||a>=57344?(s[i>>2]|=(224|a>>12)<<Dp[3&i++],s[i>>2]|=(128|a>>6&63)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),s[i>>2]|=(240|a>>18)<<Dp[3&i++],s[i>>2]|=(128|a>>12&63)<<Dp[3&i++],s[i>>2]|=(128|a>>6&63)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Up[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,a,i,o,r,s,l,c,d,u=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(d=y&f,e=0;e<64;e+=4)this.first?(s=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=u&y,a=s^u&f^d,r=g&S^~g&v,i=h+n+r+Rp[e]+m[e],o=t+a,h=p+i<<0,p=i+o<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&u,a=l^p&y^s,r=h&g^~h&S,i=v+n+r+Rp[e+1]+m[e+1],o=t+a,v=f+i<<0,f=i+o<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,a=c^f&u^l,r=v&h^~v&g,i=S+n+r+Rp[e+2]+m[e+2],o=t+a,S=y+i<<0,y=i+o<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),d=y&f,a=d^y&p^c,r=S&v^~S&h,i=g+n+r+Rp[e+3]+m[e+3],o=t+a,g=u+i<<0,u=i+o<<0;this.h0=this.h0+u<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,a=this.h3,i=this.h4,o=this.h5,r=this.h6,s=this.h7;let l=wp[e>>28&15]+wp[e>>24&15]+wp[e>>20&15]+wp[e>>16&15]+wp[e>>12&15]+wp[e>>8&15]+wp[e>>4&15]+wp[15&e]+wp[t>>28&15]+wp[t>>24&15]+wp[t>>20&15]+wp[t>>16&15]+wp[t>>12&15]+wp[t>>8&15]+wp[t>>4&15]+wp[15&t]+wp[n>>28&15]+wp[n>>24&15]+wp[n>>20&15]+wp[n>>16&15]+wp[n>>12&15]+wp[n>>8&15]+wp[n>>4&15]+wp[15&n]+wp[a>>28&15]+wp[a>>24&15]+wp[a>>20&15]+wp[a>>16&15]+wp[a>>12&15]+wp[a>>8&15]+wp[a>>4&15]+wp[15&a]+wp[i>>28&15]+wp[i>>24&15]+wp[i>>20&15]+wp[i>>16&15]+wp[i>>12&15]+wp[i>>8&15]+wp[i>>4&15]+wp[15&i]+wp[o>>28&15]+wp[o>>24&15]+wp[o>>20&15]+wp[o>>16&15]+wp[o>>12&15]+wp[o>>8&15]+wp[o>>4&15]+wp[15&o]+wp[r>>28&15]+wp[r>>24&15]+wp[r>>20&15]+wp[r>>16&15]+wp[r>>12&15]+wp[r>>8&15]+wp[r>>4&15]+wp[15&r];return l+=wp[s>>28&15]+wp[s>>24&15]+wp[s>>20&15]+wp[s>>16&15]+wp[s>>12&15]+wp[s>>8&15]+wp[s>>4&15]+wp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,a=this.h3,i=this.h4,o=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,a>>24&255,a>>16&255,a>>8&255,255&a,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class $p extends Gp{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const a=typeof e;if("string"===a){const t=[],a=e.length;let i,o=0;for(n=0;n<a;++n)i=e.charCodeAt(n),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>6,t[o++]=128|63&i):i<55296||i>=57344?(t[o++]=224|i>>12,t[o++]=128|i>>6&63,t[o++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[o++]=240|i>>18,t[o++]=128|i>>12&63,t[o++]=128|i>>6&63,t[o++]=128|63&i);e=t}else{if("object"!==a)throw new Error(_p);if(null===e)throw new Error(_p);if(Lp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Lp&&ArrayBuffer.isView(e)))throw new Error(_p)}var i;e.length>64&&(e=null==(i=new Gp(!0).update(e))?void 0:i.array());const o=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;o[n]=92^t,r[n]=54^t}Gp.call(this,t),this.update(r),this.oKeyPad=o,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Gp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Gp.prototype.finalize.call(this)}}}const xp=function(){const e=Mp("hex");e.create=function(){return new Gp},e.update=function(t){return e.create().update(t)};for(let t=0;t<Cp.length;++t){const n=Cp[t];e[n]=Mp(n)}return e}();function Vp(e,t){const n=$({},e);return t.forEach((e=>{delete n[e]})),n}async function jp(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=xp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Bp(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let a=0;a<e;a++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Fp("hex");e.create=function(e){return new $p(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Cp.length;++t){const n=Cp[t];e[n]=Fp(n)}}();const Wp=e=>new Promise(((t,n)=>{const a=new FileReader;a.readAsText(e),a.onload=()=>t(a.result),a.onerror=n}));function*zp(e){const t=yield qi((e=>e.root.appName));return Hr.getFeatureFlags(e,t)}const Kp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Hp=$({},Kp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),qp=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03"],vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03","16647407-ed6f-4ca6-83a0-86225d921959","f403c6b9-1abe-4ec7-9971-aa032255fc25","a43e059d-d731-44b1-94bb-fb6b16c62210"],vendorId:"vendorId"},{id:"1234",key:"Support",name:"Support",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03","f26b00f8-ffe0-4739-b15c-7db15c27ea26","a9c803b0-ebfa-49b9-9607-f0d3a390ee61"],tenantId:"tenantId",vendorId:"vendorId"}],Jp={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"8d71b676-754c-4600-afe7-ca5add1e6809",key:"fe.*",name:"General Admin",description:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},Yp=$({},Jp,{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}),Xp={loading:!1,error:void 0,saving:!0,profile:Jp},Qp={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"},Zp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Oa.EmailAndPassword,machineToMachineAuthStrategy:Pa.ClientCredentials},eg={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},tg={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},ng={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},ag={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},ig={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},og=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],rg={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:ag,roles:og,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},sg=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],lg={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:[qp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[qp[0]],managedBy:vp.FRONTEGG}]},cg={id:lg.id,email:lg.email,name:lg.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[qp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},dg={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:[qp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[qp[0]],managedBy:vp.FRONTEGG}]},ug={id:dg.id,email:dg.email,name:dg.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[qp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},yg={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},fg=[dg,lg],pg=[ug,cg],gg=[yg],Sg=[{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}],vg=[{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"}],hg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},mg={isActive:!0,strategy:Kn.ALLOW},bg=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Kn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Kn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Kn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Kn.BLOCK,description:"IP 4"}],Ag=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push($({},dg,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Tg=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),Eg=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ag(6),roles:[Tg("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:vp.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ag(44),roles:[Tg("Editor")],managedBy:vp.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ag(8),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ag(5),roles:[Tg("Admin")],managedBy:vp.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ag(21),description:"BDR, AE, and inside sales",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Ag(23),description:"Dev success and customer success",roles:[Tg("Admin")],managedBy:vp.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Ag(10),description:"The marketing department",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Ag(4),description:"Human resources",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Ag(3),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ag(8),roles:[Tg("Editor")],managedBy:vp.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Ag(4),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG}],Ig={scoring:{score:79},recommendations:{items:[{code:hp.FORCE_MFA,severity:Ap.WARNING,category:Tp.MFA},{code:hp.ENABLE_FORCE_RELOGIN,severity:Ap.WARNING,category:Tp.SESSIONS}]}},kg={insights:{items:[{category:Tp.MFA,code:mp.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Tp.SESSIONS,code:mp.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Tp.PASSWORD,code:mp.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Tp.DOMAIN,code:mp.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},Og={users:pg,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Pg={users:[pg[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},_g={users:[pg[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0},Lg=[{id:"8d71b676-754c-4600-afe7-ca5add1e6809",key:"fe.secure.*",name:"Secure write",description:"all secure access permissions",categoryId:"77154759-0a04-4669-b6b4-0858d3c1190e",fePermission:!0,assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date},{id:"85e1fd7b-2bb7-498f-8521-5f8e5774c01e",key:"fe.account-hierarchy.write.subAccountAccess",name:"Give access to sub accounts",description:"Give a user access to sub account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"a1807695-54a2-4f95-95de-a9b246488aae",key:"fe.account-hierarchy.read.subAccount",name:"Read sub accounts",description:"Read sub accounts",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"04dbcc11-61db-40a9-9577-9b73e50d1d03",key:"fe.secure.read.*",name:"Secure read",description:"all secure access read permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"77154759-0a04-4669-b6b4-0858d3c1190e",fePermission:!0},{id:"a1807695-54a2-4f95-95de-a9b246488aae",key:"fe.account-hierarchy.read.subAccount",name:"Read sub accounts",description:"Read sub accounts",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"85e1fd7b-2bb7-498f-8521-5f8e5774c01e",key:"fe.account-hierarchy.write.subAccountAccess",name:"Give access to sub accounts",description:"Give a user access to sub account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"a9c803b0-ebfa-49b9-9607-f0d3a390ee61",key:"fe.account-settings.delete.account",name:"Delete Account",description:"Delete my account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"42aaebe1-893d-4da5-99d7-375a4537b7a4",fePermission:!0},{id:"f26b00f8-ffe0-4739-b15c-7db15c27ea26",key:"fe.account-settings.write.custom-login-box",name:"Edit custom login settings",description:"Write account's custom login box styling",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"42aaebe1-893d-4da5-99d7-375a4537b7a4",fePermission:!0},{id:"a43e059d-d731-44b1-94bb-fb6b16c62210",key:"fe.connectivity.delete.*",name:"Connectivity delete",description:"all connectivity delete permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",fePermission:!0},{id:"f403c6b9-1abe-4ec7-9971-aa032255fc25",key:"fe.connectivity.delete.slackAppRegistration",name:"Delete slack application registration",description:"allow user to delete slack app registration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"e8c0e727-f562-449a-82c5-f7691defde02",key:"fe.connectivity.read.*",name:"Connectivity read",description:"all connectivity read permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",fePermission:!0},{id:"2a5dcd6d-57a3-45c4-815f-c265609cc1f7",key:"fe.connectivity.read.emailConfig",name:"Read email configuration",description:"read email integration configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"2d7b4be7-8269-4ff4-81d6-0c92e95790d5",fePermission:!0},{id:"4fee0eb0-5b17-450b-bea4-b9b908230bda",key:"fe.connectivity.read.eventCategories",name:"Read events categories",description:"view connectivity events categories",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"31c7a260-55d6-43d5-a872-4f9e22982ff5",fePermission:!0},{id:"750a96a5-8abf-4340-b91a-723c7bb8bcfd",key:"fe.connectivity.read.events",name:"Read events",description:"view connectivity events",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"31c7a260-55d6-43d5-a872-4f9e22982ff5",fePermission:!0},{id:"ef2a5f1a-74c5-431f-b1a6-d4fb5026e374",key:"fe.connectivity.read.slackApp",name:"Read slack application",description:"get slack application configuration in order to register",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"9fc1fa37-a8b9-4931-b2b5-5de55df25289",key:"fe.connectivity.read.slackChannels",name:"Read slack channels",description:"view registered slack workspace channels",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"87c3df9d-0ab2-4e97-bfc8-777a68ba2543",key:"fe.connectivity.read.slackSubscriptions",name:"Read slack subscriptions",description:"view slack events subscriptions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"7826470b-151f-4bab-b2c0-785e09878616",key:"fe.connectivity.read.slackUsers",name:"Read slack users",description:"view registered slack workspace users",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"ee779734-a7e3-47b3-ace9-944f9bee8ad8",key:"fe.connectivity.read.smsConfig",name:"Read SMS configuration",description:"read SMS integration configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"5743fccc-b4ea-4907-bdca-7446ea088974",fePermission:!0},{id:"54583a96-c731-4a84-9abc-1b8b827f06ae",key:"fe.connectivity.read.userBellNotifications",name:"Read bell notifications",description:"view user bell notifications",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"18d2584b-7f03-4038-ab93-bc2b0f4511be",fePermission:!0},{id:"2dfde8ef-7df2-4426-bb8d-33615e399a4d",key:"fe.connectivity.read.webhookLogs",name:"Read webhooks logs",description:"view webhooks logs",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"e74e5390-396b-429c-9544-62417912d018",fePermission:!0},{id:"16647407-ed6f-4ca6-83a0-86225d921959",key:"fe.connectivity.read.webhooks",name:"Read webhooks",description:"view webhooks configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"e74e5390-396b-429c-9544-62417912d018",fePermission:!0}],wg=[{id:"d9b4dbd0-476c-4708-b079-d9e6e4758971",name:"test",description:"",createdAt:new Date,updatedAt:new Date,permissionIds:[],feCategory:!1},{id:"2b3f1746-1135-4b8d-aff3-5697cffc4482",name:"SAML",description:"Secure access SAML",createdAt:new Date,updatedAt:new Date,permissionIds:["8ea45a49-c403-4551-9da9-77f5da44f130","8d94c261-1f7d-46bd-88a8-511e9f39273b","7391ac41-b076-4386-8a14-7c2d798d3335","6d8f5a1f-b3cd-421a-ba85-7784bdd97dc2","3c989065-35e1-4198-8c9c-c94084222794"],feCategory:!0},{id:"2c2281da-cf81-4943-9605-42969677e9fe",name:"Security Policies",description:"Secure access security policies",createdAt:new Date,updatedAt:new Date,permissionIds:["e5642338-b265-4ce5-94e4-8c21490033ad","daddb9e9-a836-4901-b175-2d1182dab6f5","bd4242ce-e84f-4387-9c41-c90e7d1fc6fa","ba33b4c1-47f0-4aa2-9e3a-fcf96229d355","ade4558f-5438-4383-b42b-728e8a745cc8","ad064258-2178-48f8-845c-ac1ce0217be8","acefb7fd-11c7-4a43-9544-b4fb461db94c","909b6a0a-4efc-4464-90ac-b8b9a8f22fc2","8a03c1e7-3991-4cca-8726-88c339766144","860eb891-b9eb-44ba-94c1-51cfc2be9dd9","719e09ae-5513-4cc3-bce1-97503a0a7658","6fcd99e7-2206-4c45-86aa-411a87b7fcac","235592cc-47c7-49cc-82e4-129f5333cc45","2214404d-3140-44bf-9c9d-438fa56b5a50"],feCategory:!0},{id:"2d7b4be7-8269-4ff4-81d6-0c92e95790d5",name:"Email integration",description:"Connectivity email integration",createdAt:new Date,updatedAt:new Date,permissionIds:["9a0bb3db-8bdb-4278-8f18-9c484bcd2f8c","440f5616-ad85-43d1-b25d-1fd7930c6d26","2a5dcd6d-57a3-45c4-815f-c265609cc1f7"],feCategory:!0},{id:"31c7a260-55d6-43d5-a872-4f9e22982ff5",name:"Events",description:"Connectivity Events",createdAt:new Date,updatedAt:new Date,permissionIds:["85c90d0f-3bb0-40c0-914a-640c7ca9eea5","750a96a5-8abf-4340-b91a-723c7bb8bcfd","4fee0eb0-5b17-450b-bea4-b9b908230bda"],feCategory:!0},{id:"42aaebe1-893d-4da5-99d7-375a4537b7a4",name:"Account settings",description:"Account profile settings",createdAt:new Date,updatedAt:new Date,permissionIds:["f26b00f8-ffe0-4739-b15c-7db15c27ea26","eb11313d-c7bb-43c0-a85d-c79bedab46b1","a9c803b0-ebfa-49b9-9607-f0d3a390ee61","634d3fab-b470-4a92-a25b-245459ddd6db"],feCategory:!0},{id:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",name:"Slack integration",description:"Connectivity Slack integration",createdAt:new Date,updatedAt:new Date,permissionIds:["f403c6b9-1abe-4ec7-9971-aa032255fc25","ef2a5f1a-74c5-431f-b1a6-d4fb5026e374","e3231a61-e425-4ac1-aa87-654ab995af5c","9fc1fa37-a8b9-4931-b2b5-5de55df25289","87c3df9d-0ab2-4e97-bfc8-777a68ba2543","7993a558-0af5-4d77-b9fc-8e8114f0ce0b","7826470b-151f-4bab-b2c0-785e09878616","5b0323d1-a0a0-4d4f-9bb8-b1634d9afa94","4245736e-13b0-48fd-9a08-bc93809dcdaf","2fccccb1-36f5-4c5c-8d93-73ab15d0b2d9"],feCategory:!0},{id:"6b925df5-8b09-470a-9fcc-dae0beae1af4",name:"Audits",description:"Audit Logs",createdAt:new Date,updatedAt:new Date,permissionIds:["97085bb5-bec7-49eb-9744-4d35bbb83ad3"],feCategory:!0},{id:"77154759-0a04-4669-b6b4-0858d3c1190e",name:"Secure access",description:"Secure access general",createdAt:new Date,updatedAt:new Date,permissionIds:["925e0c16-aead-41e6-b62f-8ddb2ea4ed06","8d71b676-754c-4600-afe7-ca5add1e6809","1c81d4ca-47a2-4564-b9d9-9d346b8cdbe7","04dbcc11-61db-40a9-9577-9b73e50d1d03"],feCategory:!0},{id:"916d6db5-489e-4109-95cf-57dee7802c57",name:"Webpush integration",description:"Webpush notifications integration",createdAt:new Date,updatedAt:new Date,permissionIds:["e5a7bbd3-f76b-4559-979d-885c5c75f72f","cb47ea6f-0a59-4694-97d0-9c32f6732e85"],feCategory:!0},{id:"9707ef7f-afd3-4d1f-962e-68c0d876db53",name:"Subscriptions",description:"Subscriptions access general",createdAt:new Date,updatedAt:new Date,permissionIds:["ce03de78-a7f4-4498-acce-df4aae30ed0d","ae81dd56-2f94-4da8-9c16-b6c781b0dcb7","72e55675-ea98-4f1a-85f0-09319cdcbcbf"],feCategory:!0},{id:"a71e2e14-0cdb-42df-b297-d00af2d4e62e",name:"Users management",description:"Secure access users management",createdAt:new Date,updatedAt:new Date,permissionIds:["e7263c99-874f-4e17-8d63-25ae3d9f5739","db957d5f-4048-4011-bcb4-5d21af0560e4","c52b0a96-dcff-4fba-aa8e-ce3a7336bde2","bc754ce1-ebbe-446a-bb84-4f287be0651c","998756c3-773a-4771-b7a5-510e795fb5f4","88565631-dc77-472c-b1d9-18674483c24b","6b84ddeb-a242-48c5-bf2a-62105315518a","61874f64-2204-4eec-8f02-0d38bd5a66b8","4c47caae-d384-48bb-99bc-554aafa2888f","43695880-d40e-412d-b342-434d58c5c8ca","4003ac5b-326c-4dc2-afb1-8900e16ee443","007c612d-5184-4f04-846e-d49c6591de0c"],feCategory:!0},{id:"c058e114-917c-4ad1-940e-11e9cc40b638",name:"Roles and permissions",description:"Secure access roles and permissions",createdAt:new Date,updatedAt:new Date,permissionIds:["c89960c8-6d67-44fa-a3aa-1a6826f45b0d","93be3a9a-98a2-48b8-a146-a223e457c904","80e49f9a-7628-4efc-913b-5f80ca92f106","7f2576d6-cbbb-4c7b-bb70-d75a88d9ce47","6a337814-34e5-4c24-a56f-d462c1db218b"],feCategory:!0},{id:"c38e9f59-ff65-4f9f-a31d-0bbfc44df347",name:"Groups",description:"Secure access groups",createdAt:new Date,updatedAt:new Date,permissionIds:["e1907e68-877d-4f2d-a266-d54e143c3c0c","7a17405a-6c4b-4053-9843-f9d5e3af9e00","5ee7bb2d-aad4-497f-94d2-9e255c470882","4c406972-c815-46a9-8f47-9708adc334b8","399bff45-aa24-49ae-9357-5f05a5eef3a5","0037b3ad-5f77-4157-aa33-33c92b5fe057"],feCategory:!0},{id:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",name:"Connectivity",description:"Connectivity general",createdAt:new Date,updatedAt:new Date,permissionIds:["e8c0e727-f562-449a-82c5-f7691defde02","c88bf74a-66a4-48c2-bc1b-2e2aa057858d","a43e059d-d731-44b1-94bb-fb6b16c62210","3f118e4c-badd-45d1-8056-3f3428be92ca"],feCategory:!0},{id:"d24db1e3-002b-421d-951d-09a967dd7cd5",name:"Account Hierarchy",description:"Account hierarchy",createdAt:new Date,updatedAt:new Date,permissionIds:["b6e66e0f-c6d2-4113-865a-57d08b1dec45","a1807695-54a2-4f95-95de-a9b246488aae","85e1fd7b-2bb7-498f-8521-5f8e5774c01e","60cfedb4-64ca-40d1-8b3a-4288bcde1209"],feCategory:!0},{id:"e74e5390-396b-429c-9544-62417912d018",name:"Webhooks integration",description:"Connectivity webhooks integration",createdAt:new Date,updatedAt:new Date,permissionIds:["996e42ed-b1d8-4e36-aa76-58091c56bdf7","8e7014d4-13fa-439a-a313-a2b9141f8b47","2dfde8ef-7df2-4426-bb8d-33615e399a4d","16647407-ed6f-4ca6-83a0-86225d921959"],feCategory:!0},{id:"e8af2833-1bbf-4ccf-8658-f6e0c60621b9",name:"API tokens",description:"Secure access API tokens",createdAt:new Date,updatedAt:new Date,permissionIds:["f03dc571-0769-4bcf-9c51-776b81582a14","c395932b-c732-41ad-bec6-ced7602bf79e","94351961-e9c8-4c63-8818-ae8481ceab22","5a744287-d01e-4a7a-8a37-2ce212ce5ff5","0cf97f9f-84dc-4dfc-bf41-2ad4b6c072e9","0c8cdac0-b364-4ab6-9737-7aa43f944013"],feCategory:!0}];let Ug,Dg,Rg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ug||(Ug={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Dg||(Dg={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Rg||(Rg={})),Rg.profile,Rg.privacy,Rg.personalApiTokens,Rg.account,Rg.users,Rg.groups,Rg.security,Rg.sso,Rg.audits,Rg.webhooks,Rg.apiTokens,Rg.roles,Rg.subscriptions,Rg.allAccounts;const Cg=e=>{try{return new URL(e),!0}catch(e){return!1}},Ng=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Mg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Fg="tenantId",Gg=e=>e.mfaRequired&&e.mfaToken?(Wo.setAccessToken(null),Wo.setUser(null),!0):(Wo.setAccessToken(e.accessToken),Wo.setUser(e),!1),$g=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:a,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),a=+Boolean(e.authenticators.length),i=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:a,numberOfEmails:i,totalDevices:t+n+a+i}})(e);if(1===i){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(a)return un.emailVerifyCode}return un.verify},xg=e=>{if(1===e.length){const[t]=e;if(t===qs.AuthenticatorApp)return un.authenticatorApp;if(t===qs.SMS)return un.smsSetPhoneNumber;if(t===qs.EmailCode)return un.emailVerifyCode}return un.verify};function*Vg(e){let t=Lt.loginWithTwoFactor,n={};const{loginState:a}=yield qi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:o}=yield zi(Ip.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:$g(e.mfaDevices)}:(n={step:xg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Lt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:wt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:$({},a,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:o,isBreachedPassword:e.isBreachedPassword})}}const jg=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let Bg;function Wg(e,t){var n,a;null==(n=(a=window).onFronteggEvent)||n.call(a,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Bg||(Bg={}));const zg=(e,t=[])=>Object.entries(e).reduce(((e,[n,a])=>"object"==typeof a?[...e,...zg(a,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:a}]),[]),Kg=["callback"];function*Hg(){yield ji(za.setCustomLoginState({loading:!0}));try{const e=yield zi(Ip.metadata.getAdminBoxMetadata);yield ji(za.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield ji(za.setCustomLoginState({loading:!1,error:jg(e)}))}}function*qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Kg);try{yield ji(za.setCustomLoginState({error:null,saving:!0}));const e=zg(n);if(0===e.length)throw new Error("No changes to update");yield zi(Ip.metadata.updateAdminBoxMetadata,{actions:e});const a=yield zi(Ip.metadata.getAdminBoxMetadata);yield ji(za.setCustomLoginState({tenantMetadata:a,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setCustomLoginState({error:jg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Jg(){return!!(yield zi(Yg))}function*Yg(){const e=Wo.getContext();if(null==e||!e.tenantResolver)return;const t=yield e.tenantResolver();if(null!=t&&t.tenant)return t.tenant;const{customLoginAlias:n,hasCustomLogin:a}=yield qi((e=>{var t,n;const a=null==(t=e.auth)||null==(n=t.tenantsState)?void 0:n.activeTenant;return{customLoginAlias:null==a?void 0:a.alias,hasCustomLogin:null==a?void 0:a.hasCustomLogin}}));return a?n:void 0}function*Xg(){try{var e;if(!(yield zi(Jg)))return;const t=yield qi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:a}=Ip.accountSettings,{applicationUrl:i}=yield zi(t?n:a);if(!i)return;const{routes:o}=yield qi((e=>e.auth)),r=null!=(e=Ng(i))?e:"";yield ji(za.setState({routes:$({},o,{customLoginAuthenticatedUrl:i,customLoginUrl:o.loginUrl+r})})),yield ji(za.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Qg(){yield Bo(za.loadTenantMetadata,Hg),yield Bo(za.updateTenantMetadata,qg)}let Zg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(Zg||(Zg={}));const eS=["callback"];function tS(e){return function*(t){const[n]=yield zi(zp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield nS(),yield aS())}}function*nS(){const e=Zg.RECOMMENDATIONS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:a}=yield zi(Ip.securityCenter.getRecommendations);yield ji(za.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==a?void 0:a.score)?t:0}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*aS(){const e=Zg.INSIGHTS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield zi(Ip.securityCenter.getInsights);yield ji(za.setSecurityCenterState({insights:t.items}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*iS(e){let{payload:{callback:t}}=e,n=ii(e.payload,eS);const a=Zg.SEND_BREACHED_PASSWORD_EMAIL;yield ji(za.setSecurityCenterStateError({key:a,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:a,value:!0}));try{yield zi(Ip.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield ji(za.setSecurityCenterStateError({key:a,value:jg(e)})),null==t||t(!1,e)}finally{yield ji(za.setSecurityCenterStateLoader({key:a,value:!1}))}}function*oS({payload:{callback:e}}){const t=Zg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield ji(za.setSecurityCenterStateError({key:t,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:t,value:!0}));try{yield zi(Ip.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield ji(za.setSecurityCenterStateError({key:t,value:jg(n)})),null==e||e(!1)}finally{yield ji(za.setSecurityCenterStateLoader({key:t,value:!1}))}}function*rS({key:e,tableState:t,updateStateKey:n,_offset:a,_limit:i,_preset:o,_email:r,_maxInactiveSeconds:s}){var l,c,d,u;yield ji(za.setSecurityCenterStateError({key:e,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=a?a:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(d=null!=i?i:null==t||null==(u=t.queryParams)?void 0:u._limit)?d:10,p=$({_offset:y,_limit:f,_includeSubTenants:!1,_preset:o,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:a,totalPages:i}}=yield zi(Ip.users.getUsersV3,p),o={totalUsersItems:a,totalUsersPages:i,usersPageOffset:y,queryParams:$({_offset:y,_limit:f,_maxInactiveSeconds:s},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield zi(Ip.roles.getRoles),a=yield zi(Ip.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const o=null==a||null==(t=a.find((t=>t.userId===e.id)))?void 0:t.roleIds;return $({},e,{roles:null!=(i=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield ji(za.setSecurityCenterState({[n]:$({users:e},o)}))}else yield ji(za.setSecurityCenterState({[n]:$({users:[]},o)}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*sS({payload:e}){var t;const n=Zg.BREACHED_PASSWORD_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:ga.BREACHED_PASSWORDS,tableState:a},e))}function*lS({payload:e}){var t;const n=Zg.UNENROLLED_MFA_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:ga.MFA_UNENROLLED,tableState:a},e))}function*cS({payload:e}){var t;const n=Zg.INACTIVE_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"inactiveUsersTable",_preset:ga.INACTIVE,tableState:a},e))}function*dS(){yield Vo(za.loadRecommendations,nS),yield Vo(za.loadInsights,aS),yield Vo(za.sendResetBreachedPasswordEmail,iS),yield Vo(za.sendBulkResetBreachedPasswordEmails,oS),yield Vo(za.loadBreachedPasswordUsers,sS),yield Vo(za.loadUnenrolledMfaUsers,lS),yield Vo(za.loadInactiveUsers,cS)}function*uS(){const e=Zg.RECOMMENDATIONS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({recommendations:Ig.recommendations.items,score:Ig.scoring.score})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*yS(){const e=Zg.INSIGHTS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({insights:kg.insights.items})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*fS(){const e=Zg.BREACHED_PASSWORD_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({breachedPasswordUsersTable:Og})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*pS(){const e=Zg.UNENROLLED_MFA_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({unenrolledMfaUsersTable:_g})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*gS(){const e=Zg.INACTIVE_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({inactiveUsersTable:Pg})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*SS({payload:{callback:e}}){const t=Zg.SEND_BREACHED_PASSWORD_EMAIL;yield ji(za.setSecurityCenterStateLoader({key:t,value:!0})),yield Ji(500),null==e||e(!0),yield ji(za.setSecurityCenterStateLoader({key:t,value:!1}))}function*vS(){yield Vo(za.loadRecommendations,uS),yield Vo(za.loadInsights,yS),yield Vo(za.loadBreachedPasswordUsers,fS),yield Vo(za.loadUnenrolledMfaUsers,pS),yield Vo(za.loadInactiveUsers,gS),yield Vo(za.sendResetBreachedPasswordEmail,SS)}const hS=["callback"],mS=["callback"],bS=["callback"],AS=["callback"],TS=["callback"],ES=["callback"];function*IS(){yield ji(za.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getGlobalSecurityPolicy);yield ji(za.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyGlobalState({error:jg(e),loading:!1}))}yield ji(za.loadSecurityPolicyMfa()),yield ji(za.loadSecurityPolicyVendorMfa()),yield ji(za.loadSecurityPolicyLockout()),yield ji(za.loadSecurityPolicyVendorLockout()),yield ji(za.loadSecurityPolicyVendorPasswordHistory()),yield ji(za.loadSecurityPolicyCaptcha()),yield ji(za.loadPublicAuthStrategiesPolicy())}function*kS(e){var t,n;if(!(yield zi(Jg)))return e;const a=yield zi(PS);return null!=a&&null!=(t=a.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?$({},e,{authStrategy:a.mainAuthStrategies[0].strategy}):e}function*OS(){yield ji(za.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorConfig),t=yield kS(e);yield ji(za.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPublicState({error:jg(e),loading:!1}))}}function*PS(){const e=yield qi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield zi(Ip.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield zi(Ip.auth.getVendorPublicAuthStrategiesConfig),t}function*_S(){yield ji(za.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield zi(PS);yield function*(e){const t=yield zi(Jg);if(!e||!t)return;const{policy:n}=yield qi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield ji(za.setSecurityPolicyPublicState({policy:$({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield ji(za.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyAuthStrategyPublicState({error:jg(e),loading:!1}))}}function*LS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getMfaPolicy);yield ji(za.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyMfaState({error:jg(e),loading:!1}))}}function*wS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorMfaPolicy);yield ji(za.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorMfaState({error:jg(e),loading:!1}))}}function*US(e){let{payload:{callback:t}}=e,n=ii(e.payload,hS);yield ji(za.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.saveMfaPolicy,n);yield ji(za.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*DS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getLockoutPolicy);yield ji(za.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyLockoutState({error:jg(e),loading:!1}))}}function*RS(e){let{payload:{callback:t}}=e,n=ii(e.payload,mS);yield ji(za.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.saveLockoutPolicy,n);yield ji(za.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyLockoutState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*CS(){yield ji(za.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorLockoutPolicy);yield ji(za.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorLockoutState({error:jg(e),loading:!1}))}}function*NS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCaptchaPolicy);yield ji(za.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyCaptchaState({error:jg(e),loading:!1}))}}function*MS(){yield ji(za.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getPasswordHistoryPolicy);yield ji(za.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPasswordHistoryState({error:jg(e),loading:!1}))}}function*FS(){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorPasswordHistoryPolicy);yield ji(za.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({error:jg(e),loading:!1}))}}function*GS(e){let{payload:{callback:t}}=e,n=ii(e.payload,bS);yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.savePasswordHistoryPolicy,n);yield ji(za.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*$S(){yield ji(za.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getPasswordConfigPolicy);yield ji(za.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPasswordState({error:jg(e),loading:!1}))}}function*xS(){yield Bo(za.loadSecurityPolicy,IS),yield Vo(za.saveSecurityPolicyMfa,tS(US)),yield Vo(za.loadSecurityPolicyMfa,LS),yield Vo(za.loadSecurityPolicyVendorMfa,wS),yield Vo(za.saveSecurityPolicyLockout,tS(RS)),yield Vo(za.loadSecurityPolicyLockout,DS),yield Vo(za.loadSecurityPolicyVendorLockout,CS),yield Vo(za.loadSecurityPolicyCaptcha,NS),yield Vo(za.saveSecurityPolicyPasswordHistory,tS(GS)),yield Vo(za.loadSecurityPolicyPasswordHistory,MS),yield Vo(za.loadSecurityPolicyVendorPasswordHistory,FS),yield Vo(za.loadVendorPasswordConfig,$S),yield Vo(za.loadPublicSecurityPolicy,OS),yield Vo(za.loadPublicAuthStrategiesPolicy,_S)}function*VS(){yield ji(za.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ji(za.setSecurityPolicyPublicState({policy:Zp,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPublicState({error:jg(e),loading:!1}))}}function*jS(){yield ji(za.setSecurityPolicyGlobalState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyGlobalState({policy:Qp,loading:!1})),yield ji(za.loadSecurityPolicyMfa()),yield ji(za.loadSecurityPolicyVendorMfa()),yield ji(za.loadSecurityPolicyLockout()),yield ji(za.loadSecurityPolicyVendorLockout()),yield ji(za.loadSecurityPolicyPasswordHistory()),yield ji(za.loadSecurityPolicyVendorPasswordHistory()),yield ji(za.loadSecurityPolicyCaptcha())}function*BS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyMfaState({policy:eg,loading:!1}))}function*WS(){yield ji(za.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorMfaState({policy:eg,loading:!1}))}function*zS(e){var t;let{payload:{callback:n}}=e,a=ii(e.payload,AS);yield ji(za.setSecurityPolicyMfaState({saving:!0,error:null}));const i=$({},tg,{id:null!=(t=a.id)?t:tg.id,enforceMFAType:a.enforceMFAType});yield It(),yield ji(za.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*KS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyLockoutState({policy:tg,loading:!1}))}function*HS(){yield ji(za.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorLockoutState({policy:tg,loading:!1}))}function*qS(e){let{payload:{callback:t}}=e,n=ii(e.payload,TS);yield ji(za.setSecurityPolicyLockoutState({saving:!0,error:null})),yield It();const a=$({},tg,n,{id:n.id?n.id:tg.id});null==t||t(a),yield ji(za.setSecurityPolicyLockoutState({policy:a,saving:!1}))}function*JS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyLockoutState({policy:tg,loading:!1}))}function*YS(){yield ji(za.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyPasswordHistoryState({policy:ng,loading:!1}))}function*XS(){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorPasswordHistoryState({policy:ng,loading:!1}))}function*QS(e){let{payload:{callback:t}}=e,n=ii(e.payload,ES);yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield It();const a=$({},ng,n,{id:n.id?n.id:ng.id});null==t||t(a),yield ji(za.setSecurityPolicyPasswordHistoryState({policy:a,saving:!1}))}function*ZS(){yield Bo(za.loadSecurityPolicy,jS),yield Vo(za.loadPublicSecurityPolicy,VS),yield Vo(za.saveSecurityPolicyMfa,zS),yield Vo(za.loadSecurityPolicyMfa,BS),yield Vo(za.loadSecurityPolicyVendorMfa,WS),yield Vo(za.saveSecurityPolicyLockout,qS),yield Vo(za.loadSecurityPolicyLockout,KS),yield Vo(za.loadSecurityPolicyVendorLockout,HS),yield Vo(za.loadSecurityPolicyCaptcha,JS),yield Vo(za.saveSecurityPolicyPasswordHistory,QS),yield Vo(za.loadSecurityPolicyPasswordHistory,YS),yield Vo(za.loadSecurityPolicyVendorPasswordHistory,XS)}const ev=["phoneNumber"],tv=["events","url"];function*nv(){yield ji(za.setSignUpState({loading:!0}));try{const e=yield zi(Ip.auth.getVendorConfig),t=yield kS(e),{allowSignups:n,allowNotVerifiedUsersLogin:a}=e;yield ji(za.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:a,firstLoad:!1})),yield ji(za.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield ji(za.setSignUpState({loading:!1,error:jg(e),firstLoad:!1}))}}function*av(e){let{payload:{events:t,url:n}}=e,a=ii(e.payload,tv);yield ji(za.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield qi((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:d,tenants:u=[],activeTenant:y}=yield zi(Ip.auth.signUpUser,(o=a,ii(o,ev)));if(!a.invitationToken){var i;const{email:e,name:o,companyName:r,phoneNumber:s}=a,l={email:e,name:o,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:Dg.PASSWORD,id:d,tenantId:c,createdAt:new Date};null==t||null==(i=t.signUpComplete)||i.call(t,l),Wg(Bg.SIGNUP_COMPLETED,l)}if(!s&&l&&Gg(l)){const t=yield Vg(l);yield ji(za.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield qi((e=>e.auth));yield ji(za.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield ji(za.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:$({},e,{tenants:u,activeTenant:y})}))}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setSignUpState({loading:!1,error:jg(e)}))}var o;yield ji(za.setSignUpState({loading:!1}))}function*iv(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield qi((e=>e.auth.signUpState));yield ji(za.resetSignUpState()),yield ji(za.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*ov(){yield Bo(za.signUpUser,av),yield Bo(za.resetSignUpStateSoft,iv)}const rv={setVendorState:(e,{payload:t})=>$({},e,t)},sv={loadVendorPublicInfo:ft("vendor/loadVendorPublicInfo")},lv={loading:!1},{reducer:cv,actions:dv}=gt({name:Gt,initialState:lv,reducers:$({},rv)}),uv=$({},dv,sv);function*yv(){yield ji(uv.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1,name:t,logo:n}=yield Ip.vendor.getVendorPublicInfo();yield ji(uv.setVendorState({whiteLabelMode:e,name:t,logo:n,loading:!1}))}catch(e){yield ji(uv.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var fv=n(9378),pv=n.n(fv);function gv(e,t){return pv()(e,t)}function*Sv({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield zi(Ip.entitlements.loadEntitlementsV2);yield function*(e){gv(yield qi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield ji(za.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*vv(){yield Bo(za.loadEntitlements,Sv)}const hv=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,a;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(a=n.FronteggNativeBridge)||a.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var i;null==(i=window.FronteggNativeBridge)||i.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,a;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(a=n.FronteggNativeBridge)||a.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var i;null==(i=window.FronteggNativeBridge)||i.loginWithSocialLogin(e)}},this.promptSocialLoginConsent=()=>{var e,t;return null!=(e=null==(t=window.FronteggNativeBridgeFunctions)?void 0:t.shouldPromptSocialLoginConsent)&&e}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isSocialLoginAvailable(){return this.isAvailable("loginWithSocialLogin")}isLoginWithSSOAvailable(){return this.isAvailable("loginWithSSO")}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*mv(){const{publicAuthStrategyPolicy:e}=yield qi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===Ks.Passkeys)))})(t),a="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[o]=yield zi(zp,["show-passkeys-new"]);if(!o||!n||a||i)return!1;{const{devices:e}=yield zi(Ip.auth.getWebAuthnDevices);return yield ji(za.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*bv({user:e,tenants:t=[],activeTenant:n},a={}){const{tenantsState:i}=yield qi((e=>e.auth));yield ji(za.setState($({user:e,tenantsState:$({},i,{tenants:t,activeTenant:n,loading:!1})},a)))}const Av="http://schemas.openid.net/pape/policies/2007/06/multi-factor",Tv=["otp","sms","hwk"],Ev="SHOULD_STEP_UP",Iv=(e,{maxAge:t}={})=>{if(!e)return!1;const{amr:n=[],acr:a="",auth_time:i}=e;if(t&&i&&!(Date.now()/1e3-i<=t))return!1;const o=a===Av,r=-1!==n.indexOf("mfa"),s=void 0!==Tv.find((e=>n.indexOf(e)));return o&&r&&s};function kv(){const e=window.location.pathname+window.location.search;window.localStorage.setItem(Rt,e)}function*Ov({customLoginAuthenticatedUrl:e,preventRedirectUrlOriginCleaning:t}){const{routes:n,includeQueryParam:a,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield qi((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=Ng(e);return n?t+n:t})(e);const{authenticatedUrl:r,loginUrl:s,logoutUrl:l,socialLoginCallbackUrl:c,activateUrl:d}=n;let u=window.localStorage.getItem(Rt);u&&![s,l,c,d].includes(u)||(u=r);const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:a})=>{let i=e;const o=new URL(window.location.href).searchParams.get("redirectUrl");return o?t&&Cg(o)?((e,t)=>{const n=new URL(window.location.href),a=new URL(e),i=a.origin===n.origin;return t.includes(a.origin)||i})(o,n)?i=o:console.warn("The redirect url param is not valid, the origin is a different site"):i=o:a&&(i+=window.location.search),i})({authenticatedUrl:u,includeQueryParam:a,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});return t?y:(f=y).startsWith(null==(p=window)?void 0:p.location.origin)?f.replace(null==(g=window)?void 0:g.location.origin,""):f;var f,p,g}function*Pv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:a,preventRedirectUrlOriginCleaning:i=!1}={}){const o=Wo.onRedirectTo;let r;if(n)r=n;else{var s;if(a){const e=window.localStorage.getItem(Rt);e&&!Cg(e)&&(r=e)}r||(r=yield zi(Ov,{customLoginAuthenticatedUrl:t,preventRedirectUrlOriginCleaning:i})),null==(s=window)||s.localStorage.removeItem(Rt)}yield Ji(200),ji(e()),o(r,{refresh:r.startsWith("http")})}function*_v(e){var t,n;const{routes:{customLoginAuthenticatedUrl:a,stepUpUrl:i}}=yield qi((e=>e.auth)),o=null==(t=window)?void 0:t.localStorage.getItem(Ev),r=yield qi((({auth:e})=>e.user));var s;if(o&&(null==(s=window)||s.localStorage.removeItem(Ev)),i&&o&&!Iv(r))return void(yield zi(Pv,za.resetLoginState,{forceStepUpUrl:i}));let l=a;a||(yield zi(Xg),l=yield qi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield zi(Pv,za.resetLoginState,{customLoginAuthenticatedUrl:l,shouldStepUpDuringLogin:!!o,preventRedirectUrlOriginCleaning:null!=(n=null==e?void 0:e.preventRedirectUrlOriginCleaning)&&n})}function*Lv(){yield zi(Pv,za.resetStepUpState)}const wv=["callback"];function*Uv(e,t,n){const{loginState:a}=yield qi((e=>e.auth));let i={};if(!n){const t=a.flow===wt.Login?Lt.success:a.step;i={loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return $({},i,{isAuthenticated:t})}function*Dv(e,t){const{loginState:n}=yield qi((e=>e.auth));if(n.flow!==wt.Login)return;const[a]=yield zi(zp,["security-center-show-login-flows"]);a&&n.isBreachedPassword&&!e?yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1})):(yield zi(mv))?yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})):yield _v(),null==t||t(!0)}function*Rv(e){yield Lv(),null==e||e(!0)}function*Cv(e,t,n){let{callback:a}=e,i=ii(e,wv);yield ji(t({loading:!0,error:void 0}));try{const{user:e,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.loginWithMfaV2,i),s=!!e.accessToken,l=yield zi(Uv,o,s,n);if(yield zi(bv,{user:e,tenants:o,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield ji(t({loading:!1,error:void 0})),n)return void(yield zi(Rv,a));yield zi(Dv,s,a)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(!1,e)}}function*Nv({payload:e}){yield Cv(e,za.setLoginState,!1)}function*Mv(){yield zi(Lv)}function*Fv(e){const{loginState:t}=yield qi((e=>e.auth)),{step:n}=yield qi((e=>e.auth.mfaState)),[a]=yield zi(zp,["security-center-show-login-flows"]);if(t.flow===wt.Login)if(a&&t.isBreachedPassword&&!e)yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1}));else{const e=yield zi(mv);n===un.smsVerifyCode&&e?yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})):yield _v()}}function*Gv({user:e,tenants:t,activeTenant:n},a=!1){yield ji(za.setUser(e)),yield ji(za.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const i=!!e.accessToken;yield ji(za.setState({isAuthenticated:i})),a?yield zi(Mv):yield zi(Fv,i)}const $v=["callback","deviceId"],xv=["callback","deviceId"];function*Vv(e,t){let{callback:n,deviceId:a}=e,i=ii(e,$v);yield ji(t({loading:!1,error:void 0}));try{const e=yield zi(Ip.auth.preVerifyMFASMSForLogin,a,i);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*jv(e,t,n=!1){let{callback:a,deviceId:i}=e,o=ii(e,xv);yield ji(t({loading:!0}));try{const e=yield zi(Ip.auth.verifyMFASMSForLoginV2,i,o);yield Gv(e,n),yield ji(t({loading:!1,error:void 0})),null==a||a(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(null)}}function*Bv({payload:e}){yield Vv(e,za.setLoginState)}function*Wv({payload:e}){yield jv(e,za.setLoginState,!1)}const zv=["callback","deviceId"],Kv=["callback","deviceId"];function*Hv(e,t){let{callback:n,deviceId:a}=e,i=ii(e,zv);yield ji(t({loading:!0}));try{var o;const e=yield zi(Ip.auth.preVerifyMFAWebAuthnForLogin,a,i),r=$({},e.options,{challenge:Pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*qv(e,t,n){let{callback:a,deviceId:i}=e,o=ii(e,Kv);yield ji(t({loading:!0}));try{const e=_t(o.publicKey),r=yield zi(Ip.auth.verifyMFAWebAuthnForLoginV2,i,$({},o,{options:e}));yield Gv(r,n),yield ji(t({loading:!1,error:void 0})),null==a||a(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(null)}}function*Jv({payload:e}){yield Hv(e,za.setLoginState)}function*Yv({payload:e}){yield qv(e,za.setLoginState,!1)}const Xv=["callback"],Qv=["callback"];function*Zv(e,t){let{callback:n}=e,a=ii(e,Xv);yield ji(t({loading:!0,error:void 0}));try{const e=yield zi(Ip.auth.preVerifyMFAEmailCode,a);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({error:jg(e)})),null==n||n(null)}}function*eh(e,t){let{callback:n}=e,a=ii(e,Qv);yield ji(t({loading:!0}));try{const e=yield zi(Ip.auth.verifyMFAEmailCodeV2,a);yield Gv(e),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*th({payload:e}){yield Zv(e,za.setLoginState)}function*nh({payload:e}){yield eh(e,za.setLoginState)}const ah=["callback"],ih=["callback"],oh=["callback"],rh=["callback"],sh=["callback","events"],lh=["callback"],ch=["callback"],dh=["callback"],uh=["callback"],yh=["user"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=["callback"],vh=["callback"];function*hh(e){const t=yield qi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return gv(t,null==e?void 0:e.entitlements)?$({},e,{entitlements:t}):e}function*mh(){let e;try{var t;const n=yield zi(Ip.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ji(za.setState({ssoACS:e}))}function*bh(){try{const{isActive:e}=yield zi(Ip.auth.getSSOPublicConfiguration);yield ji(za.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Ah(e){var t;const{routes:n,loginState:a}=yield qi((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:a.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Th(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield zi(Eh):yield zi(kh)}function*Eh(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Wo.setAccessToken(null),Wo.setUser(null),void(yield ji(za.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield zi(Ip.auth.exchangeOAuthTokensV2,t),a=yield zi(hh,n.user);yield zi(bv,$({},n,{user:a}),{isAuthenticated:!0})}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:null,isAuthenticated:!1}))}}function*Ih(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Wo.setAccessToken(null),Wo.setUser(null),void(yield ji(za.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield zi(Ip.auth.exchangeOAuthTokensV2,t),a=yield zi(hh,n.user);yield zi(bv,$({},n,{user:a}),{isAuthenticated:!0})}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:null,isAuthenticated:!1}))}}function*kh(){try{const t=Wo.onRedirectTo,{routes:n,loginState:a}=yield qi((e=>e.auth)),{user:i,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.refreshTokenV3);if(Gg(i)){const e=yield Vg(i);yield ji(za.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:a.quickLoginToRegister,n=yield Ah(i),s=yield zi(hh,i);yield zi(bv,{user:s,tenants:o,activeTenant:r},{loginState:$({},a,{quickLoginToRegister:t,flow:n?wt.RegisterQuickLogin:wt.Login}),isAuthenticated:!0}),yield Ph(n)}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:void 0,isAuthenticated:!1}))}}function*Oh(){try{const t=Wo.onRedirectTo,{routes:n,loginState:a}=yield qi((e=>e.auth)),{user:i,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.refreshTokenV3);if(Gg(i)){const e=yield Vg(i);yield ji(za.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield zi(hh,i);if(yield zi(mv))yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),yield zi(bv,{user:s,tenants:o,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:a.quickLoginToRegister,n=yield Ah(i);yield zi(bv,{user:s,tenants:o,activeTenant:r},{loginState:$({},a,{quickLoginToRegister:t,flow:n?wt.RegisterQuickLogin:wt.Login}),isAuthenticated:!0}),yield Ph(n)}}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:void 0,isAuthenticated:!1}))}}function*Ph(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),a=Wo.onRedirectTo,{routes:i,loginState:o}=yield qi((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||s.push(i.loginUrl,i.signUpUrl),e?a(i.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?a(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield _v())}function*_h({payload:{callback:e}}){try{const{ip:t}=yield zi(Ip.metadata.getCurrentUserIpMetadata);yield ji(za.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Lh({payload:e}){const t=[],n=[];t.push(zi(Th)),e&&(yield ji(za.setState({isLoading:!0})),yield ji(za.loadSocialLoginsConfigurationV2()),t.push(zi(nv)),t.push(zi(_S)),t.push(zi(bh)),t.push(zi(yv)),t.push(zi(mh)),n.push(zi(Xg))),yield Bi(t),n.length>0&&(yield Bi(n)),yield ji(za.setState({isLoading:!1}))}function*wh({accessToken:e,user:t}){if(!e)return void(yield ji(za.setState({user:void 0,isAuthenticated:!1})));const n=Wo.onRedirectTo,{routes:a}=yield qi((e=>e.auth));if(Gg(t)){const e=yield Vg(t);yield ji(za.setState(e)),n(a.loginUrl,{preserveQueryParams:!0})}}function*Uh({payload:e}){const t=[];yield ji(za.loadSocialLoginsConfigurationV2()),t.push(zi(nv)),t.push(zi(bh)),t.push(zi(yv)),t.push(zi(mh)),t.push(zi(wh,e)),t.push(zi(Xg)),yield Bi(t)}const Dh=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}};function*Rh(){const e=yield zi(Ip.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield zi(bv,e,{isAuthenticated:!0,isLoading:!1})}function*Ch({payload:e}){var t;null==(t=localStorage)||t.removeItem(Ev);const{disableSilentRefresh:n}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(n)throw new Error("silent refresh is disabled");yield Rh()}catch(t){yield Mh(e)}else yield Mh(e)}function*Nh({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:a}}){var i,o;if(null==(i=localStorage)||i.removeItem(Ev),n){const{urlStrategy:e}=yield qi((e=>({urlStrategy:e.root.urlStrategy}))),t=Dh(e);if(yield ji(za.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:r}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(a&&((e=e||{}).login_direct_action=btoa(JSON.stringify(a))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(r)throw new Error("silent refresh is disabled");yield Rh()}catch(n){if(!t)return void(yield ji(za.setState({isLoading:!1})));yield Mh(e)}else yield Mh(e)}function*Mh(e){const{routes:t,context:n,onRedirectTo:a,urlStrategy:i}=yield qi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(Dh(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ji(za.setState({isLoading:!0}));const o=Bp(),r=Bp(),s=yield zi(jp,r);localStorage.setItem(Ct,r);let l=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield zi(Xg);const c=yield qi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const d=`${Cr(n,"/oauth/authorize")}/oauth/authorize`,u=$({response_type:"code",client_id:n.appId||n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:o},e);if(null==e||!e.organization){const e=yield zi(Yg);e&&(u.organization=e)}const y=Mg(Fg);y&&(u.tenantId=y),a(`${d}?${new URLSearchParams(u).toString()}`,{refresh:!0})}function*Fh({payload:e}){const t=localStorage.getItem(Ct)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:a}=yield qi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===a?"":"#"}${n.hostedLoginRedirectUrl}`;yield zi(Xg);const o=yield qi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));o&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=o);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield zi(Ip.auth.exchangeOAuthTokensV2,r);yield zi(bv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield ji(za.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{const e=yield qi((({auth:e})=>e.user)),t=window.localStorage.getItem(Ev);window.localStorage.removeItem(Ev),t&&Iv(e)?yield Lv():yield _v()}}function*Gh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ah);try{yield ji(za.setLoginState({loading:!0}));const e=yield zi(Ip.auth.changePhoneNumberWithVerification,n);yield ji(za.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Lt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1}))}}function*$h(e){let{payload:{callback:t}}=e,n=ii(e.payload,ih);try{yield ji(za.setLoginState({loading:!0})),yield zi(Ip.auth.verifyChangePhoneNumber,n),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1}))}}function*xh(e){let{payload:{callback:t}}=e,n=ii(e.payload,oh);try{yield ji(za.setLoginState({loading:!0}));const e=yield zi(Ip.auth.passwordlessPreLogin,$({},n,{type:Oa.SmsCode}));yield ji(za.setLoginState({step:Lt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1})),null==t||t(e)}}function*Vh(e){let{payload:{callback:t}}=e,n=ii(e.payload,rh);try{let e;yield ji(za.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const a=yield zi(Ip.auth.passwordlessPreLogin,n),i=_a[n.type];yield ji(za.setLoginState({step:i,loading:!1,phoneNumber:null==a?void 0:a.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1})),null==t||t()}}function*jh(e){let{payload:{callback:t,events:n}}=e,a=ii(e.payload,sh);try{yield ji(za.setLoginState({loading:!0}));const{user:e,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.passwordlessPostLoginV2,a),s=Wo.onRedirectTo,{routes:l}=yield qi((e=>e.auth));if(Gg(e)){const t=yield Vg(e);yield ji(za.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:a}=yield qi((e=>e.auth));if(e.emailVerified){var i;const t={email:e.email,origin:Ug.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(i=n.userVerified)||i.call(n,t),Wg(Bg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield zi(bv,{user:e,tenants:o,activeTenant:r}),yield ji(za.setLoginState({error:void 0})),yield ji(za.setState({isLoading:!1})),a.flow===wt.Login?(yield zi(mv))?(yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield ji(za.setState({isAuthenticated:!0})),yield _v()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield ji(za.setLoginState({error:jg(e,"Failed to authenticate")}))}finally{yield ji(za.setLoginState({loading:!1}))}}function*Bh({payload:e}){try{yield ji(za.setLoginState({loading:!0}));const{name:t}=yield zi(Ip.auth.verifyInviteToken,e);yield ji(za.setLoginState({inviteTokenTenantName:t}))}catch(e){yield ji(za.setLoginState({inviteTokenError:jg(e,"We couldn't verify your invitation")}))}finally{yield ji(za.setLoginState({loading:!1}))}}function*Wh({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:a}}){yield ji(za.setLoginState({loading:!0}));try{const i=yield qi((({auth:{onRedirectTo:e}})=>e)),o=Mg(Fg),{address:r,idpType:s}=yield zi(Ip.auth.preLoginV2,{email:e,tenantId:o});if(r){let t=r;if(s===Pp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield qi((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}hv.isLoginWithSSOAvailable()?(hv.loginWithSSO(e),yield ji(za.setLoginState({loading:!1})),null==a||a()):(yield ji(za.setLoginState({step:Lt.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{i(t,{refresh:!0})}),2e3))}else yield zh({email:e,recaptchaToken:t,callback:a,invitationToken:n})}catch(i){yield zh({email:e,recaptchaToken:t,callback:a,invitationToken:n})}}function*zh(e){let{callback:t}=e,n=ii(e,lh);const a=yield qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==a||!a.authStrategy)return yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),void(null==t||t());(null==a?void 0:a.authStrategy)===Oa.EmailAndPassword?(yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),null==t||t()):[Oa.MagicLink,Oa.Code,Oa.SmsCode].includes(null==a?void 0:a.authStrategy)?yield ji(za.passwordlessPreLogin($({},n,{type:null==a?void 0:a.authStrategy,callback:t}))):(yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),null==t||t())}function*Kh({payload:{callback:e}}){try{yield ji(za.setLoginState({loading:!0}));const{options:t}=yield zi(Ip.auth.webAuthnCreateNewDeviceSession);t.user.id=Pt(t.user.id),t.challenge=Pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ji(za.setLoginState({error:jg(t)})),null==e||e(null)}finally{yield ji(za.setLoginState({loading:!1}))}}function*Hh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ch);try{yield ji(za.setLoginState({loading:!0}));const e=_t(n.publicKey),a="platform"===(null==e?void 0:e.authenticatorAttachment)?Hs.Platform:Hs.CrossPlatform;yield zi(Ip.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:a}),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setLoginState({loading:!1}))}}function*qh(e){let{payload:{callback:t}}=e,n=ii(e.payload,dh);try{var a;yield ji(za.setPasskeysState({loading:!0})),yield ji(za.setLoginState({loading:!0}));const{options:e}=yield zi(Ip.auth.webAuthnPreLogin,n);e.challenge=Pt(e.challenge),e.allowCredentials=null==(a=e.allowCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)}))),yield ji(za.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setPasskeysState({loading:!1})),yield ji(za.setLoginState({loading:!1}))}}function*Jh(e){let{payload:{callback:t}}=e,n=ii(e.payload,uh);try{var a;yield ji(za.setPasskeysState({loading:!0})),yield ji(za.setLoginState({loading:!0}));const e=_t(n.publicKey),i=yield zi(Ip.auth.webAuthnPostLoginV2,$({},e,{response:$({},e.response,{userHandle:null!=(a=e.response.userHandle)?a:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:o}=i,r=ii(i,yh);if(Gg(o)){const e=Wo.onRedirectTo,{routes:t}=yield qi((e=>e.auth)),n=yield Vg(o);yield ji(za.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else o.id&&localStorage.setItem("userId",o.id),yield zi(bv,$({user:o},r),{isAuthenticated:!0}),yield ji(za.setLoginState({error:void 0})),yield _v(),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setPasskeysState({loading:!1})),yield ji(za.setLoginState({loading:!1}))}}function*Yh({payload:e}){const{onRedirectTo:t,routes:n}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(za.setLoginState({loading:!0}));try{const t=yield zi(Ip.auth.postLogin,e);yield ji(za.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield _v()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ji(za.setLoginState({step:Lt.loginWithSSOFailed,loading:!1}))}}function*Xh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:a,callback:i}}){yield ji(za.setLoginState({loading:!0}));try{const{user:o,tenants:r=[],activeTenant:s}=yield zi(Ip.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:a}),l=Wo.onRedirectTo,{routes:c}=yield qi((e=>e.auth));if(Gg(o)){const e=yield Vg(o);yield ji(za.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield qi((e=>e.auth)),n=!!o.accessToken;o.id&&localStorage.setItem("userId",o.id),yield zi(bv,{user:o,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:o.mfaToken,step:t.flow===wt.Login?Lt.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:o.isBreachedPassword},isAuthenticated:n});const[a]=yield zi(zp,["security-center-show-login-flows"]);t.flow===wt.Login&&(a&&o.isBreachedPassword&&!n?yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1})):n&&((yield zi(mv))?(yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield _v()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Wo.setAccessToken(null),Wo.setUser(null),null==i||i(!1,t),yield ji(za.setLoginState({email:e,error:jg(t),loading:!1}))}}function*Qh({payload:e}){yield ji(za.setLoginState({loading:!0}));try{var t;yield zi(Ip.auth.recoverMfaToken,e),yield ji(za.setLoginState({loading:!1,error:void 0,step:Lt.preLogin})),yield ji(za.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setLoginState({error:jg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Zh({payload:e}){const{hostedLoginBox:t}=yield qi((e=>e.auth));yield ji(za.setState({isLoading:!0}));try{t?yield zi(Ip.auth.OAuthLogout):yield zi(Ip.auth.logout)}catch{}Wo.isSessionPerTenantEnabled()&&os(),yield ji(za.resetState()),yield ji(za.requestAuthorize(!0)),null==e||e()}function*em({payload:e}){var t;try{yield zi(Ip.auth.logout)}catch{}Wo.isSessionPerTenantEnabled()&&os(),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*tm({user:e,tenants:t,activeTenant:n}){const a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(a.recoveryCode=e.recoveryCode),yield ji(za.setMfaState(a)),yield ji(za.setUser(e)),yield ji(za.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*nm(e){let{payload:{callback:t}}=e,n=ii(e.payload,fh);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.preEnrollMFASMSForLogin,n);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*am(e){let{payload:{callback:t}}=e,n=ii(e.payload,ph);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.enrollMFASMSForLoginV2,n);yield tm(e),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*im(e){let{payload:{callback:t}}=e,n=ii(e.payload,gh);yield ji(za.setLoginState({loading:!0}));try{var a;const e=yield zi(Ip.auth.preEnrollMFAWebAuthnForLogin,n),i=$({},e.options,{challenge:Pt(e.options.challenge),user:$({},e.options.user,{id:Pt(e.options.user.id)}),excludeCredentials:null==(a=e.options.excludeCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*om(e){let{payload:{callback:t}}=e,n=ii(e.payload,Sh);yield ji(za.setLoginState({loading:!0}));try{const e=_t(n.publicKey),a=yield zi(Ip.auth.enrollMFAWebAuthnForLoginV2,$({},n,{options:e}));yield tm(a),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*rm(e){let{payload:{callback:t}}=e,n=ii(e.payload,vh);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield tm(e),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*sm({payload:e}){yield ji(za.setLoginState({loading:!0}));try{yield zi(Ip.auth.forgotPassword,e),yield ji(za.setLoginState({loading:!1,error:void 0,step:Lt.breachedPasswordSuccess})),yield ji(za.setState({isAuthenticated:!1}))}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)}))}}function*lm(){yield Bo(za.requestAuthorize,Lh),yield Bo(za.requestAuthorizeSSR,Uh),yield Bo(za.requestHostedLoginAuthorize,Ch),yield Bo(za.requestHostedLoginAuthorizeV2,Nh),yield Bo(za.handleHostedLoginCallback,Fh),yield Bo(za.preLogin,Wh),yield Bo(za.postLogin,Yh),yield Bo(za.login,Xh),yield Bo(za.logout,Zh),yield Bo(za.silentLogout,em),yield Bo(za.loginWithMfa,Nv),yield Bo(za.recoverMfa,Qh),yield Bo(za.quickSmsPasswordlessPreLogin,xh),yield Bo(za.changePhoneNumberWithVerification,Gh),yield Bo(za.verifyChangePhoneNumber,$h),yield Bo(za.passwordlessPreLogin,Vh),yield Bo(za.passwordlessPostLogin,jh),yield Bo(za.verifyInviteToken,Bh),yield Bo(za.webAuthnPrelogin,qh),yield Bo(za.webAuthnPostLogin,Jh),yield Bo(za.webAuthnCreateNewDeviceSession,Kh),yield Bo(za.webAuthnVerifyNewDeviceSession,Hh),yield Bo(za.afterAuthNavigation,_v),yield Bo(za.getUserIP,_h),yield Bo(za.preEnrollMFASMSForLogin,nm),yield Bo(za.enrollMFASMSForLogin,am),yield Bo(za.preEnrollMFAWebAuthnForLogin,im),yield Bo(za.enrollMFAWebAuthnForLogin,om),yield Bo(za.enrollMFAAuthenticatorAppForLogin,rm),yield Bo(za.preVerifyMFASMSForLogin,Bv),yield Bo(za.verifyMFASMSForLogin,Wv),yield Bo(za.preVerifyMFAWebAuthnForLogin,Jv),yield Bo(za.verifyMFAWebAuthnForLogin,Yv),yield Bo(za.preVerifyMFAEmailCode,th),yield Bo(za.verifyMFAEmailCode,nh),yield Bo(za.resetBreachedPassword,sm)}function*cm({payload:e}){e&&(yield ji(za.setState({isLoading:!0})));const t=Yp;yield ji(za.loadTenants()),yield ji(za.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*dm({payload:{callback:e}}){try{const{ip:t}=bg[0];yield ji(za.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*um(){yield Bo(za.requestAuthorize,cm),yield Bo(za.afterAuthNavigation,_v),yield Bo(za.getUserIP,dm)}const ym=["callback","samlVendor"],fm=["callback","samlVendor"];function*pm(){try{var e,t;yield ji(za.setSSOState({loading:!0}));const n=yield zi(Ip.auth.getSamlConfiguration),a=yield zi(Ip.auth.getOidcConfiguration),i=yield zi(Ip.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield ji(za.setSSOState({samlConfiguration:n,oidcConfiguration:a,loading:!1,firstLoad:!1}))}catch(e){yield ji(za.setSSOState({error:jg(e),loading:!1}))}}function*gm({payload:e}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ji(za.setSSOState({error:void 0,[n]:!0}));try{const a=yield Wp(e[0]),i=yield zi(Ip.auth.updateSamlVendorMetadata,{metadata:a});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ji(za.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ji(za.setSSOState({samlConfiguration:t,error:jg(e),[n]:!1}))}}function*Sm({payload:e}){const{configFile:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ji(za.setSSOState({error:void 0,[i]:!0}));try{const e=yield Wp(t),o=yield zi(Ip.auth.updateSamlVendorMetadata,{metadata:e});o.isSamlActive=null==a?void 0:a.isSamlActive,yield ji(za.setSSOState({samlConfiguration:o,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ji(za.setSSOState({samlConfiguration:a,error:jg(e),[i]:!1})),null==n||n(null,e)}}function*vm({payload:e}){const{callback:t,samlVendor:n}=e,a=ii(e,ym),i=yield qi((e=>e.auth.ssoState.samlConfiguration)),o=$({},i,a);let r="saving";(null==o?void 0:o.enabled)!==i.enabled&&(r="loading");try{if(null==o||!o.domain)return void(yield ji(za.setSSOState({samlConfiguration:$({},i,o)})));if(yield ji(za.setSSOState({error:void 0,[r]:!0})),e.type===Pp.Saml){var s,l;const e=yield zi(Ip.metadata.getSamlMetadata);o.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,o.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const a=Vp(o,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==a?void 0:a.domain)&&(a.ssoEndpoint="",a.publicCertificate="",a.signRequest=!1),a.type=null==n?void 0:n.toLowerCase();const c=yield zi(Ip.auth.updateSamlConfiguration,a);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ji(za.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ji(za.setSSOState({samlConfiguration:i,error:jg(e),[r]:!1})),null==t||t(null,e)}}function*hm({payload:{callback:e}={}}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration));try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.validateSamlDomain),yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!1}),error:jg(n),saving:!1})),null==e||e(null,n)}}function*mm(){try{const e=yield zi(Ip.auth.getSamlRoles),t=yield zi(Ip.auth.getSamlRolesGroups);yield ji(za.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ji(za.setSSOState({error:jg(e)}))}}function*bm({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Bi(e.map((e=>zi(Ip.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ji(za.setSSOState({error:jg(e)}))}}(n)),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setSSOState({error:jg(t),saving:!1})),null==e||e(null,t)}}function*Am({payload:{callback:e,id:t}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.deleteSamlGroup,{id:t}),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setSSOState({error:jg(t),saving:!1})),null==e||e(null,t)}}function*Tm({payload:{group:e,roleIds:t,callback:n}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.createSamlGroup,{group:e,roleIds:t}),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ji(za.setSSOState({error:jg(e),saving:!1})),null==n||n(null,e)}}function*Em({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ji(za.setSSOState({loading:!0})),yield zi(Ip.auth.oidcPostLoginV2,t),yield zi(Th),yield ji(za.setSSOState({loading:!1}))}catch(e){yield ji(za.setSSOState({loading:!1,error:jg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Im(){yield Vo(za.loadSSOConfigurations,pm),yield Vo(za.saveSSOConfigurations,vm),yield Vo(za.saveSSOConfigurationsFile,gm),yield Vo(za.saveSSOConfigurationsFileWithCallback,Sm),yield Vo(za.validateSSODomain,hm),yield Vo(za.loadSSOAuthorizationRoles,mm),yield Vo(za.updateSSOAuthorizationRoles,bm),yield Vo(za.deleteSamlGroup,Am),yield Vo(za.createSamlGroup,Tm),yield Vo(za.oidcPostlogin,Em)}function*km(){yield ji(za.setSSOState({loading:!0})),yield It(),yield ji(za.setSSOState({samlConfiguration:ag,loading:!1,firstLoad:!1}))}function*Om({payload:e}){const t="saving";yield ji(za.setSSOState({error:void 0,[t]:!0}));const n=$({},yield qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ji(za.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Pm({payload:e}){var t,n;const{callback:a,samlVendor:i}=e,o=ii(e,fm),r=rg.samlConfiguration,s=$({},r,o);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield ji(za.setSSOState({samlConfiguration:$({},r,s)})));yield ji(za.setSSOState({error:void 0,[l]:!0})),yield It(),s.acsUrl=null==ig||null==(t=ig.configuration)?void 0:t.acsUrl,s.spEntityId=null==ig||null==(n=ig.configuration)?void 0:n.spEntityId;const c=Vp(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield It(),yield ji(za.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==a||a(!0)}function*_m({payload:{callback:e}={}}){const t=rg.samlConfiguration;yield ji(za.setSSOState({error:void 0,saving:!0})),yield It(),yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Lm(){yield It(),yield ji(za.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*wm({payload:{callback:e,authorizationRoles:t}}){yield ji(za.setSSOState({error:void 0,saving:!0})),yield It(),yield ji(za.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Um(){yield Vo(za.loadSSOConfigurations,km),yield Vo(za.saveSSOConfigurations,Pm),yield Vo(za.saveSSOConfigurationsFile,Om),yield Vo(za.validateSSODomain,_m),yield Vo(za.loadSSOAuthorizationRoles,Lm),yield Vo(za.updateSSOAuthorizationRoles,wm)}const Dm=["callback"],Rm=["callback","ssoConfigId"],Cm=["callback","ssoConfigId"],Nm=["callback","ssoConfigId"];function*Mm(){try{return yield zi(Ip.auth.getOidcConfiguration)}catch(e){return null}}function*Fm(){try{return yield zi(Ip.metadata.getSamlMetadata)}catch(e){return null}}function*Gm(){try{yield ji(za.setSSOLoader({key:Op.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Bi([zi(Mm),zi(Fm)]),n=yield zi(Ip.auth.getSSOConfigurations);yield ji(za.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ji(za.setSSOError({key:Op.LOAD_SSO_CONFIGURATIONS,value:jg(e)}))}finally{yield ji(za.setSSOLoader({key:Op.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*$m({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ii(e,Dm),a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield zi(Ip.auth.createSSOConfiguration,$({},n,{enabled:null!=(i=n.enabled)&&i}));yield ji(za.setSSOState({ssoConfigurations:[...a,e]})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!1}))}}function*xm({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Wp(t),i=yield zi(Ip.auth.createSSOConfigurationByMetadata,{metadata:e});yield ji(za.setSSOState({ssoConfigurations:[...a,i]})),null==n||n(i)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Vm({payload:e}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,a=ii(e,Rm),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield zi(Ip.auth.updateSSOConfiguration,n,a),o=i.map((t=>t.id===n?e:t));yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.UPDATE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*jm({payload:e}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:a}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Wp(a),o=yield zi(Ip.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?o:e));yield ji(za.setSSOState({ssoConfigurations:r})),null==t||t(o)}catch(e){yield ji(za.setSSOError({key:Op.UPDATE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Bm({payload:e}){yield ji(za.setSSOLoader({key:Op.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.deleteSSOConfiguration,t),yield ji(za.setSSOState({ssoConfigurations:a.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ji(za.setSSOError({key:Op.DELETE_SSO_CONFIGURATION,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Wm({payload:e}){const{callback:t,ssoConfigId:n}=e,a=ii(e,Cm);yield ji(za.setSSOLoader({key:Op.SAVE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield zi(Ip.auth.createSSODomain,n,a),o=i.map((t=>t.id===n?$({},t,{domains:[...t.domains,e]}):t));yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_DOMAIN,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_DOMAIN,value:!1}))}}function*zm({payload:e}){const{ssoConfigId:t,domainId:n,callback:a}=e;yield ji(za.setSSOLoader({key:Op.DELETE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?$({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ji(za.setSSOState({ssoConfigurations:e})),null==a||a(!0)}catch(e){yield ji(za.setSSOError({key:Op.DELETE_SSO_DOMAIN,value:jg(e)})),null==a||a(null,e)}finally{yield ji(za.setSSOLoader({key:Op.DELETE_SSO_DOMAIN,value:!1}))}}function*Km({payload:e}){const{callback:t,domainId:n,ssoConfigId:a}=e;yield ji(za.setSSOLoader({key:Op.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.validateSSODomainV2,a,n);const e=i.map((e=>e.id===a?$({},e,{domains:e.domains.map((e=>e.id===n?$({},e,{validated:!0}):e))}):e));yield ji(za.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ji(za.setSSOError({key:Op.VALIDATE_SSO_DOMAIN,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Hm({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.setSSODefaultRoles,t,{roleIds:n});const i=a.map((e=>e.id===t?$({},e,{roleIds:n}):e));yield ji(za.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ji(za.setSSOError({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:jg(t)})),null==e||e(null,t)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*qm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:a}}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Bi(t.map((e=>zi(Ip.auth.deleteSSOGroup,n,e)))),yield Bi(e.map((e=>zi(Ip.auth.createSSOGroup,n,e))));const o=yield zi(Ip.auth.getSSOGroups,n),r=i.map((e=>e.id===n?$({},e,{groups:o}):e));yield ji(za.setSSOState({ssoConfigurations:r})),null==a||a(!0)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_GROUPS,value:jg(e)})),null==a||a(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!1}))}}function*Jm({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Bi(t.map((t=>zi(Ip.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_GROUPS,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!1}))}}function*Ym({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:a,callback:i}=e,o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;a?(r=yield zi(Ip.auth.updateSSOConfigurationByMetadataUrl,a,e),s=o.map((e=>e.id===a?r:e))):(r=yield zi(Ip.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...o]),yield ji(za.setSSOState({ssoConfigurations:s})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Xm({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,a=ii(e,Nm),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{let e,o;n?(e=yield zi(Ip.auth.updateSSOConfiguration,n,a),o=i.map((t=>t.id===n?e:t))):(e=yield zi(Ip.auth.createSSOConfiguration,a),o=[e,...i]),yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Qm(){yield Vo(za.loadSSOConfigurationsV2,Gm),yield Vo(za.saveSSOConfigurationV2,$m),yield Vo(za.saveSSODomain,Wm),yield Vo(za.deleteSSODomain,zm),yield Vo(za.validateSSODomainV2,Km),yield Vo(za.updateSSOConfiguration,Vm),yield Vo(za.deleteSSOConfiguration,Bm),yield Vo(za.setSSOGroups,qm),yield Vo(za.updateSSOGroups,Jm),yield Vo(za.setSSODefaultRoles,Hm),yield Vo(za.saveSSOConfigurationByMetadata,xm),yield Vo(za.updateSSOConfigurationByMetadata,jm),yield Vo(za.saveSSOConfigurationByUrl,Ym),yield Vo(za.saveSSOConfigurationByData,Xm)}const Zm=["callback","profilePictureUrl"],eb=["callback","profilePictureUrl"];function*tb(){yield ji(za.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var a=arguments.length,i=new Array(a>3?a-3:0),o=3;o<a;o++)i[o-3]=arguments[o];return zi.apply(void 0,[xo,e,t,n].concat(i))}(3,2e3,Ip.teams.getProfile),t=yield qi((e=>e.auth.user));za.setUser($({},t,e)),yield ji(za.setProfileState({profile:e,loading:!1}))}catch(e){yield ji(za.setProfileState({loading:!1,error:jg(e)}))}}function*nb(e){let{payload:{callback:t,profilePictureUrl:n}}=e,a=ii(e.payload,Zm);yield ji(za.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield qi((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const a=`image/${n[1]}`,i=function(e,t){const n=atob(e),a=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);a.push(new Uint8Array(i))}return new Blob(a,{type:t})}(n[2],a),o=new FormData;return o.append(t,new File([i],t,{type:a})),o}(n,"image");if(e){i=yield zi(Ip.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const o=$({},e,a,{profilePictureUrl:i}),r=yield zi(Ip.users.updateUserProfileV2,o),s=yield qi((e=>e.auth.user));yield ji(za.setUser($({},s,r))),yield ji(za.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(o)}catch(e){yield ji(za.setProfileState({saving:!1,error:jg(e),loading:!1})),null==t||t(null,e)}}function*ab({payload:e}){yield ji(za.setProfileState({loading:!0}));try{var t;yield zi(Ip.teams.changePassword,e),yield ji(za.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setProfileState({loading:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*ib(){yield Bo(za.loadProfile,tb),yield Vo(za.saveProfile,nb),yield Vo(za.changePassword,ab)}function*ob(){yield ji(za.setProfileState({loading:!0})),yield It(),yield ji(za.setUser($({},Yp,Jp))),yield ji(za.setProfileState({loading:!1,profile:Jp}))}function*rb(e){let{payload:{callback:t,profilePictureUrl:n}}=e,a=ii(e.payload,eb);yield ji(za.setProfileState({saving:!0,error:null}));const i=Xp;let o=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(o=n);const r=$({},i.profile,a,{profilePictureUrl:o}),s=Yp;yield It(),yield ji(za.setUser($({},s,r))),yield ji(za.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*sb({payload:e}){var t;yield ji(za.setProfileState({loading:!0})),yield It(),yield ji(za.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*lb(){yield Bo(za.loadProfile,ob),yield Vo(za.saveProfile,rb),yield Vo(za.changePassword,sb)}const cb=["callback"],db=["callback"],ub=["user"],yb=["callback"],fb=["deviceId","callback"],pb=["deviceId","callback"],gb=["callback"],Sb=["deviceId"],vb=["deviceId"],hb=["callback"],mb=["deviceId"],bb=["callback"];function*Ab(e){const{step:t}=yield qi((e=>e.auth.mfaState));return{step:e.recoveryCode?un.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Tb(){yield ji(za.setMfaState({saving:!0}));try{const{qrCode:e}=yield zi(Ip.auth.enrollMfa);yield ji(za.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)}))}}function*Eb(e){let{payload:{callback:t}}=e,n=ii(e.payload,cb);yield ji(za.setMfaState({saving:!0}));try{const e=yield qi((e=>e.auth.user)),a=yield zi(Ip.auth.verifyMfa,n),i=yield zi(Ip.auth.getMFADevices),o=yield Ab(a);yield ji(za.setMfaState($({},o,{mfaDevices:i}))),yield ji(za.setUser($({},e,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*Ib(e){let{payload:{callback:t}}=e,n=ii(e.payload,db);yield ji(za.setMfaState({loading:!0}));try{const e=yield zi(Ip.auth.loginWithMfaV2,n),{user:a}=e,i=ii(e,ub),o={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=a&&a.recoveryCode&&(o.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(o)),yield bv($({user:a},i)),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*kb({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t;yield zi(Ip.auth.disableMfa,e);const n=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setMfaState({saving:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ob({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t,n;const a=yield zi(Ip.auth.preEnrollMFAWebAuthn),i=$({},a.options,{challenge:Pt(a.options.challenge),user:$({},a.options.user,{id:Pt(a.options.user.id)}),excludeCredentials:null==(t=a.options.excludeCredentials)?void 0:t.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:a.webauthnToken})}catch(t){var a;yield ji(za.setMfaState({saving:!1,error:jg(t)})),null==(a=e.callback)||a.call(e,null,t)}}function*Pb(e){let{payload:{callback:t}}=e,n=ii(e.payload,yb);yield ji(za.setMfaState({saving:!0}));try{const e=_t(n.publicKey),a=yield zi(Ip.auth.enrollMFAWebAuthn,$({},n,{options:e})),i=yield zi(Ip.auth.getMFADevices),o=yield Ab(a);yield ji(za.setMfaState($({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*_b(e){let{payload:{deviceId:t,callback:n}}=e;ii(e.payload,fb),yield ji(za.setMfaState({saving:!0}));try{var a;const e=yield zi(Ip.auth.preDisableMFAWebAuthn,t),i=$({},e.options,{challenge:Pt(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==n||n(null,e)}}function*Lb(e){let{payload:{deviceId:t,callback:n}}=e,a=ii(e.payload,pb);yield ji(za.setMfaState({saving:!0}));try{const e=_t(a.publicKey);yield zi(Ip.auth.disableMFAWebAuthn,t,$({},a,{options:e}));const i=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==n||n(!1,e)}}function*wb({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t;const n=yield zi(Ip.auth.preEnrollMFASMS,e);yield ji(za.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 ji(za.setMfaState({saving:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ub(e){let{payload:{callback:t}}=e,n=ii(e.payload,gb);yield ji(za.setMfaState({saving:!0}));try{const e=yield zi(Ip.auth.enrollMFASMS,n),a=yield zi(Ip.auth.getMFADevices),i=yield Ab(e);yield ji(za.setMfaState($({},i,{mfaDevices:a}))),null==t||t(i.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*Db(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,Sb);yield ji(za.setMfaState({saving:!0}));try{var a;const e=yield zi(Ip.auth.preDisableMFASMS,t);yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(a=n.callback)||a.call(n,!0)}catch(e){var i;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Rb(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,vb);yield ji(za.setMfaState({saving:!0}));try{var a;yield zi(Ip.auth.disableMFASMS,t,n);const e=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(a=n.callback)||a.call(n,!0)}catch(e){var i;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Cb(){yield ji(za.setMfaState({loading:!0}));try{yield qi((e=>e.auth.user));const e=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)}))}}function*Nb(){yield ji(za.setMfaState({loading:!0}));try{const e=(yield zi(Ip.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ji(za.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)}))}}function*Mb(){yield Vo(za.enrollMfa,Tb),yield Vo(za.getMFADevices,Cb),yield Vo(za.getMFAStrategies,Nb),yield Vo(za.verifyMfa,Eb),yield Vo(za.disableMfa,kb),yield Vo(za.verifyMfaAfterForce,Ib),yield Vo(za.preDisableMfaSms,Db),yield Vo(za.disableMfaSms,Rb),yield Vo(za.preEnrollMfaSms,wb),yield Vo(za.enrollMfaSms,Ub),yield Vo(za.preEnrollMfaWebAuthn,Ob),yield Vo(za.enrollMfaWebAuthn,Pb),yield Vo(za.preDisableMfaWebAuthn,_b),yield Vo(za.disableMfaWebAuthn,Lb)}function*Fb(){yield ji(za.setMfaState({saving:!0})),yield ji(za.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Gb({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It();const n={token:"token",recoveryCode:"recoveryCode"},a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:$({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(a.recoveryCode=n.recoveryCode),yield ji(za.setMfaState(a)),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==e||e(a.recoveryCode)}function*$b(e){let{payload:{callback:t}}=e,n=ii(e.payload,hb);yield ji(za.setMfaState({loading:!0})),yield It();const a=$({},n,{recoveryCode:"recoveryCode"}),i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=a&&a.recoveryCode&&(i.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(i)),yield It(),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*xb({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:$({},n,{authenticators:[]})})),yield ji(za.setUser($({},Yp))),null==(t=e.callback)||t.call(e,!0)}function*Vb(e){let{}=e,t=ii(e.payload,mb);yield ji(za.setMfaState({saving:!0}));try{var n;yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var a;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(a=t.callback)||a.call(t,!1,e)}}function*jb({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({loading:!1,error:void 0,mfaDevices:$({},n,{phones:[]})})),yield ji(za.setUser($({},Yp))),null==(t=e.callback)||t.call(e,!0)}function*Bb({payload:e}){var t;yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Wb(e){let{payload:{callback:t}}=e;ii(e.payload,bb);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It();const a={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:$({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=a&&a.recoveryCode&&(i.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(i)),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*zb(){yield Vo(za.enrollMfa,Fb),yield Vo(za.verifyMfa,Gb),yield Vo(za.disableMfa,xb),yield Vo(za.verifyMfaAfterForce,$b),yield Vo(za.preDisableMfaSms,Vb),yield Vo(za.disableMfaSms,jb),yield Vo(za.preEnrollMfaSms,Bb),yield Vo(za.enrollMfaSms,Wb)}const Kb=["callback"];function*Hb({payload:e}){yield ji(za.setForgotPasswordState({loading:!0}));try{var t;yield zi(Ip.auth.forgotPassword,e),yield ji(za.setForgotPasswordState({loading:!1,error:void 0,step:Yt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setForgotPasswordState({loading:!1,error:jg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*qb(e){let{payload:{callback:t}}=e,n=ii(e.payload,Kb);yield ji(za.setForgotPasswordState({loading:!0}));try{yield zi(Ip.auth.resetPassword,n),yield ji(za.setForgotPasswordState({loading:!1,error:void 0,step:Yt.success})),null==t||t(!0)}catch(e){yield ji(za.setForgotPasswordState({loading:!1,error:jg(e)})),null==t||t(!1,e)}}function*Jb({payload:e}){yield ji(za.setForgotPasswordState({loading:!0}));try{const t=yield zi(Ip.auth.loadPasswordConfig,e);yield ji(za.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ji(za.setForgotPasswordState({loading:!1,error:jg(e)}))}}function*Yb(){yield Bo(za.forgotPassword,Hb),yield Bo(za.resetPassword,qb),yield Bo(za.loadPasswordConfig,Jb)}let Xb;!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",e.CONFIG_TEMPORARY_USERS="CONFIG_TEMPORARY_USERS",e.UPDATE_USER_EXPIRATION_TIME="UPDATE_USER_EXPIRATION_TIME"}(Xb||(Xb={}));const Qb=["callback","events"],Zb=["user"],eA=["callback"],tA=["callback"];function*nA({payload:{userId:e,token:t}}){yield ji(za.setActivateState({loading:!0,step:jt.activating}));try{const{isAuthenticated:n}=yield qi((e=>e.auth));n&&(yield ji(za.silentLogout()));const a=yield zi(Ip.auth.getActivateAccountStrategy,{userId:e,token:t});yield ji(za.setActivateStrategyState({strategy:a,loading:!1,error:void 0})),a.shouldSetPassword&&(yield ji(za.setActivateState({loading:!1,step:jt.activatingForm})))}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)}))}}function*aA(e){let{payload:{callback:t,events:n}}=e,a=ii(e.payload,Qb);yield ji(za.setActivateState({loading:!0}));try{const e=Wo.onRedirectTo,{routes:o}=yield qi((e=>e.auth)),r=yield zi(Ip.auth.activateAccountV2,a),{user:s}=r,l=ii(r,Zb);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(Gg(s)){yield ji(za.setActivateState({step:jt.success}));const t=yield Vg(s);yield ji(za.setState(t)),yield Ji(1e3),e(o.loginUrl,{preserveQueryParams:!0})}else{var i;yield ji(za.setActivateState({step:jt.success}));const e={email:s.email,origin:Ug.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(i=n.userVerified)||i.call(n,e),Wg(Bg.USER_VERIFIED,e),yield zi(bv,$({user:s},l),{isAuthenticated:!0}),yield Ji(1e3),yield _v(),yield ji(za.resetActivateState())}null==t||t(!0)}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)}))}}function*iA({payload:e}){const{callback:t}=e,n=ii(e,eA);yield ji(za.setActivateStrategyState({loading:!0}));try{const e=yield zi(Ip.auth.getActivateAccountStrategy,n);yield ji(za.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ji(za.setActivateStrategyState({loading:!1,error:jg(e)}))}}function*oA({payload:e}){const{callback:t}=e,n=ii(e,tA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.email})),yield ji(za.setActivateState({loading:!0}));try{yield zi(Ip.auth.resendActivationEmail,n),yield ji(za.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)})),yield ji(za.setTeamError({key:Xb.RESEND_ACTIVATE_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*rA(){yield Bo(za.activateAccount,aA),yield Bo(za.preActivateAccount,nA),yield Bo(za.getActivateAccountStrategy,iA),yield Bo(za.resendActivationEmail,oA)}function*sA({payload:e}){if(e.token&&e.userId)try{yield ji(za.setAcceptInvitationState({error:void 0,step:Kt.pending})),yield zi(Ip.auth.acceptInvitation,e),yield ji(za.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Kt.success}}))}catch(e){yield ji(za.setAcceptInvitationState({step:Kt.failed,error:jg(e)}))}else yield ji(za.setAcceptInvitationState({error:void 0,step:Kt.invalid}))}function*lA(){yield Bo(za.acceptInvitation,sA)}var cA,dA=new Uint8Array(16);function uA(){if(!cA&&!(cA="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 cA(dA)}const yA=/^(?:[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,fA=function(e){return"string"==typeof e&&yA.test(e)};for(var pA=[],gA=0;gA<256;++gA)pA.push((gA+256).toString(16).substr(1));const SA=function(e,t,n){var a=(e=e||{}).random||(e.rng||uA)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=a[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(pA[e[t+0]]+pA[e[t+1]]+pA[e[t+2]]+pA[e[t+3]]+"-"+pA[e[t+4]]+pA[e[t+5]]+"-"+pA[e[t+6]]+pA[e[t+7]]+"-"+pA[e[t+8]]+pA[e[t+9]]+"-"+pA[e[t+10]]+pA[e[t+11]]+pA[e[t+12]]+pA[e[t+13]]+pA[e[t+14]]+pA[e[t+15]]).toLowerCase();if(!fA(n))throw TypeError("Stringified UUID is invalid");return n}(a)};let vA,hA;!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"}(vA||(vA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(hA||(hA={}));const mA=e=>{var t;return null!=(t=e.map((({appIds:e})=>e)).reduce(((e,t)=>(null==t||t.forEach((t=>{e&&!e.includes(t)&&e.push(t)})),e)),[]))?t:[]},bA="Assignment action failed. Try again or contact support.";function*AA(){yield ji(za.setApplicationsState({loading:!0,fetching:!0}));try{const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.id})),t=yield zi(Ip.applications.getUserApplicationsId,{userId:e}),n=yield zi(Ip.applications.getApplicationsData,{appIds:t});yield ji(za.setApplicationsState({userApplications:n,fetching:!1,loading:!1}))}catch(e){yield ji(za.setApplicationsState({loading:!1,fetching:!1,error:jg(e)}))}}function*TA(){yield ji(za.setApplicationsState({loading:!0,fetching:!0}));try{const e=yield zi(Ip.applications.getTenantsApplications),t=mA(e),n=yield zi(Ip.applications.getApplicationsData,{appIds:t}),a=yield zi(Ip.applications.getUsersOfApplications,{appIds:t}),i=n.map((e=>{var t;return $({},e,{userIds:null==(t=a.find((t=>t.appId===e.id)))?void 0:t.userIds})}));yield ji(za.setApplicationsState({accountApplications:i,fetching:!1,loading:!1}))}catch(e){yield ji(za.setApplicationsState({loading:!1,fetching:!1,error:jg(e)}))}}function*EA({userIds:e}){try{const t=yield zi(Ip.applications.getUsersApplicationsId,{userIds:e}),n=mA(t),a=yield zi(Ip.applications.getApplicationsData,{appIds:n});return e.reduce(((e,n)=>{var i,o;const r=null==(i=t.find((e=>e.userId==n)))?void 0:i.appIds;return e[n]=[...a.filter((e=>e.accessType===Ep.FREE_ACCESS)),...null!=(o=null==r?void 0:r.map((e=>a.find((t=>e===t.id)))))?o:[]],e}),{})}catch(e){yield ji(za.setApplicationsState({error:jg(e)}))}}function*IA({payload:e}){const{userId:t,appIds:n,callback:a}=e;try{var i,o;const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));yield zi(Ip.applications.assignUserToApplications,{userId:t,appIds:n,tenantId:e});const r=yield null!=(i=qi((({auth:e})=>{var t;return null==e||null==(t=e.applicationsState)?void 0:t.accountApplications})))?i:[],s=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.teamState)?void 0:t.users})),l=null!=(o=null==r?void 0:r.filter((e=>n.includes(e.id))))?o:[];null!=l&&l.length&&(yield ji(za.setTeamState({users:s.map((e=>{var n;return e.id===t?$({},e,{applications:[...null!=(n=e.applications)?n:[],...l]}):e}))}))),null==a||a(!0)}catch(e){yield ji(za.setApplicationsState({error:jg(e,bA)})),null==a||a(!1)}}function*kA({payload:e}){const{userId:t,appIds:n,callback:a}=e;try{var i;const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));yield zi(Ip.applications.unassignUserFromApplications,{userId:t,appIds:n,tenantId:e});const o=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.teamState)?void 0:t.users})),r=null==(i=o.find((e=>e.id===t)))?void 0:i.applications;null!=r&&r.length&&n.length&&(yield ji(za.setTeamState({users:o.map((e=>e.id===t?$({},e,{applications:r.filter((e=>!n.includes(e.id)))}):e))}))),null==a||a(!0)}catch(e){yield ji(za.setApplicationsState({error:jg(e,bA)})),null==a||a(!1)}}function*OA({appIds:e,user:t}){var n;const[a]=yield zi(zp,["multi-apps-admin-portal"]);if(!a)return;const i=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.applicationsState)?void 0:t.accountApplications})),o=null!=(n=null==i?void 0:i.filter((e=>e.accessType===Ep.FREE_ACCESS)))?n:[];if(null!=e&&e.length){const n=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));return yield zi(Ip.applications.assignUserToApplications,{userId:t.id,appIds:e,tenantId:n}),e.map((e=>{var t;return null!=(t=null==i?void 0:i.find((t=>t.id===e)))?t:[]})).concat(o)}return o}function*PA({shouldLoadApps:e,users:t}){const[n]=yield zi(zp,["multi-apps-admin-portal"]);if(!n||!e)return t;const a=t.map((e=>e.id)),i=yield zi(EA,{userIds:a});return i?t.map((e=>null!=i&&i[e.id]?$({},e,{applications:i[e.id]}):e)):t}function*_A(){yield Bo(za.loadUserApplications,AA),yield Bo(za.loadAccountApplications,TA),yield Bo(za.assignUserToApps,IA),yield Bo(za.unassignUserFromApps,kA)}const LA=["callback","appIds"],wA=["roles"],UA=["callback"],DA=["callback","profileImage"],RA=["callback"],CA=["callback","userId"],NA=["callback"],MA=["callback"],FA=["callback"],GA=["callback"],$A=["callback"],xA=["callback"],VA=["callback"],jA=["callback"],BA=["callback"],WA=["callback","profileImage"],zA=["callback"],KA=["callback"],HA=["callback"],qA=["callback"],JA=["callback"],YA=["callback"],XA=["callback"],QA=["callback"],ZA=()=>qi((e=>e.auth.teamState));function*eT(){try{const{groups:e}=yield zi(Ip.groups.getGroups,{_groupsRelations:hA.roles});return e}catch(e){return[]}}function*tT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s,shouldLoadApps:l}=e,c=yield ZA(),d=null!=(t=e.pageSize)?t:c.pageSize,u=null!=(n=e.pageOffset)?n:c.pageOffset,y=null!=(a=e.filter)?a:c.filterV2,f=null!=(i=e.sort)?i:c.sortV2,p=null!=(o=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?o:null==c?void 0:c.shouldShowSubTenantUsersIfReseller;yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({pageSize:d,pageOffset:u,filterV2:y,sortV2:f}));try{const[{items:t,_metadata:{totalPages:n,totalItems:a}},{items:i},{items:o},r]=yield Bi([zi(Ip.users.getUsersV2,$({},(null==y?void 0:y.length)&&{_filter:y},f&&{_sortBy:f},e.order&&{_order:e.order},{_offset:u,_limit:d,_includeSubTenants:p})),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions),zi(eT)]),c=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return $({},e,{groups:n})})),g=c.map((e=>$({},e,{roleIds:e.roles.map((e=>e.id))}))),S=yield zi(PA,{shouldLoadApps:l,users:g});yield ji(za.setTeamState({users:S,totalPages:n,totalItems:a,roles:i,permissions:o})),null==s||s(t)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:jg(e)})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*nT({payload:e}){var t,n,a,i;const{silentLoading:o,callback:r}=e,s=yield ZA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(a=e.filter)?a:s.filter,u=null!=(i=e.sort)?i:s.sort;yield ji(za.setTeamLoader({key:Xb.USERS,value:!o})),yield ji(za.setTeamState({pageSize:l,pageOffset:c,filter:d,sort:u}));try{const[{items:e,totalPages:t,totalItems:n},{items:a},{items:i}]=yield Bi([zi(Ip.teams.loadUsers,{pageSize:l,pageOffset:c,filter:d,sort:u}),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({users:e,totalPages:t,totalItems:n,roles:a,permissions:i})),null==r||r(e)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:e.message})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*aT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s}=e,l=yield ZA(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(a=e._filter)?a:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(o=e._order)?o:l.allUsersQueryParams._order)||"DESC"};yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:a},{items:i}]=yield Bi([zi(Ip.subTenants.loadAllUsers,$({},c)),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:a,permissions:i})),null==s||s(e)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:jg(e)})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*iT({payload:e}){yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:a}]=yield Bi([zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({roles:n,permissions:a})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:a})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ji(za.setTeamError({key:Xb.ROLES_AND_PERMISSIONS,value:jg(t)}))}yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0}))}function*oT({payload:e}){const{callback:t,appIds:n}=e,a=ii(e,LA),i=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield zi(Ip.teams.addUser,a),{roles:r}=e,s=$({},ii(e,wA),{roleIds:null!=(o=null==r?void 0:r.map((e=>e.id)))?o:[]}),l=yield zi(OA,{appIds:n,user:s});l&&(s.applications=l),null==t||t(s),yield ji(za.setTeamState({users:[s,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*rT({payload:e}){const{callback:t}=e,n=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},n.addUserDialogState,{loading:!0})}));const a=[],i=[],o=e.emails.map((t=>$({email:t,roleIds:e.roleIds},e.expirationInSeconds&&{expirationInSeconds:e.expirationInSeconds})));yield ji(za.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<o.length;e++){const t=o.at(e);try{yield zi(Ip.teams.addUser,t),a.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield ji(za.loadUsersV2(r)),yield ji(za.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:a})}function*sT({payload:e}){const{callback:t}=e,n=ii(e,UA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:a,totalItems:i}}=yield zi(Ip.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ji(za.setTeamState({allUsers:e,totalPages:a,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*lT({payload:e}){const{callback:t}=e,n=ii(e,DA),{id:a}=n,i=yield ZA(),o=i.users.find((e=>e.id===n.id));yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:a||""})),yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})})),yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?$({},e,n):e))}));try{var r;o.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield zi(Ip.teams.updateUser,n);null==t||t(e),yield ji(za.setTeamState({users:i.users.map((t=>t.id===e.id?$({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1}))}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)}),users:i.users.map((e=>e.id===n.id?$({},e,o):e))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*cT({payload:e}){const{callback:t}=e,n=ii(e,RA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})}));try{yield zi(Ip.teams.deleteUser,n),null==t||t(!0),yield ji(za.setTeamState({users:a.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*dT({payload:e}){const{callback:t,userId:n}=e,a=ii(e,CA),i=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.setUserRolesForSubTenants,n,a);const e=i.allUsers.find((e=>e.id===n));let o=[];e&&(o=e.tenants.map((e=>{var t;return $({},e,{roles:(null==(t=a.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ji(za.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[$({},e,{tenants:o})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*uT({payload:e}){const{callback:t}=e,n=ii(e,NA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ji(za.setTeamState({allUsers:a.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*yT({payload:e}){const{callback:t}=e,n=ii(e,MA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield zi(Ip.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_ACTIVATE_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*fT({payload:e}){const{callback:t}=e,n=ii(e,FA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*pT({payload:e}){const{callback:t}=e,n=ii(e,GA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*gT({payload:e}){const{callback:t}=e,n=ii(e,$A);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*ST(){yield ji(za.setTeamError({key:Xb.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield zi(Ip.teams.getInviteLinkConfiguration);yield ji(za.setTeamState({inviteTokenState:$({},e)}))}catch(e){yield ji(za.setTeamError({key:Xb.CONFIG_TOKEN_LINK,value:jg(e)}))}}function*vT(){yield ji(za.setTeamError({key:Xb.CONFIG_TEMPORARY_USERS,value:!1}));try{const e=yield zi(Ip.teams.getTemporaryUserConfiguration);yield ji(za.setTeamState({temporaryUsersConfig:e}))}catch(e){yield ji(za.setTeamError({key:Xb.CONFIG_TEMPORARY_USERS,value:jg(e)}))}}function*hT({payload:e}){const{callback:t}=e,n=ii(e,xA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{const e=yield zi(Ip.teams.updateUserExpirationTime,n);yield ji(za.setTeamState({users:a.users.map((t=>t.id===n.userId?$({},t,{temporaryExpirationDate:new Date(e.temporaryExpirationDate)}):t))})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*mT({payload:e}){const{callback:t}=e,n=ii(e,VA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{yield zi(Ip.teams.setPermanentUser,n.userId),yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:void 0}):e))})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*bT(){yield ji(za.setTeamError({key:Xb.GET_TOKEN_LINK,value:!1}));try{yield zi(ST);const e=yield zi(Ip.teams.getInviteUserLink),{inviteTokenState:t}=yield ZA();yield ji(za.setTeamState({inviteTokenState:$({},t,e)}))}catch(e){yield ji(za.setTeamError({key:Xb.GET_TOKEN_LINK,value:jg(e)}))}}function*AT({payload:{callback:e}}){yield ji(za.setTeamError({key:Xb.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield ZA();try{const n=yield zi(Ip.teams.createInviteUserLink,{expiresInMinutes:43200});yield ji(za.setTeamState({inviteTokenState:$({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield ji(za.setTeamError({key:Xb.CREATE_TOKEN_LINK,value:jg(t)}))}}function*TT({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:a}=yield ZA();yield ji(za.setTeamError({key:Xb.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield zi(Ip.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ji(za.setTeamState({inviteTokenState:$({},a,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield ji(za.setTeamError({key:Xb.UPDATE_TOKEN_LINK,value:jg(t)}))}}function*ET({payload:e}){const{callback:t}=null!=e?e:{};yield ji(za.setTeamError({key:Xb.DELETE_TOKEN_LINK,value:!1}));try{yield zi(Ip.teams.deleteInviteUserLink),yield ji(za.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.DELETE_TOKEN_LINK,value:jg(e)})),null==t||t(!1,e)}}function*IT({payload:e}){yield ji(za.setTeamState({addUserDialogState:$({open:!0,loading:!1,error:!1},e)}))}function*kT({payload:e}){const t=yield ZA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(za.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*OT({payload:e}){yield ji(za.setTeamState({deleteUserDialogState:$({open:!0,loading:!1,error:!1},e)}))}function*PT({payload:e}){const t=yield ZA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(za.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_T(){yield jo(za.loadUsers,nT),yield jo(za.loadUsersV2,tT),yield jo(za.loadAllSubTenantsUsers,aT),yield jo(za.loadRoles,iT),yield Vo(za.addUser,oT),yield Vo(za.addUsersBulk,rT),yield Vo(za.addUserToSubTenants,sT),yield Vo(za.updateUser,lT),yield Vo(za.setUserRolesForSubTenants,dT),yield Vo(za.deleteUser,cT),yield Vo(za.deleteUserFromSubTenants,uT),yield Vo(za.resendActivationLink,yT),yield Vo(za.resendInvitationLink,fT),yield Vo(za.resendInvitationEmail,pT),yield Vo(za.resendInvitationLinkToAllSubTenants,gT),yield Vo(za.getTemporaryUsersConfig,vT),yield Vo(za.updateUserExpirationTime,hT),yield Vo(za.setUserAsPermanent,mT),yield Vo(za.getInvitationLink,bT),yield Vo(za.createInvitationLink,AT),yield Vo(za.updateInvitationLink,TT),yield Vo(za.deleteInvitationLink,ET),yield Vo(za.openAddUserDialog,IT),yield Vo(za.closeAddUserDialog,kT),yield Vo(za.openDeleteUserDialog,OT),yield Vo(za.closeDeleteUserDialog,PT)}function*LT({payload:e}){var t,n,a,i;const{silentLoading:o,callback:r}=e,s=yield ZA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(a=e.filter)?a:s.filterV2,u=null!=(i=e.sort)?i:s.sortV2;yield ji(za.setTeamLoader({key:Xb.USERS,value:!o})),yield ji(za.setTeamState({pageSize:l,pageOffset:c,filterV2:d,sortV2:u})),yield It(),yield ji(za.setTeamState({users:fg,totalPages:2,totalItems:10,roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.USERS,value:!1})),null==r||r(fg)}function*wT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s}=e,l=yield ZA(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,d=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,u=null!=(a=e._filter)?a:l.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:l.allUsersQueryParams._sortBy,f=null!=(o=e._order)?o:l.allUsersQueryParams._order;yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({allUsersQueryParams:{_limit:c,_offset:d,_filter:u,_sortBy:y,_order:f}})),yield It(),yield ji(za.setTeamState({allUsers:gg,totalPages:2,totalItems:10,roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.USERS,value:!1})),null==s||s(gg)}function*UT({payload:e}){var t;yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0})),yield It(),yield ji(za.setTeamState({roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:og,permissions:sg})}function*DT({payload:e}){const{callback:t}=e,n=ii(e,jA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})})),yield It();const i=new Date,o=$({},dg,{groups:[]},n,{id:`${SA()}`,temporaryExpirationDate:n.expirationInSeconds?new Date(i.setSeconds(i.getSeconds()+n.expirationInSeconds)):void 0});null==t||t(o),yield ji(za.setTeamState({users:[o,...a.users],addUserDialogState:{open:!1,loading:!1}}))}function*RT({payload:e}){const{callback:t}=e,n=ii(e,BA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})})),yield It();const i=$({},dg,n,{id:`${SA()}`});yield ji(za.setTeamState({users:[i,...a.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*CT({payload:e}){var t;const{callback:n}=e,a=ii(e,WA),{id:i}=a,o=yield ZA(),r=o.users.find((e=>e.id===a.id));yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:i||""})),yield ji(za.setTeamState({addUserDialogState:$({},o.addUserDialogState,{loading:!0})})),yield ji(za.setTeamState({addUserDialogState:$({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===a.id?$({},e,a):e))})),r.roleIds.length>0&&0===(null==(t=a.roleIds)?void 0:t.length)&&(a.roleIds=[""]),yield It();const s=$({},r,a);null==n||n(s),yield ji(za.setTeamState({users:o.users.map((e=>e.id===s.id?$({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1}))}function*NT({payload:e}){const{callback:t}=e,n=ii(e,zA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})})),yield It(),null==t||t(!0),yield ji(za.setTeamState({users:a.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*MT({payload:e}){const{callback:t}=e,n=ii(e,KA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})})),yield It(),null==t||t(!0),yield ji(za.setTeamState({allUsers:a.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*FT({payload:e}){const{callback:t}=e,n=ii(e,HA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.userId})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*GT({payload:e}){const{callback:t}=e,n=ii(e,qA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*$T({payload:e}){const{callback:t}=e,n=ii(e,JA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*xT({payload:e}){const{callback:t}=e,n=ii(e,YA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*VT({payload:e}){const{callback:t}=e,n=ii(e,XA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));const i=new Date;yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:n.expirationInSeconds?new Date(i.setSeconds(i.getSeconds()+n.expirationInSeconds)):void 0}):e))})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*jT({payload:e}){const{callback:t}=e,n=ii(e,QA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0})),yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:void 0}):e))})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*BT(){yield jo(za.loadUsersV2,LT),yield jo(za.loadAllSubTenantsUsers,wT),yield jo(za.loadRoles,UT),yield Vo(za.addUser,DT),yield Vo(za.addUserToSubTenants,RT),yield Vo(za.updateUser,CT),yield Vo(za.deleteUser,NT),yield Vo(za.updateUserExpirationTime,VT),yield Vo(za.setUserAsPermanent,jT),yield Vo(za.deleteUserFromSubTenants,MT),yield Vo(za.resendActivationLink,FT),yield Vo(za.resendInvitationLink,GT),yield Vo(za.resendInvitationEmail,$T),yield Vo(za.resendInvitationLinkToAllSubTenants,xT),yield Vo(za.openAddUserDialog,IT),yield Vo(za.closeAddUserDialog,kT),yield Vo(za.openDeleteUserDialog,OT),yield Vo(za.closeDeleteUserDialog,PT)}const WT=["authorizationUrl"],zT=["events","url"];function*KT(){try{yield ji(za.setSocialLoginsState({loading:!0}));const e=yield zi(Ip.auth.getSocialLoginProviders);yield ji(za.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ji(za.setSocialLoginsState({error:jg(e),loading:!1,firstLoad:!1}))}}function*HT(){const e=yield qi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield zi(Ip.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield zi(Ip.auth.getSocialLoginProvidersV2),t}function*qT(e){try{var t,n;const a=yield qi((e=>e.root.context));yield ji(za.setSocialLoginsState({loading:!0}));const i=yield zi(HT),{providers:o}=yield zi(Ip.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:i.map((e=>{let{authorizationUrl:t}=e,n=ii(e,WT);const i=Cr(a,null!=t?t:"");return $({},n,{authorizationUrl:t?`${i}${t}`:null})})),customSocialLoginsConfig:o,loading:!1,firstLoad:!1};yield ji(za.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var a,i;null==e||null==(a=e.payload)||null==(i=a.callback)||i.call(a,null,t),yield ji(za.setSocialLoginsState({error:jg(t),loading:!1,firstLoad:!1}))}}function*JT(e){let{payload:{events:t,url:n}}=e,a=ii(e.payload,zT);try{yield ji(za.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield zi(Ip.auth.loginViaSocialLogin,a);if(r){var i,o;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},d=$({},r,{socialProvider:a.provider,authenticationType:Dg.SOCIAL_LOGIN});null==t||null==(i=t.signUpComplete)||i.call(t,d),Wg(Bg.SIGNUP_COMPLETED,d);const u=$({},r,{origin:Ug.SOCIAL_LOGIN,name:c});null==t||null==(o=t.userVerified)||o.call(t,u),Wg(Bg.USER_VERIFIED,u)}s&&localStorage.setItem("userId",s),yield ji(za.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield zi(Ih):yield zi(Oh)}(),localStorage.removeItem("register-quick-login"),yield ji(za.setSocialLoginsState({loading:!1}))}catch(e){yield ji(za.setSocialLoginsState({loading:!1,error:jg(e,"Failed to authenticate"),firstLoad:!1}))}}function*YT({payload:e}){yield ji(za.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*XT(){yield Bo(za.loadSocialLoginsConfiguration,KT),yield Vo(za.loadSocialLoginsConfigurationV2,qT),yield Bo(za.loginViaSocialLogin,JT),yield jo(za.setSocialLoginError,YT)}let QT,ZT;function*eE({payload:e}){const{description:t,expires:n,callback:a}=e,{apiTokensDataUser:i}=yield qi((e=>e.auth.apiTokensState)),{policy:o}=yield qi((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==o?void 0:o.machineToMachineAuthStrategy)===Pa.AccessToken;try{let e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));let o=null;n&&(o=1440*n),e=r?yield zi(Ip.auth.createUserAccessToken,{description:t,expiresInMinutes:o}):yield zi(Ip.auth.updateUserApiTokensData,{description:t,expiresInMinutes:o}),yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataUser:[$({},e,{type:r?Pa.AccessToken:Pa.ClientCredentials}),...i],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null)}catch(e){yield ji(za.setApiTokensError({key:QT.ADD_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null,e)}}function*tE({payload:e}){const{description:t,roleIds:n,expires:a,callback:i}=e,{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState)),{policy:r}=yield qi((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Pa.AccessToken;try{let e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));let r=null;a&&(r=1440*a),e=s?yield zi(Ip.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield zi(Ip.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataTenant:[$({},e,{type:s?Pa.AccessToken:Pa.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ji(za.setApiTokensError({key:QT.ADD_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*nE({payload:e}){const{apiTokensDataUser:t}=yield qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),n?(yield zi(Ip.auth.deleteUserAccessToken,{id:e}),yield ji(za.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield zi(Ip.auth.deleteUserApiToken,{tokenId:e}),yield ji(za.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(za.setApiTokensError({key:QT.DELETE_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}}function*aE({payload:e}){const{apiTokensDataTenant:t}=yield qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let a=t;try{yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),n?(yield zi(Ip.auth.deleteTenantAccessToken,{id:e}),a=t.filter((t=>t.id!==e))):(yield zi(Ip.auth.deleteTenantApiToken,{tokenId:e}),a=t.filter((t=>t.clientId!==e))),yield ji(za.setApiTokensState({apiTokensDataTenant:a,deleteTokenDialog:{open:!1,id:e}})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(za.setApiTokensError({key:QT.DELETE_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}}function*iE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],a=[]]=yield Bi([zi(Ip.auth.getUserApiTokensData),zi(Ip.auth.getTenantApiTokensData)]);yield ji(za.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:a})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*oE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t,n,a,i;const o=yield null!=(t=zi(Ip.auth.getUserApiTokensData))?t:[],r=(null!=(a=(yield null!=(n=zi(Ip.auth.getUserAccessTokensData))?n:[]).accessTokens)?a:[]).map((e=>$({},e,{type:Pa.AccessToken}))).concat(o.map((e=>$({},e,{type:Pa.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ji(za.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var o;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*rE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t,n,a,i;const o=yield null!=(t=zi(Ip.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=zi(Ip.auth.getTenantAccessTokensData))?n:[],s=(null!=(a=null==r?void 0:r.accessTokens)?a:[]).map((e=>$({},e,{type:Pa.AccessToken}))).concat(o.map((e=>$({},e,{type:Pa.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ji(za.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var o;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*sE(){yield Bo(za.loadApiTokens,iE),yield Bo(za.loadUserApiTokens,oE),yield Bo(za.loadTenantApiTokens,rE),yield Vo(za.addUserApiToken,eE),yield Vo(za.addTenantApiToken,tE),yield jo(za.deleteTenantApiToken,aE),yield jo(za.deleteUserApiToken,nE)}function*lE({payload:e}){const{description:t,roleIds:n,callback:a}=e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield qi((e=>e.auth.apiTokensState)),o=$({},Hp,{description:t,roleIds:n,clientId:`CLIENT_ID_${SA()}`});yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataTenant:[...i,o],successDialog:{open:!0,secret:o.secret,clientId:o.clientId}})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null)}function*cE({payload:e}){yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),yield Ji(200);const t=[Hp];yield ji(za.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}function*dE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Kp],a=[Hp];yield ji(za.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:a})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*uE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Kp];yield ji(za.setApiTokensState({apiTokensDataUser:n})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Hp];yield ji(za.setApiTokensState({apiTokensDataTenant:n})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fE(){yield Bo(za.loadApiTokens,dE),yield Bo(za.loadUserApiTokens,uE),yield Bo(za.loadTenantApiTokens,yE),yield Vo(za.addTenantApiToken,lE),yield jo(za.deleteTenantApiToken,cE)}function*pE({payload:e}){try{var t;yield ji(za.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=yield zi(Ip.accountSettings.updateSettings,$({address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l},e));yield ji(za.setAccountSettingsState($({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ji(za.setAccountSettingsState({loading:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*gE({payload:e}){yield ji(za.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield zi(Ip.accountSettings.getSettings);yield ji(za.setAccountSettingsState($({},e,{loading:!1})))}catch(e){yield ji(za.setAccountSettingsState({loading:!1,error:jg(e)}))}}function*SE(){yield Bo(za.saveAccountSettings,pE),yield Bo(za.loadAccountSettings,gE)}function*vE({payload:e}){var t;yield ji(za.setAccountSettingsState({loading:!0})),yield It();const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=$({address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l},e);yield ji(za.setAccountSettingsState($({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*hE({payload:e}){yield ji(za.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield It(),yield ji(za.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*mE(){yield Bo(za.saveAccountSettings,vE),yield Bo(za.loadAccountSettings,hE)}function*bE({payload:{tenantId:e,callback:t}}){yield ji(za.setState({isLoading:!0}));try{yield zi(Ip.tenants.switchTenant,{tenantId:e}),yield zi(Th),(null==t?void 0:t(!0))||(yield ji(za.setState({isLoading:!1})))}catch(e){yield ji(za.setState({isLoading:!1})),null==t||t(!1,e)}}function*AE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(ss());yield ji(za.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,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 ji(za.setTenantsState({loading:!1}))}}function*TE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(Ip.tenants.getSubTenants);yield ji(za.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*EE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(Ip.tenants.getSubTenantsAsTree);yield ji(za.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*IE(){yield Vo(za.loadTenants,AE),yield Vo(za.loadSubTenants,TE),yield Vo(za.switchTenant,bE),yield Vo(za.loadSubTenantsTree,EE)}function*kE(){yield ji(za.setTenantsState({loading:!0})),yield It(),yield ji(za.setTenantsState({tenants:Sg,activeTenant:Sg[0],loading:!1}))}function*OE(){yield Vo(za.loadTenants,kE)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(QT||(QT={})),function(e){e.EDIT_ROLE_DIALOG="editRoleDialog",e.DELETE_ROLE_DIALOG="deleteRoleDialog",e.LOAD_ROLES="loadRoles",e.ADD_ROLE="addRole",e.MANAGE_PERMISSIONS="managePermissions"}(ZT||(ZT={}));const PE=["callback"],_E=["callback"],LE=["callback"],wE=["callback"],UE=["callback"];function*DE({payload:e}){var t;const n=ZT.LOAD_ROLES;yield ji(za.setRolesStateLoader({key:n,value:!(null!=(t=null==e?void 0:e.silentLoading)&&t)}));try{const e=yield Bi([zi(Ip.roles.getRoles),zi(Ip.roles.getPermissions),zi(Ip.roles.getPermissionCategories)]),[t,a,i]=e,{selectedRole:o}=yield qi((e=>e.auth.rolesState)),r=null==t?void 0:t.find((({id:e})=>(null==o?void 0:o.id)===e));yield ji(za.setRolesState({roles:t,permissions:a,permissionCategories:i,selectedRole:r}))}catch(e){yield ji(za.setRolesStateError({key:n,value:jg(e)}))}finally{yield ji(za.setRolesStateLoader({key:n,value:!1}))}}function*RE(e){let{payload:{callback:t}}=e,n=ii(e.payload,PE);const a=ZT.ADD_ROLE;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.addRole,n),i=yield zi(Ip.roles.getRoles);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),yield ji(za.setRolesState({roles:i})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*CE(e){let{payload:{callback:t}}=e,n=ii(e.payload,_E);const a=ZT.ADD_ROLE;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.addRoleV2,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*NE(e){let{payload:{callback:t}}=e,n=ii(e.payload,LE);const a=ZT.DELETE_ROLE_DIALOG;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{yield zi(Ip.roles.deleteRole,n),yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(!0)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(!1,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*ME(e){let{payload:{callback:t}}=e,n=ii(e.payload,wE);const a=ZT.EDIT_ROLE_DIALOG;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.updateRole,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*FE(e){let{payload:{callback:t}}=e,n=ii(e.payload,UE);const a=ZT.MANAGE_PERMISSIONS;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.attachPermissionsToRole,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*GE(){yield Bo(za.loadRolesAndPermissions,DE),yield Vo(za.addRole,RE),yield Vo(za.addRoleV2,CE),yield Vo(za.deleteRole,NE),yield Vo(za.updateRole,ME),yield Vo(za.attachPermissionsToRole,FE)}function*$E({payload:e}){var t;const n=ZT.LOAD_ROLES;yield ji(za.setRolesStateLoader({key:n,value:!(null!=(t=null==e?void 0:e.silentLoading)&&t)}));try{yield ji(za.setRolesState({roles:qp,permissionCategories:wg,permissions:Lg,selectedRole:qp[2]}))}catch(e){yield ji(za.setRolesStateError({key:n,value:jg(e)}))}finally{yield ji(za.setRolesStateLoader({key:n,value:!1}))}}function*xE(){yield Bo(za.loadRolesAndPermissions,$E)}const VE=["callback"],jE=["callback"],BE=["callback"];function*WE(e){let{payload:{callback:t}}=e,n=ii(e.payload,VE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const e=yield zi(Ip.auth.resetPhoneNumber,n);yield ji(za.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:en.VerifyResetPhoneNumber})),yield ji(za.setLoginState({email:n.email}))}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*zE(e){let{payload:{callback:t}}=e,n=ii(e.payload,jE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const e=yield zi(Ip.auth.verifyResetPhoneNumber,n);yield ji(za.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:en.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*KE(e){let{payload:{callback:t}}=e,n=ii(e.payload,BE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:a}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield zi(Ip.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ji(za.setLoginState({step:Lt.loginWithSmsOtc})),yield ji(za.passwordlessPreLogin({type:Oa.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(a.loginUrl),yield ji(za.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*HE(){yield Bo(za.resetPhoneNumber,WE),yield Bo(za.verifyResetPhoneNumber,zE),yield Bo(za.changePhoneNumber,KE)}function*qE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCurrentUserSessions);yield ji(za.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*JE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCurrentUserSession);yield ji(za.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*YE({payload:{id:e}}){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.deleteSessionForUser,e),yield ji(za.loadUserSessions())}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*XE({payload:{callback:e,userId:t}}){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.revokeSessionsForUser,t),yield ji(za.setSessionsState({loading:!1})),null==e||e(!0)}catch(t){yield ji(za.setSessionsState({error:jg(t),loading:!1})),null==e||e(!1)}}function*QE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.deleteAllSessionsForUser),yield ji(za.loadUserSessions())}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*ZE(){yield jo(za.loadUserSessions,qE),yield jo(za.deleteUserSession,YE),yield jo(za.deleteAllUserSessions,QE),yield jo(za.loadCurrentUserSession,JE),yield Vo(za.revokeUserSessions,XE)}function*eI(){yield ji(za.setSessionsState({loading:!0,error:null})),yield ji(za.setSessionsState({sessions:vg,loading:!1}))}function*tI({payload:{id:e}}){yield ji(za.setSessionsState({loading:!0,error:null}));const t=(yield qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ji(za.setSessionsState({sessions:t,loading:!1}))}function*nI(){yield ji(za.setSessionsState({loading:!0,error:null}));const e=vg.filter((e=>e.current));yield ji(za.setSessionsState({sessions:e,loading:!1}))}function*aI(){yield jo(za.loadUserSessions,eI),yield jo(za.deleteUserSession,tI),yield jo(za.deleteAllUserSessions,nI)}const iI=["callback"],oI=["callback"];function*rI(){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getSessionConfigurations);yield ji(za.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*sI({payload:e}){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ii(e,iI);yield zi(Ip.auth.createOrUpdateSessionConfigrations,n),yield ji(za.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ji(za.setSessionsPolicyState({error:e,loading:!1}))}}function*lI(){yield Bo(za.loadSessionsPolicy,rI),yield jo(za.createOrUpdateSessionsPolicy,tS(sI))}function*cI(){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));const e=yield qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:hg}));yield ji(za.setSessionsPolicyState($({},e,{loading:!1})))}function*dI({payload:e}){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ii(e,oI);null==t||t(!0),yield ji(za.setSessionsPolicyState({configurations:n,loading:!1}))}function*uI(){yield Bo(za.loadSessionsPolicy,cI),yield jo(za.createOrUpdateSessionsPolicy,dI)}const yI=["callback"],fI=["callback"],pI=["callback"],gI=["callback"],SI=["callback"],vI=["callback"],hI=["callback"],mI=["callback"],bI=()=>qi((e=>e.auth.restrictionsState.ipRestrictions)),AI=()=>qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*TI(){yield ji(za.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getDomainRestrictionsConfig),t=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(za.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ji(za.setEmailDomainRestrictionsState({error:jg(e),loading:!1}))}}function*EI(e){let{payload:{callback:t}}=e,n=ii(e.payload,yI);yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));const a=yield AI();try{var i;yield zi(Ip.auth.createDomainRestriction,n);const e=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=a.data)?void 0:t.config.listType)}));yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(i=a.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*II(e){let{payload:{callback:t}}=e,n=ii(e.payload,fI);yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.updateDomainRestrictionConfig,n),a=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(za.setEmailDomainRestrictionsState({data:{config:e,restrictions:a},saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*kI({payload:{id:e}}){yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield AI();try{var n;yield zi(Ip.auth.deleteDomainRestriction,e);const a=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Kn.ALLOW},restrictions:a},saving:!1}))}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)}))}}const OI=e=>{var t,n,a;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Kn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(a=null==e?void 0:e._offset)?a:0}};function*PI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bI(),t=yield zi(Ip.auth.getIPRestrictionsConfig),n=OI({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:a,_metadata:{totalPages:i}}=yield zi(Ip.auth.getIPRestrictions,n);yield ji(za.setIpRestrictionsState({data:{restrictions:a,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e),loading:!1}))}}function*_I(){try{const{valid:e}=yield zi(Ip.auth.testCurrentIpInAllowList);yield ji(za.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e)}))}}function*LI({payload:{callback:e}}){yield ji(za.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield qi((e=>e.auth.userIp));yield Bi([zi(Ip.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Kn.ALLOW}),zi(Ip.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield bI(),a=OI(n.pagination),{items:i,_metadata:{totalPages:o}}=yield zi(Ip.auth.getIPRestrictions,a);yield ji(za.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Kn.ALLOW},restrictions:i},userIpValid:!0,pagination:a,totalPages:o,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*wI(e){let{payload:{callback:t}}=e,n=ii(e.payload,pI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const a=yield bI();try{var i,o;yield zi(Ip.auth.createIPRestriction,n);const e=yield bI(),r=OI(e.pagination),{items:s,_metadata:{totalPages:l}}=yield zi(Ip.auth.getIPRestrictions,r);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:null!=(i=null==(o=a.data)?void 0:o.config)?i:{isActive:!1,strategy:Kn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*UI(e){let{payload:{callback:t}}=e,n=ii(e.payload,gI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));try{yield zi(Ip.auth.updateIPRestrictionConfig,n);const e=yield bI(),a=yield zi(Ip.auth.getIPRestrictionsConfig),i=OI($({},e.pagination,{_filter:a.strategy})),{items:o,_metadata:{totalPages:r}}=yield zi(Ip.auth.getIPRestrictions,i);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:a,restrictions:o},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*DI({payload:{id:e,callback:t}}){yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const n=yield bI();try{var a;yield zi(Ip.auth.deleteIPRestriction,e);const i=yield bI(),o=OI(i.pagination),{items:r,_metadata:{totalPages:s}}=yield zi(Ip.auth.getIPRestrictions,o);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:(null==(a=n.data)?void 0:a.config)||{isActive:!1,strategy:Kn.ALLOW},restrictions:r},pagination:o,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*RI(){yield Bo(za.loadIpRestrictions,tS(PI)),yield Bo(za.loadEmailDomainRestrictions,tS(TI)),yield Vo(za.saveIpRestriction,tS(wI)),yield Vo(za.saveIpRestrictionsConfig,tS(UI)),yield Vo(za.deleteIpRestriction,tS(DI)),yield Vo(za.checkIfUserIpValid,tS(_I)),yield Vo(za.addCurrentUserIpAndActivate,tS(LI)),yield Vo(za.saveEmailDomainRestriction,tS(EI)),yield Vo(za.saveEmailDomainRestrictionsConfig,tS(II)),yield Vo(za.deleteEmailDomainRestriction,tS(kI))}function*CI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null})),yield ji(za.setIpRestrictionsState({data:{restrictions:bg.filter((e=>e.strategy===mg.strategy)),config:mg},totalPages:1,pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*NI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bI(),t=bg[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ji(za.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e),loading:!1}))}}function*MI(e){var t,n,a;let{payload:{callback:i}}=e,o=ii(e.payload,SI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const r=yield bI(),s=r.data.restrictions.filter((e=>e.ip!==o.ip));yield ji(za.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Kn.ALLOW},restrictions:[...s,$({},o,{createdAt:new Date,updatedAt:new Date,id:SA(),isActive:null==(a=o.isActive)||a,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*FI(e){var t,n,a;let{payload:{callback:i}}=e,o=ii(e.payload,vI);const r=yield bI();yield ji(za.setIpRestrictionsState({saving:!0,error:null})),yield ji(za.setIpRestrictionsState({data:{config:$({},null==(t=r.data)?void 0:t.config,o),restrictions:null!=(n=null==(a=r.data)?void 0:a.restrictions)?n:[]},pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ji(za.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*GI({payload:{id:e,callback:t}}){var n;yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const a=yield bI();yield ji(za.setIpRestrictionsState({data:{config:(null==(n=a.data)?void 0:n.config)||{isActive:!1,strategy:Kn.ALLOW},restrictions:a.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*$I(){yield ji(za.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ji(za.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Kn.ALLOW}],config:{active:!0,listType:Kn.ALLOW,blockPublicDomains:!1}}}))}function*xI(e){var t,n;let{payload:{callback:a}}=e,i=ii(e.payload,hI);const o=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),null==a||a(!0),yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=o.data)?void 0:n.restrictions)||[],$({},i,{id:Date.now().toString()})]},saving:!1}))}function*VI(e){var t;let{payload:{callback:n}}=e,a=ii(e.payload,mI);const i=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),null==n||n(!0),yield ji(za.setEmailDomainRestrictionsState({data:{config:{active:a.active,blockPublicDomains:a.blockPublicDomains||!1,listType:a.type||Kn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*jI({payload:{id:e}}){var t,n;const a=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Kn.ALLOW},restrictions:((null==(n=a.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*BI(){yield Bo(za.loadIpRestrictions,CI),yield Bo(za.loadEmailDomainRestrictions,$I),yield Vo(za.saveIpRestriction,MI),yield Vo(za.saveIpRestrictionsConfig,FI),yield Vo(za.deleteIpRestriction,GI),yield Vo(za.checkIfUserIpValid,NI),yield Vo(za.saveEmailDomainRestriction,xI),yield Vo(za.saveEmailDomainRestrictionsConfig,VI),yield Vo(za.deleteEmailDomainRestriction,jI)}const WI=["callback"],zI=["id"];function*KI(e){const{count:t}=yield zi(Ip.directory.countConfigurationUsers,e.id);return $({},e,{count:t})}function*HI(){yield ji(za.setProvisioningState({loading:!0,error:null}));try{const e=yield zi(Ip.directory.getConfigs),t=yield Bi(e.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*qI(e){let{payload:{callback:t}}=e,n=ii(e.payload,WI);yield ji(za.setProvisioningState({loading:!0,error:null}));try{const e=yield zi(Ip.directory.createConfiguration,n),a=yield zi(Ip.directory.getConfigs),i=yield Bi(a.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*JI(e){let{payload:{id:t}}=e,n=ii(e.payload,zI);yield ji(za.setProvisioningState({loading:!0,error:null}));try{yield zi(Ip.directory.updateConfiguration,t,n);const e=yield zi(Ip.directory.getConfigs),a=yield Bi(e.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:a,loading:!1}))}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*YI({payload:{id:e,callback:t}}){yield ji(za.setProvisioningState({loading:!0,error:null}));try{yield zi(Ip.directory.deleteConfiguration,e);const n=yield zi(Ip.directory.getConfigs),a=yield Bi(n.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:a,loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1})),null==t||t(!1,e)}}function*XI(){yield Bo(za.loadProvisionConnections,HI),yield Vo(za.createProvisionConnection,qI),yield Vo(za.deleteProvisionConnection,YI),yield Vo(za.updateProvisionConnection,JI)}const QI=["callback","events"];function*ZI(e){let{payload:{callback:t}}=e,n=ii(e.payload,QI);yield ji(za.setImpersonateState({loading:!0}));try{yield zi(Ip.impersonate.impersonate,n),yield ji(za.setImpersonateState({step:$a.success})),yield Ji(1e3),yield _v({preventRedirectUrlOriginCleaning:!0}),yield ji(za.resetImpersonateState()),null==t||t(!0)}catch(e){yield ji(za.setImpersonateState({loading:!1,error:jg(e)}))}}function*ek(){yield Bo(za.impersonate,ZI)}function*tk({payload:e}){const{callback:t,deviceId:n}=e;yield ji(za.setPasskeysState({loading:!0}));try{yield zi(Ip.auth.deleteWebAuthnDevice,n);const{devices:e}=yield qi((e=>e.auth.passkeysState)),a=e.filter((e=>e.id!==n));yield ji(za.setPasskeysState({devices:a,loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setPasskeysState({loading:!1,error:jg(e,null)})),null==t||t(null,e)}}function*nk(){yield ji(za.setPasskeysState({loading:!0}));try{const{devices:e}=yield zi(Ip.auth.getWebAuthnDevices);yield ji(za.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ji(za.setPasskeysState({loading:!1,error:jg(e,null)}))}}function*ak(){yield Vo(za.loadWebAuthnDevices,nk),yield Vo(za.deleteWebAuthnDevice,tk)}const ik=["roleIds","userIds"],ok=()=>qi((e=>e.auth.groupsState));function*rk({payload:e}){const t=vA.GET_TEAM_USERS;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield zi(Ip.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield ji(za.setGroupsState({teamUsers:n}))}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*sk({payload:e}){const t=vA.GET_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield zi(Ip.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:hA.rolesAndUsers});yield ji(za.setGroupsState({selectedGroup:n}))}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*lk(){const e=vA.GET_GROUPS,t=yield ok();yield ji(za.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield zi(Ip.groups.getGroups,{_groupsRelations:hA.rolesAndUsers});yield ji(za.setGroupsState($({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ji(za.setUsersGroupsError({key:e,value:jg(t)}))}finally{yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}}function*ck({payload:e}){const t=vA.CREATE_GROUP,{roleIds:n,userIds:a}=e,i=ii(e,ik);yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var o;const r=yield zi(Ip.groups.createGroup,$({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=a&&a.length&&(yield ji(za.addUsersToGroup({groupId:r.id,userIds:a}))),null!=n&&n.length&&(yield ji(za.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ji(za.loadGroups()),null==e||null==(o=e.callback)||o.call(e,!0)}catch(n){var r;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=vA.UPDATE_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.updateGroup,e),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=vA.DELETE_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteGroup,e.groupId),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1,n)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=vA.ADD_ROLES_TO_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=vA.DELETE_ROLES_FROM_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*pk({payload:e}){const t=vA.ADD_USERS_TO_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;null==e||null==(a=e.callback)||a.call(e,!1),yield ji(za.setUsersGroupsError({key:t,value:jg(n)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=vA.DELETE_USERS_FROM_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk(){const e=vA.GET_GROUP_CONFIGURATION;yield ji(za.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield zi(Ip.groups.getGroupConfiguration);yield ji(za.setGroupsState({groupsConfiguration:t}))}catch(t){yield ji(za.setUsersGroupsError({key:e,value:jg(t)}))}finally{yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}}function*vk({payload:e}){const t=vA.UPDATE_GROUP_CONFIGURATION;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{yield zi(Ip.groups.updateGroupConfiguration,e),yield ji(za.getGroupConfiguration())}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){yield jo(za.loadGroups,lk),yield jo(za.getGroupById,sk),yield jo(za.createGroup,ck),yield jo(za.updateGroup,dk),yield jo(za.deleteGroup,uk),yield jo(za.addRolesToGroup,yk),yield jo(za.deleteRolesFromGroup,fk),yield jo(za.addUsersToGroup,pk),yield jo(za.deleteUsersFromGroup,gk),yield jo(za.getGroupConfiguration,Sk),yield jo(za.updateGroupConfiguration,vk),yield jo(za.getTeamUsers,rk)}function*mk(){const e=vA.GET_GROUPS;yield ji(za.setUsersGroupsLoader({key:e,value:!0}));const t=Eg;yield ji(za.setGroupsState({groups:t})),yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}function*bk({payload:e}){var t;const n=vA.CREATE_GROUP,{groups:a}=yield ok();yield ji(za.setUsersGroupsLoader({key:n,value:!0})),yield ji(za.setGroupsState({groups:[$({},e,{id:`${e.name}ID`,managedBy:vp.FRONTEGG}),...null!=a?a:[]]})),yield Ji(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ji(za.setUsersGroupsLoader({key:n,value:!1}))}function*Ak({payload:e}){var t,n,a,i,o;const r=vA.UPDATE_GROUP,s=yield ok();yield ji(za.setUsersGroupsLoader({key:r,value:!0})),yield ji(za.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:vp.FRONTEGG}):t})),selectedGroup:$({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(a=null==e?void 0:e.color)?a:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield Ji(500),null==e||null==(o=e.callback)||o.call(e,!0),yield ji(za.setUsersGroupsLoader({key:r,value:!1}))}function*Tk({payload:e}){var t,n;const a=vA.DELETE_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ek({payload:e}){var t,n;const a=vA.ADD_ROLES_TO_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ik({payload:e}){var t,n;const a=vA.DELETE_ROLES_FROM_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*kk({payload:e}){var t,n;const a=vA.ADD_USERS_TO_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ok({payload:e}){var t,n;const a=vA.DELETE_USERS_FROM_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Pk(){const e=vA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield ok();yield ji(za.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ji(za.setGroupsState({groupsConfiguration:$({},t)}))),yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}function*_k({payload:e}){const t=vA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield ok();yield ji(za.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ji(za.setGroupsState({groupsConfiguration:$({},n,e)}))),yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}function*Lk(){yield jo(za.loadGroups,mk),yield jo(za.createGroup,bk),yield jo(za.updateGroup,Ak),yield jo(za.deleteGroup,Tk),yield jo(za.addRolesToGroup,Ek),yield jo(za.deleteRolesFromGroup,Ik),yield jo(za.addUsersToGroup,kk),yield jo(za.deleteUsersFromGroup,Ok),yield jo(za.getGroupConfiguration,Pk),yield jo(za.updateGroupConfiguration,_k)}let wk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.UPDATE_SUB_ACCOUNT_MANAGEMENT="UPDATE_SUB_ACCOUNT_MANAGEMENT",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(wk||(wk={}));const Uk=(e,t,n)=>{var a,i;return e.tenantId===t?$({},e,{name:n}):$({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Uk(e,t,n))))?a:[]})};function Dk(e,t){var n;return $({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Dk(e,t))):[]})}function Rk(e,t,n){var a,i;if(e.tenantId===t){var o;const t=[...null!=(o=null==e?void 0:e.children)?o:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return $({},e,{children:t})}return $({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Rk(e,t,n))))?a:[]})}const Ck=({items:e},t)=>e.map((e=>{var n,a;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(a=t.find((t=>t.tenantId===e.tenantId)))?void 0:a.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata,isReseller:e.isReseller}})),Nk=(e,t,n)=>{var a,i;return e.tenantId===t?$({},e,{isReseller:n}):$({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Nk(e,t,n))))?a:[]})},Mk=()=>qi((e=>e.auth.allAccountsState));function*Fk({payload:e}){const t=wk.GET_ACCOUNTS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Mk(),{jwt:a,_limit:i,_offset:o}=e,r={_offset:null!=o?o:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(a){var s;const{selectedAccount:t}=yield Mk(),{items:n,_links:i}=yield zi(Ip.tenants.searchSubTenants,r,{jwt:a}),o=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:a}),l=Ck({items:n},o),c=Rk(t.accounts?t.accounts:t,null!=(s=null==e?void 0:e._subTenantId)?s:"",l.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next,isReseller:e.isReseller}))));yield ji(za.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield Mk(),{items:n,_links:a}=yield zi(Ip.tenants.searchSubTenants,r),i=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),o=Ck({items:n},i),s=Rk(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",o.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==a?void 0:a.next,isReseller:e.isReseller}))));yield ji(za.setAllAccountsState({accounts:s}))}}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=wk.SEARCH_ACCOUNTS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield Mk(),{jwt:a}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield zi(Ip.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:a});yield ji(za.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=wk.GET_USER_JWT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:a}=e;try{const e=yield zi(Ip.users.GetUserJwt,{tenantId:n});yield ji(za.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==a||a(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),yield ji(za.setSelectedAccountState({accessPermission:!1})),null==a||a(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=wk.CREATE_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:a,tenantId:i,jwt:o,callback:r}=e;try{if(o){const{accounts:e}=yield Mk(),{selectedAccount:t}=yield Mk(),r=yield zi(Ip.subTenants.createSubTenant,{name:n,parentTenantId:a,tenantId:i},{jwt:o}),s=Rk(e,null!=a?a:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Rk($({name:"",tenantId:""},null==t?void 0:t.accounts),null!=a?a:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ji(za.setAllAccountsState({accounts:s})),yield ji(za.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield Mk(),t=yield zi(Ip.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:a}),o=Rk(e,null!=a?a:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ji(za.setAllAccountsState({accounts:o}))}null==r||r(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==r||r(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=wk.DELETE_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:a,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.deleteSubTenant,a,{jwt:n});const i=Dk(t,a),o=Dk(null==e?void 0:e.accounts,a);yield ji(za.setAllAccountsState({accounts:i})),yield ji(za.setSelectedAccountState({accounts:o}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.deleteSubTenant,a);const t=Dk(e,a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_SETTINGS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:a,callback:i,tenantId:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.updateSubTenant,{tenantId:o},{name:a},{jwt:n});const i=Uk(e.accounts,o,a);yield ji(za.setSelectedAccountState({name:a,accounts:i}));const r=Uk(t,o,a);yield ji(za.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.updateSubTenant,{tenantId:o},{name:a});const t=Uk(e,o,a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_MANAGEMENT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,isReseller:a,callback:i,tenantId:o,shouldUpdateSelectedAccount:r}=e,s=!!n;try{if(r){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.updateSubTenantManagement,{tenantId:o},{isReseller:a},n?{jwt:n}:void 0);const i=Nk(e.accounts,o,null!=a&&a);yield ji(za.setSelectedAccountState({accounts:i})),s||(yield ji(za.setSelectedAccountState({isReseller:a})));const r=Nk(t,o,null!=a&&a);yield ji(za.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.updateSubTenantManagement,{tenantId:o},{isReseller:a},n?{jwt:n}:void 0);const t=Nk(e,o,null!=a&&a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=wk.DELETE_USERS_FROM_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:a,jwt:i,callback:o}=e;try{yield zi(Ip.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:a},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:a[0].tenantId})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*zk({payload:e}){const t=wk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:a,jwt:i,callback:o}=e,{selectedAccount:r}=yield Mk();try{yield zi(Ip.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:a},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=wk.ADD_USERS_TO_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:a,jwt:i,callback:o,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield zi(Ip.subTenants.addUsersToSubTenant,{users:n,tenantId:a,allowSubAccountAccess:r,roleIds:s},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:a})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Mk(),{userId:a,allowAccess:i,jwt:o,callback:r}=e;try{var s;yield zi(Ip.subTenants.updateSubAccountAccess,a,{allowAccess:i},{jwt:o}),yield ji(za.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===a?$({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==r||r(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){var t,n,a,i,o,r,s,l;const c=wk.GET_ACCOUNT_USERS;yield ji(za.setAllAccountsLoader({key:c,value:!0}));const d=yield Mk(),{jwt:u,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==d||null==(a=d.selectedAccount)||null==(i=a.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(o=null!=(r=null==e?void 0:e._limit)?r:null==d||null==(s=d.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?o:10,S=$({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield zi(Ip.users.getUsersV3,S,{jwt:u}),a={totalUsersItems:t,totalUsersPages:n,usersQueryParams:$({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield zi(Ip.roles.getRoles),i=yield zi(Ip.users.getUsersRoles,{ids:t},{jwt:u}),o=e.map((e=>{var t,a;const o=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return $({},e,{roles:null!=(a=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?a:[]})}));yield ji(za.setSelectedAccountState($({users:o},a)))}else yield ji(za.setSelectedAccountState($({users:[]},a)))}catch(e){yield ji(za.setAllAccountsError({key:c,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:c,value:!1}))}}function*Jk({payload:e}){const t=wk.SET_SELECTED_SUB_ACCOUNT_DATA;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var a,i,o,r,s,l,c;const e=yield zi(Ip.accountSettings.getSettings,{jwt:n}),d=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[null!=(a=null==e?void 0:e.tenantId)?a:""]},{jwt:n}),u=yield zi(Ip.tenants.getParentTenants,{jwt:n}),y=yield zi(Ip.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield ji(za.setSelectedAccountState({tenantId:null!=(o=e.tenantId)?o:"",name:e.name,numberOfUsersObject:d[0],parentsAccounts:u,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=d[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield ji(za.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Yk(){const e=wk.SET_ROOT_ACCOUNT_DATA;yield ji(za.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield qi((e=>e.auth.tenantsState)),{accounts:n}=yield Mk();if(t)try{var a;const i=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),o={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(a=i[0])?void 0:a.totalUsers,createdAt:null==t?void 0:t.createdAt};yield ji(za.setAllAccountsState({rootAccount:o,accounts:$({},n,o)}))}catch(t){yield ji(za.setAllAccountsError({key:e,value:jg(t)}))}finally{yield ji(za.setAllAccountsLoader({key:e,value:!1}))}}function*Xk({payload:e}){const t=wk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:a}=e;try{const e=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:a});yield ji(za.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Qk(){yield jo(za.loadAccounts,Fk),yield jo(za.searchAccounts,Gk),yield jo(za.updateSubAccountAccessForUser,Hk),yield jo(za.getUserJwtForSubAccount,$k),yield jo(za.createSubAccount,xk),yield jo(za.deleteSubAccount,Vk),yield jo(za.updateSubAccountSettings,jk),yield jo(za.updateSubAccountManagement,Bk),yield jo(za.addUsersToAccount,Kk),yield jo(za.deleteUsersFromAccount,Wk),yield jo(za.setUserRolesForSubAccount,zk),yield jo(za.getAccountUsers,qk),yield jo(za.setRootAccountData,Yk),yield jo(za.setSelectedSubAccountData,Jk),yield jo(za.loadNumberOfUsersForSelectedSubAccount,Xk)}const Zk=["callback"],eO=["callback"],tO=["callback","phoneId"],nO=["callback","phoneId"],aO=["callback"];function*iO(){yield ji(za.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield zi(Ip.userPhoneNumbers.getUserPhoneNumbers,e);yield ji(za.setSmsState({phoneNumbers:t}))}catch(e){yield ji(za.setSmsState({error:jg(e)}))}finally{yield ji(za.setSmsState({loading:!1}))}}function*oO(e){let{payload:{callback:t}}=e,n=ii(e.payload,Zk);yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.createPhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*rO(e){let{payload:{callback:t}}=e,n=ii(e.payload,eO);yield ji(za.setSmsState({loading:!0}));try{yield zi(Ip.userPhoneNumbers.verifyPhoneNumber,n),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*sO(e){let{payload:{callback:t,phoneId:n}}=e;ii(e.payload,tO),yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.deletePhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*lO(e){let{payload:{callback:t,phoneId:n}}=e,a=ii(e.payload,nO);yield ji(za.setSmsState({loading:!0}));try{yield zi(Ip.userPhoneNumbers.verifyDeletePhoneNumber,n,a),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*cO(e){let{payload:{callback:t}}=e,n=ii(e.payload,aO);yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.preVerifyPhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*dO(){yield Vo(za.loadPhoneNumbers,iO),yield Vo(za.setUpPhoneNumber,oO),yield Vo(za.verifyPhoneNumber,rO),yield Vo(za.deletePhoneNumber,sO),yield Vo(za.verifyDeletePhoneNumber,lO),yield Vo(za.preVerifyPhoneNumber,cO)}function*uO(e){yield zi(bv,e),yield zi(Lv)}function*yO({mfaToken:e,mfaDevices:t}){yield ji(za.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield zi($g,t);yield ji(za.setMfaState({step:n}))}function*fO(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield ji(za.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(Ev,"true");const{routes:t}=yield qi((e=>e.auth));Wo.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*pO({payload:{maxAge:e,callback:t}}){yield ji(za.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield zi(Ip.auth.generateStepupSession,{maxAge:e});n.user?yield zi(uO,n):yield zi(yO,n),null==t||t(!0)}catch(e){null==t||t(!1),yield zi(fO,e)}}function*gO({payload:e}){const t={acr_values:Av},{maxAge:n}=e||{};void 0!==n&&(t.max_age=n.toString());const a=yield qi((({auth:e})=>{var t,n;return null==(t=e.tenantsState)||null==(n=t.activeTenant)?void 0:n.alias}));a&&(t.organization=a),kv(),window.localStorage.setItem(Ev,"true"),yield Mh(t)}function*SO({payload:e}){yield Cv(e,za.setStepUpState,!0)}function*vO({payload:e}){yield Hv(e,za.setStepUpState)}function*hO({payload:e}){yield qv(e,za.setStepUpState,!0)}function*mO({payload:e}){yield Vv(e,za.setStepUpState)}function*bO({payload:e}){yield jv(e,za.setStepUpState,!0)}function*AO({payload:e}){yield eh(e,za.setStepUpState)}function*TO({payload:e}){yield Zv(e,za.setStepUpState)}function*EO(){yield Bo(za.stepUpHostedLogin,gO),yield Bo(za.generateStepUpSession,pO),yield Bo(za.stepUpWithAuthenticator,SO),yield Bo(za.preVerifyMFASMSForStepUp,mO),yield Bo(za.verifyMFASMSForStepUp,bO),yield Bo(za.preVerifyMFAWebAuthnForStepUp,vO),yield Bo(za.verifyMFAWebAuthnForStepUp,hO),yield Bo(za.verifyMFAEmailCodeForStepUp,AO),yield Bo(za.preVerifyMFAEmailCodeForStepUp,TO)}const IO={sagas:function*(){yield Bi([zi(lm),zi(EO),zi(rA),zi(lA),zi(Yb),zi(HE),zi(Im),zi(Qm),zi(ib),zi(Qg),zi(Mb),zi(_T),zi(hk),zi(XT),zi(ov),zi(sE),zi(xS),zi(SE),zi(IE),zi(GE),zi(ZE),zi(lI),zi(RI),zi(XI),zi(ek),zi(ak),zi(Qk),zi(vv),zi(dS),zi(dO),zi(_A)])},mockSagas:function*(){yield Bi([zi(um),zi(Um),zi(lb),zi(zb),zi(BT),zi(fE),zi(ZS),zi(aI),zi(mE),zi(OE),zi(uI),zi(BI),zi(xE),zi(Lk),zi(vS)])},storeName:Nt,initialState:Ga,reducer:Ba,actions:za},kO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>$({},t,{[e]:$({},t[e],n)})}),OO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},PO={setAuditLogsState:kO("auditLogsState"),resetAuditLogsState:e=>$({},e,{auditLogsState:OO})},_O={exportAuditsCsv:ft("auditLogs/exportAuditsCsv"),loadAuditLogs:ft("auditLogs/loadAuditLogs",(e=>({payload:e})))},LO={loading:!0},wO={setAuditsMetadataState:kO("auditsMetadataState"),resetAuditsMetadataState:e=>$({},e,{auditsMetadataState:LO})},UO={loadAuditsMetadata:ft("auditLogs/loadAuditsMetadata")},DO={auditLogsState:OO,auditsMetadataState:LO},{reducer:RO,actions:CO}=gt({name:Ft,initialState:DO,reducers:$({resetState:e=>$({},e,DO),setState:(e,{payload:t})=>$({},e,t)},PO,wO)}),NO=$({},CO,_O,UO),MO=e=>"createdAt"!==e.id,FO={total:20,data:Array.from(Array(5).keys()).map((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`})))},GO={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}]},$O=()=>qi((e=>e.auditLogs.auditLogsState)),xO=()=>qi((e=>e.auditLogs.auditsMetadataState));function*VO(){const e=yield $O(),{columns:t}=yield xO();try{const n=e.filter,a=e.sort.reduce(((e,t)=>$({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>$({},e,{[t.id]:t.value})),{});yield ji(NO.setAuditLogsState({isDownloadingCsv:!0}));const o="audits.csv";yield Ip.audits.exportAudits($({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:o},a,i))}catch(e){console.error("failed to export audits - ",e)}yield ji(NO.setAuditLogsState({isDownloadingCsv:!1}))}function*jO({payload:e}){yield ji(NO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield $O(),{columns:n}=yield xO();try{var a,i,o,r,s;const l=null!=(a=e.pageSize)?a:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,d=null!=(o=e.filter)?o:t.filter,u=null!=(r=e.sort)?r:t.sort;yield ji(NO.setAuditLogsState({pageSize:l,pageOffset:c,filter:d,sort:u}));const y=u.reduce(((e,t)=>$({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=d.reduce(((e,t)=>$({},e,{[t.id]:t.value})),{});n||(yield ji(NO.loadAuditsMetadata()));const{data:p,total:g}=yield zi(Ip.audits.getAudits,$({offset:c,count:l},y,f));yield ji(NO.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield ji(NO.setAuditLogsState({loading:!1,error:jg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*BO(){yield Vo(NO.exportAuditsCsv,VO),yield Vo(NO.loadAuditLogs,jO)}function*WO({payload:e}){yield ji(NO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield $O(),{columns:n}=yield xO();try{var a,i,o,r,s;const l=null!=(a=e.pageSize)?a:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,d=null!=(o=e.filter)?o:t.filter,u=null!=(r=e.sort)?r:t.sort;yield ji(NO.setAuditLogsState({pageSize:l,pageOffset:c,filter:d,sort:u})),n||(yield ji(NO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=FO;let a=n.filter((e=>t=>e.filter(MO).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];a=a.sort(((e,t)=>(n,a)=>n[e]>a[e]?t?-1:1:a[e]>n[e]?t?1:-1:0)(e,n))}return{data:a,total:a.length}})(d,u);yield ji(NO.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield ji(NO.setAuditLogsState({loading:!1,error:jg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*zO(){yield Vo(NO.loadAuditLogs,WO)}function*KO(){yield ji(NO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield zi(Ip.metadata.getAuditsMetadata);yield ji(NO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(NO.setAuditsMetadataState({error:e,loading:!1}))}}function*HO(){yield Vo(NO.loadAuditsMetadata,KO)}function*qO(){yield ji(NO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=GO;yield ji(NO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(NO.setAuditsMetadataState({error:e,loading:!1}))}}function*JO(){yield Vo(NO.loadAuditsMetadata,qO)}const YO={sagas:function*(){yield Bi([zi(BO),zi(HO)])},mockSagas:function*(){yield Bi([zi(zO),zi(JO)])},storeName:Ft,initialState:DO,reducer:RO,actions:NO},XO={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:QO,actions:ZO,reducer:eP}=gt({name:"audits",initialState:XO,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.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]})))}}}),tP=$({},ZO,{initData:ft(`${QO}/initData`),loadAudits:ft(`${QO}/loadAudits`),removeFilter:ft(`${QO}/removeFilter`),filterData:ft(`${QO}/filterData`),exportCSV:ft(`${QO}/exportCSV`),deleteAudits:ft(`${QO}/deleteAudits`)}),nP=()=>qi((e=>e[QO]));function*aP(){const{sortBy:e,sortDirection:t}=yield nP();try{const n=yield zi(Ip.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ji(tP.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ji(tP.loadItemFailedAction(t))}}function*iP(){try{const e=yield zi(Ip.metadata.getAuditsMetadata);yield ji(tP.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ji(tP.loadItemFailedAction(t))}}const oP=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*rP({payload:e}){const{filters:t,sortBy:n,sortDirection:a,filter:i,offset:o,virtualScroll:r}=yield nP(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:d}=s?yield nP():{rowsData:[]};try{const e=oP(t),{data:s,total:u}=yield zi(Ip.audits.getAudits,$({},r&&{paginationMode:"virtual"},{sortDirection:a,sortBy:n,filter:i},e,{offset:r?d.length+c||d.length+o:c||o,count:20}));yield ji(tP.loadAuditsSuccess({rowsData:[...d,...s],total:u})),l&&(yield ji(tP.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ji(tP.loadItemFailedAction(t))}}function*sP(){yield ji(tP.startLoading()),yield Bi([aP(),iP(),rP({payload:{onlyOneLoad:!1},type:""})]),yield ji(tP.finishLoading())}function*lP({payload:e}){const{filters:t}=yield nP(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const a=[...t.slice(0,n),...t.slice(n+1)];yield ji(tP.setFilterData(a))}function*cP({payload:e}){const{filters:t}=yield nP();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const a=[...t.slice(0,n),e,...t.slice(n+1)];yield ji(tP.setFilterData(a))}function*dP(){const{filters:e,sortBy:t,sortDirection:n,filter:a,headerProps:i}=yield nP(),o=oP(e);yield ji(tP.startDownloadingCsv());try{yield Ip.audits.exportAudits($({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:a},o,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ji(tP.stopDownloadingCsv())}}function*uP(){yield jo(tP.initData,sP),yield jo(tP.removeFilter,lP),yield jo(tP.filterData,cP),yield jo([tP.loadAudits,tP.textSearch,tP.onPageChange],rP),yield jo([tP.setFilterData,tP.setDataSorting,tP.startRefresh],(()=>rP({payload:{appendMode:!1},type:""}))),yield jo(tP.exportCSV,dP)}const yP={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},fP={initData:()=>$({},yP),setConnectivityState:(e,{payload:t})=>$({},e,t),cleanWebhookTestData:e=>$({},e,{testResult:void 0}),cleanWebhookLogsData:e=>$({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return $({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>$({},e,{error:void 0}),cleanSlackData:e=>$({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>$({},e,{retryResult:$({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>$({},e,{retryResult:$({},e.retryResult,t)})}},pP={loadSlackActions:ft("connectivity/loadSlackActions"),loadDataAction:ft("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ft("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ft("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ft("connectivity/loadScope"),deleteWebhookConfigAction:ft("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ft("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ft("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},gP={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:SP,actions:vP}=gt({name:Mt,initialState:gP,reducers:$({},fP)}),hP=$({},vP,pP),mP={slack:Ip.connectivity.getSlackConfiguration,email:Ip.connectivity.getEmailConfiguration,sms:Ip.connectivity.getSMSConfiguration,webhook:Ip.connectivity.getWebhooksConfigurations,categories:Ip.connectivity.getCategories,channelMap:Ip.connectivity.getChannelMaps},bP={slack:Ip.connectivity.postSlackConfiguration,email:Ip.connectivity.postEmailConfiguration,sms:Ip.connectivity.postSMSConfiguration,webhook:Ip.connectivity.postWebhooksConfiguration},AP=["email","slack","sms","webhook"],TP={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"}},EP=["id"],IP=["id","enabled"],kP=["categories","channelMap"];function*OP(e){return yield zi(_P,{payload:{api:e},type:""})}function*PP({payload:e=AP}){yield ji(hP.setConnectivityState({isLoading:!0}));try{const t=yield Bi([...e.map(OP),yield _P({payload:{api:"categories"},type:""}),yield function*(){return(yield Bi(e.map((function*(e){return yield _P({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,a)=>$({},t,{[`${e[a]}`]:n})),{})}()]),n=yield _P({payload:{api:"webhook"},type:""}),a=t.reduce(((n,a,i)=>e[i]?t[t.length-1][e[i]].length?$({},n,{[`${e[i]}`]:a,list:[...n.list,{id:i,key:e[i],events:TP[e[i]].events(a),active:TP[e[i]].isActive(a),platform:TP[e[i]].title,image:TP[e[i]].image}]}):n:$({},n,{[`${kP[i-e.length]}`]:a})),{list:[],webhook:n});yield ji(hP.setConnectivityState($({},a,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ji(hP.setConnectivityState({isLoading:!1}))}}function*_P({payload:{api:e,params:t}}){try{return yield zi(mP[e],t)}catch(e){return}}function*LP(){try{yield ji(hP.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield zi(Ip.connectivity.getSlackChannels);yield ji(hP.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ji(hP.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*wP(e,t){const{connectivity:{list:n}}=yield qi(),a=n.find((({key:t})=>t===e));if(!a)return;const i=TP[e].isActive(t);i!==a.active&&(yield ji(hP.setConnectivityState({list:n.map((t=>t.key===e?$({},t,{active:i}):t))})))}function*UP({payload:{platform:e,data:t,callback:n}}){const{processIds:a}=yield qi((e=>e.connectivity));try{if(yield ji(hP.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...a]:a})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:a}=e;yield Bi([...a.reduce(((e,t)=>{var a,i;return!t.id&&t.slackEvents&&null!=(a=t.slackEvents[0].channelIds)&&a.length||(null==n?void 0:n.find((e=>{let{id:n}=e,a=ii(e,EP);return n===t.id&&JSON.stringify($({id:n},a))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield zi(bP.slack,e)})),...a.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield zi(Ip.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield qi(),{processIds:a}=yield qi((e=>e.connectivity)),i=n[t];if(!i)return;let o=[];try{o=yield Bi([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield zi("email"===t?Ip.connectivity.postEmailConfiguration:Ip.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:a}=e,i=n[0],{id:o="",enabled:r}=i,s=ii(i,IP);return yield Bi([yield zi("email"===t?Ip.connectivity.patchEmailConfiguration:Ip.connectivity.patchSMSConfiguration,{eventKey:a,enabled:r}),yield zi("email"===t?Ip.connectivity.putEmailSubscriptions:Ip.connectivity.putSMSSubscriptions,o,a,$({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return zi("email"===t?Ip.connectivity.deleteEmailSubscriptions:Ip.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(o.length){const e=yield _P({payload:{api:t},type:""});yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?a.filter((t=>t!==e.id)):a})),yield wP(t,e)}else yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:a}))}({payload:t,type:e}):yield zi(bP[e],t),!["sms","email"].includes(e)){const i=yield _P({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?a.filter((e=>e!==i.id)):a})),yield wP(e,i),null==n||n(!0)}}catch(e){yield ji(hP.setConnectivityState({error:jg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*DP({payload:e}){try{yield Ip.connectivity.postSlackCode(e)}catch{}yield ji(hP.setConnectivityState({error:void 0,isSaving:!1}))}function*RP(){const{slackChannels:e}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({slackChannels:$({},e,{isLoadingScope:!0})}));const{clientId:t}=yield zi(Ip.connectivity.getSlackScope);yield ji(hP.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ji(hP.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*CP({payload:e}){const{callback:t,webhookId:n}=e,{processIds:a}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({isSaving:!0})),yield zi(Ip.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,jg(e))}const i=yield _P({payload:{api:"webhook"},type:""});i&&(yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?a.filter((e=>e!==i.id)):a}))),null==t||t(!0)}function*NP({payload:e}){try{yield ji(hP.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield zi(Ip.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*MP({payload:e}){try{const{statusCode:t}=yield zi(Ip.connectivity.postWebhookRetry,e);yield ji(hP.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ji(hP.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*FP({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:a}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({webhookLogs:$({},a,{isLoading:!0})}));const i=yield zi(Ip.connectivity.getWebhookLog,e,n,t);yield ji(hP.setConnectivityState({error:void 0,webhookLogs:$({isLoading:!1},i)}))}catch(e){yield ji(hP.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}const GP={sagas:function*(){yield Vo(hP.loadDataAction,PP),yield jo(hP.loadSlackActions,LP),yield Vo(hP.postDataAction,UP),yield Vo(hP.postCodeAction,DP),yield Vo(hP.loadScope,RP),yield Vo(hP.deleteWebhookConfigAction,CP),yield Vo(hP.postWebhookTestAction,NP),yield Vo(hP.postWebhookRetryAction,MP),yield jo(hP.loadWebhookLogsAction,FP)},storeName:Mt,initialState:gP,reducer:SP,actions:hP};function $P(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,t.payload)}}}function xP(e,t){return{prepare:e=>({payload:e}),reducer:(n,a)=>$({},n,{[e]:t(n[e],a)})}}function VP(e){return xP(e,((e,t)=>$({},e,{loading:t.payload})))}function jP(e){return xP(e,((e,t)=>$({},e,{error:t.payload,loading:!1})))}const BP={loading:!1,error:null,fetching:!0,plans:[]},{actions:WP,reducer:zP,name:KP}=gt({name:"subscriptions/plans",initialState:BP,reducers:$({},$P())}),HP=$({loadPlans:ft(`${KP}/loadPlans`)},WP),qP={loading:!1,error:null,fetching:!0,config:null},JP=$({},$P()),{actions:YP,reducer:XP,name:QP}=gt({name:"subscriptions/config",initialState:qP,reducers:JP}),ZP=$({loadPaymentConfiguration:ft(`${QP}/loadPaymentConfiguration`)},YP),e_={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},t_=$({},$P(),{setCancellationLoading:VP("cancellation"),setCancellationError:jP("cancellation"),setRenewalLoading:VP("renewal"),setRenewalError:jP("renewal")}),{reducer:n_,actions:a_,name:i_}=gt({name:"subscriptions/billing/subscription",initialState:e_,reducers:t_}),o_=$({load:ft(`${i_}/loadSubscription`),cancelSubscription:ft(`${i_}/cancelSubscription`),renewSubscription:ft(`${i_}/renewSubscription`)},a_),r_={loading:!1,error:null,fetching:!0},s_=$({},$P()),{reducer:l_,actions:c_,name:d_}=gt({name:"subscriptions/billing/information",initialState:r_,reducers:s_}),u_=$({loadBillingInformation:ft(`${d_}/loadBillingInformation`),cancelSubscription:o_.cancelSubscription,renewSubscription:o_.renewSubscription},c_),y_={loading:!1,error:null,fetching:!0},f_=$({},$P(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,t.payload)}}),{reducer:p_,actions:g_,name:S_}=gt({name:"subscriptions/billing/payment",initialState:y_,reducers:f_}),v_=$({loadPaymentMethod:ft(`${S_}/loadPaymentMethod`),submitPaymentMethod:ft(`${S_}/submitPaymentMethod`),submitPaymentMethodError:ft(`${S_}/submitPaymentMethodError`),submitPaymentMethodSuccess:ft(`${S_}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ft(`${S_}/updateBillingDetails`,(e=>({payload:e})))},g_),h_={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},m_=$({},$P(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{invoiceDownload:$({},e.invoiceDownload,t.payload)})}}),{reducer:b_,actions:A_,name:T_}=gt({name:"subscriptions/billing/invoices",initialState:h_,reducers:m_}),E_=$({loadInvoices:ft(`${T_}/loadInvoices`),downloadInvoice:ft(`${T_}/downloadInvoice`,(e=>({payload:e})))},A_),I_={information:r_,invoices:h_,paymentMethod:y_,subscription:e_},k_={invoices:E_,information:u_,paymentMethod:v_,subscription:o_},O_=He({invoices:b_,information:l_,paymentMethod:p_,subscription:n_}),P_={fetching:!0,loading:!1,error:null,confirmed:!1},__=$({},$P()),{actions:L_,reducer:w_,name:U_}=gt({name:"subscriptions/checkout",initialState:P_,reducers:__}),D_=$({loadCheckout:ft(`${U_}/loadCheckout`),resetCheckout:ft(`${U_}/resetCheckout`),submitCheckout:ft(`${U_}/submitCheckout`),confirmCheckout:ft(`${U_}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ft(`${U_}/errorCheckout`,(e=>({payload:e})))},L_),R_={loading:!1,error:null,cardSetupIntentSecret:null},C_=$({},$P()),{reducer:N_,actions:M_,name:F_}=gt({name:"subscriptions/stripe",initialState:R_,reducers:C_}),G_=$({loadCustomer:ft(`${F_}/loadCustomer`),createCardSetupIntentSecret:ft(`${F_}/createCardSetupIntentSecret`)},M_),$_={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:x_,reducer:V_,name:j_}=gt({name:"subscriptions/vendorPublicConfig",initialState:$_,reducers:$({},$P())}),B_=$({loadVendorPublicConfiguration:ft(`${j_}/loadVendorPublicConfiguration`)},x_),W_={config:qP,plans:BP,checkout:P_,billing:I_,stripe:R_,vendorPublicConfig:$_},z_={config:ZP,billing:k_,plans:HP,checkout:D_,stripe:G_,vendorPublicConfig:B_},K_=He({config:XP,billing:O_,plans:zP,checkout:w_,stripe:N_,vendorPublicConfig:V_});let H_,q_,J_;function Y_({policy:e}){return{policy:J_.AT_PERIOD_END}}function X_(e){switch(e){case of.ACTIVE:return q_.ACTIVE;case of.INCOMPLETE:return q_.INCOMPLETE;case of.CANCELED:return q_.CANCELED;case of.EXPIRED:return q_.EXPIRED;case of.TRIALING:return q_.TRIALING;default:return q_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(H_||(H_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(q_||(q_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(J_||(J_={}));const Q_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:of.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},Z_=[{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"}],eL=[{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:""}],tL=[{id:"id",externalId:"externalId",type:rf.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],nL={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*aL(){yield ji(o_.setLoading(!0));try{const[e]=yield zi(Ip.subscriptions.getManagedSubscriptions);yield ji(o_.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ji(o_.setError(e))}}function*iL(){yield Vo(u_.loadBillingInformation,oL)}function*oL(){yield function*(e){const t=yield qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield rL(n,!1):yield ji(u_.setError(t?"Not authorized":"Internal feature failure"))}()}function*rL(e,t){yield ji(u_.setLoading(!0));try{var n,a;const i=yield zi(Ip.subscriptions.getSubscriptionSummaries,e),{currentPlanId:o,externallyManaged:r}=i;let s,l=null;r?s=yield zi(Ip.subscriptions.getSubscriptionPlan,o):([,s]=yield Bi([zi(aL),zi(Ip.subscriptions.getSubscriptionPlan,o)]),l=yield qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ji(u_.setState($({loading:!1,fetching:!1,summary:i},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?q_.ACTIVE:X_(l.status),cancellation:l.cancellation&&Y_(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(a=s.price)?void 0:a.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield ji(u_.setError(jg(e)))}}function*sL(){yield function*(){var e,t;yield ji(u_.setLoading(!0)),yield Ji(500),yield ji(u_.setState({loading:!1,fetching:!1,summary:{subscriptionId:Q_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:lf.Stripe,externallyManaged:!1,currentPlanId:Z_[0].id,defaultPlanId:Z_[0].id},plan:$({},Z_[0],{price:null==(e=Z_[0].price)?void 0:e.amount,currency:null==(t=Z_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*lL(){yield Vo(u_.loadBillingInformation,sL)}function*cL(){yield Vo(v_.loadPaymentMethod,dL),yield Vo(v_.submitPaymentMethod,yL),yield Vo(v_.submitPaymentMethodError,fL),yield Vo(v_.submitPaymentMethodSuccess,pL),yield Vo(v_.updatePaymentMethodBillingDetails,uL)}function*dL(){yield ji(v_.setLoading(!0));try{const e=(yield zi(Ip.subscriptions.getPaymentMethods))[0];yield ji(v_.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ji(v_.setError(jg(e)))}}function*uL({payload:e}){yield ji(v_.setLoading(!0));const{id:t,email:n,address:a,callback:i}=e;try{yield zi(Ip.subscriptions.updatePaymentMethodBillingDetails,t,$({email:n},a)),yield zi(dL),null==i||i(!0)}catch(e){yield ji(v_.setError(jg(e))),null==i||i(!1)}yield ji(v_.setLoading(!1))}function*yL(){yield ji(v_.setLoading(!0))}function*fL({payload:e}){yield ji(v_.setError(e))}function*pL(){yield ji(v_.loadPaymentMethod())}function*gL(){yield ji(v_.setLoading(!0)),yield Ji(500);const e=tL[0];yield ji(v_.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*SL(){yield Vo(v_.loadPaymentMethod,gL)}function*vL(){yield Vo(E_.loadInvoices,hL),yield Vo(E_.downloadInvoice,mL)}function*hL(){yield ji(E_.setLoading(!0));try{const e=(yield zi(Ip.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 ji(E_.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ji(E_.setError(jg(e)))}}function*mL({payload:e}){yield ji(E_.setInvoiceDownloadState({loading:!0,error:null}));try{yield zi(Ip.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ji(E_.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ji(E_.setInvoiceDownloadState({loading:!1,error:jg(e,null)}))}}function*bL(){yield ji(E_.setLoading(!0)),yield Ji(500),yield ji(E_.setState({loading:!1,fetching:!1,invoices:eL.map((e=>$({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ji(E_.setLoading(!1))}function*AL(){yield Vo(E_.loadInvoices,bL)}function*TL(){yield Vo(o_.load,EL),yield Vo(o_.cancelSubscription,IL),yield Vo(o_.renewSubscription,kL)}function*EL(){const e=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield rL(e)}function*IL(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(o_.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(o_.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:a}=e||{};if(!n&&a===of.ACTIVE)try{yield ji(o_.setCancellationLoading(!0)),yield zi(Ip.subscriptions.cancelManagedSubscription,t),yield aL(),yield ji(o_.setCancellationLoading(!1))}catch(e){yield ji(o_.setCancellationError(jg(e)))}}function*kL(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(o_.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(o_.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===sf.AT_PERIOD_END)try{yield ji(o_.setRenewalLoading(!0)),yield zi(Ip.subscriptions.renewManagedSubscription,t),yield aL(),yield ji(o_.setRenewalLoading(!1))}catch(e){yield ji(o_.setCancellationError(jg(e)))}}function*OL(){yield ji(o_.setLoading(!0)),yield Ji(500),yield ji(o_.setState({subscription:Q_,fetching:!1,loading:!1,error:null}))}function*PL(){yield Vo(o_.load,OL)}function*_L(){yield Bi([zi(iL),zi(cL),zi(vL),zi(TL)])}function*LL(){yield Bi([zi(lL),zi(SL),zi(AL),zi(PL)])}function*wL(){yield Vo(D_.loadCheckout,UL),yield Vo(D_.resetCheckout,DL),yield Vo(D_.submitCheckout,RL),yield Vo(D_.confirmCheckout,CL),yield Vo(D_.errorCheckout,ML)}function*UL(){yield ji(D_.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*DL(){yield ji(D_.setState({loading:!1,error:null,confirmed:!1}))}function*RL(){yield ji(D_.setState({loading:!0,error:null}))}function*CL({payload:{paymentMethodId:e,planId:t}}){const n=yield qi((e=>e.subscriptions.billing.subscription.subscription)),a=yield qi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===of.TRIALING,o=!(null==a||!a.paymentMethodId);if(n){if(yield ji(D_.setState({loading:!0,error:null})),i&&o)return yield NL(),void(yield ji(o_.setState({subscription:$({},n,{status:of.ACTIVE})})));try{yield zi(Ip.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Bi([oL(),dL(),hL()]),yield NL()}catch(e){yield ji(D_.setState({loading:!1,error:jg(e)}))}}else yield ji(D_.setState({loading:!1,error:"Subscription not found"}))}function*NL(){yield ji(D_.setState({loading:!1,error:null,confirmed:!0}))}function*ML({payload:e}){yield ji(D_.setState({loading:!1,error:e}))}function*FL(){yield Vo(D_.resetCheckout,DL)}function*GL(){yield Vo(HP.loadPlans,$L)}function*$L(){yield ji(HP.setLoading(!0));try{const e=(yield zi(Ip.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 ji(HP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ji(HP.setError(jg(e)))}}function*xL(){yield ji(HP.setLoading(!0)),yield Ji(500),yield ji(HP.setState({fetching:!1,loading:!1,plans:Z_.map((e=>{var t,n;return $({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*VL(){yield Vo(HP.loadPlans,xL)}function*jL(){yield Vo(ZP.loadPaymentConfiguration,BL)}function*BL(){yield ji(ZP.setLoading(!0));try{(yield zi(Ip.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===lf.Stripe))?yield function*(){yield ji(ZP.setLoading(!0));try{const e=yield zi(Ip.subscriptions.getStripePaymentProviderConfiguration);yield ji(ZP.setState({loading:!1,fetching:!1,config:{paymentProvider:H_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ji(ZP.setError(jg(e)))}}():yield ji(ZP.setError("Payment provider not configured"))}catch(e){yield ji(ZP.setError(jg(e)))}}function*WL(){yield ji(ZP.setLoading(!0)),yield Ji(500),yield ji(ZP.setState({loading:!1,fetching:!1,config:{paymentProvider:H_.STRIPE,apiKey:""}}))}function*zL(){yield Vo(ZP.loadPaymentConfiguration,WL)}function*KL(){yield Vo(G_.createCardSetupIntentSecret,HL)}function*HL({payload:e}){yield ji(G_.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield zi(Ip.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ji(G_.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ji(G_.setError(jg(e)))}}function*qL(){yield Vo(B_.loadVendorPublicConfiguration,JL)}function*JL(){yield ji(B_.setLoading(!0));try{const e=yield zi(Ip.subscriptions.getVendorPublicConfigurations);yield ji(B_.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ji(B_.setError(jg(e)))}}function*YL(){yield ji(B_.setLoading(!0)),yield Ji(500),yield ji(B_.setState({fetching:!1,loading:!1,vendorPublicConfig:nL}))}function*XL(){yield Vo(B_.loadVendorPublicConfiguration,YL)}const QL={sagas:function*(){yield Bi([zi(_L),zi(wL),zi(GL),zi(jL),zi(KL),zi(qL)])},mockSagas:function*(){yield Bi([zi(LL),zi(FL),zi(VL),zi(zL),zi(XL)])},reducer:K_,actions:z_,initialState:W_,storeName:"subscriptions"},ZL={sagas:function*(){yield Vo(uv.loadVendorPublicInfo,yv)},storeName:Gt,initialState:lv,reducer:cv,actions:uv},{reducer:ew}=gt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Wo.setContext(t),$({},e,{context:t}))}}}),tw=(e,t,n=!1,a,i,o=!1,r="path")=>{const s="undefined"==typeof window;let l=t;if(s&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var c,d,u,y,f,p,g,S,v,h;n||o||Wo.setContext(e.context);const t=Do(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=yt({middleware:s,preloadedState:{root:$({},e,{previewMode:n,urlStrategy:r}),[IO.storeName]:$({},IO.initialState,a,null!=(c=null==i?void 0:i.auth)?c:{},{routes:$({},IO.initialState.routes,null!=(d=null==a?void 0:a.routes)?d:{},null!=(u=null==i||null==(y=i.auth)?void 0:y.routes)?u:{})}),[YO.storeName]:$({},YO.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:$({},YO.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:$({},YO.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[QO]:$({},XO,null!=(h=null==i?void 0:i.audits)?h:{}),[GP.storeName]:GP.initialState,[QL.storeName]:QL.initialState,[ZL.storeName]:ZL.initialState},reducer:He({root:ew,[IO.storeName]:IO.reducer,[YO.storeName]:YO.reducer,[QO]:eP,[GP.storeName]:GP.reducer,[QL.storeName]:QL.reducer,[ZL.storeName]:ZL.reducer})});const m=function*(){yield Bi([zi(IO.sagas),zi(YO.sagas),zi(uP),zi(GP.sagas),zi(QL.sagas),zi(ZL.sagas)])},b=function*(){yield Bi([zi(IO.mockSagas),zi(YO.mockSagas),zi(QL.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(za.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel,l.store.subscribeStateChanged=e=>{let t=l.store.getState();return l.store.subscribe((()=>{const n=l.store.getState();t!=n&&(t=n,e(n))}))}}return l.store};var nw=n(9314);const aw=()=>{if(!Wo.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")};var iw=n(9714),ow=n.n(iw);function rw(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function sw(e){if(e.type)return e;if("#"===e.charAt(0))return sw(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 a=e.substring(t+1,e.length-1);let i,o;if("color"===n){if(o=a.split(" "),i=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else o=a.split(",");return{type:n,values:o.map((e=>parseFloat(e))),colorSpace:i}}function lw(e){const{type:t,colorSpace:n}=e;let{values:a}=e;return-1!==t.indexOf("rgb")?a=a.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(a[1]=`${a[1]}%`,a[2]=`${a[2]}%`),a=-1!==t.indexOf("color")?`${n} ${a.join(" ")}`:`${a.join(", ")}`,`${t}(${a})`}function cw(e){if(0===e.indexOf("#"))return e;const{values:t}=sw(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 dw(e,t){return e=sw(e),t=rw(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,lw(e)}function uw(e,t){if(e=sw(e),t=rw(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 lw(e)}function yw(e,t){if(e=sw(e),t=rw(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 lw(e)}const fw=e=>{if(e)return{main:e,light:cw(yw(e,.4)),dark:cw(uw(e,.15)),hover:cw(uw(e,.15)),active:cw(uw(e,.2))}},pw=e=>{if(e)return{main:e,light:yw(e,.7),dark:uw(e,.2)}},gw=(e,t)=>{var n,a,i,o,r,s,l,c,d,u,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?$({},t,{palette:{primary:$({},fw(null==e||null==(a=e.palette)?void 0:a.primary),{contrastText:null!=(i=null==e||null==(o=e.palette)?void 0:o.primaryText)?i:"#000000"}),secondary:$({},fw(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:$({},fw(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:$({},pw(null==e||null==(d=e.palette)?void 0:d.success),{contrastText:"#FFF"}),error:$({},pw(null==e||null==(u=e.palette)?void 0:u.error),{contrastText:"#FFF"}),warning:$({},pw(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:$({},pw(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Sw={theme:{},themeV2:{},localizations:{},navigation:{usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class vw{constructor(){this._theme=Sw.theme,this._themeV2=Sw.themeV2,this._navigation=Sw.navigation,this._localizations=Sw.localizations,this._integrations=Sw.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new vw;return n.set(e),vw._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:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,a,i,o,r,s,l,c;this._navigation=ow().all([null!=(t=Sw.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=ow().all([null!=(a=Sw.theme)?a:{},gw(null==e?void 0:e.theme,Sw.theme)]),this._themeV2=ow().all([null!=(i=Sw.themeV2)?i:{},null!=(o=null==e?void 0:e.themeV2)?o:{}]),this._localizations=ow().all([null!=(r=Sw.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=ow().all([null!=(l=Sw.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=Sw.navigation,this._theme=Sw.theme,this._themeV2=Sw.themeV2,this._localizations=Sw.localizations,this._integrations=Sw.integrations}}}vw._instances={};var hw=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},mw=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=document.createElement(t);return Object.keys(n).forEach((function(e){return a.setAttribute(e,n[e])})),e.appendChild(a),a},bw=function(e){return new Promise((function(t,n){var a=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):a<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(a-=50)}),50)}))},Aw=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let Tw,Ew,Iw,kw,Ow,Pw,_w,Lw,ww,Uw,Dw,Rw;!function(e){e.phoneNumber="phoneNumber"}(Tw||(Tw={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(Ew||(Ew={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Iw||(Iw={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(kw||(kw={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Ow||(Ow={})),function(e){e.Invoices="invoices"}(Pw||(Pw={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(_w||(_w={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Lw||(Lw={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(ww||(ww={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(Uw||(Uw={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(Dw||(Dw={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(Rw||(Rw={}));const Cw={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},Nw={hidden:"hidden",edit:"edit"},Mw="6.190.0-alpha.0";var Fw={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on","temporary-users":"on"},Gw=function(){function e(t,n){var a,i,o=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(Mw),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=M(G().mark((function e(){var t,n,a,i,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Gr,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(a=r.rows)||null==(i=a[0])?void 0:i.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:vw.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=null==(t=o.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,o.options.builderMode||"nextjs"===o.options.framework||(o.options.hostedLoginBox&&!o.options.customLoginBox?a&&o.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):o.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Hr.set(Fw,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,qr();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Hr.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Hr.set(Object.assign({},Fw,e),o.name)},this.queryFeatureFlags=function(e){return Hr.getFeatureFlags(e,o.name)},this.updateLocalizationsSetter=function(e){o.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=o.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return o.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=o.getUserFromStore();return{entitlements:o.getEntitlementsFromStore(),attributes:{custom:e,jwt:t}}};var l=hw(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=Object.assign({},t,{contextOptions:Object.assign({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var d,u,y=this.options.authOptions?Object.assign({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(a=this.options.authOptions)?void 0:a.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!s&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=tw({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(d=this.options.authOptions)?d:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);D.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(i=t.authOptions)?void 0:i.enableSessionPerTenant}),Wo.setAppName(l)}var t,n,a,i;return U(e,[{key:"setEntitlementsOptions",value:function(e){Wo.setEntitlementsOptions(Object.assign({},e))}},{key:"setSessionContext",value:function(e){Wo.setSessionContext(Object.assign({},e))}},{key:"initContainers",value:(i=M(G().mark((function e(t){return G().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,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,a=void 0,void 0,o=void 0,null==(o=null==(i=vw.getInstance(n))||null==(a=i.integrations)?void 0:a.gtm)||o.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,a,i,o}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;vw.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,a){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:O})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),a(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(a=M(G().mark((function e(){return G().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 a.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(t){var n,a,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(null!=t?t:{isMultiApp:!1}).isMultiApp,a=this.queryFeatureFlags(["multi-apps-admin-portal"]),i=C(a,1),o=i[0],Wo.setRequestSource(ua.AdminPortal),e.next=5,this.loadScript("FronteggAdminPortal");case 5:r=e.sent,this.adminPortalRenderer=r.render(this.adminPortalEl,{injector:this,options:Object.assign({isMultiApp:o&&n},this.options)});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"openHostedAdminPortal",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.options.contextOptions.baseUrl,n="".concat(t,"/oauth/portal");e?window.open(n,"_blank"):window.location.href=n}},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),Aw(t),Wo.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=M(G().mark((function e(t){var n;return G().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,Object.assign({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:"getFeatureEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,a)=>(aw(),(0,nw.tE)(t,e,n)))(n.entitlements,e,n.attributes)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,a)=>(aw(),(0,nw.wJ)(t,e,n)))(n.entitlements,e,n.attributes)}},{key:"getEntitlements",value:function(e,t){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey,t):this.getFeatureEntitlements(e.featureKey,t)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"stepUp",value:function(e){var t=this.store.getState(),n=(null==t?void 0:t.auth)||{},a=n.hostedLoginBox,i=n.routes.stepUpUrl;a?this.store.dispatch({type:"auth/stepUpHostedLogin",payload:e}):((e,t,n)=>{kv();const a=new URLSearchParams(window.location.search);n&&a.set("maxAge",n.toString()),t(`${e}${a?`?${a}`:""}`,{refresh:!1})})(i,t.auth.onRedirectTo,null==e?void 0:e.maxAge)}},{key:"isSteppedUp",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(null==(e=this.store.getState())?void 0:e.auth)||{},a=n.user;return Iv(a,t)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),$w=function(){function e(){P(this,e)}return U(e,null,[{key:"setAuthentication",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=D.getInstance(a);e&&t?(Wo.setAccessToken(t),Wo.setUser(Object.assign({},n,{accessToken:t})),i.store.dispatch(za.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(za.loadTenants())):(Wo.setAccessToken(null),Wo.setUser(null),i.store.dispatch(za.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),xw=function(){function e(){P(this,e)}return U(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).showAdminPortal()}},{key:"showMultiApp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).showAdminPortal({isMultiApp:!0})}},{key:"openHosted",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";D.getInstance(t).openHostedAdminPortal(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).hideAdminPortal()}}]),e}(),Vw=function(){function e(){P(this,e)}return U(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";D.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).hideCheckoutDialog()}}]),e}(),jw=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},Bw=function(){function e(t,n,a,i){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(a){if(this.store=a,!o&&a.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=tw({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new Gw(this.options,t,!0),vw.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,a,i,o,r=this;return G().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,a=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return o=e.sent,this.app.adminPortalRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:a,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,bw(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}(),Ww="modern",zw=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[Ww]},Kw=function(){function e(t,n,a,i){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(a){if(this.store=a,!o&&a.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=tw({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new Gw(this.options,t,!0,o),vw.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,a,i,o,r=this;return G().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,a=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return o=e.sent,this.app.loginBoxRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:a,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,bw(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 Hw(e,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hw(e,t)}function qw(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&&Hw(e,t)}function Jw(e,t){if(t&&("object"===_(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 Yw(e){return Yw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yw(e)}function Xw(){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 Qw(e,t,n){return Qw=Xw()?Reflect.construct.bind():function(e,t,n){var a=[null];a.push.apply(a,t);var i=new(Function.bind.apply(e,a));return n&&Hw(i,n.prototype),i},Qw.apply(null,arguments)}function Zw(e){var t="function"==typeof Map?new Map:void 0;return Zw=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 Qw(e,arguments,Yw(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Hw(n,e)},Zw(e)}function eU(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,a=Yw(e);if(t){var i=Yw(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return Jw(this,n)}}var tU=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new Gw(e,t);if("undefined"!=typeof document){var a;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var o=function(e){qw(n,e);var t=eU(n);function n(){var e;P(this,n);for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return U(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=D.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var a=mw(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=mw(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),o=mw(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=a.attachShadow({mode:"open"}),s=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),c=mw(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),d=mw(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),u=mw(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:d,adminPortalContainer:a,loginBoxContainer:i,checkoutDialogContainer:o,checkoutDialogEl:u})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(Zw(HTMLElement));customElements.define("frontegg-app",o)}null==(a=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||a.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}})(),a})()));
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,(()=>(()=>{var e={6987:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const a=n(3651),i=n(9082);t.createConditionEvaluator=function(e){const t=(0,i.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:o}=t(e.condition.value);if(!n||void 0===o)return()=>!1;const r=(0,a.useOperation)(e.condition.op,o);return t=>{const n=t[e.condition.attribute];if(void 0===n||!r)return!1;const{isValid:a}=r(n);return e.condition.negate?!a:a}}},2898:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(6987),t),i(n(7371),t)},7371:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},3840:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const a=n(2380);t.evaluateFeatureFlag=function(e,t){if(!e.on)return{treatment:e.offTreatment};const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,a.createRuleEvaluator)({rule:e})(t)===a.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},6095:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3840),t)},9314:(e,t,n)=>{"use strict";t.wJ=t.tE=void 0;n(6095),n(521),n(2380),n(2379);var a=n(5535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return a.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return a.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const o=n(2379),r=n(6610);i(n(6610),t),i(n(7226),t),t.BooleanOperationsMapper={[o.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},6610:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},7226:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const a=n(2379);t.singleBooleanSanitizer=e=>{const t=void 0!==e.boolean&&(e=>"boolean"==typeof e)(e.boolean)?{boolean:e.boolean}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.BooleanSanitizersMapper={[a.OperationEnum.Is]:t.singleBooleanSanitizer}},3651:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const a=n(5943),i=n(1610),o=n(9004),r=n(195),s={...a.StringOperationsMapper,...i.NumericOperationsMapper,...o.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},9082:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const a=n(195),i=n(2903),o=n(6886),r=n(1610),s={...i.StringSanitizersMapper,...r.NumericSanitizersMapper,...o.DateSanitizersMapper,...a.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},9004:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const o=n(2379),r=n(4569);i(n(4569),t),i(n(5931),t),t.DateOperationsMapper={[o.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[o.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[o.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[o.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},4569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useDateBetweenOperation=t.useDateOnOrBeforeOperation=t.useDateOnOrAfterOperation=t.useDateOnOperation=void 0,t.useDateOnOperation=function(e){return t=>({isValid:t.getTime()===e.date.getTime()})},t.useDateOnOrAfterOperation=function(e){return t=>({isValid:t.getTime()>=e.date.getTime()})},t.useDateOnOrBeforeOperation=function(e){return t=>({isValid:t.getTime()<=e.date.getTime()})},t.useDateBetweenOperation=function(e){return t=>({isValid:t.getTime()>=e.start.getTime()&&t.getTime()<=e.end.getTime()})}},6886:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const a=n(2379);t.sanitizeDateValue=e=>new Date(e),t.isValidDate=e=>e instanceof Date&&!isNaN(e),t.sanitizeSingleDate=e=>{const n=e.date?(0,t.sanitizeDateValue)(e.date):void 0,a=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!a,sanitizedValue:a}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,a=e.end?(0,t.sanitizeDateValue)(e.end):void 0,i=n&&a&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(a)?{start:n,end:a}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.DateSanitizersMapper={[a.OperationEnum.On]:t.sanitizeSingleDate,[a.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[a.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[a.OperationEnum.BetweenDate]:t.sanitizeDateRange}},5931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},1610:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const o=n(2379),r=n(9217);t.NumericOperationsMapper={[o.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[o.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[o.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[o.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[o.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[o.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},i(n(9217),t),i(n(9326),t),i(n(1764),t)},9217:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useBetweenNumericOperation=t.useLesserThanEqualOperation=t.useLesserThanOperation=t.useGreaterThanEqualOperation=t.useGreaterThanOperation=t.useEqualsOperation=void 0,t.useEqualsOperation=function(e){return t=>({isValid:t===e.number})},t.useGreaterThanOperation=function(e){return t=>({isValid:t>e.number})},t.useGreaterThanEqualOperation=function(e){return t=>({isValid:t>=e.number})},t.useLesserThanOperation=function(e){return t=>({isValid:t<e.number})},t.useLesserThanEqualOperation=function(e){return t=>({isValid:t<=e.number})},t.useBetweenNumericOperation=function(e){return t=>({isValid:t>=e.start&&t<=e.end})}},9326:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const a=n(2379),i=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&i(e.number)?{number:e.number}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeNumericRange=e=>{const t=void 0!==e.start&&void 0!==e.end&&i(e.start)&&i(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[a.OperationEnum.Equal]:t.sanitizeSingleNumber,[a.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[a.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[a.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[a.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[a.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},1764:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},5943:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const o=n(2379),r=n(2431);i(n(2431),t),i(n(2097),t),t.StringOperationsMapper={[o.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[o.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[o.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[o.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[o.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},2431:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useMatchesOperation=t.useInListOperation=t.useContainsOperation=t.useEndsWithOperation=t.useStartsWithOperation=void 0,t.useStartsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.startsWith(e)))})},t.useEndsWithOperation=function(e){return t=>({isValid:e.list.some((e=>t.endsWith(e)))})},t.useContainsOperation=function(e){return t=>({isValid:e.list.some((e=>t.includes(e)))})},t.useInListOperation=function(e){return t=>({isValid:e.list.includes(t)})},t.useMatchesOperation=function(e){return t=>{let n;try{n=new RegExp(e.string)}catch(e){return{isValid:!1}}return{isValid:n.test(t)}}}},2903:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const a=n(2379),i=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&i(e.string)?{string:e.string}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.sanitizeListString=e=>{const t=void 0!==e.list&&e.list.every((e=>i(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[a.OperationEnum.Matches]:t.sanitizeSingleString,[a.OperationEnum.Contains]:t.sanitizeListString,[a.OperationEnum.StartsWith]:t.sanitizeListString,[a.OperationEnum.EndsWith]:t.sanitizeListString,[a.OperationEnum.InList]:t.sanitizeListString}},2097:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},2379:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3982),t)},3982:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.OperationEnum=void 0,(n=t.OperationEnum||(t.OperationEnum={})).InList="in_list",n.StartsWith="starts_with",n.EndsWith="ends_with",n.Contains="contains",n.Matches="matches",n.Equal="equal",n.GreaterThan="greater_than",n.GreaterThanEqual="greater_than_equal",n.LesserThan="lower_than",n.LesserThanEqual="lower_than_equal",n.BetweenNumeric="between_numeric",n.Is="is",n.On="on",n.BetweenDate="between_date",n.OnOrAfter="on_or_after",n.OnOrBefore="on_or_before"},521:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3603),t)},3603:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluatePlan=void 0;const a=n(2380);t.evaluatePlan=function(e,t){const n=function(e,t){var n;return null===(n=e.rules)||void 0===n?void 0:n.find((e=>(0,a.createRuleEvaluator)({rule:e})(t)===a.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},2380:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(2930),t),i(n(1304),t)},1304:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const a=n(2930),i=n(2898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,i.createConditionEvaluator)({condition:e})(t)))?a.RuleEvaluationResultEnum.Treatable:a.RuleEvaluationResultEnum.Insufficient}},2930:(e,t)=>{"use strict";var n,a;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(a=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",a.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},5535:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(3779),t),i(n(1038),t),i(n(5113),t),i(n(4848),t)},5640:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.directEntitlementEvalutor=void 0;const a=n(5113);t.directEntitlementEvalutor=function(e,t,n={}){const i=t.features[e];let o=!1;return i&&null!==i.expireTime&&(o=i.expireTime!==a.NO_EXPIRATION_TIME&&i.expireTime<Date.now(),!o)?{isEntitled:!0}:{isEntitled:!1,justification:o?a.NotEntitledJustification.BUNDLE_EXPIRED:a.NotEntitledJustification.MISSING_FEATURE}}},9838:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.featureFlagEvaluator=void 0;const a=n(5113),i=n(6095),o=n(4668),r=n(2380);t.featureFlagEvaluator=function(e,t,n={}){const s=t.features[e];if(s&&s.featureFlag){const e=(0,o.prepareAttributes)(n),{treatment:t}=(0,i.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE}}},4529:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getIsEntitledEvaluators=void 0;const a=n(5640),i=n(9838),o=n(3751);t.getIsEntitledEvaluators=function(){return[a.directEntitlementEvalutor,i.featureFlagEvaluator,o.planTargetingRulesEvalutor]}},3751:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.planTargetingRulesEvalutor=void 0;const a=n(5113),i=n(4668),o=n(2380),r=n(521);t.planTargetingRulesEvalutor=function(e,t,n={}){const s=t.features[e];if(s&&s.planIds&&s.planIds.length>0){const e=(0,i.prepareAttributes)(n),a=t.plans;for(const t of s.planIds){const n=a[t];if(n){const{treatment:t}=(0,r.evaluatePlan)(n,e);if(t===o.TreatmentEnum.True)return{isEntitled:!0}}}}return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE}}},3779:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(7850),t)},7850:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToFeature=void 0;const a=n(5113),i=n(4848),o=n(4529);t.evaluateIsEntitledToFeature=function(e,t,n={}){if(!t)return{isEntitled:!1,justification:a.NotEntitledJustification.MISSING_FEATURE};const r=[];for(const a of(0,o.getIsEntitledEvaluators)())if(r.push(a(e,t,n)),!(0,i.shouldContinue)(r))break;return(0,i.getResult)(r)}},1038:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(519),t)},519:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=void 0;const a=n(7850),i=n(5113),o=n(4848),r=n(4852);t.evaluateIsEntitledToPermissions=function(e,t,n){if(!t)return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};if(!(0,r.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const s=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!s.length)return{isEntitled:!0};const l=[];for(const e of s)if(l.push((0,a.evaluateIsEntitledToFeature)(e,t,n)),!(0,o.shouldContinue)(l))break;return(0,o.getResult)(l)}},5113:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.NO_EXPIRATION_TIME=t.NotEntitledJustification=void 0,(n=t.NotEntitledJustification||(t.NotEntitledJustification={})).MISSING_FEATURE="MISSING_FEATURE",n.MISSING_PERMISSION="MISSING_PERMISSION",n.BUNDLE_EXPIRED="BUNDLE_EXPIRED",t.NO_EXPIRATION_TIME=-1},4668:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const a=n(193);function i(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function o(e,t){return Object.keys(e).reduce(((n,a)=>(n[`${t}${a}`]=e[a],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,a.flatten)(r);return{...n,...o(t?t(r):i(r),"frontegg."),...o(s,"jwt.")}},t.defaultFronteggAttributesMapper=i,t.modifyObjectKeysWithPrefix=o},1882:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shouldContinue=t.getResult=void 0;const a=n(5113);t.getResult=function(e){let t=!1;for(const n of e){if(n.isEntitled)return n;n.justification===a.NotEntitledJustification.BUNDLE_EXPIRED&&(t=!0)}return{isEntitled:!1,justification:t?a.NotEntitledJustification.BUNDLE_EXPIRED:a.NotEntitledJustification.MISSING_FEATURE}},t.shouldContinue=function(e){return e.every((({isEntitled:e})=>!e))}},193:(e,t)=>{"use strict";function n(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatten=void 0,t.flatten=function(e,t){const a=(null==(t=t||{})?void 0:t.delimiter)||".",i=null==t?void 0:t.maxDepth,o=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const d=n[c],u=(null==t?void 0:t.safe)&&Array.isArray(d),y=Object.prototype.toString.call(d),f=(p=d)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+a+o(c):o(c);if(!u&&!f&&g&&Object.keys(d).length&&(!(null==t?void 0:t.maxDepth)||i&&l<i))return e(d,S,l+1);r[S]=d}))}(e),r}},4848:function(e,t,n){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,n,a){void 0===a&&(a=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,a,i)}:function(e,t,n,a){void 0===a&&(a=n),e[a]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||a(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(4852),t),i(n(4668),t),i(n(1882),t)},4852:(e,t)=>{"use strict";function n(e){return new RegExp("^"+e.replace(/\./g,"\\.").replace(/\*/g,".*")+"$","gs")}Object.defineProperty(t,"__esModule",{value:!0}),t.createPermissionCheckRegex=t.checkPermission=void 0,t.checkPermission=function(e,t){return Object.keys(e).some((e=>n(e).test(t)))},t.createPermissionCheckRegex=n},9714: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 a(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function i(e,t,n){return e.concat(t).map((function(e){return a(e,n)}))}function o(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||i,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=a;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var i={};return n.isMergeableObject(e)&&o(e).forEach((function(t){i[t]=a(e[t],n)})),o(t).forEach((function(o){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(r(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(o,n)(e[o],t[o],n):i[o]=a(t[o],n))})),i}(e,n,l):a(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},9378:e=>{"use strict";e.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var a,i,o;if(Array.isArray(t)){if((a=t.length)!=n.length)return!1;for(i=a;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((a=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=a;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=a;0!=i--;){var r=o[i];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},7609:(e,t,n)=>{var a=n(7425).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,o=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function y(e,t,n,a){var i=t&&t.prototype instanceof g?t:g,o=Object.create(i.prototype),s=new _(a||[]);return r(o,"_invoke",{value:I(e,n,s)}),o}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={};u(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(L([])));b&&b!==n&&o.call(b,l)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,r,s,l){var c=f(e[i],e,r);if("throw"!==c.type){var d=c.arg,u=d.value;return u&&"object"==a(u)&&o.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(u).then((function(e){d.value=e,s(d)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var i;r(this,"_invoke",{value:function(e,a){function o(){return new t((function(t,i){n(e,a,t,i)}))}return i=i?i.then(o,o):o()}})}function I(e,t,n){var a="suspendedStart";return function(i,o){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var r=n.delegate;if(r){var s=k(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===a)throw a="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a="executing";var l=f(e,t,n);if("normal"===l.type){if(a=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a="completed",n.method="throw",n.arg=l.arg)}}}function k(e,t){var n=t.method,a=e.iterator[n];if(void 0===a)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var i=f(a,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,p;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function O(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 P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function L(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:w}}function w(){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=u(v,d,"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,u(e,d,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},T(E.prototype),u(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,a,i,o){void 0===o&&(o=Promise);var r=new E(y(e,n,a,i),o);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(A),u(A,d,"Generator"),u(A,l,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var a in t)n.push(a);return n.reverse(),function e(){for(;n.length;){var a=n.pop();if(a in t)return e.value=a,e.done=!1,e}return e.done=!0,e}},t.values=L,_.prototype={constructor:_,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(P),!e)for(var t in this)"t"===t.charAt(0)&&o.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,a){return r.type="throw",r.arg=e,t.next=n,a&&(t.method="next",t.arg=void 0),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],r=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),l=o.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&o.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var r=i?i.completion:{};return r.type=e,r.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(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 a=n.completion;if("throw"===a.type){var i=a.arg;P(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:L(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},7425: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},2841:(e,t,n)=>{var a=n(7609)();e.exports=a;try{regeneratorRuntime=a}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}}},t={};function n(a){var i=t[a];if(void 0!==i)return i.exports;var o=t[a]={exports:{}};return e[a].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{"use strict";n.r(a),n.d(a,{AdminPortal:()=>xw,AdminPortalRenderer:()=>Bw,AppHolder:()=>D,CheckoutDialog:()=>Vw,FronteggApp:()=>Gw,HostedLogin:()=>$w,LoginBoxRenderer:()=>Kw,createElement:()=>mw,defaultTheme:()=>Ww,formatName:()=>hw,getThemeAdminByName:()=>jw,getThemeByName:()=>zw,initialize:()=>tU,mockFlagsList:()=>Fw,restoreSearchParams:()=>Aw,waitThemeSetter:()=>bw});var e={};n.r(e),n.d(e,{Delete:()=>jr,Get:()=>Gr,Patch:()=>xr,Post:()=>$r,PostDownload:()=>Br,Put:()=>Vr,extractHeadersFromOptions:()=>Wr,getBaseUrl:()=>Cr,getMetadataHeaders:()=>Nr,getScopedTenant:()=>Mr});var t={};n.r(t),n.d(t,{FeatureFlags:()=>Hr,loadFeatureFlags:()=>qr});var i={};n.r(i),n.d(i,{GetUserJwt:()=>Jr,getCurrentUserTenantsV1:()=>ts,getCurrentUserTenantsV3:()=>es,getUsersGroups:()=>Zr,getUsersRoles:()=>Qr,getUsersV2:()=>Yr,getUsersV3:()=>Xr,sendResetBreachedPasswordEmails:()=>ns,updateUserProfileV2:()=>as});var o={};n.r(o),n.d(o,{getHierarchyMetadata:()=>Ss,getParentTenants:()=>ys,getParentTenantsById:()=>fs,getSubTenants:()=>ds,getSubTenantsAsTree:()=>us,getTenants:()=>cs,getTenantsUsersCount:()=>ps,searchSubTenants:()=>gs,switchTenant:()=>ls});var r={};n.r(r),n.d(r,{loadEntitlementsV2:()=>Ys});var s={};n.r(s),n.d(s,{AuthStrategyEnum:()=>Oa,MachineToMachineAuthStrategy:()=>Pa,OAuthLogout:()=>Pl,SocialLoginProviders:()=>ka,acceptInvitation:()=>Tl,activateAccount:()=>vl,activateAccountV2:()=>hl,bulkCreateIPRestriction:()=>Fs,changePhoneNumber:()=>Ud,changePhoneNumberWithVerification:()=>Ld,checkIfAllowToRememberMfaDevice:()=>Qc,createDomainRestriction:()=>Us,createIPRestriction:()=>Ms,createOrUpdateSessionConfigrations:()=>Mc,createSSOConfiguration:()=>id,createSSOConfigurationByMetadata:()=>sd,createSSOConfigurationByMetadataUrl:()=>cd,createSSODomain:()=>ud,createSSOGroup:()=>vd,createSamlGroup:()=>bc,createTenantAccessToken:()=>Wc,createUserAccessToken:()=>Bc,deleteAllSessionsForUser:()=>Gc,deleteDomainRestriction:()=>Rs,deleteIPRestriction:()=>$s,deleteSSOConfiguration:()=>rd,deleteSSODomain:()=>yd,deleteSSOGroup:()=>md,deleteSamlGroup:()=>Tc,deleteSessionForUser:()=>Fc,deleteTenantAccessToken:()=>Vc,deleteTenantApiToken:()=>Jc,deleteUserAccessToken:()=>jc,deleteUserApiToken:()=>Yc,deleteWebAuthnDevice:()=>Fd,disableMFAAuthenticatorApp:()=>Vl,disableMFASMS:()=>Bl,disableMFAWebAuthn:()=>zl,disableMfa:()=>xl,enrollMFAAuthenticatorApp:()=>Cl,enrollMFAAuthenticatorAppForLogin:()=>ql,enrollMFAAuthenticatorAppForLoginV2:()=>Jl,enrollMFASMS:()=>Ml,enrollMFASMSForLogin:()=>tc,enrollMFASMSForLoginV2:()=>nc,enrollMFAWebAuthn:()=>Gl,enrollMFAWebAuthnForLogin:()=>sc,enrollMFAWebAuthnForLoginV2:()=>lc,enrollMfa:()=>Dl,exchangeOAuthTokens:()=>kd,exchangeOAuthTokensV2:()=>Ed,forgotPassword:()=>_l,generateLoginResponse:()=>nl,generateLoginResponseFromOAuthResponse:()=>sl,generateLoginResponseFromOAuthResponseV2:()=>ll,generateLoginResponseV2:()=>al,generateLoginResponseV3:()=>rl,generateStepupSession:()=>Kd,getActivateAccountStrategy:()=>ml,getCaptchaPolicy:()=>Is,getCurrentUserSession:()=>Rc,getCurrentUserSessions:()=>Dc,getCurrentUserTenantsFunction:()=>ss,getCustomSocialLoginProvidersV1:()=>_c,getDomainRestrictions:()=>Ls,getDomainRestrictionsConfig:()=>ws,getGlobalSecurityPolicy:()=>vs,getIPRestrictions:()=>Cs,getIPRestrictionsConfig:()=>Ns,getLockoutPolicy:()=>As,getMFADevices:()=>Kl,getMFAStrategiesConfig:()=>Vd,getMeAndEntitlements:()=>zd,getMeV2:()=>Bd,getMfaPolicy:()=>hs,getOidcConfiguration:()=>Ec,getPasswordConfigPolicy:()=>_s,getPasswordHistoryPolicy:()=>ks,getPublicAuthStrategiesConfigForAuthenticatedUser:()=>xd,getSSOConfigurations:()=>ad,getSSODefaultRoles:()=>gd,getSSOGroups:()=>bd,getSSOPublicConfiguration:()=>Ic,getSamlConfiguration:()=>yc,getSamlRoles:()=>vc,getSamlRolesGroups:()=>hc,getSamlVendorConfiguration:()=>pc,getSessionConfigurations:()=>Nc,getSocialLoginProviders:()=>kc,getSocialLoginProvidersV2:()=>Oc,getSocialLoginProvidersV2ForAuthenticatedUser:()=>Pc,getTabTenantFromSessionStorage:()=>rs,getTenantAccessTokensData:()=>xc,getTenantApiTokensData:()=>Kc,getUserAccessTokensData:()=>$c,getUserApiTokensData:()=>zc,getUserAuthorization:()=>jd,getUserById:()=>Xc,getVendorConfig:()=>wc,getVendorLockoutPolicy:()=>Ts,getVendorMfaPolicy:()=>ms,getVendorPasswordHistoryPolicy:()=>Os,getVendorPublicAuthStrategiesConfig:()=>$d,getWebAuthnDevices:()=>Md,loadPasswordConfig:()=>wl,login:()=>fl,loginViaSocialLogin:()=>Lc,loginWithMfa:()=>gl,loginWithMfaV2:()=>Sl,loginv2:()=>pl,logout:()=>Ol,oidcPostLogin:()=>yl,oidcPostLoginV2:()=>Td,passwordlessPostLogin:()=>td,passwordlessPostLoginV2:()=>ed,passwordlessPreLogin:()=>Zc,postLogin:()=>ul,preDisableMFASMS:()=>jl,preDisableMFAWebAuthn:()=>Wl,preEnrollMFAAuthenticatorApp:()=>Rl,preEnrollMFAAuthenticatorAppForLogin:()=>Hl,preEnrollMFASMS:()=>Nl,preEnrollMFASMSForLogin:()=>ec,preEnrollMFAWebAuthn:()=>Fl,preEnrollMFAWebAuthnForLogin:()=>rc,preLogin:()=>cl,preLoginV2:()=>Ad,preLoginWithIdpType:()=>dl,preVerifyMFAEmailCode:()=>Xl,preVerifyMFASMSForLogin:()=>ac,preVerifyMFAWebAuthnForLogin:()=>cc,recoverMfaToken:()=>Ul,refreshToken:()=>El,refreshTokenV2:()=>Il,refreshTokenV3:()=>kl,removeTabTenantFromSessionStorage:()=>os,resendActivationEmail:()=>bl,resendInvitationEmail:()=>Al,resetPassword:()=>Ll,resetPhoneNumber:()=>Pd,revokeSessionsForUser:()=>Cc,saveLockoutPolicy:()=>Es,saveMfaPolicy:()=>bs,savePasswordHistoryPolicy:()=>Ps,setSSODefaultRoles:()=>Sd,setTabTenantInSessionStorage:()=>is,signUpUser:()=>Uc,silentOAuthRefreshToken:()=>Od,silentOAuthRefreshTokenV2:()=>Id,testCurrentIp:()=>xs,testCurrentIpInAllowList:()=>Vs,updateDomainRestrictionConfig:()=>Ds,updateIPRestrictionConfig:()=>Gs,updateSSOConfiguration:()=>od,updateSSOConfigurationByMetadata:()=>ld,updateSSOConfigurationByMetadataUrl:()=>dd,updateSSOGroup:()=>hd,updateSamlConfiguration:()=>fc,updateSamlGroup:()=>Ac,updateSamlRoles:()=>mc,updateSamlVendorMetadata:()=>gc,updateTenantApiTokensData:()=>qc,updateUserApiTokensData:()=>Hc,validateSSODomain:()=>fd,validateSSODomainV2:()=>pd,validateSamlDomain:()=>Sc,verifyChangePhoneNumber:()=>wd,verifyInviteToken:()=>nd,verifyMFAAuthenticatorAppForLogin:()=>Yl,verifyMFAEmailCode:()=>Ql,verifyMFAEmailCodeV2:()=>Zl,verifyMFASMSForLogin:()=>ic,verifyMFASMSForLoginV2:()=>oc,verifyMFAWebAuthnForLogin:()=>dc,verifyMFAWebAuthnForLoginV2:()=>uc,verifyMfa:()=>$l,verifyNewDeviceSession:()=>Gd,verifyResetPhoneNumber:()=>_d,webAuthnCreateNewDeviceSession:()=>Nd,webAuthnPostLogin:()=>Rd,webAuthnPostLoginV2:()=>Cd,webAuthnPreLogin:()=>Dd});var l={};n.r(l),n.d(l,{addUser:()=>Qd,changePassword:()=>Yd,createInviteUserLink:()=>iu,deleteInviteUserLink:()=>ru,deleteUser:()=>Zd,getInviteLinkConfiguration:()=>lu,getInviteUserLink:()=>su,getProfile:()=>Hd,getTemporaryUserConfiguration:()=>au,loadAvailablePermissions:()=>du,loadAvailableRoles:()=>cu,loadStats:()=>uu,loadUsers:()=>Xd,resendActivationLink:()=>yu,resendInvitationLink:()=>fu,resendInvitationLinkToAllTenants:()=>pu,setPermanentUser:()=>nu,updateInviteUserLink:()=>ou,updateProfile:()=>qd,updateProfileImage:()=>Jd,updateUser:()=>eu,updateUserExpirationTime:()=>tu});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:()=>Su,getAuditsMetadata:()=>Au,getCurrentUserIpMetadata:()=>hu,getIpAdressMetadata:()=>Tu,getNotificationsMetadata:()=>mu,getSamlMetadata:()=>bu,updateAdminBoxMetadata:()=>vu});var d={};n.r(d),n.d(d,{downloadReport:()=>wu,getReport:()=>Pu,getReports:()=>Ou,renderReport:()=>_u,scheduleReport:()=>Lu,sendReport:()=>Uu});var u={};n.r(u),n.d(u,{getNotifications:()=>Du,markAllAsRead:()=>Nu,updateNotificationIsPinned:()=>Cu,updateNotificationStatus:()=>Ru});var y={};n.r(y),n.d(y,{exportAudits:()=>$u,getAudits:()=>Fu,getAuditsStats:()=>Gu});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:()=>Zu,deleteEmailSubscriptions:()=>Xu,deleteSMSConfiguration:()=>oy,deleteSMSSubscriptions:()=>ay,deleteSlackConfiguration:()=>Ku,deleteWebhooksConfiguration:()=>ly,getCategories:()=>yy,getChannelMaps:()=>fy,getEmailConfiguration:()=>qu,getSMSConfiguration:()=>ey,getSlackChannels:()=>Wu,getSlackConfiguration:()=>ju,getSlackScope:()=>Bu,getWebhookLog:()=>cy,getWebhooksConfigurations:()=>ry,patchEmailConfiguration:()=>Yu,patchSMSConfiguration:()=>ny,postEmailConfiguration:()=>Ju,postSMSConfiguration:()=>ty,postSlackCode:()=>Hu,postSlackConfiguration:()=>zu,postWebhookRetry:()=>uy,postWebhookTest:()=>dy,postWebhooksConfiguration:()=>sy,putEmailSubscriptions:()=>Qu,putSMSSubscriptions:()=>iy});var p={};n.r(p),n.d(p,{getPublicSettings:()=>Sy,getSettings:()=>gy,updateSettings:()=>py});var g={};n.r(g),n.d(g,{addRole:()=>Ay,addRoleV2:()=>_y,attachPermissionToRoles:()=>Oy,attachPermissionsToRole:()=>Iy,deleteRole:()=>Ty,getPermissionCategories:()=>Py,getPermissions:()=>ky,getRoles:()=>by,updateRole:()=>Ey});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:()=>sf,ISubscriptionStatus:()=>of,PaymentMethodType:()=>rf,ProviderType:()=>lf,TenantCreatedAction:()=>df,TrialEndAction:()=>cf,cancelManagedSubscription:()=>My,cancelSubscription:()=>Uy,createStripeCustomer:()=>Yy,createStripePaymentMethodSetupIntentSecret:()=>Qy,createSubscription:()=>qy,createTenantConfiguration:()=>tf,getManagedSubscription:()=>Cy,getManagedSubscriptions:()=>Ny,getPaymentMethod:()=>Ky,getPaymentMethods:()=>zy,getPaymentProviders:()=>nf,getStripeCustomer:()=>Jy,getStripePaymentProviderConfiguration:()=>Xy,getSubscription:()=>wy,getSubscriptionInvoice:()=>jy,getSubscriptionInvoicePdf:()=>By,getSubscriptionInvoices:()=>Vy,getSubscriptionPlan:()=>xy,getSubscriptionPlans:()=>$y,getSubscriptionSummaries:()=>Zy,getSubscriptions:()=>Ly,getTenantConfiguration:()=>ef,getVendorPublicConfigurations:()=>af,renewManagedSubscription:()=>Fy,renewSubscription:()=>Dy,updateManagedSubscription:()=>Gy,updatePaymentMethodBillingDetails:()=>Hy,updateSubscription:()=>Ry});var v={};n.r(v),n.d(v,{assignUserToApplications:()=>gf,getApplicationsData:()=>pf,getTenantsApplications:()=>ff,getUserApplicationsId:()=>uf,getUsersApplicationsId:()=>yf,getUsersOfApplications:()=>vf,unassignUserFromApplications:()=>Sf});var h={};n.r(h),n.d(h,{getVendorPublicInfo:()=>hf});var m={};n.r(m),n.d(m,{addUserRolesForSubTenants:()=>Tf,addUserToTenantAndSubTenants:()=>bf,addUsersToSubTenant:()=>wf,createSubTenant:()=>kf,deleteSubTenant:()=>Of,loadAllUsers:()=>mf,removeUserFromTenantAndSubTenants:()=>Af,removeUserRolesFromSubTenants:()=>Ef,setUserRolesForSubTenants:()=>If,updateSubAccountAccess:()=>Lf,updateSubTenant:()=>Pf,updateSubTenantManagement:()=>_f});var b={};n.r(b),n.d(b,{countConfigurationUsers:()=>Nf,createConfiguration:()=>Rf,deleteConfiguration:()=>Cf,getConfigs:()=>Uf,updateConfiguration:()=>Df});var A={};n.r(A),n.d(A,{impersonate:()=>Mf});var T={};n.r(T),n.d(T,{addRolesToGroup:()=>Wf,addUsersToGroup:()=>Kf,createGroup:()=>Vf,deleteGroup:()=>Bf,deleteRolesFromGroup:()=>zf,deleteUsersFromGroup:()=>Hf,getGroupById:()=>Gf,getGroupConfiguration:()=>qf,getGroups:()=>$f,getGroupsByIds:()=>xf,updateGroup:()=>jf,updateGroupConfiguration:()=>Jf});var E={};n.r(E),n.d(E,{getInsights:()=>Xf,getRecommendations:()=>Yf});var I={};n.r(I),n.d(I,{createPhoneNumber:()=>Zf,deletePhoneNumber:()=>ep,getUserPhoneNumbers:()=>Qf,preVerifyPhoneNumber:()=>tp,verifyDeletePhoneNumber:()=>ap,verifyPhoneNumber:()=>np});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:()=>Qs,ApplicationAccessType:()=>Ep,AuthStrategyEnum:()=>Oa,ContextHolder:()=>Wo,FeatureFlags:()=>Hr,FronteggApiError:()=>Ko,FronteggContext:()=>zo,FronteggFrameworks:()=>ya,GetUsersFilterPreset:()=>ga,GroupManagedByEnum:()=>vp,GroupRelations:()=>Sp,ISubscriptionCancellationPolicy:()=>sf,ISubscriptionStatus:()=>of,InsightCode:()=>mp,LOAD_AUTHORIZATION_FF:()=>Js,MFAStrategyEnum:()=>qs,MachineToMachineAuthStrategy:()=>Pa,NotEntitledJustification:()=>Xs,PaginationOrderEnum:()=>fa,PaymentMethodType:()=>rf,PermissionAssignmentTypeEnum:()=>sp,ProviderType:()=>lf,RecommendationActionKey:()=>bp,RecommendationCode:()=>hp,RecommendationSeverity:()=>Ap,RequestSource:()=>ua,RestrictionType:()=>Kn,ScimConnectionSource:()=>gp,SecondaryAuthStrategy:()=>Ks,SecurityCategory:()=>Tp,SocialLoginProviders:()=>ka,SortByEnum:()=>pa,TenantSortByEnum:()=>op,TenantType:()=>rp,UserManagedByEnum:()=>ip,WebAuthnDeviceType:()=>Hs,api:()=>Ip,countConfigurationUsers:()=>Nf,createConfiguration:()=>Rf,default:()=>kp,deleteConfiguration:()=>Cf,fetch:()=>e,fronteggAuthApiRoutesRegex:()=>lp,fronteggEntitlementsV2Url:()=>pp,fronteggHeaders:()=>da,fronteggRefreshTokenUrl:()=>cp,fronteggSilentRefreshTokenUrl:()=>dp,fronteggTenantsUrl:()=>yp,fronteggTenantsV3Url:()=>fp,fronteggUsersUrl:()=>up,getConfigs:()=>Uf,getCurrentUserTenantsFunction:()=>ss,getTabTenantFromSessionStorage:()=>rs,loadFeatureFlags:()=>qr,providersArray:()=>Sa,setTabTenantInSessionStorage:()=>is,updateConfiguration:()=>Df});var O={};function P(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e){return _="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)}function L(e){var t=function(e,t){if("object"!==_(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,t);if("object"!==_(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===_(t)?t:String(t)}function w(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,L(a.key),a)}}function U(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(O),n.d(O,{AccountDetailsPageTabs:()=>Rw,AccountPageFields:()=>Ow,DomainRestrictionsTabFields:()=>Dw,GeneralSettingsTabFields:()=>ww,InviteUserModalFields:()=>kw,IpRestrictionsTabFields:()=>Uw,Metadata:()=>vw,PrivacyPageFields:()=>Iw,ProfilePageFields:()=>Ew,SecurityPageTabs:()=>_w,SessionManagementTabFields:()=>Lw,SignupFields:()=>Tw,SubscriptionsPageFields:()=>Pw,alpha:()=>dw,fieldAppearance:()=>Cw,tabAppearance:()=>Nw});var D=function(){function e(){P(this,e)}return U(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 R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,i,o,r,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(s.push(a.value),s.length!==t);l=!0);}catch(e){c=!0,i=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw i}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function N(e,t,n,a,i,o,r){try{var s=e[o](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(a,i)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(a,i){var o=e.apply(t,n);function r(e){N(o,a,i,r,s,"next",e)}function s(e){N(o,a,i,r,s,"throw",e)}r(void 0)}))}}D._apps={};var F=n(2841),G=n.n(F);function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},$.apply(this,arguments)}function x(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];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 V(e){return!!e&&!!e[Pe]}function j(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)===_e}(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor[Oe]||q(e)||J(e))}function B(e,t,n){void 0===n&&(n=!1),0===W(e)?(n?Object.keys:Le)(e).forEach((function(a){n&&"symbol"==typeof a||t(a,e[a],e)})):e.forEach((function(n,a){return t(a,n,e)}))}function W(e){var t=e[Pe];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:q(e)?2:J(e)?3:0}function z(e,t){return 2===W(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function K(e,t,n){var a=W(e);2===a?e.set(t,n):3===a?(e.delete(t),e.add(n)):e[t]=n}function H(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function q(e){return Te&&e instanceof Map}function J(e){return Ee&&e instanceof Set}function Y(e){return e.o||e.t}function X(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=we(e);delete t[Pe];for(var n=Le(t),a=0;a<n.length;a++){var i=n[a],o=t[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),ee(e)||V(e)||!j(e)||(W(e)>1&&(e.set=e.add=e.clear=e.delete=Z),Object.freeze(e),t&&B(e,(function(e,t){return Q(t,!0)}),!0)),e}function Z(){x(2)}function ee(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function te(e){var t=Ue[e];return t||x(18,e),t}function ne(){return be}function ae(e,t){t&&(te("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(se),e.p=null}function oe(e){e===be&&(be=e.l)}function re(e){return be={p:[],l:be,h:e,m:!0,_:0}}function se(e){var t=e[Pe];0===t.i||1===t.i?t.j():t.O=!0}function le(e,t){t._=t.p.length;var n=t.p[0],a=void 0!==e&&e!==n;return t.h.g||te("ES5").S(t,e,a),a?(n[Pe].P&&(ie(t),x(4)),j(e)&&(e=ce(t,e),t.l||ue(t,e)),t.u&&te("Patches").M(n[Pe].t,e,t.u,t.s)):e=ce(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function ce(e,t,n){if(ee(t))return t;var a=t[Pe];if(!a)return B(t,(function(i,o){return de(e,a,t,i,o,n)}),!0),t;if(a.A!==e)return t;if(!a.P)return ue(e,a.t,!0),a.t;if(!a.I){a.I=!0,a.A._--;var i=4===a.i||5===a.i?a.o=X(a.k):a.o;B(3===a.i?new Set(i):i,(function(t,o){return de(e,a,i,t,o,n)})),ue(e,i,!1),n&&e.u&&te("Patches").R(a,n,e.u,e.s)}return a.o}function de(e,t,n,a,i,o){if(V(i)){var r=ce(e,i,o&&t&&3!==t.i&&!z(t.D,a)?o.concat(a):void 0);if(K(n,a,r),!V(r))return;e.m=!1}if(j(i)&&!ee(i)){if(!e.h.F&&e._<1)return;ce(e,i),t&&t.A.l||ue(e,i)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Q(t,n)}function ye(e,t){var n=e[Pe];return(n?Y(n):e)[t]}function fe(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var a=Object.getOwnPropertyDescriptor(n,t);if(a)return a;n=Object.getPrototypeOf(n)}}function pe(e){e.P||(e.P=!0,e.l&&pe(e.l))}function ge(e){e.o||(e.o=X(e.t))}function Se(e,t,n){var a=q(t)?te("MapSet").N(t,n):J(t)?te("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),a={i:n?1:0,A:t?t.A:ne(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=a,o=De;n&&(i=[a],o=Re);var r=Proxy.revocable(i,o),s=r.revoke,l=r.proxy;return a.k=l,a.j=s,l}(t,n):te("ES5").J(t,n);return(n?n.A:ne()).p.push(a),a}function ve(e){return V(e)||x(22,e),function e(t){if(!j(t))return t;var n,a=t[Pe],i=W(t);if(a){if(!a.P&&(a.i<4||!te("ES5").K(a)))return a.t;a.I=!0,n=he(t,i),a.I=!1}else n=he(t,i);return B(n,(function(t,i){a&&function(e,t){return 2===W(e)?e.get(t):e[t]}(a.t,t)===i||K(n,t,e(i))})),3===i?new Set(n):n}(e)}function he(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return X(e)}var me,be,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Te="undefined"!=typeof Map,Ee="undefined"!=typeof Set,Ie="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((me={})["immer-nothing"]=!0,me),Oe=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Pe=Ae?Symbol.for("immer-state"):"__$immer_state",_e=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),Le="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,we=Object.getOwnPropertyDescriptors||function(e){var t={};return Le(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ue={},De={get:function(e,t){if(t===Pe)return e;var n=Y(e);if(!z(n,t))return function(e,t,n){var a,i=fe(t,n);return i?"value"in i?i.value:null===(a=i.get)||void 0===a?void 0:a.call(e.k):void 0}(e,n,t);var a=n[t];return e.I||!j(a)?a:a===ye(e.t,t)?(ge(e),e.o[t]=Se(e.A.h,a,e)):a},has:function(e,t){return t in Y(e)},ownKeys:function(e){return Reflect.ownKeys(Y(e))},set:function(e,t,n){var a=fe(Y(e),t);if(null==a?void 0:a.set)return a.set.call(e.k,n),!0;if(!e.P){var i=ye(Y(e),t),o=null==i?void 0:i[Pe];if(o&&o.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(H(n,i)&&(void 0!==n||z(e.t,t)))return!0;ge(e),pe(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!==ye(e.t,t)||t in e.t?(e.D[t]=!1,ge(e),pe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Y(e),a=Reflect.getOwnPropertyDescriptor(n,t);return a?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:a.enumerable,value:n[t]}:a},defineProperty:function(){x(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){x(12)}},Re={};B(De,(function(e,t){Re[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Re.deleteProperty=function(e,t){return Re.set.call(this,e,t,void 0)},Re.set=function(e,t,n){return De.set.call(this,e[0],t,n,e[0])};var Ce=function(){function e(e){var t=this;this.g=Ie,this.F=!0,this.produce=function(e,n,a){if("function"==typeof e&&"function"!=typeof n){var i=n;n=e;var o=t;return function(e){var t=this;void 0===e&&(e=i);for(var a=arguments.length,r=Array(a>1?a-1:0),s=1;s<a;s++)r[s-1]=arguments[s];return o.produce(e,(function(e){var a;return(a=n).call.apply(a,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&x(6),void 0!==a&&"function"!=typeof a&&x(7),j(e)){var s=re(t),l=Se(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?ie(s):oe(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return ae(s,a),le(e,s)}),(function(e){throw ie(s),e})):(ae(s,a),le(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&Q(r,!0),a){var d=[],u=[];te("Patches").M(e,r,d,u),a(d,u)}return r}x(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var a=arguments.length,i=Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(i))}))};var a,i,o=t.produce(e,n,(function(e,t){a=e,i=t}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(e){return[e,a,i]})):[o,a,i]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){j(e)||x(8),V(e)&&(e=ve(e));var t=re(this),n=Se(this,e,void 0);return n[Pe].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Pe]).A;return ae(n,t),le(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ie&&x(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var a=t[n];if(0===a.path.length&&"replace"===a.op){e=a.value;break}}n>-1&&(t=t.slice(n+1));var i=te("Patches").$;return V(e)?i(e,t):this.produce(e,(function(e){return i(e,t)}))},e}(),Ne=new Ce,Me=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseProxies.bind(Ne),Ne.applyPatches.bind(Ne),Ne.createDraft.bind(Ne),Ne.finishDraft.bind(Ne);const Fe=Me;function Ge(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach((function(t){Ge(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ve(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 je="function"==typeof Symbol&&Symbol.observable||"@@observable",Be=function(){return Math.random().toString(36).substring(7).split("").join(".")},We={INIT:"@@redux/INIT"+Be(),REPLACE:"@@redux/REPLACE"+Be(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Be()}};function ze(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 Ke(e,t,n){var a;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ve(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ve(1));return n(Ke)(e,t)}if("function"!=typeof e)throw new Error(Ve(2));var i=e,o=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function d(){if(l)throw new Error(Ve(3));return o}function u(e){if("function"!=typeof e)throw new Error(Ve(4));if(l)throw new Error(Ve(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ve(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!ze(e))throw new Error(Ve(7));if(void 0===e.type)throw new Error(Ve(8));if(l)throw new Error(Ve(9));try{l=!0,o=i(o,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ve(10));i=e,y({type:We.REPLACE})}function p(){var e,t=u;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ve(11));function n(){e.next&&e.next(d())}return n(),{unsubscribe:t(n)}}})[je]=function(){return this},e}return y({type:We.INIT}),(a={dispatch:y,subscribe:u,getState:d,replaceReducer:f})[je]=p,a}function He(e){for(var t=Object.keys(e),n={},a=0;a<t.length;a++){var i=t[a];"function"==typeof e[i]&&(n[i]=e[i])}var o,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:We.INIT}))throw new Error(Ve(12));if(void 0===n(void 0,{type:We.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(13))}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var a=!1,i={},s=0;s<r.length;s++){var l=r[s],c=n[l],d=e[l],u=c(d,t);if(void 0===u)throw t&&t.type,new Error(Ve(14));i[l]=u,a=a||u!==d}return(a=a||r.length!==Object.keys(e).length)?i:e}}function qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function Je(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),a=function(){throw new Error(Ve(15))},i={getState:n.getState,dispatch:function(){return a.apply(void 0,arguments)}},o=t.map((function(e){return e(i)}));return a=qe.apply(void 0,o)(n.dispatch),xe(xe({},n),{},{dispatch:a})}}}function Ye(e){return function(t){var n=t.dispatch,a=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,a,e):t(i)}}}}var Xe=Ye();Xe.withExtraArgument=Ye;const Qe=Xe;var Ze,et=(Ze=function(e,t){return Ze=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])},Ze(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}Ze(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),tt=function(e,t){for(var n=0,a=t.length,i=e.length;n<a;n++,i++)e[i]=t[n];return e},nt=Object.defineProperty,at=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,rt=function(e,t,n){return t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},st=function(e,t){for(var n in t||(t={}))it.call(t,n)&&rt(e,n,t[n]);if(at)for(var a=0,i=at(t);a<i.length;a++)n=i[a],ot.call(t,n)&&rt(e,n,t[n]);return e},lt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?qe:qe.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var ct=function(e){function t(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];var i=e.apply(this,n)||this;return Object.setPrototypeOf(i,t.prototype),i}return et(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,tt([void 0],e[0].concat(this)))):new(t.bind.apply(t,tt([void 0],e.concat(this))))},t}(Array);function dt(e){return j(e)?Fe(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,a=(e.immutableCheck,e.serializableCheck,new ct);return n&&(function(e){return"boolean"==typeof e}(n)?a.push(Qe):a.push(Qe.withExtraArgument(n.extraArgument))),a}function yt(e){var t,n=function(e){return ut(e)},a=e||{},i=a.reducer,o=void 0===i?void 0:i,r=a.middleware,s=void 0===r?n():r,l=a.devTools,c=void 0===l||l,d=a.preloadedState,u=void 0===d?void 0:d,y=a.enhancers,f=void 0===y?void 0:y;if("function"==typeof o)t=o;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}(o))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=He(o)}var p=s;"function"==typeof p&&(p=p(n));var g=Je.apply(void 0,p),S=qe;c&&(S=lt(st({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=tt([g],f):"function"==typeof f&&(v=f(v)),Ke(t,u,S.apply(void 0,v))}function ft(e,t){function n(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];if(t){var i=t.apply(void 0,n);if(!i)throw new Error("prepareAction did not return an object");return st(st({type:e,payload:i.payload},"meta"in i&&{meta:i.meta}),"error"in i&&{error:i.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function pt(e){var t,n={},a=[],i={addCase:function(e,t){var a="string"==typeof e?e:e.type;if(a in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[a]=t,i},addMatcher:function(e,t){return a.push({matcher:e,reducer:t}),i},addDefaultCase:function(e){return t=e,i}};return e(i),[n,a,t]}function gt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,a="function"==typeof e.initialState?e.initialState:dt(e.initialState),i=e.reducers||{},o=Object.keys(i),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?pt(e.extraReducers):[e.extraReducers],n=t[0],i=void 0===n?{}:n,o=t[1],r=void 0===o?[]:o,l=t[2],c=void 0===l?void 0:l,d=st(st({},i),s);return function(e,t,n,a){void 0===n&&(n=[]);var i,o="function"==typeof t?pt(t):[t,n,a],r=o[0],s=o[1],l=o[2];if(function(e){return"function"==typeof e}(e))i=function(){return dt(e())};else{var c=dt(e);i=function(){return c}}function d(e,t){void 0===e&&(e=i());var n=tt([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var a;if(V(e))return void 0===(a=n(e,t))?e:a;if(j(e))return Fe(e,(function(e){return n(e,t)}));if(void 0===(a=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return a}return e}),e)}return d.getInitialState=i,d}(a,d,r,c)}return o.forEach((function(e){var n,a,o=i[e],c=t+"/"+e;"reducer"in o?(n=o.reducer,a=o.prepare):n=o,r[e]=n,s[c]=n,l[e]=a?ft(c,a):ft(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var St="listenerMiddleware";ft(St+"/add"),ft(St+"/removeAll"),ft(St+"/remove"),function(){function e(e,t){var n=i[e];return n?n.enumerable=t:i[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Pe];return De.get(t,e)},set:function(t){var n=this[Pe];De.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var i=e[t][Pe];if(!i.P)switch(i.i){case 5:a(i)&&pe(i);break;case 4:n(i)&&pe(i)}}}function n(e){for(var t=e.t,n=e.k,a=Le(n),i=a.length-1;i>=0;i--){var o=a[i];if(o!==Pe){var r=t[o];if(void 0===r&&!z(t,o))return!0;var s=n[o],l=s&&s[Pe];if(l?l.t!==r:!H(s,r))return!0}}var c=!!t[Pe];return a.length!==Le(t).length+(c?0:1)}function a(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 a=0;a<t.length;a++)if(!t.hasOwnProperty(a))return!0;return!1}var i={};!function(e,t){Ue[e]||(Ue[e]=t)}("ES5",{J:function(t,n){var a=Array.isArray(t),i=function(t,n){if(t){for(var a=Array(n.length),i=0;i<n.length;i++)Object.defineProperty(a,""+i,e(i,!0));return a}var o=we(n);delete o[Pe];for(var r=Le(o),s=0;s<r.length;s++){var l=r[s];o[l]=e(l,t||!!o[l].enumerable)}return Object.create(Object.getPrototypeOf(n),o)}(a,t),o={i:a?5:4,A:n?n.A:ne(),P:!1,I:!1,D:{},l:n,t,k:i,o:null,O:!1,C:!1};return Object.defineProperty(i,Pe,{value:o,writable:!0}),i},S:function(e,n,i){i?V(n)&&n[Pe].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Pe];if(n){var i=n.t,o=n.k,r=n.D,s=n.i;if(4===s)B(o,(function(t){t!==Pe&&(void 0!==i[t]||z(i,t)?r[t]||e(o[t]):(r[t]=!0,pe(n)))})),B(i,(function(e){void 0!==o[e]||z(o,e)||(r[e]=!1,pe(n))}));else if(5===s){if(a(n)&&(pe(n),r.length=!0),o.length<i.length)for(var l=o.length;l<i.length;l++)r[l]=!1;else for(var c=i.length;c<o.length;c++)r[c]=!0;for(var d=Math.min(o.length,i.length),u=0;u<d;u++)o.hasOwnProperty(u)||(r[u]=!0),void 0===r[u]&&e(o[u])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):a(e)}})}();const vt=(e,t)=>n=>$({},n,{[e]:t[e]}),ht=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>$({},t,{[e]:$({},t[e],n)})}),mt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:a})=>{var i;return $({},n,{[e]:$({},n[e],{[t]:$({},null==n||null==(i=n[e])?void 0:i[t],a)})})}}),bt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var a,i;return $({},t,{[e]:$({},t[e],{loaders:$({},null==(a=t[e])?void 0:a.loaders,{[n.key]:null==(i=n.value)||i})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var a;return $({},t,{[e]:$({},t[e],{errors:$({},t[e].errors,{[n.key]:null==(a=n.value)||a})})})}}),Tt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(a,{payload:i})=>{var o;return $({},a,{[e]:$({},a[e],{[t]:$({},null==a||null==(o=a[e])?void 0:o[t],i,n)})})}}),Et=(e,t,n)=>a=>{var i;return $({},a,{[e]:$({},a[e],{[t]:$({},null==a||null==(i=a[e])?void 0:i[t],n)})})},It=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Ot=new Uint8Array(256);for(let e=0;e<kt.length;e++)Ot[kt.charCodeAt(e)]=e;const Pt=e=>{const t=.75*e.length,n=e.length;let a,i,o,r,s,l=0;const c=new Uint8Array(t);for(a=0;a<n;a+=4)i=Ot[e.charCodeAt(a)],o=Ot[e.charCodeAt(a+1)],r=Ot[e.charCodeAt(a+2)],s=Ot[e.charCodeAt(a+3)],c[l++]=i<<2|o>>4,c[l++]=(15&o)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},_t=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(_t(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let a,i="";for(a=0;a<n;a+=3)i+=kt[t[a]>>2],i+=kt[(3&t[a])<<4|t[a+1]>>4],i+=kt[(15&t[a+1])<<2|t[a+2]>>6],i+=kt[63&t[a+2]];return n%3==2?i=i.substring(0,i.length-1):n%3==1&&(i=i.substring(0,i.length-2)),i})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=_t(e[n]);return t}return e};let Lt,wt,Ut,Dt;!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",e.breachedPassword="breachedPassword",e.breachedPasswordSuccess="breachedPasswordSuccess"}(Lt||(Lt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(wt||(wt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Ut||(Ut={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Dt||(Dt={}));const Rt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Ct="HOSTED_LOGIN_VERIFIER_KEY",Nt="auth",Mt="connectivity",Ft="auditLogs",Gt="vendor",$t={flow:wt.Login,step:Lt.preLogin,loading:!1,email:"",tenants:[]},xt={setLoginState:ht("loginState"),resetLoginState:vt("loginState",{loginState:$t})},Vt={requestAuthorize:ft("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ft("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ft("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:ft("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:ft("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ft("auth/afterAuthNavigation"),preLogin:ft("auth/preLogin",(e=>({payload:e}))),postLogin:ft("auth/postLogin",(e=>({payload:e}))),login:ft("auth/login",(e=>({payload:e}))),loginWithMfa:ft("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ft("auth/recoverMfa",(e=>({payload:e}))),logout:ft("auth/logout",(e=>({payload:e}))),silentLogout:ft("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ft("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ft("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ft("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ft("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ft("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ft("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ft("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ft("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ft("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ft("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ft("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ft("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ft("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ft("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ft("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ft("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ft("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ft("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ft("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ft("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ft("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:ft("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:ft("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:ft("auth/resetBreachedPassword",(e=>({payload:e})))};let jt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(jt||(jt={}));const Bt={step:jt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Wt={setActivateState:ht("activateState"),resetActivateState:vt("activateState",{activateState:Bt}),setActivateStrategyState:mt("activateState","activationStrategy")},zt={activateAccount:ft("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ft("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ft("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ft("auth/resendActivationEmail",(e=>({payload:e})))};let Kt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Kt||(Kt={}));const Ht={step:Kt.validate},qt={setAcceptInvitationState:ht("acceptInvitationState"),resetAcceptInvitationState:vt("acceptInvitationState",{acceptInvitationState:Ht})},Jt={acceptInvitation:ft("auth/acceptInvitation",(e=>({payload:e})))};let Yt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Yt||(Yt={}));const Xt={step:Yt.forgotPassword,loading:!1,email:"",passwordConfig:null},Qt={setForgotPasswordState:ht("forgotPasswordState"),resetForgotPasswordState:vt("forgotPasswordState",{forgotPasswordState:Xt})},Zt={forgotPassword:ft("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ft("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ft("auth/loadPasswordConfig",(e=>({payload:e})))};let en;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(en||(en={}));const tn={step:en.ResetPhoneNumber,loading:!1},nn={setResetPhoneNumberState:ht("resetPhoneNumberState"),resetResetPhoneNumberState:vt("resetPhoneNumberState",{resetPhoneNumberState:tn})},an={resetPhoneNumber:ft("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ft("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ft("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},rn={setSSOLoader:bt("ssoState"),setSSOError:At("ssoState"),setSSOState:ht("ssoState"),resetSSOState:vt("ssoState",{ssoState:on})},sn={loadSSOConfigurationsV2:ft("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ft("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ft("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ft("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ft("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ft("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ft("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ft("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ft("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ft("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ft("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ft("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ft("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ft("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ft("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ft("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ft("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ft("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ft("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ft("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ft("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ft("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ft("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ft("auth/oidcPostlogin",(e=>({payload:e})))},ln={loading:!1,error:null},cn={setProfileState:ht("profileState"),resetProfileState:vt("profileState",{profileState:ln})},dn={loadProfile:ft("auth/loadProfile"),saveProfile:ft("auth/saveProfile",(e=>({payload:e}))),changePassword:ft("auth/changePassword",(e=>({payload:e})))};let un;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode",e.emailVerifyCode="emailVerifyCode",e.noMFAEnrolledStepUp="noMFAEnrolledStepUp"}(un||(un={}));const yn={step:un.verify,loading:!1,saving:!1},fn={setMfaState:ht("mfaState"),resetMfaState:vt("mfaState",{mfaState:yn})},pn={enrollMfa:ft("auth/enrollMfa"),getMFADevices:ft("auth/getMFADevices"),getMFAStrategies:ft("auth/getMFAStrategies"),verifyMfa:ft("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ft("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ft("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ft("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ft("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ft("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ft("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ft("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ft("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ft("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ft("auth/disableMfaWebAuthn",(e=>({payload:e})))},gn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,shouldShowSubTenantUsersIfReseller:!1,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}},Sn={setTeamLoader:bt("teamState"),setTeamError:At("teamState"),setTeamState:ht("teamState"),resetTeamState:vt("teamState",{teamState:gn})},vn={loadUsersV2:ft("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:ft("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ft("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ft("auth/loadRoles",(e=>({payload:e}))),addUser:ft("auth/addUser",(e=>({payload:e}))),addUsersBulk:ft("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ft("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ft("auth/updateUser",(e=>({payload:e}))),deleteUser:ft("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ft("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ft("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ft("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ft("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ft("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ft("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ft("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getTemporaryUsersConfig:ft("auth/getTemporaryUsersConfig"),updateUserExpirationTime:ft("auth/updateUserExpirationTime",(e=>({payload:e}))),setUserAsPermanent:ft("auth/setUserAsPermanent",(e=>({payload:e}))),getInvitationLink:ft("auth/getInvitationLink"),createInvitationLink:ft("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ft("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ft("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ft("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ft("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ft("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ft("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ft("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ft("auth/closeLockUserDialog",(e=>({payload:e})))},hn={firstLoad:!0,loading:!1,error:""},mn={setSocialLoginsState:ht("socialLoginState"),resetSocialLoginsState:vt("socialLoginState",{socialLoginState:hn})},bn={loadSocialLoginsConfiguration:ft("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ft("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:ft("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ft("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const Tn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},En={setSignUpState:ht("signUpState"),resetSignUpState:vt("signUpState",{signUpState:Tn})},In={signUpUser:ft("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ft("auth/resetSignUpStateSoft")},kn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},On={setApiTokensLoader:bt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:ht("apiTokensState"),resetApiTokensState:vt("apiTokensState",{apiTokensState:kn})},Pn={loadApiTokens:ft("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ft("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ft("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ft("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ft("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ft("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ft("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ft("auth/deleteTenantApiToken",(e=>({payload:e})))},_n={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}},Ln={setSecurityPolicyState:ht("securityPolicyState"),setSecurityPolicyGlobalState:mt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:mt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:mt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:mt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:mt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:mt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:mt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:mt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:mt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:mt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:mt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:vt("securityPolicyState",{securityPolicyState:_n})},wn={loadSecurityPolicy:ft("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ft("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ft("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ft("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ft("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ft("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ft("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ft("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ft("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ft("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ft("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ft("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ft("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ft("auth/loadPublicAuthStrategiesPolicy")},Un={loading:!1},Dn={setAccountSettingsState:ht("accountSettingsState"),resetAccountSettingsState:vt("accountSettingsState",{accountSettingsState:Un})},Rn={loadAccountSettings:ft("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ft("auth/saveAccountSettings",(e=>({payload:e})))},Cn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Nn={setTenantsState:ht("tenantsState"),resetTenantsState:vt("tenantsState",{tenantsState:Cn})},Mn={switchTenant:ft("auth/switchTenant",(e=>({payload:e}))),loadTenants:ft("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ft("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ft("auth/loadSubTenantsTree",(e=>({payload:e})))},Fn={loaders:{},errors:{},roles:[],permissions:[],permissionCategories:[]},Gn={setRolesState:ht("rolesState"),resetRolesState:vt("rolesState",{rolesState:Fn}),setRolesStateLoader:bt("rolesState"),setRolesStateError:At("rolesState")},$n={loadRolesAndPermissions:ft("auth/loadRoles",(e=>({payload:e}))),addRole:ft("auth/addRole",(e=>({payload:e}))),addRoleV2:ft("auth/addRoleV2",(e=>({payload:e}))),updateRole:ft("auth/updateRole",(e=>({payload:e}))),deleteRole:ft("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ft("auth/attachPermissionsToRole",(e=>({payload:e})))},xn={loading:!1,sessions:[]},Vn={setSessionsState:ht("sessionsState"),resetSessionsState:vt("sessionsState",{sessionsState:xn})},jn={loadUserSessions:ft("auth/loadUserSessions"),loadCurrentUserSession:ft("auth/loadCurrentUserSession"),deleteUserSession:ft("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ft("auth/deleteAllUserSessions"),revokeUserSessions:ft("auth/revokeUserSessions",(e=>({payload:e})))},Bn={loading:!1,configurations:{}},Wn={setSessionsPolicyState:ht("sessionsPolicyState"),resetSessionsPolicyState:vt("sessionsPolicyState",{sessionsPolicyState:Bn})},zn={loadSessionsPolicy:ft("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ft("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Kn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Kn||(Kn={}));const Hn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Kn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},qn={setRestrictionsState:ht("restrictionsState"),setIpRestrictionsState:mt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:mt("restrictionsState","emailDomainRestrictions")},Jn={checkIfUserIpValid:ft("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ft("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ft("auth/loadIpRestrictions"),saveIpRestriction:ft("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ft("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ft("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ft("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ft("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ft("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ft("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Yn={loading:!1},Xn={setProvisioningState:ht("provisioningState"),resetProvisioningState:vt("provisioningState",{provisioningState:Yn})},Qn={loadProvisionConnections:ft("auth/loadProvisionConnections"),createProvisionConnection:ft("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ft("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ft("auth/updateProvisionConnection",(e=>({payload:e})))},Zn={devices:[],loading:!1,error:null},ea={setPasskeysState:ht("passkeysState"),resetPasskeysState:vt("passkeysState",{passkeysState:Zn})},ta={loadWebAuthnDevices:ft("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ft("auth/deleteWebAuthnDevice",(e=>({payload:e})))},na={loaders:{},errors:{},groups:[],groupsConfiguration:{}},aa={setUsersGroupsLoader:bt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:ht("groupsState"),resetUsersGroupsState:vt("groupsState",{groupsState:na})},ia={loadGroups:ft("auth/loadUsersGroups"),getGroupById:ft("auth/getGroupById",(e=>({payload:e}))),createGroup:ft("auth/createGroup",(e=>({payload:e}))),updateGroup:ft("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ft("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ft("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ft("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ft("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ft("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ft("auth/getGroupConfiguration"),updateGroupConfiguration:ft("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ft("auth/getUsers",(e=>({payload:e})))},oa={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}},ra={setGroupsDialogsState:ht("groupsDialogsState"),resetGroupsDialogsState:vt("groupsState",{groupsDialogsState:oa}),openAddGroupDialog:Et("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Et("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Et("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Et("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Et("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Et("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Et("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},sa={loading:!0,error:null},la={setCustomLoginState:ht("customLoginState"),resetCustomLoginState:vt("customLoginState",{customLoginState:sa})},ca={loadTenantMetadata:ft("auth/loadTenantMetadata"),updateTenantMetadata:ft("auth/updateTenantMetadata",(e=>({payload:e})))},da={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ua,ya,fa,pa,ga;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ua||(ua={})),function(e){e.Nextjs="nextjs",e.React="react",e.Angular="angular",e.Vuejs="vuejs",e.Flutter="flutter",e.Ios="ios",e.Android="android",e.Vanillajs="vanillajs"}(ya||(ya={})),function(e){e.ASC="ASC",e.DESC="DESC"}(fa||(fa={})),function(e){e.createdAt="createdAt",e.name="name",e.email="email",e.id="id",e.verified="verified",e.isLocked="isLocked",e.provider="provider",e.tenantId="tenantId"}(pa||(pa={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(ga||(ga={}));const Sa=["local","saml","google","github","facebook","microsoft","scim2","slack"],va={loaders:{},errors:{},accounts:{tenantId:"",children:[]},accountsQueryParams:{_limit:50,_offset:0,_filter:"",_subTenantId:""},searchAccountsData:[],rootAccount:{tenantId:""},selectedAccount:{tenantId:"",userJwt:{accessToken:"",expiresIn:0,expires:""},users:[],usersQueryParams:{_offset:0,_limit:10,_order:fa.DESC,_sortBy:pa.name},usersPageOffset:0,accountSettings:{}}},ha={setAllAccountsLoader:bt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:ht("allAccountsState"),setSelectedAccountState:mt("allAccountsState","selectedAccount"),resetAllAccountsState:vt("allAccountsState",{allAccountsState:va})},ma={loadAccounts:ft("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:ft("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:ft("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:ft("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:ft("auth/updateAccount",(e=>({payload:e}))),updateSubAccountManagement:ft("auth/updateSubAccountManagement",(e=>({payload:e}))),deleteSubAccount:ft("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:ft("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:ft("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:ft("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:ft("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:ft("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:ft("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:ft("auth/setRootAccountData"),setSelectedSubAccountData:ft("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:ft("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},ba={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},disableSubAccountManagementDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1},enableSubAccountManagementDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1},deleteSubAccountDialog:{accountId:"",accountName:"",isParentAccount:!1,loading:!1,open:!1,error:!1,jwt:""},addUsersToAccountDialog:{loading:!1,open:!1,accountName:"",accountId:"",permissionToGiveAccessToSubAccounts:!1,jwt:""},deleteUserFromAccountDialog:{userId:"",userName:"",accountId:"",loading:!1,open:!1,jwt:""},editUserRolesDialog:{loading:!1,open:!1,jwt:"",accountId:"",userId:"",userName:"",userRoles:[]}},Aa={setAllAccountDialogsState:ht("allAccountsDialogsState"),resetAllAccountDialogsState:vt("allAccountsDialogsState",{allAccountsDialogsState:ba}),openCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Et("allAccountsDialogsState","createSubAccountDialog",ba.createSubAccountDialog),openUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Et("allAccountsDialogsState","updateSubAccountDialog",ba.updateSubAccountDialog),openDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Et("allAccountsDialogsState","deleteSubAccountDialog",ba.deleteSubAccountDialog),openDisableSubAccountManagementDialog:Tt("allAccountsDialogsState","disableSubAccountManagementDialog",{open:!0}),closeDisableSubAccountManagementDialog:Et("allAccountsDialogsState","disableSubAccountManagementDialog",ba.disableSubAccountManagementDialog),openEnableSubAccountManagementDialog:Tt("allAccountsDialogsState","enableSubAccountManagementDialog",{open:!0}),closeEnableSubAccountManagementDialog:Et("allAccountsDialogsState","enableSubAccountManagementDialog",ba.enableSubAccountManagementDialog),openAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Et("allAccountsDialogsState","addUsersToAccountDialog",ba.addUsersToAccountDialog),openDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Et("allAccountsDialogsState","deleteUserFromAccountDialog",ba.deleteUserFromAccountDialog),openEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Et("allAccountsDialogsState","editUserRolesDialog",ba.editUserRolesDialog)},Ta={loaders:{},errors:{},recommendations:void 0,insights:void 0,score:0,breachedPasswordUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},unenrolledMfaUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10}},inactiveUsersTable:{users:[],usersPageOffset:0,totalUsersItems:0,totalUsersPages:0,queryParams:{_offset:0,_limit:10,_maxInactiveSeconds:7776e3}}},Ea={setSecurityCenterState:ht("securityCenterState"),resetSecurityCenterState:vt("securityCenterState",{securityCenterState:Ta}),setSecurityCenterStateLoader:bt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ia={loadRecommendations:ft("auth/loadRecommendations"),loadInsights:ft("auth/loadInsights"),sendResetBreachedPasswordEmail:ft("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:ft("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:ft("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:ft("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:ft("auth/loadInactiveUsers",(e=>({payload:e})))};let ka,Oa,Pa;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ka||(ka={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Oa||(Oa={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Pa||(Pa={}));const _a={[Oa.Code]:Lt.loginWithOtc,[Oa.EmailAndPassword]:Lt.loginWithPassword,[Oa.MagicLink]:Lt.magicLinkPreLoginSuccess,[Oa.SmsCode]:Lt.loginWithSmsOtc},La={loading:!1,error:null,phoneNumbers:void 0},wa={setSmsState:ht("smsState"),resetSmsState:vt("smsState",{smsState:La})},Ua={loadPhoneNumbers:ft("auth/loadPhoneNumbers"),setUpPhoneNumber:ft("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:ft("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:ft("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:ft("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:ft("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Da={loading:!1,mfaDevices:void 0,mfaToken:""},Ra={setStepUpState:ht("stepUpState"),resetStepUpState:vt("stepUpState",{stepUpState:Da})},Ca={stepUpHostedLogin:ft("auth/stepUpHostedLogin",(e=>({payload:e}))),generateStepUpSession:ft("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:ft("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:ft("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:ft("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:ft("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:ft("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:ft("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:ft("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Na={setApplicationsState:ht("applicationsState")},Ma={loadUserApplications:ft("auth/loadUserApplications"),loadAccountApplications:ft("auth/loadAccountApplications"),assignUserToApps:ft("auth/assignUserToApps",(e=>({payload:e}))),unassignUserFromApps:ft("auth/unassignUserFromApps",(e=>({payload:e})))},Fa={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:Tn,loginState:$t,stepUpState:Da,activateState:Bt,acceptInvitationState:Ht,forgotPasswordState:Xt,ssoState:on,profileState:ln,customLoginState:sa,applicationsState:{loading:!0,fetching:!0,error:null,userApplications:[],accountApplications:[]},mfaState:yn,teamState:gn,groupsState:na,groupsDialogsState:oa,socialLoginState:hn,apiTokensState:kn,securityPolicyState:_n,accountSettingsState:Un,tenantsState:Cn,rolesState:Fn,resetPhoneNumberState:tn,sessionsState:xn,sessionsPolicyState:Bn,restrictionsState:Hn,provisioningState:Yn,passkeysState:Zn,allAccountsState:va,allAccountsDialogsState:ba,securityCenterState:Ta,smsState:La},Ga=$({routes:{authenticatedUrl:"/",loginUrl:"/account/login",stepUpUrl:"/account/step-up",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",openAppUrl:"/account/redirect"},onRedirectTo:()=>{}},Fa);let $a;!function(e){e.impersonating="impersonating",e.success="success"}($a||($a={}));const xa={step:$a.impersonating,loading:!1},Va={setImpersonateState:ht("impersonateState"),resetImpersonateState:vt("impersonateState",{impersonateState:xa})},ja={impersonate:ft("impersonation/impersonate",(e=>({payload:e})))},{reducer:Ba,actions:Wa}=gt({name:Nt,initialState:Ga,reducers:$({resetState:e=>$({},e,Fa),setState:(e,{payload:t})=>$({},e,t),setUser:("user",(e,{payload:t})=>$({},e,{user:t})),setEntitlements:mt("user","entitlements")},xt,Ra,mn,Wt,Va,qt,Qt,nn,En,cn,Na,la,rn,fn,Sn,aa,ra,On,Ln,Dn,Nn,Gn,Vn,Wn,qn,Xn,ea,ha,Aa,Ea,wa)});const za=$({loadEntitlements:ft("auth/loadEntitlements",(e=>({payload:e})))},Wa,Vt,Ca,bn,zt,Jt,Zt,an,In,dn,ca,Ma,sn,pn,vn,ia,{},Pn,wn,Rn,Mn,$n,jn,zn,Jn,Qn,ja,ta,ma,Ia,Ua);var Ka=function(e){return"@@redux-saga/"+e},Ha=Ka("CANCEL_PROMISE"),qa=Ka("CHANNEL_END"),Ja=Ka("IO"),Ya=Ka("MATCH"),Xa=Ka("MULTICAST"),Qa=Ka("SAGA_ACTION"),Za=Ka("SELF_CANCELLATION"),ei=Ka("TASK"),ti=Ka("TASK_CANCEL"),ni=Ka("TERMINATE"),ai=Ka("LOCATION");function ii(e,t){if(null==e)return{};var n,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}var oi=function(e){return null==e},ri=function(e){return null!=e},si=function(e){return"function"==typeof e},li=function(e){return"string"==typeof e},ci=Array.isArray,di=function(e){return e&&si(e.then)},ui=function(e){return e&&si(e.next)&&si(e.throw)},yi=function e(t){return t&&(li(t)||gi(t)||si(t)||ci(t)&&t.every(e))},fi=function(e){return e&&si(e.take)&&si(e.close)},pi=function(e){return si(e)&&e.hasOwnProperty("toString")},gi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype};const Si=function(e,t){var n;void 0===t&&(t=!0);var a=new Promise((function(a){n=setTimeout(a,Math.min(2147483647,e),t)}));return a[Ha]=function(){clearTimeout(n)},a};var vi=function(e){return function(){return e}},hi=vi(!0),mi=function(){},bi=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Ai=function(e,t){$(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ti(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Ei=function(e){throw e},Ii=function(e){return{value:e,done:!0}};function ki(e,t,n){void 0===t&&(t=Ei),void 0===n&&(n="iterator");var a={meta:{name:n},next:e,throw:t,return:Ii,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(a[Symbol.iterator]=function(){return a}),a}function Oi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Pi=function(e){return Array.apply(null,new Array(e))},_i=function(e){return function(t){return e(Object.defineProperty(t,Qa,{value:!0}))}},Li=function(e){return e===ni},wi=function(e){return e===ti},Ui=function(e){return Li(e)||wi(e)};function Di(e,t){var n,a=Object.keys(e),i=a.length,o=0,r=ci(e)?Pi(i):{},s={};return a.forEach((function(e){var a=function(a,s){n||(s||Ui(a)?(t.cancel(),t(a,s)):(r[e]=a,++o===i&&(n=!0,t(r))))};a.cancel=mi,s[e]=a})),t.cancel=function(){n||(n=!0,a.forEach((function(e){return s[e].cancel()})))},s}function Ri(e){return{name:e.name||"anonymous",location:Ci(e)}}function Ci(e){return e[ai]}var Ni=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),a=0,i=0,o=0,r=function(t){n[i]=t,i=(i+1)%e,a++},s=function(){if(0!=a){var t=n[o];return n[o]=null,a--,o=(o+1)%e,t}},l=function(){for(var e=[];a;)e.push(s());return e};return{isEmpty:function(){return 0==a},put:function(s){var c;if(a<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[i]=s,o=i=(i+1)%e;break;case 4:c=2*e,n=l(),a=n.length,i=n.length,o=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Mi="TAKE",Fi="CALL",Gi="FORK",$i="SELECT",xi=function(e,t){var n;return(n={})[Ja]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function Vi(e,t){return void 0===e&&(e="*"),yi(e)?(ri(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),xi(Mi,{pattern:e})):fi(n=e)&&n[Xa]&&ri(t)&&yi(t)?xi(Mi,{channel:e,pattern:t}):fi(e)?(ri(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),xi(Mi,{channel:e})):void 0;var n}function ji(e,t){return oi(t)&&(t=e,e=void 0),xi("PUT",{channel:e,action:t})}function Bi(e){var t=xi("ALL",e);return t.combinator=!0,t}function Wi(e,t){var n,a=null;return si(e)?n=e:(ci(e)?(a=e[0],n=e[1]):(a=e.context,n=e.fn),a&&li(n)&&si(a[n])&&(n=a[n])),{context:a,fn:n,args:t}}function zi(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi(Fi,Wi(e,n))}function Ki(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi(Gi,Wi(e,n))}function Hi(e){return void 0===e&&(e=Za),xi("CANCEL",e)}function qi(e){void 0===e&&(e=bi);for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return xi($i,{selector:e,args:n})}var Ji=zi.bind(null,Si);const Yi=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e};var Xi=[],Qi=0;function Zi(e){try{no(),e()}finally{ao()}}function eo(e){Xi.push(e),Qi||(no(),io())}function to(e){try{return no(),e()}finally{io()}}function no(){Qi++}function ao(){Qi--}function io(){var e;for(ao();!Qi&&void 0!==(e=Xi.shift());)Zi(e)}var oo=function(e){return function(t){return e.some((function(e){return uo(e)(t)}))}},ro=function(e){return function(t){return e(t)}},so=function(e){return function(t){return t.type===String(e)}},lo=function(e){return function(t){return t.type===e}},co=function(){return hi};function uo(e){var t="*"===e?co:li(e)?so:ci(e)?oo:pi(e)?so:si(e)?ro:gi(e)?lo:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var yo={type:qa},fo=function(e){return e&&e.type===qa};function po(){var e,t,n,a,i,o,r=(t=!1,a=n=[],i=function(){a===n&&(a=n.slice())},o=function(){t=!0;var e=n=a;a=[],e.forEach((function(e){e(yo)}))},(e={})[Xa]=!0,e.put=function(e){if(!t)if(fo(e))o();else for(var i=n=a,r=0,s=i.length;r<s;r++){var l=i[r];l[Ya](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var o;void 0===n&&(n=co),t?e(yo):(e[Ya]=n,i(),a.push(e),e.cancel=(o=!1,function(){o||(o=!0,i(),Ti(a,e))}))},e.close=o,e),s=r.put;return r.put=function(e){e[Qa]?s(e):eo((function(){s(e)}))},r}function go(e,t){var n=e[Ha];si(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var So,vo=0,ho=function(){return++vo};function mo(e){e.isRunning()&&e.cancel()}var bo=((So={}).TAKE=function(e,t,n){var a=t.channel,i=void 0===a?e.channel:a,o=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!fo(e)||r?n(e):n(ni)};try{i.take(s,ri(o)?uo(o):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},So.PUT=function(e,t,n){var a=t.channel,i=t.action,o=t.resolve;eo((function(){var t;try{t=(a?a.put:e.dispatch)(i)}catch(e){return void n(e,!0)}o&&di(t)?go(t,n):n(t)}))},So.ALL=function(e,t,n,a){var i=a.digestEffect,o=vo,r=Object.keys(t);if(0!==r.length){var s=Di(t,n);r.forEach((function(e){i(t[e],o,s[e],e)}))}else n(ci(t)?[]:{})},So.RACE=function(e,t,n,a){var i=a.digestEffect,o=vo,r=Object.keys(t),s=ci(t)?Pi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,a){c||(a||Ui(t)?(n.cancel(),n(t,a)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=mi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||i(t[e],o,l[e],e)}))},So.CALL=function(e,t,n,a){var i=t.context,o=t.fn,r=t.args,s=a.task;try{var l=o.apply(i,r);if(di(l))return void go(l,n);if(ui(l))return void wo(e,l,s.context,vo,Ri(o),!1,n);n(l)}catch(e){n(e,!0)}},So.CPS=function(e,t,n){var a=t.context,i=t.fn,o=t.args;try{var r=function(e,t){oi(e)?n(t):n(e,!0)};i.apply(a,o.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},So.FORK=function(e,t,n,a){var i=t.context,o=t.fn,r=t.args,s=t.detached,l=a.task,c=function(e){var t=e.context,n=e.fn,a=e.args;try{var i=n.apply(t,a);if(ui(i))return i;var o=!1;return ki((function(e){return o?{value:e,done:!0}:(o=!0,{value:i,done:!di(i)})}))}catch(e){return ki((function(){throw e}))}}({context:i,fn:o,args:r}),d=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ri(t)}(c,o);to((function(){var t=wo(e,c,l.context,vo,d,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},So.JOIN=function(e,t,n,a){var i=a.task,o=function(e,t){if(e.isRunning()){var n={task:i,cb:t};t.cancel=function(){e.isRunning()&&Ti(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ci(t)){if(0===t.length)return void n([]);var r=Di(t,n);t.forEach((function(e,t){o(e,r[t])}))}else o(t,n)},So.CANCEL=function(e,t,n,a){var i=a.task;t===Za?mo(i):ci(t)?t.forEach(mo):mo(t),n()},So.SELECT=function(e,t,n){var a=t.selector,i=t.args;try{n(a.apply(void 0,[e.getState()].concat(i)))}catch(e){n(e,!0)}},So.ACTION_CHANNEL=function(e,t,n){var a=t.pattern,i=function(e){void 0===e&&(e=Ni());var t=!1,n=[];return{take:function(a){t&&e.isEmpty()?a(yo):e.isEmpty()?(n.push(a),a.cancel=function(){Ti(n,a)}):a(e.take())},put:function(a){if(!t){if(0===n.length)return e.put(a);n.shift()(a)}},flush:function(n){t&&e.isEmpty()?n(yo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var a=0,i=e.length;a<i;a++)(0,e[a])(yo)}}}}(t.buffer),o=uo(a),r=function t(n){fo(n)||e.channel.take(t,o),i.put(n)},s=i.close;i.close=function(){r.cancel(),s()},e.channel.take(r,o),n(i)},So.CANCELLED=function(e,t,n,a){n(a.task.isCancelled())},So.FLUSH=function(e,t,n){t.flush(n)},So.GET_CONTEXT=function(e,t,n,a){n(a.task.context[t])},So.SET_CONTEXT=function(e,t,n,a){var i=a.task;Ai(i.context,t),n()},So);function Ao(e,t){return e+"?"+t}function To(e){var t=e.name,n=e.location;return n?t+" "+Ao(n.fileName,n.lineNumber):t}function Eo(e){var t,n,a,i=(t=function(e){return e.cancelledTasks},n=e,(a=[]).concat.apply(a,n.map(t)));return i.length?["Tasks cancelled due to error:"].concat(i).join("\n"):""}var Io=null,ko=[],Oo=function(e){e.crashedEffect=Io,ko.push(e)},Po=function(){Io=null,ko.length=0},_o=function(){var e,t,n=ko[0],a=ko.slice(1),i=n.crashedEffect?(e=n.crashedEffect,(t=Ci(e))?t.code+" "+Ao(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+To(n.meta)+(i?" \n when executing effect "+i:"")].concat(a.map((function(e){return" created by "+To(e.meta)})),[Eo(ko)]).join("\n")};function Lo(e,t,n,a,i,o,r){var s;void 0===r&&(r=mi);var l,c,d=0,u=null,y=[],f=Object.create(n),p=function(e,t,n){var a,i=[],o=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){i.push(t),t.cont=function(s,l){o||(Ti(i,t),t.cont=mi,l?r(s):(t===e&&(a=s),i.length||(o=!0,n(a))))}}function l(){o||(o=!0,i.forEach((function(e){e.cont=mi,e.cancel()})),i=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return i}}}(t,0,g);function g(t,n){if(n){if(d=2,Oo({meta:i,cancelledTasks:y}),S.isRoot){var a=_o();Po(),e.onError(t,{sagaStack:a})}c=t,u&&u.reject(t)}else t===ti?d=1:1!==d&&(d=3),l=t,u&&u.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[ei]=!0,s.id=a,s.meta=i,s.isRoot=o,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===d&&(d=1,p.cancelAll(),g(ti,!1))},s.cont=r,s.end=g,s.setContext=function(e){Ai(f,e)},s.toPromise=function(){return u||(u=Yi(),2===d?u.reject(c):0!==d&&u.resolve(l)),u.promise},s.isRunning=function(){return 0===d},s.isCancelled=function(){return 1===d||0===d&&1===t.status},s.isAborted=function(){return 2===d},s.result=function(){return l},s.error=function(){return c},s);return S}function wo(e,t,n,a,i,o,r){var s=e.finalizeRunEffect((function(t,n,a){di(t)?go(t,a):ui(t)?wo(e,t,c.context,n,i,!1,a):t&&t[Ja]?(0,bo[t.type])(e,t.payload,a,d):a(t)}));u.cancel=mi;var l={meta:i,cancel:function(){0===l.status&&(l.status=1,u(ti))},status:0},c=Lo(e,l,n,a,i,o,r),d={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),u(),c;function u(e,n){try{var i;n?(i=t.throw(e),Po()):wi(e)?(l.status=1,u.cancel(),i=si(t.return)?t.return(ti):{done:!0,value:ti}):i=Li(e)?si(t.return)?t.return():{done:!0}:t.next(e),i.done?(1!==l.status&&(l.status=3),l.cont(i.value)):y(i.value,a,u)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,a,i){void 0===i&&(i="");var o,r=ho();function l(n,i){o||(o=!0,a.cancel=mi,e.sagaMonitor&&(i?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),i&&function(e){Io=e}(t),a(n,i))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:i,effect:t}),l.cancel=mi,a.cancel=function(){o||(o=!0,l.cancel(),l.cancel=mi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Uo(e,t){for(var n=e.channel,a=void 0===n?po():n,i=e.dispatch,o=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,d=e.onError,u=void 0===d?Oi:d,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=ho();if(l&&(l.rootSagaStarted=l.rootSagaStarted||mi,l.effectTriggered=l.effectTriggered||mi,l.effectResolved=l.effectResolved||mi,l.effectRejected=l.effectRejected||mi,l.effectCancelled=l.effectCancelled||mi,l.actionDispatched=l.actionDispatched||mi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=qe.apply(void 0,c);g=function(e){return function(t,n,a){return h((function(t){return e(t,n,a)}))(t)}}}else g=bi;var m={channel:a,dispatch:_i(i),getState:o,sagaMonitor:l,onError:u,finalizeRunEffect:g};return to((function(){var e=wo(m,S,s,v,Ri(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}const Do=function(e){var t,n=void 0===e?{}:e,a=n.context,i=void 0===a?{}:a,o=n.channel,r=void 0===o?po():o,s=n.sagaMonitor,l=ii(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,a=e.dispatch;return t=Uo.bind(null,$({},l,{context:i,channel:r,dispatch:a,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){Ai(i,e)},c};var Ro=function(e){return{done:!0,value:e}},Co={};function No(e){return fi(e)?"channel":pi(e)?String(e):si(e)?e.name:String(e)}function Mo(e,t,n){var a,i,o,r=t;function s(t,n){if(r===Co)return Ro(t);if(n&&!i)throw r=Co,n;a&&a(t);var s=n?e[i](n):e[r]();return r=s.nextState,o=s.effect,a=s.stateUpdater,i=s.errorState,r===Co?Ro(t):o}return ki(s,(function(e){return s(null,e)}),n)}function Fo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:Ki.apply(void 0,[t].concat(a,[e]))}},l=function(e){return o=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeEvery("+No(e)+", "+t.name+")")}function Go(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r,s={done:!1,value:Vi(e)},l=function(e){return{done:!1,value:Ki.apply(void 0,[t].concat(a,[e]))}},c=function(e){return{done:!1,value:Hi(e)}},d=function(e){return o=e},u=function(e){return r=e};return Mo({q1:function(){return{nextState:"q2",effect:s,stateUpdater:u}},q2:function(){return o?{nextState:"q3",effect:c(o)}:{nextState:"q1",effect:l(r),stateUpdater:d}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:d}}},"q1","takeLatest("+No(e)+", "+t.name+")")}function $o(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];var o,r={done:!1,value:Vi(e)},s=function(e){return{done:!1,value:zi.apply(void 0,[t].concat(a,[e]))}},l=function(e){return o=e};return Mo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(o)}}},"q1","takeLeading("+No(e)+", "+t.name+")")}function xo(e,t,n){for(var a=e,i=arguments.length,o=new Array(i>3?i-3:0),r=3;r<i;r++)o[r-3]=arguments[r];var s={done:!1,value:zi.apply(void 0,[n].concat(o))},l={done:!1,value:Ji(t)};return Mo({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Co}},q10:function(e){if((a-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Vo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[Fo,e,t].concat(a))}function jo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[Go,e,t].concat(a))}function Bo(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return Ki.apply(void 0,[$o,e,t].concat(a))}class Wo{constructor(){this.context=null,this.accessToken=null,this.user=null,this.requestSource=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout",this.entitlementsOptions=null,this.appName=null,this.sessionContext=void 0}static getInstance(){return Wo.instance||(Wo.instance=new Wo),Wo.instance}static setContext(e){Wo.getInstance().context=e}static setAccessToken(e){Wo.getInstance().accessToken=e}static setUser(e){Wo.getInstance().user=e}static setRequestSource(e){Wo.getInstance().requestSource=e}static setOnRedirectTo(e){Wo.getInstance().onRedirectTo=e}static setLogout(e,t){Wo.getInstance().logout=n=>{n?e(n):Wo.onRedirectTo(t)}}static setEntitlementsOptions(e){Wo.getInstance().entitlementsOptions=e}static setSessionContext(e){Wo.getInstance().sessionContext=e}static setAppName(e){Wo.getInstance().appName=e}static getContext(){var e;return null!=(e=Wo.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Wo.getInstance().accessToken}static getRequestSource(){return Wo.getInstance().requestSource}static getUser(){return Wo.getInstance().user}static onRedirectTo(e,t){return Wo.getInstance().onRedirectTo(e,t)}static logout(e){return Wo.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Wo.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Wo.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Wo.getInstance().appName}}Wo.instance=void 0;const zo={getContext:()=>Wo.getContext(),getAccessToken:()=>Wo.getAccessToken(),getUser:()=>Wo.getUser(),onRedirectTo:(e,t)=>Wo.onRedirectTo(e,t),logout:e=>Wo.logout(e)};class Ko extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Ho={v1:"/identity/resources/users/webauthn/v1/devices"},qo={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Jo={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",v3:"/identity/resources/users/v3",roles:{v3:"/identity/resources/users/v3/roles"},groups:{v3:"/identity/resources/users/v3/groups"},tenants:{me:{v1:"/identity/resources/users/v1/me/tenants",v3:"/identity/resources/users/v3/me/tenants"}},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"}},passwords:{resetBreachedPasswords:{v1:"/identity/resources/users/v1/passwords/breached/reset/bulk"}},authorization:{v1:"/identity/resources/users/v1/me/authorization"},temporary:{v1:"/identity/resources/users/temporary/v1",configuration:{v1:"/identity/resources/users/temporary/v1/configuration"}}},Yo={v1:"/identity/resources/configurations/v1"},Xo={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Qo={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Zo={v1:"/identity/resources/permissions/v1"},er={apiTokens:{v1:"/identity/resources/tenants/api-tokens/v1",v2:"/identity/resources/tenants/api-tokens/v2"},accessTokens:{v1:"/identity/resources/tenants/access-tokens/v1"},invites:{user:{v1:"/identity/resources/tenants/invites/v1/user"},verify:{v1:"/identity/resources/tenants/invites/v1/verify"},configuration:{v1:"/identity/resources/tenants/invites/v1/configuration"}},users:{v1:"/identity/resources/tenants/users/v1"}},tr={v1:"/identity/resources/roles/v1",v2:"/identity/resources/roles/v2"},nr={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},ar={v1:"/identity/resources/impersonation/v1"},ir={v1:"/identity/resources/applications/v1"},or={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},rr={v1:"/identity/resources/users/phone-numbers/v1"},sr={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},lr={v1:"/team/resources/members/v1"},cr={v1:"/team/resources/roles/v1"},dr={v1:"/team/resources/stats/v1"},ur={v1:"/team/resources/profile"},yr={v1:"/tenants/resources/account-settings/v1"},fr={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"},parents:{v1:"/tenants/resources/hierarchy/v1/parents"},v2:"/tenants/resources/hierarchy/v2",metadata:{v2:"/tenants/resources/hierarchy/v2/metadata"}},pr={v1:"/tenants/resources/sub-tenants/v1"},gr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Sr={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"}}}},vr={v1:"/subscriptions/resources/payment-providers/v1"},hr={v1:"/subscriptions/resources/subscriptions/v1"},mr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},br={v1:"/reports/engine/resources/triggers/v1"},Ar="/notification",Tr="/audits",Er={v1:"/event/resources/configurations/v1"},Ir="/webhook",kr="/oauth",Or="/flags",Pr="/directory/resources/v1/configurations/scim2",_r="/directory/resources/scim/temp",Lr="/entitlements/api/v2/user-entitlements",wr={v1:"/security-center/resources/recommendations/v1"},Ur={v1:"/security-center/resources/insights/v1"},Dr="/applications/resources/applications/v1",Rr={v1:"/applications/resources/applications/tenant-assignments/v1"};function Cr(e,t,n=!0){let a;a="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const i=e.urlPrefix||"frontegg",o="frontegg"===i&&!n;return a.endsWith("/")||(a+="/"),a.endsWith(i)||o||(a+=i),a}function Nr(e){var t,n;const a={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(a[da.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(a[da.frameWork]=e.metadataHeaders.framework),a}function Mr(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Fr=async e=>{var t,n,a;const i=Wo.getContext(),o=await async function(e,t){var n;const a=Nr(e),i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Wo.getAccessToken)(),o=Wo.getRequestSource(),r=Mr();t&&(a[da.contentType]=t),o&&(a[da.source]=o),i&&(a.Authorization=`Bearer ${i}`),r&&(a[da.scopedTenant]=r);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return e.appId&&t.push({key:"frontegg-requested-application-id",value:e.appId}),t}(e))a[`${t.key}`]=`${t.value}`;return a}(i,e.contentType),r=await async function(e,t,n){const a=Cr(e,t),i=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const a=Object.keys(t);for(const e of a){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let o=t.startsWith("http")?t:`${a}${t}`;const r=Object.keys(i).length>0;return i&&r&&(o+=`?${new URLSearchParams(i)}`),o}(i,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:$({},o,e.headers),credentials:null!=(n=null!=(a=e.credentials)?a:i.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Ko("Error request is too large",s.status);let e,t=!0;try{e=await s.text(),e=JSON.parse(e)}catch(e){t=!1}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=i.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=i.logLevel)?c:"")&&console.error(e),new Ko(t?e:"We're facing some difficulties, Please try again",s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},Gr=async(e,t,n)=>Fr($({url:e,method:"GET",contentType:"application/json",params:t},n)),$r=async(e,t,n)=>Fr($({url:e,method:"POST",contentType:"application/json",body:t},n)),xr=async(e,t,n)=>Fr($({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Vr=async(e,t,n)=>Fr($({url:e,method:"PUT",contentType:"application/json",body:t},n)),jr=async(e,t,n)=>Fr($({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Br=async(e,t,n,a)=>Fr($({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},a)),Wr=(e={})=>$({},e.jwt?{Authorization:e.jwt}:{}),zr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Kr={flags:{}};class Hr{constructor(){var e;this._flags={},this._flags=null!=(e=Kr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Hr;return n.set(e),Hr._instances[t]=n,n}static getFeatureFlags(e,t){const n=this.getInstance(t);return e.map((e=>"on"===(null==n?void 0:n._flags[e])))}get flags(){var e;return null!=(e=this.flags)?e:{}}set(e){var t;this._flags=$({},null!=(t=null==Kr?void 0:Kr.flags)?t:{},null!=e?e:{})}}async function qr(){return Gr(Or)}async function Jr(e){return $r(`${Jo.v3}/me/token`,e)}async function Yr(e,t){return Gr(Jo.v2,e,{headers:Wr(t)})}async function Xr(e,t){return Gr(Jo.v3,e,{headers:Wr(t)})}async function Qr(e,t){return Gr(Jo.roles.v3,$({},e,{ids:e.ids.join(",")}),{headers:Wr(t)})}async function Zr(e,t){return Gr(Jo.groups.v3,$({},e,{ids:e.ids.join(",")}),{headers:Wr(t)})}async function es(e){return Gr(Jo.tenants.me.v3,void 0,{headers:Wr(e)})}async function ts(e){return Gr(Jo.tenants.me.v1,void 0,{headers:Wr(e)})}async function ns(){return $r(Jo.passwords.resetBreachedPasswords.v1)}async function as(e){return Vr(`${Jo.v2}/me`,e)}function is(e){e&&sessionStorage.setItem(zr,e)}function os(){sessionStorage.removeItem(zr)}function rs(){return Wo.isSessionPerTenantEnabled()?sessionStorage.getItem(zr):null}function ss(){const[e]=Hr.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Wo.getAppName()||"");return Wo.isSessionPerTenantEnabled()||e?ts:es}async function ls(e){return Wo.isSessionPerTenantEnabled()&&is(e.tenantId),Vr(`${Jo.v1}/tenant`,e)}async function cs(){return Gr(`${Jo.v2}/me/tenants`)}async function ds(e){return Gr(fr.v1,void 0,{headers:Wr(e)})}async function us(e){return Gr(fr.tree.v1,void 0,{headers:Wr(e)})}async function ys(e){return Gr(fr.parents.v1,void 0,{headers:Wr(e)})}async function fs(e,t){return Gr(`${fr.parents.v1}/${e}`,void 0,{headers:Wr(t)})}async function ps(e,t){return $r(`${er.users.v1}/count`,e,{headers:Wr(t)})}async function gs(e,t){return Gr(fr.v2,e,{headers:Wr(t)})}async function Ss(e,t){return Gr(fr.metadata.v2,$({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:Wr(t)})}async function vs(){return Gr(Yo.v1)}async function hs(){return Gr(`${Yo.v1}/mfa-policy`)}async function ms(){return Gr(`${Yo.v1}/mfa-policy/vendor`)}async function bs(e){return e.id?xr(`${Yo.v1}/mfa-policy`,e):$r(`${Yo.v1}/mfa-policy`,e)}async function As(){return Gr(`${Yo.v1}/lockout-policy`)}async function Ts(){return Gr(`${Yo.v1}/lockout-policy/vendor`)}async function Es(e){return e.id?xr(`${Yo.v1}/lockout-policy`,e):$r(`${Yo.v1}/lockout-policy`,e)}async function Is(){try{return await Gr(`${Yo.v1}/captcha-policy/public`)}catch{return null}}async function ks(){return Gr(`${Yo.v1}/password-history-policy`)}async function Os(){return Gr(`${Yo.v1}/password-history-policy/vendor`)}async function Ps(e){return e.id?xr(`${Yo.v1}/password-history-policy`,e):$r(`${Yo.v1}/password-history-policy`,e)}async function _s(){return Gr(`${Yo.v1}/password`)}async function Ls(){return Gr(`${Xo.emailDomain.v1}`)}async function ws(){return Gr(`${Xo.emailDomain.v1}/config`)}async function Us(e){return $r(`${Xo.emailDomain.v1}`,e)}async function Ds(e){return $r(`${Xo.emailDomain.v1}/config`,e)}async function Rs(e){return jr(`${Xo.emailDomain.v1}/${e}`)}async function Cs(e){return Gr(`${Xo.ip.v1}`,e)}async function Ns(){return Gr(`${Xo.ip.v1}/config`)}async function Ms(e){return $r(`${Xo.ip.v1}`,e)}async function Fs(e){return $r(`${Xo.ip.v1}/bulk`,e)}async function Gs(e){return $r(`${Xo.ip.v1}/config`,e)}async function $s(e){return jr(`${Xo.ip.v1}/${e}`)}async function xs(){return $r(`${Xo.ip.v1}/verify`)}async function Vs(){return $r(`${Xo.ip.v1}/verify/allow`)}Hr._instances={};class js extends Error{constructor(e){super(e)}}const Bs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new js("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,a,i=0,o=0;a=t.charAt(o++);~a&&(e=i%4?64*e+a:a,i++%4)?n+=String.fromCharCode(255&e>>(-2*i&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);return n};class Ws extends Error{constructor(e){super(e)}}const zs=(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(Bs(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 Bs(t)}})(e.split(".")[n]))}catch(e){throw new Ws("Invalid token specified: "+e.message)}};let Ks,Hs,qs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Ks||(Ks={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Hs||(Hs={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(qs||(qs={}));const Js="admin_portal_should_load_authorization";async function Ys(){return Gr(Lr)}let Xs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Xs||(Xs={}));const Qs="admin_portal_entitlements",Zs=["type"],el=["type"],tl=["type"];async function nl(e){if(!e.accessToken)return e;Wo.setAccessToken(e.accessToken);const t=await zd(),n=$({},e,e.accessToken?zs(e.accessToken):{},t);return Wo.setUser(n),n}async function al(e){if(!e.accessToken)return{user:e};Wo.setAccessToken(e.accessToken);const[t,n]=await Promise.all([zd(),cs()]),a=$({},e,e.accessToken?zs(e.accessToken):{},t);return Wo.setUser(a),{user:a,tenants:n}}function il(){if(!Wo.shouldLoadEntitlements())return!1;const[e]=Hr.getFeatureFlags([Qs],Wo.getAppName()||"");return e}function ol(){const[e]=Hr.getFeatureFlags([Js],Wo.getAppName()||"");return e}async function rl(e){const{accessToken:t}=e;if(!t)return{user:e};Wo.setAccessToken(t);const[n,a]=await Promise.all([zd(),ss()()]),i=$({},e,t?zs(t):{},n);return Wo.isSessionPerTenantEnabled()&&is(i.tenantId),Wo.setUser(i),{user:i,tenants:a.tenants,activeTenant:a.activeTenant}}async function sl(e){Wo.setAccessToken(e.id_token);const t=await zd(),n=e.id_token?zs(e.id_token):{},a=$({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Wo.setUser(a),a}async function ll(e){Wo.setAccessToken(e.id_token);const[t,n]=await Promise.all([zd(),ss()()]),a=e.id_token?zs(e.id_token):{},i=$({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},a,t,{expiresIn:e.expires_in||300});return Wo.isSessionPerTenantEnabled()&&is(i.tenantId),Wo.setUser(i),{user:i,tenants:n.tenants,activeTenant:n.activeTenant}}async function cl(e){try{const{address:t}=await $r(`${qo.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function dl(e){return $r(`${qo.v1}/user/saml/prelogin`,e)}async function ul(e){return nl(await $r(`${qo.v1}/user/saml/postlogin`,e))}async function yl(e){return nl(await $r(`${qo.v1}/user/oidc/postlogin`,e))}async function fl(e){return nl(await $r(`${qo.v1}/user`,e))}async function pl(e){return rl(await $r(`${qo.v1}/user`,e))}async function gl(e){return nl(await $r(`${qo.v1}/user/mfa/verify`,e))}async function Sl(e){return rl(await $r(`${qo.v1}/user/mfa/verify`,e))}async function vl(e){return $r(`${Jo.v1}/activate`,e)}async function hl(e){return rl(await $r(`${Jo.v1}/activate`,e))}async function ml(e){return Gr(`${Jo.v1}/activate/strategy`,e)}async function bl(e){return $r(`${Jo.v1}/activate/reset`,e)}async function Al(e){return $r(`${Jo.v1}/invitation/reset`,e)}async function Tl(e){return $r(`${Jo.v1}/invitation/accept`,e)}async function El(){const e=rs();return nl(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function Il(){const e=rs();return al(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function kl(){const e=rs();return rl(await $r(`${qo.v1}/user/token/refresh`,{tenantId:e}))}async function Ol(){return $r(`${qo.v1}/logout`)}async function Pl(e){return Gr(`${kr}/logout`,e)}async function _l(e){return $r(`${Jo.v1}/passwords/reset`,e)}async function Ll(e){return $r(`${Jo.v1}/passwords/reset/verify`,e)}async function wl(e){return Gr(`${Jo.v1}/passwords/config`,e)}async function Ul(e){return $r(`${qo.v1}/user/mfa/recover`,e)}async function Dl(){return $r(`${Jo.v1}/mfa/enroll`)}async function Rl(){return $r(`${Jo.v1}/mfa/authenticator/enroll`)}async function Cl(e){return $r(`${Jo.v1}/mfa/authenticator/enroll/verify`,e)}async function Nl(e){return $r(`${Jo.v1}/mfa/sms/enroll`,e)}async function Ml(e){return $r(`${Jo.v1}/mfa/sms/enroll/verify`,e)}async function Fl(){return $r(`${Jo.v1}/mfa/webauthn/enroll`)}async function Gl(e){return $r(`${Jo.v1}/mfa/webauthn/enroll/verify`,e)}async function $l(e){return $r(`${Jo.v1}/mfa/enroll/verify`,e)}async function xl(e){return $r(`${Jo.v1}/mfa/disable`,e)}async function Vl(e,t){return $r(`${Jo.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function jl(e){return $r(`${Jo.v1}/mfa/sms/${e}/disable`)}async function Bl(e,t){return $r(`${Jo.v1}/mfa/sms/${e}/disable/verify`,t)}async function Wl(e){return $r(`${Jo.v1}/mfa/webauthn/${e}/disable`)}async function zl(e,t){return $r(`${Jo.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Kl(){return Gr(`${Jo.v1}/mfa/devices`)}async function Hl(e){return $r(`${qo.v1}/user/mfa/authenticator/enroll`,e)}async function ql(e){return $r(`${qo.v1}/user/mfa/authenticator/enroll/verify`,e)}async function Jl(e){return rl(await $r(`${qo.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Yl(e,t){return $r(`${qo.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Xl(e){return $r(`${qo.v1}/user/mfa/emailcode`,e)}async function Ql(e){return $r(`${qo.v1}/user/mfa/emailcode/verify`,e)}async function Zl(e){return rl(await $r(`${qo.v1}/user/mfa/emailcode/verify`,e))}async function ec(e){return $r(`${qo.v1}/user/mfa/sms/enroll`,e)}async function tc(e){return $r(`${qo.v1}/user/mfa/sms/enroll/verify`,e)}async function nc(e){return rl(await $r(`${qo.v1}/user/mfa/sms/enroll/verify`,e))}async function ac(e,t){return $r(`${qo.v1}/user/mfa/sms/${e}`,t)}async function ic(e,t){return $r(`${qo.v1}/user/mfa/sms/${e}/verify`,t)}async function oc(e,t){return rl(await $r(`${qo.v1}/user/mfa/sms/${e}/verify`,t))}async function rc(e){return $r(`${qo.v1}/user/mfa/webauthn/enroll`,e)}async function sc(e){return $r(`${qo.v1}/user/mfa/webauthn/enroll/verify`,e)}async function lc(e){return rl(await $r(`${qo.v1}/user/mfa/webauthn/enroll/verify`,e))}async function cc(e,t){return $r(`${qo.v1}/user/mfa/webauthn/${e}`,t)}async function dc(e,t){return $r(`${qo.v1}/user/mfa/webauthn/${e}/verify`,t)}async function uc(e,t){return rl(await $r(`${qo.v1}/user/mfa/webauthn/${e}/verify`,t))}async function yc(){return Gr(`${sr.v1}/saml/configurations`)}async function fc(e){return $r(`${sr.v1}/saml/configurations`,e)}async function pc(){return Gr(`${sr.v1}/saml/configurations/vendor-config`)}async function gc(e){return Vr(`${sr.v1}/saml/configurations/metadata`,e)}async function Sc(){return Vr(`${sr.v1}/saml/validations/domain`)}async function vc(){return Gr(`${sr.v1}/saml/configurations/roles/default`)}async function hc(){return Gr(`${sr.v2}/saml/configurations/groups`)}async function mc({roleIds:e}){return $r(`${sr.v1}/saml/configurations/roles/default`,{roleIds:e})}async function bc({roleIds:e,group:t}){return $r(`${sr.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Ac({roleIds:e,group:t,id:n}){return xr(`${sr.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Tc({id:e}){return jr(`${sr.v2}/saml/configurations/groups/${e}`)}async function Ec(){return Gr(`${sr.v1}/oidc/configurations`)}async function Ic(){return Gr(`${sr.v2}/configurations/public`)}async function kc(){return Gr(Qo.v1)}async function Oc(){return Gr(Qo.v2)}async function Pc(){return Gr(`${Qo.v2}/authenticated`)}async function _c(){return Gr(Qo.custom.v1)}async function Lc({provider:e,code:t,idToken:n,redirectUri:a,codeVerifier:i,metadata:o,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),a&&(l.redirectUri=a),i&&(l.code_verifier=i),s&&(l.state=s),$r(`${qo.v1}/user/sso/${e}/postlogin`,{metadata:o,invitationToken:r},{params:l})}async function wc(){return Gr(`${Yo.v1}/public`)}async function Uc(e){const{shouldActivate:t,authResponse:n,userId:a,tenantId:i}=await $r(`${Jo.v1}/signUp`,e),o={shouldActivate:t,userId:a,tenantId:i};if(!t&&n){const{user:e,tenants:t,activeTenant:a}=await rl(n);return $({},o,{user:e,tenants:t,activeTenant:a})}return o}async function Dc(){return Gr(Jo.sessions.currentUser.v1)}async function Rc(){return Gr(`${Jo.sessions.currentUser.v1}/current`)}async function Cc(e){return $r(`${Jo.sessions.v1}/revoke`,{userId:e})}async function Nc(){return Gr(Jo.sessions.configurations.v1)}async function Mc(e){await $r(Jo.sessions.configurations.v1,e)}async function Fc(e){await jr(`${Jo.sessions.currentUser.v1}/${e}`)}async function Gc(){await jr(`${Jo.sessions.currentUser.v1}/all`)}async function $c(){return Gr(Jo.accessTokens.v1)}async function xc(){return Gr(er.accessTokens.v1)}async function Vc({id:e}){return jr(`${er.accessTokens.v1}/${e}`)}async function jc({id:e}){return jr(`${Jo.accessTokens.v1}/${e}`)}async function Bc(e){return $r(Jo.accessTokens.v1,e)}async function Wc(e){return $r(er.accessTokens.v1,e)}async function zc(){return Gr(Jo.apiTokens.v1)}async function Kc(){return Gr(er.apiTokens.v1)}async function Hc(e){return $r(Jo.apiTokens.v1,e)}async function qc(e){return $r(er.apiTokens.v2,e)}async function Jc({tokenId:e}){return jr(`${er.apiTokens.v1}/${e}`)}async function Yc({tokenId:e}){return jr(`${Jo.apiTokens.v1}/${e}`)}async function Xc({userId:e}){return Gr(`${Jo.v1}/${e}`)}async function Qc(e){return Gr(`${Yo.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Zc(e){let{type:t}=e,n=ii(e,Zs);return $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function ed(e){let{type:t}=e,n=ii(e,el);return rl(await $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function td(e){let{type:t}=e,n=ii(e,tl);return $r(`${qo.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function nd({token:e}){return $r(er.invites.verify.v1,{token:e})}async function ad(){return Gr(`${sr.v1}/configurations`)}async function id(e){return $r(`${sr.v1}/configurations`,e)}async function od(e,t){return xr(`${sr.v1}/configurations/${e}`,t)}async function rd(e){return jr(`${sr.v1}/configurations/${e}`)}async function sd(e){return $r(`${sr.v1}/configurations/metadata`,e)}async function ld(e,t){return Vr(`${sr.v1}/configurations/${e}/metadata`,t)}async function cd(e){return $r(`${sr.v1}/configurations/metadata-url`,e)}async function dd(e,t){return Vr(`${sr.v1}/configurations/${e}/metadata-url`,t)}async function ud(e,t){return $r(`${sr.v1}/configurations/${e}/domains`,t)}async function yd(e,t){return jr(`${sr.v1}/configurations/${e}/domains/${t}`)}async function fd(e,t){return Vr(`${sr.v1}/configurations/${e}/domains/${t}/validate`)}async function pd(e,t){return Vr(`${sr.v2}/configurations/${e}/domains/${t}/validate`)}async function gd(e){return Gr(`${sr.v1}/configurations/${e}/roles`)}async function Sd(e,t){return Vr(`${sr.v1}/configurations/${e}/roles`,t)}async function vd(e,t){return $r(`${sr.v1}/configurations/${e}/groups`,t)}async function hd(e,{roleIds:t,group:n,id:a}){return xr(`${sr.v1}/configurations/${e}/groups/${a}`,{group:n,roleIds:t})}async function md(e,t){return jr(`${sr.v1}/configurations/${e}/groups/${t}`)}async function bd(e){return Gr(`${sr.v1}/configurations/${e}/groups`)}async function Ad(e){return $r(`${qo.v2}/user/sso/prelogin`,e)}async function Td(e){return nl(await $r(`${qo.v2}/user/oidc/postlogin`,e))}async function Ed(e){return ll(await $r(`${kr}/token`,e))}async function Id(){const e=rs();return ll(await $r(`${kr}/authorize/silent`,{tenantId:e}))}async function kd(e){return sl(await $r(`${kr}/token`,e))}async function Od(){const e=rs();return sl(await $r(`${kr}/authorize/silent`,{tenantId:e}))}async function Pd(e){return $r(`${Jo.v1}/phone/reset`,e)}async function _d(e){return $r(`${Jo.v1}/phone/reset/verify`,e)}async function Ld(e){return $r(`${Jo.v1}/phone`,e)}async function wd(e){return $r(`${Jo.v1}/phone/verify`,e)}async function Ud(e){return Vr(`${Jo.v1}/phone/change`,e)}async function Dd(e){return $r(`${qo.v1}/webauthn/prelogin`,e)}async function Rd(e){return $r(`${qo.v1}/webauthn/postlogin`,e)}async function Cd(e){return rl(await $r(`${qo.v1}/webauthn/postlogin`,e))}async function Nd(){return $r(Ho.v1)}async function Md(){return Gr(Ho.v1)}async function Fd(e){return jr(`${Ho.v1}/${e}`)}async function Gd(e){return $r(`${Ho.v1}/verify`,e)}async function $d(){return Gr(`${Yo.v1}/auth/strategies/public`)}async function xd(){return Gr(`${Yo.v1}/auth/strategies`)}async function Vd(){return Gr(`${Yo.v1}/mfa/strategies`)}async function jd(){return Gr(`${Jo.authorization.v1}`)}async function Bd(){return Gr(`${Jo.v2}/me`)}const Wd=async()=>{try{return await Ys()}catch(e){}};async function zd(){const e=[{action:Bd,shouldLoad:!0},{action:Wd,shouldLoad:il()},{action:jd,shouldLoad:ol()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[t,n,a]=await Promise.all(e),i=rs();return i&&(t.tenantId=i),$({},t,null!=a?a:{},{entitlements:n})}async function Kd(e){const t=await $r(`${qo.v1}/user/step-up/generate`,e);return t.accessToken?rl(t):t}async function Hd(e){return Gr(`${Jo.v2}/me`,null!=e?e:{addRoles:!0})}async function qd(e){return Vr(`${Jo.v2}/me`,e)}async function Jd(e){return Vr(`${ur.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Yd(e){return $r(`${Jo.v1}/passwords/change`,e)}async function Xd(e){var t,n,a,i,o,r;const s=(e.filter||[]).reduce(((e,t)=>$({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(a=e.sort)||null==(i=a[0])?void 0:i.id)?n:"name",sortDirection:null!=(o=e.sort)&&null!=(r=o[0])&&r.desc?"desc":"asc"}:null;return Gr(lr.v1,$({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Qd(e){return $r(Jo.v2,$({},e,{provider:"local"}))}async function Zd(e){return jr(`${lr.v1}/${e.userId}`)}async function eu(e){return Vr(lr.v1,e)}async function tu(e){const{userId:t,expirationInSeconds:n}=e;return Vr(`${Jo.temporary.v1}/${t}`,{expirationInSeconds:n})}async function nu(e){return jr(`${Jo.temporary.v1}/${e}`)}async function au(){return Gr(Jo.temporary.configuration.v1)}async function iu(e){return $r(er.invites.user.v1,$({},e))}async function ou(e){return xr(er.invites.user.v1,$({},e))}async function ru(){return jr(er.invites.user.v1)}async function su(){return Gr(er.invites.user.v1)}async function lu(){return Gr(er.invites.configuration.v1)}async function cu(){return Gr(cr.v1)}async function du(){return Gr(Zo.v1)}async function uu(){return Gr(`${dr.v1}/members`)}async function yu(e){return $r(`${lr.v1}/${e.userId}/resendActivationEmail`,{})}async function fu(e){return $r(Jo.v2,$({},e,{provider:"local"}))}async function pu(e){return $r(Jo.invitation.resendAll.v1,$({},e))}async function gu(e){var t,n;const a=await Gr("/metadata",e);if(null!=a&&null!=(t=a.rows)&&t[0])return null==a||null==(n=a.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function Su(){return Gr("/metadata/admin-box")}async function vu(e){return $r("/metadata/admin-box",e)}async function hu(){const e=await Gr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const mu=async()=>gu({entityName:"notifications"}),bu=async()=>gu({entityName:"saml"}),Au=async()=>gu({entityName:"audits"}),Tu=async e=>async function(e){const t=await Gr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),Eu=["dataFilters"],Iu=["templateId","dataFilters"],ku=["dataFilters"];async function Ou(e){return Gr(`${mr.v2}/tenant-reports`,e)}async function Pu(e){return Gr(`${mr.v2}/${e.id}/tenant-reports`)}async function _u(e){let{dataFilters:t}=e,n=ii(e,Eu);return{html:await Gr(`${br.v1}/preview-report`,$({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lu(e){let{templateId:t,dataFilters:n}=e,a=ii(e,Iu);return $r(`${mr.v2}/${t}/tenant-reports`,$({},a,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function wu(e){let{dataFilters:t}=e,n=ii(e,ku);const a=await Gr(`${br.v1}/preview-report`,$({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let i="text/html",o="html";"pdf"===n.responseType?(i="application/pdf",o="pdf"):"image"===n.responseType&&(i="image/jpeg",o="jpg");const r=new Blob([a],{type:i}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${o}`),l.click(),setTimeout(l.remove.bind(l))}async function Uu(e){return $r(`${br.v1}/tenant-reports`,e)}async function Du(e){return Gr(Ar,{params:e})}async function Ru(e){return Vr(`${Ar}/status`,{params:e})}async function Cu(e){const{notificationId:t,pinStatus:n}=e;return Vr(`${Ar}/${n}`,{notificationId:t})}async function Nu(){return $r(`${Ar}/status/mark-all-read`)}const Mu=["endpoint","headerProps"];async function Fu(e){return Gr(Tr,e)}async function Gu(e){return Gr(`${Tr}/stats`,e)}async function $u(e){const{endpoint:t,headerProps:n}=e,a=ii(e,Mu);return Br(`${Tr}/export/${t}`,{properties:n},a)}const xu=["eventKey"],Vu=["eventKey"],ju=()=>Gr(`${gr.v1}/slack`),Bu=()=>Gr(`${gr.v1}/slack/applications`),Wu=()=>Gr(`${gr.v1}/slack/channels`),zu=e=>e.id?xr(`${gr.v1}/slack/subscription/${e.id}`,e):$r(`${gr.v1}/slack/subscriptions`,e),Ku=e=>jr(`${gr.v1}/slack/subscriptions/${e.id}`),Hu=e=>$r(`${gr.v1}/slack/applications/registrations`,{code:e}),qu=()=>Gr(`${gr.v1}/emails`),Ju=e=>{let{eventKey:t}=e,n=ii(e,xu);return $r(`${gr.v1}/emails/${t}`,n)},Yu=({eventKey:e,enabled:t})=>xr(`${gr.v1}/emails/${e}`,{enabled:t}),Xu=(e,t)=>jr(`${gr.v1}/emails/${e}/subscriptions/${t}`),Qu=(e,t,n)=>Vr(`${gr.v1}/emails/${t}/subscriptions/${e}`,n),Zu=e=>jr(`${gr.v1}/emails/${e}`),ey=()=>Gr(`${gr.v2}/sms`),ty=e=>{let{eventKey:t}=e,n=ii(e,Vu);return $r(`${gr.v2}/sms/${t}`,n)},ny=({eventKey:e,enabled:t})=>xr(`${gr.v2}/sms/${e}`,{enabled:t}),ay=(e,t)=>jr(`${gr.v2}/sms/${e}/subscriptions/${t}`),iy=(e,t,n)=>Vr(`${gr.v2}/sms/${t}/subscriptions/${e}`,n),oy=e=>jr(`${gr.v2}/sms/${e}`),ry=()=>Gr(Ir),sy=e=>e._id?xr(`${Ir}/${e._id}`,e):$r(`${Ir}/custom`,e),ly=e=>jr(`${Ir}/${e}`),cy=(e,t=0,n=10)=>{const a=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Gr(`${Ir}/logs/?${a.toString()}`)},dy=e=>$r(`${Ir}/test`,e),uy=e=>$r(`${Ir}/logs/${e}/retries`),yy=()=>Gr(`${Er.v1}/categories`),fy=e=>Gr(Er.v1,{channels:e});async function py(e,t){return Vr(yr.v1,e,{headers:Wr(t)})}async function gy(e){return Gr(yr.v1,void 0,{headers:Wr(e)})}async function Sy(){return Gr(`${yr.v1}/public`)}const vy=["roleId"],hy=["roleId"],my=["permissionId"];async function by(){return Gr(tr.v1)}async function Ay(e){return $r(tr.v1,e)}async function Ty({roleId:e}){return jr(`${tr.v1}/${e}`)}async function Ey(e){let{roleId:t}=e,n=ii(e,vy);return xr(`${tr.v1}/${t}`,n)}async function Iy(e){let{roleId:t}=e,n=ii(e,hy);return Vr(`${tr.v1}/${t}/permissions`,n)}async function ky(){return Gr(Zo.v1)}async function Oy(e){let{permissionId:t}=e,n=ii(e,my);return Vr(`${Zo.v1}/${t}/roles`,n)}async function Py(){return Gr(`${Zo.v1}/categories`)}async function _y(e){return $r(tr.v2,e)}async function Ly(){return Gr(Sr.subscriptions.v1)}async function wy(e){return Gr(`${Sr.subscriptions.v1}/${e}`)}async function Uy(e){return Vr(`${Sr.subscriptions.v1}/${e}/cancellations/`,{})}async function Dy(e){return Vr(`${Sr.subscriptions.v1}/${e}/renewals/`,{})}async function Ry(e,{paymentMethodId:t,planId:n}){return Vr(`${Sr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(e){return Gr(`${hr.v1}/${e}`)}async function Ny(){return Gr(`${hr.v1}`)}async function My(e){return Vr(`${hr.v1}/${e}/cancellations/`,{})}async function Fy(e){return Vr(`${hr.v1}/${e}/renewals/`,{})}async function Gy(e,{paymentMethodId:t,planId:n}){return Vr(`${hr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function $y(){return Gr(Sr.plans.v1)}async function xy(e){return Gr(`${Sr.plans.v1}/${e}`)}async function Vy(){return Gr(Sr.invoices.v1)}async function jy(e){return Gr(`${Sr.invoices.v1}/${e}`)}async function By(e,t){return Gr(`${Sr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Wy=["email"];async function zy(){return Gr(Sr.paymentMethods.v1)}async function Ky(e){return Gr(`${Sr.paymentMethods.v1}/${e}`)}async function Hy(e,t){let{email:n}=t,a=ii(t,Wy);return xr(`${Sr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:a})}async function qy(e){return $r(Sr.paymentProviders.stripe.subscriptions.v1,e)}async function Jy(e){return Gr(`${Sr.paymentProviders.stripe.customers.v1}/${e}`)}async function Yy(e){return $r(`${Sr.paymentProviders.stripe.customers.v1}`,e)}async function Xy(){return Gr(`${Sr.paymentProviders.stripe.publicConfigurations.v1}`)}async function Qy(e){return $r(`${Sr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Zy(e){return Gr(`${Sr.summaries.v1}/${e}`)}async function ef(e){return Gr(`${Sr.tenantConfiguration.v1}/${e}`)}async function tf(e){return $r(`${Sr.tenantConfiguration.v1}`,e)}async function nf(){return Gr(vr.v1)}async function af(){return Gr(`${Sr.configurations.vendorPublicConfigurations.v1}`)}let of,rf,sf,lf,cf,df;async function uf({userId:e}){return Gr(`${ir.v1}/${e}/apps`)}async function yf({userIds:e}){return Gr(`${ir.v1}/users-apps`,{userIds:e.join(",")})}async function ff(){return Gr(Rr.v1)}async function pf({appIds:e,includeFreeAccess:t=!0}){return Gr(Dr,{ids:e.join(","),_includeFreeAccess:t})}async function gf(e){return $r(`${ir.v1}/apps-user`,e)}async function Sf(e){return jr(`${ir.v1}/user-apps`,e)}async function vf({appIds:e}){return Gr(`${ir.v1}/apps-users`,{appIds:e.join(",")})}async function hf(){return Gr("/vendors/public")}async function mf(e){return Gr(nr.v1,e)}async function bf(e){return $r(nr.v1,e)}async function Af(e,t){return jr(nr.v1,e,{headers:Wr(t)})}async function Tf(e,t,n){return $r(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function Ef(e,t,n){return jr(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function If(e,t,n){return xr(`${nr.v1}/${e}/roles`,t,{headers:Wr(n)})}async function kf(e,t){return $r(pr.v1,e,{headers:Wr(t)})}async function Of(e,t){return jr(`${pr.v1}/${e}`,void 0,{headers:Wr(t)})}async function Pf({tenantId:e},t,n){return xr(`${pr.v1}/${e}`,t,{headers:Wr(n)})}async function _f({tenantId:e},t,n){return Vr(`${pr.v1}/${e}/management`,t,{headers:Wr(n)})}async function Lf(e,t,n){return Vr(`${nr.v1}/${e}/access`,t,{headers:Wr(n)})}async function wf(e,t){return $r(`${nr.v2}/`,e,{headers:Wr(t)})}async function Uf(){return Gr(`${Pr}`)}async function Df(e,t){return xr(`${Pr}/${e}`,t)}async function Rf(e){return $r(`${Pr}`,e)}async function Cf(e){return jr(`${Pr}/${e}`)}async function Nf(e){return Gr(`${_r}/${e}/Users/count`)}async function Mf(e){return $r(`${ar.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(of||(of={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(rf||(rf={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(sf||(sf={})),(lf||(lf={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(cf||(cf={})),function(e){e.CREATE="create_customer"}(df||(df={}));const Ff=["groupId"];async function Gf({groupId:e},t){return Gr(`${or.v1}/${e}`,$({},t))}async function $f(e){return Gr(`${or.v1}`,$({},e))}async function xf(e,t){return $r(`${or.getByIds.v1}`,e,{params:t})}async function Vf(e){return $r(`${or.v1}`,e)}async function jf(e){let{groupId:t}=e,n=ii(e,Ff);return xr(`${or.v1}/${t}`,n)}async function Bf(e){return jr(`${or.v1}/${e}`)}async function Wf(e,t){return $r(`${or.v1}/${e}/roles`,t)}async function zf(e,t){return jr(`${or.v1}/${e}/roles`,t)}async function Kf(e,t){return $r(`${or.v1}/${e}/users`,t)}async function Hf(e,t){return jr(`${or.v1}/${e}/users`,t)}async function qf(){return Gr(`${or.configurations.v1}`)}async function Jf(e){return $r(`${or.configurations.v1}`,e)}async function Yf(){return Gr(wr.v1)}async function Xf(){return Gr(Ur.v1)}async function Qf(e){return Gr(`${rr.v1}`,e)}async function Zf(e){return $r(`${rr.v1}`,e)}async function ep(e){return jr(`${rr.v1}/${e}`)}async function tp(e){return $r(`${rr.v1}/preverify`,e)}async function np(e){return $r(`${rr.v1}/verify`,e)}async function ap(e,t){return $r(`${rr.v1}/${e}/delete/verify`,t)}let ip,op,rp,sp;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ip||(ip={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(op||(op={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(rp||(rp={})),function(e){e.NEVER="NEVER",e.ALWAYS="ALWAYS",e.ASSIGNABLE="ASSIGNABLE"}(sp||(sp={}));const lp=[/^(.*)\/logout$/g,"/logout",/^\/identity\/resources\/auth\/v[0-9]*\/user\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/passwordless\/[^\/]*\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/webauthn\/postlogin$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/token\/refresh$/g,/^\/identity\/resources\/users\/v[0-9]*$/g,/^\/identity\/resources\/users\/v[0-9]*\/signUp$/g,/^\/identity\/resources\/users\/v[0-9]*\/activate$/g,/^\/identity\/resources\/users\/v[0-9]*\/invitation\/accept$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/verify$/g,/^\/identity\/resources\/auth\/v[0-9]*\/user\/mfa\/[^\/]*\/[^\/]*\/verify$/g,/^\/oauth\/token$/g,/^\/oauth\/authorize\/silent$/g],cp=`${qo.v1}/user/token/refresh`,dp=`${kr}/authorize/silent`,up=`${Jo.v2}/me`,yp=`${Jo.v2}/me/tenants`,fp=`${Jo.v3}/me/tenants`,pp=Lr;let gp,Sp,vp,hp,mp,bp,Ap,Tp,Ep;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(gp||(gp={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Sp||(Sp={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(vp||(vp={})),function(e){e.FORCE_MFA="FORCE_MFA",e.BREACHED_PASSWORDS_EXIST="BREACHED_PASSWORDS_EXIST",e.ENABLE_USER_LOCKOUT="ENABLE_USER_LOCKOUT",e.STRENGTHEN_USER_LOCKOUT="STRENGTHEN_USER_LOCKOUT",e.ENABLE_PASSWORD_HISTORY="ENABLE_PASSWORD_HISTORY",e.STRENGTHEN_PASSWORD_HISTORY="STRENGTHEN_PASSWORD_HISTORY",e.ENABLE_FORCE_RELOGIN="ENABLE_FORCE_RELOGIN",e.SET_FORCE_RELOGIN="SET_FORCE_RELOGIN",e.ENABLE_SESSION_CONCURRENCY="ENABLE_SESSION_CONCURRENCY",e.SET_SESSION_CONCURRENCY="SET_SESSION_CONCURRENCY",e.ENABLE_IDLE_SESSION="ENABLE_IDLE_SESSION",e.SET_IDLE_SESSION="SET_IDLE_SESSION",e.ENABLE_IP_RESTRICTIONS="ENABLE_IP_RESTRICTIONS",e.CHANGE_IP_TO_ALLOWLIST="CHANGE_IP_TO_ALLOWLIST",e.ENABLE_DOMAIN_RESTRICTIONS="ENABLE_DOMAIN_RESTRICTIONS",e.CHANGE_DOMAIN_TO_ALLOWLIST="CHANGE_DOMAIN_TO_ALLOWLIST",e.CONFIGURE_SSO="CONFIGURE_SSO"}(hp||(hp={})),function(e){e.MFA_FORCED="MFA_FORCED",e.PARTIALLY_FORCED_MFA="PARTIALLY_FORCED_MFA",e.PARTIAL_MFA_USAGE="PARTIAL_MFA_USAGE",e.FULL_MFA_USAGE="FULL_MFA_USAGE",e.BREACHED_PASSWORD_USERS_EXIST="BREACHED_PASSWORD_USERS_EXIST",e.IMPROVE_LOCKOUT_POLICY="IMPROVE_LOCKOUT_POLICY",e.IMPROVE_PASSWORD_HISTORY_POLICY="IMPROVE_PASSWORD_HISTORY_POLICY",e.NO_SESSION_SETTINGS="NO_SESSION_SETTINGS",e.PARTIAL_SESSION_SETTINGS="PARTIAL_SESSION_SETTINGS",e.FULL_SESSION_SETTINGS="FULL_SESSION_SETTINGS",e.NO_IP_RESTRICTIONS="NO_IP_RESTRICTIONS",e.IP_ALLOWLIST="IP_ALLOWLIST",e.IP_DENYLIST="IP_DENYLIST",e.NO_DOMAIN_RESTRICTIONS="NO_DOMAIN_RESTRICTIONS",e.DOMAIN_ALLOWLIST="DOMAIN_ALLOWLIST",e.DOMAIN_DENYLIST="DOMAIN_DENYLIST",e.FULL_PASSWORD_SETTINGS="FULL_PASSWORD_SETTINGS"}(mp||(mp={})),function(e){e.SEND_RESET_BREACHED_PASSWORD_EMAIL="SEND_RESET_BREACHED_PASSWORD_EMAIL",e.ADJUST_FORCE_RELOGIN="ADJUST_FORCE_RELOGIN",e.ADJUST_MAX_CONCURRENT_SESSIONS="ADJUST_MAX_CONCURRENT_SESSIONS",e.ADJUST_IDLE_TIMEOUT="ADJUST_IDLE_TIMEOUT"}(bp||(bp={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(Ap||(Ap={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(Tp||(Tp={})),function(e){e.FREE_ACCESS="FREE_ACCESS",e.MANAGED_ACCESS="MANAGED_ACCESS"}(Ep||(Ep={}));const Ip={auth:s,teams:l,metadata:c,reports:d,connectivity:f,notifications:u,audits:y,tenants:o,accountSettings:p,roles:g,subscriptions:S,vendor:h,subTenants:m,featureFlags:t,directory:b,impersonate:A,groups:T,users:i,entitlements:r,securityCenter:E,userPhoneNumbers:I,applications:v},kp={fetch:e,ContextHolder:Wo,FronteggContext:zo,api:Ip,FronteggApiError:Ko,AuthStrategyEnum:Oa,MachineToMachineAuthStrategy:Pa,SocialLoginProviders:ka,ISubscriptionCancellationPolicy:sf,ISubscriptionStatus:of,PaymentMethodType:rf,ProviderType:lf};let Op,Pp;!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"}(Op||(Op={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Pp||(Pp={}));const _p="input is invalid type",Lp="undefined"!=typeof ArrayBuffer,wp="0123456789abcdef".split(""),Up=[-2147483648,8388608,32768,128],Dp=[24,16,8,0],Rp=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Cp=["hex","array","digest","arrayBuffer"],Np=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Lp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const Mp=function(e){return function(t){const n=new Gp(!0).update(t);return null==n?void 0:n[e]()}},Fp=function(e){return function(t,n){const a=new $p(t,!0).update(n);return null==a?void 0:a[e]()}};class Gp{constructor(e=!1){this.blocks=void 0,this.h0=void 0,this.h1=void 0,this.h2=void 0,this.h3=void 0,this.h4=void 0,this.h5=void 0,this.h6=void 0,this.h7=void 0,this.block=void 0,this.start=void 0,this.bytes=void 0,this.hBytes=void 0,this.finalized=void 0,this.hashed=void 0,this.first=void 0,this.lastByteIndex=void 0,this.sharedMemory=!1,this.toString=()=>this.hex(),this.array=()=>Gp.prototype.digest(),e?(Np[0]=Np[16]=Np[1]=Np[2]=Np[3]=Np[4]=Np[5]=Np[6]=Np[7]=Np[8]=Np[9]=Np[10]=Np[11]=Np[12]=Np[13]=Np[14]=Np[15]=0,this.blocks=Np):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.sharedMemory=e}update(e){if(this.finalized)return;let t;const n=typeof e;if("string"!==n){if("object"!==n)throw new Error(_p);if(null===e)throw new Error(_p);if(Lp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Lp&&ArrayBuffer.isView(e)))throw new Error(_p);t=!0}let a,i,o=0;const r=e.length,s=this.blocks;for(;o<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(i=this.start;o<r&&i<64;++o)s[i>>2]|=e[o]<<Dp[3&i++];else for(i=this.start;o<r&&i<64;++o)a=e.charCodeAt(o),a<128?s[i>>2]|=a<<Dp[3&i++]:a<2048?(s[i>>2]|=(192|a>>6)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]):a<55296||a>=57344?(s[i>>2]|=(224|a>>12)<<Dp[3&i++],s[i>>2]|=(128|a>>6&63)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),s[i>>2]|=(240|a>>18)<<Dp[3&i++],s[i>>2]|=(128|a>>12&63)<<Dp[3&i++],s[i>>2]|=(128|a>>6&63)<<Dp[3&i++],s[i>>2]|=(128|63&a)<<Dp[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=Up[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,a,i,o,r,s,l,c,d,u=this.h0,y=this.h1,f=this.h2,p=this.h3,g=this.h4,S=this.h5,v=this.h6,h=this.h7;const m=this.blocks;for(e=16;e<64;++e)i=m[e-15],t=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,i=m[e-2],n=(i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(d=y&f,e=0;e<64;e+=4)this.first?(s=704751109,i=m[0]-210244248,h=i-1521486534<<0,p=i+143694565<<0,this.first=!1):(t=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=u&y,a=s^u&f^d,r=g&S^~g&v,i=h+n+r+Rp[e]+m[e],o=t+a,h=p+i<<0,p=i+o<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&u,a=l^p&y^s,r=h&g^~h&S,i=v+n+r+Rp[e+1]+m[e+1],o=t+a,v=f+i<<0,f=i+o<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,a=c^f&u^l,r=v&h^~v&g,i=S+n+r+Rp[e+2]+m[e+2],o=t+a,S=y+i<<0,y=i+o<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),d=y&f,a=d^y&p^c,r=S&v^~S&h,i=g+n+r+Rp[e+3]+m[e+3],o=t+a,g=u+i<<0,u=i+o<<0;this.h0=this.h0+u<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+S<<0,this.h6=this.h6+v<<0,this.h7=this.h7+h<<0}hex(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,a=this.h3,i=this.h4,o=this.h5,r=this.h6,s=this.h7;let l=wp[e>>28&15]+wp[e>>24&15]+wp[e>>20&15]+wp[e>>16&15]+wp[e>>12&15]+wp[e>>8&15]+wp[e>>4&15]+wp[15&e]+wp[t>>28&15]+wp[t>>24&15]+wp[t>>20&15]+wp[t>>16&15]+wp[t>>12&15]+wp[t>>8&15]+wp[t>>4&15]+wp[15&t]+wp[n>>28&15]+wp[n>>24&15]+wp[n>>20&15]+wp[n>>16&15]+wp[n>>12&15]+wp[n>>8&15]+wp[n>>4&15]+wp[15&n]+wp[a>>28&15]+wp[a>>24&15]+wp[a>>20&15]+wp[a>>16&15]+wp[a>>12&15]+wp[a>>8&15]+wp[a>>4&15]+wp[15&a]+wp[i>>28&15]+wp[i>>24&15]+wp[i>>20&15]+wp[i>>16&15]+wp[i>>12&15]+wp[i>>8&15]+wp[i>>4&15]+wp[15&i]+wp[o>>28&15]+wp[o>>24&15]+wp[o>>20&15]+wp[o>>16&15]+wp[o>>12&15]+wp[o>>8&15]+wp[o>>4&15]+wp[15&o]+wp[r>>28&15]+wp[r>>24&15]+wp[r>>20&15]+wp[r>>16&15]+wp[r>>12&15]+wp[r>>8&15]+wp[r>>4&15]+wp[15&r];return l+=wp[s>>28&15]+wp[s>>24&15]+wp[s>>20&15]+wp[s>>16&15]+wp[s>>12&15]+wp[s>>8&15]+wp[s>>4&15]+wp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,a=this.h3,i=this.h4,o=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,a>>24&255,a>>16&255,a>>8&255,255&a,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class $p extends Gp{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const a=typeof e;if("string"===a){const t=[],a=e.length;let i,o=0;for(n=0;n<a;++n)i=e.charCodeAt(n),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>6,t[o++]=128|63&i):i<55296||i>=57344?(t[o++]=224|i>>12,t[o++]=128|i>>6&63,t[o++]=128|63&i):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++n)),t[o++]=240|i>>18,t[o++]=128|i>>12&63,t[o++]=128|i>>6&63,t[o++]=128|63&i);e=t}else{if("object"!==a)throw new Error(_p);if(null===e)throw new Error(_p);if(Lp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Lp&&ArrayBuffer.isView(e)))throw new Error(_p)}var i;e.length>64&&(e=null==(i=new Gp(!0).update(e))?void 0:i.array());const o=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;o[n]=92^t,r[n]=54^t}Gp.call(this,t),this.update(r),this.oKeyPad=o,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Gp.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Gp.prototype.finalize.call(this)}}}const xp=function(){const e=Mp("hex");e.create=function(){return new Gp},e.update=function(t){return e.create().update(t)};for(let t=0;t<Cp.length;++t){const n=Cp[t];e[n]=Mp(n)}return e}();function Vp(e,t){const n=$({},e);return t.forEach((e=>{delete n[e]})),n}async function jp(e){var t,n;return null!=(t=window.crypto)&&null!=(n=t.subtle)&&n.digest?async function(e){const t=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e):(console.warn("Generating CodeChallenge in non-secure domain:",window.location.origin),async function(e){const t=xp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Bp(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let a=0;a<e;a++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=Fp("hex");e.create=function(e){return new $p(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Cp.length;++t){const n=Cp[t];e[n]=Fp(n)}}();const Wp=e=>new Promise(((t,n)=>{const a=new FileReader;a.readAsText(e),a.onload=()=>t(a.result),a.onerror=n}));function*zp(e){const t=yield qi((e=>e.root.appName));return Hr.getFeatureFlags(e,t)}const Kp={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Hp=$({},Kp,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),qp=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03"],vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03","16647407-ed6f-4ca6-83a0-86225d921959","f403c6b9-1abe-4ec7-9971-aa032255fc25","a43e059d-d731-44b1-94bb-fb6b16c62210"],vendorId:"vendorId"},{id:"1234",key:"Support",name:"Support",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03","f26b00f8-ffe0-4739-b15c-7db15c27ea26","a9c803b0-ebfa-49b9-9607-f0d3a390ee61"],tenantId:"tenantId",vendorId:"vendorId"}],Jp={sub:"",tenants:[],id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!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:["8d71b676-754c-4600-afe7-ca5add1e6809","04dbcc11-61db-40a9-9577-9b73e50d1d03"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"8d71b676-754c-4600-afe7-ca5add1e6809",key:"fe.*",name:"General Admin",description:"description",categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date,roleIds:[]}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),verified:!1},Yp=$({},Jp,{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}),Xp={loading:!1,error:void 0,saving:!0,profile:Jp},Qp={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"},Zp={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Oa.EmailAndPassword,machineToMachineAuthStrategy:Pa.ClientCredentials},eg={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},tg={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},ng={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},ag={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},ig={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},og=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],rg={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:ag,roles:og,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},sg=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],lg={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:[qp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[qp[0]],managedBy:vp.FRONTEGG}]},cg={id:lg.id,email:lg.email,name:lg.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[qp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},dg={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:[qp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[qp[0]],managedBy:vp.FRONTEGG}]},ug={id:dg.id,email:dg.email,name:dg.name,phoneNumber:void 0,profileImage:void 0,tenantId:"tenantId",activatedForTenant:!0,createdAt:new Date(2022,4,1),verified:!0,lastLogin:new Date(2022,5,25),mfaEnrolled:!1,roles:[qp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},yg={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},fg=[dg,lg],pg=[ug,cg],gg=[yg],Sg=[{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}],vg=[{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"}],hg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},mg={isActive:!0,strategy:Kn.ALLOW},bg=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Kn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Kn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Kn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Kn.BLOCK,description:"IP 4"}],Ag=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push($({},dg,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Tg=e=>({id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0"+e,key:e,name:e,description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:[],tenantId:"tenantId",vendorId:"vendorId"}),Eg=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Ag(6),roles:[Tg("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:vp.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Ag(44),roles:[Tg("Editor")],managedBy:vp.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Ag(8),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Ag(5),roles:[Tg("Admin")],managedBy:vp.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Ag(21),description:"BDR, AE, and inside sales",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Ag(23),description:"Dev success and customer success",roles:[Tg("Admin")],managedBy:vp.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Ag(10),description:"The marketing department",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Ag(4),description:"Human resources",roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Ag(3),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Ag(8),roles:[Tg("Editor")],managedBy:vp.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Ag(4),roles:[Tg("Viewer")],managedBy:vp.FRONTEGG}],Ig={scoring:{score:79},recommendations:{items:[{code:hp.FORCE_MFA,severity:Ap.WARNING,category:Tp.MFA},{code:hp.ENABLE_FORCE_RELOGIN,severity:Ap.WARNING,category:Tp.SESSIONS}]}},kg={insights:{items:[{category:Tp.MFA,code:mp.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:Tp.SESSIONS,code:mp.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:Tp.PASSWORD,code:mp.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:Tp.DOMAIN,code:mp.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},Og={users:pg,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},Pg={users:[pg[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},_g={users:[pg[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0},Lg=[{id:"8d71b676-754c-4600-afe7-ca5add1e6809",key:"fe.secure.*",name:"Secure write",description:"all secure access permissions",categoryId:"77154759-0a04-4669-b6b4-0858d3c1190e",fePermission:!0,assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date},{id:"85e1fd7b-2bb7-498f-8521-5f8e5774c01e",key:"fe.account-hierarchy.write.subAccountAccess",name:"Give access to sub accounts",description:"Give a user access to sub account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"a1807695-54a2-4f95-95de-a9b246488aae",key:"fe.account-hierarchy.read.subAccount",name:"Read sub accounts",description:"Read sub accounts",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"04dbcc11-61db-40a9-9577-9b73e50d1d03",key:"fe.secure.read.*",name:"Secure read",description:"all secure access read permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"77154759-0a04-4669-b6b4-0858d3c1190e",fePermission:!0},{id:"a1807695-54a2-4f95-95de-a9b246488aae",key:"fe.account-hierarchy.read.subAccount",name:"Read sub accounts",description:"Read sub accounts",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"85e1fd7b-2bb7-498f-8521-5f8e5774c01e",key:"fe.account-hierarchy.write.subAccountAccess",name:"Give access to sub accounts",description:"Give a user access to sub account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d24db1e3-002b-421d-951d-09a967dd7cd5",fePermission:!0},{id:"a9c803b0-ebfa-49b9-9607-f0d3a390ee61",key:"fe.account-settings.delete.account",name:"Delete Account",description:"Delete my account",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"42aaebe1-893d-4da5-99d7-375a4537b7a4",fePermission:!0},{id:"f26b00f8-ffe0-4739-b15c-7db15c27ea26",key:"fe.account-settings.write.custom-login-box",name:"Edit custom login settings",description:"Write account's custom login box styling",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"42aaebe1-893d-4da5-99d7-375a4537b7a4",fePermission:!0},{id:"a43e059d-d731-44b1-94bb-fb6b16c62210",key:"fe.connectivity.delete.*",name:"Connectivity delete",description:"all connectivity delete permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",fePermission:!0},{id:"f403c6b9-1abe-4ec7-9971-aa032255fc25",key:"fe.connectivity.delete.slackAppRegistration",name:"Delete slack application registration",description:"allow user to delete slack app registration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"e8c0e727-f562-449a-82c5-f7691defde02",key:"fe.connectivity.read.*",name:"Connectivity read",description:"all connectivity read permissions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",fePermission:!0},{id:"2a5dcd6d-57a3-45c4-815f-c265609cc1f7",key:"fe.connectivity.read.emailConfig",name:"Read email configuration",description:"read email integration configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"2d7b4be7-8269-4ff4-81d6-0c92e95790d5",fePermission:!0},{id:"4fee0eb0-5b17-450b-bea4-b9b908230bda",key:"fe.connectivity.read.eventCategories",name:"Read events categories",description:"view connectivity events categories",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"31c7a260-55d6-43d5-a872-4f9e22982ff5",fePermission:!0},{id:"750a96a5-8abf-4340-b91a-723c7bb8bcfd",key:"fe.connectivity.read.events",name:"Read events",description:"view connectivity events",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"31c7a260-55d6-43d5-a872-4f9e22982ff5",fePermission:!0},{id:"ef2a5f1a-74c5-431f-b1a6-d4fb5026e374",key:"fe.connectivity.read.slackApp",name:"Read slack application",description:"get slack application configuration in order to register",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"9fc1fa37-a8b9-4931-b2b5-5de55df25289",key:"fe.connectivity.read.slackChannels",name:"Read slack channels",description:"view registered slack workspace channels",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"87c3df9d-0ab2-4e97-bfc8-777a68ba2543",key:"fe.connectivity.read.slackSubscriptions",name:"Read slack subscriptions",description:"view slack events subscriptions",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"7826470b-151f-4bab-b2c0-785e09878616",key:"fe.connectivity.read.slackUsers",name:"Read slack users",description:"view registered slack workspace users",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",fePermission:!0},{id:"ee779734-a7e3-47b3-ace9-944f9bee8ad8",key:"fe.connectivity.read.smsConfig",name:"Read SMS configuration",description:"read SMS integration configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"5743fccc-b4ea-4907-bdca-7446ea088974",fePermission:!0},{id:"54583a96-c731-4a84-9abc-1b8b827f06ae",key:"fe.connectivity.read.userBellNotifications",name:"Read bell notifications",description:"view user bell notifications",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"18d2584b-7f03-4038-ab93-bc2b0f4511be",fePermission:!0},{id:"2dfde8ef-7df2-4426-bb8d-33615e399a4d",key:"fe.connectivity.read.webhookLogs",name:"Read webhooks logs",description:"view webhooks logs",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"e74e5390-396b-429c-9544-62417912d018",fePermission:!0},{id:"16647407-ed6f-4ca6-83a0-86225d921959",key:"fe.connectivity.read.webhooks",name:"Read webhooks",description:"view webhooks configuration",assignmentType:sp.ASSIGNABLE,createdAt:new Date,updatedAt:new Date,categoryId:"e74e5390-396b-429c-9544-62417912d018",fePermission:!0}],wg=[{id:"d9b4dbd0-476c-4708-b079-d9e6e4758971",name:"test",description:"",createdAt:new Date,updatedAt:new Date,permissionIds:[],feCategory:!1},{id:"2b3f1746-1135-4b8d-aff3-5697cffc4482",name:"SAML",description:"Secure access SAML",createdAt:new Date,updatedAt:new Date,permissionIds:["8ea45a49-c403-4551-9da9-77f5da44f130","8d94c261-1f7d-46bd-88a8-511e9f39273b","7391ac41-b076-4386-8a14-7c2d798d3335","6d8f5a1f-b3cd-421a-ba85-7784bdd97dc2","3c989065-35e1-4198-8c9c-c94084222794"],feCategory:!0},{id:"2c2281da-cf81-4943-9605-42969677e9fe",name:"Security Policies",description:"Secure access security policies",createdAt:new Date,updatedAt:new Date,permissionIds:["e5642338-b265-4ce5-94e4-8c21490033ad","daddb9e9-a836-4901-b175-2d1182dab6f5","bd4242ce-e84f-4387-9c41-c90e7d1fc6fa","ba33b4c1-47f0-4aa2-9e3a-fcf96229d355","ade4558f-5438-4383-b42b-728e8a745cc8","ad064258-2178-48f8-845c-ac1ce0217be8","acefb7fd-11c7-4a43-9544-b4fb461db94c","909b6a0a-4efc-4464-90ac-b8b9a8f22fc2","8a03c1e7-3991-4cca-8726-88c339766144","860eb891-b9eb-44ba-94c1-51cfc2be9dd9","719e09ae-5513-4cc3-bce1-97503a0a7658","6fcd99e7-2206-4c45-86aa-411a87b7fcac","235592cc-47c7-49cc-82e4-129f5333cc45","2214404d-3140-44bf-9c9d-438fa56b5a50"],feCategory:!0},{id:"2d7b4be7-8269-4ff4-81d6-0c92e95790d5",name:"Email integration",description:"Connectivity email integration",createdAt:new Date,updatedAt:new Date,permissionIds:["9a0bb3db-8bdb-4278-8f18-9c484bcd2f8c","440f5616-ad85-43d1-b25d-1fd7930c6d26","2a5dcd6d-57a3-45c4-815f-c265609cc1f7"],feCategory:!0},{id:"31c7a260-55d6-43d5-a872-4f9e22982ff5",name:"Events",description:"Connectivity Events",createdAt:new Date,updatedAt:new Date,permissionIds:["85c90d0f-3bb0-40c0-914a-640c7ca9eea5","750a96a5-8abf-4340-b91a-723c7bb8bcfd","4fee0eb0-5b17-450b-bea4-b9b908230bda"],feCategory:!0},{id:"42aaebe1-893d-4da5-99d7-375a4537b7a4",name:"Account settings",description:"Account profile settings",createdAt:new Date,updatedAt:new Date,permissionIds:["f26b00f8-ffe0-4739-b15c-7db15c27ea26","eb11313d-c7bb-43c0-a85d-c79bedab46b1","a9c803b0-ebfa-49b9-9607-f0d3a390ee61","634d3fab-b470-4a92-a25b-245459ddd6db"],feCategory:!0},{id:"62fc3fe0-f06b-4a0f-854c-cdf51353b616",name:"Slack integration",description:"Connectivity Slack integration",createdAt:new Date,updatedAt:new Date,permissionIds:["f403c6b9-1abe-4ec7-9971-aa032255fc25","ef2a5f1a-74c5-431f-b1a6-d4fb5026e374","e3231a61-e425-4ac1-aa87-654ab995af5c","9fc1fa37-a8b9-4931-b2b5-5de55df25289","87c3df9d-0ab2-4e97-bfc8-777a68ba2543","7993a558-0af5-4d77-b9fc-8e8114f0ce0b","7826470b-151f-4bab-b2c0-785e09878616","5b0323d1-a0a0-4d4f-9bb8-b1634d9afa94","4245736e-13b0-48fd-9a08-bc93809dcdaf","2fccccb1-36f5-4c5c-8d93-73ab15d0b2d9"],feCategory:!0},{id:"6b925df5-8b09-470a-9fcc-dae0beae1af4",name:"Audits",description:"Audit Logs",createdAt:new Date,updatedAt:new Date,permissionIds:["97085bb5-bec7-49eb-9744-4d35bbb83ad3"],feCategory:!0},{id:"77154759-0a04-4669-b6b4-0858d3c1190e",name:"Secure access",description:"Secure access general",createdAt:new Date,updatedAt:new Date,permissionIds:["925e0c16-aead-41e6-b62f-8ddb2ea4ed06","8d71b676-754c-4600-afe7-ca5add1e6809","1c81d4ca-47a2-4564-b9d9-9d346b8cdbe7","04dbcc11-61db-40a9-9577-9b73e50d1d03"],feCategory:!0},{id:"916d6db5-489e-4109-95cf-57dee7802c57",name:"Webpush integration",description:"Webpush notifications integration",createdAt:new Date,updatedAt:new Date,permissionIds:["e5a7bbd3-f76b-4559-979d-885c5c75f72f","cb47ea6f-0a59-4694-97d0-9c32f6732e85"],feCategory:!0},{id:"9707ef7f-afd3-4d1f-962e-68c0d876db53",name:"Subscriptions",description:"Subscriptions access general",createdAt:new Date,updatedAt:new Date,permissionIds:["ce03de78-a7f4-4498-acce-df4aae30ed0d","ae81dd56-2f94-4da8-9c16-b6c781b0dcb7","72e55675-ea98-4f1a-85f0-09319cdcbcbf"],feCategory:!0},{id:"a71e2e14-0cdb-42df-b297-d00af2d4e62e",name:"Users management",description:"Secure access users management",createdAt:new Date,updatedAt:new Date,permissionIds:["e7263c99-874f-4e17-8d63-25ae3d9f5739","db957d5f-4048-4011-bcb4-5d21af0560e4","c52b0a96-dcff-4fba-aa8e-ce3a7336bde2","bc754ce1-ebbe-446a-bb84-4f287be0651c","998756c3-773a-4771-b7a5-510e795fb5f4","88565631-dc77-472c-b1d9-18674483c24b","6b84ddeb-a242-48c5-bf2a-62105315518a","61874f64-2204-4eec-8f02-0d38bd5a66b8","4c47caae-d384-48bb-99bc-554aafa2888f","43695880-d40e-412d-b342-434d58c5c8ca","4003ac5b-326c-4dc2-afb1-8900e16ee443","007c612d-5184-4f04-846e-d49c6591de0c"],feCategory:!0},{id:"c058e114-917c-4ad1-940e-11e9cc40b638",name:"Roles and permissions",description:"Secure access roles and permissions",createdAt:new Date,updatedAt:new Date,permissionIds:["c89960c8-6d67-44fa-a3aa-1a6826f45b0d","93be3a9a-98a2-48b8-a146-a223e457c904","80e49f9a-7628-4efc-913b-5f80ca92f106","7f2576d6-cbbb-4c7b-bb70-d75a88d9ce47","6a337814-34e5-4c24-a56f-d462c1db218b"],feCategory:!0},{id:"c38e9f59-ff65-4f9f-a31d-0bbfc44df347",name:"Groups",description:"Secure access groups",createdAt:new Date,updatedAt:new Date,permissionIds:["e1907e68-877d-4f2d-a266-d54e143c3c0c","7a17405a-6c4b-4053-9843-f9d5e3af9e00","5ee7bb2d-aad4-497f-94d2-9e255c470882","4c406972-c815-46a9-8f47-9708adc334b8","399bff45-aa24-49ae-9357-5f05a5eef3a5","0037b3ad-5f77-4157-aa33-33c92b5fe057"],feCategory:!0},{id:"d18fccaa-e09a-4e6e-b902-cc9c615ff12d",name:"Connectivity",description:"Connectivity general",createdAt:new Date,updatedAt:new Date,permissionIds:["e8c0e727-f562-449a-82c5-f7691defde02","c88bf74a-66a4-48c2-bc1b-2e2aa057858d","a43e059d-d731-44b1-94bb-fb6b16c62210","3f118e4c-badd-45d1-8056-3f3428be92ca"],feCategory:!0},{id:"d24db1e3-002b-421d-951d-09a967dd7cd5",name:"Account Hierarchy",description:"Account hierarchy",createdAt:new Date,updatedAt:new Date,permissionIds:["b6e66e0f-c6d2-4113-865a-57d08b1dec45","a1807695-54a2-4f95-95de-a9b246488aae","85e1fd7b-2bb7-498f-8521-5f8e5774c01e","60cfedb4-64ca-40d1-8b3a-4288bcde1209"],feCategory:!0},{id:"e74e5390-396b-429c-9544-62417912d018",name:"Webhooks integration",description:"Connectivity webhooks integration",createdAt:new Date,updatedAt:new Date,permissionIds:["996e42ed-b1d8-4e36-aa76-58091c56bdf7","8e7014d4-13fa-439a-a313-a2b9141f8b47","2dfde8ef-7df2-4426-bb8d-33615e399a4d","16647407-ed6f-4ca6-83a0-86225d921959"],feCategory:!0},{id:"e8af2833-1bbf-4ccf-8658-f6e0c60621b9",name:"API tokens",description:"Secure access API tokens",createdAt:new Date,updatedAt:new Date,permissionIds:["f03dc571-0769-4bcf-9c51-776b81582a14","c395932b-c732-41ad-bec6-ced7602bf79e","94351961-e9c8-4c63-8818-ae8481ceab22","5a744287-d01e-4a7a-8a37-2ce212ce5ff5","0cf97f9f-84dc-4dfc-bf41-2ad4b6c072e9","0c8cdac0-b364-4ab6-9737-7aa43f944013"],feCategory:!0}];let Ug,Dg,Rg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ug||(Ug={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Dg||(Dg={})),function(e){e.profile="profile",e.privacy="privacy",e.personalApiTokens="personalApiTokens",e.account="account",e.users="users",e.groups="groups",e.security="security",e.sso="sso",e.audits="audits",e.webhooks="webhooks",e.apiTokens="apiTokens",e.roles="roles",e.subscriptions="subscription",e.allAccounts="allAccounts"}(Rg||(Rg={})),Rg.profile,Rg.privacy,Rg.personalApiTokens,Rg.account,Rg.users,Rg.groups,Rg.security,Rg.sso,Rg.audits,Rg.webhooks,Rg.apiTokens,Rg.roles,Rg.subscriptions,Rg.allAccounts;const Cg=e=>{try{return new URL(e),!0}catch(e){return!1}},Ng=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Mg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},Fg="tenantId",Gg=e=>e.mfaRequired&&e.mfaToken?(Wo.setAccessToken(null),Wo.setUser(null),!0):(Wo.setAccessToken(e.accessToken),Wo.setUser(e),!1),$g=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:a,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),a=+Boolean(e.authenticators.length),i=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:a,numberOfEmails:i,totalDevices:t+n+a+i}})(e);if(1===i){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(a)return un.emailVerifyCode}return un.verify},xg=e=>{if(1===e.length){const[t]=e;if(t===qs.AuthenticatorApp)return un.authenticatorApp;if(t===qs.SMS)return un.smsSetPhoneNumber;if(t===qs.EmailCode)return un.emailVerifyCode}return un.verify};function*Vg(e){let t=Lt.loginWithTwoFactor,n={};const{loginState:a}=yield qi((e=>e.auth)),{isAllowedToRemember:i,mfaDeviceExpiration:o}=yield zi(Ip.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:$g(e.mfaDevices)}:(n={step:xg(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=Lt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:wt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:$({},a,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:i,mfaDeviceExpiration:o,isBreachedPassword:e.isBreachedPassword})}}const jg=(e,t)=>e?(e=>Boolean(null==e?void 0:e.statusCode))(e)?e.message:((e=>e instanceof Error||(null==e?void 0:e.message)&&(null==e?void 0:e.stack)&&"Error"===(null==e?void 0:e.name))(e)?console.error(e.message):"string"==typeof e&&console.error(e),null!=t?t:"We're facing some difficulties, Please try again"):t;let Bg;function Wg(e,t){var n,a;null==(n=(a=window).onFronteggEvent)||n.call(a,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Bg||(Bg={}));const zg=(e,t=[])=>Object.entries(e).reduce(((e,[n,a])=>"object"==typeof a?[...e,...zg(a,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:a}]),[]),Kg=["callback"];function*Hg(){yield ji(za.setCustomLoginState({loading:!0}));try{const e=yield zi(Ip.metadata.getAdminBoxMetadata);yield ji(za.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield ji(za.setCustomLoginState({loading:!1,error:jg(e)}))}}function*qg(e){let{payload:{callback:t}}=e,n=ii(e.payload,Kg);try{yield ji(za.setCustomLoginState({error:null,saving:!0}));const e=zg(n);if(0===e.length)throw new Error("No changes to update");yield zi(Ip.metadata.updateAdminBoxMetadata,{actions:e});const a=yield zi(Ip.metadata.getAdminBoxMetadata);yield ji(za.setCustomLoginState({tenantMetadata:a,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setCustomLoginState({error:jg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Jg(){return!!(yield zi(Yg))}function*Yg(){const e=Wo.getContext();if(null==e||!e.tenantResolver)return;const t=yield e.tenantResolver();if(null!=t&&t.tenant)return t.tenant;const{customLoginAlias:n,hasCustomLogin:a}=yield qi((e=>{var t,n;const a=null==(t=e.auth)||null==(n=t.tenantsState)?void 0:n.activeTenant;return{customLoginAlias:null==a?void 0:a.alias,hasCustomLogin:null==a?void 0:a.hasCustomLogin}}));return a?n:void 0}function*Xg(){try{var e;if(!(yield zi(Jg)))return;const t=yield qi((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:a}=Ip.accountSettings,{applicationUrl:i}=yield zi(t?n:a);if(!i)return;const{routes:o}=yield qi((e=>e.auth)),r=null!=(e=Ng(i))?e:"";yield ji(za.setState({routes:$({},o,{customLoginAuthenticatedUrl:i,customLoginUrl:o.loginUrl+r})})),yield ji(za.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Qg(){yield Bo(za.loadTenantMetadata,Hg),yield Bo(za.updateTenantMetadata,qg)}let Zg;!function(e){e.RECOMMENDATIONS="recommendations",e.INSIGHTS="insights",e.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS="sendBulkResetBreachedPasswordEmails",e.SEND_BREACHED_PASSWORD_EMAIL="sendBreachedPasswordEmail",e.BREACHED_PASSWORD_USERS_TABLE="breachedPasswordUsersTable",e.UNENROLLED_MFA_USERS_TABLE="unenrolledMfaUsersTable",e.INACTIVE_USERS_TABLE="inactiveUsersTable"}(Zg||(Zg={}));const eS=["callback"];function tS(e){return function*(t){const[n]=yield zi(zp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield nS(),yield aS())}}function*nS(){const e=Zg.RECOMMENDATIONS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:a}=yield zi(Ip.securityCenter.getRecommendations);yield ji(za.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==a?void 0:a.score)?t:0}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*aS(){const e=Zg.INSIGHTS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield zi(Ip.securityCenter.getInsights);yield ji(za.setSecurityCenterState({insights:t.items}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*iS(e){let{payload:{callback:t}}=e,n=ii(e.payload,eS);const a=Zg.SEND_BREACHED_PASSWORD_EMAIL;yield ji(za.setSecurityCenterStateError({key:a,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:a,value:!0}));try{yield zi(Ip.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield ji(za.setSecurityCenterStateError({key:a,value:jg(e)})),null==t||t(!1,e)}finally{yield ji(za.setSecurityCenterStateLoader({key:a,value:!1}))}}function*oS({payload:{callback:e}}){const t=Zg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield ji(za.setSecurityCenterStateError({key:t,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:t,value:!0}));try{yield zi(Ip.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield ji(za.setSecurityCenterStateError({key:t,value:jg(n)})),null==e||e(!1)}finally{yield ji(za.setSecurityCenterStateLoader({key:t,value:!1}))}}function*rS({key:e,tableState:t,updateStateKey:n,_offset:a,_limit:i,_preset:o,_email:r,_maxInactiveSeconds:s}){var l,c,d,u;yield ji(za.setSecurityCenterStateError({key:e,value:!1})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=a?a:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(d=null!=i?i:null==t||null==(u=t.queryParams)?void 0:u._limit)?d:10,p=$({_offset:y,_limit:f,_includeSubTenants:!1,_preset:o,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:a,totalPages:i}}=yield zi(Ip.users.getUsersV3,p),o={totalUsersItems:a,totalUsersPages:i,usersPageOffset:y,queryParams:$({_offset:y,_limit:f,_maxInactiveSeconds:s},!!r&&{_email:r})};if(t.length){const e=yield function*(e){const t=e.map((e=>e.id)),n=yield zi(Ip.roles.getRoles),a=yield zi(Ip.users.getUsersRoles,{ids:t});return e.map((e=>{var t,i;const o=null==a||null==(t=a.find((t=>t.userId===e.id)))?void 0:t.roleIds;return $({},e,{roles:null!=(i=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}))}(t);yield ji(za.setSecurityCenterState({[n]:$({users:e},o)}))}else yield ji(za.setSecurityCenterState({[n]:$({users:[]},o)}))}catch(t){yield ji(za.setSecurityCenterStateError({key:e,value:jg(t)}))}finally{yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}}function*sS({payload:e}){var t;const n=Zg.BREACHED_PASSWORD_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:ga.BREACHED_PASSWORDS,tableState:a},e))}function*lS({payload:e}){var t;const n=Zg.UNENROLLED_MFA_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:ga.MFA_UNENROLLED,tableState:a},e))}function*cS({payload:e}){var t;const n=Zg.INACTIVE_USERS_TABLE,a=yield null!=(t=qi((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield rS($({key:n,updateStateKey:"inactiveUsersTable",_preset:ga.INACTIVE,tableState:a},e))}function*dS(){yield Vo(za.loadRecommendations,nS),yield Vo(za.loadInsights,aS),yield Vo(za.sendResetBreachedPasswordEmail,iS),yield Vo(za.sendBulkResetBreachedPasswordEmails,oS),yield Vo(za.loadBreachedPasswordUsers,sS),yield Vo(za.loadUnenrolledMfaUsers,lS),yield Vo(za.loadInactiveUsers,cS)}function*uS(){const e=Zg.RECOMMENDATIONS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({recommendations:Ig.recommendations.items,score:Ig.scoring.score})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*yS(){const e=Zg.INSIGHTS;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({insights:kg.insights.items})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*fS(){const e=Zg.BREACHED_PASSWORD_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({breachedPasswordUsersTable:Og})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*pS(){const e=Zg.UNENROLLED_MFA_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({unenrolledMfaUsersTable:_g})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*gS(){const e=Zg.INACTIVE_USERS_TABLE;yield ji(za.setSecurityCenterStateLoader({key:e,value:!0})),yield Ji(500),yield ji(za.setSecurityCenterState({inactiveUsersTable:Pg})),yield ji(za.setSecurityCenterStateLoader({key:e,value:!1}))}function*SS({payload:{callback:e}}){const t=Zg.SEND_BREACHED_PASSWORD_EMAIL;yield ji(za.setSecurityCenterStateLoader({key:t,value:!0})),yield Ji(500),null==e||e(!0),yield ji(za.setSecurityCenterStateLoader({key:t,value:!1}))}function*vS(){yield Vo(za.loadRecommendations,uS),yield Vo(za.loadInsights,yS),yield Vo(za.loadBreachedPasswordUsers,fS),yield Vo(za.loadUnenrolledMfaUsers,pS),yield Vo(za.loadInactiveUsers,gS),yield Vo(za.sendResetBreachedPasswordEmail,SS)}const hS=["callback"],mS=["callback"],bS=["callback"],AS=["callback"],TS=["callback"],ES=["callback"];function*IS(){yield ji(za.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getGlobalSecurityPolicy);yield ji(za.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyGlobalState({error:jg(e),loading:!1}))}yield ji(za.loadSecurityPolicyMfa()),yield ji(za.loadSecurityPolicyVendorMfa()),yield ji(za.loadSecurityPolicyLockout()),yield ji(za.loadSecurityPolicyVendorLockout()),yield ji(za.loadSecurityPolicyVendorPasswordHistory()),yield ji(za.loadSecurityPolicyCaptcha()),yield ji(za.loadPublicAuthStrategiesPolicy())}function*kS(e){var t,n;if(!(yield zi(Jg)))return e;const a=yield zi(PS);return null!=a&&null!=(t=a.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?$({},e,{authStrategy:a.mainAuthStrategies[0].strategy}):e}function*OS(){yield ji(za.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorConfig),t=yield kS(e);yield ji(za.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPublicState({error:jg(e),loading:!1}))}}function*PS(){const e=yield qi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield zi(Ip.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield zi(Ip.auth.getVendorPublicAuthStrategiesConfig),t}function*_S(){yield ji(za.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield zi(PS);yield function*(e){const t=yield zi(Jg);if(!e||!t)return;const{policy:n}=yield qi((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield ji(za.setSecurityPolicyPublicState({policy:$({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield ji(za.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyAuthStrategyPublicState({error:jg(e),loading:!1}))}}function*LS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getMfaPolicy);yield ji(za.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyMfaState({error:jg(e),loading:!1}))}}function*wS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorMfaPolicy);yield ji(za.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorMfaState({error:jg(e),loading:!1}))}}function*US(e){let{payload:{callback:t}}=e,n=ii(e.payload,hS);yield ji(za.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.saveMfaPolicy,n);yield ji(za.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*DS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getLockoutPolicy);yield ji(za.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyLockoutState({error:jg(e),loading:!1}))}}function*RS(e){let{payload:{callback:t}}=e,n=ii(e.payload,mS);yield ji(za.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.saveLockoutPolicy,n);yield ji(za.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyLockoutState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*CS(){yield ji(za.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorLockoutPolicy);yield ji(za.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorLockoutState({error:jg(e),loading:!1}))}}function*NS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCaptchaPolicy);yield ji(za.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyCaptchaState({error:jg(e),loading:!1}))}}function*MS(){yield ji(za.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getPasswordHistoryPolicy);yield ji(za.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPasswordHistoryState({error:jg(e),loading:!1}))}}function*FS(){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getVendorPasswordHistoryPolicy);yield ji(za.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({error:jg(e),loading:!1}))}}function*GS(e){let{payload:{callback:t}}=e,n=ii(e.payload,bS);yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.savePasswordHistoryPolicy,n);yield ji(za.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*$S(){yield ji(za.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getPasswordConfigPolicy);yield ji(za.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPasswordState({error:jg(e),loading:!1}))}}function*xS(){yield Bo(za.loadSecurityPolicy,IS),yield Vo(za.saveSecurityPolicyMfa,tS(US)),yield Vo(za.loadSecurityPolicyMfa,LS),yield Vo(za.loadSecurityPolicyVendorMfa,wS),yield Vo(za.saveSecurityPolicyLockout,tS(RS)),yield Vo(za.loadSecurityPolicyLockout,DS),yield Vo(za.loadSecurityPolicyVendorLockout,CS),yield Vo(za.loadSecurityPolicyCaptcha,NS),yield Vo(za.saveSecurityPolicyPasswordHistory,tS(GS)),yield Vo(za.loadSecurityPolicyPasswordHistory,MS),yield Vo(za.loadSecurityPolicyVendorPasswordHistory,FS),yield Vo(za.loadVendorPasswordConfig,$S),yield Vo(za.loadPublicSecurityPolicy,OS),yield Vo(za.loadPublicAuthStrategiesPolicy,_S)}function*VS(){yield ji(za.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield ji(za.setSecurityPolicyPublicState({policy:Zp,loading:!1}))}catch(e){yield ji(za.setSecurityPolicyPublicState({error:jg(e),loading:!1}))}}function*jS(){yield ji(za.setSecurityPolicyGlobalState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyGlobalState({policy:Qp,loading:!1})),yield ji(za.loadSecurityPolicyMfa()),yield ji(za.loadSecurityPolicyVendorMfa()),yield ji(za.loadSecurityPolicyLockout()),yield ji(za.loadSecurityPolicyVendorLockout()),yield ji(za.loadSecurityPolicyPasswordHistory()),yield ji(za.loadSecurityPolicyVendorPasswordHistory()),yield ji(za.loadSecurityPolicyCaptcha())}function*BS(){yield ji(za.setSecurityPolicyMfaState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyMfaState({policy:eg,loading:!1}))}function*WS(){yield ji(za.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorMfaState({policy:eg,loading:!1}))}function*zS(e){var t;let{payload:{callback:n}}=e,a=ii(e.payload,AS);yield ji(za.setSecurityPolicyMfaState({saving:!0,error:null}));const i=$({},tg,{id:null!=(t=a.id)?t:tg.id,enforceMFAType:a.enforceMFAType});yield It(),yield ji(za.setSecurityPolicyMfaState({policy:i,saving:!1})),null==n||n(i)}function*KS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyLockoutState({policy:tg,loading:!1}))}function*HS(){yield ji(za.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorLockoutState({policy:tg,loading:!1}))}function*qS(e){let{payload:{callback:t}}=e,n=ii(e.payload,TS);yield ji(za.setSecurityPolicyLockoutState({saving:!0,error:null})),yield It();const a=$({},tg,n,{id:n.id?n.id:tg.id});null==t||t(a),yield ji(za.setSecurityPolicyLockoutState({policy:a,saving:!1}))}function*JS(){yield ji(za.setSecurityPolicyLockoutState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyLockoutState({policy:tg,loading:!1}))}function*YS(){yield ji(za.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyPasswordHistoryState({policy:ng,loading:!1}))}function*XS(){yield ji(za.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield It(),yield ji(za.setSecurityPolicyVendorPasswordHistoryState({policy:ng,loading:!1}))}function*QS(e){let{payload:{callback:t}}=e,n=ii(e.payload,ES);yield ji(za.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield It();const a=$({},ng,n,{id:n.id?n.id:ng.id});null==t||t(a),yield ji(za.setSecurityPolicyPasswordHistoryState({policy:a,saving:!1}))}function*ZS(){yield Bo(za.loadSecurityPolicy,jS),yield Vo(za.loadPublicSecurityPolicy,VS),yield Vo(za.saveSecurityPolicyMfa,zS),yield Vo(za.loadSecurityPolicyMfa,BS),yield Vo(za.loadSecurityPolicyVendorMfa,WS),yield Vo(za.saveSecurityPolicyLockout,qS),yield Vo(za.loadSecurityPolicyLockout,KS),yield Vo(za.loadSecurityPolicyVendorLockout,HS),yield Vo(za.loadSecurityPolicyCaptcha,JS),yield Vo(za.saveSecurityPolicyPasswordHistory,QS),yield Vo(za.loadSecurityPolicyPasswordHistory,YS),yield Vo(za.loadSecurityPolicyVendorPasswordHistory,XS)}const ev=["phoneNumber"],tv=["events","url"];function*nv(){yield ji(za.setSignUpState({loading:!0}));try{const e=yield zi(Ip.auth.getVendorConfig),t=yield kS(e),{allowSignups:n,allowNotVerifiedUsersLogin:a}=e;yield ji(za.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:a,firstLoad:!1})),yield ji(za.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield ji(za.setSignUpState({loading:!1,error:jg(e),firstLoad:!1}))}}function*av(e){let{payload:{events:t,url:n}}=e,a=ii(e.payload,tv);yield ji(za.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield qi((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:d,tenants:u=[],activeTenant:y}=yield zi(Ip.auth.signUpUser,(o=a,ii(o,ev)));if(!a.invitationToken){var i;const{email:e,name:o,companyName:r,phoneNumber:s}=a,l={email:e,name:o,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:Dg.PASSWORD,id:d,tenantId:c,createdAt:new Date};null==t||null==(i=t.signUpComplete)||i.call(t,l),Wg(Bg.SIGNUP_COMPLETED,l)}if(!s&&l&&Gg(l)){const t=yield Vg(l);yield ji(za.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield qi((e=>e.auth));yield ji(za.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield ji(za.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:$({},e,{tenants:u,activeTenant:y})}))}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setSignUpState({loading:!1,error:jg(e)}))}var o;yield ji(za.setSignUpState({loading:!1}))}function*iv(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield qi((e=>e.auth.signUpState));yield ji(za.resetSignUpState()),yield ji(za.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*ov(){yield Bo(za.signUpUser,av),yield Bo(za.resetSignUpStateSoft,iv)}const rv={setVendorState:(e,{payload:t})=>$({},e,t)},sv={loadVendorPublicInfo:ft("vendor/loadVendorPublicInfo")},lv={loading:!1},{reducer:cv,actions:dv}=gt({name:Gt,initialState:lv,reducers:$({},rv)}),uv=$({},dv,sv);function*yv(){yield ji(uv.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1,name:t,logo:n}=yield Ip.vendor.getVendorPublicInfo();yield ji(uv.setVendorState({whiteLabelMode:e,name:t,logo:n,loading:!1}))}catch(e){yield ji(uv.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var fv=n(9378),pv=n.n(fv);function gv(e,t){return pv()(e,t)}function*Sv({payload:e}){const t=null==e?void 0:e.callback;try{const e=yield zi(Ip.entitlements.loadEntitlementsV2);yield function*(e){gv(yield qi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield ji(za.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*vv(){yield Bo(za.loadEntitlements,Sv)}const hv=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,a;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(a=n.FronteggNativeBridge)||a.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var i;null==(i=window.FronteggNativeBridge)||i.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,a;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(a=n.FronteggNativeBridge)||a.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var i;null==(i=window.FronteggNativeBridge)||i.loginWithSocialLogin(e)}},this.promptSocialLoginConsent=()=>{var e,t;return null!=(e=null==(t=window.FronteggNativeBridgeFunctions)?void 0:t.shouldPromptSocialLoginConsent)&&e}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isSocialLoginAvailable(){return this.isAvailable("loginWithSocialLogin")}isLoginWithSSOAvailable(){return this.isAvailable("loginWithSSO")}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*mv(){const{publicAuthStrategyPolicy:e}=yield qi((e=>e.auth.securityPolicyState)),{policy:t}=e,n=(e=>{var t;return!(null==e||null==(t=e.secondaryAuthStrategies)||!t.some((({isActive:e,strategy:t})=>e&&t===Ks.Passkeys)))})(t),a="Passkeys"===localStorage.getItem("preferred-login-method"),i="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[o]=yield zi(zp,["show-passkeys-new"]);if(!o||!n||a||i)return!1;{const{devices:e}=yield zi(Ip.auth.getWebAuthnDevices);return yield ji(za.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*bv({user:e,tenants:t=[],activeTenant:n},a={}){const{tenantsState:i}=yield qi((e=>e.auth));yield ji(za.setState($({user:e,tenantsState:$({},i,{tenants:t,activeTenant:n,loading:!1})},a)))}const Av="http://schemas.openid.net/pape/policies/2007/06/multi-factor",Tv=["otp","sms","hwk"],Ev="SHOULD_STEP_UP",Iv=(e,{maxAge:t}={})=>{if(!e)return!1;const{amr:n=[],acr:a="",auth_time:i}=e;if(t&&i&&!(Date.now()/1e3-i<=t))return!1;const o=a===Av,r=-1!==n.indexOf("mfa"),s=void 0!==Tv.find((e=>n.indexOf(e)));return o&&r&&s};function kv(){const e=window.location.pathname+window.location.search;window.localStorage.setItem(Rt,e)}function*Ov({customLoginAuthenticatedUrl:e,preventRedirectUrlOriginCleaning:t}){const{routes:n,includeQueryParam:a,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield qi((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=Ng(e);return n?t+n:t})(e);const{authenticatedUrl:r,loginUrl:s,logoutUrl:l,socialLoginCallbackUrl:c,activateUrl:d}=n;let u=window.localStorage.getItem(Rt);u&&![s,l,c,d].includes(u)||(u=r);const y=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:a})=>{let i=e;const o=new URL(window.location.href).searchParams.get("redirectUrl");return o?t&&Cg(o)?((e,t)=>{const n=new URL(window.location.href),a=new URL(e),i=a.origin===n.origin;return t.includes(a.origin)||i})(o,n)?i=o:console.warn("The redirect url param is not valid, the origin is a different site"):i=o:a&&(i+=window.location.search),i})({authenticatedUrl:u,includeQueryParam:a,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});return t?y:(f=y).startsWith(null==(p=window)?void 0:p.location.origin)?f.replace(null==(g=window)?void 0:g.location.origin,""):f;var f,p,g}function*Pv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:a,preventRedirectUrlOriginCleaning:i=!1}={}){const o=Wo.onRedirectTo;let r;if(n)r=n;else{var s;if(a){const e=window.localStorage.getItem(Rt);e&&!Cg(e)&&(r=e)}r||(r=yield zi(Ov,{customLoginAuthenticatedUrl:t,preventRedirectUrlOriginCleaning:i})),null==(s=window)||s.localStorage.removeItem(Rt)}yield Ji(200),ji(e()),o(r,{refresh:r.startsWith("http")})}function*_v(e){var t,n;const{routes:{customLoginAuthenticatedUrl:a,stepUpUrl:i}}=yield qi((e=>e.auth)),o=null==(t=window)?void 0:t.localStorage.getItem(Ev),r=yield qi((({auth:e})=>e.user));var s;if(o&&(null==(s=window)||s.localStorage.removeItem(Ev)),i&&o&&!Iv(r))return void(yield zi(Pv,za.resetLoginState,{forceStepUpUrl:i}));let l=a;a||(yield zi(Xg),l=yield qi((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield zi(Pv,za.resetLoginState,{customLoginAuthenticatedUrl:l,shouldStepUpDuringLogin:!!o,preventRedirectUrlOriginCleaning:null!=(n=null==e?void 0:e.preventRedirectUrlOriginCleaning)&&n})}function*Lv(){yield zi(Pv,za.resetStepUpState)}const wv=["callback"];function*Uv(e,t,n){const{loginState:a}=yield qi((e=>e.auth));let i={};if(!n){const t=a.flow===wt.Login?Lt.success:a.step;i={loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return $({},i,{isAuthenticated:t})}function*Dv(e,t){const{loginState:n}=yield qi((e=>e.auth));if(n.flow!==wt.Login)return;const[a]=yield zi(zp,["security-center-show-login-flows"]);a&&n.isBreachedPassword&&!e?yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1})):(yield zi(mv))?yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})):yield _v(),null==t||t(!0)}function*Rv(e){yield Lv(),null==e||e(!0)}function*Cv(e,t,n){let{callback:a}=e,i=ii(e,wv);yield ji(t({loading:!0,error:void 0}));try{const{user:e,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.loginWithMfaV2,i),s=!!e.accessToken,l=yield zi(Uv,o,s,n);if(yield zi(bv,{user:e,tenants:o,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield ji(t({loading:!1,error:void 0})),n)return void(yield zi(Rv,a));yield zi(Dv,s,a)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(!1,e)}}function*Nv({payload:e}){yield Cv(e,za.setLoginState,!1)}function*Mv(){yield zi(Lv)}function*Fv(e){const{loginState:t}=yield qi((e=>e.auth)),{step:n}=yield qi((e=>e.auth.mfaState)),[a]=yield zi(zp,["security-center-show-login-flows"]);if(t.flow===wt.Login)if(a&&t.isBreachedPassword&&!e)yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1}));else{const e=yield zi(mv);n===un.smsVerifyCode&&e?yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})):yield _v()}}function*Gv({user:e,tenants:t,activeTenant:n},a=!1){yield ji(za.setUser(e)),yield ji(za.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const i=!!e.accessToken;yield ji(za.setState({isAuthenticated:i})),a?yield zi(Mv):yield zi(Fv,i)}const $v=["callback","deviceId"],xv=["callback","deviceId"];function*Vv(e,t){let{callback:n,deviceId:a}=e,i=ii(e,$v);yield ji(t({loading:!1,error:void 0}));try{const e=yield zi(Ip.auth.preVerifyMFASMSForLogin,a,i);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*jv(e,t,n=!1){let{callback:a,deviceId:i}=e,o=ii(e,xv);yield ji(t({loading:!0}));try{const e=yield zi(Ip.auth.verifyMFASMSForLoginV2,i,o);yield Gv(e,n),yield ji(t({loading:!1,error:void 0})),null==a||a(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(null)}}function*Bv({payload:e}){yield Vv(e,za.setLoginState)}function*Wv({payload:e}){yield jv(e,za.setLoginState,!1)}const zv=["callback","deviceId"],Kv=["callback","deviceId"];function*Hv(e,t){let{callback:n,deviceId:a}=e,i=ii(e,zv);yield ji(t({loading:!0}));try{var o;const e=yield zi(Ip.auth.preVerifyMFAWebAuthnForLogin,a,i),r=$({},e.options,{challenge:Pt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*qv(e,t,n){let{callback:a,deviceId:i}=e,o=ii(e,Kv);yield ji(t({loading:!0}));try{const e=_t(o.publicKey),r=yield zi(Ip.auth.verifyMFAWebAuthnForLoginV2,i,$({},o,{options:e}));yield Gv(r,n),yield ji(t({loading:!1,error:void 0})),null==a||a(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==a||a(null)}}function*Jv({payload:e}){yield Hv(e,za.setLoginState)}function*Yv({payload:e}){yield qv(e,za.setLoginState,!1)}const Xv=["callback"],Qv=["callback"];function*Zv(e,t){let{callback:n}=e,a=ii(e,Xv);yield ji(t({loading:!0,error:void 0}));try{const e=yield zi(Ip.auth.preVerifyMFAEmailCode,a);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({error:jg(e)})),null==n||n(null)}}function*eh(e,t){let{callback:n}=e,a=ii(e,Qv);yield ji(t({loading:!0}));try{const e=yield zi(Ip.auth.verifyMFAEmailCodeV2,a);yield Gv(e),yield ji(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield ji(t({loading:!1,error:jg(e)})),null==n||n(null)}}function*th({payload:e}){yield Zv(e,za.setLoginState)}function*nh({payload:e}){yield eh(e,za.setLoginState)}const ah=["callback"],ih=["callback"],oh=["callback"],rh=["callback"],sh=["callback","events"],lh=["callback"],ch=["callback"],dh=["callback"],uh=["callback"],yh=["user"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=["callback"],vh=["callback"];function*hh(e){const t=yield qi((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return gv(t,null==e?void 0:e.entitlements)?$({},e,{entitlements:t}):e}function*mh(){let e;try{var t;const n=yield zi(Ip.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield ji(za.setState({ssoACS:e}))}function*bh(){try{const{isActive:e}=yield zi(Ip.auth.getSSOPublicConfiguration);yield ji(za.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Ah(e){var t;const{routes:n,loginState:a}=yield qi((e=>e.auth)),i=null!=(t=localStorage.getItem("register-quick-login"))?t:a.quickLoginToRegister;return i&&"true"!==localStorage.getItem(`${e.id}-${i}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Th(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield zi(Eh):yield zi(kh)}function*Eh(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Wo.setAccessToken(null),Wo.setUser(null),void(yield ji(za.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield zi(Ip.auth.exchangeOAuthTokensV2,t),a=yield zi(hh,n.user);yield zi(bv,$({},n,{user:a}),{isAuthenticated:!0})}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:null,isAuthenticated:!1}))}}function*Ih(){const{user:e}=yield qi((e=>e.auth));if(null==e||!e.refreshToken)return Wo.setAccessToken(null),Wo.setUser(null),void(yield ji(za.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield zi(Ip.auth.exchangeOAuthTokensV2,t),a=yield zi(hh,n.user);yield zi(bv,$({},n,{user:a}),{isAuthenticated:!0})}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:null,isAuthenticated:!1}))}}function*kh(){try{const t=Wo.onRedirectTo,{routes:n,loginState:a}=yield qi((e=>e.auth)),{user:i,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.refreshTokenV3);if(Gg(i)){const e=yield Vg(i);yield ji(za.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:a.quickLoginToRegister,n=yield Ah(i),s=yield zi(hh,i);yield zi(bv,{user:s,tenants:o,activeTenant:r},{loginState:$({},a,{quickLoginToRegister:t,flow:n?wt.RegisterQuickLogin:wt.Login}),isAuthenticated:!0}),yield Ph(n)}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:void 0,isAuthenticated:!1}))}}function*Oh(){try{const t=Wo.onRedirectTo,{routes:n,loginState:a}=yield qi((e=>e.auth)),{user:i,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.refreshTokenV3);if(Gg(i)){const e=yield Vg(i);yield ji(za.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield zi(hh,i);if(yield zi(mv))yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),yield zi(bv,{user:s,tenants:o,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;i.id&&localStorage.setItem("userId",i.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:a.quickLoginToRegister,n=yield Ah(i);yield zi(bv,{user:s,tenants:o,activeTenant:r},{loginState:$({},a,{quickLoginToRegister:t,flow:n?wt.RegisterQuickLogin:wt.Login}),isAuthenticated:!0}),yield Ph(n)}}}catch(e){Wo.setAccessToken(null),Wo.setUser(null),yield ji(za.setState({user:void 0,isAuthenticated:!1}))}}function*Ph(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),a=Wo.onRedirectTo,{routes:i,loginState:o}=yield qi((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[i.socialLoginCallbackUrl,i.oidcRedirectUrl,i.samlCallbackUrl];r||s.push(i.loginUrl,i.signUpUrl),e?a(i.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(o.isNewUser&&i.signUpSuccessUrl&&i.socialLoginCallbackUrl===window.location.pathname?a(i.signUpSuccessUrl,{refresh:i.signUpSuccessUrl.startsWith("http")}):yield _v())}function*_h({payload:{callback:e}}){try{const{ip:t}=yield zi(Ip.metadata.getCurrentUserIpMetadata);yield ji(za.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*Lh({payload:e}){const t=[],n=[];t.push(zi(Th)),e&&(yield ji(za.setState({isLoading:!0})),yield ji(za.loadSocialLoginsConfigurationV2()),t.push(zi(nv)),t.push(zi(_S)),t.push(zi(bh)),t.push(zi(yv)),t.push(zi(mh)),n.push(zi(Xg))),yield Bi(t),n.length>0&&(yield Bi(n)),yield ji(za.setState({isLoading:!1}))}function*wh({accessToken:e,user:t}){if(!e)return void(yield ji(za.setState({user:void 0,isAuthenticated:!1})));const n=Wo.onRedirectTo,{routes:a}=yield qi((e=>e.auth));if(Gg(t)){const e=yield Vg(t);yield ji(za.setState(e)),n(a.loginUrl,{preserveQueryParams:!0})}}function*Uh({payload:e}){const t=[];yield ji(za.loadSocialLoginsConfigurationV2()),t.push(zi(nv)),t.push(zi(bh)),t.push(zi(yv)),t.push(zi(mh)),t.push(zi(wh,e)),t.push(zi(Xg)),yield Bi(t)}const Dh=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}};function*Rh(){const e=yield zi(Ip.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield zi(bv,e,{isAuthenticated:!0,isLoading:!1})}function*Ch({payload:e}){var t;null==(t=localStorage)||t.removeItem(Ev);const{disableSilentRefresh:n}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(n)throw new Error("silent refresh is disabled");yield Rh()}catch(t){yield Mh(e)}else yield Mh(e)}function*Nh({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:a}}){var i,o;if(null==(i=localStorage)||i.removeItem(Ev),n){const{urlStrategy:e}=yield qi((e=>({urlStrategy:e.root.urlStrategy}))),t=Dh(e);if(yield ji(za.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:r}=yield qi((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(a&&((e=e||{}).login_direct_action=btoa(JSON.stringify(a))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(r)throw new Error("silent refresh is disabled");yield Rh()}catch(n){if(!t)return void(yield ji(za.setState({isLoading:!1})));yield Mh(e)}else yield Mh(e)}function*Mh(e){const{routes:t,context:n,onRedirectTo:a,urlStrategy:i}=yield qi((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(Dh(i)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield ji(za.setState({isLoading:!0}));const o=Bp(),r=Bp(),s=yield zi(jp,r);localStorage.setItem(Ct,r);let l=`${window.location.origin}${"path"===i?"":"#"}${t.hostedLoginRedirectUrl}`;yield zi(Xg);const c=yield qi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const d=`${Cr(n,"/oauth/authorize")}/oauth/authorize`,u=$({response_type:"code",client_id:n.appId||n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:o},e);if(null==e||!e.organization){const e=yield zi(Yg);e&&(u.organization=e)}const y=Mg(Fg);y&&(u.tenantId=y),a(`${d}?${new URLSearchParams(u).toString()}`,{refresh:!0})}function*Fh({payload:e}){const t=localStorage.getItem(Ct)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:a}=yield qi((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let i=`${window.location.origin}${"path"===a?"":"#"}${n.hostedLoginRedirectUrl}`;yield zi(Xg);const o=yield qi((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));o&&(i.endsWith("/")&&(i=i.slice(0,-1)),i+=o);const r={code:e.code,redirect_uri:i,code_verifier:t,grant_type:"authorization_code"};try{const e=yield zi(Ip.auth.exchangeOAuthTokensV2,r);yield zi(bv,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield ji(za.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{const e=yield qi((({auth:e})=>e.user)),t=window.localStorage.getItem(Ev);window.localStorage.removeItem(Ev),t&&Iv(e)?yield Lv():yield _v()}}function*Gh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ah);try{yield ji(za.setLoginState({loading:!0}));const e=yield zi(Ip.auth.changePhoneNumberWithVerification,n);yield ji(za.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:Lt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1}))}}function*$h(e){let{payload:{callback:t}}=e,n=ii(e.payload,ih);try{yield ji(za.setLoginState({loading:!0})),yield zi(Ip.auth.verifyChangePhoneNumber,n),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1}))}}function*xh(e){let{payload:{callback:t}}=e,n=ii(e.payload,oh);try{yield ji(za.setLoginState({loading:!0}));const e=yield zi(Ip.auth.passwordlessPreLogin,$({},n,{type:Oa.SmsCode}));yield ji(za.setLoginState({step:Lt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1})),null==t||t(e)}}function*Vh(e){let{payload:{callback:t}}=e,n=ii(e.payload,rh);try{let e;yield ji(za.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const a=yield zi(Ip.auth.passwordlessPreLogin,n),i=_a[n.type];yield ji(za.setLoginState({step:i,loading:!1,phoneNumber:null==a?void 0:a.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield ji(za.setLoginState({error:jg(e),loading:!1})),null==t||t()}}function*jh(e){let{payload:{callback:t,events:n}}=e,a=ii(e.payload,sh);try{yield ji(za.setLoginState({loading:!0}));const{user:e,tenants:o=[],activeTenant:r}=yield zi(Ip.auth.passwordlessPostLoginV2,a),s=Wo.onRedirectTo,{routes:l}=yield qi((e=>e.auth));if(Gg(e)){const t=yield Vg(e);yield ji(za.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:a}=yield qi((e=>e.auth));if(e.emailVerified){var i;const t={email:e.email,origin:Ug.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(i=n.userVerified)||i.call(n,t),Wg(Bg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield zi(bv,{user:e,tenants:o,activeTenant:r}),yield ji(za.setLoginState({error:void 0})),yield ji(za.setState({isLoading:!1})),a.flow===wt.Login?(yield zi(mv))?(yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield ji(za.setState({isAuthenticated:!0})),yield _v()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield ji(za.setLoginState({error:jg(e,"Failed to authenticate")}))}finally{yield ji(za.setLoginState({loading:!1}))}}function*Bh({payload:e}){try{yield ji(za.setLoginState({loading:!0}));const{name:t}=yield zi(Ip.auth.verifyInviteToken,e);yield ji(za.setLoginState({inviteTokenTenantName:t}))}catch(e){yield ji(za.setLoginState({inviteTokenError:jg(e,"We couldn't verify your invitation")}))}finally{yield ji(za.setLoginState({loading:!1}))}}function*Wh({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:a}}){yield ji(za.setLoginState({loading:!0}));try{const i=yield qi((({auth:{onRedirectTo:e}})=>e)),o=Mg(Fg),{address:r,idpType:s}=yield zi(Ip.auth.preLoginV2,{email:e,tenantId:o});if(r){let t=r;if(s===Pp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield qi((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}hv.isLoginWithSSOAvailable()?(hv.loginWithSSO(e),yield ji(za.setLoginState({loading:!1})),null==a||a()):(yield ji(za.setLoginState({step:Lt.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{i(t,{refresh:!0})}),2e3))}else yield zh({email:e,recaptchaToken:t,callback:a,invitationToken:n})}catch(i){yield zh({email:e,recaptchaToken:t,callback:a,invitationToken:n})}}function*zh(e){let{callback:t}=e,n=ii(e,lh);const a=yield qi((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==a||!a.authStrategy)return yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),void(null==t||t());(null==a?void 0:a.authStrategy)===Oa.EmailAndPassword?(yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),null==t||t()):[Oa.MagicLink,Oa.Code,Oa.SmsCode].includes(null==a?void 0:a.authStrategy)?yield ji(za.passwordlessPreLogin($({},n,{type:null==a?void 0:a.authStrategy,callback:t}))):(yield ji(za.setLoginState({step:Lt.loginWithPassword,loading:!1})),null==t||t())}function*Kh({payload:{callback:e}}){try{yield ji(za.setLoginState({loading:!0}));const{options:t}=yield zi(Ip.auth.webAuthnCreateNewDeviceSession);t.user.id=Pt(t.user.id),t.challenge=Pt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield ji(za.setLoginState({error:jg(t)})),null==e||e(null)}finally{yield ji(za.setLoginState({loading:!1}))}}function*Hh(e){let{payload:{callback:t}}=e,n=ii(e.payload,ch);try{yield ji(za.setLoginState({loading:!0}));const e=_t(n.publicKey),a="platform"===(null==e?void 0:e.authenticatorAttachment)?Hs.Platform:Hs.CrossPlatform;yield zi(Ip.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:a}),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setLoginState({loading:!1}))}}function*qh(e){let{payload:{callback:t}}=e,n=ii(e.payload,dh);try{var a;yield ji(za.setPasskeysState({loading:!0})),yield ji(za.setLoginState({loading:!0}));const{options:e}=yield zi(Ip.auth.webAuthnPreLogin,n);e.challenge=Pt(e.challenge),e.allowCredentials=null==(a=e.allowCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)}))),yield ji(za.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setPasskeysState({loading:!1})),yield ji(za.setLoginState({loading:!1}))}}function*Jh(e){let{payload:{callback:t}}=e,n=ii(e.payload,uh);try{var a;yield ji(za.setPasskeysState({loading:!0})),yield ji(za.setLoginState({loading:!0}));const e=_t(n.publicKey),i=yield zi(Ip.auth.webAuthnPostLoginV2,$({},e,{response:$({},e.response,{userHandle:null!=(a=e.response.userHandle)?a:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:o}=i,r=ii(i,yh);if(Gg(o)){const e=Wo.onRedirectTo,{routes:t}=yield qi((e=>e.auth)),n=yield Vg(o);yield ji(za.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else o.id&&localStorage.setItem("userId",o.id),yield zi(bv,$({user:o},r),{isAuthenticated:!0}),yield ji(za.setLoginState({error:void 0})),yield _v(),null==t||t(!0)}catch(e){yield ji(za.setLoginState({error:jg(e)})),null==t||t(null)}finally{yield ji(za.setPasskeysState({loading:!1})),yield ji(za.setLoginState({loading:!1}))}}function*Yh({payload:e}){const{onRedirectTo:t,routes:n}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ji(za.setLoginState({loading:!0}));try{const t=yield zi(Ip.auth.postLogin,e);yield ji(za.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield _v()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield ji(za.setLoginState({step:Lt.loginWithSSOFailed,loading:!1}))}}function*Xh({payload:{email:e,password:t,recaptchaToken:n,invitationToken:a,callback:i}}){yield ji(za.setLoginState({loading:!0}));try{const{user:o,tenants:r=[],activeTenant:s}=yield zi(Ip.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:a}),l=Wo.onRedirectTo,{routes:c}=yield qi((e=>e.auth));if(Gg(o)){const e=yield Vg(o);yield ji(za.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield qi((e=>e.auth)),n=!!o.accessToken;o.id&&localStorage.setItem("userId",o.id),yield zi(bv,{user:o,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:o.mfaToken,step:t.flow===wt.Login?Lt.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:o.isBreachedPassword},isAuthenticated:n});const[a]=yield zi(zp,["security-center-show-login-flows"]);t.flow===wt.Login&&(a&&o.isBreachedPassword&&!n?yield ji(za.setLoginState({step:Lt.breachedPassword,loading:!1})):n&&((yield zi(mv))?(yield ji(za.setLoginState({step:Lt.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield _v()))}localStorage.removeItem("register-quick-login"),null==i||i(!0)}catch(t){Wo.setAccessToken(null),Wo.setUser(null),null==i||i(!1,t),yield ji(za.setLoginState({email:e,error:jg(t),loading:!1}))}}function*Qh({payload:e}){yield ji(za.setLoginState({loading:!0}));try{var t;yield zi(Ip.auth.recoverMfaToken,e),yield ji(za.setLoginState({loading:!1,error:void 0,step:Lt.preLogin})),yield ji(za.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setLoginState({error:jg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Zh({payload:e}){const{hostedLoginBox:t}=yield qi((e=>e.auth));yield ji(za.setState({isLoading:!0}));try{t?yield zi(Ip.auth.OAuthLogout):yield zi(Ip.auth.logout)}catch{}Wo.isSessionPerTenantEnabled()&&os(),yield ji(za.resetState()),yield ji(za.requestAuthorize(!0)),null==e||e()}function*em({payload:e}){var t;try{yield zi(Ip.auth.logout)}catch{}Wo.isSessionPerTenantEnabled()&&os(),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*tm({user:e,tenants:t,activeTenant:n}){const a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(a.recoveryCode=e.recoveryCode),yield ji(za.setMfaState(a)),yield ji(za.setUser(e)),yield ji(za.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*nm(e){let{payload:{callback:t}}=e,n=ii(e.payload,fh);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.preEnrollMFASMSForLogin,n);yield ji(za.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*am(e){let{payload:{callback:t}}=e,n=ii(e.payload,ph);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.enrollMFASMSForLoginV2,n);yield tm(e),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*im(e){let{payload:{callback:t}}=e,n=ii(e.payload,gh);yield ji(za.setLoginState({loading:!0}));try{var a;const e=yield zi(Ip.auth.preEnrollMFAWebAuthnForLogin,n),i=$({},e.options,{challenge:Pt(e.options.challenge),user:$({},e.options.user,{id:Pt(e.options.user.id)}),excludeCredentials:null==(a=e.options.excludeCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setLoginState({loading:!1})),null==t||t({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*om(e){let{payload:{callback:t}}=e,n=ii(e.payload,Sh);yield ji(za.setLoginState({loading:!0}));try{const e=_t(n.publicKey),a=yield zi(Ip.auth.enrollMFAWebAuthnForLoginV2,$({},n,{options:e}));yield tm(a),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*rm(e){let{payload:{callback:t}}=e,n=ii(e.payload,vh);yield ji(za.setLoginState({loading:!0}));try{const e=yield zi(Ip.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield tm(e),yield ji(za.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)})),null==t||t(null)}}function*sm({payload:e}){yield ji(za.setLoginState({loading:!0}));try{yield zi(Ip.auth.forgotPassword,e),yield ji(za.setLoginState({loading:!1,error:void 0,step:Lt.breachedPasswordSuccess})),yield ji(za.setState({isAuthenticated:!1}))}catch(e){yield ji(za.setLoginState({loading:!1,error:jg(e)}))}}function*lm(){yield Bo(za.requestAuthorize,Lh),yield Bo(za.requestAuthorizeSSR,Uh),yield Bo(za.requestHostedLoginAuthorize,Ch),yield Bo(za.requestHostedLoginAuthorizeV2,Nh),yield Bo(za.handleHostedLoginCallback,Fh),yield Bo(za.preLogin,Wh),yield Bo(za.postLogin,Yh),yield Bo(za.login,Xh),yield Bo(za.logout,Zh),yield Bo(za.silentLogout,em),yield Bo(za.loginWithMfa,Nv),yield Bo(za.recoverMfa,Qh),yield Bo(za.quickSmsPasswordlessPreLogin,xh),yield Bo(za.changePhoneNumberWithVerification,Gh),yield Bo(za.verifyChangePhoneNumber,$h),yield Bo(za.passwordlessPreLogin,Vh),yield Bo(za.passwordlessPostLogin,jh),yield Bo(za.verifyInviteToken,Bh),yield Bo(za.webAuthnPrelogin,qh),yield Bo(za.webAuthnPostLogin,Jh),yield Bo(za.webAuthnCreateNewDeviceSession,Kh),yield Bo(za.webAuthnVerifyNewDeviceSession,Hh),yield Bo(za.afterAuthNavigation,_v),yield Bo(za.getUserIP,_h),yield Bo(za.preEnrollMFASMSForLogin,nm),yield Bo(za.enrollMFASMSForLogin,am),yield Bo(za.preEnrollMFAWebAuthnForLogin,im),yield Bo(za.enrollMFAWebAuthnForLogin,om),yield Bo(za.enrollMFAAuthenticatorAppForLogin,rm),yield Bo(za.preVerifyMFASMSForLogin,Bv),yield Bo(za.verifyMFASMSForLogin,Wv),yield Bo(za.preVerifyMFAWebAuthnForLogin,Jv),yield Bo(za.verifyMFAWebAuthnForLogin,Yv),yield Bo(za.preVerifyMFAEmailCode,th),yield Bo(za.verifyMFAEmailCode,nh),yield Bo(za.resetBreachedPassword,sm)}function*cm({payload:e}){e&&(yield ji(za.setState({isLoading:!0})));const t=Yp;yield ji(za.loadTenants()),yield ji(za.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*dm({payload:{callback:e}}){try{const{ip:t}=bg[0];yield ji(za.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*um(){yield Bo(za.requestAuthorize,cm),yield Bo(za.afterAuthNavigation,_v),yield Bo(za.getUserIP,dm)}const ym=["callback","samlVendor"],fm=["callback","samlVendor"];function*pm(){try{var e,t;yield ji(za.setSSOState({loading:!0}));const n=yield zi(Ip.auth.getSamlConfiguration),a=yield zi(Ip.auth.getOidcConfiguration),i=yield zi(Ip.metadata.getSamlMetadata);n.acsUrl=null==i||null==(e=i.configuration)?void 0:e.acsUrl,n.spEntityId=null==i||null==(t=i.configuration)?void 0:t.spEntityId,n.isSamlActive=null==i?void 0:i.isActive,yield ji(za.setSSOState({samlConfiguration:n,oidcConfiguration:a,loading:!1,firstLoad:!1}))}catch(e){yield ji(za.setSSOState({error:jg(e),loading:!1}))}}function*gm({payload:e}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield ji(za.setSSOState({error:void 0,[n]:!0}));try{const a=yield Wp(e[0]),i=yield zi(Ip.auth.updateSamlVendorMetadata,{metadata:a});i.isSamlActive=null==t?void 0:t.isSamlActive,yield ji(za.setSSOState({samlConfiguration:i,error:void 0,[n]:!1}))}catch(e){yield ji(za.setSSOState({samlConfiguration:t,error:jg(e),[n]:!1}))}}function*Sm({payload:e}){const{configFile:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.samlConfiguration)),i="saving";yield ji(za.setSSOState({error:void 0,[i]:!0}));try{const e=yield Wp(t),o=yield zi(Ip.auth.updateSamlVendorMetadata,{metadata:e});o.isSamlActive=null==a?void 0:a.isSamlActive,yield ji(za.setSSOState({samlConfiguration:o,error:void 0,[i]:!1})),null==n||n(!0)}catch(e){yield ji(za.setSSOState({samlConfiguration:a,error:jg(e),[i]:!1})),null==n||n(null,e)}}function*vm({payload:e}){const{callback:t,samlVendor:n}=e,a=ii(e,ym),i=yield qi((e=>e.auth.ssoState.samlConfiguration)),o=$({},i,a);let r="saving";(null==o?void 0:o.enabled)!==i.enabled&&(r="loading");try{if(null==o||!o.domain)return void(yield ji(za.setSSOState({samlConfiguration:$({},i,o)})));if(yield ji(za.setSSOState({error:void 0,[r]:!0})),e.type===Pp.Saml){var s,l;const e=yield zi(Ip.metadata.getSamlMetadata);o.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,o.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const a=Vp(o,["validated","generatedVerification","createdAt","updatedAt"]);(null==i?void 0:i.domain)!==(null==a?void 0:a.domain)&&(a.ssoEndpoint="",a.publicCertificate="",a.signRequest=!1),a.type=null==n?void 0:n.toLowerCase();const c=yield zi(Ip.auth.updateSamlConfiguration,a);c.isSamlActive=null==i?void 0:i.isSamlActive,yield ji(za.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield ji(za.setSSOState({samlConfiguration:i,error:jg(e),[r]:!1})),null==t||t(null,e)}}function*hm({payload:{callback:e}={}}){const t=yield qi((e=>e.auth.ssoState.samlConfiguration));try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.validateSamlDomain),yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!1}),error:jg(n),saving:!1})),null==e||e(null,n)}}function*mm(){try{const e=yield zi(Ip.auth.getSamlRoles),t=yield zi(Ip.auth.getSamlRolesGroups);yield ji(za.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield ji(za.setSSOState({error:jg(e)}))}}function*bm({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Bi(e.map((e=>zi(Ip.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield ji(za.setSSOState({error:jg(e)}))}}(n)),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setSSOState({error:jg(t),saving:!1})),null==e||e(null,t)}}function*Am({payload:{callback:e,id:t}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.deleteSamlGroup,{id:t}),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setSSOState({error:jg(t),saving:!1})),null==e||e(null,t)}}function*Tm({payload:{group:e,roleIds:t,callback:n}}){try{yield ji(za.setSSOState({error:void 0,saving:!0})),yield zi(Ip.auth.createSamlGroup,{group:e,roleIds:t}),yield mm(),yield ji(za.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield ji(za.setSSOState({error:jg(e),saving:!1})),null==n||n(null,e)}}function*Em({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield ji(za.setSSOState({loading:!0})),yield zi(Ip.auth.oidcPostLoginV2,t),yield zi(Th),yield ji(za.setSSOState({loading:!1}))}catch(e){yield ji(za.setSSOState({loading:!1,error:jg(e,"Failed to authenticate"),firstLoad:!1}))}}function*Im(){yield Vo(za.loadSSOConfigurations,pm),yield Vo(za.saveSSOConfigurations,vm),yield Vo(za.saveSSOConfigurationsFile,gm),yield Vo(za.saveSSOConfigurationsFileWithCallback,Sm),yield Vo(za.validateSSODomain,hm),yield Vo(za.loadSSOAuthorizationRoles,mm),yield Vo(za.updateSSOAuthorizationRoles,bm),yield Vo(za.deleteSamlGroup,Am),yield Vo(za.createSamlGroup,Tm),yield Vo(za.oidcPostlogin,Em)}function*km(){yield ji(za.setSSOState({loading:!0})),yield It(),yield ji(za.setSSOState({samlConfiguration:ag,loading:!1,firstLoad:!1}))}function*Om({payload:e}){const t="saving";yield ji(za.setSSOState({error:void 0,[t]:!0}));const n=$({},yield qi((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield ji(za.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*Pm({payload:e}){var t,n;const{callback:a,samlVendor:i}=e,o=ii(e,fm),r=rg.samlConfiguration,s=$({},r,o);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield ji(za.setSSOState({samlConfiguration:$({},r,s)})));yield ji(za.setSSOState({error:void 0,[l]:!0})),yield It(),s.acsUrl=null==ig||null==(t=ig.configuration)?void 0:t.acsUrl,s.spEntityId=null==ig||null==(n=ig.configuration)?void 0:n.spEntityId;const c=Vp(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==i?void 0:i.toLowerCase(),yield It(),yield ji(za.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==a||a(!0)}function*_m({payload:{callback:e}={}}){const t=rg.samlConfiguration;yield ji(za.setSSOState({error:void 0,saving:!0})),yield It(),yield ji(za.setSSOState({samlConfiguration:$({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*Lm(){yield It(),yield ji(za.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*wm({payload:{callback:e,authorizationRoles:t}}){yield ji(za.setSSOState({error:void 0,saving:!0})),yield It(),yield ji(za.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Um(){yield Vo(za.loadSSOConfigurations,km),yield Vo(za.saveSSOConfigurations,Pm),yield Vo(za.saveSSOConfigurationsFile,Om),yield Vo(za.validateSSODomain,_m),yield Vo(za.loadSSOAuthorizationRoles,Lm),yield Vo(za.updateSSOAuthorizationRoles,wm)}const Dm=["callback"],Rm=["callback","ssoConfigId"],Cm=["callback","ssoConfigId"],Nm=["callback","ssoConfigId"];function*Mm(){try{return yield zi(Ip.auth.getOidcConfiguration)}catch(e){return null}}function*Fm(){try{return yield zi(Ip.metadata.getSamlMetadata)}catch(e){return null}}function*Gm(){try{yield ji(za.setSSOLoader({key:Op.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Bi([zi(Mm),zi(Fm)]),n=yield zi(Ip.auth.getSSOConfigurations);yield ji(za.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield ji(za.setSSOError({key:Op.LOAD_SSO_CONFIGURATIONS,value:jg(e)}))}finally{yield ji(za.setSSOLoader({key:Op.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*$m({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=ii(e,Dm),a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{var i;const e=yield zi(Ip.auth.createSSOConfiguration,$({},n,{enabled:null!=(i=n.enabled)&&i}));yield ji(za.setSSOState({ssoConfigurations:[...a,e]})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!1}))}}function*xm({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Wp(t),i=yield zi(Ip.auth.createSSOConfigurationByMetadata,{metadata:e});yield ji(za.setSSOState({ssoConfigurations:[...a,i]})),null==n||n(i)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Vm({payload:e}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,a=ii(e,Rm),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield zi(Ip.auth.updateSSOConfiguration,n,a),o=i.map((t=>t.id===n?e:t));yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.UPDATE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*jm({payload:e}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:a}=e,i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Wp(a),o=yield zi(Ip.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=i.map((e=>e.id===n?o:e));yield ji(za.setSSOState({ssoConfigurations:r})),null==t||t(o)}catch(e){yield ji(za.setSSOError({key:Op.UPDATE_SSO_CONFIGURATION,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Bm({payload:e}){yield ji(za.setSSOLoader({key:Op.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.deleteSSOConfiguration,t),yield ji(za.setSSOState({ssoConfigurations:a.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield ji(za.setSSOError({key:Op.DELETE_SSO_CONFIGURATION,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Wm({payload:e}){const{callback:t,ssoConfigId:n}=e,a=ii(e,Cm);yield ji(za.setSSOLoader({key:Op.SAVE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield zi(Ip.auth.createSSODomain,n,a),o=i.map((t=>t.id===n?$({},t,{domains:[...t.domains,e]}):t));yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_DOMAIN,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_DOMAIN,value:!1}))}}function*zm({payload:e}){const{ssoConfigId:t,domainId:n,callback:a}=e;yield ji(za.setSSOLoader({key:Op.DELETE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.deleteSSODomain,t,n);const e=i.map((e=>e.id===t?$({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield ji(za.setSSOState({ssoConfigurations:e})),null==a||a(!0)}catch(e){yield ji(za.setSSOError({key:Op.DELETE_SSO_DOMAIN,value:jg(e)})),null==a||a(null,e)}finally{yield ji(za.setSSOLoader({key:Op.DELETE_SSO_DOMAIN,value:!1}))}}function*Km({payload:e}){const{callback:t,domainId:n,ssoConfigId:a}=e;yield ji(za.setSSOLoader({key:Op.VALIDATE_SSO_DOMAIN,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.validateSSODomainV2,a,n);const e=i.map((e=>e.id===a?$({},e,{domains:e.domains.map((e=>e.id===n?$({},e,{validated:!0}):e))}):e));yield ji(za.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield ji(za.setSSOError({key:Op.VALIDATE_SSO_DOMAIN,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Hm({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const a=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield zi(Ip.auth.setSSODefaultRoles,t,{roleIds:n});const i=a.map((e=>e.id===t?$({},e,{roleIds:n}):e));yield ji(za.setSSOState({ssoConfigurations:i})),null==e||e(!0)}catch(t){yield ji(za.setSSOError({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:jg(t)})),null==e||e(null,t)}finally{yield ji(za.setSSOLoader({key:Op.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*qm({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:a}}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!0}));const i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{yield Bi(t.map((e=>zi(Ip.auth.deleteSSOGroup,n,e)))),yield Bi(e.map((e=>zi(Ip.auth.createSSOGroup,n,e))));const o=yield zi(Ip.auth.getSSOGroups,n),r=i.map((e=>e.id===n?$({},e,{groups:o}):e));yield ji(za.setSSOState({ssoConfigurations:r})),null==a||a(!0)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_GROUPS,value:jg(e)})),null==a||a(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!1}))}}function*Jm({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Bi(t.map((t=>zi(Ip.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield ji(za.setSSOError({key:Op.SAVE_SSO_GROUPS,value:jg(e)})),null==n||n(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_GROUPS,value:!1}))}}function*Ym({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:a,callback:i}=e,o=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;a?(r=yield zi(Ip.auth.updateSSOConfigurationByMetadataUrl,a,e),s=o.map((e=>e.id===a?r:e))):(r=yield zi(Ip.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...o]),yield ji(za.setSSOState({ssoConfigurations:s})),null==i||i(r)}catch(e){null==i||i(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Xm({payload:e}){yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,a=ii(e,Nm),i=yield qi((e=>e.auth.ssoState.ssoConfigurations));try{let e,o;n?(e=yield zi(Ip.auth.updateSSOConfiguration,n,a),o=i.map((t=>t.id===n?e:t))):(e=yield zi(Ip.auth.createSSOConfiguration,a),o=[e,...i]),yield ji(za.setSSOState({ssoConfigurations:o})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield ji(za.setSSOLoader({key:Op.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Qm(){yield Vo(za.loadSSOConfigurationsV2,Gm),yield Vo(za.saveSSOConfigurationV2,$m),yield Vo(za.saveSSODomain,Wm),yield Vo(za.deleteSSODomain,zm),yield Vo(za.validateSSODomainV2,Km),yield Vo(za.updateSSOConfiguration,Vm),yield Vo(za.deleteSSOConfiguration,Bm),yield Vo(za.setSSOGroups,qm),yield Vo(za.updateSSOGroups,Jm),yield Vo(za.setSSODefaultRoles,Hm),yield Vo(za.saveSSOConfigurationByMetadata,xm),yield Vo(za.updateSSOConfigurationByMetadata,jm),yield Vo(za.saveSSOConfigurationByUrl,Ym),yield Vo(za.saveSSOConfigurationByData,Xm)}const Zm=["callback","profilePictureUrl"],eb=["callback","profilePictureUrl"];function*tb(){yield ji(za.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var a=arguments.length,i=new Array(a>3?a-3:0),o=3;o<a;o++)i[o-3]=arguments[o];return zi.apply(void 0,[xo,e,t,n].concat(i))}(3,2e3,Ip.teams.getProfile),t=yield qi((e=>e.auth.user));za.setUser($({},t,e)),yield ji(za.setProfileState({profile:e,loading:!1}))}catch(e){yield ji(za.setProfileState({loading:!1,error:jg(e)}))}}function*nb(e){let{payload:{callback:t,profilePictureUrl:n}}=e,a=ii(e.payload,Zm);yield ji(za.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield qi((e=>e.auth.profileState.profile));let i=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const a=`image/${n[1]}`,i=function(e,t){const n=atob(e),a=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),i=new Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);a.push(new Uint8Array(i))}return new Blob(a,{type:t})}(n[2],a),o=new FormData;return o.append(t,new File([i],t,{type:a})),o}(n,"image");if(e){i=yield zi(Ip.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(i);n.searchParams.set("t",t),i=n.href}}const o=$({},e,a,{profilePictureUrl:i}),r=yield zi(Ip.users.updateUserProfileV2,o),s=yield qi((e=>e.auth.user));yield ji(za.setUser($({},s,r))),yield ji(za.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(o)}catch(e){yield ji(za.setProfileState({saving:!1,error:jg(e),loading:!1})),null==t||t(null,e)}}function*ab({payload:e}){yield ji(za.setProfileState({loading:!0}));try{var t;yield zi(Ip.teams.changePassword,e),yield ji(za.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setProfileState({loading:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*ib(){yield Bo(za.loadProfile,tb),yield Vo(za.saveProfile,nb),yield Vo(za.changePassword,ab)}function*ob(){yield ji(za.setProfileState({loading:!0})),yield It(),yield ji(za.setUser($({},Yp,Jp))),yield ji(za.setProfileState({loading:!1,profile:Jp}))}function*rb(e){let{payload:{callback:t,profilePictureUrl:n}}=e,a=ii(e.payload,eb);yield ji(za.setProfileState({saving:!0,error:null}));const i=Xp;let o=i.profile.profilePictureUrl;n!==i.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(o=n);const r=$({},i.profile,a,{profilePictureUrl:o}),s=Yp;yield It(),yield ji(za.setUser($({},s,r))),yield ji(za.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*sb({payload:e}){var t;yield ji(za.setProfileState({loading:!0})),yield It(),yield ji(za.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*lb(){yield Bo(za.loadProfile,ob),yield Vo(za.saveProfile,rb),yield Vo(za.changePassword,sb)}const cb=["callback"],db=["callback"],ub=["user"],yb=["callback"],fb=["deviceId","callback"],pb=["deviceId","callback"],gb=["callback"],Sb=["deviceId"],vb=["deviceId"],hb=["callback"],mb=["deviceId"],bb=["callback"];function*Ab(e){const{step:t}=yield qi((e=>e.auth.mfaState));return{step:e.recoveryCode?un.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*Tb(){yield ji(za.setMfaState({saving:!0}));try{const{qrCode:e}=yield zi(Ip.auth.enrollMfa);yield ji(za.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)}))}}function*Eb(e){let{payload:{callback:t}}=e,n=ii(e.payload,cb);yield ji(za.setMfaState({saving:!0}));try{const e=yield qi((e=>e.auth.user)),a=yield zi(Ip.auth.verifyMfa,n),i=yield zi(Ip.auth.getMFADevices),o=yield Ab(a);yield ji(za.setMfaState($({},o,{mfaDevices:i}))),yield ji(za.setUser($({},e,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*Ib(e){let{payload:{callback:t}}=e,n=ii(e.payload,db);yield ji(za.setMfaState({loading:!0}));try{const e=yield zi(Ip.auth.loginWithMfaV2,n),{user:a}=e,i=ii(e,ub),o={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=a&&a.recoveryCode&&(o.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(o)),yield bv($({user:a},i)),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*kb({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t;yield zi(Ip.auth.disableMfa,e);const n=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setMfaState({saving:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ob({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t,n;const a=yield zi(Ip.auth.preEnrollMFAWebAuthn),i=$({},a.options,{challenge:Pt(a.options.challenge),user:$({},a.options.user,{id:Pt(a.options.user.id)}),excludeCredentials:null==(t=a.options.excludeCredentials)?void 0:t.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:i,webauthnToken:a.webauthnToken})}catch(t){var a;yield ji(za.setMfaState({saving:!1,error:jg(t)})),null==(a=e.callback)||a.call(e,null,t)}}function*Pb(e){let{payload:{callback:t}}=e,n=ii(e.payload,yb);yield ji(za.setMfaState({saving:!0}));try{const e=_t(n.publicKey),a=yield zi(Ip.auth.enrollMFAWebAuthn,$({},n,{options:e})),i=yield zi(Ip.auth.getMFADevices),o=yield Ab(a);yield ji(za.setMfaState($({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*_b(e){let{payload:{deviceId:t,callback:n}}=e;ii(e.payload,fb),yield ji(za.setMfaState({saving:!0}));try{var a;const e=yield zi(Ip.auth.preDisableMFAWebAuthn,t),i=$({},e.options,{challenge:Pt(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>$({},e,{id:Pt(e.id)})))});yield ji(za.setMfaState({saving:!1})),null==n||n({options:i,webauthnToken:e.webauthnToken})}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==n||n(null,e)}}function*Lb(e){let{payload:{deviceId:t,callback:n}}=e,a=ii(e.payload,pb);yield ji(za.setMfaState({saving:!0}));try{const e=_t(a.publicKey);yield zi(Ip.auth.disableMFAWebAuthn,t,$({},a,{options:e}));const i=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:i})),null==n||n(!0)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==n||n(!1,e)}}function*wb({payload:e}){yield ji(za.setMfaState({saving:!0}));try{var t;const n=yield zi(Ip.auth.preEnrollMFASMS,e);yield ji(za.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 ji(za.setMfaState({saving:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*Ub(e){let{payload:{callback:t}}=e,n=ii(e.payload,gb);yield ji(za.setMfaState({saving:!0}));try{const e=yield zi(Ip.auth.enrollMFASMS,n),a=yield zi(Ip.auth.getMFADevices),i=yield Ab(e);yield ji(za.setMfaState($({},i,{mfaDevices:a}))),null==t||t(i.recoveryCode)}catch(e){yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*Db(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,Sb);yield ji(za.setMfaState({saving:!0}));try{var a;const e=yield zi(Ip.auth.preDisableMFASMS,t);yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(a=n.callback)||a.call(n,!0)}catch(e){var i;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Rb(e){let{payload:{deviceId:t}}=e,n=ii(e.payload,vb);yield ji(za.setMfaState({saving:!0}));try{var a;yield zi(Ip.auth.disableMFASMS,t,n);const e=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(a=n.callback)||a.call(n,!0)}catch(e){var i;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(i=n.callback)||i.call(n,!1,e)}}function*Cb(){yield ji(za.setMfaState({loading:!0}));try{yield qi((e=>e.auth.user));const e=yield zi(Ip.auth.getMFADevices);yield ji(za.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)}))}}function*Nb(){yield ji(za.setMfaState({loading:!0}));try{const e=(yield zi(Ip.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield ji(za.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield ji(za.setMfaState({loading:!1,error:jg(e)}))}}function*Mb(){yield Vo(za.enrollMfa,Tb),yield Vo(za.getMFADevices,Cb),yield Vo(za.getMFAStrategies,Nb),yield Vo(za.verifyMfa,Eb),yield Vo(za.disableMfa,kb),yield Vo(za.verifyMfaAfterForce,Ib),yield Vo(za.preDisableMfaSms,Db),yield Vo(za.disableMfaSms,Rb),yield Vo(za.preEnrollMfaSms,wb),yield Vo(za.enrollMfaSms,Ub),yield Vo(za.preEnrollMfaWebAuthn,Ob),yield Vo(za.enrollMfaWebAuthn,Pb),yield Vo(za.preDisableMfaWebAuthn,_b),yield Vo(za.disableMfaWebAuthn,Lb)}function*Fb(){yield ji(za.setMfaState({saving:!0})),yield ji(za.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*Gb({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It();const n={token:"token",recoveryCode:"recoveryCode"},a={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:$({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(a.recoveryCode=n.recoveryCode),yield ji(za.setMfaState(a)),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==e||e(a.recoveryCode)}function*$b(e){let{payload:{callback:t}}=e,n=ii(e.payload,hb);yield ji(za.setMfaState({loading:!0})),yield It();const a=$({},n,{recoveryCode:"recoveryCode"}),i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=a&&a.recoveryCode&&(i.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(i)),yield It(),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*xb({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({saving:!1,error:void 0,mfaDevices:$({},n,{authenticators:[]})})),yield ji(za.setUser($({},Yp))),null==(t=e.callback)||t.call(e,!0)}function*Vb(e){let{}=e,t=ii(e.payload,mb);yield ji(za.setMfaState({saving:!0}));try{var n;yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var a;yield ji(za.setMfaState({saving:!1,error:jg(e)})),null==(a=t.callback)||a.call(t,!1,e)}}function*jb({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({loading:!1,error:void 0,mfaDevices:$({},n,{phones:[]})})),yield ji(za.setUser($({},Yp))),null==(t=e.callback)||t.call(e,!0)}function*Bb({payload:e}){var t;yield ji(za.setMfaState({saving:!0})),yield It(),yield ji(za.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*Wb(e){let{payload:{callback:t}}=e;ii(e.payload,bb);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield qi((e=>e.auth.mfaState));yield ji(za.setMfaState({saving:!0})),yield It();const a={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:$({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=a&&a.recoveryCode&&(i.recoveryCode=a.recoveryCode),yield ji(za.setMfaState(i)),yield ji(za.setUser($({},Yp,{mfaEnrolled:!0}))),null==t||t(i.recoveryCode)}function*zb(){yield Vo(za.enrollMfa,Fb),yield Vo(za.verifyMfa,Gb),yield Vo(za.disableMfa,xb),yield Vo(za.verifyMfaAfterForce,$b),yield Vo(za.preDisableMfaSms,Vb),yield Vo(za.disableMfaSms,jb),yield Vo(za.preEnrollMfaSms,Bb),yield Vo(za.enrollMfaSms,Wb)}const Kb=["callback"];function*Hb({payload:e}){yield ji(za.setForgotPasswordState({loading:!0}));try{var t;yield zi(Ip.auth.forgotPassword,e),yield ji(za.setForgotPasswordState({loading:!1,error:void 0,step:Yt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setForgotPasswordState({loading:!1,error:jg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*qb(e){let{payload:{callback:t}}=e,n=ii(e.payload,Kb);yield ji(za.setForgotPasswordState({loading:!0}));try{yield zi(Ip.auth.resetPassword,n),yield ji(za.setForgotPasswordState({loading:!1,error:void 0,step:Yt.success})),null==t||t(!0)}catch(e){yield ji(za.setForgotPasswordState({loading:!1,error:jg(e)})),null==t||t(!1,e)}}function*Jb({payload:e}){yield ji(za.setForgotPasswordState({loading:!0}));try{const t=yield zi(Ip.auth.loadPasswordConfig,e);yield ji(za.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield ji(za.setForgotPasswordState({loading:!1,error:jg(e)}))}}function*Yb(){yield Bo(za.forgotPassword,Hb),yield Bo(za.resetPassword,qb),yield Bo(za.loadPasswordConfig,Jb)}let Xb;!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",e.CONFIG_TEMPORARY_USERS="CONFIG_TEMPORARY_USERS",e.UPDATE_USER_EXPIRATION_TIME="UPDATE_USER_EXPIRATION_TIME"}(Xb||(Xb={}));const Qb=["callback","events"],Zb=["user"],eA=["callback"],tA=["callback"];function*nA({payload:{userId:e,token:t}}){yield ji(za.setActivateState({loading:!0,step:jt.activating}));try{const{isAuthenticated:n}=yield qi((e=>e.auth));n&&(yield ji(za.silentLogout()));const a=yield zi(Ip.auth.getActivateAccountStrategy,{userId:e,token:t});yield ji(za.setActivateStrategyState({strategy:a,loading:!1,error:void 0})),a.shouldSetPassword&&(yield ji(za.setActivateState({loading:!1,step:jt.activatingForm})))}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)}))}}function*aA(e){let{payload:{callback:t,events:n}}=e,a=ii(e.payload,Qb);yield ji(za.setActivateState({loading:!0}));try{const e=Wo.onRedirectTo,{routes:o}=yield qi((e=>e.auth)),r=yield zi(Ip.auth.activateAccountV2,a),{user:s}=r,l=ii(r,Zb);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(Gg(s)){yield ji(za.setActivateState({step:jt.success}));const t=yield Vg(s);yield ji(za.setState(t)),yield Ji(1e3),e(o.loginUrl,{preserveQueryParams:!0})}else{var i;yield ji(za.setActivateState({step:jt.success}));const e={email:s.email,origin:Ug.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(i=n.userVerified)||i.call(n,e),Wg(Bg.USER_VERIFIED,e),yield zi(bv,$({user:s},l),{isAuthenticated:!0}),yield Ji(1e3),yield _v(),yield ji(za.resetActivateState())}null==t||t(!0)}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)}))}}function*iA({payload:e}){const{callback:t}=e,n=ii(e,eA);yield ji(za.setActivateStrategyState({loading:!0}));try{const e=yield zi(Ip.auth.getActivateAccountStrategy,n);yield ji(za.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield ji(za.setActivateStrategyState({loading:!1,error:jg(e)}))}}function*oA({payload:e}){const{callback:t}=e,n=ii(e,tA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.email})),yield ji(za.setActivateState({loading:!0}));try{yield zi(Ip.auth.resendActivationEmail,n),yield ji(za.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield ji(za.setActivateState({loading:!1,error:jg(e)})),yield ji(za.setTeamError({key:Xb.RESEND_ACTIVATE_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*rA(){yield Bo(za.activateAccount,aA),yield Bo(za.preActivateAccount,nA),yield Bo(za.getActivateAccountStrategy,iA),yield Bo(za.resendActivationEmail,oA)}function*sA({payload:e}){if(e.token&&e.userId)try{yield ji(za.setAcceptInvitationState({error:void 0,step:Kt.pending})),yield zi(Ip.auth.acceptInvitation,e),yield ji(za.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Kt.success}}))}catch(e){yield ji(za.setAcceptInvitationState({step:Kt.failed,error:jg(e)}))}else yield ji(za.setAcceptInvitationState({error:void 0,step:Kt.invalid}))}function*lA(){yield Bo(za.acceptInvitation,sA)}var cA,dA=new Uint8Array(16);function uA(){if(!cA&&!(cA="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 cA(dA)}const yA=/^(?:[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,fA=function(e){return"string"==typeof e&&yA.test(e)};for(var pA=[],gA=0;gA<256;++gA)pA.push((gA+256).toString(16).substr(1));const SA=function(e,t,n){var a=(e=e||{}).random||(e.rng||uA)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=a[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(pA[e[t+0]]+pA[e[t+1]]+pA[e[t+2]]+pA[e[t+3]]+"-"+pA[e[t+4]]+pA[e[t+5]]+"-"+pA[e[t+6]]+pA[e[t+7]]+"-"+pA[e[t+8]]+pA[e[t+9]]+"-"+pA[e[t+10]]+pA[e[t+11]]+pA[e[t+12]]+pA[e[t+13]]+pA[e[t+14]]+pA[e[t+15]]).toLowerCase();if(!fA(n))throw TypeError("Stringified UUID is invalid");return n}(a)};let vA,hA;!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"}(vA||(vA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(hA||(hA={}));const mA=e=>{var t;return null!=(t=e.map((({appIds:e})=>e)).reduce(((e,t)=>(null==t||t.forEach((t=>{e&&!e.includes(t)&&e.push(t)})),e)),[]))?t:[]},bA="Assignment action failed. Try again or contact support.";function*AA(){yield ji(za.setApplicationsState({loading:!0,fetching:!0}));try{const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.id})),t=yield zi(Ip.applications.getUserApplicationsId,{userId:e}),n=yield zi(Ip.applications.getApplicationsData,{appIds:t});yield ji(za.setApplicationsState({userApplications:n,fetching:!1,loading:!1}))}catch(e){yield ji(za.setApplicationsState({loading:!1,fetching:!1,error:jg(e)}))}}function*TA(){yield ji(za.setApplicationsState({loading:!0,fetching:!0}));try{const e=yield zi(Ip.applications.getTenantsApplications),t=mA(e),n=yield zi(Ip.applications.getApplicationsData,{appIds:t}),a=yield zi(Ip.applications.getUsersOfApplications,{appIds:t}),i=n.map((e=>{var t;return $({},e,{userIds:null==(t=a.find((t=>t.appId===e.id)))?void 0:t.userIds})}));yield ji(za.setApplicationsState({accountApplications:i,fetching:!1,loading:!1}))}catch(e){yield ji(za.setApplicationsState({loading:!1,fetching:!1,error:jg(e)}))}}function*EA({userIds:e}){try{const t=yield zi(Ip.applications.getUsersApplicationsId,{userIds:e}),n=mA(t),a=yield zi(Ip.applications.getApplicationsData,{appIds:n});return e.reduce(((e,n)=>{var i,o;const r=null==(i=t.find((e=>e.userId==n)))?void 0:i.appIds;return e[n]=[...a.filter((e=>e.accessType===Ep.FREE_ACCESS)),...null!=(o=null==r?void 0:r.map((e=>a.find((t=>e===t.id)))))?o:[]],e}),{})}catch(e){yield ji(za.setApplicationsState({error:jg(e)}))}}function*IA({payload:e}){const{userId:t,appIds:n,callback:a}=e;try{var i,o;const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));yield zi(Ip.applications.assignUserToApplications,{userId:t,appIds:n,tenantId:e});const r=yield null!=(i=qi((({auth:e})=>{var t;return null==e||null==(t=e.applicationsState)?void 0:t.accountApplications})))?i:[],s=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.teamState)?void 0:t.users})),l=null!=(o=null==r?void 0:r.filter((e=>n.includes(e.id))))?o:[];null!=l&&l.length&&(yield ji(za.setTeamState({users:s.map((e=>{var n;return e.id===t?$({},e,{applications:[...null!=(n=e.applications)?n:[],...l]}):e}))}))),null==a||a(!0)}catch(e){yield ji(za.setApplicationsState({error:jg(e,bA)})),null==a||a(!1)}}function*kA({payload:e}){const{userId:t,appIds:n,callback:a}=e;try{var i;const e=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));yield zi(Ip.applications.unassignUserFromApplications,{userId:t,appIds:n,tenantId:e});const o=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.teamState)?void 0:t.users})),r=null==(i=o.find((e=>e.id===t)))?void 0:i.applications;null!=r&&r.length&&n.length&&(yield ji(za.setTeamState({users:o.map((e=>e.id===t?$({},e,{applications:r.filter((e=>!n.includes(e.id)))}):e))}))),null==a||a(!0)}catch(e){yield ji(za.setApplicationsState({error:jg(e,bA)})),null==a||a(!1)}}function*OA({appIds:e,user:t}){var n;const[a]=yield zi(zp,["multi-apps-admin-portal"]);if(!a)return;const i=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.applicationsState)?void 0:t.accountApplications})),o=null!=(n=null==i?void 0:i.filter((e=>e.accessType===Ep.FREE_ACCESS)))?n:[];if(null!=e&&e.length){const n=yield qi((({auth:e})=>{var t;return null==e||null==(t=e.user)?void 0:t.tenantId}));return yield zi(Ip.applications.assignUserToApplications,{userId:t.id,appIds:e,tenantId:n}),e.map((e=>{var t;return null!=(t=null==i?void 0:i.find((t=>t.id===e)))?t:[]})).concat(o)}return o}function*PA({shouldLoadApps:e,users:t}){const[n]=yield zi(zp,["multi-apps-admin-portal"]);if(!n||!e)return t;const a=t.map((e=>e.id)),i=yield zi(EA,{userIds:a});return i?t.map((e=>null!=i&&i[e.id]?$({},e,{applications:i[e.id]}):e)):t}function*_A(){yield Bo(za.loadUserApplications,AA),yield Bo(za.loadAccountApplications,TA),yield Bo(za.assignUserToApps,IA),yield Bo(za.unassignUserFromApps,kA)}const LA=["callback","appIds"],wA=["roles"],UA=["callback"],DA=["callback","profileImage"],RA=["callback"],CA=["callback","userId"],NA=["callback"],MA=["callback"],FA=["callback"],GA=["callback"],$A=["callback"],xA=["callback"],VA=["callback"],jA=["callback"],BA=["callback"],WA=["callback","profileImage"],zA=["callback"],KA=["callback"],HA=["callback"],qA=["callback"],JA=["callback"],YA=["callback"],XA=["callback"],QA=["callback"],ZA=()=>qi((e=>e.auth.teamState));function*eT(){try{const{groups:e}=yield zi(Ip.groups.getGroups,{_groupsRelations:hA.roles});return e}catch(e){return[]}}function*tT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s,shouldLoadApps:l}=e,c=yield ZA(),d=null!=(t=e.pageSize)?t:c.pageSize,u=null!=(n=e.pageOffset)?n:c.pageOffset,y=null!=(a=e.filter)?a:c.filterV2,f=null!=(i=e.sort)?i:c.sortV2,p=null!=(o=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?o:null==c?void 0:c.shouldShowSubTenantUsersIfReseller;yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({pageSize:d,pageOffset:u,filterV2:y,sortV2:f}));try{const[{items:t,_metadata:{totalPages:n,totalItems:a}},{items:i},{items:o},r]=yield Bi([zi(Ip.users.getUsersV2,$({},(null==y?void 0:y.length)&&{_filter:y},f&&{_sortBy:f},e.order&&{_order:e.order},{_offset:u,_limit:d,_includeSubTenants:p})),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions),zi(eT)]),c=t.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>r.filter((t=>t.id===e.id)))).flat();return $({},e,{groups:n})})),g=c.map((e=>$({},e,{roleIds:e.roles.map((e=>e.id))}))),S=yield zi(PA,{shouldLoadApps:l,users:g});yield ji(za.setTeamState({users:S,totalPages:n,totalItems:a,roles:i,permissions:o})),null==s||s(t)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:jg(e)})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*nT({payload:e}){var t,n,a,i;const{silentLoading:o,callback:r}=e,s=yield ZA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(a=e.filter)?a:s.filter,u=null!=(i=e.sort)?i:s.sort;yield ji(za.setTeamLoader({key:Xb.USERS,value:!o})),yield ji(za.setTeamState({pageSize:l,pageOffset:c,filter:d,sort:u}));try{const[{items:e,totalPages:t,totalItems:n},{items:a},{items:i}]=yield Bi([zi(Ip.teams.loadUsers,{pageSize:l,pageOffset:c,filter:d,sort:u}),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({users:e,totalPages:t,totalItems:n,roles:a,permissions:i})),null==r||r(e)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:e.message})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*aT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s}=e,l=yield ZA(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(a=e._filter)?a:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(i=e._sortBy)?i:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(o=e._order)?o:l.allUsersQueryParams._order)||"DESC"};yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:a},{items:i}]=yield Bi([zi(Ip.subTenants.loadAllUsers,$({},c)),zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:a,permissions:i})),null==s||s(e)}catch(e){yield ji(za.setTeamError({key:Xb.USERS,value:jg(e)})),yield ji(za.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield ji(za.setTeamLoader({key:Xb.USERS,value:!1}))}function*iT({payload:e}){yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:a}]=yield Bi([zi(Ip.teams.loadAvailableRoles),zi(Ip.teams.loadAvailablePermissions)]);yield ji(za.setTeamState({roles:n,permissions:a})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:a})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield ji(za.setTeamError({key:Xb.ROLES_AND_PERMISSIONS,value:jg(t)}))}yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0}))}function*oT({payload:e}){const{callback:t,appIds:n}=e,a=ii(e,LA),i=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield zi(Ip.teams.addUser,a),{roles:r}=e,s=$({},ii(e,wA),{roleIds:null!=(o=null==r?void 0:r.map((e=>e.id)))?o:[]}),l=yield zi(OA,{appIds:n,user:s});l&&(s.applications=l),null==t||t(s),yield ji(za.setTeamState({users:[s,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*rT({payload:e}){const{callback:t}=e,n=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},n.addUserDialogState,{loading:!0})}));const a=[],i=[],o=e.emails.map((t=>$({email:t,roleIds:e.roleIds},e.expirationInSeconds&&{expirationInSeconds:e.expirationInSeconds})));yield ji(za.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<o.length;e++){const t=o.at(e);try{yield zi(Ip.teams.addUser,t),a.push(t.email)}catch(e){i.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield ji(za.loadUsersV2(r)),yield ji(za.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:i,allowedEmails:a})}function*sT({payload:e}){const{callback:t}=e,n=ii(e,UA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:a,totalItems:i}}=yield zi(Ip.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield ji(za.setTeamState({allUsers:e,totalPages:a,totalItems:i,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*lT({payload:e}){const{callback:t}=e,n=ii(e,DA),{id:a}=n,i=yield ZA(),o=i.users.find((e=>e.id===n.id));yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:a||""})),yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})})),yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0}),users:i.users.map((e=>e.id===n.id?$({},e,n):e))}));try{var r;o.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield zi(Ip.teams.updateUser,n);null==t||t(e),yield ji(za.setTeamState({users:i.users.map((t=>t.id===e.id?$({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1}))}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)}),users:i.users.map((e=>e.id===n.id?$({},e,o):e))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*cT({payload:e}){const{callback:t}=e,n=ii(e,RA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})}));try{yield zi(Ip.teams.deleteUser,n),null==t||t(!0),yield ji(za.setTeamState({users:a.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*dT({payload:e}){const{callback:t,userId:n}=e,a=ii(e,CA),i=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.setUserRolesForSubTenants,n,a);const e=i.allUsers.find((e=>e.id===n));let o=[];e&&(o=e.tenants.map((e=>{var t;return $({},e,{roles:(null==(t=a.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>i.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield ji(za.setTeamState({allUsers:[...i.allUsers.filter((e=>e.id!==n)),...e?[$({},e,{tenants:o})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield ji(za.setTeamState({addUserDialogState:$({},i.addUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*uT({payload:e}){const{callback:t}=e,n=ii(e,NA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})}));try{yield zi(Ip.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield ji(za.setTeamState({allUsers:a.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!1,error:jg(e)})})),null==t||t(null,e)}}function*yT({payload:e}){const{callback:t}=e,n=ii(e,MA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield zi(Ip.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_ACTIVATE_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*fT({payload:e}){const{callback:t}=e,n=ii(e,FA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*pT({payload:e}){const{callback:t}=e,n=ii(e,GA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*gT({payload:e}){const{callback:t}=e,n=ii(e,$A);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email}));try{yield zi(Ip.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.RESEND_INVITATION_LINK,value:jg(e)})),null==t||t(null,e)}yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*ST(){yield ji(za.setTeamError({key:Xb.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield zi(Ip.teams.getInviteLinkConfiguration);yield ji(za.setTeamState({inviteTokenState:$({},e)}))}catch(e){yield ji(za.setTeamError({key:Xb.CONFIG_TOKEN_LINK,value:jg(e)}))}}function*vT(){yield ji(za.setTeamError({key:Xb.CONFIG_TEMPORARY_USERS,value:!1}));try{const e=yield zi(Ip.teams.getTemporaryUserConfiguration);yield ji(za.setTeamState({temporaryUsersConfig:e}))}catch(e){yield ji(za.setTeamError({key:Xb.CONFIG_TEMPORARY_USERS,value:jg(e)}))}}function*hT({payload:e}){const{callback:t}=e,n=ii(e,xA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{const e=yield zi(Ip.teams.updateUserExpirationTime,n);yield ji(za.setTeamState({users:a.users.map((t=>t.id===n.userId?$({},t,{temporaryExpirationDate:new Date(e.temporaryExpirationDate)}):t))})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*mT({payload:e}){const{callback:t}=e,n=ii(e,VA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{yield zi(Ip.teams.setPermanentUser,n.userId),yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:void 0}):e))})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*bT(){yield ji(za.setTeamError({key:Xb.GET_TOKEN_LINK,value:!1}));try{yield zi(ST);const e=yield zi(Ip.teams.getInviteUserLink),{inviteTokenState:t}=yield ZA();yield ji(za.setTeamState({inviteTokenState:$({},t,e)}))}catch(e){yield ji(za.setTeamError({key:Xb.GET_TOKEN_LINK,value:jg(e)}))}}function*AT({payload:{callback:e}}){yield ji(za.setTeamError({key:Xb.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield ZA();try{const n=yield zi(Ip.teams.createInviteUserLink,{expiresInMinutes:43200});yield ji(za.setTeamState({inviteTokenState:$({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield ji(za.setTeamError({key:Xb.CREATE_TOKEN_LINK,value:jg(t)}))}}function*TT({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:a}=yield ZA();yield ji(za.setTeamError({key:Xb.UPDATE_TOKEN_LINK,value:!1}));try{const i=yield zi(Ip.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield ji(za.setTeamState({inviteTokenState:$({},a,i)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield ji(za.setTeamError({key:Xb.UPDATE_TOKEN_LINK,value:jg(t)}))}}function*ET({payload:e}){const{callback:t}=null!=e?e:{};yield ji(za.setTeamError({key:Xb.DELETE_TOKEN_LINK,value:!1}));try{yield zi(Ip.teams.deleteInviteUserLink),yield ji(za.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield ji(za.setTeamError({key:Xb.DELETE_TOKEN_LINK,value:jg(e)})),null==t||t(!1,e)}}function*IT({payload:e}){yield ji(za.setTeamState({addUserDialogState:$({open:!0,loading:!1,error:!1},e)}))}function*kT({payload:e}){const t=yield ZA(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(za.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*OT({payload:e}){yield ji(za.setTeamState({deleteUserDialogState:$({open:!0,loading:!1,error:!1},e)}))}function*PT({payload:e}){const t=yield ZA(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield ji(za.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*_T(){yield jo(za.loadUsers,nT),yield jo(za.loadUsersV2,tT),yield jo(za.loadAllSubTenantsUsers,aT),yield jo(za.loadRoles,iT),yield Vo(za.addUser,oT),yield Vo(za.addUsersBulk,rT),yield Vo(za.addUserToSubTenants,sT),yield Vo(za.updateUser,lT),yield Vo(za.setUserRolesForSubTenants,dT),yield Vo(za.deleteUser,cT),yield Vo(za.deleteUserFromSubTenants,uT),yield Vo(za.resendActivationLink,yT),yield Vo(za.resendInvitationLink,fT),yield Vo(za.resendInvitationEmail,pT),yield Vo(za.resendInvitationLinkToAllSubTenants,gT),yield Vo(za.getTemporaryUsersConfig,vT),yield Vo(za.updateUserExpirationTime,hT),yield Vo(za.setUserAsPermanent,mT),yield Vo(za.getInvitationLink,bT),yield Vo(za.createInvitationLink,AT),yield Vo(za.updateInvitationLink,TT),yield Vo(za.deleteInvitationLink,ET),yield Vo(za.openAddUserDialog,IT),yield Vo(za.closeAddUserDialog,kT),yield Vo(za.openDeleteUserDialog,OT),yield Vo(za.closeDeleteUserDialog,PT)}function*LT({payload:e}){var t,n,a,i;const{silentLoading:o,callback:r}=e,s=yield ZA(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,d=null!=(a=e.filter)?a:s.filterV2,u=null!=(i=e.sort)?i:s.sortV2;yield ji(za.setTeamLoader({key:Xb.USERS,value:!o})),yield ji(za.setTeamState({pageSize:l,pageOffset:c,filterV2:d,sortV2:u})),yield It(),yield ji(za.setTeamState({users:fg,totalPages:2,totalItems:10,roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.USERS,value:!1})),null==r||r(fg)}function*wT({payload:e}){var t,n,a,i,o;const{silentLoading:r,callback:s}=e,l=yield ZA(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,d=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,u=null!=(a=e._filter)?a:l.allUsersQueryParams._filter,y=null!=(i=e._sortBy)?i:l.allUsersQueryParams._sortBy,f=null!=(o=e._order)?o:l.allUsersQueryParams._order;yield ji(za.setTeamLoader({key:Xb.USERS,value:!r})),yield ji(za.setTeamState({allUsersQueryParams:{_limit:c,_offset:d,_filter:u,_sortBy:y,_order:f}})),yield It(),yield ji(za.setTeamState({allUsers:gg,totalPages:2,totalItems:10,roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.USERS,value:!1})),null==s||s(gg)}function*UT({payload:e}){var t;yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0})),yield It(),yield ji(za.setTeamState({roles:og,permissions:sg})),yield ji(za.setTeamLoader({key:Xb.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:og,permissions:sg})}function*DT({payload:e}){const{callback:t}=e,n=ii(e,jA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})})),yield It();const i=new Date,o=$({},dg,{groups:[]},n,{id:`${SA()}`,temporaryExpirationDate:n.expirationInSeconds?new Date(i.setSeconds(i.getSeconds()+n.expirationInSeconds)):void 0});null==t||t(o),yield ji(za.setTeamState({users:[o,...a.users],addUserDialogState:{open:!1,loading:!1}}))}function*RT({payload:e}){const{callback:t}=e,n=ii(e,BA),a=yield ZA();yield ji(za.setTeamState({addUserDialogState:$({},a.addUserDialogState,{loading:!0})})),yield It();const i=$({},dg,n,{id:`${SA()}`});yield ji(za.setTeamState({users:[i,...a.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*CT({payload:e}){var t;const{callback:n}=e,a=ii(e,WA),{id:i}=a,o=yield ZA(),r=o.users.find((e=>e.id===a.id));yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:i||""})),yield ji(za.setTeamState({addUserDialogState:$({},o.addUserDialogState,{loading:!0})})),yield ji(za.setTeamState({addUserDialogState:$({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===a.id?$({},e,a):e))})),r.roleIds.length>0&&0===(null==(t=a.roleIds)?void 0:t.length)&&(a.roleIds=[""]),yield It();const s=$({},r,a);null==n||n(s),yield ji(za.setTeamState({users:o.users.map((e=>e.id===s.id?$({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER,value:!1}))}function*NT({payload:e}){const{callback:t}=e,n=ii(e,zA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})})),yield It(),null==t||t(!0),yield ji(za.setTeamState({users:a.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*MT({payload:e}){const{callback:t}=e,n=ii(e,KA),a=yield ZA();yield ji(za.setTeamState({deleteUserDialogState:$({},a.deleteUserDialogState,{loading:!0})})),yield It(),null==t||t(!0),yield ji(za.setTeamState({allUsers:a.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*FT({payload:e}){const{callback:t}=e,n=ii(e,HA);yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:n.userId})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_ACTIVATE_LINK,value:!1}))}function*GT({payload:e}){const{callback:t}=e,n=ii(e,qA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*$T({payload:e}){const{callback:t}=e,n=ii(e,JA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*xT({payload:e}){const{callback:t}=e,n=ii(e,YA);yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:n.email})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.RESEND_INVITATION_LINK,value:!1}))}function*VT({payload:e}){const{callback:t}=e,n=ii(e,XA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0}));const i=new Date;yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:n.expirationInSeconds?new Date(i.setSeconds(i.getSeconds()+n.expirationInSeconds)):void 0}):e))})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*jT({payload:e}){const{callback:t}=e,n=ii(e,QA),a=yield ZA();yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!0})),yield ji(za.setTeamState({users:a.users.map((e=>e.id===n.userId?$({},e,{temporaryExpirationDate:void 0}):e))})),yield It(),null==t||t(!0),yield ji(za.setTeamLoader({key:Xb.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*BT(){yield jo(za.loadUsersV2,LT),yield jo(za.loadAllSubTenantsUsers,wT),yield jo(za.loadRoles,UT),yield Vo(za.addUser,DT),yield Vo(za.addUserToSubTenants,RT),yield Vo(za.updateUser,CT),yield Vo(za.deleteUser,NT),yield Vo(za.updateUserExpirationTime,VT),yield Vo(za.setUserAsPermanent,jT),yield Vo(za.deleteUserFromSubTenants,MT),yield Vo(za.resendActivationLink,FT),yield Vo(za.resendInvitationLink,GT),yield Vo(za.resendInvitationEmail,$T),yield Vo(za.resendInvitationLinkToAllSubTenants,xT),yield Vo(za.openAddUserDialog,IT),yield Vo(za.closeAddUserDialog,kT),yield Vo(za.openDeleteUserDialog,OT),yield Vo(za.closeDeleteUserDialog,PT)}const WT=["authorizationUrl"],zT=["events","url"];function*KT(){try{yield ji(za.setSocialLoginsState({loading:!0}));const e=yield zi(Ip.auth.getSocialLoginProviders);yield ji(za.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield ji(za.setSocialLoginsState({error:jg(e),loading:!1,firstLoad:!1}))}}function*HT(){const e=yield qi((({auth:e})=>e.isAuthenticated));let t;return t=e?yield zi(Ip.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield zi(Ip.auth.getSocialLoginProvidersV2),t}function*qT(e){try{var t,n;const a=yield qi((e=>e.root.context));yield ji(za.setSocialLoginsState({loading:!0}));const i=yield zi(HT),{providers:o}=yield zi(Ip.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:i.map((e=>{let{authorizationUrl:t}=e,n=ii(e,WT);const i=Cr(a,null!=t?t:"");return $({},n,{authorizationUrl:t?`${i}${t}`:null})})),customSocialLoginsConfig:o,loading:!1,firstLoad:!1};yield ji(za.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var a,i;null==e||null==(a=e.payload)||null==(i=a.callback)||i.call(a,null,t),yield ji(za.setSocialLoginsState({error:jg(t),loading:!1,firstLoad:!1}))}}function*JT(e){let{payload:{events:t,url:n}}=e,a=ii(e.payload,zT);try{yield ji(za.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield zi(Ip.auth.loginViaSocialLogin,a);if(r){var i,o;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},d=$({},r,{socialProvider:a.provider,authenticationType:Dg.SOCIAL_LOGIN});null==t||null==(i=t.signUpComplete)||i.call(t,d),Wg(Bg.SIGNUP_COMPLETED,d);const u=$({},r,{origin:Ug.SOCIAL_LOGIN,name:c});null==t||null==(o=t.userVerified)||o.call(t,u),Wg(Bg.USER_VERIFIED,u)}s&&localStorage.setItem("userId",s),yield ji(za.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield qi((e=>e.auth));e?yield zi(Ih):yield zi(Oh)}(),localStorage.removeItem("register-quick-login"),yield ji(za.setSocialLoginsState({loading:!1}))}catch(e){yield ji(za.setSocialLoginsState({loading:!1,error:jg(e,"Failed to authenticate"),firstLoad:!1}))}}function*YT({payload:e}){yield ji(za.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*XT(){yield Bo(za.loadSocialLoginsConfiguration,KT),yield Vo(za.loadSocialLoginsConfigurationV2,qT),yield Bo(za.loginViaSocialLogin,JT),yield jo(za.setSocialLoginError,YT)}let QT,ZT;function*eE({payload:e}){const{description:t,expires:n,callback:a}=e,{apiTokensDataUser:i}=yield qi((e=>e.auth.apiTokensState)),{policy:o}=yield qi((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==o?void 0:o.machineToMachineAuthStrategy)===Pa.AccessToken;try{let e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));let o=null;n&&(o=1440*n),e=r?yield zi(Ip.auth.createUserAccessToken,{description:t,expiresInMinutes:o}):yield zi(Ip.auth.updateUserApiTokensData,{description:t,expiresInMinutes:o}),yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataUser:[$({},e,{type:r?Pa.AccessToken:Pa.ClientCredentials}),...i],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null)}catch(e){yield ji(za.setApiTokensError({key:QT.ADD_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null,e)}}function*tE({payload:e}){const{description:t,roleIds:n,expires:a,callback:i}=e,{apiTokensDataTenant:o}=yield qi((e=>e.auth.apiTokensState)),{policy:r}=yield qi((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Pa.AccessToken;try{let e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));let r=null;a&&(r=1440*a),e=s?yield zi(Ip.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield zi(Ip.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataTenant:[$({},e,{type:s?Pa.AccessToken:Pa.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield ji(za.setApiTokensError({key:QT.ADD_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*nE({payload:e}){const{apiTokensDataUser:t}=yield qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),n?(yield zi(Ip.auth.deleteUserAccessToken,{id:e}),yield ji(za.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield zi(Ip.auth.deleteUserApiToken,{tokenId:e}),yield ji(za.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(za.setApiTokensError({key:QT.DELETE_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}}function*aE({payload:e}){const{apiTokensDataTenant:t}=yield qi((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let a=t;try{yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),n?(yield zi(Ip.auth.deleteTenantAccessToken,{id:e}),a=t.filter((t=>t.id!==e))):(yield zi(Ip.auth.deleteTenantApiToken,{tokenId:e}),a=t.filter((t=>t.clientId!==e))),yield ji(za.setApiTokensState({apiTokensDataTenant:a,deleteTokenDialog:{open:!1,id:e}})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}catch(e){yield ji(za.setApiTokensError({key:QT.DELETE_API_TOKEN,value:jg(e)})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}}function*iE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],a=[]]=yield Bi([zi(Ip.auth.getUserApiTokensData),zi(Ip.auth.getTenantApiTokensData)]);yield ji(za.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:a})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*oE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t,n,a,i;const o=yield null!=(t=zi(Ip.auth.getUserApiTokensData))?t:[],r=(null!=(a=(yield null!=(n=zi(Ip.auth.getUserAccessTokensData))?n:[]).accessTokens)?a:[]).map((e=>$({},e,{type:Pa.AccessToken}))).concat(o.map((e=>$({},e,{type:Pa.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ji(za.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var o;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*rE({payload:e}){null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));try{var t,n,a,i;const o=yield null!=(t=zi(Ip.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=zi(Ip.auth.getTenantAccessTokensData))?n:[],s=(null!=(a=null==r?void 0:r.accessTokens)?a:[]).map((e=>$({},e,{type:Pa.AccessToken}))).concat(o.map((e=>$({},e,{type:Pa.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield ji(za.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(i=e.callback)||i.call(e,!0)}catch(t){var o;yield ji(za.setApiTokensError({key:QT.LOAD_API_TOKENS,value:jg(t)})),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,null,t)}}function*sE(){yield Bo(za.loadApiTokens,iE),yield Bo(za.loadUserApiTokens,oE),yield Bo(za.loadTenantApiTokens,rE),yield Vo(za.addUserApiToken,eE),yield Vo(za.addTenantApiToken,tE),yield jo(za.deleteTenantApiToken,aE),yield jo(za.deleteUserApiToken,nE)}function*lE({payload:e}){const{description:t,roleIds:n,callback:a}=e;yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:i}=yield qi((e=>e.auth.apiTokensState)),o=$({},Hp,{description:t,roleIds:n,clientId:`CLIENT_ID_${SA()}`});yield ji(za.setApiTokensState({showAddTokenDialog:!1})),yield Ji(200),yield ji(za.setApiTokensState({apiTokensDataTenant:[...i,o],successDialog:{open:!0,secret:o.secret,clientId:o.clientId}})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.ADD_API_TOKEN,value:!1})),null==a||a(null)}function*cE({payload:e}){yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!0})),yield Ji(200);const t=[Hp];yield ji(za.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield ji(za.setApiTokensLoader({key:QT.DELETE_API_TOKEN,value:!1}))}function*dE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Kp],a=[Hp];yield ji(za.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:a})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*uE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Kp];yield ji(za.setApiTokensState({apiTokensDataUser:n})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*yE({payload:e}){var t;null!=e&&e.silentLoading||(yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!0})));const n=[Hp];yield ji(za.setApiTokensState({apiTokensDataTenant:n})),yield Ji(200),yield ji(za.setApiTokensLoader({key:QT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*fE(){yield Bo(za.loadApiTokens,dE),yield Bo(za.loadUserApiTokens,uE),yield Bo(za.loadTenantApiTokens,yE),yield Vo(za.addTenantApiToken,lE),yield jo(za.deleteTenantApiToken,cE)}function*pE({payload:e}){try{var t;yield ji(za.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=yield zi(Ip.accountSettings.updateSettings,$({address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l},e));yield ji(za.setAccountSettingsState($({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield ji(za.setAccountSettingsState({loading:!1,error:jg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*gE({payload:e}){yield ji(za.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield zi(Ip.accountSettings.getSettings);yield ji(za.setAccountSettingsState($({},e,{loading:!1})))}catch(e){yield ji(za.setAccountSettingsState({loading:!1,error:jg(e)}))}}function*SE(){yield Bo(za.saveAccountSettings,pE),yield Bo(za.loadAccountSettings,gE)}function*vE({payload:e}){var t;yield ji(za.setAccountSettingsState({loading:!0})),yield It();const{accountSettingsState:n}=yield qi((e=>e.auth)),{address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l}=n,c=$({address:a,timezone:i,dateFormat:o,timeFormat:r,currency:s,logo:l},e);yield ji(za.setAccountSettingsState($({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*hE({payload:e}){yield ji(za.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield It(),yield ji(za.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*mE(){yield Bo(za.saveAccountSettings,vE),yield Bo(za.loadAccountSettings,hE)}function*bE({payload:{tenantId:e,callback:t}}){yield ji(za.setState({isLoading:!0}));try{yield zi(Ip.tenants.switchTenant,{tenantId:e}),yield zi(Th),(null==t?void 0:t(!0))||(yield ji(za.setState({isLoading:!1})))}catch(e){yield ji(za.setState({isLoading:!1})),null==t||t(!1,e)}}function*AE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(ss());yield ji(za.setTenantsState({tenants:n.tenants,activeTenant:n.activeTenant,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 ji(za.setTenantsState({loading:!1}))}}function*TE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(Ip.tenants.getSubTenants);yield ji(za.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*EE({payload:e}){yield ji(za.setTenantsState({loading:!0}));try{var t;const n=yield zi(Ip.tenants.getSubTenantsAsTree);yield ji(za.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield ji(za.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*IE(){yield Vo(za.loadTenants,AE),yield Vo(za.loadSubTenants,TE),yield Vo(za.switchTenant,bE),yield Vo(za.loadSubTenantsTree,EE)}function*kE(){yield ji(za.setTenantsState({loading:!0})),yield It(),yield ji(za.setTenantsState({tenants:Sg,activeTenant:Sg[0],loading:!1}))}function*OE(){yield Vo(za.loadTenants,kE)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(QT||(QT={})),function(e){e.EDIT_ROLE_DIALOG="editRoleDialog",e.DELETE_ROLE_DIALOG="deleteRoleDialog",e.LOAD_ROLES="loadRoles",e.ADD_ROLE="addRole",e.MANAGE_PERMISSIONS="managePermissions"}(ZT||(ZT={}));const PE=["callback"],_E=["callback"],LE=["callback"],wE=["callback"],UE=["callback"];function*DE({payload:e}){var t;const n=ZT.LOAD_ROLES;yield ji(za.setRolesStateLoader({key:n,value:!(null!=(t=null==e?void 0:e.silentLoading)&&t)}));try{const e=yield Bi([zi(Ip.roles.getRoles),zi(Ip.roles.getPermissions),zi(Ip.roles.getPermissionCategories)]),[t,a,i]=e,{selectedRole:o}=yield qi((e=>e.auth.rolesState)),r=null==t?void 0:t.find((({id:e})=>(null==o?void 0:o.id)===e));yield ji(za.setRolesState({roles:t,permissions:a,permissionCategories:i,selectedRole:r}))}catch(e){yield ji(za.setRolesStateError({key:n,value:jg(e)}))}finally{yield ji(za.setRolesStateLoader({key:n,value:!1}))}}function*RE(e){let{payload:{callback:t}}=e,n=ii(e.payload,PE);const a=ZT.ADD_ROLE;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.addRole,n),i=yield zi(Ip.roles.getRoles);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),yield ji(za.setRolesState({roles:i})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*CE(e){let{payload:{callback:t}}=e,n=ii(e.payload,_E);const a=ZT.ADD_ROLE;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.addRoleV2,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*NE(e){let{payload:{callback:t}}=e,n=ii(e.payload,LE);const a=ZT.DELETE_ROLE_DIALOG;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{yield zi(Ip.roles.deleteRole,n),yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(!0)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(!1,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*ME(e){let{payload:{callback:t}}=e,n=ii(e.payload,wE);const a=ZT.EDIT_ROLE_DIALOG;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.updateRole,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*FE(e){let{payload:{callback:t}}=e,n=ii(e.payload,UE);const a=ZT.MANAGE_PERMISSIONS;yield ji(za.setRolesStateLoader({key:a,value:!0}));try{const e=yield zi(Ip.roles.attachPermissionsToRole,n);yield ji(za.loadRolesAndPermissions({silentLoading:!0})),null==t||t(e)}catch(e){yield ji(za.setRolesStateError({key:a,value:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setRolesStateLoader({key:a,value:!1}))}}function*GE(){yield Bo(za.loadRolesAndPermissions,DE),yield Vo(za.addRole,RE),yield Vo(za.addRoleV2,CE),yield Vo(za.deleteRole,NE),yield Vo(za.updateRole,ME),yield Vo(za.attachPermissionsToRole,FE)}function*$E({payload:e}){var t;const n=ZT.LOAD_ROLES;yield ji(za.setRolesStateLoader({key:n,value:!(null!=(t=null==e?void 0:e.silentLoading)&&t)}));try{yield ji(za.setRolesState({roles:qp,permissionCategories:wg,permissions:Lg,selectedRole:qp[2]}))}catch(e){yield ji(za.setRolesStateError({key:n,value:jg(e)}))}finally{yield ji(za.setRolesStateLoader({key:n,value:!1}))}}function*xE(){yield Bo(za.loadRolesAndPermissions,$E)}const VE=["callback"],jE=["callback"],BE=["callback"];function*WE(e){let{payload:{callback:t}}=e,n=ii(e.payload,VE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const e=yield zi(Ip.auth.resetPhoneNumber,n);yield ji(za.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:en.VerifyResetPhoneNumber})),yield ji(za.setLoginState({email:n.email}))}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*zE(e){let{payload:{callback:t}}=e,n=ii(e.payload,jE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const e=yield zi(Ip.auth.verifyResetPhoneNumber,n);yield ji(za.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:en.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*KE(e){let{payload:{callback:t}}=e,n=ii(e.payload,BE);yield ji(za.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:a}=yield qi((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield zi(Ip.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield ji(za.setLoginState({step:Lt.loginWithSmsOtc})),yield ji(za.passwordlessPreLogin({type:Oa.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(a.loginUrl),yield ji(za.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setResetPhoneNumberState({loading:!1,error:jg(e)})),null==t||t(null,e)}}function*HE(){yield Bo(za.resetPhoneNumber,WE),yield Bo(za.verifyResetPhoneNumber,zE),yield Bo(za.changePhoneNumber,KE)}function*qE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCurrentUserSessions);yield ji(za.setSessionsState({sessions:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*JE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getCurrentUserSession);yield ji(za.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*YE({payload:{id:e}}){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.deleteSessionForUser,e),yield ji(za.loadUserSessions())}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*XE({payload:{callback:e,userId:t}}){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.revokeSessionsForUser,t),yield ji(za.setSessionsState({loading:!1})),null==e||e(!0)}catch(t){yield ji(za.setSessionsState({error:jg(t),loading:!1})),null==e||e(!1)}}function*QE(){yield ji(za.setSessionsState({loading:!0,error:null}));try{yield zi(Ip.auth.deleteAllSessionsForUser),yield ji(za.loadUserSessions())}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*ZE(){yield jo(za.loadUserSessions,qE),yield jo(za.deleteUserSession,YE),yield jo(za.deleteAllUserSessions,QE),yield jo(za.loadCurrentUserSession,JE),yield Vo(za.revokeUserSessions,XE)}function*eI(){yield ji(za.setSessionsState({loading:!0,error:null})),yield ji(za.setSessionsState({sessions:vg,loading:!1}))}function*tI({payload:{id:e}}){yield ji(za.setSessionsState({loading:!0,error:null}));const t=(yield qi((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield ji(za.setSessionsState({sessions:t,loading:!1}))}function*nI(){yield ji(za.setSessionsState({loading:!0,error:null}));const e=vg.filter((e=>e.current));yield ji(za.setSessionsState({sessions:e,loading:!1}))}function*aI(){yield jo(za.loadUserSessions,eI),yield jo(za.deleteUserSession,tI),yield jo(za.deleteAllUserSessions,nI)}const iI=["callback"],oI=["callback"];function*rI(){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getSessionConfigurations);yield ji(za.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield ji(za.setSessionsState({error:e,loading:!1}))}}function*sI({payload:e}){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=ii(e,iI);yield zi(Ip.auth.createOrUpdateSessionConfigrations,n),yield ji(za.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield ji(za.setSessionsPolicyState({error:e,loading:!1}))}}function*lI(){yield Bo(za.loadSessionsPolicy,rI),yield jo(za.createOrUpdateSessionsPolicy,tS(sI))}function*cI(){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));const e=yield qi((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:hg}));yield ji(za.setSessionsPolicyState($({},e,{loading:!1})))}function*dI({payload:e}){yield ji(za.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=ii(e,oI);null==t||t(!0),yield ji(za.setSessionsPolicyState({configurations:n,loading:!1}))}function*uI(){yield Bo(za.loadSessionsPolicy,cI),yield jo(za.createOrUpdateSessionsPolicy,dI)}const yI=["callback"],fI=["callback"],pI=["callback"],gI=["callback"],SI=["callback"],vI=["callback"],hI=["callback"],mI=["callback"],bI=()=>qi((e=>e.auth.restrictionsState.ipRestrictions)),AI=()=>qi((e=>e.auth.restrictionsState.emailDomainRestrictions));function*TI(){yield ji(za.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield zi(Ip.auth.getDomainRestrictionsConfig),t=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(za.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield ji(za.setEmailDomainRestrictionsState({error:jg(e),loading:!1}))}}function*EI(e){let{payload:{callback:t}}=e,n=ii(e.payload,yI);yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));const a=yield AI();try{var i;yield zi(Ip.auth.createDomainRestriction,n);const e=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=a.data)?void 0:t.config.listType)}));yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(i=a.data)?void 0:i.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*II(e){let{payload:{callback:t}}=e,n=ii(e.payload,fI);yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield zi(Ip.auth.updateDomainRestrictionConfig,n),a=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield ji(za.setEmailDomainRestrictionsState({data:{config:e,restrictions:a},saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*kI({payload:{id:e}}){yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield AI();try{var n;yield zi(Ip.auth.deleteDomainRestriction,e);const a=(yield zi(Ip.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Kn.ALLOW},restrictions:a},saving:!1}))}catch(e){yield ji(za.setEmailDomainRestrictionsState({saving:!1,error:jg(e)}))}}const OI=e=>{var t,n,a;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Kn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(a=null==e?void 0:e._offset)?a:0}};function*PI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bI(),t=yield zi(Ip.auth.getIPRestrictionsConfig),n=OI({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:a,_metadata:{totalPages:i}}=yield zi(Ip.auth.getIPRestrictions,n);yield ji(za.setIpRestrictionsState({data:{restrictions:a,config:t},totalPages:i,pagination:n,loading:!1}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e),loading:!1}))}}function*_I(){try{const{valid:e}=yield zi(Ip.auth.testCurrentIpInAllowList);yield ji(za.setIpRestrictionsState({userIpValid:e}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e)}))}}function*LI({payload:{callback:e}}){yield ji(za.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield qi((e=>e.auth.userIp));yield Bi([zi(Ip.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Kn.ALLOW}),zi(Ip.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield bI(),a=OI(n.pagination),{items:i,_metadata:{totalPages:o}}=yield zi(Ip.auth.getIPRestrictions,a);yield ji(za.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Kn.ALLOW},restrictions:i},userIpValid:!0,pagination:a,totalPages:o,saving:!1})),null==e||e(!0)}catch(t){yield ji(za.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*wI(e){let{payload:{callback:t}}=e,n=ii(e.payload,pI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const a=yield bI();try{var i,o;yield zi(Ip.auth.createIPRestriction,n);const e=yield bI(),r=OI(e.pagination),{items:s,_metadata:{totalPages:l}}=yield zi(Ip.auth.getIPRestrictions,r);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:null!=(i=null==(o=a.data)?void 0:o.config)?i:{isActive:!1,strategy:Kn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*UI(e){let{payload:{callback:t}}=e,n=ii(e.payload,gI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));try{yield zi(Ip.auth.updateIPRestrictionConfig,n);const e=yield bI(),a=yield zi(Ip.auth.getIPRestrictionsConfig),i=OI($({},e.pagination,{_filter:a.strategy})),{items:o,_metadata:{totalPages:r}}=yield zi(Ip.auth.getIPRestrictions,i);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:a,restrictions:o},pagination:i,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*DI({payload:{id:e,callback:t}}){yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const n=yield bI();try{var a;yield zi(Ip.auth.deleteIPRestriction,e);const i=yield bI(),o=OI(i.pagination),{items:r,_metadata:{totalPages:s}}=yield zi(Ip.auth.getIPRestrictions,o);yield _I(),yield ji(za.setIpRestrictionsState({data:{config:(null==(a=n.data)?void 0:a.config)||{isActive:!1,strategy:Kn.ALLOW},restrictions:r},pagination:o,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield ji(za.setIpRestrictionsState({saving:!1,error:jg(e)})),null==t||t(null,e)}}function*RI(){yield Bo(za.loadIpRestrictions,tS(PI)),yield Bo(za.loadEmailDomainRestrictions,tS(TI)),yield Vo(za.saveIpRestriction,tS(wI)),yield Vo(za.saveIpRestrictionsConfig,tS(UI)),yield Vo(za.deleteIpRestriction,tS(DI)),yield Vo(za.checkIfUserIpValid,tS(_I)),yield Vo(za.addCurrentUserIpAndActivate,tS(LI)),yield Vo(za.saveEmailDomainRestriction,tS(EI)),yield Vo(za.saveEmailDomainRestrictionsConfig,tS(II)),yield Vo(za.deleteEmailDomainRestriction,tS(kI))}function*CI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null})),yield ji(za.setIpRestrictionsState({data:{restrictions:bg.filter((e=>e.strategy===mg.strategy)),config:mg},totalPages:1,pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*NI(){yield ji(za.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield bI(),t=bg[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield ji(za.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield ji(za.setIpRestrictionsState({error:jg(e),loading:!1}))}}function*MI(e){var t,n,a;let{payload:{callback:i}}=e,o=ii(e.payload,SI);yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const r=yield bI(),s=r.data.restrictions.filter((e=>e.ip!==o.ip));yield ji(za.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Kn.ALLOW},restrictions:[...s,$({},o,{createdAt:new Date,updatedAt:new Date,id:SA(),isActive:null==(a=o.isActive)||a,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},saving:!1})),null==i||i(!0)}function*FI(e){var t,n,a;let{payload:{callback:i}}=e,o=ii(e.payload,vI);const r=yield bI();yield ji(za.setIpRestrictionsState({saving:!0,error:null})),yield ji(za.setIpRestrictionsState({data:{config:$({},null==(t=r.data)?void 0:t.config,o),restrictions:null!=(n=null==(a=r.data)?void 0:a.restrictions)?n:[]},pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield ji(za.setIpRestrictionsState({saving:!1,error:null})),null==i||i(!0)}function*GI({payload:{id:e,callback:t}}){var n;yield ji(za.setIpRestrictionsState({saving:!0,error:null}));const a=yield bI();yield ji(za.setIpRestrictionsState({data:{config:(null==(n=a.data)?void 0:n.config)||{isActive:!1,strategy:Kn.ALLOW},restrictions:a.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Kn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*$I(){yield ji(za.setEmailDomainRestrictionsState({loading:!0,error:null})),yield ji(za.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Kn.ALLOW}],config:{active:!0,listType:Kn.ALLOW,blockPublicDomains:!1}}}))}function*xI(e){var t,n;let{payload:{callback:a}}=e,i=ii(e.payload,hI);const o=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),null==a||a(!0),yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(t=o.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:i.type},restrictions:[...(null==(n=o.data)?void 0:n.restrictions)||[],$({},i,{id:Date.now().toString()})]},saving:!1}))}function*VI(e){var t;let{payload:{callback:n}}=e,a=ii(e.payload,mI);const i=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),null==n||n(!0),yield ji(za.setEmailDomainRestrictionsState({data:{config:{active:a.active,blockPublicDomains:a.blockPublicDomains||!1,listType:a.type||Kn.ALLOW},restrictions:[...(null==(t=i.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*jI({payload:{id:e}}){var t,n;const a=yield AI();yield ji(za.setEmailDomainRestrictionsState({saving:!0,error:null})),yield It(),yield ji(za.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Kn.ALLOW},restrictions:((null==(n=a.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*BI(){yield Bo(za.loadIpRestrictions,CI),yield Bo(za.loadEmailDomainRestrictions,$I),yield Vo(za.saveIpRestriction,MI),yield Vo(za.saveIpRestrictionsConfig,FI),yield Vo(za.deleteIpRestriction,GI),yield Vo(za.checkIfUserIpValid,NI),yield Vo(za.saveEmailDomainRestriction,xI),yield Vo(za.saveEmailDomainRestrictionsConfig,VI),yield Vo(za.deleteEmailDomainRestriction,jI)}const WI=["callback"],zI=["id"];function*KI(e){const{count:t}=yield zi(Ip.directory.countConfigurationUsers,e.id);return $({},e,{count:t})}function*HI(){yield ji(za.setProvisioningState({loading:!0,error:null}));try{const e=yield zi(Ip.directory.getConfigs),t=yield Bi(e.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:t,loading:!1}))}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*qI(e){let{payload:{callback:t}}=e,n=ii(e.payload,WI);yield ji(za.setProvisioningState({loading:!0,error:null}));try{const e=yield zi(Ip.directory.createConfiguration,n),a=yield zi(Ip.directory.getConfigs),i=yield Bi(a.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:i,loading:!1})),null==t||t(e)}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*JI(e){let{payload:{id:t}}=e,n=ii(e.payload,zI);yield ji(za.setProvisioningState({loading:!0,error:null}));try{yield zi(Ip.directory.updateConfiguration,t,n);const e=yield zi(Ip.directory.getConfigs),a=yield Bi(e.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:a,loading:!1}))}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1}))}}function*YI({payload:{id:e,callback:t}}){yield ji(za.setProvisioningState({loading:!0,error:null}));try{yield zi(Ip.directory.deleteConfiguration,e);const n=yield zi(Ip.directory.getConfigs),a=yield Bi(n.map((e=>KI(e))));yield ji(za.setProvisioningState({connections:a,loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setProvisioningState({error:jg(e),loading:!1})),null==t||t(!1,e)}}function*XI(){yield Bo(za.loadProvisionConnections,HI),yield Vo(za.createProvisionConnection,qI),yield Vo(za.deleteProvisionConnection,YI),yield Vo(za.updateProvisionConnection,JI)}const QI=["callback","events"];function*ZI(e){let{payload:{callback:t}}=e,n=ii(e.payload,QI);yield ji(za.setImpersonateState({loading:!0}));try{yield zi(Ip.impersonate.impersonate,n),yield ji(za.setImpersonateState({step:$a.success})),yield Ji(1e3),yield _v({preventRedirectUrlOriginCleaning:!0}),yield ji(za.resetImpersonateState()),null==t||t(!0)}catch(e){yield ji(za.setImpersonateState({loading:!1,error:jg(e)}))}}function*ek(){yield Bo(za.impersonate,ZI)}function*tk({payload:e}){const{callback:t,deviceId:n}=e;yield ji(za.setPasskeysState({loading:!0}));try{yield zi(Ip.auth.deleteWebAuthnDevice,n);const{devices:e}=yield qi((e=>e.auth.passkeysState)),a=e.filter((e=>e.id!==n));yield ji(za.setPasskeysState({devices:a,loading:!1})),null==t||t(!0)}catch(e){yield ji(za.setPasskeysState({loading:!1,error:jg(e,null)})),null==t||t(null,e)}}function*nk(){yield ji(za.setPasskeysState({loading:!0}));try{const{devices:e}=yield zi(Ip.auth.getWebAuthnDevices);yield ji(za.setPasskeysState({devices:e,loading:!1}))}catch(e){yield ji(za.setPasskeysState({loading:!1,error:jg(e,null)}))}}function*ak(){yield Vo(za.loadWebAuthnDevices,nk),yield Vo(za.deleteWebAuthnDevice,tk)}const ik=["roleIds","userIds"],ok=()=>qi((e=>e.auth.groupsState));function*rk({payload:e}){const t=vA.GET_TEAM_USERS;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield zi(Ip.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield ji(za.setGroupsState({teamUsers:n}))}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*sk({payload:e}){const t=vA.GET_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield zi(Ip.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:hA.rolesAndUsers});yield ji(za.setGroupsState({selectedGroup:n}))}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*lk(){const e=vA.GET_GROUPS,t=yield ok();yield ji(za.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield zi(Ip.groups.getGroups,{_groupsRelations:hA.rolesAndUsers});yield ji(za.setGroupsState($({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield ji(za.setUsersGroupsError({key:e,value:jg(t)}))}finally{yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}}function*ck({payload:e}){const t=vA.CREATE_GROUP,{roleIds:n,userIds:a}=e,i=ii(e,ik);yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var o;const r=yield zi(Ip.groups.createGroup,$({name:i.name},!!i.description&&{description:i.description},{color:i.color}));null!=a&&a.length&&(yield ji(za.addUsersToGroup({groupId:r.id,userIds:a}))),null!=n&&n.length&&(yield ji(za.addRolesToGroup({groupId:r.id,roleIds:n}))),yield ji(za.loadGroups()),null==e||null==(o=e.callback)||o.call(e,!0)}catch(n){var r;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*dk({payload:e}){const t=vA.UPDATE_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.updateGroup,e),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*uk({payload:e}){const t=vA.DELETE_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteGroup,e.groupId),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1,n)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*yk({payload:e}){const t=vA.ADD_ROLES_TO_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*fk({payload:e}){const t=vA.DELETE_ROLES_FROM_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*pk({payload:e}){const t=vA.ADD_USERS_TO_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;null==e||null==(a=e.callback)||a.call(e,!1),yield ji(za.setUsersGroupsError({key:t,value:jg(n)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*gk({payload:e}){const t=vA.DELETE_USERS_FROM_GROUP;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield zi(Ip.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield ji(za.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var a;yield ji(za.setUsersGroupsError({key:t,value:jg(n)})),null==e||null==(a=e.callback)||a.call(e,!1)}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*Sk(){const e=vA.GET_GROUP_CONFIGURATION;yield ji(za.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield zi(Ip.groups.getGroupConfiguration);yield ji(za.setGroupsState({groupsConfiguration:t}))}catch(t){yield ji(za.setUsersGroupsError({key:e,value:jg(t)}))}finally{yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}}function*vk({payload:e}){const t=vA.UPDATE_GROUP_CONFIGURATION;yield ji(za.setUsersGroupsLoader({key:t,value:!0}));try{yield zi(Ip.groups.updateGroupConfiguration,e),yield ji(za.getGroupConfiguration())}catch(e){yield ji(za.setUsersGroupsError({key:t,value:jg(e)}))}finally{yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){yield jo(za.loadGroups,lk),yield jo(za.getGroupById,sk),yield jo(za.createGroup,ck),yield jo(za.updateGroup,dk),yield jo(za.deleteGroup,uk),yield jo(za.addRolesToGroup,yk),yield jo(za.deleteRolesFromGroup,fk),yield jo(za.addUsersToGroup,pk),yield jo(za.deleteUsersFromGroup,gk),yield jo(za.getGroupConfiguration,Sk),yield jo(za.updateGroupConfiguration,vk),yield jo(za.getTeamUsers,rk)}function*mk(){const e=vA.GET_GROUPS;yield ji(za.setUsersGroupsLoader({key:e,value:!0}));const t=Eg;yield ji(za.setGroupsState({groups:t})),yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}function*bk({payload:e}){var t;const n=vA.CREATE_GROUP,{groups:a}=yield ok();yield ji(za.setUsersGroupsLoader({key:n,value:!0})),yield ji(za.setGroupsState({groups:[$({},e,{id:`${e.name}ID`,managedBy:vp.FRONTEGG}),...null!=a?a:[]]})),yield Ji(500),null==e||null==(t=e.callback)||t.call(e,!0),yield ji(za.setUsersGroupsLoader({key:n,value:!1}))}function*Ak({payload:e}){var t,n,a,i,o;const r=vA.UPDATE_GROUP,s=yield ok();yield ji(za.setUsersGroupsLoader({key:r,value:!0})),yield ji(za.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:vp.FRONTEGG}):t})),selectedGroup:$({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(a=null==e?void 0:e.color)?a:"",description:null!=(i=null==e?void 0:e.description)?i:""})})),yield Ji(500),null==e||null==(o=e.callback)||o.call(e,!0),yield ji(za.setUsersGroupsLoader({key:r,value:!1}))}function*Tk({payload:e}){var t,n;const a=vA.DELETE_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ek({payload:e}){var t,n;const a=vA.ADD_ROLES_TO_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ik({payload:e}){var t,n;const a=vA.DELETE_ROLES_FROM_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*kk({payload:e}){var t,n;const a=vA.ADD_USERS_TO_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Ok({payload:e}){var t,n;const a=vA.DELETE_USERS_FROM_GROUP,i=yield ok();yield ji(za.setUsersGroupsLoader({key:a,value:!0})),yield ji(za.setGroupsState({groups:null==i||null==(t=i.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?$({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ji(500),null==e||null==(n=e.callback)||n.call(e,!0),yield ji(za.setUsersGroupsLoader({key:a,value:!1}))}function*Pk(){const e=vA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield ok();yield ji(za.setUsersGroupsLoader({key:e,value:!0})),t&&(yield ji(za.setGroupsState({groupsConfiguration:$({},t)}))),yield ji(za.setUsersGroupsLoader({key:e,value:!1}))}function*_k({payload:e}){const t=vA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield ok();yield ji(za.setUsersGroupsLoader({key:t,value:!0})),n&&(yield ji(za.setGroupsState({groupsConfiguration:$({},n,e)}))),yield ji(za.setUsersGroupsLoader({key:t,value:!1}))}function*Lk(){yield jo(za.loadGroups,mk),yield jo(za.createGroup,bk),yield jo(za.updateGroup,Ak),yield jo(za.deleteGroup,Tk),yield jo(za.addRolesToGroup,Ek),yield jo(za.deleteRolesFromGroup,Ik),yield jo(za.addUsersToGroup,kk),yield jo(za.deleteUsersFromGroup,Ok),yield jo(za.getGroupConfiguration,Pk),yield jo(za.updateGroupConfiguration,_k)}let wk;!function(e){e.GET_ACCOUNTS="GET_ACCOUNTS",e.SEARCH_ACCOUNTS="SEARCH_ACCOUNTS",e.SET_ROOT_ACCOUNT_DATA="SET_ROOT_ACCOUNT_DATA",e.SET_SELECTED_SUB_ACCOUNT_DATA="SET_SELECTED_SUB_ACCOUNT_DATA",e.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT="LOAD_NUMBER_OF_USERS_FOR_ACCOUNT",e.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER="UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER",e.CREATE_SUB_ACCOUNT="CREATE_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT="UPDATE_SUB_ACCOUNT",e.DELETE_SUB_ACCOUNT="DELETE_SUB_ACCOUNT",e.GET_ACCOUNT_USERS="GET_ACCOUNT_USERS",e.ADD_USERS_TO_ACCOUNT="ADD_USERS_TO_ACCOUNT",e.DELETE_USERS_FROM_ACCOUNT="DELETE_USERS_FROM_ACCOUNT",e.SET_USER_ROLES_FOR_SUB_ACCOUNT="SET_USER_ROLES_FOR_SUB_ACCOUNT",e.UPDATE_SUB_ACCOUNT_SETTINGS="UPDATE_SUB_ACCOUNT_SETTINGS",e.UPDATE_SUB_ACCOUNT_MANAGEMENT="UPDATE_SUB_ACCOUNT_MANAGEMENT",e.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(wk||(wk={}));const Uk=(e,t,n)=>{var a,i;return e.tenantId===t?$({},e,{name:n}):$({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Uk(e,t,n))))?a:[]})};function Dk(e,t){var n;return $({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Dk(e,t))):[]})}function Rk(e,t,n){var a,i;if(e.tenantId===t){var o;const t=[...null!=(o=null==e?void 0:e.children)?o:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return $({},e,{children:t})}return $({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Rk(e,t,n))))?a:[]})}const Ck=({items:e},t)=>e.map((e=>{var n,a;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(a=t.find((t=>t.tenantId===e.tenantId)))?void 0:a.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata,isReseller:e.isReseller}})),Nk=(e,t,n)=>{var a,i;return e.tenantId===t?$({},e,{isReseller:n}):$({},e,{children:null!=(a=null==e||null==(i=e.children)?void 0:i.map((e=>Nk(e,t,n))))?a:[]})},Mk=()=>qi((e=>e.auth.allAccountsState));function*Fk({payload:e}){const t=wk.GET_ACCOUNTS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield Mk(),{jwt:a,_limit:i,_offset:o}=e,r={_offset:null!=o?o:n._offset,_limit:null!=i?i:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(a){var s;const{selectedAccount:t}=yield Mk(),{items:n,_links:i}=yield zi(Ip.tenants.searchSubTenants,r,{jwt:a}),o=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:a}),l=Ck({items:n},o),c=Rk(t.accounts?t.accounts:t,null!=(s=null==e?void 0:e._subTenantId)?s:"",l.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==i?void 0:i.next,isReseller:e.isReseller}))));yield ji(za.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield Mk(),{items:n,_links:a}=yield zi(Ip.tenants.searchSubTenants,r),i=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),o=Ck({items:n},i),s=Rk(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",o.map((e=>({name:e.name,tenantId:e.tenantId,numberOfUsers:e.numberOfUsers,createdAt:e.createdAt,metadata:e.metadata,children:[],loadMoreLink:null==a?void 0:a.next,isReseller:e.isReseller}))));yield ji(za.setAllAccountsState({accounts:s}))}}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Gk({payload:e}){const t=wk.SEARCH_ACCOUNTS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield Mk(),{jwt:a}=e;try{if(null!=e&&e._subTenantId){var i;const{items:t}=yield zi(Ip.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(i=null==e?void 0:e._filter)?i:"",_subTenantId:e._subTenantId},{jwt:a});yield ji(za.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*$k({payload:e}){const t=wk.GET_USER_JWT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:a}=e;try{const e=yield zi(Ip.users.GetUserJwt,{tenantId:n});yield ji(za.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==a||a(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),yield ji(za.setSelectedAccountState({accessPermission:!1})),null==a||a(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*xk({payload:e}){const t=wk.CREATE_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:a,tenantId:i,jwt:o,callback:r}=e;try{if(o){const{accounts:e}=yield Mk(),{selectedAccount:t}=yield Mk(),r=yield zi(Ip.subTenants.createSubTenant,{name:n,parentTenantId:a,tenantId:i},{jwt:o}),s=Rk(e,null!=a?a:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Rk($({name:"",tenantId:""},null==t?void 0:t.accounts),null!=a?a:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ji(za.setAllAccountsState({accounts:s})),yield ji(za.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield Mk(),t=yield zi(Ip.subTenants.createSubTenant,{name:n,tenantId:i,parentTenantId:a}),o=Rk(e,null!=a?a:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield ji(za.setAllAccountsState({accounts:o}))}null==r||r(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==r||r(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Vk({payload:e}){const t=wk.DELETE_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:a,callback:i}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.deleteSubTenant,a,{jwt:n});const i=Dk(t,a),o=Dk(null==e?void 0:e.accounts,a);yield ji(za.setAllAccountsState({accounts:i})),yield ji(za.setSelectedAccountState({accounts:o}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.deleteSubTenant,a);const t=Dk(e,a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*jk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_SETTINGS;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:a,callback:i,tenantId:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.updateSubTenant,{tenantId:o},{name:a},{jwt:n});const i=Uk(e.accounts,o,a);yield ji(za.setSelectedAccountState({name:a,accounts:i}));const r=Uk(t,o,a);yield ji(za.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.updateSubTenant,{tenantId:o},{name:a});const t=Uk(e,o,a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Bk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_MANAGEMENT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,isReseller:a,callback:i,tenantId:o,shouldUpdateSelectedAccount:r}=e,s=!!n;try{if(r){const{selectedAccount:e,accounts:t}=yield Mk();yield zi(Ip.subTenants.updateSubTenantManagement,{tenantId:o},{isReseller:a},n?{jwt:n}:void 0);const i=Nk(e.accounts,o,null!=a&&a);yield ji(za.setSelectedAccountState({accounts:i})),s||(yield ji(za.setSelectedAccountState({isReseller:a})));const r=Nk(t,o,null!=a&&a);yield ji(za.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield Mk();yield zi(Ip.subTenants.updateSubTenantManagement,{tenantId:o},{isReseller:a},n?{jwt:n}:void 0);const t=Nk(e,o,null!=a&&a);yield ji(za.setAllAccountsState({accounts:t}))}null==i||i(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==i||i(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Wk({payload:e}){const t=wk.DELETE_USERS_FROM_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:a,jwt:i,callback:o}=e;try{yield zi(Ip.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:a},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:a[0].tenantId})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*zk({payload:e}){const t=wk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:a,jwt:i,callback:o}=e,{selectedAccount:r}=yield Mk();try{yield zi(Ip.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:a},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:r.tenantId})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Kk({payload:e}){const t=wk.ADD_USERS_TO_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:a,jwt:i,callback:o,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield zi(Ip.subTenants.addUsersToSubTenant,{users:n,tenantId:a,allowSubAccountAccess:r,roleIds:s},{jwt:i}),yield ji(za.getAccountUsers({jwt:i,_tenantId:a})),null==o||o(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==o||o(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){const t=wk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield Mk(),{userId:a,allowAccess:i,jwt:o,callback:r}=e;try{var s;yield zi(Ip.subTenants.updateSubAccountAccess,a,{allowAccess:i},{jwt:o}),yield ji(za.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===a?$({},e,{subAccountAccessAllowed:i}):e))})),null==r||r(!0)}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)})),null==r||r(!1)}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){var t,n,a,i,o,r,s,l;const c=wk.GET_ACCOUNT_USERS;yield ji(za.setAllAccountsLoader({key:c,value:!0}));const d=yield Mk(),{jwt:u,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==d||null==(a=d.selectedAccount)||null==(i=a.usersQueryParams)?void 0:i._offset)?t:0,g=null!=(o=null!=(r=null==e?void 0:e._limit)?r:null==d||null==(s=d.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?o:10,S=$({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield zi(Ip.users.getUsersV3,S,{jwt:u}),a={totalUsersItems:t,totalUsersPages:n,usersQueryParams:$({_offset:null!=p?p:0,_limit:null!=g?g:10},!!f&&{_email:f})};if(e.length){const t=e.map((e=>e.id)),n=yield zi(Ip.roles.getRoles),i=yield zi(Ip.users.getUsersRoles,{ids:t},{jwt:u}),o=e.map((e=>{var t,a;const o=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return $({},e,{roles:null!=(a=null==o?void 0:o.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?a:[]})}));yield ji(za.setSelectedAccountState($({users:o},a)))}else yield ji(za.setSelectedAccountState($({users:[]},a)))}catch(e){yield ji(za.setAllAccountsError({key:c,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:c,value:!1}))}}function*Jk({payload:e}){const t=wk.SET_SELECTED_SUB_ACCOUNT_DATA;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var a,i,o,r,s,l,c;const e=yield zi(Ip.accountSettings.getSettings,{jwt:n}),d=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[null!=(a=null==e?void 0:e.tenantId)?a:""]},{jwt:n}),u=yield zi(Ip.tenants.getParentTenants,{jwt:n}),y=yield zi(Ip.tenants.getHierarchyMetadata,{_tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n});yield ji(za.setSelectedAccountState({tenantId:null!=(o=e.tenantId)?o:"",name:e.name,numberOfUsersObject:d[0],parentsAccounts:u,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=d[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield ji(za.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Yk(){const e=wk.SET_ROOT_ACCOUNT_DATA;yield ji(za.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield qi((e=>e.auth.tenantsState)),{accounts:n}=yield Mk();if(t)try{var a;const i=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),o={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(a=i[0])?void 0:a.totalUsers,createdAt:null==t?void 0:t.createdAt};yield ji(za.setAllAccountsState({rootAccount:o,accounts:$({},n,o)}))}catch(t){yield ji(za.setAllAccountsError({key:e,value:jg(t)}))}finally{yield ji(za.setAllAccountsLoader({key:e,value:!1}))}}function*Xk({payload:e}){const t=wk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield ji(za.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:a}=e;try{const e=yield zi(Ip.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:a});yield ji(za.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield ji(za.setAllAccountsError({key:t,value:jg(e)}))}finally{yield ji(za.setAllAccountsLoader({key:t,value:!1}))}}function*Qk(){yield jo(za.loadAccounts,Fk),yield jo(za.searchAccounts,Gk),yield jo(za.updateSubAccountAccessForUser,Hk),yield jo(za.getUserJwtForSubAccount,$k),yield jo(za.createSubAccount,xk),yield jo(za.deleteSubAccount,Vk),yield jo(za.updateSubAccountSettings,jk),yield jo(za.updateSubAccountManagement,Bk),yield jo(za.addUsersToAccount,Kk),yield jo(za.deleteUsersFromAccount,Wk),yield jo(za.setUserRolesForSubAccount,zk),yield jo(za.getAccountUsers,qk),yield jo(za.setRootAccountData,Yk),yield jo(za.setSelectedSubAccountData,Jk),yield jo(za.loadNumberOfUsersForSelectedSubAccount,Xk)}const Zk=["callback"],eO=["callback"],tO=["callback","phoneId"],nO=["callback","phoneId"],aO=["callback"];function*iO(){yield ji(za.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield zi(Ip.userPhoneNumbers.getUserPhoneNumbers,e);yield ji(za.setSmsState({phoneNumbers:t}))}catch(e){yield ji(za.setSmsState({error:jg(e)}))}finally{yield ji(za.setSmsState({loading:!1}))}}function*oO(e){let{payload:{callback:t}}=e,n=ii(e.payload,Zk);yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.createPhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*rO(e){let{payload:{callback:t}}=e,n=ii(e.payload,eO);yield ji(za.setSmsState({loading:!0}));try{yield zi(Ip.userPhoneNumbers.verifyPhoneNumber,n),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*sO(e){let{payload:{callback:t,phoneId:n}}=e;ii(e.payload,tO),yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.deletePhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*lO(e){let{payload:{callback:t,phoneId:n}}=e,a=ii(e.payload,nO);yield ji(za.setSmsState({loading:!0}));try{yield zi(Ip.userPhoneNumbers.verifyDeletePhoneNumber,n,a),yield zi(iO),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*cO(e){let{payload:{callback:t}}=e,n=ii(e.payload,aO);yield ji(za.setSmsState({loading:!0}));try{const e=yield zi(Ip.userPhoneNumbers.preVerifyPhoneNumber,n);yield ji(za.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield ji(za.setSmsState({error:jg(e)})),null==t||t(null,e)}finally{yield ji(za.setSmsState({loading:!1}))}}function*dO(){yield Vo(za.loadPhoneNumbers,iO),yield Vo(za.setUpPhoneNumber,oO),yield Vo(za.verifyPhoneNumber,rO),yield Vo(za.deletePhoneNumber,sO),yield Vo(za.verifyDeletePhoneNumber,lO),yield Vo(za.preVerifyPhoneNumber,cO)}function*uO(e){yield zi(bv,e),yield zi(Lv)}function*yO({mfaToken:e,mfaDevices:t}){yield ji(za.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield zi($g,t);yield ji(za.setMfaState({step:n}))}function*fO(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield ji(za.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(Ev,"true");const{routes:t}=yield qi((e=>e.auth));Wo.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*pO({payload:{maxAge:e,callback:t}}){yield ji(za.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield zi(Ip.auth.generateStepupSession,{maxAge:e});n.user?yield zi(uO,n):yield zi(yO,n),null==t||t(!0)}catch(e){null==t||t(!1),yield zi(fO,e)}}function*gO({payload:e}){const t={acr_values:Av},{maxAge:n}=e||{};void 0!==n&&(t.max_age=n.toString());const a=yield qi((({auth:e})=>{var t,n;return null==(t=e.tenantsState)||null==(n=t.activeTenant)?void 0:n.alias}));a&&(t.organization=a),kv(),window.localStorage.setItem(Ev,"true"),yield Mh(t)}function*SO({payload:e}){yield Cv(e,za.setStepUpState,!0)}function*vO({payload:e}){yield Hv(e,za.setStepUpState)}function*hO({payload:e}){yield qv(e,za.setStepUpState,!0)}function*mO({payload:e}){yield Vv(e,za.setStepUpState)}function*bO({payload:e}){yield jv(e,za.setStepUpState,!0)}function*AO({payload:e}){yield eh(e,za.setStepUpState)}function*TO({payload:e}){yield Zv(e,za.setStepUpState)}function*EO(){yield Bo(za.stepUpHostedLogin,gO),yield Bo(za.generateStepUpSession,pO),yield Bo(za.stepUpWithAuthenticator,SO),yield Bo(za.preVerifyMFASMSForStepUp,mO),yield Bo(za.verifyMFASMSForStepUp,bO),yield Bo(za.preVerifyMFAWebAuthnForStepUp,vO),yield Bo(za.verifyMFAWebAuthnForStepUp,hO),yield Bo(za.verifyMFAEmailCodeForStepUp,AO),yield Bo(za.preVerifyMFAEmailCodeForStepUp,TO)}const IO={sagas:function*(){yield Bi([zi(lm),zi(EO),zi(rA),zi(lA),zi(Yb),zi(HE),zi(Im),zi(Qm),zi(ib),zi(Qg),zi(Mb),zi(_T),zi(hk),zi(XT),zi(ov),zi(sE),zi(xS),zi(SE),zi(IE),zi(GE),zi(ZE),zi(lI),zi(RI),zi(XI),zi(ek),zi(ak),zi(Qk),zi(vv),zi(dS),zi(dO),zi(_A)])},mockSagas:function*(){yield Bi([zi(um),zi(Um),zi(lb),zi(zb),zi(BT),zi(fE),zi(ZS),zi(aI),zi(mE),zi(OE),zi(uI),zi(BI),zi(xE),zi(Lk),zi(vS)])},storeName:Nt,initialState:Ga,reducer:Ba,actions:za},kO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>$({},t,{[e]:$({},t[e],n)})}),OO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},PO={setAuditLogsState:kO("auditLogsState"),resetAuditLogsState:e=>$({},e,{auditLogsState:OO})},_O={exportAuditsCsv:ft("auditLogs/exportAuditsCsv"),loadAuditLogs:ft("auditLogs/loadAuditLogs",(e=>({payload:e})))},LO={loading:!0},wO={setAuditsMetadataState:kO("auditsMetadataState"),resetAuditsMetadataState:e=>$({},e,{auditsMetadataState:LO})},UO={loadAuditsMetadata:ft("auditLogs/loadAuditsMetadata")},DO={auditLogsState:OO,auditsMetadataState:LO},{reducer:RO,actions:CO}=gt({name:Ft,initialState:DO,reducers:$({resetState:e=>$({},e,DO),setState:(e,{payload:t})=>$({},e,t)},PO,wO)}),NO=$({},CO,_O,UO),MO=e=>"createdAt"!==e.id,FO={total:20,data:Array.from(Array(5).keys()).map((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`})))},GO={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}]},$O=()=>qi((e=>e.auditLogs.auditLogsState)),xO=()=>qi((e=>e.auditLogs.auditsMetadataState));function*VO(){const e=yield $O(),{columns:t}=yield xO();try{const n=e.filter,a=e.sort.reduce(((e,t)=>$({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),i=n.reduce(((e,t)=>$({},e,{[t.id]:t.value})),{});yield ji(NO.setAuditLogsState({isDownloadingCsv:!0}));const o="audits.csv";yield Ip.audits.exportAudits($({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:o},a,i))}catch(e){console.error("failed to export audits - ",e)}yield ji(NO.setAuditLogsState({isDownloadingCsv:!1}))}function*jO({payload:e}){yield ji(NO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield $O(),{columns:n}=yield xO();try{var a,i,o,r,s;const l=null!=(a=e.pageSize)?a:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,d=null!=(o=e.filter)?o:t.filter,u=null!=(r=e.sort)?r:t.sort;yield ji(NO.setAuditLogsState({pageSize:l,pageOffset:c,filter:d,sort:u}));const y=u.reduce(((e,t)=>$({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=d.reduce(((e,t)=>$({},e,{[t.id]:t.value})),{});n||(yield ji(NO.loadAuditsMetadata()));const{data:p,total:g}=yield zi(Ip.audits.getAudits,$({offset:c,count:l},y,f));yield ji(NO.setAuditLogsState({loading:!1,logs:null!=p?p:[],totalPages:+Math.ceil(g/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield ji(NO.setAuditLogsState({loading:!1,error:jg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*BO(){yield Vo(NO.exportAuditsCsv,VO),yield Vo(NO.loadAuditLogs,jO)}function*WO({payload:e}){yield ji(NO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield $O(),{columns:n}=yield xO();try{var a,i,o,r,s;const l=null!=(a=e.pageSize)?a:t.pageSize,c=null!=(i=e.pageOffset)?i:t.pageOffset,d=null!=(o=e.filter)?o:t.filter,u=null!=(r=e.sort)?r:t.sort;yield ji(NO.setAuditLogsState({pageSize:l,pageOffset:c,filter:d,sort:u})),n||(yield ji(NO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=FO;let a=n.filter((e=>t=>e.filter(MO).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];a=a.sort(((e,t)=>(n,a)=>n[e]>a[e]?t?-1:1:a[e]>n[e]?t?1:-1:0)(e,n))}return{data:a,total:a.length}})(d,u);yield ji(NO.setAuditLogsState({loading:!1,logs:null!=y?y:[],totalPages:+Math.ceil(f/l)})),null==e||null==(s=e.callback)||s.call(e,!0)}catch(t){var l;yield ji(NO.setAuditLogsState({loading:!1,error:jg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*zO(){yield Vo(NO.loadAuditLogs,WO)}function*KO(){yield ji(NO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield zi(Ip.metadata.getAuditsMetadata);yield ji(NO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(NO.setAuditsMetadataState({error:e,loading:!1}))}}function*HO(){yield Vo(NO.loadAuditsMetadata,KO)}function*qO(){yield ji(NO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=GO;yield ji(NO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield ji(NO.setAuditsMetadataState({error:e,loading:!1}))}}function*JO(){yield Vo(NO.loadAuditsMetadata,qO)}const YO={sagas:function*(){yield Bi([zi(BO),zi(HO)])},mockSagas:function*(){yield Bi([zi(zO),zi(JO)])},storeName:Ft,initialState:DO,reducer:RO,actions:NO},XO={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:QO,actions:ZO,reducer:eP}=gt({name:"audits",initialState:XO,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.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]})))}}}),tP=$({},ZO,{initData:ft(`${QO}/initData`),loadAudits:ft(`${QO}/loadAudits`),removeFilter:ft(`${QO}/removeFilter`),filterData:ft(`${QO}/filterData`),exportCSV:ft(`${QO}/exportCSV`),deleteAudits:ft(`${QO}/deleteAudits`)}),nP=()=>qi((e=>e[QO]));function*aP(){const{sortBy:e,sortDirection:t}=yield nP();try{const n=yield zi(Ip.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield ji(tP.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield ji(tP.loadItemFailedAction(t))}}function*iP(){try{const e=yield zi(Ip.metadata.getAuditsMetadata);yield ji(tP.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield ji(tP.loadItemFailedAction(t))}}const oP=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*rP({payload:e}){const{filters:t,sortBy:n,sortDirection:a,filter:i,offset:o,virtualScroll:r}=yield nP(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:d}=s?yield nP():{rowsData:[]};try{const e=oP(t),{data:s,total:u}=yield zi(Ip.audits.getAudits,$({},r&&{paginationMode:"virtual"},{sortDirection:a,sortBy:n,filter:i},e,{offset:r?d.length+c||d.length+o:c||o,count:20}));yield ji(tP.loadAuditsSuccess({rowsData:[...d,...s],total:u})),l&&(yield ji(tP.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield ji(tP.loadItemFailedAction(t))}}function*sP(){yield ji(tP.startLoading()),yield Bi([aP(),iP(),rP({payload:{onlyOneLoad:!1},type:""})]),yield ji(tP.finishLoading())}function*lP({payload:e}){const{filters:t}=yield nP(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const a=[...t.slice(0,n),...t.slice(n+1)];yield ji(tP.setFilterData(a))}function*cP({payload:e}){const{filters:t}=yield nP();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const a=[...t.slice(0,n),e,...t.slice(n+1)];yield ji(tP.setFilterData(a))}function*dP(){const{filters:e,sortBy:t,sortDirection:n,filter:a,headerProps:i}=yield nP(),o=oP(e);yield ji(tP.startDownloadingCsv());try{yield Ip.audits.exportAudits($({endpoint:"csv/v2",headerProps:i,sortDirection:n,sortBy:t,filter:a},o,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield ji(tP.stopDownloadingCsv())}}function*uP(){yield jo(tP.initData,sP),yield jo(tP.removeFilter,lP),yield jo(tP.filterData,cP),yield jo([tP.loadAudits,tP.textSearch,tP.onPageChange],rP),yield jo([tP.setFilterData,tP.setDataSorting,tP.startRefresh],(()=>rP({payload:{appendMode:!1},type:""}))),yield jo(tP.exportCSV,dP)}const yP={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},fP={initData:()=>$({},yP),setConnectivityState:(e,{payload:t})=>$({},e,t),cleanWebhookTestData:e=>$({},e,{testResult:void 0}),cleanWebhookLogsData:e=>$({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return $({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>$({},e,{error:void 0}),cleanSlackData:e=>$({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>$({},e,{retryResult:$({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>$({},e,{retryResult:$({},e.retryResult,t)})}},pP={loadSlackActions:ft("connectivity/loadSlackActions"),loadDataAction:ft("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ft("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ft("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ft("connectivity/loadScope"),deleteWebhookConfigAction:ft("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ft("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ft("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},gP={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:SP,actions:vP}=gt({name:Mt,initialState:gP,reducers:$({},fP)}),hP=$({},vP,pP),mP={slack:Ip.connectivity.getSlackConfiguration,email:Ip.connectivity.getEmailConfiguration,sms:Ip.connectivity.getSMSConfiguration,webhook:Ip.connectivity.getWebhooksConfigurations,categories:Ip.connectivity.getCategories,channelMap:Ip.connectivity.getChannelMaps},bP={slack:Ip.connectivity.postSlackConfiguration,email:Ip.connectivity.postEmailConfiguration,sms:Ip.connectivity.postSMSConfiguration,webhook:Ip.connectivity.postWebhooksConfiguration},AP=["email","slack","sms","webhook"],TP={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"}},EP=["id"],IP=["id","enabled"],kP=["categories","channelMap"];function*OP(e){return yield zi(_P,{payload:{api:e},type:""})}function*PP({payload:e=AP}){yield ji(hP.setConnectivityState({isLoading:!0}));try{const t=yield Bi([...e.map(OP),yield _P({payload:{api:"categories"},type:""}),yield function*(){return(yield Bi(e.map((function*(e){return yield _P({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,a)=>$({},t,{[`${e[a]}`]:n})),{})}()]),n=yield _P({payload:{api:"webhook"},type:""}),a=t.reduce(((n,a,i)=>e[i]?t[t.length-1][e[i]].length?$({},n,{[`${e[i]}`]:a,list:[...n.list,{id:i,key:e[i],events:TP[e[i]].events(a),active:TP[e[i]].isActive(a),platform:TP[e[i]].title,image:TP[e[i]].image}]}):n:$({},n,{[`${kP[i-e.length]}`]:a})),{list:[],webhook:n});yield ji(hP.setConnectivityState($({},a,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield ji(hP.setConnectivityState({isLoading:!1}))}}function*_P({payload:{api:e,params:t}}){try{return yield zi(mP[e],t)}catch(e){return}}function*LP(){try{yield ji(hP.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield zi(Ip.connectivity.getSlackChannels);yield ji(hP.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield ji(hP.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*wP(e,t){const{connectivity:{list:n}}=yield qi(),a=n.find((({key:t})=>t===e));if(!a)return;const i=TP[e].isActive(t);i!==a.active&&(yield ji(hP.setConnectivityState({list:n.map((t=>t.key===e?$({},t,{active:i}):t))})))}function*UP({payload:{platform:e,data:t,callback:n}}){const{processIds:a}=yield qi((e=>e.connectivity));try{if(yield ji(hP.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...a]:a})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield qi();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:a}=e;yield Bi([...a.reduce(((e,t)=>{var a,i;return!t.id&&t.slackEvents&&null!=(a=t.slackEvents[0].channelIds)&&a.length||(null==n?void 0:n.find((e=>{let{id:n}=e,a=ii(e,EP);return n===t.id&&JSON.stringify($({id:n},a))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length?[...e,t]:e}),[]).map((function*(e){return yield zi(bP.slack,e)})),...a.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield zi(Ip.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield qi(),{processIds:a}=yield qi((e=>e.connectivity)),i=n[t];if(!i)return;let o=[];try{o=yield Bi([...e.reduce(((e,t)=>!i.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield zi("email"===t?Ip.connectivity.postEmailConfiguration:Ip.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:a}=e,i=n[0],{id:o="",enabled:r}=i,s=ii(i,IP);return yield Bi([yield zi("email"===t?Ip.connectivity.patchEmailConfiguration:Ip.connectivity.patchSMSConfiguration,{eventKey:a,enabled:r}),yield zi("email"===t?Ip.connectivity.putEmailSubscriptions:Ip.connectivity.putSMSSubscriptions,o,a,$({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=i.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return zi("email"===t?Ip.connectivity.deleteEmailSubscriptions:Ip.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(o.length){const e=yield _P({payload:{api:t},type:""});yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?a.filter((t=>t!==e.id)):a})),yield wP(t,e)}else yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:i,processIds:a}))}({payload:t,type:e}):yield zi(bP[e],t),!["sms","email"].includes(e)){const i=yield _P({payload:{api:e},type:""});"webhook"===e&&(i.id=t._id),yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:i,processIds:i.id?a.filter((e=>e!==i.id)):a})),yield wP(e,i),null==n||n(!0)}}catch(e){yield ji(hP.setConnectivityState({error:jg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*DP({payload:e}){try{yield Ip.connectivity.postSlackCode(e)}catch{}yield ji(hP.setConnectivityState({error:void 0,isSaving:!1}))}function*RP(){const{slackChannels:e}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({slackChannels:$({},e,{isLoadingScope:!0})}));const{clientId:t}=yield zi(Ip.connectivity.getSlackScope);yield ji(hP.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield ji(hP.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*CP({payload:e}){const{callback:t,webhookId:n}=e,{processIds:a}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({isSaving:!0})),yield zi(Ip.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,jg(e))}const i=yield _P({payload:{api:"webhook"},type:""});i&&(yield ji(hP.setConnectivityState({error:void 0,isSaving:!1,webhook:i,processIds:i.id?a.filter((e=>e!==i.id)):a}))),null==t||t(!0)}function*NP({payload:e}){try{yield ji(hP.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield zi(Ip.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield ji(hP.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*MP({payload:e}){try{const{statusCode:t}=yield zi(Ip.connectivity.postWebhookRetry,e);yield ji(hP.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield ji(hP.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*FP({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:a}=yield qi((e=>e.connectivity));try{yield ji(hP.setConnectivityState({webhookLogs:$({},a,{isLoading:!0})}));const i=yield zi(Ip.connectivity.getWebhookLog,e,n,t);yield ji(hP.setConnectivityState({error:void 0,webhookLogs:$({isLoading:!1},i)}))}catch(e){yield ji(hP.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}const GP={sagas:function*(){yield Vo(hP.loadDataAction,PP),yield jo(hP.loadSlackActions,LP),yield Vo(hP.postDataAction,UP),yield Vo(hP.postCodeAction,DP),yield Vo(hP.loadScope,RP),yield Vo(hP.deleteWebhookConfigAction,CP),yield Vo(hP.postWebhookTestAction,NP),yield Vo(hP.postWebhookRetryAction,MP),yield jo(hP.loadWebhookLogsAction,FP)},storeName:Mt,initialState:gP,reducer:SP,actions:hP};function $P(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,t.payload)}}}function xP(e,t){return{prepare:e=>({payload:e}),reducer:(n,a)=>$({},n,{[e]:t(n[e],a)})}}function VP(e){return xP(e,((e,t)=>$({},e,{loading:t.payload})))}function jP(e){return xP(e,((e,t)=>$({},e,{error:t.payload,loading:!1})))}const BP={loading:!1,error:null,fetching:!0,plans:[]},{actions:WP,reducer:zP,name:KP}=gt({name:"subscriptions/plans",initialState:BP,reducers:$({},$P())}),HP=$({loadPlans:ft(`${KP}/loadPlans`)},WP),qP={loading:!1,error:null,fetching:!0,config:null},JP=$({},$P()),{actions:YP,reducer:XP,name:QP}=gt({name:"subscriptions/config",initialState:qP,reducers:JP}),ZP=$({loadPaymentConfiguration:ft(`${QP}/loadPaymentConfiguration`)},YP),e_={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},t_=$({},$P(),{setCancellationLoading:VP("cancellation"),setCancellationError:jP("cancellation"),setRenewalLoading:VP("renewal"),setRenewalError:jP("renewal")}),{reducer:n_,actions:a_,name:i_}=gt({name:"subscriptions/billing/subscription",initialState:e_,reducers:t_}),o_=$({load:ft(`${i_}/loadSubscription`),cancelSubscription:ft(`${i_}/cancelSubscription`),renewSubscription:ft(`${i_}/renewSubscription`)},a_),r_={loading:!1,error:null,fetching:!0},s_=$({},$P()),{reducer:l_,actions:c_,name:d_}=gt({name:"subscriptions/billing/information",initialState:r_,reducers:s_}),u_=$({loadBillingInformation:ft(`${d_}/loadBillingInformation`),cancelSubscription:o_.cancelSubscription,renewSubscription:o_.renewSubscription},c_),y_={loading:!1,error:null,fetching:!0},f_=$({},$P(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,t.payload)}}),{reducer:p_,actions:g_,name:S_}=gt({name:"subscriptions/billing/payment",initialState:y_,reducers:f_}),v_=$({loadPaymentMethod:ft(`${S_}/loadPaymentMethod`),submitPaymentMethod:ft(`${S_}/submitPaymentMethod`),submitPaymentMethodError:ft(`${S_}/submitPaymentMethodError`),submitPaymentMethodSuccess:ft(`${S_}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ft(`${S_}/updateBillingDetails`,(e=>({payload:e})))},g_),h_={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},m_=$({},$P(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>$({},e,{invoiceDownload:$({},e.invoiceDownload,t.payload)})}}),{reducer:b_,actions:A_,name:T_}=gt({name:"subscriptions/billing/invoices",initialState:h_,reducers:m_}),E_=$({loadInvoices:ft(`${T_}/loadInvoices`),downloadInvoice:ft(`${T_}/downloadInvoice`,(e=>({payload:e})))},A_),I_={information:r_,invoices:h_,paymentMethod:y_,subscription:e_},k_={invoices:E_,information:u_,paymentMethod:v_,subscription:o_},O_=He({invoices:b_,information:l_,paymentMethod:p_,subscription:n_}),P_={fetching:!0,loading:!1,error:null,confirmed:!1},__=$({},$P()),{actions:L_,reducer:w_,name:U_}=gt({name:"subscriptions/checkout",initialState:P_,reducers:__}),D_=$({loadCheckout:ft(`${U_}/loadCheckout`),resetCheckout:ft(`${U_}/resetCheckout`),submitCheckout:ft(`${U_}/submitCheckout`),confirmCheckout:ft(`${U_}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ft(`${U_}/errorCheckout`,(e=>({payload:e})))},L_),R_={loading:!1,error:null,cardSetupIntentSecret:null},C_=$({},$P()),{reducer:N_,actions:M_,name:F_}=gt({name:"subscriptions/stripe",initialState:R_,reducers:C_}),G_=$({loadCustomer:ft(`${F_}/loadCustomer`),createCardSetupIntentSecret:ft(`${F_}/createCardSetupIntentSecret`)},M_),$_={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:x_,reducer:V_,name:j_}=gt({name:"subscriptions/vendorPublicConfig",initialState:$_,reducers:$({},$P())}),B_=$({loadVendorPublicConfiguration:ft(`${j_}/loadVendorPublicConfiguration`)},x_),W_={config:qP,plans:BP,checkout:P_,billing:I_,stripe:R_,vendorPublicConfig:$_},z_={config:ZP,billing:k_,plans:HP,checkout:D_,stripe:G_,vendorPublicConfig:B_},K_=He({config:XP,billing:O_,plans:zP,checkout:w_,stripe:N_,vendorPublicConfig:V_});let H_,q_,J_;function Y_({policy:e}){return{policy:J_.AT_PERIOD_END}}function X_(e){switch(e){case of.ACTIVE:return q_.ACTIVE;case of.INCOMPLETE:return q_.INCOMPLETE;case of.CANCELED:return q_.CANCELED;case of.EXPIRED:return q_.EXPIRED;case of.TRIALING:return q_.TRIALING;default:return q_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(H_||(H_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(q_||(q_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(J_||(J_={}));const Q_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:of.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},Z_=[{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"}],eL=[{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:""}],tL=[{id:"id",externalId:"externalId",type:rf.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],nL={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*aL(){yield ji(o_.setLoading(!0));try{const[e]=yield zi(Ip.subscriptions.getManagedSubscriptions);yield ji(o_.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield ji(o_.setError(e))}}function*iL(){yield Vo(u_.loadBillingInformation,oL)}function*oL(){yield function*(e){const t=yield qi((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield rL(n,!1):yield ji(u_.setError(t?"Not authorized":"Internal feature failure"))}()}function*rL(e,t){yield ji(u_.setLoading(!0));try{var n,a;const i=yield zi(Ip.subscriptions.getSubscriptionSummaries,e),{currentPlanId:o,externallyManaged:r}=i;let s,l=null;r?s=yield zi(Ip.subscriptions.getSubscriptionPlan,o):([,s]=yield Bi([zi(aL),zi(Ip.subscriptions.getSubscriptionPlan,o)]),l=yield qi((e=>e.subscriptions.billing.subscription.subscription||null))),yield ji(u_.setState($({loading:!1,fetching:!1,summary:i},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?q_.ACTIVE:X_(l.status),cancellation:l.cancellation&&Y_(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(a=s.price)?void 0:a.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield ji(u_.setError(jg(e)))}}function*sL(){yield function*(){var e,t;yield ji(u_.setLoading(!0)),yield Ji(500),yield ji(u_.setState({loading:!1,fetching:!1,summary:{subscriptionId:Q_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:lf.Stripe,externallyManaged:!1,currentPlanId:Z_[0].id,defaultPlanId:Z_[0].id},plan:$({},Z_[0],{price:null==(e=Z_[0].price)?void 0:e.amount,currency:null==(t=Z_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*lL(){yield Vo(u_.loadBillingInformation,sL)}function*cL(){yield Vo(v_.loadPaymentMethod,dL),yield Vo(v_.submitPaymentMethod,yL),yield Vo(v_.submitPaymentMethodError,fL),yield Vo(v_.submitPaymentMethodSuccess,pL),yield Vo(v_.updatePaymentMethodBillingDetails,uL)}function*dL(){yield ji(v_.setLoading(!0));try{const e=(yield zi(Ip.subscriptions.getPaymentMethods))[0];yield ji(v_.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield ji(v_.setError(jg(e)))}}function*uL({payload:e}){yield ji(v_.setLoading(!0));const{id:t,email:n,address:a,callback:i}=e;try{yield zi(Ip.subscriptions.updatePaymentMethodBillingDetails,t,$({email:n},a)),yield zi(dL),null==i||i(!0)}catch(e){yield ji(v_.setError(jg(e))),null==i||i(!1)}yield ji(v_.setLoading(!1))}function*yL(){yield ji(v_.setLoading(!0))}function*fL({payload:e}){yield ji(v_.setError(e))}function*pL(){yield ji(v_.loadPaymentMethod())}function*gL(){yield ji(v_.setLoading(!0)),yield Ji(500);const e=tL[0];yield ji(v_.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*SL(){yield Vo(v_.loadPaymentMethod,gL)}function*vL(){yield Vo(E_.loadInvoices,hL),yield Vo(E_.downloadInvoice,mL)}function*hL(){yield ji(E_.setLoading(!0));try{const e=(yield zi(Ip.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 ji(E_.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield ji(E_.setError(jg(e)))}}function*mL({payload:e}){yield ji(E_.setInvoiceDownloadState({loading:!0,error:null}));try{yield zi(Ip.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield ji(E_.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield ji(E_.setInvoiceDownloadState({loading:!1,error:jg(e,null)}))}}function*bL(){yield ji(E_.setLoading(!0)),yield Ji(500),yield ji(E_.setState({loading:!1,fetching:!1,invoices:eL.map((e=>$({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield ji(E_.setLoading(!1))}function*AL(){yield Vo(E_.loadInvoices,bL)}function*TL(){yield Vo(o_.load,EL),yield Vo(o_.cancelSubscription,IL),yield Vo(o_.renewSubscription,kL)}function*EL(){const e=yield qi((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield rL(e)}function*IL(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(o_.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(o_.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:a}=e||{};if(!n&&a===of.ACTIVE)try{yield ji(o_.setCancellationLoading(!0)),yield zi(Ip.subscriptions.cancelManagedSubscription,t),yield aL(),yield ji(o_.setCancellationLoading(!1))}catch(e){yield ji(o_.setCancellationError(jg(e)))}}function*kL(){const{subscription:e}=yield qi((e=>e.subscriptions.billing.subscription));if(!e)return void(yield ji(o_.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield ji(o_.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===sf.AT_PERIOD_END)try{yield ji(o_.setRenewalLoading(!0)),yield zi(Ip.subscriptions.renewManagedSubscription,t),yield aL(),yield ji(o_.setRenewalLoading(!1))}catch(e){yield ji(o_.setCancellationError(jg(e)))}}function*OL(){yield ji(o_.setLoading(!0)),yield Ji(500),yield ji(o_.setState({subscription:Q_,fetching:!1,loading:!1,error:null}))}function*PL(){yield Vo(o_.load,OL)}function*_L(){yield Bi([zi(iL),zi(cL),zi(vL),zi(TL)])}function*LL(){yield Bi([zi(lL),zi(SL),zi(AL),zi(PL)])}function*wL(){yield Vo(D_.loadCheckout,UL),yield Vo(D_.resetCheckout,DL),yield Vo(D_.submitCheckout,RL),yield Vo(D_.confirmCheckout,CL),yield Vo(D_.errorCheckout,ML)}function*UL(){yield ji(D_.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*DL(){yield ji(D_.setState({loading:!1,error:null,confirmed:!1}))}function*RL(){yield ji(D_.setState({loading:!0,error:null}))}function*CL({payload:{paymentMethodId:e,planId:t}}){const n=yield qi((e=>e.subscriptions.billing.subscription.subscription)),a=yield qi((e=>e.subscriptions.billing.information.summary)),i=(null==n?void 0:n.status)===of.TRIALING,o=!(null==a||!a.paymentMethodId);if(n){if(yield ji(D_.setState({loading:!0,error:null})),i&&o)return yield NL(),void(yield ji(o_.setState({subscription:$({},n,{status:of.ACTIVE})})));try{yield zi(Ip.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Bi([oL(),dL(),hL()]),yield NL()}catch(e){yield ji(D_.setState({loading:!1,error:jg(e)}))}}else yield ji(D_.setState({loading:!1,error:"Subscription not found"}))}function*NL(){yield ji(D_.setState({loading:!1,error:null,confirmed:!0}))}function*ML({payload:e}){yield ji(D_.setState({loading:!1,error:e}))}function*FL(){yield Vo(D_.resetCheckout,DL)}function*GL(){yield Vo(HP.loadPlans,$L)}function*$L(){yield ji(HP.setLoading(!0));try{const e=(yield zi(Ip.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 ji(HP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield ji(HP.setError(jg(e)))}}function*xL(){yield ji(HP.setLoading(!0)),yield Ji(500),yield ji(HP.setState({fetching:!1,loading:!1,plans:Z_.map((e=>{var t,n;return $({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*VL(){yield Vo(HP.loadPlans,xL)}function*jL(){yield Vo(ZP.loadPaymentConfiguration,BL)}function*BL(){yield ji(ZP.setLoading(!0));try{(yield zi(Ip.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===lf.Stripe))?yield function*(){yield ji(ZP.setLoading(!0));try{const e=yield zi(Ip.subscriptions.getStripePaymentProviderConfiguration);yield ji(ZP.setState({loading:!1,fetching:!1,config:{paymentProvider:H_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield ji(ZP.setError(jg(e)))}}():yield ji(ZP.setError("Payment provider not configured"))}catch(e){yield ji(ZP.setError(jg(e)))}}function*WL(){yield ji(ZP.setLoading(!0)),yield Ji(500),yield ji(ZP.setState({loading:!1,fetching:!1,config:{paymentProvider:H_.STRIPE,apiKey:""}}))}function*zL(){yield Vo(ZP.loadPaymentConfiguration,WL)}function*KL(){yield Vo(G_.createCardSetupIntentSecret,HL)}function*HL({payload:e}){yield ji(G_.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield zi(Ip.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield ji(G_.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield ji(G_.setError(jg(e)))}}function*qL(){yield Vo(B_.loadVendorPublicConfiguration,JL)}function*JL(){yield ji(B_.setLoading(!0));try{const e=yield zi(Ip.subscriptions.getVendorPublicConfigurations);yield ji(B_.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield ji(B_.setError(jg(e)))}}function*YL(){yield ji(B_.setLoading(!0)),yield Ji(500),yield ji(B_.setState({fetching:!1,loading:!1,vendorPublicConfig:nL}))}function*XL(){yield Vo(B_.loadVendorPublicConfiguration,YL)}const QL={sagas:function*(){yield Bi([zi(_L),zi(wL),zi(GL),zi(jL),zi(KL),zi(qL)])},mockSagas:function*(){yield Bi([zi(LL),zi(FL),zi(VL),zi(zL),zi(XL)])},reducer:K_,actions:z_,initialState:W_,storeName:"subscriptions"},ZL={sagas:function*(){yield Vo(uv.loadVendorPublicInfo,yv)},storeName:Gt,initialState:lv,reducer:cv,actions:uv},{reducer:ew}=gt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Wo.setContext(t),$({},e,{context:t}))}}}),tw=(e,t,n=!1,a,i,o=!1,r="path")=>{const s="undefined"==typeof window;let l=t;if(s&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(l||(l=window),!l.store){var c,d,u,y,f,p,g,S,v,h;n||o||Wo.setContext(e.context);const t=Do(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=yt({middleware:s,preloadedState:{root:$({},e,{previewMode:n,urlStrategy:r}),[IO.storeName]:$({},IO.initialState,a,null!=(c=null==i?void 0:i.auth)?c:{},{routes:$({},IO.initialState.routes,null!=(d=null==a?void 0:a.routes)?d:{},null!=(u=null==i||null==(y=i.auth)?void 0:y.routes)?u:{})}),[YO.storeName]:$({},YO.initialState,null!=(f=null==i?void 0:i.auditLogs)?f:{},{auditLogsState:$({},YO.initialState.auditLogsState,null!=(p=null==i||null==(g=i.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:$({},YO.initialState.auditsMetadataState,null!=(S=null==i||null==(v=i.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[QO]:$({},XO,null!=(h=null==i?void 0:i.audits)?h:{}),[GP.storeName]:GP.initialState,[QL.storeName]:QL.initialState,[ZL.storeName]:ZL.initialState},reducer:He({root:ew,[IO.storeName]:IO.reducer,[YO.storeName]:YO.reducer,[QO]:eP,[GP.storeName]:GP.reducer,[QL.storeName]:QL.reducer,[ZL.storeName]:ZL.reducer})});const m=function*(){yield Bi([zi(IO.sagas),zi(YO.sagas),zi(uP),zi(GP.sagas),zi(QL.sagas),zi(ZL.sagas)])},b=function*(){yield Bi([zi(IO.mockSagas),zi(YO.mockSagas),zi(QL.mockSagas)])};n?(l.store.destroy=t.run(b).cancel,l.store.dispatch(za.requestAuthorize(!0))):l.store.destroy=t.run(m).cancel,l.store.subscribeStateChanged=e=>{let t=l.store.getState();return l.store.subscribe((()=>{const n=l.store.getState();t!=n&&(t=n,e(n))}))}}return l.store};var nw=n(9314);const aw=()=>{if(!Wo.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")};var iw=n(9714),ow=n.n(iw);function rw(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function sw(e){if(e.type)return e;if("#"===e.charAt(0))return sw(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 a=e.substring(t+1,e.length-1);let i,o;if("color"===n){if(o=a.split(" "),i=o.shift(),4===o.length&&"/"===o[3].charAt(0)&&(o[3]=o[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(i))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+i)}else o=a.split(",");return{type:n,values:o.map((e=>parseFloat(e))),colorSpace:i}}function lw(e){const{type:t,colorSpace:n}=e;let{values:a}=e;return-1!==t.indexOf("rgb")?a=a.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(a[1]=`${a[1]}%`,a[2]=`${a[2]}%`),a=-1!==t.indexOf("color")?`${n} ${a.join(" ")}`:`${a.join(", ")}`,`${t}(${a})`}function cw(e){if(0===e.indexOf("#"))return e;const{values:t}=sw(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 dw(e,t){return e=sw(e),t=rw(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,lw(e)}function uw(e,t){if(e=sw(e),t=rw(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 lw(e)}function yw(e,t){if(e=sw(e),t=rw(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 lw(e)}const fw=e=>{if(e)return{main:e,light:cw(yw(e,.4)),dark:cw(uw(e,.15)),hover:cw(uw(e,.15)),active:cw(uw(e,.2))}},pw=e=>{if(e)return{main:e,light:yw(e,.7),dark:uw(e,.2)}},gw=(e,t)=>{var n,a,i,o,r,s,l,c,d,u,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?$({},t,{palette:{primary:$({},fw(null==e||null==(a=e.palette)?void 0:a.primary),{contrastText:null!=(i=null==e||null==(o=e.palette)?void 0:o.primaryText)?i:"#000000"}),secondary:$({},fw(null==e||null==(r=e.palette)?void 0:r.secondary),{contrastText:null!=(s=null==e||null==(l=e.palette)?void 0:l.secondaryText)?s:"#000000"}),danger:$({},fw(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:$({},pw(null==e||null==(d=e.palette)?void 0:d.success),{contrastText:"#FFF"}),error:$({},pw(null==e||null==(u=e.palette)?void 0:u.error),{contrastText:"#FFF"}),warning:$({},pw(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:$({},pw(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},Sw={theme:{},themeV2:{},localizations:{},navigation:{usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class vw{constructor(){this._theme=Sw.theme,this._themeV2=Sw.themeV2,this._navigation=Sw.navigation,this._localizations=Sw.localizations,this._integrations=Sw.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new vw;return n.set(e),vw._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:{}}get integrations(){var e;return null!=(e=this._integrations)?e:{}}set(e){try{var t,n,a,i,o,r,s,l,c;this._navigation=ow().all([null!=(t=Sw.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=ow().all([null!=(a=Sw.theme)?a:{},gw(null==e?void 0:e.theme,Sw.theme)]),this._themeV2=ow().all([null!=(i=Sw.themeV2)?i:{},null!=(o=null==e?void 0:e.themeV2)?o:{}]),this._localizations=ow().all([null!=(r=Sw.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=ow().all([null!=(l=Sw.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=Sw.navigation,this._theme=Sw.theme,this._themeV2=Sw.themeV2,this._localizations=Sw.localizations,this._integrations=Sw.integrations}}}vw._instances={};var hw=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},mw=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=document.createElement(t);return Object.keys(n).forEach((function(e){return a.setAttribute(e,n[e])})),e.appendChild(a),a},bw=function(e){return new Promise((function(t,n){var a=4e3,i=setInterval((function(){return null!=e.themeSetter?(clearInterval(i),void t(!0)):a<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(i)):void(a-=50)}),50)}))},Aw=function(e){var t=e.toString();if(t){var n=new URL(window.location.href);n.search=t,window.history.pushState(null,"",n.toString())}};let Tw,Ew,Iw,kw,Ow,Pw,_w,Lw,ww,Uw,Dw,Rw;!function(e){e.phoneNumber="phoneNumber"}(Tw||(Tw={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(Ew||(Ew={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(Iw||(Iw={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(kw||(kw={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(Ow||(Ow={})),function(e){e.Invoices="invoices"}(Pw||(Pw={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(_w||(_w={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(Lw||(Lw={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(ww||(ww={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(Uw||(Uw={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(Dw||(Dw={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(Rw||(Rw={}));const Cw={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},Nw={hidden:"hidden",edit:"edit"},Mw="6.190.0";var Fw={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts-new":"on","temporary-users":"on"},Gw=function(){function e(t,n){var a,i,o=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];P(this,e),this.name=void 0,this.iframeRendering=void 0,this.options=void 0,this.loading=!0,this.cdnUrl="https://assets.frontegg.com/admin-box/".concat(Mw),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=M(G().mark((function e(){var t,n,a,i,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Gr,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(a=r.rows)||null==(i=a[0])?void 0:i.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:vw.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,a;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:a=null==(t=o.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,o.options.builderMode||"nextjs"===o.options.framework||(o.options.hostedLoginBox&&!o.options.customLoginBox?a&&o.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):o.store.dispatch({type:"auth/requestAuthorize",payload:!0}));case 2:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}Hr.set(Fw,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,qr();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),Hr.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.setFeatureFlagsForPreview=function(e){Hr.set(Object.assign({},Fw,e),o.name)},this.queryFeatureFlags=function(e){return Hr.getFeatureFlags(e,o.name)},this.updateLocalizationsSetter=function(e){o.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=o.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return o.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=o.getUserFromStore();return{entitlements:o.getEntitlementsFromStore(),attributes:{custom:e,jwt:t}}};var l=hw(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=Object.assign({},t,{contextOptions:Object.assign({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var d,u,y=this.options.authOptions?Object.assign({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(a=this.options.authOptions)?void 0:a.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!s&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=tw({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(d=this.options.authOptions)?d:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);D.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(i=t.authOptions)?void 0:i.enableSessionPerTenant}),Wo.setAppName(l)}var t,n,a,i;return U(e,[{key:"setEntitlementsOptions",value:function(e){Wo.setEntitlementsOptions(Object.assign({},e))}},{key:"setSessionContext",value:function(e){Wo.setSessionContext(Object.assign({},e))}},{key:"initContainers",value:(i=M(G().mark((function e(t){return G().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,this.loadFeatureFlags();case 9:return e.next=11,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize()]);case 11:this.options.previewMode||this.options.customLoginBox||(this.loadLoginBox(),n=this.name,a=void 0,void 0,o=void 0,null==(o=null==(i=vw.getInstance(n))||null==(a=i.integrations)?void 0:a.gtm)||o.filter((function(e){var t=e.id;return e.enabled&&function(e){return/^GTM-[a-zA-Z0-9]+$/.test(e)}(t)})).forEach((function(e){var t=e.id,n=document.createElement("script");n.innerHTML="\n (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n })(window,document,'script','dataLayer','".concat(t,"');\n "),document.body.appendChild(n)}))),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 13:case"end":return e.stop()}var n,a,i,o}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;vw.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,a){if(window[e])n(window[e]);else{var i=document.createElement("script");i.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),i.setAttribute("id","".concat(e,"Script")),i.setAttribute("cdn-url",t.cdnUrl),i.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:O})):n(window[e])},i.onerror=function(e){console.log("Profile page error",e),a(e)},document.body.append(i)}}))}},{key:"loadLoginBox",value:(a=M(G().mark((function e(){return G().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 a.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(t){var n,a,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(null!=t?t:{isMultiApp:!1}).isMultiApp,a=this.queryFeatureFlags(["multi-apps-admin-portal"]),i=C(a,1),o=i[0],Wo.setRequestSource(ua.AdminPortal),e.next=5,this.loadScript("FronteggAdminPortal");case 5:r=e.sent,this.adminPortalRenderer=r.render(this.adminPortalEl,{injector:this,options:Object.assign({isMultiApp:o&&n},this.options)});case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"openHostedAdminPortal",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.options.contextOptions.baseUrl,n="".concat(t,"/oauth/portal");e?window.open(n,"_blank"):window.location.href=n}},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),Aw(t),Wo.setRequestSource(null)}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=M(G().mark((function e(t){var n;return G().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,Object.assign({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:"getFeatureEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,a)=>(aw(),(0,nw.tE)(t,e,n)))(n.entitlements,e,n.attributes)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,a)=>(aw(),(0,nw.wJ)(t,e,n)))(n.entitlements,e,n.attributes)}},{key:"getEntitlements",value:function(e,t){return"permissionKey"in e?this.getPermissionEntitlements(e.permissionKey,t):this.getFeatureEntitlements(e.featureKey,t)}},{key:"loadEntitlements",value:function(e){this.store.dispatch({type:"auth/loadEntitlements",payload:{callback:e}})}},{key:"stepUp",value:function(e){var t=this.store.getState(),n=(null==t?void 0:t.auth)||{},a=n.hostedLoginBox,i=n.routes.stepUpUrl;a?this.store.dispatch({type:"auth/stepUpHostedLogin",payload:e}):((e,t,n)=>{kv();const a=new URLSearchParams(window.location.search);n&&a.set("maxAge",n.toString()),t(`${e}${a?`?${a}`:""}`,{refresh:!1})})(i,t.auth.onRedirectTo,null==e?void 0:e.maxAge)}},{key:"isSteppedUp",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=(null==(e=this.store.getState())?void 0:e.auth)||{},a=n.user;return Iv(a,t)}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),$w=function(){function e(){P(this,e)}return U(e,null,[{key:"setAuthentication",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",i=D.getInstance(a);e&&t?(Wo.setAccessToken(t),Wo.setUser(Object.assign({},n,{accessToken:t})),i.store.dispatch(za.setState({isLoading:!1,isAuthenticated:e,user:n})),i.store.dispatch(za.loadTenants())):(Wo.setAccessToken(null),Wo.setUser(null),i.store.dispatch(za.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),xw=function(){function e(){P(this,e)}return U(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).showAdminPortal()}},{key:"showMultiApp",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).showAdminPortal({isMultiApp:!0})}},{key:"openHosted",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";D.getInstance(t).openHostedAdminPortal(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).hideAdminPortal()}}]),e}(),Vw=function(){function e(){P(this,e)}return U(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";D.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";D.getInstance(e).hideCheckoutDialog()}}]),e}(),jw=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},Bw=function(){function e(t,n,a,i){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(a){if(this.store=a,!o&&a.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=tw({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},i),this.app=new Gw(this.options,t,!0),vw.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,a,i,o,r=this;return G().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,a=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return o=e.sent,this.app.adminPortalRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:a,setStaticRouteSetter:i}),this.app.loading=!1,e.next=13,bw(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}(),Ww="modern",zw=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[Ww]},Kw=function(){function e(t,n,a,i){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];P(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(a){if(this.store=a,!o&&a.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=tw({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=Object.assign({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},i),this.app=new Gw(this.options,t,!0,o),vw.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,a,i,o,r=this;return G().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,a=function(e){r.themeSetter=e},i=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return o=e.sent,this.app.loginBoxRenderer=o.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:a,setStaticRouteSetter:i,staticRoute:"/account/login"}),e.next=12,bw(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 Hw(e,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Hw(e,t)}function qw(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&&Hw(e,t)}function Jw(e,t){if(t&&("object"===_(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 Yw(e){return Yw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Yw(e)}function Xw(){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 Qw(e,t,n){return Qw=Xw()?Reflect.construct.bind():function(e,t,n){var a=[null];a.push.apply(a,t);var i=new(Function.bind.apply(e,a));return n&&Hw(i,n.prototype),i},Qw.apply(null,arguments)}function Zw(e){var t="function"==typeof Map?new Map:void 0;return Zw=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 Qw(e,arguments,Yw(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Hw(n,e)},Zw(e)}function eU(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,a=Yw(e);if(t){var i=Yw(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return Jw(this,n)}}var tU=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new Gw(e,t);if("undefined"!=typeof document){var a;if(!e.contextOptions.baseUrl){var i=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(i.message),i}if(!customElements.get("frontegg-app")){var o=function(e){qw(n,e);var t=eU(n);function n(){var e;P(this,n);for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];return(e=t.call.apply(t,[this].concat(i))).app=null,e}return U(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=D.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var a=mw(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),i=mw(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),o=mw(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=a.attachShadow({mode:"open"}),s=i.attachShadow({mode:"open"}),l=o.attachShadow({mode:"open"}),c=mw(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),d=mw(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),u=mw(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:d,adminPortalContainer:a,loginBoxContainer:i,checkoutDialogContainer:o,checkoutDialogEl:u})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(Zw(HTMLElement));customElements.define("frontegg-app",o)}null==(a=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||a.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}})(),a})()));