@frontegg/js 6.163.0 → 6.164.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,(function(){return function(){var e={987:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const i=n(651),o=n(82);t.createConditionEvaluator=function(e){const t=(0,o.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:a}=t(e.condition.value);if(!n||void 0===a)return()=>!1;const r=(0,i.useOperation)(e.condition.op,a);return t=>{const n=t[e.condition.attribute],{isValid:i}=void 0!==n&&r?r(n):{isValid:!1};return e.condition.negate?!i:i}}},898:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(987),t),o(n(371),t)},371:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const i=n(380);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,i.createRuleEvaluator)({rule:e})(t)===i.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},95:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(840),t)},314:function(e,t,n){"use strict";t.wJ=t.tE=void 0;n(95),n(380),n(379);var i=n(535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return i.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return i.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const a=n(379),r=n(615);o(n(615),t),o(n(226),t),t.BooleanOperationsMapper={[a.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},615:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},226:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const i=n(379);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={[i.OperationEnum.Is]:t.singleBooleanSanitizer}},651:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const i=n(943),o=n(610),a=n(4),r=n(195),s={...i.StringOperationsMapper,...o.NumericOperationsMapper,...a.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},82:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const i=n(195),o=n(903),a=n(886),r=n(610),s={...o.StringSanitizersMapper,...r.NumericSanitizersMapper,...a.DateSanitizersMapper,...i.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},4:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const a=n(379),r=n(569);o(n(569),t),o(n(931),t),t.DateOperationsMapper={[a.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[a.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[a.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[a.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},569:function(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()})}},886:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const i=n(379);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,i=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,i=e.end?(0,t.sanitizeDateValue)(e.end):void 0,o=n&&i&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(i)?{start:n,end:i}:void 0;return{isSanitized:!!o,sanitizedValue:o}},t.DateSanitizersMapper={[i.OperationEnum.On]:t.sanitizeSingleDate,[i.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[i.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[i.OperationEnum.BetweenDate]:t.sanitizeDateRange}},931:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},610:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const a=n(379),r=n(217);t.NumericOperationsMapper={[a.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[a.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[a.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[a.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[a.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[a.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},o(n(217),t),o(n(326),t),o(n(764),t)},217:function(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})}},326:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const i=n(379),o=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&o(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&&o(e.start)&&o(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[i.OperationEnum.Equal]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},764:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const a=n(379),r=n(431);o(n(431),t),o(n(97),t),t.StringOperationsMapper={[a.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[a.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[a.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[a.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[a.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},431:function(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)}}}},903:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const i=n(379),o=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&o(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=>o(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[i.OperationEnum.Matches]:t.sanitizeSingleString,[i.OperationEnum.Contains]:t.sanitizeListString,[i.OperationEnum.StartsWith]:t.sanitizeListString,[i.OperationEnum.EndsWith]:t.sanitizeListString,[i.OperationEnum.InList]:t.sanitizeListString}},97:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(982),t)},982:function(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"},380:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(930),t),o(n(304),t)},304:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const i=n(930),o=n(898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,o.createConditionEvaluator)({condition:e})(t)))?i.RuleEvaluationResultEnum.Treatable:i.RuleEvaluationResultEnum.Insufficient}},930:function(e,t){"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(i=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",i.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},950:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const i=n(137);function o(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function a(e,t){return Object.keys(e).reduce(((n,i)=>(n[`${t}${i}`]=e[i],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,i.flatten)(r);return{...n,...a(t?t(r):o(r),"frontegg."),...a(s,"jwt.")}},t.defaultFronteggAttributesMapper=o,t.modifyObjectKeysWithPrefix=a},137:function(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 i=(null==(t=t||{})?void 0:t.delimiter)||".",o=null==t?void 0:t.maxDepth,a=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const u=n[c],d=(null==t?void 0:t.safe)&&Array.isArray(u),y=Object.prototype.toString.call(u),f=(p=u)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+i+a(c):a(c);if(!d&&!f&&g&&Object.keys(u).length&&(!(null==t?void 0:t.maxDepth)||o&&l<o))return e(u,S,l+1);r[S]=u}))}(e),r}},535:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(405),t),o(n(113),t),o(n(950),t),o(n(387),t)},405:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=t.evaluateIsEntitledToFeature=void 0;const i=n(113),o=n(95),a=n(950),r=n(380),s=n(387);function l(e,t,n={}){const s=t.features[e];let l=!1;if(s&&null!==s.expireTime&&(l=s.expireTime!==i.NO_EXPIRATION_TIME&&s.expireTime<Date.now(),!l))return{isEntitled:!0};if(s&&s.featureFlag){const e=(0,a.prepareAttributes)(n),{treatment:t}=(0,o.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:l?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}t.evaluateIsEntitledToFeature=l,t.evaluateIsEntitledToPermissions=function(e,t,n){if(!(0,s.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const o=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!o.length)return{isEntitled:!0};let a=!1;for(const e of o){const{isEntitled:o,justification:r}=l(e,t,n);if(o)return{isEntitled:!0};r===i.NotEntitledJustification.BUNDLE_EXPIRED&&(a=!0)}return{isEntitled:!1,justification:a?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}},387:function(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},113:function(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},714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},378:function(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 i,o,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(o=i;0!=o--;)if(!e(t[o],n[o]))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((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=i;0!=o--;){var r=a[o];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new _(i||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(L([])));A&&A!==n&&a.call(A,l)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=O(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"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function O(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,O(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,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,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(E.prototype),d(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new E(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,l,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=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)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,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 i=n.completion;if("throw"===i.type){var o=i.arg;P(n)}return o}}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=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return qL},AdminPortalRenderer:function(){return QL},AppHolder:function(){return U},CheckoutDialog:function(){return JL},FronteggApp:function(){return KL},HostedLogin:function(){return HL},LoginBoxRenderer:function(){return ew},createElement:function(){return PL},defaultTheme:function(){return XL},formatName:function(){return IL},getThemeAdminByName:function(){return YL},getThemeByName:function(){return ZL},initialize:function(){return cw},mockFlagsList:function(){return zL},restoreSearchParams:function(){return LL},waitThemeSetter:function(){return _L}});var e={};n.r(e),n.d(e,{Delete:function(){return Fr},Get:function(){return Dr},Patch:function(){return Nr},Post:function(){return Rr},PostDownload:function(){return Gr},Put:function(){return Mr},extractHeadersFromOptions:function(){return $r},getBaseUrl:function(){return Lr},getMetadataHeaders:function(){return wr},getScopedTenant:function(){return Ur}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Br},loadFeatureFlags:function(){return Wr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return zr},getCurrentUserTenantsV1:function(){return Qr},getCurrentUserTenantsV3:function(){return Yr},getUsersGroups:function(){return Jr},getUsersRoles:function(){return qr},getUsersV2:function(){return Kr},getUsersV3:function(){return Hr},sendResetBreachedPasswordEmails:function(){return Xr},updateUserProfileV2:function(){return Zr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return ds},getParentTenants:function(){return ss},getParentTenantsById:function(){return ls},getSubTenants:function(){return as},getSubTenantsAsTree:function(){return rs},getTenants:function(){return os},getTenantsUsersCount:function(){return cs},searchSubTenants:function(){return us},switchTenant:function(){return is}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return zs},loadEntitlementsV2:function(){return Ks}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return Oi},MachineToMachineAuthStrategy:function(){return Ii},OAuthLogout:function(){return El},SocialLoginProviders:function(){return ki},acceptInvitation:function(){return hl},activateAccount:function(){return fl},activateAccountV2:function(){return pl},bulkCreateIPRestriction:function(){return Cs},changePhoneNumber:function(){return Iu},changePhoneNumberWithVerification:function(){return ku},checkIfAllowToRememberMfaDevice:function(){return qc},createDomainRestriction:function(){return Is},createIPRestriction:function(){return Us},createOrUpdateSessionConfigrations:function(){return Cc},createSSOConfiguration:function(){return eu},createSSOConfigurationByMetadata:function(){return iu},createSSOConfigurationByMetadataUrl:function(){return au},createSSODomain:function(){return su},createSSOGroup:function(){return yu},createSamlGroup:function(){return Sc},createTenantAccessToken:function(){return Vc},createUserAccessToken:function(){return $c},deleteAllSessionsForUser:function(){return Rc},deleteDomainRestriction:function(){return _s},deleteIPRestriction:function(){return Rs},deleteSSOConfiguration:function(){return nu},deleteSSODomain:function(){return lu},deleteSSOGroup:function(){return pu},deleteSamlGroup:function(){return hc},deleteSessionForUser:function(){return Dc},deleteTenantAccessToken:function(){return Fc},deleteTenantApiToken:function(){return zc},deleteUserAccessToken:function(){return Gc},deleteUserApiToken:function(){return Kc},deleteWebAuthnDevice:function(){return Cu},disableMFAAuthenticatorApp:function(){return Fl},disableMFASMS:function(){return $l},disableMFAWebAuthn:function(){return xl},disableMfa:function(){return Ml},enrollMFAAuthenticatorApp:function(){return wl},enrollMFAAuthenticatorAppForLogin:function(){return Wl},enrollMFAAuthenticatorAppForLoginV2:function(){return zl},enrollMFASMS:function(){return Cl},enrollMFASMSForLogin:function(){return Ql},enrollMFASMSForLoginV2:function(){return Xl},enrollMFAWebAuthn:function(){return Rl},enrollMFAWebAuthnForLogin:function(){return ic},enrollMFAWebAuthnForLoginV2:function(){return oc},enrollMfa:function(){return _l},exchangeOAuthTokens:function(){return Au},exchangeOAuthTokensV2:function(){return hu},forgotPassword:function(){return kl},generateLoginResponse:function(){return Xs},generateLoginResponseFromOAuthResponse:function(){return il},generateLoginResponseFromOAuthResponseV2:function(){return ol},generateLoginResponseV2:function(){return Zs},generateLoginResponseV3:function(){return nl},generateStepupSession:function(){return Vu},getActivateAccountStrategy:function(){return gl},getCaptchaPolicy:function(){return ms},getCurrentUserSession:function(){return Lc},getCurrentUserSessions:function(){return _c},getCurrentUserTenantsFunction:function(){return ns},getCustomSocialLoginProvidersV1:function(){return kc},getDomainRestrictions:function(){return ks},getDomainRestrictionsConfig:function(){return Os},getGlobalSecurityPolicy:function(){return ys},getIPRestrictions:function(){return Ls},getIPRestrictionsConfig:function(){return ws},getLockoutPolicy:function(){return Ss},getMFADevices:function(){return jl},getMFAStrategiesConfig:function(){return Mu},getMeAndEntitlements:function(){return $u},getMeV2:function(){return Gu},getMfaPolicy:function(){return fs},getOidcConfiguration:function(){return mc},getPasswordConfigPolicy:function(){return Es},getPasswordHistoryPolicy:function(){return As},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Nu},getSSOConfigurations:function(){return Zc},getSSODefaultRoles:function(){return uu},getSSOGroups:function(){return gu},getSSOPublicConfiguration:function(){return Ac},getSamlConfiguration:function(){return lc},getSamlRoles:function(){return fc},getSamlRolesGroups:function(){return pc},getSamlVendorConfiguration:function(){return uc},getSessionConfigurations:function(){return Uc},getSocialLoginProviders:function(){return bc},getSocialLoginProvidersV2:function(){return Tc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Ec},getTabTenantFromSessionStorage:function(){return ts},getTenantAccessTokensData:function(){return Mc},getTenantApiTokensData:function(){return jc},getUserAccessTokensData:function(){return Nc},getUserApiTokensData:function(){return xc},getUserAuthorization:function(){return Fu},getUserById:function(){return Hc},getVendorConfig:function(){return Ic},getVendorLockoutPolicy:function(){return vs},getVendorMfaPolicy:function(){return ps},getVendorPasswordHistoryPolicy:function(){return bs},getVendorPublicAuthStrategiesConfig:function(){return Ru},getWebAuthnDevices:function(){return Uu},loadPasswordConfig:function(){return Il},login:function(){return cl},loginViaSocialLogin:function(){return Oc},loginWithMfa:function(){return dl},loginWithMfaV2:function(){return yl},loginv2:function(){return ul},logout:function(){return Tl},oidcPostLogin:function(){return ll},oidcPostLoginV2:function(){return vu},passwordlessPostLogin:function(){return Qc},passwordlessPostLoginV2:function(){return Yc},passwordlessPreLogin:function(){return Jc},postLogin:function(){return sl},preDisableMFASMS:function(){return Gl},preDisableMFAWebAuthn:function(){return Vl},preEnrollMFAAuthenticatorApp:function(){return Ll},preEnrollMFAAuthenticatorAppForLogin:function(){return Bl},preEnrollMFASMS:function(){return Ul},preEnrollMFASMSForLogin:function(){return Yl},preEnrollMFAWebAuthn:function(){return Dl},preEnrollMFAWebAuthnForLogin:function(){return nc},preLogin:function(){return al},preLoginV2:function(){return Su},preLoginWithIdpType:function(){return rl},preVerifyMFAEmailCode:function(){return Hl},preVerifyMFASMSForLogin:function(){return Zl},preVerifyMFAWebAuthnForLogin:function(){return ac},recoverMfaToken:function(){return Pl},refreshToken:function(){return ml},refreshTokenV2:function(){return Al},refreshTokenV3:function(){return bl},resendActivationEmail:function(){return Sl},resendInvitationEmail:function(){return vl},resetPassword:function(){return Ol},resetPhoneNumber:function(){return Tu},revokeSessionsForUser:function(){return wc},saveLockoutPolicy:function(){return hs},saveMfaPolicy:function(){return gs},savePasswordHistoryPolicy:function(){return Ts},setSSODefaultRoles:function(){return du},setTabTenantInSessionStorage:function(){return es},signUpUser:function(){return Pc},silentOAuthRefreshToken:function(){return bu},silentOAuthRefreshTokenV2:function(){return mu},testCurrentIp:function(){return Ns},testCurrentIpInAllowList:function(){return Ms},updateDomainRestrictionConfig:function(){return Ps},updateIPRestrictionConfig:function(){return Ds},updateSSOConfiguration:function(){return tu},updateSSOConfigurationByMetadata:function(){return ou},updateSSOConfigurationByMetadataUrl:function(){return ru},updateSSOGroup:function(){return fu},updateSamlConfiguration:function(){return cc},updateSamlGroup:function(){return vc},updateSamlRoles:function(){return gc},updateSamlVendorMetadata:function(){return dc},updateTenantApiTokensData:function(){return Wc},updateUserApiTokensData:function(){return Bc},validateSSODomain:function(){return cu},validateSamlDomain:function(){return yc},verifyChangePhoneNumber:function(){return Ou},verifyInviteToken:function(){return Xc},verifyMFAAuthenticatorAppForLogin:function(){return Kl},verifyMFAEmailCode:function(){return ql},verifyMFAEmailCodeV2:function(){return Jl},verifyMFASMSForLogin:function(){return ec},verifyMFASMSForLoginV2:function(){return tc},verifyMFAWebAuthnForLogin:function(){return rc},verifyMFAWebAuthnForLoginV2:function(){return sc},verifyMfa:function(){return Nl},verifyNewDeviceSession:function(){return Du},verifyResetPhoneNumber:function(){return Eu},webAuthnCreateNewDeviceSession:function(){return wu},webAuthnPostLogin:function(){return _u},webAuthnPostLoginV2:function(){return Lu},webAuthnPreLogin:function(){return Pu}});var l={};n.r(l),n.d(l,{addUser:function(){return Ku},changePassword:function(){return Wu},createInviteUserLink:function(){return Xu},deleteInviteUserLink:function(){return ed},deleteUser:function(){return Hu},getInviteLinkConfiguration:function(){return nd},getInviteUserLink:function(){return td},getProfile:function(){return xu},getTemporaryUserConfiguration:function(){return Qu},loadAvailablePermissions:function(){return od},loadAvailableRoles:function(){return id},loadStats:function(){return ad},loadUsers:function(){return zu},resendActivationLink:function(){return rd},resendInvitationLink:function(){return sd},resendInvitationLinkToAllTenants:function(){return ld},setPermanentUser:function(){return Yu},updateInviteUserLink:function(){return Zu},updateProfile:function(){return ju},updateProfileImage:function(){return Bu},updateUser:function(){return qu},updateUserExpirationTime:function(){return Ju}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return ud},getAuditsMetadata:function(){return gd},getCurrentUserIpMetadata:function(){return yd},getIpAdressMetadata:function(){return Sd},getNotificationsMetadata:function(){return fd},getSamlMetadata:function(){return pd},updateAdminBoxMetadata:function(){return dd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return kd},getReport:function(){return bd},getReports:function(){return Ad},renderReport:function(){return Td},scheduleReport:function(){return Ed},sendReport:function(){return Od}});var d={};n.r(d),n.d(d,{getNotifications:function(){return Id},markAllAsRead:function(){return Ld},updateNotificationIsPinned:function(){return _d},updateNotificationStatus:function(){return Pd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Dd},getAudits:function(){return Ud},getAuditsStats:function(){return Cd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Hd},deleteEmailSubscriptions:function(){return zd},deleteSMSConfiguration:function(){return Zd},deleteSMSSubscriptions:function(){return Qd},deleteSlackConfiguration:function(){return Vd},deleteWebhooksConfiguration:function(){return ny},getCategories:function(){return ry},getChannelMaps:function(){return sy},getEmailConfiguration:function(){return jd},getSMSConfiguration:function(){return qd},getSlackChannels:function(){return Gd},getSlackConfiguration:function(){return Md},getSlackScope:function(){return Fd},getWebhookLog:function(){return iy},getWebhooksConfigurations:function(){return ey},patchEmailConfiguration:function(){return Wd},patchSMSConfiguration:function(){return Yd},postEmailConfiguration:function(){return Bd},postSMSConfiguration:function(){return Jd},postSlackCode:function(){return xd},postSlackConfiguration:function(){return $d},postWebhookRetry:function(){return ay},postWebhookTest:function(){return oy},postWebhooksConfiguration:function(){return ty},putEmailSubscriptions:function(){return Kd},putSMSSubscriptions:function(){return Xd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return uy},getSettings:function(){return cy},updateSettings:function(){return ly}});var g={};n.r(g),n.d(g,{addRole:function(){return gy},attachPermissionToRoles:function(){return Ay},attachPermissionsToRole:function(){return hy},deleteRole:function(){return Sy},getPermissionCategories:function(){return by},getPermissions:function(){return my},getRoles:function(){return py},updateRole:function(){return vy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Qy},PaymentMethodType:function(){return Xy},ProviderType:function(){return ef},TenantCreatedAction:function(){return nf},TrialEndAction:function(){return tf},cancelManagedSubscription:function(){return Ly},cancelSubscription:function(){return ky},createStripeCustomer:function(){return By},createStripePaymentMethodSetupIntentSecret:function(){return zy},createSubscription:function(){return xy},createTenantConfiguration:function(){return qy},getManagedSubscription:function(){return Py},getManagedSubscriptions:function(){return _y},getPaymentMethod:function(){return $y},getPaymentMethods:function(){return Gy},getPaymentProviders:function(){return Jy},getStripeCustomer:function(){return jy},getStripePaymentProviderConfiguration:function(){return Wy},getSubscription:function(){return Ey},getSubscriptionInvoice:function(){return Ny},getSubscriptionInvoicePdf:function(){return My},getSubscriptionInvoices:function(){return Ry},getSubscriptionPlan:function(){return Dy},getSubscriptionPlans:function(){return Cy},getSubscriptionSummaries:function(){return Ky},getSubscriptions:function(){return Ty},getTenantConfiguration:function(){return Hy},getVendorPublicConfigurations:function(){return Yy},renewManagedSubscription:function(){return wy},renewSubscription:function(){return Oy},updateManagedSubscription:function(){return Uy},updatePaymentMethodBillingDetails:function(){return Vy},updateSubscription:function(){return Iy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return of}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return lf},addUserToTenantAndSubTenants:function(){return rf},addUsersToSubTenant:function(){return gf},createSubTenant:function(){return df},deleteSubTenant:function(){return yf},loadAllUsers:function(){return af},removeUserFromTenantAndSubTenants:function(){return sf},removeUserRolesFromSubTenants:function(){return cf},setUserRolesForSubTenants:function(){return uf},updateSubAccountAccess:function(){return pf},updateSubTenant:function(){return ff}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},deleteConfiguration:function(){return mf},getConfigs:function(){return Sf},updateConfiguration:function(){return vf}});var A={};n.r(A),n.d(A,{impersonate:function(){return bf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Lf},addUsersToGroup:function(){return Uf},createGroup:function(){return If},deleteGroup:function(){return _f},deleteRolesFromGroup:function(){return wf},deleteUsersFromGroup:function(){return Cf},getGroupById:function(){return Ef},getGroupConfiguration:function(){return Df},getGroups:function(){return kf},getGroupsByIds:function(){return Of},updateGroup:function(){return Pf},updateGroupConfiguration:function(){return Rf}});var T={};n.r(T),n.d(T,{getInsights:function(){return Mf},getRecommendations:function(){return Nf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Gf},deletePhoneNumber:function(){return $f},getUserPhoneNumbers:function(){return Ff},preVerifyPhoneNumber:function(){return Vf},verifyDeletePhoneNumber:function(){return jf},verifyPhoneNumber:function(){return xf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return qs},AuthStrategyEnum:function(){return Oi},ContextHolder:function(){return xa},FeatureFlags:function(){return Br},FronteggApiError:function(){return Ba},FronteggContext:function(){return ja},FronteggFrameworks:function(){return di},GetUsersFilterPreset:function(){return pi},GroupManagedByEnum:function(){return ep},GroupRelations:function(){return Zf},ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Qy},InsightCode:function(){return np},LOAD_AUTHORIZATION_FF:function(){return Ws},MFAStrategyEnum:function(){return Bs},MachineToMachineAuthStrategy:function(){return Ii},NotEntitledJustification:function(){return Hs},PaginationOrderEnum:function(){return yi},PaymentMethodType:function(){return Xy},ProviderType:function(){return ef},RecommendationActionKey:function(){return ip},RecommendationCode:function(){return tp},RecommendationSeverity:function(){return op},RequestSource:function(){return ui},RestrictionType:function(){return zn},ScimConnectionSource:function(){return Xf},SecondaryAuthStrategy:function(){return xs},SecurityCategory:function(){return ap},SocialLoginProviders:function(){return ki},SortByEnum:function(){return fi},TenantSortByEnum:function(){return Wf},TenantType:function(){return zf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return xr},UserManagedByEnum:function(){return Bf},WebAuthnDeviceType:function(){return js},api:function(){return rp},countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},default:function(){return sp},deleteConfiguration:function(){return mf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Kf},fronteggHeaders:function(){return ci},fronteggRefreshTokenUrl:function(){return Hf},fronteggSilentRefreshTokenUrl:function(){return qf},fronteggTenantsUrl:function(){return Yf},fronteggTenantsV3Url:function(){return Qf},fronteggUsersUrl:function(){return Jf},getConfigs:function(){return Sf},getCurrentUserTenantsFunction:function(){return ns},getTabTenantFromSessionStorage:function(){return ts},loadFeatureFlags:function(){return Wr},providersArray:function(){return gi},setTabTenantInSessionStorage:function(){return es},updateConfiguration:function(){return vf}});var O={};function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="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},P(e)}function _(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_(i.key),i)}}function w(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(O),n.d(O,{AccountDetailsPageTabs:function(){return xL},AccountPageFields:function(){return RL},DomainRestrictionsTabFields:function(){return VL},GeneralSettingsTabFields:function(){return GL},InviteUserModalFields:function(){return DL},IpRestrictionsTabFields:function(){return $L},Metadata:function(){return OL},PrivacyPageFields:function(){return CL},ProfilePageFields:function(){return UL},SecurityPageTabs:function(){return ML},SessionManagementTabFields:function(){return FL},SignupFields:function(){return wL},SubscriptionsPageFields:function(){return NL},alpha:function(){return hL},fieldAppearance:function(){return jL},tabAppearance:function(){return BL}});var U=function(){function e(){I(this,e)}return w(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function D(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 i,o,a,r,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(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)?C(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 R(){return R=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},R.apply(this,arguments)}function N(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){N(a,i,o,r,s,"next",e)}function s(e){N(a,i,o,r,s,"throw",e)}r(void 0)}))}}U._apps={};var F=n(841),G=n.n(F);function $(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function V(e){return!!e&&!!e[Ie]}function x(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)===Pe}(e)||Array.isArray(e)||!!e[Oe]||!!e.constructor[Oe]||H(e)||q(e))}function j(e,t,n){void 0===n&&(n=!1),0===B(e)?(n?Object.keys:_e)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function B(e){var t=e[Ie];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:H(e)?2:q(e)?3:0}function W(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,n){var i=B(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function H(e){return be&&e instanceof Map}function q(e){return Te&&e instanceof Set}function J(e){return e.o||e.t}function Y(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Ie];for(var n=_e(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function Q(e,t){return void 0===t&&(t=!1),Z(e)||V(e)||!x(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=X),Object.freeze(e),t&&j(e,(function(e,t){return Q(t,!0)}),!0)),e}function X(){$(2)}function Z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ee(e){var t=we[e];return t||$(18,e),t}function te(){return me}function ne(e,t){t&&(ee("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(re),e.p=null}function oe(e){e===me&&(me=e.l)}function ae(e){return me={p:[],l:me,h:e,m:!0,_:0}}function re(e){var t=e[Ie];0===t.i||1===t.i?t.j():t.O=!0}function se(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||ee("ES5").S(t,e,i),i?(n[Ie].P&&(ie(t),$(4)),x(e)&&(e=le(t,e),t.l||ue(t,e)),t.u&&ee("Patches").M(n[Ie].t,e,t.u,t.s)):e=le(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function le(e,t,n){if(Z(t))return t;var i=t[Ie];if(!i)return j(t,(function(o,a){return ce(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ue(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=Y(i.k):i.o;j(3===i.i?new Set(o):o,(function(t,a){return ce(e,i,o,t,a,n)})),ue(e,o,!1),n&&e.u&&ee("Patches").R(i,n,e.u,e.s)}return i.o}function ce(e,t,n,i,o,a){if(V(o)){var r=le(e,o,a&&t&&3!==t.i&&!W(t.D,i)?a.concat(i):void 0);if(z(n,i,r),!V(r))return;e.m=!1}if(x(o)&&!Z(o)){if(!e.h.F&&e._<1)return;le(e,o),t&&t.A.l||ue(e,o)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&Q(t,n)}function de(e,t){var n=e[Ie];return(n?J(n):e)[t]}function ye(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function fe(e){e.P||(e.P=!0,e.l&&fe(e.l))}function pe(e){e.o||(e.o=Y(e.t))}function ge(e,t,n){var i=H(t)?ee("MapSet").N(t,n):q(t)?ee("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:te(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ue;n&&(o=[i],a=Ce);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):ee("ES5").J(t,n);return(n?n.A:te()).p.push(i),i}function Se(e){return V(e)||$(22,e),function e(t){if(!x(t))return t;var n,i=t[Ie],o=B(t);if(i){if(!i.P&&(i.i<4||!ee("ES5").K(i)))return i.t;i.I=!0,n=ve(t,o),i.I=!1}else n=ve(t,o);return j(n,(function(t,o){i&&function(e,t){return 2===B(e)?e.get(t):e[t]}(i.t,t)===o||z(n,t,e(o))})),3===o?new Set(n):n}(e)}function ve(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Y(e)}var he,me,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),be="undefined"!=typeof Map,Te="undefined"!=typeof Set,Ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((he={})["immer-nothing"]=!0,he),Oe=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Ie=Ae?Symbol.for("immer-state"):"__$immer_state",Pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),_e="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return _e(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},we={},Ue={get:function(e,t){if(t===Ie)return e;var n=J(e);if(!W(n,t))return function(e,t,n){var i,o=ye(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!x(i)?i:i===de(e.t,t)?(pe(e),e.o[t]=ge(e.A.h,i,e)):i},has:function(e,t){return t in J(e)},ownKeys:function(e){return Reflect.ownKeys(J(e))},set:function(e,t,n){var i=ye(J(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=de(J(e),t),a=null==o?void 0:o[Ie];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(K(n,o)&&(void 0!==n||W(e.t,t)))return!0;pe(e),fe(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!==de(e.t,t)||t in e.t?(e.D[t]=!1,pe(e),fe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=J(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){$(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){$(12)}},Ce={};j(Ue,(function(e,t){Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)},Ce.set=function(e,t,n){return Ue.set.call(this,e[0],t,n,e[0])};var De=function(){function e(e){var t=this;this.g=Ee,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&$(6),void 0!==i&&"function"!=typeof i&&$(7),x(e)){var s=ae(t),l=ge(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 ne(s,i),se(e,s)}),(function(e){throw ie(s),e})):(ne(s,i),se(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),i){var u=[],d=[];ee("Patches").M(e,r,u,d),i(u,d)}return r}$(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){x(e)||$(8),V(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Ie].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Ie]).A;return ne(n,t),se(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ee&&$(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=ee("Patches").$;return V(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Re=new De,Ne=Re.produce,Me=(Re.produceWithPatches.bind(Re),Re.setAutoFreeze.bind(Re),Re.setUseProxies.bind(Re),Re.applyPatches.bind(Re),Re.createDraft.bind(Re),Re.finishDraft.bind(Re),Ne);function Fe(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(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 xe="function"==typeof Symbol&&Symbol.observable||"@@observable",je=function(){return Math.random().toString(36).substring(7).split("").join(".")},Be={INIT:"@@redux/INIT"+je(),REPLACE:"@@redux/REPLACE"+je(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+je()}};function We(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 ze(e,t,n){var i;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(ze)(e,t)}if("function"!=typeof e)throw new Error(Ve(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(Ve(3));return a}function d(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(!We(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,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(Ve(10));o=e,y({type:Be.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ve(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[xe]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[xe]=p,i}function Ke(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Be.INIT}))throw new Error(Ve(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(Ve(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(Ve(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function He(){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 qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(Ve(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=He.apply(void 0,a)(n.dispatch),$e($e({},n),{},{dispatch:i})}}}function Je(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ye=Je();Ye.withExtraArgument=Je;var Qe,Xe=Ye,Ze=(Qe=function(e,t){return Qe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Qe(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Qe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),et=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},tt=Object.defineProperty,nt=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,at=function(e,t,n){return t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},rt=function(e,t){for(var n in t||(t={}))it.call(t,n)&&at(e,n,t[n]);if(nt)for(var i=0,o=nt(t);i<o.length;i++)n=o[i],ot.call(t,n)&&at(e,n,t[n]);return e},st="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?He:He.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var lt=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ze(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,et([void 0],e[0].concat(this)))):new(t.bind.apply(t,et([void 0],e.concat(this))))},t}(Array);function ct(e){return x(e)?Me(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new lt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Xe):i.push(Xe.withExtraArgument(n.extraArgument))),i}function dt(e){var t,n=function(e){return ut(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ke(a)}var p=s;"function"==typeof p&&(p=p(n));var g=qe.apply(void 0,p),S=He;c&&(S=st(rt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=et([g],f):"function"==typeof f&&(v=f(v)),ze(t,d,S.apply(void 0,v))}function yt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return rt(rt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ft(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function pt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ct(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ft(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=rt(rt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ft(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return ct(e())};else{var c=ct(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=et([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(V(e))return void 0===(i=n(e,t))?e:i;if(x(e))return Me(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?yt(c,i):yt(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 gt="listenerMiddleware";yt(gt+"/add"),yt(gt+"/removeAll"),yt(gt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Ie];return Ue.get(t,e)},set:function(t){var n=this[Ie];Ue.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Ie];if(!o.P)switch(o.i){case 5:i(o)&&fe(o);break;case 4:n(o)&&fe(o)}}}function n(e){for(var t=e.t,n=e.k,i=_e(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Ie){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],l=s&&s[Ie];if(l?l.t!==r:!K(s,r))return!0}}var c=!!t[Ie];return i.length!==_e(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){we[e]||(we[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Le(n);delete a[Ie];for(var r=_e(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:te(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Ie,{value:a,writable:!0}),o},S:function(e,n,o){o?V(n)&&n[Ie].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Ie];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Ie&&(void 0!==o[t]||W(o,t)?r[t]||e(a[t]):(r[t]=!0,fe(n)))})),j(o,(function(e){void 0!==a[e]||W(a,e)||(r[e]=!1,fe(n))}));else if(5===s){if(i(n)&&(fe(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const St=(e,t)=>n=>R({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return R({},n,{[e]:R({},n[e],{[t]:R({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),mt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i,o;return R({},t,{[e]:R({},t[e],{loaders:R({},null==(i=t[e])?void 0:i.loaders,{[n.key]:null==(o=n.value)||o})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return R({},t,{[e]:R({},t[e],{errors:R({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),bt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),Tt=(e,t,n)=>i=>{var o;return R({},i,{[e]:R({},i[e],{[t]:R({},null==i||null==(o=i[e])?void 0:o[t],n)})})},Et=(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 It=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=Ot[e.charCodeAt(i)],a=Ot[e.charCodeAt(i+1)],r=Ot[e.charCodeAt(i+2)],s=Ot[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=kt[t[i]>>2],o+=kt[(3&t[i])<<4|t[i+1]>>4],o+=kt[(15&t[i+1])<<2|t[i+2]>>6],o+=kt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Pt(e[n]);return t}return e};let _t,Lt,wt,Ut;!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"}(_t||(_t={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(wt||(wt={})),function(e){e["social-login"]="social-login",e["custom-social-login"]="custom-social-login",e.direct="direct"}(Ut||(Ut={}));const Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Dt="HOSTED_LOGIN_VERIFIER_KEY",Rt="auth",Nt="connectivity",Mt="auditLogs",Ft="vendor",Gt={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},$t={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Gt})},Vt={requestAuthorize:yt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:yt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:yt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:yt("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:yt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:yt("auth/afterAuthNavigation"),preLogin:yt("auth/preLogin",(e=>({payload:e}))),postLogin:yt("auth/postLogin",(e=>({payload:e}))),login:yt("auth/login",(e=>({payload:e}))),loginWithMfa:yt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:yt("auth/recoverMfa",(e=>({payload:e}))),logout:yt("auth/logout",(e=>({payload:e}))),silentLogout:yt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:yt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:yt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:yt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:yt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:yt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:yt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:yt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:yt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:yt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:yt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:yt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:yt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:yt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:yt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:yt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:yt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:yt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:yt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:yt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:yt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:yt("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:yt("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:yt("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:yt("auth/resetBreachedPassword",(e=>({payload:e})))};let xt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(xt||(xt={}));const jt={step:xt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Bt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:jt}),setActivateStrategyState:ht("activateState","activationStrategy")},Wt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let zt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(zt||(zt={}));const Kt={step:zt.validate},Ht={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:Kt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Jt||(Jt={}));const Yt={step:Jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Qt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Yt})},Xt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Zt||(Zt={}));const en={step:Zt.ResetPhoneNumber,loading:!1},tn={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:en})},nn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},an={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:on})},rn={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},sn={loading:!1,error:null},ln={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:sn})},cn={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("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 dn={step:un.verify,loading:!1,saving:!1},yn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:dn})},fn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},pn={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}},gn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:pn})},Sn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},vn={firstLoad:!0,loading:!1,error:""},hn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:vn})},mn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const bn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},Tn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:bn})},En={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("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:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:kn})},In={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},Pn={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}},_n={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:Pn})},Ln={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},wn={loading:!1},Un={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:wn})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Dn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Rn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Dn})},Nn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Mn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Fn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Mn})},Gn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},$n={loading:!1,sessions:[]},Vn={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:$n})},xn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},jn={loading:!1,configurations:{}},Bn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:jn})},Wn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let zn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(zn||(zn={}));const Kn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:zn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Hn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},qn={checkIfUserIpValid:yt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:yt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:yt("auth/loadIpRestrictions"),saveIpRestriction:yt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:yt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:yt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:yt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:yt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:yt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:yt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Jn={loading:!1},Yn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Jn})},Qn={loadProvisionConnections:yt("auth/loadProvisionConnections"),createProvisionConnection:yt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:yt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:yt("auth/updateProvisionConnection",(e=>({payload:e})))},Xn={devices:[],loading:!1,error:null},Zn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Xn})},ei={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ti={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ni={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ti})},ii={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},oi={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}},ai={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:oi}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ri={loading:!0,error:null},si={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ri})},li={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},ci={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ui,di,yi,fi,pi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ui||(ui={})),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"}(di||(di={})),function(e){e.ASC="ASC",e.DESC="DESC"}(yi||(yi={})),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"}(fi||(fi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(pi||(pi={}));const gi=["local","saml","google","github","facebook","microsoft","scim2","slack"],Si={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:yi.DESC,_sortBy:fi.name},usersPageOffset:0,accountSettings:{}}},vi={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:Si})},hi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},mi={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},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:[]}},Ai={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:mi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",mi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",mi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",mi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",mi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",mi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",mi.editUserRolesDialog)},bi={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}}},Ti={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:bi}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ei={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let ki,Oi,Ii;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ki||(ki={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Oi||(Oi={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Ii||(Ii={}));const Pi={[Oi.Code]:_t.loginWithOtc,[Oi.EmailAndPassword]:_t.loginWithPassword,[Oi.MagicLink]:_t.magicLinkPreLoginSuccess,[Oi.SmsCode]:_t.loginWithSmsOtc},_i={loading:!1,error:null,phoneNumbers:void 0},Li={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:_i})},wi={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},Ui={loading:!1,mfaDevices:void 0,mfaToken:""},Ci={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:Ui})},Di={generateStepUpSession:yt("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:yt("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:yt("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:yt("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:yt("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:yt("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:yt("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:yt("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Ri={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:bn,loginState:Gt,stepUpState:Ui,activateState:jt,acceptInvitationState:Kt,forgotPasswordState:Yt,ssoState:on,profileState:sn,customLoginState:ri,mfaState:dn,teamState:pn,groupsState:ti,groupsDialogsState:oi,socialLoginState:vn,apiTokensState:kn,securityPolicyState:Pn,accountSettingsState:wn,tenantsState:Dn,rolesState:Mn,resetPhoneNumberState:en,sessionsState:$n,sessionsPolicyState:jn,restrictionsState:Kn,provisioningState:Jn,passkeysState:Xn,allAccountsState:Si,allAccountsDialogsState:mi,securityCenterState:bi,smsState:_i},Ni=R({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"},onRedirectTo:()=>{}},Ri);let Mi;!function(e){e.impersonating="impersonating",e.success="success"}(Mi||(Mi={}));const Fi={step:Mi.impersonating,loading:!1},Gi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Fi})},$i={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:Vi,actions:xi}=pt({name:Rt,initialState:Ni,reducers:R({resetState:e=>R({},e,Ri),setState:(e,{payload:t})=>R({},e,t),setUser:("user",(e,{payload:t})=>R({},e,{user:t})),setEntitlements:ht("user","entitlements")},$t,Ci,hn,Bt,Gi,Ht,Qt,tn,Tn,ln,si,an,yn,gn,ni,ai,On,_n,Un,Rn,Fn,Vn,Bn,Hn,Yn,Zn,vi,Ai,Ti,Li)});const ji=R({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},xi,Vt,Di,mn,Wt,qt,Xt,nn,En,cn,li,rn,fn,Sn,ii,{},In,Ln,Cn,Nn,Gn,xn,Wn,qn,Qn,$i,ei,hi,Ei,wi);var Bi=function(e){return"@@redux-saga/"+e},Wi=Bi("CANCEL_PROMISE"),zi=Bi("CHANNEL_END"),Ki=Bi("IO"),Hi=Bi("MATCH"),qi=Bi("MULTICAST"),Ji=Bi("SAGA_ACTION"),Yi=Bi("SELF_CANCELLATION"),Qi=Bi("TASK"),Xi=Bi("TASK_CANCEL"),Zi=Bi("TERMINATE"),eo=Bi("LOCATION");function to(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var no=function(e){return null==e},io=function(e){return null!=e},oo=function(e){return"function"==typeof e},ao=function(e){return"string"==typeof e},ro=Array.isArray,so=function(e){return e&&oo(e.then)},lo=function(e){return e&&oo(e.next)&&oo(e.throw)},co=function e(t){return t&&(ao(t)||fo(t)||oo(t)||ro(t)&&t.every(e))},uo=function(e){return e&&oo(e.take)&&oo(e.close)},yo=function(e){return oo(e)&&e.hasOwnProperty("toString")},fo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},po=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Wi]=function(){clearTimeout(n)},i},go=function(e){return function(){return e}},So=go(!0),vo=function(){},ho=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var mo=function(e,t){R(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ao(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var bo=function(e){throw e},To=function(e){return{value:e,done:!0}};function Eo(e,t,n){void 0===t&&(t=bo),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:To,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function ko(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Oo=function(e){return Array.apply(null,new Array(e))},Io=function(e){return function(t){return e(Object.defineProperty(t,Ji,{value:!0}))}},Po=function(e){return e===Zi},_o=function(e){return e===Xi},Lo=function(e){return Po(e)||_o(e)};function wo(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ro(e)?Oo(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Lo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=vo,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Uo(e){return{name:e.name||"anonymous",location:Co(e)}}function Co(e){return e[eo]}var Do=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Ro="TAKE",No="CALL",Mo="FORK",Fo="SELECT",Go=function(e,t){var n;return(n={})[Ki]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function $o(e,t){return void 0===e&&(e="*"),co(e)?(io(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Go(Ro,{pattern:e})):uo(n=e)&&n[qi]&&io(t)&&co(t)?Go(Ro,{channel:e,pattern:t}):uo(e)?(io(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Go(Ro,{channel:e})):void 0;var n}function Vo(e,t){return no(t)&&(t=e,e=void 0),Go("PUT",{channel:e,action:t})}function xo(e){var t=Go("ALL",e);return t.combinator=!0,t}function jo(e,t){var n,i=null;return oo(e)?n=e:(ro(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ao(n)&&oo(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Bo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(No,jo(e,n))}function Wo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Mo,jo(e,n))}function zo(e){return void 0===e&&(e=Yi),Go("CANCEL",e)}function Ko(e){void 0===e&&(e=ho);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Fo,{selector:e,args:n})}var Ho=Bo.bind(null,po);var qo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Jo=[],Yo=0;function Qo(e){try{ea(),e()}finally{ta()}}function Xo(e){Jo.push(e),Yo||(ea(),na())}function Zo(e){try{return ea(),e()}finally{na()}}function ea(){Yo++}function ta(){Yo--}function na(){var e;for(ta();!Yo&&void 0!==(e=Jo.shift());)Qo(e)}var ia=function(e){return function(t){return e.some((function(e){return la(e)(t)}))}},oa=function(e){return function(t){return e(t)}},aa=function(e){return function(t){return t.type===String(e)}},ra=function(e){return function(t){return t.type===e}},sa=function(){return So};function la(e){var t="*"===e?sa:ao(e)?aa:ro(e)?ia:yo(e)?aa:oo(e)?oa:fo(e)?ra:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ca={type:zi},ua=function(e){return e&&e.type===zi};function da(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(ca)}))},(e={})[qi]=!0,e.put=function(e){if(!t)if(ua(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Hi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=sa),t?e(ca):(e[Hi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ao(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ji]?s(e):Xo((function(){s(e)}))},r}function ya(e,t){var n=e[Wi];oo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var fa,pa=0,ga=function(){return++pa};function Sa(e){e.isRunning()&&e.cancel()}var va=((fa={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!ua(e)||r?n(e):n(Zi)};try{o.take(s,io(a)?la(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},fa.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Xo((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&so(t)?ya(t,n):n(t)}))},fa.ALL=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t);if(0!==r.length){var s=wo(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(ro(t)?[]:{})},fa.RACE=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t),s=ro(t)?Oo(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Lo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=vo,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},fa.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(so(l))return void ya(l,n);if(lo(l))return void Pa(e,l,s.context,pa,Uo(a),!1,n);n(l)}catch(e){n(e,!0)}},fa.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){no(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},fa.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(lo(o))return o;var a=!1;return Eo((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!so(o)})}))}catch(e){return Eo((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Uo(t)}(c,a);Zo((function(){var t=Pa(e,c,l.context,pa,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},fa.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ao(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ro(t)){if(0===t.length)return void n([]);var r=wo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},fa.CANCEL=function(e,t,n,i){var o=i.task;t===Yi?Sa(o):ro(t)?t.forEach(Sa):Sa(t),n()},fa.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},fa.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Do());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ca):e.isEmpty()?(n.push(i),i.cancel=function(){Ao(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(ca):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(ca)}}}}(t.buffer),a=la(i),r=function t(n){ua(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},fa.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},fa.FLUSH=function(e,t,n){t.flush(n)},fa.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},fa.SET_CONTEXT=function(e,t,n,i){var o=i.task;mo(o.context,t),n()},fa);function ha(e,t){return e+"?"+t}function ma(e){var t=e.name,n=e.location;return n?t+" "+ha(n.fileName,n.lineNumber):t}function Aa(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var ba=null,Ta=[],Ea=function(e){e.crashedEffect=ba,Ta.push(e)},ka=function(){ba=null,Ta.length=0},Oa=function(){var e,t,n=Ta[0],i=Ta.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Co(e))?t.code+" "+ha(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ma(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ma(e.meta)})),[Aa(Ta)]).join("\n")};function Ia(e,t,n,i,o,a,r){var s;void 0===r&&(r=vo);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Ao(o,t),t.cont=vo,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=vo,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,Ea({meta:o,cancelledTasks:y}),S.isRoot){var i=Oa();ka(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Xi?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Qi]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Xi,!1))},s.cont=r,s.end=g,s.setContext=function(e){mo(f,e)},s.toPromise=function(){return d||(d=qo(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Pa(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){so(t)?ya(t,i):lo(t)?Pa(e,t,c.context,n,o,!1,i):t&&t[Ki]?(0,va[t.type])(e,t.payload,i,u):i(t)}));d.cancel=vo;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Xi))},status:0},c=Ia(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),ka()):_o(e)?(l.status=1,d.cancel(),o=oo(t.return)?t.return(Xi):{done:!0,value:Xi}):o=Po(e)?oo(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=ga();function l(n,o){a||(a=!0,i.cancel=vo,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ba=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=vo,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=vo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function _a(e,t){for(var n=e.channel,i=void 0===n?da():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?ko:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ga();if(l&&(l.rootSagaStarted=l.rootSagaStarted||vo,l.effectTriggered=l.effectTriggered||vo,l.effectResolved=l.effectResolved||vo,l.effectRejected=l.effectRejected||vo,l.effectCancelled=l.effectCancelled||vo,l.actionDispatched=l.actionDispatched||vo,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=He.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=ho;var m={channel:i,dispatch:Io(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Zo((function(){var e=Pa(m,S,s,v,Uo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var La=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?da():a,s=n.sagaMonitor,l=to(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=_a.bind(null,R({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){mo(o,e)},c},wa=function(e){return{done:!0,value:e}},Ua={};function Ca(e){return uo(e)?"channel":yo(e)?String(e):oo(e)?e.name:String(e)}function Da(e,t,n){var i,o,a,r=t;function s(t,n){if(r===Ua)return wa(t);if(n&&!o)throw r=Ua,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===Ua?wa(t):a}return Eo(s,(function(e){return s(null,e)}),n)}function Ra(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Da({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Ca(e)+", "+t.name+")")}function Na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:$o(e)},l=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zo(e)}},u=function(e){return a=e},d=function(e){return r=e};return Da({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+Ca(e)+", "+t.name+")")}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Da({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Ca(e)+", "+t.name+")")}function Fa(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:Bo.apply(void 0,[n].concat(a))},l={done:!1,value:Ho(t)};return Da({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Ua}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Ga(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Ra,e,t].concat(i))}function $a(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Na,e,t].concat(i))}function Va(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Ma,e,t].concat(i))}class xa{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 xa.instance||(xa.instance=new xa),xa.instance}static setContext(e){xa.getInstance().context=e}static setAccessToken(e){xa.getInstance().accessToken=e}static setUser(e){xa.getInstance().user=e}static setRequestSource(e){xa.getInstance().requestSource=e}static setOnRedirectTo(e){xa.getInstance().onRedirectTo=e}static setLogout(e,t){xa.getInstance().logout=n=>{n?e(n):xa.onRedirectTo(t)}}static setEntitlementsOptions(e){xa.getInstance().entitlementsOptions=e}static setSessionContext(e){xa.getInstance().sessionContext=e}static setAppName(e){xa.getInstance().appName=e}static getContext(){var e;return null!=(e=xa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return xa.getInstance().accessToken}static getRequestSource(){return xa.getInstance().requestSource}static getUser(){return xa.getInstance().user}static onRedirectTo(e,t){return xa.getInstance().onRedirectTo(e,t)}static logout(e){return xa.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=xa.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=xa.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return xa.getInstance().appName}}xa.instance=void 0;const ja={getContext:()=>xa.getContext(),getAccessToken:()=>xa.getAccessToken(),getUser:()=>xa.getUser(),onRedirectTo:(e,t)=>xa.onRedirectTo(e,t),logout:e=>xa.logout(e)};class Ba extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Wa={v1:"/identity/resources/users/webauthn/v1/devices"},za={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ka={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"}}},Ha={v1:"/identity/resources/configurations/v1"},qa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ja={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ya={v1:"/identity/resources/permissions/v1"},Qa={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"}},Xa={v1:"/identity/resources/roles/v1"},Za={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},er={v1:"/identity/resources/impersonation/v1"},tr={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},nr={v1:"/identity/resources/users/phone-numbers/v1"},ir={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},or={v1:"/team/resources/members/v1"},ar={v1:"/team/resources/roles/v1"},rr={v1:"/team/resources/stats/v1"},sr={v1:"/team/resources/profile"},lr={v1:"/tenants/resources/account-settings/v1"},cr={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"}},ur={v1:"/tenants/resources/sub-tenants/v1"},dr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},yr={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"}}}},fr={v1:"/subscriptions/resources/payment-providers/v1"},pr={v1:"/subscriptions/resources/subscriptions/v1"},gr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Sr={v1:"/reports/engine/resources/triggers/v1"},vr="/notification",hr="/audits",mr={v1:"/event/resources/configurations/v1"},Ar="/webhook",br="/oauth",Tr="/flags",Er="/directory/resources/v1/configurations/scim2",kr="/directory/resources/scim/temp",Or="/entitlements/api/v1/user-entitlements",Ir="/entitlements/api/v2/user-entitlements",Pr={v1:"/security-center/resources/recommendations/v1"},_r={v1:"/security-center/resources/insights/v1"};function Lr(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}function wr(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[ci.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[ci.frameWork]=e.metadataHeaders.framework),i}function Ur(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Cr=async e=>{var t,n,i;const o=xa.getContext(),a=await async function(e,t){var n;const i=wr(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:xa.getAccessToken)(),a=xa.getRequestSource(),r=Ur();t&&(i[ci.contentType]=t),a&&(i[ci.source]=a),o&&(i.Authorization=`Bearer ${o}`),r&&(i[ci.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 t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=Lr(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:R({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Ba("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=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Ba(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{}}},Dr=async(e,t,n)=>Cr(R({url:e,method:"GET",contentType:"application/json",params:t},n)),Rr=async(e,t,n)=>Cr(R({url:e,method:"POST",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>Cr(R({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Mr=async(e,t,n)=>Cr(R({url:e,method:"PUT",contentType:"application/json",body:t},n)),Fr=async(e,t,n)=>Cr(R({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Gr=async(e,t,n,i)=>Cr(R({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),$r=(e={})=>R({},e.jwt?{Authorization:e.jwt}:{}),Vr="FRONTEGG_SEPARATE_TABS_BY_TENANT",xr="admin_portal_use_entitlements_v2_endpoint",jr={flags:{}};class Br{constructor(){var e;this._flags={},this._flags=null!=(e=jr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Br;return n.set(e),Br._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=R({},null!=(t=null==jr?void 0:jr.flags)?t:{},null!=e?e:{})}}async function Wr(){return Dr(Tr)}async function zr(e){return Rr(`${Ka.v3}/me/token`,e)}async function Kr(e,t){return Dr(Ka.v2,e,{headers:$r(t)})}async function Hr(e,t){return Dr(Ka.v3,e,{headers:$r(t)})}async function qr(e,t){return Dr(Ka.roles.v3,R({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Jr(e,t){return Dr(Ka.groups.v3,R({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Yr(e){return Dr(Ka.tenants.me.v3,void 0,{headers:$r(e)})}async function Qr(e){return Dr(Ka.tenants.me.v1,void 0,{headers:$r(e)})}async function Xr(){return Rr(Ka.passwords.resetBreachedPasswords.v1)}async function Zr(e){return Mr(`${Ka.v2}/me`,e)}function es(e){e&&sessionStorage.setItem(Vr,e)}function ts(){return xa.isSessionPerTenantEnabled()?sessionStorage.getItem(Vr):null}function ns(){const[e]=Br.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],xa.getAppName()||"");return xa.isSessionPerTenantEnabled()||e?Qr:Yr}async function is(e){return xa.isSessionPerTenantEnabled()&&es(e.tenantId),Mr(`${Ka.v1}/tenant`,e)}async function os(){return Dr(`${Ka.v2}/me/tenants`)}async function as(e){return Dr(cr.v1,void 0,{headers:$r(e)})}async function rs(e){return Dr(cr.tree.v1,void 0,{headers:$r(e)})}async function ss(e){return Dr(cr.parents.v1,void 0,{headers:$r(e)})}async function ls(e,t){return Dr(`${cr.parents.v1}/${e}`,void 0,{headers:$r(t)})}async function cs(e,t){return Rr(`${Qa.users.v1}/count`,e,{headers:$r(t)})}async function us(e,t){return Dr(cr.v2,e,{headers:$r(t)})}async function ds(e,t){return Dr(cr.metadata.v2,R({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:$r(t)})}async function ys(){return Dr(Ha.v1)}async function fs(){return Dr(`${Ha.v1}/mfa-policy`)}async function ps(){return Dr(`${Ha.v1}/mfa-policy/vendor`)}async function gs(e){return e.id?Nr(`${Ha.v1}/mfa-policy`,e):Rr(`${Ha.v1}/mfa-policy`,e)}async function Ss(){return Dr(`${Ha.v1}/lockout-policy`)}async function vs(){return Dr(`${Ha.v1}/lockout-policy/vendor`)}async function hs(e){return e.id?Nr(`${Ha.v1}/lockout-policy`,e):Rr(`${Ha.v1}/lockout-policy`,e)}async function ms(){try{return await Dr(`${Ha.v1}/captcha-policy/public`)}catch{return null}}async function As(){return Dr(`${Ha.v1}/password-history-policy`)}async function bs(){return Dr(`${Ha.v1}/password-history-policy/vendor`)}async function Ts(e){return e.id?Nr(`${Ha.v1}/password-history-policy`,e):Rr(`${Ha.v1}/password-history-policy`,e)}async function Es(){return Dr(`${Ha.v1}/password`)}async function ks(){return Dr(`${qa.emailDomain.v1}`)}async function Os(){return Dr(`${qa.emailDomain.v1}/config`)}async function Is(e){return Rr(`${qa.emailDomain.v1}`,e)}async function Ps(e){return Rr(`${qa.emailDomain.v1}/config`,e)}async function _s(e){return Fr(`${qa.emailDomain.v1}/${e}`)}async function Ls(e){return Dr(`${qa.ip.v1}`,e)}async function ws(){return Dr(`${qa.ip.v1}/config`)}async function Us(e){return Rr(`${qa.ip.v1}`,e)}async function Cs(e){return Rr(`${qa.ip.v1}/bulk`,e)}async function Ds(e){return Rr(`${qa.ip.v1}/config`,e)}async function Rs(e){return Fr(`${qa.ip.v1}/${e}`)}async function Ns(){return Rr(`${qa.ip.v1}/verify`)}async function Ms(){return Rr(`${qa.ip.v1}/verify/allow`)}Br._instances={};class Fs extends Error{constructor(e){super(e)}}const Gs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Fs("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class $s extends Error{constructor(e){super(e)}}const Vs=(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(Gs(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 Gs(t)}})(e.split(".")[n]))}catch(e){throw new $s("Invalid token specified: "+e.message)}};let xs,js,Bs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(xs||(xs={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(js||(js={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Bs||(Bs={}));const Ws="admin_portal_should_load_authorization";async function zs(){return Dr(Or)}async function Ks(){return Dr(Ir)}let Hs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Hs||(Hs={}));const qs="admin_portal_entitlements",Js=["type"],Ys=["type"],Qs=["type"];async function Xs(e){if(!e.accessToken)return e;xa.setAccessToken(e.accessToken);const t=await $u(),n=R({},e,e.accessToken?Vs(e.accessToken):{},t);return xa.setUser(n),n}async function Zs(e){if(!e.accessToken)return{user:e};xa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([$u(),os()]),i=R({},e,e.accessToken?Vs(e.accessToken):{},t);return xa.setUser(i),{user:i,tenants:n}}function el(){if(!xa.shouldLoadEntitlements())return!1;const[e]=Br.getFeatureFlags([qs],xa.getAppName()||"");return e}function tl(){const[e]=Br.getFeatureFlags([Ws],xa.getAppName()||"");return e}async function nl(e){const{accessToken:t}=e;if(!t)return{user:e};xa.setAccessToken(t);const[n,i]=await Promise.all([$u(),ns()()]),o=R({},e,t?Vs(t):{},n);return xa.isSessionPerTenantEnabled()&&es(o.tenantId),xa.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function il(e){xa.setAccessToken(e.id_token);const t=await $u(),n=e.id_token?Vs(e.id_token):{},i=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return xa.setUser(i),i}async function ol(e){xa.setAccessToken(e.id_token);const[t,n]=await Promise.all([$u(),ns()()]),i=e.id_token?Vs(e.id_token):{},o=R({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return xa.isSessionPerTenantEnabled()&&es(o.tenantId),xa.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function al(e){try{const{address:t}=await Rr(`${za.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function rl(e){return Rr(`${za.v1}/user/saml/prelogin`,e)}async function sl(e){return Xs(await Rr(`${za.v1}/user/saml/postlogin`,e))}async function ll(e){return Xs(await Rr(`${za.v1}/user/oidc/postlogin`,e))}async function cl(e){return Xs(await Rr(`${za.v1}/user`,e))}async function ul(e){return nl(await Rr(`${za.v1}/user`,e))}async function dl(e){return Xs(await Rr(`${za.v1}/user/mfa/verify`,e))}async function yl(e){return nl(await Rr(`${za.v1}/user/mfa/verify`,e))}async function fl(e){return Rr(`${Ka.v1}/activate`,e)}async function pl(e){return nl(await Rr(`${Ka.v1}/activate`,e))}async function gl(e){return Dr(`${Ka.v1}/activate/strategy`,e)}async function Sl(e){return Rr(`${Ka.v1}/activate/reset`,e)}async function vl(e){return Rr(`${Ka.v1}/invitation/reset`,e)}async function hl(e){return Rr(`${Ka.v1}/invitation/accept`,e)}async function ml(){const e=ts();return Xs(await Rr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){const e=ts();return Zs(await Rr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function bl(){const e=ts();return nl(await Rr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Tl(){return Rr(`${za.v1}/logout`)}async function El(e){return Dr(`${br}/logout`,e)}async function kl(e){return Rr(`${Ka.v1}/passwords/reset`,e)}async function Ol(e){return Rr(`${Ka.v1}/passwords/reset/verify`,e)}async function Il(e){return Dr(`${Ka.v1}/passwords/config`,e)}async function Pl(e){return Rr(`${za.v1}/user/mfa/recover`,e)}async function _l(){return Rr(`${Ka.v1}/mfa/enroll`)}async function Ll(){return Rr(`${Ka.v1}/mfa/authenticator/enroll`)}async function wl(e){return Rr(`${Ka.v1}/mfa/authenticator/enroll/verify`,e)}async function Ul(e){return Rr(`${Ka.v1}/mfa/sms/enroll`,e)}async function Cl(e){return Rr(`${Ka.v1}/mfa/sms/enroll/verify`,e)}async function Dl(){return Rr(`${Ka.v1}/mfa/webauthn/enroll`)}async function Rl(e){return Rr(`${Ka.v1}/mfa/webauthn/enroll/verify`,e)}async function Nl(e){return Rr(`${Ka.v1}/mfa/enroll/verify`,e)}async function Ml(e){return Rr(`${Ka.v1}/mfa/disable`,e)}async function Fl(e,t){return Rr(`${Ka.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return Rr(`${Ka.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return Rr(`${Ka.v1}/mfa/sms/${e}/disable/verify`,t)}async function Vl(e){return Rr(`${Ka.v1}/mfa/webauthn/${e}/disable`)}async function xl(e,t){return Rr(`${Ka.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return Dr(`${Ka.v1}/mfa/devices`)}async function Bl(e){return Rr(`${za.v1}/user/mfa/authenticator/enroll`,e)}async function Wl(e){return Rr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e)}async function zl(e){return nl(await Rr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Kl(e,t){return Rr(`${za.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Hl(e){return Rr(`${za.v1}/user/mfa/emailcode`,e)}async function ql(e){return Rr(`${za.v1}/user/mfa/emailcode/verify`,e)}async function Jl(e){return nl(await Rr(`${za.v1}/user/mfa/emailcode/verify`,e))}async function Yl(e){return Rr(`${za.v1}/user/mfa/sms/enroll`,e)}async function Ql(e){return Rr(`${za.v1}/user/mfa/sms/enroll/verify`,e)}async function Xl(e){return nl(await Rr(`${za.v1}/user/mfa/sms/enroll/verify`,e))}async function Zl(e,t){return Rr(`${za.v1}/user/mfa/sms/${e}`,t)}async function ec(e,t){return Rr(`${za.v1}/user/mfa/sms/${e}/verify`,t)}async function tc(e,t){return nl(await Rr(`${za.v1}/user/mfa/sms/${e}/verify`,t))}async function nc(e){return Rr(`${za.v1}/user/mfa/webauthn/enroll`,e)}async function ic(e){return Rr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e)}async function oc(e){return nl(await Rr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ac(e,t){return Rr(`${za.v1}/user/mfa/webauthn/${e}`,t)}async function rc(e,t){return Rr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t)}async function sc(e,t){return nl(await Rr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t))}async function lc(){return Dr(`${ir.v1}/saml/configurations`)}async function cc(e){return Rr(`${ir.v1}/saml/configurations`,e)}async function uc(){return Dr(`${ir.v1}/saml/configurations/vendor-config`)}async function dc(e){return Mr(`${ir.v1}/saml/configurations/metadata`,e)}async function yc(){return Mr(`${ir.v1}/saml/validations/domain`)}async function fc(){return Dr(`${ir.v1}/saml/configurations/roles/default`)}async function pc(){return Dr(`${ir.v2}/saml/configurations/groups`)}async function gc({roleIds:e}){return Rr(`${ir.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Sc({roleIds:e,group:t}){return Rr(`${ir.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function vc({roleIds:e,group:t,id:n}){return Nr(`${ir.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function hc({id:e}){return Fr(`${ir.v2}/saml/configurations/groups/${e}`)}async function mc(){return Dr(`${ir.v1}/oidc/configurations`)}async function Ac(){return Dr(`${ir.v2}/configurations/public`)}async function bc(){return Dr(Ja.v1)}async function Tc(){return Dr(Ja.v2)}async function Ec(){return Dr(`${Ja.v2}/authenticated`)}async function kc(){return Dr(Ja.custom.v1)}async function Oc({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),Rr(`${za.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Ic(){return Dr(`${Ha.v1}/public`)}async function Pc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Rr(`${Ka.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await nl(n);return R({},a,{user:e,tenants:t,activeTenant:i})}return a}async function _c(){return Dr(Ka.sessions.currentUser.v1)}async function Lc(){return Dr(`${Ka.sessions.currentUser.v1}/current`)}async function wc(e){return Rr(`${Ka.sessions.v1}/revoke`,{userId:e})}async function Uc(){return Dr(Ka.sessions.configurations.v1)}async function Cc(e){await Rr(Ka.sessions.configurations.v1,e)}async function Dc(e){await Fr(`${Ka.sessions.currentUser.v1}/${e}`)}async function Rc(){await Fr(`${Ka.sessions.currentUser.v1}/all`)}async function Nc(){return Dr(Ka.accessTokens.v1)}async function Mc(){return Dr(Qa.accessTokens.v1)}async function Fc({id:e}){return Fr(`${Qa.accessTokens.v1}/${e}`)}async function Gc({id:e}){return Fr(`${Ka.accessTokens.v1}/${e}`)}async function $c(e){return Rr(Ka.accessTokens.v1,e)}async function Vc(e){return Rr(Qa.accessTokens.v1,e)}async function xc(){return Dr(Ka.apiTokens.v1)}async function jc(){return Dr(Qa.apiTokens.v1)}async function Bc(e){return Rr(Ka.apiTokens.v1,e)}async function Wc(e){return Rr(Qa.apiTokens.v2,e)}async function zc({tokenId:e}){return Fr(`${Qa.apiTokens.v1}/${e}`)}async function Kc({tokenId:e}){return Fr(`${Ka.apiTokens.v1}/${e}`)}async function Hc({userId:e}){return Dr(`${Ka.v1}/${e}`)}async function qc(e){return Dr(`${Ha.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Jc(e){let{type:t}=e,n=to(e,Js);return Rr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Yc(e){let{type:t}=e,n=to(e,Ys);return nl(await Rr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Qc(e){let{type:t}=e,n=to(e,Qs);return Rr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Xc({token:e}){return Rr(Qa.invites.verify.v1,{token:e})}async function Zc(){return Dr(`${ir.v1}/configurations`)}async function eu(e){return Rr(`${ir.v1}/configurations`,e)}async function tu(e,t){return Nr(`${ir.v1}/configurations/${e}`,t)}async function nu(e){return Fr(`${ir.v1}/configurations/${e}`)}async function iu(e){return Rr(`${ir.v1}/configurations/metadata`,e)}async function ou(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata`,t)}async function au(e){return Rr(`${ir.v1}/configurations/metadata-url`,e)}async function ru(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata-url`,t)}async function su(e,t){return Rr(`${ir.v1}/configurations/${e}/domains`,t)}async function lu(e,t){return Fr(`${ir.v1}/configurations/${e}/domains/${t}`)}async function cu(e,t){return Mr(`${ir.v1}/configurations/${e}/domains/${t}/validate`)}async function uu(e){return Dr(`${ir.v1}/configurations/${e}/roles`)}async function du(e,t){return Mr(`${ir.v1}/configurations/${e}/roles`,t)}async function yu(e,t){return Rr(`${ir.v1}/configurations/${e}/groups`,t)}async function fu(e,{roleIds:t,group:n,id:i}){return Nr(`${ir.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function pu(e,t){return Fr(`${ir.v1}/configurations/${e}/groups/${t}`)}async function gu(e){return Dr(`${ir.v1}/configurations/${e}/groups`)}async function Su(e){return Rr(`${za.v2}/user/sso/prelogin`,e)}async function vu(e){return Xs(await Rr(`${za.v2}/user/oidc/postlogin`,e))}async function hu(e){return ol(await Rr(`${br}/token`,e))}async function mu(){const e=ts();return ol(await Rr(`${br}/authorize/silent`,{tenantId:e}))}async function Au(e){return il(await Rr(`${br}/token`,e))}async function bu(){const e=ts();return il(await Rr(`${br}/authorize/silent`,{tenantId:e}))}async function Tu(e){return Rr(`${Ka.v1}/phone/reset`,e)}async function Eu(e){return Rr(`${Ka.v1}/phone/reset/verify`,e)}async function ku(e){return Rr(`${Ka.v1}/phone`,e)}async function Ou(e){return Rr(`${Ka.v1}/phone/verify`,e)}async function Iu(e){return Mr(`${Ka.v1}/phone/change`,e)}async function Pu(e){return Rr(`${za.v1}/webauthn/prelogin`,e)}async function _u(e){return Rr(`${za.v1}/webauthn/postlogin`,e)}async function Lu(e){return nl(await Rr(`${za.v1}/webauthn/postlogin`,e))}async function wu(){return Rr(Wa.v1)}async function Uu(){return Dr(Wa.v1)}async function Cu(e){return Fr(`${Wa.v1}/${e}`)}async function Du(e){return Rr(`${Wa.v1}/verify`,e)}async function Ru(){return Dr(`${Ha.v1}/auth/strategies/public`)}async function Nu(){return Dr(`${Ha.v1}/auth/strategies`)}async function Mu(){return Dr(`${Ha.v1}/mfa/strategies`)}async function Fu(){return Dr(`${Ka.authorization.v1}`)}async function Gu(){return Dr(`${Ka.v2}/me`)}async function $u(){const[e]=Br.getFeatureFlags([xr],xa.getAppName()||""),t=[{action:Gu,shouldLoad:!0},{action:e?Ks:zs,shouldLoad:el()},{action:Fu,shouldLoad:tl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=ts();return a&&(n.tenantId=a),R({},n,null!=o?o:{},{entitlements:i})}async function Vu(e){const t=await Rr(`${za.v1}/user/step-up/generate`,e);return t.accessToken?nl(t):t}async function xu(e){return Dr(`${Ka.v2}/me`,null!=e?e:{addRoles:!0})}async function ju(e){return Mr(`${Ka.v2}/me`,e)}async function Bu(e){return Mr(`${sr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Wu(e){return Rr(`${Ka.v1}/passwords/change`,e)}async function zu(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>R({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Dr(or.v1,R({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ku(e){return Rr(Ka.v2,R({},e,{provider:"local"}))}async function Hu(e){return Fr(`${or.v1}/${e.userId}`)}async function qu(e){return Mr(or.v1,e)}async function Ju(e){const{userId:t,expirationInSeconds:n}=e;return Mr(`${Ka.temporary.v1}/${t}`,{expirationInSeconds:n})}async function Yu(e){return Fr(`${Ka.temporary.v1}/${e}`)}async function Qu(){return Dr(Ka.temporary.configuration.v1)}async function Xu(e){return Rr(Qa.invites.user.v1,R({},e))}async function Zu(e){return Nr(Qa.invites.user.v1,R({},e))}async function ed(){return Fr(Qa.invites.user.v1)}async function td(){return Dr(Qa.invites.user.v1)}async function nd(){return Dr(Qa.invites.configuration.v1)}async function id(){return Dr(ar.v1)}async function od(){return Dr(Ya.v1)}async function ad(){return Dr(`${rr.v1}/members`)}async function rd(e){return Rr(`${or.v1}/${e.userId}/resendActivationEmail`,{})}async function sd(e){return Rr(Ka.v2,R({},e,{provider:"local"}))}async function ld(e){return Rr(Ka.invitation.resendAll.v1,R({},e))}async function cd(e){var t,n;const i=await Dr("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function ud(){return Dr("/metadata/admin-box")}async function dd(e){return Rr("/metadata/admin-box",e)}async function yd(){const e=await Dr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const fd=async()=>cd({entityName:"notifications"}),pd=async()=>cd({entityName:"saml"}),gd=async()=>cd({entityName:"audits"}),Sd=async e=>async function(e){const t=await Dr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vd=["dataFilters"],hd=["templateId","dataFilters"],md=["dataFilters"];async function Ad(e){return Dr(`${gr.v2}/tenant-reports`,e)}async function bd(e){return Dr(`${gr.v2}/${e.id}/tenant-reports`)}async function Td(e){let{dataFilters:t}=e,n=to(e,vd);return{html:await Dr(`${Sr.v1}/preview-report`,R({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ed(e){let{templateId:t,dataFilters:n}=e,i=to(e,hd);return Rr(`${gr.v2}/${t}/tenant-reports`,R({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function kd(e){let{dataFilters:t}=e,n=to(e,md);const i=await Dr(`${Sr.v1}/preview-report`,R({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function Od(e){return Rr(`${Sr.v1}/tenant-reports`,e)}async function Id(e){return Dr(vr,{params:e})}async function Pd(e){return Mr(`${vr}/status`,{params:e})}async function _d(e){const{notificationId:t,pinStatus:n}=e;return Mr(`${vr}/${n}`,{notificationId:t})}async function Ld(){return Rr(`${vr}/status/mark-all-read`)}const wd=["endpoint","headerProps"];async function Ud(e){return Dr(hr,e)}async function Cd(e){return Dr(`${hr}/stats`,e)}async function Dd(e){const{endpoint:t,headerProps:n}=e,i=to(e,wd);return Gr(`${hr}/export/${t}`,{properties:n},i)}const Rd=["eventKey"],Nd=["eventKey"],Md=()=>Dr(`${dr.v1}/slack`),Fd=()=>Dr(`${dr.v1}/slack/applications`),Gd=()=>Dr(`${dr.v1}/slack/channels`),$d=e=>e.id?Nr(`${dr.v1}/slack/subscription/${e.id}`,e):Rr(`${dr.v1}/slack/subscriptions`,e),Vd=e=>Fr(`${dr.v1}/slack/subscriptions/${e.id}`),xd=e=>Rr(`${dr.v1}/slack/applications/registrations`,{code:e}),jd=()=>Dr(`${dr.v1}/emails`),Bd=e=>{let{eventKey:t}=e,n=to(e,Rd);return Rr(`${dr.v1}/emails/${t}`,n)},Wd=({eventKey:e,enabled:t})=>Nr(`${dr.v1}/emails/${e}`,{enabled:t}),zd=(e,t)=>Fr(`${dr.v1}/emails/${e}/subscriptions/${t}`),Kd=(e,t,n)=>Mr(`${dr.v1}/emails/${t}/subscriptions/${e}`,n),Hd=e=>Fr(`${dr.v1}/emails/${e}`),qd=()=>Dr(`${dr.v2}/sms`),Jd=e=>{let{eventKey:t}=e,n=to(e,Nd);return Rr(`${dr.v2}/sms/${t}`,n)},Yd=({eventKey:e,enabled:t})=>Nr(`${dr.v2}/sms/${e}`,{enabled:t}),Qd=(e,t)=>Fr(`${dr.v2}/sms/${e}/subscriptions/${t}`),Xd=(e,t,n)=>Mr(`${dr.v2}/sms/${t}/subscriptions/${e}`,n),Zd=e=>Fr(`${dr.v2}/sms/${e}`),ey=()=>Dr(Ar),ty=e=>e._id?Nr(`${Ar}/${e._id}`,e):Rr(`${Ar}/custom`,e),ny=e=>Fr(`${Ar}/${e}`),iy=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Dr(`${Ar}/logs/?${i.toString()}`)},oy=e=>Rr(`${Ar}/test`,e),ay=e=>Rr(`${Ar}/logs/${e}/retries`),ry=()=>Dr(`${mr.v1}/categories`),sy=e=>Dr(mr.v1,{channels:e});async function ly(e,t){return Mr(lr.v1,e,{headers:$r(t)})}async function cy(e){return Dr(lr.v1,void 0,{headers:$r(e)})}async function uy(){return Dr(`${lr.v1}/public`)}const dy=["roleId"],yy=["roleId"],fy=["permissionId"];async function py(){return Dr(Xa.v1)}async function gy(e){return Rr(Xa.v1,e)}async function Sy({roleId:e}){return Fr(`${Xa.v1}/${e}`)}async function vy(e){let{roleId:t}=e,n=to(e,dy);return Nr(`${Xa.v1}/${t}`,n)}async function hy(e){let{roleId:t}=e,n=to(e,yy);return Mr(`${Xa.v1}/${t}/permissions`,n)}async function my(){return Dr(Ya.v1)}async function Ay(e){let{permissionId:t}=e,n=to(e,fy);return Mr(`${Ya.v1}/${t}/roles`,n)}async function by(){return Dr(`${Ya.v1}/categories`)}async function Ty(){return Dr(yr.subscriptions.v1)}async function Ey(e){return Dr(`${yr.subscriptions.v1}/${e}`)}async function ky(e){return Mr(`${yr.subscriptions.v1}/${e}/cancellations/`,{})}async function Oy(e){return Mr(`${yr.subscriptions.v1}/${e}/renewals/`,{})}async function Iy(e,{paymentMethodId:t,planId:n}){return Mr(`${yr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(e){return Dr(`${pr.v1}/${e}`)}async function _y(){return Dr(`${pr.v1}`)}async function Ly(e){return Mr(`${pr.v1}/${e}/cancellations/`,{})}async function wy(e){return Mr(`${pr.v1}/${e}/renewals/`,{})}async function Uy(e,{paymentMethodId:t,planId:n}){return Mr(`${pr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(){return Dr(yr.plans.v1)}async function Dy(e){return Dr(`${yr.plans.v1}/${e}`)}async function Ry(){return Dr(yr.invoices.v1)}async function Ny(e){return Dr(`${yr.invoices.v1}/${e}`)}async function My(e,t){return Dr(`${yr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fy=["email"];async function Gy(){return Dr(yr.paymentMethods.v1)}async function $y(e){return Dr(`${yr.paymentMethods.v1}/${e}`)}async function Vy(e,t){let{email:n}=t,i=to(t,Fy);return Nr(`${yr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function xy(e){return Rr(yr.paymentProviders.stripe.subscriptions.v1,e)}async function jy(e){return Dr(`${yr.paymentProviders.stripe.customers.v1}/${e}`)}async function By(e){return Rr(`${yr.paymentProviders.stripe.customers.v1}`,e)}async function Wy(){return Dr(`${yr.paymentProviders.stripe.publicConfigurations.v1}`)}async function zy(e){return Rr(`${yr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ky(e){return Dr(`${yr.summaries.v1}/${e}`)}async function Hy(e){return Dr(`${yr.tenantConfiguration.v1}/${e}`)}async function qy(e){return Rr(`${yr.tenantConfiguration.v1}`,e)}async function Jy(){return Dr(fr.v1)}async function Yy(){return Dr(`${yr.configurations.vendorPublicConfigurations.v1}`)}let Qy,Xy,Zy,ef,tf,nf;async function of(){return Dr("/vendors/public")}async function af(e){return Dr(Za.v1,e)}async function rf(e){return Rr(Za.v1,e)}async function sf(e,t){return Fr(Za.v1,e,{headers:$r(t)})}async function lf(e,t,n){return Rr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function cf(e,t,n){return Fr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function uf(e,t,n){return Nr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function df(e,t){return Rr(ur.v1,e,{headers:$r(t)})}async function yf(e,t){return Fr(`${ur.v1}/${e}`,void 0,{headers:$r(t)})}async function ff({tenantId:e},t,n){return Nr(`${ur.v1}/${e}`,t,{headers:$r(n)})}async function pf(e,t,n){return Mr(`${Za.v1}/${e}/access`,t,{headers:$r(n)})}async function gf(e,t){return Rr(`${Za.v2}/`,e,{headers:$r(t)})}async function Sf(){return Dr(`${Er}`)}async function vf(e,t){return Nr(`${Er}/${e}`,t)}async function hf(e){return Rr(`${Er}`,e)}async function mf(e){return Fr(`${Er}/${e}`)}async function Af(e){return Dr(`${kr}/${e}/Users/count`)}async function bf(e){return Rr(`${er.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Qy||(Qy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Xy||(Xy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zy||(Zy={})),(ef||(ef={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(tf||(tf={})),function(e){e.CREATE="create_customer"}(nf||(nf={}));const Tf=["groupId"];async function Ef({groupId:e},t){return Dr(`${tr.v1}/${e}`,R({},t))}async function kf(e){return Dr(`${tr.v1}`,R({},e))}async function Of(e,t){return Rr(`${tr.getByIds.v1}`,e,{params:t})}async function If(e){return Rr(`${tr.v1}`,e)}async function Pf(e){let{groupId:t}=e,n=to(e,Tf);return Nr(`${tr.v1}/${t}`,n)}async function _f(e){return Fr(`${tr.v1}/${e}`)}async function Lf(e,t){return Rr(`${tr.v1}/${e}/roles`,t)}async function wf(e,t){return Fr(`${tr.v1}/${e}/roles`,t)}async function Uf(e,t){return Rr(`${tr.v1}/${e}/users`,t)}async function Cf(e,t){return Fr(`${tr.v1}/${e}/users`,t)}async function Df(){return Dr(`${tr.configurations.v1}`)}async function Rf(e){return Rr(`${tr.configurations.v1}`,e)}async function Nf(){return Dr(Pr.v1)}async function Mf(){return Dr(_r.v1)}async function Ff(e){return Dr(`${nr.v1}`,e)}async function Gf(e){return Rr(`${nr.v1}`,e)}async function $f(e){return Fr(`${nr.v1}/${e}`)}async function Vf(e){return Rr(`${nr.v1}/preverify`,e)}async function xf(e){return Rr(`${nr.v1}/verify`,e)}async function jf(e,t){return Rr(`${nr.v1}/${e}/delete/verify`,t)}let Bf,Wf,zf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Bf||(Bf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Wf||(Wf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(zf||(zf={}));const Kf=[/^(.*)\/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],Hf=`${za.v1}/user/token/refresh`,qf=`${br}/authorize/silent`,Jf=`${Ka.v2}/me`,Yf=`${Ka.v2}/me/tenants`,Qf=`${Ka.v3}/me/tenants`;let Xf,Zf,ep,tp,np,ip,op,ap;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Xf||(Xf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Zf||(Zf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ep||(ep={})),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"}(tp||(tp={})),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"}(np||(np={})),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"}(ip||(ip={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(op||(op={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(ap||(ap={}));const rp={auth:s,teams:l,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:a,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:o,entitlements:r,securityCenter:T,userPhoneNumbers:E};var sp={fetch:e,ContextHolder:xa,FronteggContext:ja,api:rp,FronteggApiError:Ba,AuthStrategyEnum:Oi,MachineToMachineAuthStrategy:Ii,SocialLoginProviders:ki,ISubscriptionCancellationPolicy:Zy,ISubscriptionStatus:Qy,PaymentMethodType:Xy,ProviderType:ef};let lp,cp;!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"}(lp||(lp={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(cp||(cp={}));const up="input is invalid type",dp="undefined"!=typeof ArrayBuffer,yp="0123456789abcdef".split(""),fp=[-2147483648,8388608,32768,128],pp=[24,16,8,0],gp=[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],Sp=["hex","array","digest","arrayBuffer"],vp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),dp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const hp=function(e){return function(t){const n=new Ap(!0).update(t);return null==n?void 0:n[e]()}},mp=function(e){return function(t,n){const i=new bp(t,!0).update(n);return null==i?void 0:i[e]()}};class Ap{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=()=>Ap.prototype.digest(),e?(vp[0]=vp[16]=vp[1]=vp[2]=vp[3]=vp[4]=vp[5]=vp[6]=vp[7]=vp[8]=vp[9]=vp[10]=vp[11]=vp[12]=vp[13]=vp[14]=vp[15]=0,this.blocks=vp):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(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<pp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<pp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<pp[3&o++],s[o>>2]|=(128|i>>12&63)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=fp[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,o,a,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,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)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+gp[e]+m[e],a=t+i,h=p+o<<0,p=o+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+gp[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+gp[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+gp[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+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,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=yp[e>>28&15]+yp[e>>24&15]+yp[e>>20&15]+yp[e>>16&15]+yp[e>>12&15]+yp[e>>8&15]+yp[e>>4&15]+yp[15&e]+yp[t>>28&15]+yp[t>>24&15]+yp[t>>20&15]+yp[t>>16&15]+yp[t>>12&15]+yp[t>>8&15]+yp[t>>4&15]+yp[15&t]+yp[n>>28&15]+yp[n>>24&15]+yp[n>>20&15]+yp[n>>16&15]+yp[n>>12&15]+yp[n>>8&15]+yp[n>>4&15]+yp[15&n]+yp[i>>28&15]+yp[i>>24&15]+yp[i>>20&15]+yp[i>>16&15]+yp[i>>12&15]+yp[i>>8&15]+yp[i>>4&15]+yp[15&i]+yp[o>>28&15]+yp[o>>24&15]+yp[o>>20&15]+yp[o>>16&15]+yp[o>>12&15]+yp[o>>8&15]+yp[o>>4&15]+yp[15&o]+yp[a>>28&15]+yp[a>>24&15]+yp[a>>20&15]+yp[a>>16&15]+yp[a>>12&15]+yp[a>>8&15]+yp[a>>4&15]+yp[15&a]+yp[r>>28&15]+yp[r>>24&15]+yp[r>>20&15]+yp[r>>16&15]+yp[r>>12&15]+yp[r>>8&15]+yp[r>>4&15]+yp[15&r];return l+=yp[s>>28&15]+yp[s>>24&15]+yp[s>>20&15]+yp[s>>16&15]+yp[s>>12&15]+yp[s>>8&15]+yp[s>>4&15]+yp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class bp extends Ap{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up)}var o;e.length>64&&(e=null==(o=new Ap(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Ap.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Ap.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Ap.prototype.finalize.call(this)}}}const Tp=function(){const e=hp("hex");e.create=function(){return new Ap},e.update=function(t){return e.create().update(t)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=hp(n)}return e}();function Ep(e,t){const n=R({},e);return t.forEach((e=>{delete n[e]})),n}async function kp(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=Tp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Op(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=mp("hex");e.create=function(e){return new bp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=mp(n)}}();const Ip=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Pp(e){const t=yield Ko((e=>e.root.appName));return Br.getFeatureFlags(e,t)}const _p={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Lp=R({},_p,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),wp=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],Up={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:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",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},Cp=R({},Up,{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}),Dp={loading:!1,error:void 0,saving:!0,profile:Up},Rp={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"},Np={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Oi.EmailAndPassword,machineToMachineAuthStrategy:Ii.ClientCredentials},Mp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Fp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Gp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},$p={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},Vp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},xp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],jp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:$p,roles:xp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Bp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Wp={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:[wp[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[wp[0]],managedBy:ep.FRONTEGG}]},zp={id:Wp.id,email:Wp.email,name:Wp.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:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Kp={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:[wp[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[wp[0]],managedBy:ep.FRONTEGG}]},Hp={id:Kp.id,email:Kp.email,name:Kp.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:[wp[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},qp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Jp=[Kp,Wp],Yp=[Hp,zp],Qp=[qp],Xp=[{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}],Zp=[{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"}],eg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},tg={isActive:!0,strategy:zn.ALLOW},ng=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:zn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:zn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 4"}],ig=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(R({},Kp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},og=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"}),ag=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:ig(6),roles:[og("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:ep.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:ig(44),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:ig(8),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:ig(5),roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:ig(21),description:"BDR, AE, and inside sales",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:ig(23),description:"Dev success and customer success",roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:ig(10),description:"The marketing department",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:ig(4),description:"Human resources",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:ig(3),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:ig(8),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:ig(4),roles:[og("Viewer")],managedBy:ep.FRONTEGG}],rg={scoring:{score:79},recommendations:{items:[{code:tp.FORCE_MFA,severity:op.WARNING,category:ap.MFA},{code:tp.ENABLE_FORCE_RELOGIN,severity:op.WARNING,category:ap.SESSIONS}]}},sg={insights:{items:[{category:ap.MFA,code:np.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:ap.SESSIONS,code:np.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:ap.PASSWORD,code:np.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:ap.DOMAIN,code:np.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},lg={users:Yp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},cg={users:[Yp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ug={users:[Yp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let dg,yg,fg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(dg||(dg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(yg||(yg={})),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"}(fg||(fg={})),fg.profile,fg.privacy,fg.personalApiTokens,fg.account,fg.users,fg.groups,fg.security,fg.sso,fg.audits,fg.webhooks,fg.apiTokens,fg.roles,fg.subscriptions,fg.allAccounts;const pg=e=>{try{return new URL(e),!0}catch(e){return!1}},gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Sg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},vg="tenantId",hg=e=>e.mfaRequired&&e.mfaToken?(xa.setAccessToken(null),xa.setUser(null),!0):(xa.setAccessToken(e.accessToken),xa.setUser(e),!1),mg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:i,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length),o=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,numberOfEmails:o,totalDevices:t+n+i+o}})(e);if(1===o){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(i)return un.emailVerifyCode}return un.verify},Ag=e=>{if(1===e.length){const[t]=e;if(t===Bs.AuthenticatorApp)return un.authenticatorApp;if(t===Bs.SMS)return un.smsSetPhoneNumber;if(t===Bs.EmailCode)return un.emailVerifyCode}return un.verify};function*bg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield Ko((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Bo(rp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:mg(e.mfaDevices)}:(n={step:Ag(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=_t.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:R({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const Tg=(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 Eg;function kg(e,t){var n,i;null==(n=(i=window).onFronteggEvent)||n.call(i,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Eg||(Eg={}));const Og=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...Og(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Ig=["callback"];function*Pg(){yield Vo(ji.setCustomLoginState({loading:!0}));try{const e=yield Bo(rp.metadata.getAdminBoxMetadata);yield Vo(ji.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield Vo(ji.setCustomLoginState({loading:!1,error:Tg(e)}))}}function*_g(e){let{payload:{callback:t}}=e,n=to(e.payload,Ig);try{yield Vo(ji.setCustomLoginState({error:null,saving:!0}));const e=Og(n);if(0===e.length)throw new Error("No changes to update");yield Bo(rp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield Bo(rp.metadata.getAdminBoxMetadata);yield Vo(ji.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setCustomLoginState({error:Tg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Lg(){var e,t,n;if(yield Ko((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=Ko((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=xa.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*wg(){try{var e;if(!(yield Bo(Lg)))return;const t=yield Ko((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=rp.accountSettings,{applicationUrl:o}=yield Bo(t?n:i);if(!o)return;const{routes:a}=yield Ko((e=>e.auth)),r=null!=(e=gg(o))?e:"";yield Vo(ji.setState({routes:R({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield Vo(ji.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*Ug(){yield Va(ji.loadTenantMetadata,Pg),yield Va(ji.updateTenantMetadata,_g)}let Cg;!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"}(Cg||(Cg={}));const Dg=["callback"];function Rg(e){return function*(t){const[n]=yield Bo(Pp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Ng(),yield Mg())}}function*Ng(){const e=Cg.RECOMMENDATIONS;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield Bo(rp.securityCenter.getRecommendations);yield Vo(ji.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield Vo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Mg(){const e=Cg.INSIGHTS;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Bo(rp.securityCenter.getInsights);yield Vo(ji.setSecurityCenterState({insights:t.items}))}catch(t){yield Vo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Fg(e){let{payload:{callback:t}}=e,n=to(e.payload,Dg);const i=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield Vo(ji.setSecurityCenterStateError({key:i,value:!1})),yield Vo(ji.setSecurityCenterStateLoader({key:i,value:!0}));try{yield Bo(rp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield Vo(ji.setSecurityCenterStateError({key:i,value:Tg(e)})),null==t||t(!1,e)}finally{yield Vo(ji.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Gg({payload:{callback:e}}){const t=Cg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield Vo(ji.setSecurityCenterStateError({key:t,value:!1})),yield Vo(ji.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Bo(rp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield Vo(ji.setSecurityCenterStateError({key:t,value:Tg(n)})),null==e||e(!1)}finally{yield Vo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}}function*$g({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield Vo(ji.setSecurityCenterStateError({key:e,value:!1})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=i?i:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(u=null!=o?o:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=R({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:o}}=yield Bo(rp.users.getUsersV3,p),a={totalUsersItems:i,totalUsersPages:o,usersPageOffset:y,queryParams:R({_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 Bo(rp.roles.getRoles),i=yield Bo(rp.users.getUsersRoles,{ids:t});return e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return R({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}))}(t);yield Vo(ji.setSecurityCenterState({[n]:R({users:e},a)}))}else yield Vo(ji.setSecurityCenterState({[n]:R({users:[]},a)}))}catch(t){yield Vo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Vg({payload:e}){var t;const n=Cg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield $g(R({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:pi.BREACHED_PASSWORDS,tableState:i},e))}function*xg({payload:e}){var t;const n=Cg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield $g(R({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:pi.MFA_UNENROLLED,tableState:i},e))}function*jg({payload:e}){var t;const n=Cg.INACTIVE_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield $g(R({key:n,updateStateKey:"inactiveUsersTable",_preset:pi.INACTIVE,tableState:i},e))}function*Bg(){yield Ga(ji.loadRecommendations,Ng),yield Ga(ji.loadInsights,Mg),yield Ga(ji.sendResetBreachedPasswordEmail,Fg),yield Ga(ji.sendBulkResetBreachedPasswordEmails,Gg),yield Ga(ji.loadBreachedPasswordUsers,Vg),yield Ga(ji.loadUnenrolledMfaUsers,xg),yield Ga(ji.loadInactiveUsers,jg)}function*Wg(){const e=Cg.RECOMMENDATIONS;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield Vo(ji.setSecurityCenterState({recommendations:rg.recommendations.items,score:rg.scoring.score})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*zg(){const e=Cg.INSIGHTS;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield Vo(ji.setSecurityCenterState({insights:sg.insights.items})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Kg(){const e=Cg.BREACHED_PASSWORD_USERS_TABLE;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield Vo(ji.setSecurityCenterState({breachedPasswordUsersTable:lg})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hg(){const e=Cg.UNENROLLED_MFA_USERS_TABLE;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield Vo(ji.setSecurityCenterState({unenrolledMfaUsersTable:ug})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*qg(){const e=Cg.INACTIVE_USERS_TABLE;yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield Vo(ji.setSecurityCenterState({inactiveUsersTable:cg})),yield Vo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Jg({payload:{callback:e}}){const t=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield Vo(ji.setSecurityCenterStateLoader({key:t,value:!0})),yield Ho(500),null==e||e(!0),yield Vo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}function*Yg(){yield Ga(ji.loadRecommendations,Wg),yield Ga(ji.loadInsights,zg),yield Ga(ji.loadBreachedPasswordUsers,Kg),yield Ga(ji.loadUnenrolledMfaUsers,Hg),yield Ga(ji.loadInactiveUsers,qg),yield Ga(ji.sendResetBreachedPasswordEmail,Jg)}const Qg=["callback"],Xg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["callback"];function*iS(){yield Vo(ji.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getGlobalSecurityPolicy);yield Vo(ji.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyGlobalState({error:Tg(e),loading:!1}))}yield Vo(ji.loadSecurityPolicyMfa()),yield Vo(ji.loadSecurityPolicyVendorMfa()),yield Vo(ji.loadSecurityPolicyLockout()),yield Vo(ji.loadSecurityPolicyVendorLockout()),yield Vo(ji.loadSecurityPolicyVendorPasswordHistory()),yield Vo(ji.loadSecurityPolicyCaptcha()),yield Vo(ji.loadPublicAuthStrategiesPolicy())}function*oS(e){var t,n;if(!(yield Bo(Lg)))return e;const i=yield Bo(rS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?R({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*aS(){yield Vo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e);yield Vo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*rS(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Bo(rp.auth.getVendorPublicAuthStrategiesConfig),t}function*sS(){yield Vo(ji.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Bo(rS);yield function*(e){const t=yield Bo(Lg);if(!e||!t)return;const{policy:n}=yield Ko((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield Vo(ji.setSecurityPolicyPublicState({policy:R({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield Vo(ji.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyAuthStrategyPublicState({error:Tg(e),loading:!1}))}}function*lS(){yield Vo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getMfaPolicy);yield Vo(ji.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyMfaState({error:Tg(e),loading:!1}))}}function*cS(){yield Vo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorMfaPolicy);yield Vo(ji.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyVendorMfaState({error:Tg(e),loading:!1}))}}function*uS(e){let{payload:{callback:t}}=e,n=to(e.payload,Qg);yield Vo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveMfaPolicy,n);yield Vo(ji.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setSecurityPolicyMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dS(){yield Vo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getLockoutPolicy);yield Vo(ji.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyLockoutState({error:Tg(e),loading:!1}))}}function*yS(e){let{payload:{callback:t}}=e,n=to(e.payload,Xg);yield Vo(ji.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveLockoutPolicy,n);yield Vo(ji.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setSecurityPolicyLockoutState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*fS(){yield Vo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorLockoutPolicy);yield Vo(ji.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyVendorLockoutState({error:Tg(e),loading:!1}))}}function*pS(){yield Vo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCaptchaPolicy);yield Vo(ji.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyCaptchaState({error:Tg(e),loading:!1}))}}function*gS(){yield Vo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordHistoryPolicy);yield Vo(ji.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyPasswordHistoryState({error:Tg(e),loading:!1}))}}function*SS(){yield Vo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorPasswordHistoryPolicy);yield Vo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyVendorPasswordHistoryState({error:Tg(e),loading:!1}))}}function*vS(e){let{payload:{callback:t}}=e,n=to(e.payload,Zg);yield Vo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.savePasswordHistoryPolicy,n);yield Vo(ji.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setSecurityPolicyPasswordHistoryState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*hS(){yield Vo(ji.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordConfigPolicy);yield Vo(ji.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyPasswordState({error:Tg(e),loading:!1}))}}function*mS(){yield Va(ji.loadSecurityPolicy,iS),yield Ga(ji.saveSecurityPolicyMfa,Rg(uS)),yield Ga(ji.loadSecurityPolicyMfa,lS),yield Ga(ji.loadSecurityPolicyVendorMfa,cS),yield Ga(ji.saveSecurityPolicyLockout,Rg(yS)),yield Ga(ji.loadSecurityPolicyLockout,dS),yield Ga(ji.loadSecurityPolicyVendorLockout,fS),yield Ga(ji.loadSecurityPolicyCaptcha,pS),yield Ga(ji.saveSecurityPolicyPasswordHistory,Rg(vS)),yield Ga(ji.loadSecurityPolicyPasswordHistory,gS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,SS),yield Ga(ji.loadVendorPasswordConfig,hS),yield Ga(ji.loadPublicSecurityPolicy,aS),yield Ga(ji.loadPublicAuthStrategiesPolicy,sS)}function*AS(){yield Vo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield Vo(ji.setSecurityPolicyPublicState({policy:Np,loading:!1}))}catch(e){yield Vo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*bS(){yield Vo(ji.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyGlobalState({policy:Rp,loading:!1})),yield Vo(ji.loadSecurityPolicyMfa()),yield Vo(ji.loadSecurityPolicyVendorMfa()),yield Vo(ji.loadSecurityPolicyLockout()),yield Vo(ji.loadSecurityPolicyVendorLockout()),yield Vo(ji.loadSecurityPolicyPasswordHistory()),yield Vo(ji.loadSecurityPolicyVendorPasswordHistory()),yield Vo(ji.loadSecurityPolicyCaptcha())}function*TS(){yield Vo(ji.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyMfaState({policy:Mp,loading:!1}))}function*ES(){yield Vo(ji.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyVendorMfaState({policy:Mp,loading:!1}))}function*kS(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,eS);yield Vo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));const o=R({},Fp,{id:null!=(t=i.id)?t:Fp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield Vo(ji.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*OS(){yield Vo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*IS(){yield Vo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyVendorLockoutState({policy:Fp,loading:!1}))}function*PS(e){let{payload:{callback:t}}=e,n=to(e.payload,tS);yield Vo(ji.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=R({},Fp,n,{id:n.id?n.id:Fp.id});null==t||t(i),yield Vo(ji.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*_S(){yield Vo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*LS(){yield Vo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyPasswordHistoryState({policy:Gp,loading:!1}))}function*wS(){yield Vo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield Vo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:Gp,loading:!1}))}function*US(e){let{payload:{callback:t}}=e,n=to(e.payload,nS);yield Vo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=R({},Gp,n,{id:n.id?n.id:Gp.id});null==t||t(i),yield Vo(ji.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*CS(){yield Va(ji.loadSecurityPolicy,bS),yield Ga(ji.loadPublicSecurityPolicy,AS),yield Ga(ji.saveSecurityPolicyMfa,kS),yield Ga(ji.loadSecurityPolicyMfa,TS),yield Ga(ji.loadSecurityPolicyVendorMfa,ES),yield Ga(ji.saveSecurityPolicyLockout,PS),yield Ga(ji.loadSecurityPolicyLockout,OS),yield Ga(ji.loadSecurityPolicyVendorLockout,IS),yield Ga(ji.loadSecurityPolicyCaptcha,_S),yield Ga(ji.saveSecurityPolicyPasswordHistory,US),yield Ga(ji.loadSecurityPolicyPasswordHistory,LS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,wS)}const DS=["phoneNumber"],RS=["events","url"];function*NS(){yield Vo(ji.setSignUpState({loading:!0}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield Vo(ji.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield Vo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield Vo(ji.setSignUpState({loading:!1,error:Tg(e),firstLoad:!1}))}}function*MS(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,RS);yield Vo(ji.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield Ko((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield Bo(rp.auth.signUpUser,(a=i,to(a,DS)));if(!i.invitationToken){var o;const{email:e,name:a,companyName:r,phoneNumber:s}=i,l={email:e,name:a,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:yg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),kg(Eg.SIGNUP_COMPLETED,l)}if(!s&&l&&hg(l)){const t=yield bg(l);yield Vo(ji.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield Ko((e=>e.auth));yield Vo(ji.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield Vo(ji.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:R({},e,{tenants:d,activeTenant:y})}))}}catch(e){xa.setAccessToken(null),xa.setUser(null),yield Vo(ji.setSignUpState({loading:!1,error:Tg(e)}))}var a;yield Vo(ji.setSignUpState({loading:!1}))}function*FS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ko((e=>e.auth.signUpState));yield Vo(ji.resetSignUpState()),yield Vo(ji.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*GS(){yield Va(ji.signUpUser,MS),yield Va(ji.resetSignUpStateSoft,FS)}const $S={setVendorState:(e,{payload:t})=>R({},e,t)},VS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},xS={loading:!1},{reducer:jS,actions:BS}=pt({name:Ft,initialState:xS,reducers:R({},$S)}),WS=R({},BS,VS);function*zS(){yield Vo(WS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield rp.vendor.getVendorPublicInfo();yield Vo(WS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield Vo(WS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var KS=n(378),HS=n.n(KS);function qS(e,t){return HS()(e,t)}function*JS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield Bo(Pp,[xr]);try{const e=yield Bo(n?rp.entitlements.loadEntitlementsV2:rp.entitlements.loadEntitlements);yield function*(e){qS(yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield Vo(ji.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*YS(){yield Va(ji.loadEntitlements,JS)}var QS=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSocialLogin(e)}}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*XS(){const{publicAuthStrategyPolicy:e}=yield Ko((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===xs.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Bo(Pp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);return yield Vo(ji.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ZS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield Ko((e=>e.auth));yield Vo(ji.setState(R({user:e,tenantsState:R({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}const ev=["otp","sms","hwk"],tv="SHOULD_STEP_UP";function*nv(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield Ko((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t})(e);const{authenticatedUrl:a,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ct);u&&![r,s,l,c].includes(u)||(u=a);const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&pg(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});return(y=d).startsWith(null==(f=window)?void 0:f.location.origin)?y.replace(null==(p=window)?void 0:p.location.origin,""):y;var y,f,p}function*iv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:i}={}){const o=xa.onRedirectTo;let a;if(n)a=n;else{var r;if(i){const e=window.localStorage.getItem(Ct);e&&!pg(e)&&(a=e)}a||(a=yield Bo(nv,t)),null==(r=window)||r.localStorage.removeItem(Ct)}yield Ho(200),Vo(e()),o(a,{refresh:a.startsWith("http")})}function*ov(){var e;const{routes:{customLoginAuthenticatedUrl:t,stepUpUrl:n}}=yield Ko((e=>e.auth)),i=null==(e=window)?void 0:e.localStorage.getItem(tv),o=yield Ko((({auth:e})=>e.user));var a;if(i&&(null==(a=window)||a.localStorage.removeItem(tv)),n&&i&&!(({amr:e=[],acr:t="",auth_time:n,maxAge:i}={})=>{if(i&&n&&!(Date.now()/1e3-n<=i))return!1;const o="http://schemas.openid.net/pape/policies/2007/06/multi-factor"===t,a=-1!==e.indexOf("mfa"),r=void 0!==ev.find((t=>e.indexOf(t)));return o&&a&&r})(o))return void(yield Bo(iv,ji.resetLoginState,{forceStepUpUrl:n}));let r=t;t||(yield Bo(wg),r=yield Ko((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield Bo(iv,ji.resetLoginState,{customLoginAuthenticatedUrl:r,shouldStepUpDuringLogin:!!i})}function*av(){yield Bo(iv,ji.resetStepUpState)}const rv=["callback"];function*sv(e,t,n){const{loginState:i}=yield Ko((e=>e.auth));let o={};if(!n){const t=i.flow===Lt.Login?_t.success:i.step;o={loginState:{flow:i.flow,quickLoginToRegister:i.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return R({},o,{isAuthenticated:t})}function*lv(e,t){const{loginState:n}=yield Ko((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield Bo(Pp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield Vo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):(yield Bo(XS))?yield Vo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield ov(),null==t||t(!0)}function*cv(e){yield av(),null==e||e(!0)}function*uv(e,t,n){let{callback:i}=e,o=to(e,rv);yield Vo(t({loading:!0,error:void 0}));try{const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.loginWithMfaV2,o),s=!!e.accessToken,l=yield Bo(sv,a,s,n);if(yield Bo(ZS,{user:e,tenants:a,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield Vo(t({loading:!1,error:void 0})),n)return void(yield Bo(cv,i));yield Bo(lv,s,i)}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==i||i(!1,e)}}function*dv({payload:e}){yield uv(e,ji.setLoginState,!1)}function*yv(){yield Bo(av)}function*fv(e){const{loginState:t}=yield Ko((e=>e.auth)),{step:n}=yield Ko((e=>e.auth.mfaState)),[i]=yield Bo(Pp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield Vo(ji.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield Bo(XS);n===un.smsVerifyCode&&e?yield Vo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield ov()}}function*pv({user:e,tenants:t,activeTenant:n},i=!1){yield Vo(ji.setUser(e)),yield Vo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const o=!!e.accessToken;yield Vo(ji.setState({isAuthenticated:o})),i?yield Bo(yv):yield Bo(fv,o)}const gv=["callback","deviceId"],Sv=["callback","deviceId"];function*vv(e,t){let{callback:n,deviceId:i}=e,o=to(e,gv);yield Vo(t({loading:!1,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFASMSForLogin,i,o);yield Vo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Vo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*hv(e,t,n=!1){let{callback:i,deviceId:o}=e,a=to(e,Sv);yield Vo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFASMSForLoginV2,o,a);yield pv(e,n),yield Vo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*mv({payload:e}){yield vv(e,ji.setLoginState)}function*Av({payload:e}){yield hv(e,ji.setLoginState,!1)}const bv=["callback","deviceId"],Tv=["callback","deviceId"];function*Ev(e,t){let{callback:n,deviceId:i}=e,o=to(e,bv);yield Vo(t({loading:!0}));try{var a;const e=yield Bo(rp.auth.preVerifyMFAWebAuthnForLogin,i,o),r=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>R({},e,{id:It(e.id)})))});yield Vo(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*kv(e,t,n){let{callback:i,deviceId:o}=e,a=to(e,Tv);yield Vo(t({loading:!0}));try{const e=Pt(a.publicKey),r=yield Bo(rp.auth.verifyMFAWebAuthnForLoginV2,o,R({},a,{options:e}));yield pv(r,n),yield Vo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*Ov({payload:e}){yield Ev(e,ji.setLoginState)}function*Iv({payload:e}){yield kv(e,ji.setLoginState,!1)}const Pv=["callback"],_v=["callback"];function*Lv(e,t){let{callback:n}=e,i=to(e,Pv);yield Vo(t({loading:!0,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFAEmailCode,i);yield Vo(ji.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield Vo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield Vo(t({error:Tg(e)})),null==n||n(null)}}function*wv(e,t){let{callback:n}=e,i=to(e,_v);yield Vo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFAEmailCodeV2,i);yield pv(e),yield Vo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield Vo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*Uv({payload:e}){yield Lv(e,ji.setLoginState)}function*Cv({payload:e}){yield wv(e,ji.setLoginState)}const Dv=["callback"],Rv=["callback"],Nv=["callback"],Mv=["callback"],Fv=["callback","events"],Gv=["callback"],$v=["callback"],Vv=["callback"],xv=["callback"],jv=["user"],Bv=["callback"],Wv=["callback"],zv=["callback"],Kv=["callback"],Hv=["callback"];function*qv(e){const t=yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return qS(t,null==e?void 0:e.entitlements)?R({},e,{entitlements:t}):e}function*Jv(){let e;try{var t;const n=yield Bo(rp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield Vo(ji.setState({ssoACS:e}))}function*Yv(){try{const{isActive:e}=yield Bo(rp.auth.getSSOPublicConfiguration);yield Vo(ji.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Qv(e){var t;const{routes:n,loginState:i}=yield Ko((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Xv(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(Zv):yield Bo(th)}function*Zv(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return xa.setAccessToken(null),xa.setUser(null),void(yield Vo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(qv,n.user);yield Bo(ZS,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){xa.setAccessToken(null),xa.setUser(null),yield Vo(ji.setState({user:null,isAuthenticated:!1}))}}function*eh(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return xa.setAccessToken(null),xa.setUser(null),void(yield Vo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(qv,n.user);yield Bo(ZS,R({},n,{user:i}),{isAuthenticated:!0})}catch(e){xa.setAccessToken(null),xa.setUser(null),yield Vo(ji.setState({user:null,isAuthenticated:!1}))}}function*th(){try{const t=xa.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield Vo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Qv(o),s=yield Bo(qv,o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield ih(n)}}catch(e){xa.setAccessToken(null),xa.setUser(null),yield Vo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*nh(){try{const t=xa.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield Vo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield Bo(qv,o);if(yield Bo(XS))yield Vo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Qv(o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:R({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield ih(n)}}}catch(e){xa.setAccessToken(null),xa.setUser(null),yield Vo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*ih(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=xa.onRedirectTo,{routes:o,loginState:a}=yield Ko((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield ov())}function*oh({payload:{callback:e}}){try{const{ip:t}=yield Bo(rp.metadata.getCurrentUserIpMetadata);yield Vo(ji.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ah({payload:e}){const t=[];(yield Bo(Lg))?yield Bo(Xv):t.push(Bo(Xv)),e&&(yield Vo(ji.setState({isLoading:!0})),yield Vo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(sS)),t.push(Bo(Yv)),t.push(Bo(zS)),t.push(Bo(Jv)),t.push(Bo(wg))),yield xo(t),yield Vo(ji.setState({isLoading:!1}))}function*rh({accessToken:e,user:t}){if(!e)return void(yield Vo(ji.setState({user:void 0,isAuthenticated:!1})));const n=xa.onRedirectTo,{routes:i}=yield Ko((e=>e.auth));if(hg(t)){const e=yield bg(t);yield Vo(ji.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*sh({payload:e}){const t=[];yield Vo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(Yv)),t.push(Bo(zS)),t.push(Bo(Jv)),t.push(Bo(rh,e)),t.push(Bo(wg)),yield xo(t)}const lh=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*ch(){const e=yield Bo(rp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*uh({payload:e}){const{disableSilentRefresh:t}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield ch()}catch(t){yield yh(e)}else yield yh(e)}function*dh({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:i}}){var o;if(n){const{urlStrategy:e}=yield Ko((e=>({urlStrategy:e.root.urlStrategy}))),t=lh(e);if(yield Vo(ji.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:a}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(i&&((e=e||{}).login_direct_action=btoa(JSON.stringify(i))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(a)throw new Error("silent refresh is disabled");yield ch()}catch(n){if(!t)return void(yield Vo(ji.setState({isLoading:!1})));yield yh(e)}else yield yh(e)}function*yh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Ko((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(lh(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield Vo(ji.setState({isLoading:!0}));const a=Op(),r=Op(),s=yield Bo(kp,r);localStorage.setItem(Dt,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield Bo(wg);const c=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${Lr(n,"/oauth/authorize")}/oauth/authorize`,d=R({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Sg(vg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*fh({payload:e}){const t=localStorage.getItem(Dt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Ko((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield Bo(wg);const a=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Bo(rp.auth.exchangeOAuthTokensV2,r);yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield Vo(ji.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield ov()}}function*ph(e){let{payload:{callback:t}}=e,n=to(e.payload,Dv);try{yield Vo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.changePhoneNumberWithVerification,n);yield Vo(ji.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*gh(e){let{payload:{callback:t}}=e,n=to(e.payload,Rv);try{yield Vo(ji.setLoginState({loading:!0})),yield Bo(rp.auth.verifyChangePhoneNumber,n),yield Vo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*Sh(e){let{payload:{callback:t}}=e,n=to(e.payload,Nv);try{yield Vo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.passwordlessPreLogin,R({},n,{type:Oi.SmsCode}));yield Vo(ji.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t(e)}}function*vh(e){let{payload:{callback:t}}=e,n=to(e.payload,Mv);try{let e;yield Vo(ji.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield Bo(rp.auth.passwordlessPreLogin,n),o=Pi[n.type];yield Vo(ji.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield Vo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t()}}function*hh(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,Fv);try{yield Vo(ji.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.passwordlessPostLoginV2,i),s=xa.onRedirectTo,{routes:l}=yield Ko((e=>e.auth));if(hg(e)){const t=yield bg(e);yield Vo(ji.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ko((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:dg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),kg(Eg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Bo(ZS,{user:e,tenants:a,activeTenant:r}),yield Vo(ji.setLoginState({error:void 0})),yield Vo(ji.setState({isLoading:!1})),i.flow===Lt.Login?(yield Bo(XS))?(yield Vo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield Vo(ji.setState({isAuthenticated:!0})),yield ov()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield Vo(ji.setLoginState({error:Tg(e,"Failed to authenticate")}))}finally{yield Vo(ji.setLoginState({loading:!1}))}}function*mh({payload:e}){try{yield Vo(ji.setLoginState({loading:!0}));const{name:t}=yield Bo(rp.auth.verifyInviteToken,e);yield Vo(ji.setLoginState({inviteTokenTenantName:t}))}catch(e){yield Vo(ji.setLoginState({inviteTokenError:Tg(e,"We couldn't verify your invitation")}))}finally{yield Vo(ji.setLoginState({loading:!1}))}}function*Ah({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield Vo(ji.setLoginState({loading:!0}));try{const o=yield Ko((({auth:{onRedirectTo:e}})=>e)),a=Sg(vg),{address:r,idpType:s}=yield Bo(rp.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===cp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ko((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}QS.isAvailable("loginWithSSO")?(QS.loginWithSSO(e),yield Vo(ji.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield Vo(ji.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield bh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield bh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*bh(e){let{callback:t}=e,n=to(e,Gv);const i=yield Ko((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield Vo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Oi.EmailAndPassword?(yield Vo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[Oi.MagicLink,Oi.Code,Oi.SmsCode].includes(null==i?void 0:i.authStrategy)?yield Vo(ji.passwordlessPreLogin(R({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield Vo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Th({payload:{callback:e}}){try{yield Vo(ji.setLoginState({loading:!0}));const{options:t}=yield Bo(rp.auth.webAuthnCreateNewDeviceSession);t.user.id=It(t.user.id),t.challenge=It(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield Vo(ji.setLoginState({error:Tg(t)})),null==e||e(null)}finally{yield Vo(ji.setLoginState({loading:!1}))}}function*Eh(e){let{payload:{callback:t}}=e,n=to(e.payload,$v);try{yield Vo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?js.Platform:js.CrossPlatform;yield Bo(rp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield Vo(ji.setLoginState({loading:!1}))}}function*kh(e){let{payload:{callback:t}}=e,n=to(e.payload,Vv);try{var i;yield Vo(ji.setPasskeysState({loading:!0})),yield Vo(ji.setLoginState({loading:!0}));const{options:e}=yield Bo(rp.auth.webAuthnPreLogin,n);e.challenge=It(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)}))),yield Vo(ji.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield Vo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield Vo(ji.setPasskeysState({loading:!1})),yield Vo(ji.setLoginState({loading:!1}))}}function*Oh(e){let{payload:{callback:t}}=e,n=to(e.payload,xv);try{var i;yield Vo(ji.setPasskeysState({loading:!0})),yield Vo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield Bo(rp.auth.webAuthnPostLoginV2,R({},e,{response:R({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=o,r=to(o,jv);if(hg(a)){const e=xa.onRedirectTo,{routes:t}=yield Ko((e=>e.auth)),n=yield bg(a);yield Vo(ji.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,R({user:a},r),{isAuthenticated:!0}),yield Vo(ji.setLoginState({error:void 0})),yield ov(),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield Vo(ji.setPasskeysState({loading:!1})),yield Vo(ji.setLoginState({loading:!1}))}}function*Ih({payload:e}){const{onRedirectTo:t,routes:n}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Vo(ji.setLoginState({loading:!0}));try{const t=yield Bo(rp.auth.postLogin,e);yield Vo(ji.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield ov()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield Vo(ji.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*Ph({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield Vo(ji.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield Bo(rp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=xa.onRedirectTo,{routes:c}=yield Ko((e=>e.auth));if(hg(a)){const e=yield bg(a);yield Vo(ji.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ko((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,{user:a,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?_t.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[i]=yield Bo(Pp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield Vo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield Bo(XS))?(yield Vo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield ov()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){xa.setAccessToken(null),xa.setUser(null),null==o||o(!1,t),yield Vo(ji.setLoginState({email:e,error:Tg(t),loading:!1}))}}function*_h({payload:e}){yield Vo(ji.setLoginState({loading:!0}));try{var t;yield Bo(rp.auth.recoverMfaToken,e),yield Vo(ji.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield Vo(ji.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setLoginState({error:Tg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lh({payload:e}){const{hostedLoginBox:t}=yield Ko((e=>e.auth));yield Vo(ji.setState({isLoading:!0}));try{t?yield Bo(rp.auth.OAuthLogout):yield Bo(rp.auth.logout)}catch{}yield Vo(ji.resetState()),yield Vo(ji.requestAuthorize(!0)),null==e||e()}function*wh({payload:e}){var t;try{yield Bo(rp.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*Uh({user:e,tenants:t,activeTenant:n}){const i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield Vo(ji.setMfaState(i)),yield Vo(ji.setUser(e)),yield Vo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ch(e){let{payload:{callback:t}}=e,n=to(e.payload,Bv);yield Vo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.preEnrollMFASMSForLogin,n);yield Vo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield Vo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Dh(e){let{payload:{callback:t}}=e,n=to(e.payload,Wv);yield Vo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFASMSForLoginV2,n);yield Uh(e),yield Vo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Rh(e){let{payload:{callback:t}}=e,n=to(e.payload,zv);yield Vo(ji.setLoginState({loading:!0}));try{var i;const e=yield Bo(rp.auth.preEnrollMFAWebAuthnForLogin,n),o=R({},e.options,{challenge:It(e.options.challenge),user:R({},e.options.user,{id:It(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield Vo(ji.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Nh(e){let{payload:{callback:t}}=e,n=to(e.payload,Kv);yield Vo(ji.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthnForLoginV2,R({},n,{options:e}));yield Uh(i),yield Vo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Mh(e){let{payload:{callback:t}}=e,n=to(e.payload,Hv);yield Vo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield Uh(e),yield Vo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Fh({payload:e}){yield Vo(ji.setLoginState({loading:!0}));try{yield Bo(rp.auth.forgotPassword,e),yield Vo(ji.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield Vo(ji.setState({isAuthenticated:!1}))}catch(e){yield Vo(ji.setLoginState({loading:!1,error:Tg(e)}))}}function*Gh(){yield Va(ji.requestAuthorize,ah),yield Va(ji.requestAuthorizeSSR,sh),yield Va(ji.requestHostedLoginAuthorize,uh),yield Va(ji.requestHostedLoginAuthorizeV2,dh),yield Va(ji.handleHostedLoginCallback,fh),yield Va(ji.preLogin,Ah),yield Va(ji.postLogin,Ih),yield Va(ji.login,Ph),yield Va(ji.logout,Lh),yield Va(ji.silentLogout,wh),yield Va(ji.loginWithMfa,dv),yield Va(ji.recoverMfa,_h),yield Va(ji.quickSmsPasswordlessPreLogin,Sh),yield Va(ji.changePhoneNumberWithVerification,ph),yield Va(ji.verifyChangePhoneNumber,gh),yield Va(ji.passwordlessPreLogin,vh),yield Va(ji.passwordlessPostLogin,hh),yield Va(ji.verifyInviteToken,mh),yield Va(ji.webAuthnPrelogin,kh),yield Va(ji.webAuthnPostLogin,Oh),yield Va(ji.webAuthnCreateNewDeviceSession,Th),yield Va(ji.webAuthnVerifyNewDeviceSession,Eh),yield Va(ji.afterAuthNavigation,ov),yield Va(ji.getUserIP,oh),yield Va(ji.preEnrollMFASMSForLogin,Ch),yield Va(ji.enrollMFASMSForLogin,Dh),yield Va(ji.preEnrollMFAWebAuthnForLogin,Rh),yield Va(ji.enrollMFAWebAuthnForLogin,Nh),yield Va(ji.enrollMFAAuthenticatorAppForLogin,Mh),yield Va(ji.preVerifyMFASMSForLogin,mv),yield Va(ji.verifyMFASMSForLogin,Av),yield Va(ji.preVerifyMFAWebAuthnForLogin,Ov),yield Va(ji.verifyMFAWebAuthnForLogin,Iv),yield Va(ji.preVerifyMFAEmailCode,Uv),yield Va(ji.verifyMFAEmailCode,Cv),yield Va(ji.resetBreachedPassword,Fh)}function*$h({payload:e}){e&&(yield Vo(ji.setState({isLoading:!0})));const t=Cp;yield Vo(ji.loadTenants()),yield Vo(ji.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Vh({payload:{callback:e}}){try{const{ip:t}=ng[0];yield Vo(ji.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*xh(){yield Va(ji.requestAuthorize,$h),yield Va(ji.afterAuthNavigation,ov),yield Va(ji.getUserIP,Vh)}const jh=["callback","samlVendor"],Bh=["callback","samlVendor"];function*Wh(){try{var e,t;yield Vo(ji.setSSOState({loading:!0}));const n=yield Bo(rp.auth.getSamlConfiguration),i=yield Bo(rp.auth.getOidcConfiguration),o=yield Bo(rp.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield Vo(ji.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield Vo(ji.setSSOState({error:Tg(e),loading:!1}))}}function*zh({payload:e}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield Vo(ji.setSSOState({error:void 0,[n]:!0}));try{const i=yield Ip(e[0]),o=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield Vo(ji.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield Vo(ji.setSSOState({samlConfiguration:t,error:Tg(e),[n]:!1}))}}function*Kh({payload:e}){const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield Vo(ji.setSSOState({error:void 0,[o]:!0}));try{const e=yield Ip(t),a=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield Vo(ji.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield Vo(ji.setSSOState({samlConfiguration:i,error:Tg(e),[o]:!1})),null==n||n(null,e)}}function*Hh({payload:e}){const{callback:t,samlVendor:n}=e,i=to(e,jh),o=yield Ko((e=>e.auth.ssoState.samlConfiguration)),a=R({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield Vo(ji.setSSOState({samlConfiguration:R({},o,a)})));if(yield Vo(ji.setSSOState({error:void 0,[r]:!0})),e.type===cp.Saml){var s,l;const e=yield Bo(rp.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Ep(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Bo(rp.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield Vo(ji.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setSSOState({samlConfiguration:o,error:Tg(e),[r]:!1})),null==t||t(null,e)}}function*qh({payload:{callback:e}={}}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration));try{yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.validateSamlDomain),yield Vo(ji.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield Vo(ji.setSSOState({samlConfiguration:R({},t,{validated:!1}),error:Tg(n),saving:!1})),null==e||e(null,n)}}function*Jh(){try{const e=yield Bo(rp.auth.getSamlRoles),t=yield Bo(rp.auth.getSamlRolesGroups);yield Vo(ji.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield Vo(ji.setSSOState({error:Tg(e)}))}}function*Yh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield xo(e.map((e=>Bo(rp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield Vo(ji.setSSOState({error:Tg(e)}))}}(n)),yield Jh(),yield Vo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Vo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*Qh({payload:{callback:e,id:t}}){try{yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.deleteSamlGroup,{id:t}),yield Jh(),yield Vo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield Vo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*Xh({payload:{group:e,roleIds:t,callback:n}}){try{yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.createSamlGroup,{group:e,roleIds:t}),yield Jh(),yield Vo(ji.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield Vo(ji.setSSOState({error:Tg(e),saving:!1})),null==n||n(null,e)}}function*Zh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield Vo(ji.setSSOState({loading:!0})),yield Bo(rp.auth.oidcPostLoginV2,t),yield Bo(Xv),yield Vo(ji.setSSOState({loading:!1}))}catch(e){yield Vo(ji.setSSOState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*em(){yield Ga(ji.loadSSOConfigurations,Wh),yield Ga(ji.saveSSOConfigurations,Hh),yield Ga(ji.saveSSOConfigurationsFile,zh),yield Ga(ji.saveSSOConfigurationsFileWithCallback,Kh),yield Ga(ji.validateSSODomain,qh),yield Ga(ji.loadSSOAuthorizationRoles,Jh),yield Ga(ji.updateSSOAuthorizationRoles,Yh),yield Ga(ji.deleteSamlGroup,Qh),yield Ga(ji.createSamlGroup,Xh),yield Ga(ji.oidcPostlogin,Zh)}function*tm(){yield Vo(ji.setSSOState({loading:!0})),yield Et(),yield Vo(ji.setSSOState({samlConfiguration:$p,loading:!1,firstLoad:!1}))}function*nm({payload:e}){const t="saving";yield Vo(ji.setSSOState({error:void 0,[t]:!0}));const n=R({},yield Ko((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield Vo(ji.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*im({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=to(e,Bh),r=jp.samlConfiguration,s=R({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield Vo(ji.setSSOState({samlConfiguration:R({},r,s)})));yield Vo(ji.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==Vp||null==(t=Vp.configuration)?void 0:t.acsUrl,s.spEntityId=null==Vp||null==(n=Vp.configuration)?void 0:n.spEntityId;const c=Ep(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield Et(),yield Vo(ji.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*om({payload:{callback:e}={}}){const t=jp.samlConfiguration;yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield Vo(ji.setSSOState({samlConfiguration:R({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*am(){yield Et(),yield Vo(ji.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*rm({payload:{callback:e,authorizationRoles:t}}){yield Vo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield Vo(ji.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*sm(){yield Ga(ji.loadSSOConfigurations,tm),yield Ga(ji.saveSSOConfigurations,im),yield Ga(ji.saveSSOConfigurationsFile,nm),yield Ga(ji.validateSSODomain,om),yield Ga(ji.loadSSOAuthorizationRoles,am),yield Ga(ji.updateSSOAuthorizationRoles,rm)}const lm=["callback"],cm=["callback","ssoConfigId"],um=["callback","ssoConfigId"],dm=["callback","ssoConfigId"];function*ym(){try{return yield Bo(rp.auth.getOidcConfiguration)}catch(e){return null}}function*fm(){try{return yield Bo(rp.metadata.getSamlMetadata)}catch(e){return null}}function*pm(){try{yield Vo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield xo([Bo(ym),Bo(fm)]),n=yield Bo(rp.auth.getSSOConfigurations);yield Vo(ji.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield Vo(ji.setSSOError({key:lp.LOAD_SSO_CONFIGURATIONS,value:Tg(e)}))}finally{yield Vo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*gm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=to(e,lm),i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Bo(rp.auth.createSSOConfiguration,R({},n,{enabled:null!=(o=n.enabled)&&o}));yield Vo(ji.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield Vo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Sm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ip(t),o=yield Bo(rp.auth.createSSOConfigurationByMetadata,{metadata:e});yield Vo(ji.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield Vo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Tg(e)})),null==n||n(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*vm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,cm),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield Vo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Vo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*hm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Ip(i),a=yield Bo(rp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield Vo(ji.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield Vo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*mm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSOConfiguration,t),yield Vo(ji.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield Vo(ji.setSSOError({key:lp.DELETE_SSO_CONFIGURATION,value:Tg(e)})),null==n||n(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Am({payload:e}){const{callback:t,ssoConfigId:n}=e,i=to(e,um);yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?R({},t,{domains:[...t.domains,e]}):t));yield Vo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield Vo(ji.setSSOError({key:lp.SAVE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!1}))}}function*bm({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield Vo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?R({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield Vo(ji.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield Vo(ji.setSSOError({key:lp.DELETE_SSO_DOMAIN,value:Tg(e)})),null==i||i(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!1}))}}function*Tm({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield Vo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?R({},e,{domains:e.domains.map((e=>e.id===n?R({},e,{validated:!0}):e))}):e));yield Vo(ji.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield Vo(ji.setSSOError({key:lp.VALIDATE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Em({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?R({},e,{roleIds:n}):e));yield Vo(ji.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield Vo(ji.setSSOError({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:Tg(t)})),null==e||e(null,t)}finally{yield Vo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*km({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield xo(t.map((e=>Bo(rp.auth.deleteSSOGroup,n,e)))),yield xo(e.map((e=>Bo(rp.auth.createSSOGroup,n,e))));const a=yield Bo(rp.auth.getSSOGroups,n),r=o.map((e=>e.id===n?R({},e,{groups:a}):e));yield Vo(ji.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield Vo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==i||i(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Om({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield xo(t.map((t=>Bo(rp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield Vo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==n||n(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Im({payload:e}){yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield Bo(rp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield Bo(rp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield Vo(ji.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Pm({payload:e}){yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,dm),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield Bo(rp.auth.createSSOConfiguration,i),a=[e,...o]),yield Vo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield Vo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*_m(){yield Ga(ji.loadSSOConfigurationsV2,pm),yield Ga(ji.saveSSOConfigurationV2,gm),yield Ga(ji.saveSSODomain,Am),yield Ga(ji.deleteSSODomain,bm),yield Ga(ji.validateSSODomainV2,Tm),yield Ga(ji.updateSSOConfiguration,vm),yield Ga(ji.deleteSSOConfiguration,mm),yield Ga(ji.setSSOGroups,km),yield Ga(ji.updateSSOGroups,Om),yield Ga(ji.setSSODefaultRoles,Em),yield Ga(ji.saveSSOConfigurationByMetadata,Sm),yield Ga(ji.updateSSOConfigurationByMetadata,hm),yield Ga(ji.saveSSOConfigurationByUrl,Im),yield Ga(ji.saveSSOConfigurationByData,Pm)}const Lm=["callback","profilePictureUrl"],wm=["callback","profilePictureUrl"];function*Um(){yield Vo(ji.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Bo.apply(void 0,[Fa,e,t,n].concat(o))}(3,2e3,rp.teams.getProfile),t=yield Ko((e=>e.auth.user));ji.setUser(R({},t,e)),yield Vo(ji.setProfileState({profile:e,loading:!1}))}catch(e){yield Vo(ji.setProfileState({loading:!1,error:Tg(e)}))}}function*Cm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,Lm);yield Vo(ji.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Ko((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Bo(rp.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=R({},e,i,{profilePictureUrl:o}),r=yield Bo(rp.users.updateUserProfileV2,a),s=yield Ko((e=>e.auth.user));yield Vo(ji.setUser(R({},s,r))),yield Vo(ji.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield Vo(ji.setProfileState({saving:!1,error:Tg(e),loading:!1})),null==t||t(null,e)}}function*Dm({payload:e}){yield Vo(ji.setProfileState({loading:!0}));try{var t;yield Bo(rp.teams.changePassword,e),yield Vo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setProfileState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Rm(){yield Va(ji.loadProfile,Um),yield Ga(ji.saveProfile,Cm),yield Ga(ji.changePassword,Dm)}function*Nm(){yield Vo(ji.setProfileState({loading:!0})),yield Et(),yield Vo(ji.setUser(R({},Cp,Up))),yield Vo(ji.setProfileState({loading:!1,profile:Up}))}function*Mm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,wm);yield Vo(ji.setProfileState({saving:!0,error:null}));const o=Dp;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=R({},o.profile,i,{profilePictureUrl:a}),s=Cp;yield Et(),yield Vo(ji.setUser(R({},s,r))),yield Vo(ji.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Fm({payload:e}){var t;yield Vo(ji.setProfileState({loading:!0})),yield Et(),yield Vo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Gm(){yield Va(ji.loadProfile,Nm),yield Ga(ji.saveProfile,Mm),yield Ga(ji.changePassword,Fm)}const $m=["callback"],Vm=["callback"],xm=["user"],jm=["callback"],Bm=["deviceId","callback"],Wm=["deviceId","callback"],zm=["callback"],Km=["deviceId"],Hm=["deviceId"],qm=["callback"],Jm=["deviceId"],Ym=["callback"];function*Qm(e){const{step:t}=yield Ko((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*Xm(){yield Vo(ji.setMfaState({saving:!0}));try{const{qrCode:e}=yield Bo(rp.auth.enrollMfa);yield Vo(ji.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)}))}}function*Zm(e){let{payload:{callback:t}}=e,n=to(e.payload,$m);yield Vo(ji.setMfaState({saving:!0}));try{const e=yield Ko((e=>e.auth.user)),i=yield Bo(rp.auth.verifyMfa,n),o=yield Bo(rp.auth.getMFADevices),a=yield Qm(i);yield Vo(ji.setMfaState(R({},a,{mfaDevices:o}))),yield Vo(ji.setUser(R({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*eA(e){let{payload:{callback:t}}=e,n=to(e.payload,Vm);yield Vo(ji.setMfaState({loading:!0}));try{const e=yield Bo(rp.auth.loginWithMfaV2,n),{user:i}=e,o=to(e,xm),a={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield Vo(ji.setMfaState(a)),yield ZS(R({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield Vo(ji.setMfaState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*tA({payload:e}){yield Vo(ji.setMfaState({saving:!0}));try{var t;yield Bo(rp.auth.disableMfa,e);const n=yield Bo(rp.auth.getMFADevices);yield Vo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*nA({payload:e}){yield Vo(ji.setMfaState({saving:!0}));try{var t,n;const i=yield Bo(rp.auth.preEnrollMFAWebAuthn),o=R({},i.options,{challenge:It(i.options.challenge),user:R({},i.options.user,{id:It(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>R({},e,{id:It(e.id)})))});yield Vo(ji.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield Vo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*iA(e){let{payload:{callback:t}}=e,n=to(e.payload,jm);yield Vo(ji.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthn,R({},n,{options:e})),o=yield Bo(rp.auth.getMFADevices),a=yield Qm(i);yield Vo(ji.setMfaState(R({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*oA(e){let{payload:{deviceId:t,callback:n}}=e;to(e.payload,Bm),yield Vo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFAWebAuthn,t),o=R({},e.options,{challenge:It(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>R({},e,{id:It(e.id)})))});yield Vo(ji.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(null,e)}}function*aA(e){let{payload:{deviceId:t,callback:n}}=e,i=to(e.payload,Wm);yield Vo(ji.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield Bo(rp.auth.disableMFAWebAuthn,t,R({},i,{options:e}));const o=yield Bo(rp.auth.getMFADevices);yield Vo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(!1,e)}}function*rA({payload:e}){yield Vo(ji.setMfaState({saving:!0}));try{var t;const n=yield Bo(rp.auth.preEnrollMFASMS,e);yield Vo(ji.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 Vo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*sA(e){let{payload:{callback:t}}=e,n=to(e.payload,zm);yield Vo(ji.setMfaState({saving:!0}));try{const e=yield Bo(rp.auth.enrollMFASMS,n),i=yield Bo(rp.auth.getMFADevices),o=yield Qm(e);yield Vo(ji.setMfaState(R({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*lA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Km);yield Vo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFASMS,t);yield Vo(ji.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*cA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Hm);yield Vo(ji.setMfaState({saving:!0}));try{var i;yield Bo(rp.auth.disableMFASMS,t,n);const e=yield Bo(rp.auth.getMFADevices);yield Vo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*uA(){yield Vo(ji.setMfaState({loading:!0}));try{yield Ko((e=>e.auth.user));const e=yield Bo(rp.auth.getMFADevices);yield Vo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield Vo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*dA(){yield Vo(ji.setMfaState({loading:!0}));try{const e=(yield Bo(rp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield Vo(ji.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield Vo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*yA(){yield Ga(ji.enrollMfa,Xm),yield Ga(ji.getMFADevices,uA),yield Ga(ji.getMFAStrategies,dA),yield Ga(ji.verifyMfa,Zm),yield Ga(ji.disableMfa,tA),yield Ga(ji.verifyMfaAfterForce,eA),yield Ga(ji.preDisableMfaSms,lA),yield Ga(ji.disableMfaSms,cA),yield Ga(ji.preEnrollMfaSms,rA),yield Ga(ji.enrollMfaSms,sA),yield Ga(ji.preEnrollMfaWebAuthn,nA),yield Ga(ji.enrollMfaWebAuthn,iA),yield Ga(ji.preDisableMfaWebAuthn,oA),yield Ga(ji.disableMfaWebAuthn,aA)}function*fA(){yield Vo(ji.setMfaState({saving:!0})),yield Vo(ji.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*pA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield Vo(ji.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield Vo(ji.setMfaState(i)),yield Vo(ji.setUser(R({},Cp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*gA(e){let{payload:{callback:t}}=e,n=to(e.payload,qm);yield Vo(ji.setMfaState({loading:!0})),yield Et();const i=R({},n,{recoveryCode:"recoveryCode"}),o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Vo(ji.setMfaState(o)),yield Et(),yield Vo(ji.setUser(R({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*SA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield Vo(ji.setMfaState({saving:!0})),yield Et(),yield Vo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:R({},n,{authenticators:[]})})),yield Vo(ji.setUser(R({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*vA(e){let{}=e,t=to(e.payload,Jm);yield Vo(ji.setMfaState({saving:!0}));try{var n;yield Vo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield Vo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*hA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield Vo(ji.setMfaState({saving:!0})),yield Et(),yield Vo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:R({},n,{phones:[]})})),yield Vo(ji.setUser(R({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*mA({payload:e}){var t;yield Vo(ji.setMfaState({saving:!0})),yield Et(),yield Vo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*AA(e){let{payload:{callback:t}}=e;to(e.payload,Ym);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield Vo(ji.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:R({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield Vo(ji.setMfaState(o)),yield Vo(ji.setUser(R({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*bA(){yield Ga(ji.enrollMfa,fA),yield Ga(ji.verifyMfa,pA),yield Ga(ji.disableMfa,SA),yield Ga(ji.verifyMfaAfterForce,gA),yield Ga(ji.preDisableMfaSms,vA),yield Ga(ji.disableMfaSms,hA),yield Ga(ji.preEnrollMfaSms,mA),yield Ga(ji.enrollMfaSms,AA)}const TA=["callback"];function*EA({payload:e}){yield Vo(ji.setForgotPasswordState({loading:!0}));try{var t;yield Bo(rp.auth.forgotPassword,e),yield Vo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setForgotPasswordState({loading:!1,error:Tg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*kA(e){let{payload:{callback:t}}=e,n=to(e.payload,TA);yield Vo(ji.setForgotPasswordState({loading:!0}));try{yield Bo(rp.auth.resetPassword,n),yield Vo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==t||t(!0)}catch(e){yield Vo(ji.setForgotPasswordState({loading:!1,error:Tg(e)})),null==t||t(!1,e)}}function*OA({payload:e}){yield Vo(ji.setForgotPasswordState({loading:!0}));try{const t=yield Bo(rp.auth.loadPasswordConfig,e);yield Vo(ji.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield Vo(ji.setForgotPasswordState({loading:!1,error:Tg(e)}))}}function*IA(){yield Va(ji.forgotPassword,EA),yield Va(ji.resetPassword,kA),yield Va(ji.loadPasswordConfig,OA)}let PA;!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"}(PA||(PA={}));const _A=["callback","events"],LA=["user"],wA=["callback"],UA=["callback"];function*CA({payload:{userId:e,token:t}}){yield Vo(ji.setActivateState({loading:!0,step:xt.activating}));try{const{isAuthenticated:n}=yield Ko((e=>e.auth));n&&(yield Vo(ji.silentLogout()));const i=yield Bo(rp.auth.getActivateAccountStrategy,{userId:e,token:t});yield Vo(ji.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield Vo(ji.setActivateState({loading:!1,step:xt.activatingForm})))}catch(e){yield Vo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*DA(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,_A);yield Vo(ji.setActivateState({loading:!0}));try{const e=xa.onRedirectTo,{routes:a}=yield Ko((e=>e.auth)),r=yield Bo(rp.auth.activateAccountV2,i),{user:s}=r,l=to(r,LA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(hg(s)){yield Vo(ji.setActivateState({step:xt.success}));const t=yield bg(s);yield Vo(ji.setState(t)),yield Ho(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield Vo(ji.setActivateState({step:xt.success}));const e={email:s.email,origin:dg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),kg(Eg.USER_VERIFIED,e),yield Bo(ZS,R({user:s},l),{isAuthenticated:!0}),yield Ho(1e3),yield ov(),yield Vo(ji.resetActivateState())}null==t||t(!0)}catch(e){yield Vo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*RA({payload:e}){const{callback:t}=e,n=to(e,wA);yield Vo(ji.setActivateStrategyState({loading:!0}));try{const e=yield Bo(rp.auth.getActivateAccountStrategy,n);yield Vo(ji.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield Vo(ji.setActivateStrategyState({loading:!1,error:Tg(e)}))}}function*NA({payload:e}){const{callback:t}=e,n=to(e,UA);yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.email})),yield Vo(ji.setActivateState({loading:!0}));try{yield Bo(rp.auth.resendActivationEmail,n),yield Vo(ji.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield Vo(ji.setActivateState({loading:!1,error:Tg(e)})),yield Vo(ji.setTeamError({key:PA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*MA(){yield Va(ji.activateAccount,DA),yield Va(ji.preActivateAccount,CA),yield Va(ji.getActivateAccountStrategy,RA),yield Va(ji.resendActivationEmail,NA)}function*FA({payload:e}){if(e.token&&e.userId)try{yield Vo(ji.setAcceptInvitationState({error:void 0,step:zt.pending})),yield Bo(rp.auth.acceptInvitation,e),yield Vo(ji.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:zt.success}}))}catch(e){yield Vo(ji.setAcceptInvitationState({step:zt.failed,error:Tg(e)}))}else yield Vo(ji.setAcceptInvitationState({error:void 0,step:zt.invalid}))}function*GA(){yield Va(ji.acceptInvitation,FA)}var $A,VA=new Uint8Array(16);function xA(){if(!$A&&!($A="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 $A(VA)}for(var jA=/^(?:[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,BA=function(e){return"string"==typeof e&&jA.test(e)},WA=[],zA=0;zA<256;++zA)WA.push((zA+256).toString(16).substr(1));var KA=function(e,t,n){var i=(e=e||{}).random||(e.rng||xA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(WA[e[t+0]]+WA[e[t+1]]+WA[e[t+2]]+WA[e[t+3]]+"-"+WA[e[t+4]]+WA[e[t+5]]+"-"+WA[e[t+6]]+WA[e[t+7]]+"-"+WA[e[t+8]]+WA[e[t+9]]+"-"+WA[e[t+10]]+WA[e[t+11]]+WA[e[t+12]]+WA[e[t+13]]+WA[e[t+14]]+WA[e[t+15]]).toLowerCase();if(!BA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let HA,qA;!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"}(HA||(HA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qA||(qA={}));const JA=["callback"],YA=["roles"],QA=["callback"],XA=["callback","profileImage"],ZA=["callback"],eb=["callback","userId"],tb=["callback"],nb=["callback"],ib=["callback"],ob=["callback"],ab=["callback"],rb=["callback"],sb=["callback"],lb=["callback","profileImage"],cb=["callback"],ub=["callback"],db=["callback"],yb=["callback"],fb=["callback"],pb=["callback"],gb=()=>Ko((e=>e.auth.teamState));function*Sb(){try{const{groups:e}=yield Bo(rp.groups.getGroups,{_groupsRelations:qA.roles});return e}catch(e){return[]}}function*vb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield gb(),c=null!=(t=e.pageSize)?t:l.pageSize,u=null!=(n=e.pageOffset)?n:l.pageOffset,d=null!=(i=e.filter)?i:l.filterV2,y=null!=(o=e.sort)?o:l.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==l?void 0:l.shouldShowSubTenantUsersIfReseller;yield Vo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield Vo(ji.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield xo([Bo(rp.users.getUsersV2,R({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions),Bo(Sb)]),l=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 R({},e,{groups:n})}));yield Vo(ji.setTeamState({users:l.map((e=>R({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:o,permissions:a})),null==s||s(t)}catch(e){yield Vo(ji.setTeamError({key:PA.USERS,value:Tg(e)})),yield Vo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Vo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*hb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield gb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield Vo(ji.setTeamLoader({key:PA.USERS,value:!a})),yield Vo(ji.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield xo([Bo(rp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield Vo(ji.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield Vo(ji.setTeamError({key:PA.USERS,value:e.message})),yield Vo(ji.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield Vo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*mb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield gb(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield Vo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield Vo(ji.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield xo([Bo(rp.subTenants.loadAllUsers,R({},c)),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield Vo(ji.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield Vo(ji.setTeamError({key:PA.USERS,value:Tg(e)})),yield Vo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield Vo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*Ab({payload:e}){yield Vo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield xo([Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield Vo(ji.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield Vo(ji.setTeamError({key:PA.ROLES_AND_PERMISSIONS,value:Tg(t)}))}yield Vo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0}))}function*bb({payload:e}){const{callback:t}=e,n=to(e,JA),i=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield Bo(rp.teams.addUser,n),{roles:a}=e,r=R({},to(e,YA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield Vo(ji.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Tb({payload:e}){const{callback:t}=e,n=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield Vo(ji.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Bo(rp.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield Vo(ji.loadUsersV2(r)),yield Vo(ji.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*Eb({payload:e}){const{callback:t}=e,n=to(e,QA),i=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Bo(rp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield Vo(ji.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*kb({payload:e}){const{callback:t}=e,n=to(e,XA),{id:i}=n,o=yield gb(),a=o.users.find((e=>e.id===n.id));yield Vo(ji.setTeamLoader({key:PA.UPDATE_USER,value:i||""})),yield Vo(ji.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})})),yield Vo(ji.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?R({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Bo(rp.teams.updateUser,n);null==t||t(e),yield Vo(ji.setTeamState({users:o.users.map((t=>t.id===e.id?R({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield Vo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1}))}catch(e){yield Vo(ji.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:Tg(e)}),users:o.users.map((e=>e.id===n.id?R({},e,a):e))})),yield Vo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Ob({payload:e}){const{callback:t}=e,n=to(e,ZA),i=yield gb();yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.teams.deleteUser,n),null==t||t(!0),yield Vo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Ib({payload:e}){const{callback:t,userId:n}=e,i=to(e,eb),o=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return R({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield Vo(ji.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[R({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield Vo(ji.setTeamState({addUserDialogState:R({},o.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Pb({payload:e}){const{callback:t}=e,n=to(e,tb),i=yield gb();yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield Vo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*_b({payload:e}){const{callback:t}=e,n=to(e,nb);yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Bo(rp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield Vo(ji.setTeamError({key:PA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*Lb({payload:e}){const{callback:t}=e,n=to(e,ib);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield Vo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*wb({payload:e}){const{callback:t}=e,n=to(e,ob);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield Vo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Ub({payload:e}){const{callback:t}=e,n=to(e,ab);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield Vo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Cb(){yield Vo(ji.setTeamError({key:PA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Bo(rp.teams.getInviteLinkConfiguration);yield Vo(ji.setTeamState({inviteTokenState:R({},e)}))}catch(e){yield Vo(ji.setTeamError({key:PA.CONFIG_TOKEN_LINK,value:Tg(e)}))}}function*Db(){yield Vo(ji.setTeamError({key:PA.GET_TOKEN_LINK,value:!1}));try{yield Bo(Cb);const e=yield Bo(rp.teams.getInviteUserLink),{inviteTokenState:t}=yield gb();yield Vo(ji.setTeamState({inviteTokenState:R({},t,e)}))}catch(e){yield Vo(ji.setTeamError({key:PA.GET_TOKEN_LINK,value:Tg(e)}))}}function*Rb({payload:{callback:e}}){yield Vo(ji.setTeamError({key:PA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield gb();try{const n=yield Bo(rp.teams.createInviteUserLink,{expiresInMinutes:43200});yield Vo(ji.setTeamState({inviteTokenState:R({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield Vo(ji.setTeamError({key:PA.CREATE_TOKEN_LINK,value:Tg(t)}))}}function*Nb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield gb();yield Vo(ji.setTeamError({key:PA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Bo(rp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield Vo(ji.setTeamState({inviteTokenState:R({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield Vo(ji.setTeamError({key:PA.UPDATE_TOKEN_LINK,value:Tg(t)}))}}function*Mb({payload:e}){const{callback:t}=null!=e?e:{};yield Vo(ji.setTeamError({key:PA.DELETE_TOKEN_LINK,value:!1}));try{yield Bo(rp.teams.deleteInviteUserLink),yield Vo(ji.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield Vo(ji.setTeamError({key:PA.DELETE_TOKEN_LINK,value:Tg(e)})),null==t||t(!1,e)}}function*Fb({payload:e}){yield Vo(ji.setTeamState({addUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*Gb({payload:e}){const t=yield gb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield Vo(ji.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*$b({payload:e}){yield Vo(ji.setTeamState({deleteUserDialogState:R({open:!0,loading:!1,error:!1},e)}))}function*Vb({payload:e}){const t=yield gb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield Vo(ji.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*xb(){yield $a(ji.loadUsers,hb),yield $a(ji.loadUsersV2,vb),yield $a(ji.loadAllSubTenantsUsers,mb),yield $a(ji.loadRoles,Ab),yield Ga(ji.addUser,bb),yield Ga(ji.addUsersBulk,Tb),yield Ga(ji.addUserToSubTenants,Eb),yield Ga(ji.updateUser,kb),yield Ga(ji.setUserRolesForSubTenants,Ib),yield Ga(ji.deleteUser,Ob),yield Ga(ji.deleteUserFromSubTenants,Pb),yield Ga(ji.resendActivationLink,_b),yield Ga(ji.resendInvitationLink,Lb),yield Ga(ji.resendInvitationEmail,wb),yield Ga(ji.resendInvitationLinkToAllSubTenants,Ub),yield Ga(ji.getInvitationLink,Db),yield Ga(ji.createInvitationLink,Rb),yield Ga(ji.updateInvitationLink,Nb),yield Ga(ji.deleteInvitationLink,Mb),yield Ga(ji.openAddUserDialog,Fb),yield Ga(ji.closeAddUserDialog,Gb),yield Ga(ji.openDeleteUserDialog,$b),yield Ga(ji.closeDeleteUserDialog,Vb)}function*jb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield gb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filterV2,d=null!=(o=e.sort)?o:s.sortV2;yield Vo(ji.setTeamLoader({key:PA.USERS,value:!a})),yield Vo(ji.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield Vo(ji.setTeamState({users:Jp,totalPages:2,totalItems:10,roles:xp,permissions:Bp})),yield Vo(ji.setTeamLoader({key:PA.USERS,value:!1})),null==r||r(Jp)}function*Bb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield gb(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield Vo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield Vo(ji.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield Vo(ji.setTeamState({allUsers:Qp,totalPages:2,totalItems:10,roles:xp,permissions:Bp})),yield Vo(ji.setTeamLoader({key:PA.USERS,value:!1})),null==s||s(Qp)}function*Wb({payload:e}){var t;yield Vo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield Vo(ji.setTeamState({roles:xp,permissions:Bp})),yield Vo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:xp,permissions:Bp})}function*zb({payload:e}){const{callback:t}=e,n=to(e,rb),i=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},Kp,{groups:[]},n,{id:`${KA()}`});null==t||t(o),yield Vo(ji.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kb({payload:e}){const{callback:t}=e,n=to(e,sb),i=yield gb();yield Vo(ji.setTeamState({addUserDialogState:R({},i.addUserDialogState,{loading:!0})})),yield Et();const o=R({},Kp,n,{id:`${KA()}`});yield Vo(ji.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*Hb({payload:e}){var t;const{callback:n}=e,i=to(e,lb),{id:o}=i,a=yield gb(),r=a.users.find((e=>e.id===i.id));yield Vo(ji.setTeamLoader({key:PA.UPDATE_USER,value:o||""})),yield Vo(ji.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0})})),yield Vo(ji.setTeamState({addUserDialogState:R({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?R({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=R({},r,i);null==n||n(s),yield Vo(ji.setTeamState({users:a.users.map((e=>e.id===s.id?R({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield Vo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1}))}function*qb({payload:e}){const{callback:t}=e,n=to(e,cb),i=yield gb();yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Jb({payload:e}){const{callback:t}=e,n=to(e,ub),i=yield gb();yield Vo(ji.setTeamState({deleteUserDialogState:R({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Yb({payload:e}){const{callback:t}=e,n=to(e,db);yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*Qb({payload:e}){const{callback:t}=e,n=to(e,yb);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Xb({payload:e}){const{callback:t}=e,n=to(e,fb);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Zb({payload:e}){const{callback:t}=e,n=to(e,pb);yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield Vo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*eT(){yield $a(ji.loadUsersV2,jb),yield $a(ji.loadAllSubTenantsUsers,Bb),yield $a(ji.loadRoles,Wb),yield Ga(ji.addUser,zb),yield Ga(ji.addUserToSubTenants,Kb),yield Ga(ji.updateUser,Hb),yield Ga(ji.deleteUser,qb),yield Ga(ji.deleteUserFromSubTenants,Jb),yield Ga(ji.resendActivationLink,Yb),yield Ga(ji.resendInvitationLink,Qb),yield Ga(ji.resendInvitationEmail,Xb),yield Ga(ji.resendInvitationLinkToAllSubTenants,Zb),yield Ga(ji.openAddUserDialog,Fb),yield Ga(ji.closeAddUserDialog,Gb),yield Ga(ji.openDeleteUserDialog,$b),yield Ga(ji.closeDeleteUserDialog,Vb)}const tT=["authorizationUrl"],nT=["events","url"];function*iT(){try{yield Vo(ji.setSocialLoginsState({loading:!0}));const e=yield Bo(rp.auth.getSocialLoginProviders);yield Vo(ji.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield Vo(ji.setSocialLoginsState({error:Tg(e),loading:!1,firstLoad:!1}))}}function*oT(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Bo(rp.auth.getSocialLoginProvidersV2),t}function*aT(e){try{var t,n;const i=yield Ko((e=>e.root.context));yield Vo(ji.setSocialLoginsState({loading:!0}));const o=yield Bo(oT),{providers:a}=yield Bo(rp.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:o.map((e=>{let{authorizationUrl:t}=e,n=to(e,tT);const o=Lr(i,null!=t?t:"");return R({},n,{authorizationUrl:t?`${o}${t}`:null})})),customSocialLoginsConfig:a,loading:!1,firstLoad:!1};yield Vo(ji.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var i,o;null==e||null==(i=e.payload)||null==(o=i.callback)||o.call(i,null,t),yield Vo(ji.setSocialLoginsState({error:Tg(t),loading:!1,firstLoad:!1}))}}function*rT(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,nT);try{yield Vo(ji.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield Bo(rp.auth.loginViaSocialLogin,i);if(r){var o,a;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=R({},r,{socialProvider:i.provider,authenticationType:yg.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),kg(Eg.SIGNUP_COMPLETED,u);const d=R({},r,{origin:dg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),kg(Eg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield Vo(ji.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(eh):yield Bo(nh)}(),localStorage.removeItem("register-quick-login"),yield Vo(ji.setSocialLoginsState({loading:!1}))}catch(e){yield Vo(ji.setSocialLoginsState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*sT({payload:e}){yield Vo(ji.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*lT(){yield Va(ji.loadSocialLoginsConfiguration,iT),yield Ga(ji.loadSocialLoginsConfigurationV2,aT),yield Va(ji.loginViaSocialLogin,rT),yield $a(ji.setSocialLoginError,sT)}let cT;function*uT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Ko((e=>e.auth.apiTokensState)),{policy:a}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield Bo(rp.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield Bo(rp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield Vo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield Vo(ji.setApiTokensState({apiTokensDataUser:[R({},e,{type:r?Ii.AccessToken:Ii.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield Vo(ji.setApiTokensError({key:cT.ADD_API_TOKEN,value:Tg(e)})),yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*dT({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Ko((e=>e.auth.apiTokensState)),{policy:r}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Ii.AccessToken;try{let e;yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield Bo(rp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield Bo(rp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield Vo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield Vo(ji.setApiTokensState({apiTokensDataTenant:[R({},e,{type:s?Ii.AccessToken:Ii.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield Vo(ji.setApiTokensError({key:cT.ADD_API_TOKEN,value:Tg(e)})),yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*yT({payload:e}){const{apiTokensDataUser:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteUserAccessToken,{id:e}),yield Vo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Bo(rp.auth.deleteUserApiToken,{tokenId:e}),yield Vo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!1}))}catch(e){yield Vo(ji.setApiTokensError({key:cT.DELETE_API_TOKEN,value:Tg(e)})),yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!1}))}}function*fT({payload:e}){const{apiTokensDataTenant:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Bo(rp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield Vo(ji.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!1}))}catch(e){yield Vo(ji.setApiTokensError({key:cT.DELETE_API_TOKEN,value:Tg(e)})),yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!1}))}}function*pT({payload:e}){null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield xo([Bo(rp.auth.getUserApiTokensData),Bo(rp.auth.getTenantApiTokensData)]);yield Vo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setApiTokensError({key:cT.LOAD_API_TOKENS,value:Tg(t)})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*gT({payload:e}){null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Bo(rp.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>R({},e,{type:Ii.AccessToken}))).concat(a.map((e=>R({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Vo(ji.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Vo(ji.setApiTokensError({key:cT.LOAD_API_TOKENS,value:Tg(t)})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*ST({payload:e}){null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Bo(rp.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>R({},e,{type:Ii.AccessToken}))).concat(a.map((e=>R({},e,{type:Ii.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield Vo(ji.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield Vo(ji.setApiTokensError({key:cT.LOAD_API_TOKENS,value:Tg(t)})),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*vT(){yield Va(ji.loadApiTokens,pT),yield Va(ji.loadUserApiTokens,gT),yield Va(ji.loadTenantApiTokens,ST),yield Ga(ji.addUserApiToken,uT),yield Ga(ji.addTenantApiToken,dT),yield $a(ji.deleteTenantApiToken,fT),yield $a(ji.deleteUserApiToken,yT)}function*hT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ko((e=>e.auth.apiTokensState)),a=R({},Lp,{description:t,roleIds:n,clientId:`CLIENT_ID_${KA()}`});yield Vo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield Vo(ji.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ho(200),yield Vo(ji.setApiTokensLoader({key:cT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*mT({payload:e}){yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!0})),yield Ho(200);const t=[Lp];yield Vo(ji.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield Vo(ji.setApiTokensLoader({key:cT.DELETE_API_TOKEN,value:!1}))}function*AT({payload:e}){var t;null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));const n=[_p],i=[Lp];yield Vo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ho(200),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bT({payload:e}){var t;null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));const n=[_p];yield Vo(ji.setApiTokensState({apiTokensDataUser:n})),yield Ho(200),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*TT({payload:e}){var t;null!=e&&e.silentLoading||(yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!0})));const n=[Lp];yield Vo(ji.setApiTokensState({apiTokensDataTenant:n})),yield Ho(200),yield Vo(ji.setApiTokensLoader({key:cT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*ET(){yield Va(ji.loadApiTokens,AT),yield Va(ji.loadUserApiTokens,bT),yield Va(ji.loadTenantApiTokens,TT),yield Ga(ji.addTenantApiToken,hT),yield $a(ji.deleteTenantApiToken,mT)}function*kT({payload:e}){try{var t;yield Vo(ji.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield Bo(rp.accountSettings.updateSettings,R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield Vo(ji.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield Vo(ji.setAccountSettingsState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*OT({payload:e}){yield Vo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Bo(rp.accountSettings.getSettings);yield Vo(ji.setAccountSettingsState(R({},e,{loading:!1})))}catch(e){yield Vo(ji.setAccountSettingsState({loading:!1,error:Tg(e)}))}}function*IT(){yield Va(ji.saveAccountSettings,kT),yield Va(ji.loadAccountSettings,OT)}function*PT({payload:e}){var t;yield Vo(ji.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=R({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield Vo(ji.setAccountSettingsState(R({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*_T({payload:e}){yield Vo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield Vo(ji.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*LT(){yield Va(ji.saveAccountSettings,PT),yield Va(ji.loadAccountSettings,_T)}function*wT({payload:{tenantId:e,callback:t}}){yield Vo(ji.setState({isLoading:!0}));try{yield Bo(rp.tenants.switchTenant,{tenantId:e}),yield Bo(Xv),(null==t?void 0:t(!0))||(yield Vo(ji.setState({isLoading:!1})))}catch(e){yield Vo(ji.setState({isLoading:!1})),null==t||t(!1,e)}}function*UT({payload:e}){yield Vo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(ns());yield Vo(ji.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 Vo(ji.setTenantsState({loading:!1}))}}function*CT({payload:e}){yield Vo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenants);yield Vo(ji.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*DT({payload:e}){yield Vo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenantsAsTree);yield Vo(ji.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield Vo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*RT(){yield Ga(ji.loadTenants,UT),yield Ga(ji.loadSubTenants,CT),yield Ga(ji.switchTenant,wT),yield Ga(ji.loadSubTenantsTree,DT)}function*NT(){yield Vo(ji.setTenantsState({loading:!0})),yield Et(),yield Vo(ji.setTenantsState({tenants:Xp,activeTenant:Xp[0],loading:!1}))}function*MT(){yield Ga(ji.loadTenants,NT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(cT||(cT={}));const FT=["callback"],GT=["callback"],$T=["callback"],VT=["callback"],xT=["callback"];function*jT({payload:e}){var t;yield Vo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield xo([Bo(rp.roles.getRoles),Bo(rp.roles.getPermissions),Bo(rp.roles.getPermissionCategories)]),[t,n,i]=e;yield Vo(ji.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield Vo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*BT(e){let{payload:{callback:t}}=e,n=to(e.payload,FT);yield Vo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.addRole,n),i=yield Bo(rp.roles.getRoles);yield Vo(ji.loadRolesAndPermissions({silentLoading:!0})),yield Vo(ji.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*WT(e){let{payload:{callback:t}}=e,n=to(e.payload,GT);yield Vo(ji.setRolesState({saving:!0}));try{yield Bo(rp.roles.deleteRole,n),yield Vo(ji.loadRolesAndPermissions({silentLoading:!0})),yield Vo(ji.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(!1,e)}}function*zT(e){let{payload:{callback:t}}=e,n=to(e.payload,$T);yield Vo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.updateRole,n);yield Vo(ji.loadRolesAndPermissions({silentLoading:!0})),yield Vo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*KT(e){let{payload:{callback:t}}=e,n=to(e.payload,VT);yield Vo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionsToRole,n);yield Vo(ji.loadRolesAndPermissions({silentLoading:!0})),yield Vo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*HT(e){let{payload:{callback:t}}=e,n=to(e.payload,xT);yield Vo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionToRoles,n);yield Vo(ji.loadRolesAndPermissions({silentLoading:!0})),yield Vo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield Vo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*qT(){yield Va(ji.loadRolesAndPermissions,jT),yield Ga(ji.addRole,BT),yield Ga(ji.deleteRole,WT),yield Ga(ji.updateRole,zT),yield Ga(ji.attachPermissionsToRole,KT),yield Ga(ji.attachPermissionToRoles,HT)}function*JT({payload:e}){var t;yield Vo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield Vo(ji.setRolesState({roles:wp,loading:!1}))}catch(e){yield Vo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*YT(){yield Va(ji.loadRolesAndPermissions,JT)}const QT=["callback"],XT=["callback"],ZT=["callback"];function*eE(e){let{payload:{callback:t}}=e,n=to(e.payload,QT);yield Vo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.resetPhoneNumber,n);yield Vo(ji.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Zt.VerifyResetPhoneNumber})),yield Vo(ji.setLoginState({email:n.email}))}catch(e){yield Vo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*tE(e){let{payload:{callback:t}}=e,n=to(e.payload,XT);yield Vo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.verifyResetPhoneNumber,n);yield Vo(ji.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield Vo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*nE(e){let{payload:{callback:t}}=e,n=to(e.payload,ZT);yield Vo(ji.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bo(rp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield Vo(ji.setLoginState({step:_t.loginWithSmsOtc})),yield Vo(ji.passwordlessPreLogin({type:Oi.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield Vo(ji.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*iE(){yield Va(ji.resetPhoneNumber,eE),yield Va(ji.verifyResetPhoneNumber,tE),yield Va(ji.changePhoneNumber,nE)}function*oE(){yield Vo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSessions);yield Vo(ji.setSessionsState({sessions:e,loading:!1}))}catch(e){yield Vo(ji.setSessionsState({error:e,loading:!1}))}}function*aE(){yield Vo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSession);yield Vo(ji.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield Vo(ji.setSessionsState({error:e,loading:!1}))}}function*rE({payload:{id:e}}){yield Vo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteSessionForUser,e),yield Vo(ji.loadUserSessions())}catch(e){yield Vo(ji.setSessionsState({error:e,loading:!1}))}}function*sE({payload:{callback:e,userId:t}}){yield Vo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield Vo(ji.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*lE(){yield Vo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteAllSessionsForUser),yield Vo(ji.loadUserSessions())}catch(e){yield Vo(ji.setSessionsState({error:e,loading:!1}))}}function*cE(){yield $a(ji.loadUserSessions,oE),yield $a(ji.deleteUserSession,rE),yield $a(ji.deleteAllUserSessions,lE),yield $a(ji.loadCurrentUserSession,aE),yield Ga(ji.revokeUserSessions,sE)}function*uE(){yield Vo(ji.setSessionsState({loading:!0,error:null})),yield Vo(ji.setSessionsState({sessions:Zp,loading:!1}))}function*dE({payload:{id:e}}){yield Vo(ji.setSessionsState({loading:!0,error:null}));const t=(yield Ko((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield Vo(ji.setSessionsState({sessions:t,loading:!1}))}function*yE(){yield Vo(ji.setSessionsState({loading:!0,error:null}));const e=Zp.filter((e=>e.current));yield Vo(ji.setSessionsState({sessions:e,loading:!1}))}function*fE(){yield $a(ji.loadUserSessions,uE),yield $a(ji.deleteUserSession,dE),yield $a(ji.deleteAllUserSessions,yE)}const pE=["callback"],gE=["callback"];function*SE(){yield Vo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getSessionConfigurations);yield Vo(ji.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield Vo(ji.setSessionsState({error:e,loading:!1}))}}function*vE({payload:e}){yield Vo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=to(e,pE);yield Bo(rp.auth.createOrUpdateSessionConfigrations,n),yield Vo(ji.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield Vo(ji.setSessionsPolicyState({error:e,loading:!1}))}}function*hE(){yield Va(ji.loadSessionsPolicy,SE),yield $a(ji.createOrUpdateSessionsPolicy,Rg(vE))}function*mE(){yield Vo(ji.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ko((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:eg}));yield Vo(ji.setSessionsPolicyState(R({},e,{loading:!1})))}function*AE({payload:e}){yield Vo(ji.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=to(e,gE);null==t||t(!0),yield Vo(ji.setSessionsPolicyState({configurations:n,loading:!1}))}function*bE(){yield Va(ji.loadSessionsPolicy,mE),yield $a(ji.createOrUpdateSessionsPolicy,AE)}const TE=["callback"],EE=["callback"],kE=["callback"],OE=["callback"],IE=["callback"],PE=["callback"],_E=["callback"],LE=["callback"],wE=()=>Ko((e=>e.auth.restrictionsState.ipRestrictions)),UE=()=>Ko((e=>e.auth.restrictionsState.emailDomainRestrictions));function*CE(){yield Vo(ji.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getDomainRestrictionsConfig),t=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Vo(ji.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield Vo(ji.setEmailDomainRestrictionsState({error:Tg(e),loading:!1}))}}function*DE(e){let{payload:{callback:t}}=e,n=to(e.payload,TE);yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield UE();try{var o;yield Bo(rp.auth.createDomainRestriction,n);const e=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield Vo(ji.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*RE(e){let{payload:{callback:t}}=e,n=to(e.payload,EE);yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.updateDomainRestrictionConfig,n),i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield Vo(ji.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*NE({payload:{id:e}}){yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield UE();try{var n;yield Bo(rp.auth.deleteDomainRestriction,e);const i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield Vo(ji.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield Vo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)}))}}const ME=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:zn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*FE(){yield Vo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield wE(),t=yield Bo(rp.auth.getIPRestrictionsConfig),n=ME({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Bo(rp.auth.getIPRestrictions,n);yield Vo(ji.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield Vo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*GE(){try{const{valid:e}=yield Bo(rp.auth.testCurrentIpInAllowList);yield Vo(ji.setIpRestrictionsState({userIpValid:e}))}catch(e){yield Vo(ji.setIpRestrictionsState({error:Tg(e)}))}}function*$E({payload:{callback:e}}){yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ko((e=>e.auth.userIp));yield xo([Bo(rp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:zn.ALLOW}),Bo(rp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield wE(),i=ME(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Bo(rp.auth.getIPRestrictions,i);yield Vo(ji.setIpRestrictionsState({data:{config:{isActive:!0,strategy:zn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield Vo(ji.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*VE(e){let{payload:{callback:t}}=e,n=to(e.payload,kE);yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield wE();try{var o,a;yield Bo(rp.auth.createIPRestriction,n);const e=yield wE(),r=ME(e.pagination),{items:s,_metadata:{totalPages:l}}=yield Bo(rp.auth.getIPRestrictions,r);yield GE(),yield Vo(ji.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:zn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*xE(e){let{payload:{callback:t}}=e,n=to(e.payload,OE);yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));try{yield Bo(rp.auth.updateIPRestrictionConfig,n);const e=yield wE(),i=yield Bo(rp.auth.getIPRestrictionsConfig),o=ME(R({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Bo(rp.auth.getIPRestrictions,o);yield GE(),yield Vo(ji.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*jE({payload:{id:e,callback:t}}){yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));const n=yield wE();try{var i;yield Bo(rp.auth.deleteIPRestriction,e);const o=yield wE(),a=ME(o.pagination),{items:r,_metadata:{totalPages:s}}=yield Bo(rp.auth.getIPRestrictions,a);yield GE(),yield Vo(ji.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*BE(){yield Va(ji.loadIpRestrictions,Rg(FE)),yield Va(ji.loadEmailDomainRestrictions,Rg(CE)),yield Ga(ji.saveIpRestriction,Rg(VE)),yield Ga(ji.saveIpRestrictionsConfig,Rg(xE)),yield Ga(ji.deleteIpRestriction,Rg(jE)),yield Ga(ji.checkIfUserIpValid,Rg(GE)),yield Ga(ji.addCurrentUserIpAndActivate,Rg($E)),yield Ga(ji.saveEmailDomainRestriction,Rg(DE)),yield Ga(ji.saveEmailDomainRestrictionsConfig,Rg(RE)),yield Ga(ji.deleteEmailDomainRestriction,Rg(NE))}function*WE(){yield Vo(ji.setIpRestrictionsState({loading:!0,error:null})),yield Vo(ji.setIpRestrictionsState({data:{restrictions:ng.filter((e=>e.strategy===tg.strategy)),config:tg},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*zE(){yield Vo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield wE(),t=ng[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield Vo(ji.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield Vo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*KE(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,IE);yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));const r=yield wE(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield Vo(ji.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:zn.ALLOW},restrictions:[...s,R({},a,{createdAt:new Date,updatedAt:new Date,id:KA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*HE(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,PE);const r=yield wE();yield Vo(ji.setIpRestrictionsState({saving:!0,error:null})),yield Vo(ji.setIpRestrictionsState({data:{config:R({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield Vo(ji.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*qE({payload:{id:e,callback:t}}){var n;yield Vo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield wE();yield Vo(ji.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*JE(){yield Vo(ji.setEmailDomainRestrictionsState({loading:!0,error:null})),yield Vo(ji.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:zn.ALLOW}],config:{active:!0,listType:zn.ALLOW,blockPublicDomains:!1}}}))}function*YE(e){var t,n;let{payload:{callback:i}}=e,o=to(e.payload,_E);const a=yield UE();yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield Vo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],R({},o,{id:Date.now().toString()})]},saving:!1}))}function*QE(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,LE);const o=yield UE();yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield Vo(ji.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||zn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*XE({payload:{id:e}}){var t,n;const i=yield UE();yield Vo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield Vo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*ZE(){yield Va(ji.loadIpRestrictions,WE),yield Va(ji.loadEmailDomainRestrictions,JE),yield Ga(ji.saveIpRestriction,KE),yield Ga(ji.saveIpRestrictionsConfig,HE),yield Ga(ji.deleteIpRestriction,qE),yield Ga(ji.checkIfUserIpValid,zE),yield Ga(ji.saveEmailDomainRestriction,YE),yield Ga(ji.saveEmailDomainRestrictionsConfig,QE),yield Ga(ji.deleteEmailDomainRestriction,XE)}const ek=["callback"],tk=["id"];function*nk(e){const{count:t}=yield Bo(rp.directory.countConfigurationUsers,e.id);return R({},e,{count:t})}function*ik(){yield Vo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.getConfigs),t=yield xo(e.map((e=>nk(e))));yield Vo(ji.setProvisioningState({connections:t,loading:!1}))}catch(e){yield Vo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*ok(e){let{payload:{callback:t}}=e,n=to(e.payload,ek);yield Vo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.createConfiguration,n),i=yield Bo(rp.directory.getConfigs),o=yield xo(i.map((e=>nk(e))));yield Vo(ji.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield Vo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*ak(e){let{payload:{id:t}}=e,n=to(e.payload,tk);yield Vo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.updateConfiguration,t,n);const e=yield Bo(rp.directory.getConfigs),i=yield xo(e.map((e=>nk(e))));yield Vo(ji.setProvisioningState({connections:i,loading:!1}))}catch(e){yield Vo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*rk({payload:{id:e,callback:t}}){yield Vo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.deleteConfiguration,e);const n=yield Bo(rp.directory.getConfigs),i=yield xo(n.map((e=>nk(e))));yield Vo(ji.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setProvisioningState({error:Tg(e),loading:!1})),null==t||t(!1,e)}}function*sk(){yield Va(ji.loadProvisionConnections,ik),yield Ga(ji.createProvisionConnection,ok),yield Ga(ji.deleteProvisionConnection,rk),yield Ga(ji.updateProvisionConnection,ak)}const lk=["callback","events"];function*ck(e){let{payload:{callback:t}}=e,n=to(e.payload,lk);yield Vo(ji.setImpersonateState({loading:!0}));try{yield Bo(rp.impersonate.impersonate,n),yield Vo(ji.setImpersonateState({step:Mi.success})),yield Ho(1e3),yield ov(),yield Vo(ji.resetImpersonateState()),null==t||t(!0)}catch(e){yield Vo(ji.setImpersonateState({loading:!1,error:Tg(e)}))}}function*uk(){yield Va(ji.impersonate,ck)}function*dk({payload:e}){const{callback:t,deviceId:n}=e;yield Vo(ji.setPasskeysState({loading:!0}));try{yield Bo(rp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Ko((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield Vo(ji.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield Vo(ji.setPasskeysState({loading:!1,error:Tg(e,null)})),null==t||t(null,e)}}function*yk(){yield Vo(ji.setPasskeysState({loading:!0}));try{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);yield Vo(ji.setPasskeysState({devices:e,loading:!1}))}catch(e){yield Vo(ji.setPasskeysState({loading:!1,error:Tg(e,null)}))}}function*fk(){yield Ga(ji.loadWebAuthnDevices,yk),yield Ga(ji.deleteWebAuthnDevice,dk)}const pk=["roleIds","userIds"],gk=()=>Ko((e=>e.auth.groupsState));function*Sk({payload:e}){const t=HA.GET_TEAM_USERS;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Bo(rp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield Vo(ji.setGroupsState({teamUsers:n}))}catch(e){yield Vo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*vk({payload:e}){const t=HA.GET_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Bo(rp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:qA.rolesAndUsers});yield Vo(ji.setGroupsState({selectedGroup:n}))}catch(e){yield Vo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*hk(){const e=HA.GET_GROUPS,t=yield gk();yield Vo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Bo(rp.groups.getGroups,{_groupsRelations:qA.rolesAndUsers});yield Vo(ji.setGroupsState(R({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield Vo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*mk({payload:e}){const t=HA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=to(e,pk);yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Bo(rp.groups.createGroup,R({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield Vo(ji.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield Vo(ji.addRolesToGroup({groupId:r.id,roleIds:n}))),yield Vo(ji.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ak({payload:e}){const t=HA.UPDATE_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.updateGroup,e),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*bk({payload:e}){const t=HA.DELETE_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteGroup,e.groupId),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Tk({payload:e}){const t=HA.ADD_ROLES_TO_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ek({payload:e}){const t=HA.DELETE_ROLES_FROM_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*kk({payload:e}){const t=HA.ADD_USERS_TO_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=HA.DELETE_USERS_FROM_GROUP;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield Vo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield Vo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ik(){const e=HA.GET_GROUP_CONFIGURATION;yield Vo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Bo(rp.groups.getGroupConfiguration);yield Vo(ji.setGroupsState({groupsConfiguration:t}))}catch(t){yield Vo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*Pk({payload:e}){const t=HA.UPDATE_GROUP_CONFIGURATION;yield Vo(ji.setUsersGroupsLoader({key:t,value:!0}));try{yield Bo(rp.groups.updateGroupConfiguration,e),yield Vo(ji.getGroupConfiguration())}catch(e){yield Vo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*_k(){yield $a(ji.loadGroups,hk),yield $a(ji.getGroupById,vk),yield $a(ji.createGroup,mk),yield $a(ji.updateGroup,Ak),yield $a(ji.deleteGroup,bk),yield $a(ji.addRolesToGroup,Tk),yield $a(ji.deleteRolesFromGroup,Ek),yield $a(ji.addUsersToGroup,kk),yield $a(ji.deleteUsersFromGroup,Ok),yield $a(ji.getGroupConfiguration,Ik),yield $a(ji.updateGroupConfiguration,Pk),yield $a(ji.getTeamUsers,Sk)}function*Lk(){const e=HA.GET_GROUPS;yield Vo(ji.setUsersGroupsLoader({key:e,value:!0}));const t=ag;yield Vo(ji.setGroupsState({groups:t})),yield Vo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*wk({payload:e}){var t;const n=HA.CREATE_GROUP,{groups:i}=yield gk();yield Vo(ji.setUsersGroupsLoader({key:n,value:!0})),yield Vo(ji.setGroupsState({groups:[R({},e,{id:`${e.name}ID`,managedBy:ep.FRONTEGG}),...null!=i?i:[]]})),yield Ho(500),null==e||null==(t=e.callback)||t.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:n,value:!1}))}function*Uk({payload:e}){var t,n,i,o,a;const r=HA.UPDATE_GROUP,s=yield gk();yield Vo(ji.setUsersGroupsLoader({key:r,value:!0})),yield Vo(ji.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:ep.FRONTEGG}):t})),selectedGroup:R({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield Ho(500),null==e||null==(a=e.callback)||a.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:r,value:!1}))}function*Ck({payload:e}){var t,n;const i=HA.DELETE_GROUP,o=yield gk();yield Vo(ji.setUsersGroupsLoader({key:i,value:!0})),yield Vo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Dk({payload:e}){var t,n;const i=HA.ADD_ROLES_TO_GROUP,o=yield gk();yield Vo(ji.setUsersGroupsLoader({key:i,value:!0})),yield Vo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Rk({payload:e}){var t,n;const i=HA.DELETE_ROLES_FROM_GROUP,o=yield gk();yield Vo(ji.setUsersGroupsLoader({key:i,value:!0})),yield Vo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Nk({payload:e}){var t,n;const i=HA.ADD_USERS_TO_GROUP,o=yield gk();yield Vo(ji.setUsersGroupsLoader({key:i,value:!0})),yield Vo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Mk({payload:e}){var t,n;const i=HA.DELETE_USERS_FROM_GROUP,o=yield gk();yield Vo(ji.setUsersGroupsLoader({key:i,value:!0})),yield Vo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?R({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield Vo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Fk(){const e=HA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield gk();yield Vo(ji.setUsersGroupsLoader({key:e,value:!0})),t&&(yield Vo(ji.setGroupsState({groupsConfiguration:R({},t)}))),yield Vo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*Gk({payload:e}){const t=HA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield gk();yield Vo(ji.setUsersGroupsLoader({key:t,value:!0})),n&&(yield Vo(ji.setGroupsState({groupsConfiguration:R({},n,e)}))),yield Vo(ji.setUsersGroupsLoader({key:t,value:!1}))}function*$k(){yield $a(ji.loadGroups,Lk),yield $a(ji.createGroup,wk),yield $a(ji.updateGroup,Uk),yield $a(ji.deleteGroup,Ck),yield $a(ji.addRolesToGroup,Dk),yield $a(ji.deleteRolesFromGroup,Rk),yield $a(ji.addUsersToGroup,Nk),yield $a(ji.deleteUsersFromGroup,Mk),yield $a(ji.getGroupConfiguration,Fk),yield $a(ji.updateGroupConfiguration,Gk)}let Vk;!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.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Vk||(Vk={}));const xk=(e,t,n)=>{var i,o;return e.tenantId===t?R({},e,{name:n}):R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>xk(e,t,n))))?i:[]})};function jk(e,t){var n;return R({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>jk(e,t))):[]})}function Bk(e,t,n){var i,o;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return R({},e,{children:t})}return R({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Bk(e,t,n))))?i:[]})}const Wk=({items:e},t)=>e.map((e=>{var n,i;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(i=t.find((t=>t.tenantId===e.tenantId)))?void 0:i.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),zk=()=>Ko((e=>e.auth.allAccountsState));function*Kk({payload:e}){const t=Vk.GET_ACCOUNTS;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield zk(),{jwt:i,_limit:o,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=o?o:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(i){var s;const{selectedAccount:t}=yield zk(),{items:n,_links:o}=yield Bo(rp.tenants.searchSubTenants,r,{jwt:i}),a=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=Wk({items:n},a),c=Bk(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==o?void 0:o.next}))));yield Vo(ji.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield zk(),{items:n,_links:i}=yield Bo(rp.tenants.searchSubTenants,r),o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Wk({items:n},o),s=Bk(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",a.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}))));yield Vo(ji.setAllAccountsState({accounts:s}))}}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Hk({payload:e}){const t=Vk.SEARCH_ACCOUNTS;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield zk(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield Bo(rp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield Vo(ji.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*qk({payload:e}){const t=Vk.GET_USER_JWT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield Bo(rp.users.GetUserJwt,{tenantId:n});yield Vo(ji.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),yield Vo(ji.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Jk({payload:e}){const t=Vk.CREATE_SUB_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield zk(),{selectedAccount:t}=yield zk(),r=yield Bo(rp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=Bk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Bk(R({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Vo(ji.setAllAccountsState({accounts:s})),yield Vo(ji.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield zk(),t=yield Bo(rp.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=Bk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield Vo(ji.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Yk({payload:e}){const t=Vk.DELETE_SUB_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield zk();yield Bo(rp.subTenants.deleteSubTenant,i,{jwt:n});const o=jk(t,i),a=jk(null==e?void 0:e.accounts,i);yield Vo(ji.setAllAccountsState({accounts:o})),yield Vo(ji.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield zk();yield Bo(rp.subTenants.deleteSubTenant,i);const t=jk(e,i);yield Vo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Qk({payload:e}){const t=Vk.UPDATE_SUB_ACCOUNT_SETTINGS;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield zk();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=xk(e.accounts,a,i);yield Vo(ji.setSelectedAccountState({name:i,accounts:o}));const r=xk(t,a,i);yield Vo(ji.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield zk();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=xk(e,a,i);yield Vo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Xk({payload:e}){const t=Vk.DELETE_USERS_FROM_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield Vo(ji.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*Zk({payload:e}){const t=Vk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield zk();try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield Vo(ji.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*eO({payload:e}){const t=Vk.ADD_USERS_TO_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield Bo(rp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield Vo(ji.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*tO({payload:e}){const t=Vk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield zk(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield Bo(rp.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield Vo(ji.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?R({},e,{subAccountAccessAllowed:o}):e))})),null==r||r(!0)}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*nO({payload:e}){var t,n,i,o,a,r,s,l;const c=Vk.GET_ACCOUNT_USERS;yield Vo(ji.setAllAccountsLoader({key:c,value:!0}));const u=yield zk(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(i=u.selectedAccount)||null==(o=i.usersQueryParams)?void 0:o._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(s=u.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?a:10,S=R({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Bo(rp.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:R({_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 Bo(rp.roles.getRoles),o=yield Bo(rp.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return R({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}));yield Vo(ji.setSelectedAccountState(R({users:a},i)))}else yield Vo(ji.setSelectedAccountState(R({users:[]},i)))}catch(e){yield Vo(ji.setAllAccountsError({key:c,value:Tg(e)}))}finally{yield Vo(ji.setAllAccountsLoader({key:c,value:!1}))}}function*iO({payload:e}){const t=Vk.SET_SELECTED_SUB_ACCOUNT_DATA;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield Bo(rp.accountSettings.getSettings,{jwt:n}),u=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield Bo(rp.tenants.getParentTenants,{jwt:n}),y=yield Bo(rp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield Vo(ji.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=u[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield Vo(ji.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*oO(){const e=Vk.SET_ROOT_ACCOUNT_DATA;yield Vo(ji.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Ko((e=>e.auth.tenantsState)),{accounts:n}=yield zk();if(t)try{var i;const o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(i=o[0])?void 0:i.totalUsers,createdAt:null==t?void 0:t.createdAt};yield Vo(ji.setAllAccountsState({rootAccount:a,accounts:R({},n,a)}))}catch(t){yield Vo(ji.setAllAccountsError({key:e,value:Tg(t)}))}finally{yield Vo(ji.setAllAccountsLoader({key:e,value:!1}))}}function*aO({payload:e}){const t=Vk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield Vo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield Vo(ji.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield Vo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield Vo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*rO(){yield $a(ji.loadAccounts,Kk),yield $a(ji.searchAccounts,Hk),yield $a(ji.updateSubAccountAccessForUser,tO),yield $a(ji.getUserJwtForSubAccount,qk),yield $a(ji.createSubAccount,Jk),yield $a(ji.deleteSubAccount,Yk),yield $a(ji.updateSubAccountSettings,Qk),yield $a(ji.addUsersToAccount,eO),yield $a(ji.deleteUsersFromAccount,Xk),yield $a(ji.setUserRolesForSubAccount,Zk),yield $a(ji.getAccountUsers,nO),yield $a(ji.setRootAccountData,oO),yield $a(ji.setSelectedSubAccountData,iO),yield $a(ji.loadNumberOfUsersForSelectedSubAccount,aO)}const sO=["callback"],lO=["callback"],cO=["callback","phoneId"],uO=["callback","phoneId"],dO=["callback"];function*yO(){yield Vo(ji.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Bo(rp.userPhoneNumbers.getUserPhoneNumbers,e);yield Vo(ji.setSmsState({phoneNumbers:t}))}catch(e){yield Vo(ji.setSmsState({error:Tg(e)}))}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*fO(e){let{payload:{callback:t}}=e,n=to(e.payload,sO);yield Vo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.createPhoneNumber,n);yield Vo(ji.setSmsState({otcToken:e.otcToken})),yield Bo(yO),null==t||t(!0)}catch(e){yield Vo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*pO(e){let{payload:{callback:t}}=e,n=to(e.payload,lO);yield Vo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyPhoneNumber,n),yield Bo(yO),null==t||t(!0)}catch(e){yield Vo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*gO(e){let{payload:{callback:t,phoneId:n}}=e;to(e.payload,cO),yield Vo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.deletePhoneNumber,n);yield Vo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Vo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*SO(e){let{payload:{callback:t,phoneId:n}}=e,i=to(e.payload,uO);yield Vo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield Bo(yO),null==t||t(!0)}catch(e){yield Vo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*vO(e){let{payload:{callback:t}}=e,n=to(e.payload,dO);yield Vo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.preVerifyPhoneNumber,n);yield Vo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield Vo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield Vo(ji.setSmsState({loading:!1}))}}function*hO(){yield Ga(ji.loadPhoneNumbers,yO),yield Ga(ji.setUpPhoneNumber,fO),yield Ga(ji.verifyPhoneNumber,pO),yield Ga(ji.deletePhoneNumber,gO),yield Ga(ji.verifyDeletePhoneNumber,SO),yield Ga(ji.preVerifyPhoneNumber,vO)}function*mO(e){yield Bo(ZS,e),yield Bo(av)}function*AO({mfaToken:e,mfaDevices:t}){yield Vo(ji.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield Bo(mg,t);yield Vo(ji.setMfaState({step:n}))}function*bO(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield Vo(ji.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(tv,"true");const{routes:t}=yield Ko((e=>e.auth));xa.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*TO({payload:{maxAge:e,callback:t}}){yield Vo(ji.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield Bo(rp.auth.generateStepupSession,{maxAge:e});n.user?yield Bo(mO,n):yield Bo(AO,n),null==t||t(!0)}catch(e){null==t||t(!1),yield Bo(bO,e)}}function*EO({payload:e}){yield uv(e,ji.setStepUpState,!0)}function*kO({payload:e}){yield Ev(e,ji.setStepUpState)}function*OO({payload:e}){yield kv(e,ji.setStepUpState,!0)}function*IO({payload:e}){yield vv(e,ji.setStepUpState)}function*PO({payload:e}){yield hv(e,ji.setStepUpState,!0)}function*_O({payload:e}){yield wv(e,ji.setStepUpState)}function*LO({payload:e}){yield Lv(e,ji.setStepUpState)}function*wO(){yield Va(ji.generateStepUpSession,TO),yield Va(ji.stepUpWithAuthenticator,EO),yield Va(ji.preVerifyMFASMSForStepUp,IO),yield Va(ji.verifyMFASMSForStepUp,PO),yield Va(ji.preVerifyMFAWebAuthnForStepUp,kO),yield Va(ji.verifyMFAWebAuthnForStepUp,OO),yield Va(ji.verifyMFAEmailCodeForStepUp,_O),yield Va(ji.preVerifyMFAEmailCodeForStepUp,LO)}var UO={sagas:function*(){yield xo([Bo(Gh),Bo(wO),Bo(MA),Bo(GA),Bo(IA),Bo(iE),Bo(em),Bo(_m),Bo(Rm),Bo(Ug),Bo(yA),Bo(xb),Bo(_k),Bo(lT),Bo(GS),Bo(vT),Bo(mS),Bo(IT),Bo(RT),Bo(qT),Bo(cE),Bo(hE),Bo(BE),Bo(sk),Bo(uk),Bo(fk),Bo(rO),Bo(YS),Bo(Bg),Bo(hO)])},mockSagas:function*(){yield xo([Bo(xh),Bo(sm),Bo(Gm),Bo(bA),Bo(eT),Bo(ET),Bo(CS),Bo(fE),Bo(LT),Bo(MT),Bo(bE),Bo(ZE),Bo(YT),Bo($k),Bo(Yg)])},storeName:Rt,initialState:Ni,reducer:Vi,actions:ji};const CO=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>R({},t,{[e]:R({},t[e],n)})}),DO={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},RO={setAuditLogsState:CO("auditLogsState"),resetAuditLogsState:e=>R({},e,{auditLogsState:DO})},NO={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},MO={loading:!0},FO={setAuditsMetadataState:CO("auditsMetadataState"),resetAuditsMetadataState:e=>R({},e,{auditsMetadataState:MO})},GO={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},$O={auditLogsState:DO,auditsMetadataState:MO},{reducer:VO,actions:xO}=pt({name:Mt,initialState:$O,reducers:R({resetState:e=>R({},e,$O),setState:(e,{payload:t})=>R({},e,t)},RO,FO)}),jO=R({},xO,NO,GO),BO=e=>"createdAt"!==e.id,WO={total:20,data:Array.from(Array(5).keys()).map((e=>R({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`})))},zO={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}]},KO=()=>Ko((e=>e.auditLogs.auditLogsState)),HO=()=>Ko((e=>e.auditLogs.auditsMetadataState));function*qO(){const e=yield KO(),{columns:t}=yield HO();try{const n=e.filter,i=e.sort.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});yield Vo(jO.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield rp.audits.exportAudits(R({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield Vo(jO.setAuditLogsState({isDownloadingCsv:!1}))}function*JO({payload:e}){yield Vo(jO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield KO(),{columns:n}=yield HO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Vo(jO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>R({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>R({},e,{[t.id]:t.value})),{});n||(yield Vo(jO.loadAuditsMetadata()));const{data:p,total:g}=yield Bo(rp.audits.getAudits,R({offset:c,count:l},y,f));yield Vo(jO.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 Vo(jO.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*YO(){yield Ga(jO.exportAuditsCsv,qO),yield Ga(jO.loadAuditLogs,JO)}function*QO({payload:e}){yield Vo(jO.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield KO(),{columns:n}=yield HO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield Vo(jO.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield Vo(jO.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=WO;let i=n.filter((e=>t=>e.filter(BO).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield Vo(jO.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 Vo(jO.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*XO(){yield Ga(jO.loadAuditLogs,QO)}function*ZO(){yield Vo(jO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Bo(rp.metadata.getAuditsMetadata);yield Vo(jO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Vo(jO.setAuditsMetadataState({error:e,loading:!1}))}}function*eI(){yield Ga(jO.loadAuditsMetadata,ZO)}function*tI(){yield Vo(jO.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=zO;yield Vo(jO.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield Vo(jO.setAuditsMetadataState({error:e,loading:!1}))}}function*nI(){yield Ga(jO.loadAuditsMetadata,tI)}var iI={sagas:function*(){yield xo([Bo(YO),Bo(eI)])},mockSagas:function*(){yield xo([Bo(XO),Bo(nI)])},storeName:Mt,initialState:$O,reducer:VO,actions:jO};const oI={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:aI,actions:rI,reducer:sI}=pt({name:"audits",initialState:oI,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=R({},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]})))}}}),lI=R({},rI,{initData:yt(`${aI}/initData`),loadAudits:yt(`${aI}/loadAudits`),removeFilter:yt(`${aI}/removeFilter`),filterData:yt(`${aI}/filterData`),exportCSV:yt(`${aI}/exportCSV`),deleteAudits:yt(`${aI}/deleteAudits`)}),cI=()=>Ko((e=>e[aI]));function*uI(){const{sortBy:e,sortDirection:t}=yield cI();try{const n=yield Bo(rp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield Vo(lI.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield Vo(lI.loadItemFailedAction(t))}}function*dI(){try{const e=yield Bo(rp.metadata.getAuditsMetadata);yield Vo(lI.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield Vo(lI.loadItemFailedAction(t))}}const yI=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*fI({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield cI(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield cI():{rowsData:[]};try{const e=yI(t),{data:s,total:d}=yield Bo(rp.audits.getAudits,R({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield Vo(lI.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield Vo(lI.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield Vo(lI.loadItemFailedAction(t))}}function*pI(){yield Vo(lI.startLoading()),yield xo([uI(),dI(),fI({payload:{onlyOneLoad:!1},type:""})]),yield Vo(lI.finishLoading())}function*gI({payload:e}){const{filters:t}=yield cI(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield Vo(lI.setFilterData(i))}function*SI({payload:e}){const{filters:t}=yield cI();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield Vo(lI.setFilterData(i))}function*vI(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield cI(),a=yI(e);yield Vo(lI.startDownloadingCsv());try{yield rp.audits.exportAudits(R({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield Vo(lI.stopDownloadingCsv())}}function*hI(){yield $a(lI.initData,pI),yield $a(lI.removeFilter,gI),yield $a(lI.filterData,SI),yield $a([lI.loadAudits,lI.textSearch,lI.onPageChange],fI),yield $a([lI.setFilterData,lI.setDataSorting,lI.startRefresh],(()=>fI({payload:{appendMode:!1},type:""}))),yield $a(lI.exportCSV,vI)}const mI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},AI={initData:()=>R({},mI),setConnectivityState:(e,{payload:t})=>R({},e,t),cleanWebhookTestData:e=>R({},e,{testResult:void 0}),cleanWebhookLogsData:e=>R({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return R({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>R({},e,{error:void 0}),cleanSlackData:e=>R({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>R({},e,{retryResult:R({},e.retryResult,t)})}},bI={loadSlackActions:yt("connectivity/loadSlackActions"),loadDataAction:yt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:yt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:yt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:yt("connectivity/loadScope"),deleteWebhookConfigAction:yt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:yt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:yt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},TI={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:EI,actions:kI}=pt({name:Nt,initialState:TI,reducers:R({},AI)}),OI=R({},kI,bI),II={slack:rp.connectivity.getSlackConfiguration,email:rp.connectivity.getEmailConfiguration,sms:rp.connectivity.getSMSConfiguration,webhook:rp.connectivity.getWebhooksConfigurations,categories:rp.connectivity.getCategories,channelMap:rp.connectivity.getChannelMaps},PI={slack:rp.connectivity.postSlackConfiguration,email:rp.connectivity.postEmailConfiguration,sms:rp.connectivity.postSMSConfiguration,webhook:rp.connectivity.postWebhooksConfiguration},_I=["email","slack","sms","webhook"],LI={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"}},wI=["id"],UI=["id","enabled"],CI=["categories","channelMap"];function*DI(e){return yield Bo(NI,{payload:{api:e},type:""})}function*RI({payload:e=_I}){yield Vo(OI.setConnectivityState({isLoading:!0}));try{const t=yield xo([...e.map(DI),yield NI({payload:{api:"categories"},type:""}),yield function*(){return(yield xo(e.map((function*(e){return yield NI({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>R({},t,{[`${e[i]}`]:n})),{})}()]),n=yield NI({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?R({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:LI[e[o]].events(i),active:LI[e[o]].isActive(i),platform:LI[e[o]].title,image:LI[e[o]].image}]}):n:R({},n,{[`${CI[o-e.length]}`]:i})),{list:[],webhook:n});yield Vo(OI.setConnectivityState(R({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield Vo(OI.setConnectivityState({isLoading:!1}))}}function*NI({payload:{api:e,params:t}}){try{return yield Bo(II[e],t)}catch(e){return}}function*MI(){try{yield Vo(OI.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Bo(rp.connectivity.getSlackChannels);yield Vo(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield Vo(OI.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*FI(e,t){const{connectivity:{list:n}}=yield Ko(),i=n.find((({key:t})=>t===e));if(!i)return;const o=LI[e].isActive(t);o!==i.active&&(yield Vo(OI.setConnectivityState({list:n.map((t=>t.key===e?R({},t,{active:o}):t))})))}function*GI({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ko((e=>e.connectivity));try{if(yield Vo(OI.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ko();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield xo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=to(e,wI);return n===t.id&&JSON.stringify(R({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Bo(PI.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Bo(rp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ko(),{processIds:i}=yield Ko((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield xo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Bo("email"===t?rp.connectivity.postEmailConfiguration:rp.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=to(o,UI);return yield xo([yield Bo("email"===t?rp.connectivity.patchEmailConfiguration:rp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Bo("email"===t?rp.connectivity.putEmailSubscriptions:rp.connectivity.putSMSSubscriptions,a,i,R({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Bo("email"===t?rp.connectivity.deleteEmailSubscriptions:rp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield NI({payload:{api:t},type:""});yield Vo(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield FI(t,e)}else yield Vo(OI.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Bo(PI[e],t),!["sms","email"].includes(e)){const o=yield NI({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield Vo(OI.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield FI(e,o),null==n||n(!0)}}catch(e){yield Vo(OI.setConnectivityState({error:Tg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*$I({payload:e}){try{yield rp.connectivity.postSlackCode(e)}catch{}yield Vo(OI.setConnectivityState({error:void 0,isSaving:!1}))}function*VI(){const{slackChannels:e}=yield Ko((e=>e.connectivity));try{yield Vo(OI.setConnectivityState({slackChannels:R({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Bo(rp.connectivity.getSlackScope);yield Vo(OI.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield Vo(OI.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*xI({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ko((e=>e.connectivity));try{yield Vo(OI.setConnectivityState({isSaving:!0})),yield Bo(rp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Tg(e))}const o=yield NI({payload:{api:"webhook"},type:""});o&&(yield Vo(OI.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*jI({payload:e}){try{yield Vo(OI.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Bo(rp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield Vo(OI.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield Vo(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield Vo(OI.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*BI({payload:e}){try{const{statusCode:t}=yield Bo(rp.connectivity.postWebhookRetry,e);yield Vo(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield Vo(OI.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*WI({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ko((e=>e.connectivity));try{yield Vo(OI.setConnectivityState({webhookLogs:R({},i,{isLoading:!0})}));const o=yield Bo(rp.connectivity.getWebhookLog,e,n,t);yield Vo(OI.setConnectivityState({error:void 0,webhookLogs:R({isLoading:!1},o)}))}catch(e){yield Vo(OI.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var zI={sagas:function*(){yield Ga(OI.loadDataAction,RI),yield $a(OI.loadSlackActions,MI),yield Ga(OI.postDataAction,GI),yield Ga(OI.postCodeAction,$I),yield Ga(OI.loadScope,VI),yield Ga(OI.deleteWebhookConfigAction,xI),yield Ga(OI.postWebhookTestAction,jI),yield Ga(OI.postWebhookRetryAction,BI),yield $a(OI.loadWebhookLogsAction,WI)},storeName:Nt,initialState:TI,reducer:EI,actions:OI};function KI(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}}function HI(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>R({},n,{[e]:t(n[e],i)})}}function qI(e){return HI(e,((e,t)=>R({},e,{loading:t.payload})))}function JI(e){return HI(e,((e,t)=>R({},e,{error:t.payload,loading:!1})))}const YI={loading:!1,error:null,fetching:!0,plans:[]},{actions:QI,reducer:XI,name:ZI}=pt({name:"subscriptions/plans",initialState:YI,reducers:R({},KI())}),eP=R({loadPlans:yt(`${ZI}/loadPlans`)},QI),tP={loading:!1,error:null,fetching:!0,config:null},nP=R({},KI()),{actions:iP,reducer:oP,name:aP}=pt({name:"subscriptions/config",initialState:tP,reducers:nP}),rP=R({loadPaymentConfiguration:yt(`${aP}/loadPaymentConfiguration`)},iP),sP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},lP=R({},KI(),{setCancellationLoading:qI("cancellation"),setCancellationError:JI("cancellation"),setRenewalLoading:qI("renewal"),setRenewalError:JI("renewal")}),{reducer:cP,actions:uP,name:dP}=pt({name:"subscriptions/billing/subscription",initialState:sP,reducers:lP}),yP=R({load:yt(`${dP}/loadSubscription`),cancelSubscription:yt(`${dP}/cancelSubscription`),renewSubscription:yt(`${dP}/renewSubscription`)},uP),fP={loading:!1,error:null,fetching:!0},pP=R({},KI()),{reducer:gP,actions:SP,name:vP}=pt({name:"subscriptions/billing/information",initialState:fP,reducers:pP}),hP=R({loadBillingInformation:yt(`${vP}/loadBillingInformation`),cancelSubscription:yP.cancelSubscription,renewSubscription:yP.renewSubscription},SP),mP={loading:!1,error:null,fetching:!0},AP=R({},KI(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,t.payload)}}),{reducer:bP,actions:TP,name:EP}=pt({name:"subscriptions/billing/payment",initialState:mP,reducers:AP}),kP=R({loadPaymentMethod:yt(`${EP}/loadPaymentMethod`),submitPaymentMethod:yt(`${EP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${EP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${EP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${EP}/updateBillingDetails`,(e=>({payload:e})))},TP),OP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},IP=R({},KI(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>R({},e,{invoiceDownload:R({},e.invoiceDownload,t.payload)})}}),{reducer:PP,actions:_P,name:LP}=pt({name:"subscriptions/billing/invoices",initialState:OP,reducers:IP}),wP=R({loadInvoices:yt(`${LP}/loadInvoices`),downloadInvoice:yt(`${LP}/downloadInvoice`,(e=>({payload:e})))},_P),UP={information:fP,invoices:OP,paymentMethod:mP,subscription:sP},CP={invoices:wP,information:hP,paymentMethod:kP,subscription:yP},DP=Ke({invoices:PP,information:gP,paymentMethod:bP,subscription:cP}),RP={fetching:!0,loading:!1,error:null,confirmed:!1},NP=R({},KI()),{actions:MP,reducer:FP,name:GP}=pt({name:"subscriptions/checkout",initialState:RP,reducers:NP}),$P=R({loadCheckout:yt(`${GP}/loadCheckout`),resetCheckout:yt(`${GP}/resetCheckout`),submitCheckout:yt(`${GP}/submitCheckout`),confirmCheckout:yt(`${GP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${GP}/errorCheckout`,(e=>({payload:e})))},MP),VP={loading:!1,error:null,cardSetupIntentSecret:null},xP=R({},KI()),{reducer:jP,actions:BP,name:WP}=pt({name:"subscriptions/stripe",initialState:VP,reducers:xP}),zP=R({loadCustomer:yt(`${WP}/loadCustomer`),createCardSetupIntentSecret:yt(`${WP}/createCardSetupIntentSecret`)},BP),KP={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:HP,reducer:qP,name:JP}=pt({name:"subscriptions/vendorPublicConfig",initialState:KP,reducers:R({},KI())}),YP=R({loadVendorPublicConfiguration:yt(`${JP}/loadVendorPublicConfiguration`)},HP),QP={config:tP,plans:YI,checkout:RP,billing:UP,stripe:VP,vendorPublicConfig:KP},XP={config:rP,billing:CP,plans:eP,checkout:$P,stripe:zP,vendorPublicConfig:YP},ZP=Ke({config:oP,billing:DP,plans:XI,checkout:FP,stripe:jP,vendorPublicConfig:qP});let e_,t_,n_;function i_({policy:e}){return{policy:n_.AT_PERIOD_END}}function o_(e){switch(e){case Qy.ACTIVE:return t_.ACTIVE;case Qy.INCOMPLETE:return t_.INCOMPLETE;case Qy.CANCELED:return t_.CANCELED;case Qy.EXPIRED:return t_.EXPIRED;case Qy.TRIALING:return t_.TRIALING;default:return t_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(e_||(e_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(t_||(t_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(n_||(n_={}));const a_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Qy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},r_=[{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"}],s_=[{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:""}],l_=[{id:"id",externalId:"externalId",type:Xy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],c_={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*u_(){yield Vo(yP.setLoading(!0));try{const[e]=yield Bo(rp.subscriptions.getManagedSubscriptions);yield Vo(yP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield Vo(yP.setError(e))}}function*d_(){yield Ga(hP.loadBillingInformation,y_)}function*y_(){yield function*(e){const t=yield Ko((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield f_(n,!1):yield Vo(hP.setError(t?"Not authorized":"Internal feature failure"))}()}function*f_(e,t){yield Vo(hP.setLoading(!0));try{var n,i;const o=yield Bo(rp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield Bo(rp.subscriptions.getSubscriptionPlan,a):([,s]=yield xo([Bo(u_),Bo(rp.subscriptions.getSubscriptionPlan,a)]),l=yield Ko((e=>e.subscriptions.billing.subscription.subscription||null))),yield Vo(hP.setState(R({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?t_.ACTIVE:o_(l.status),cancellation:l.cancellation&&i_(l.cancellation),trialEnd:l.trialEnd?l.trialEnd:null}}:{},s?{plan:{id:s.id,name:s.name,description:s.description,price:(null==(n=s.price)?void 0:n.amount)||0,currency:(null==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield Vo(hP.setError(Tg(e)))}}function*p_(){yield function*(){var e,t;yield Vo(hP.setLoading(!0)),yield Ho(500),yield Vo(hP.setState({loading:!1,fetching:!1,summary:{subscriptionId:a_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ef.Stripe,externallyManaged:!1,currentPlanId:r_[0].id,defaultPlanId:r_[0].id},plan:R({},r_[0],{price:null==(e=r_[0].price)?void 0:e.amount,currency:null==(t=r_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*g_(){yield Ga(hP.loadBillingInformation,p_)}function*S_(){yield Ga(kP.loadPaymentMethod,v_),yield Ga(kP.submitPaymentMethod,m_),yield Ga(kP.submitPaymentMethodError,A_),yield Ga(kP.submitPaymentMethodSuccess,b_),yield Ga(kP.updatePaymentMethodBillingDetails,h_)}function*v_(){yield Vo(kP.setLoading(!0));try{const e=(yield Bo(rp.subscriptions.getPaymentMethods))[0];yield Vo(kP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield Vo(kP.setError(Tg(e)))}}function*h_({payload:e}){yield Vo(kP.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Bo(rp.subscriptions.updatePaymentMethodBillingDetails,t,R({email:n},i)),yield Bo(v_),null==o||o(!0)}catch(e){yield Vo(kP.setError(Tg(e))),null==o||o(!1)}yield Vo(kP.setLoading(!1))}function*m_(){yield Vo(kP.setLoading(!0))}function*A_({payload:e}){yield Vo(kP.setError(e))}function*b_(){yield Vo(kP.loadPaymentMethod())}function*T_(){yield Vo(kP.setLoading(!0)),yield Ho(500);const e=l_[0];yield Vo(kP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*E_(){yield Ga(kP.loadPaymentMethod,T_)}function*k_(){yield Ga(wP.loadInvoices,O_),yield Ga(wP.downloadInvoice,I_)}function*O_(){yield Vo(wP.setLoading(!0));try{const e=(yield Bo(rp.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 Vo(wP.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield Vo(wP.setError(Tg(e)))}}function*I_({payload:e}){yield Vo(wP.setInvoiceDownloadState({loading:!0,error:null}));try{yield Bo(rp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield Vo(wP.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield Vo(wP.setInvoiceDownloadState({loading:!1,error:Tg(e,null)}))}}function*P_(){yield Vo(wP.setLoading(!0)),yield Ho(500),yield Vo(wP.setState({loading:!1,fetching:!1,invoices:s_.map((e=>R({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield Vo(wP.setLoading(!1))}function*__(){yield Ga(wP.loadInvoices,P_)}function*L_(){yield Ga(yP.load,w_),yield Ga(yP.cancelSubscription,U_),yield Ga(yP.renewSubscription,C_)}function*w_(){const e=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield f_(e)}function*U_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Vo(yP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Vo(yP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Qy.ACTIVE)try{yield Vo(yP.setCancellationLoading(!0)),yield Bo(rp.subscriptions.cancelManagedSubscription,t),yield u_(),yield Vo(yP.setCancellationLoading(!1))}catch(e){yield Vo(yP.setCancellationError(Tg(e)))}}function*C_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield Vo(yP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield Vo(yP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zy.AT_PERIOD_END)try{yield Vo(yP.setRenewalLoading(!0)),yield Bo(rp.subscriptions.renewManagedSubscription,t),yield u_(),yield Vo(yP.setRenewalLoading(!1))}catch(e){yield Vo(yP.setCancellationError(Tg(e)))}}function*D_(){yield Vo(yP.setLoading(!0)),yield Ho(500),yield Vo(yP.setState({subscription:a_,fetching:!1,loading:!1,error:null}))}function*R_(){yield Ga(yP.load,D_)}function*N_(){yield xo([Bo(d_),Bo(S_),Bo(k_),Bo(L_)])}function*M_(){yield xo([Bo(g_),Bo(E_),Bo(__),Bo(R_)])}function*F_(){yield Ga($P.loadCheckout,G_),yield Ga($P.resetCheckout,$_),yield Ga($P.submitCheckout,V_),yield Ga($P.confirmCheckout,x_),yield Ga($P.errorCheckout,B_)}function*G_(){yield Vo($P.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*$_(){yield Vo($P.setState({loading:!1,error:null,confirmed:!1}))}function*V_(){yield Vo($P.setState({loading:!0,error:null}))}function*x_({payload:{paymentMethodId:e,planId:t}}){const n=yield Ko((e=>e.subscriptions.billing.subscription.subscription)),i=yield Ko((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Qy.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield Vo($P.setState({loading:!0,error:null})),o&&a)return yield j_(),void(yield Vo(yP.setState({subscription:R({},n,{status:Qy.ACTIVE})})));try{yield Bo(rp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield xo([y_(),v_(),O_()]),yield j_()}catch(e){yield Vo($P.setState({loading:!1,error:Tg(e)}))}}else yield Vo($P.setState({loading:!1,error:"Subscription not found"}))}function*j_(){yield Vo($P.setState({loading:!1,error:null,confirmed:!0}))}function*B_({payload:e}){yield Vo($P.setState({loading:!1,error:e}))}function*W_(){yield Ga($P.resetCheckout,$_)}function*z_(){yield Ga(eP.loadPlans,K_)}function*K_(){yield Vo(eP.setLoading(!0));try{const e=(yield Bo(rp.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 Vo(eP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield Vo(eP.setError(Tg(e)))}}function*H_(){yield Vo(eP.setLoading(!0)),yield Ho(500),yield Vo(eP.setState({fetching:!1,loading:!1,plans:r_.map((e=>{var t,n;return R({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*q_(){yield Ga(eP.loadPlans,H_)}function*J_(){yield Ga(rP.loadPaymentConfiguration,Y_)}function*Y_(){yield Vo(rP.setLoading(!0));try{(yield Bo(rp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ef.Stripe))?yield function*(){yield Vo(rP.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getStripePaymentProviderConfiguration);yield Vo(rP.setState({loading:!1,fetching:!1,config:{paymentProvider:e_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield Vo(rP.setError(Tg(e)))}}():yield Vo(rP.setError("Payment provider not configured"))}catch(e){yield Vo(rP.setError(Tg(e)))}}function*Q_(){yield Vo(rP.setLoading(!0)),yield Ho(500),yield Vo(rP.setState({loading:!1,fetching:!1,config:{paymentProvider:e_.STRIPE,apiKey:""}}))}function*X_(){yield Ga(rP.loadPaymentConfiguration,Q_)}function*Z_(){yield Ga(zP.createCardSetupIntentSecret,eL)}function*eL({payload:e}){yield Vo(zP.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Bo(rp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield Vo(zP.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield Vo(zP.setError(Tg(e)))}}function*tL(){yield Ga(YP.loadVendorPublicConfiguration,nL)}function*nL(){yield Vo(YP.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getVendorPublicConfigurations);yield Vo(YP.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield Vo(YP.setError(Tg(e)))}}function*iL(){yield Vo(YP.setLoading(!0)),yield Ho(500),yield Vo(YP.setState({fetching:!1,loading:!1,vendorPublicConfig:c_}))}function*oL(){yield Ga(YP.loadVendorPublicConfiguration,iL)}var aL={sagas:function*(){yield xo([Bo(N_),Bo(F_),Bo(z_),Bo(J_),Bo(Z_),Bo(tL)])},mockSagas:function*(){yield xo([Bo(M_),Bo(W_),Bo(q_),Bo(X_),Bo(oL)])},reducer:ZP,actions:XP,initialState:QP,storeName:"subscriptions"},rL={sagas:function*(){yield Ga(WS.loadVendorPublicInfo,zS)},storeName:Ft,initialState:xS,reducer:jS,actions:WS};const{reducer:sL}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(xa.setContext(t),R({},e,{context:t}))}}}),lL=(e,t,n=!1,i,o,a=!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,u,d,y,f,p,g,S,v,h;n||a||xa.setContext(e.context);const t=La(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:R({},e,{previewMode:n,urlStrategy:r}),[UO.storeName]:R({},UO.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:R({},UO.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[iI.storeName]:R({},iI.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:R({},iI.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:R({},iI.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[aI]:R({},oI,null!=(h=null==o?void 0:o.audits)?h:{}),[zI.storeName]:zI.initialState,[aL.storeName]:aL.initialState,[rL.storeName]:rL.initialState},reducer:Ke({root:sL,[UO.storeName]:UO.reducer,[iI.storeName]:iI.reducer,[aI]:sI,[zI.storeName]:zI.reducer,[aL.storeName]:aL.reducer,[rL.storeName]:rL.reducer})});const m=function*(){yield xo([Bo(UO.sagas),Bo(iI.sagas),Bo(hI),Bo(zI.sagas),Bo(aL.sagas),Bo(rL.sagas)])},A=function*(){yield xo([Bo(UO.mockSagas),Bo(iI.mockSagas),Bo(aL.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(ji.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 cL=n(314);const uL=()=>{if(!xa.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},dL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var yL=n(714),fL=n.n(yL);function pL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function gL(e){if(e.type)return e;if("#"===e.charAt(0))return gL(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function SL(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function vL(e){if(0===e.indexOf("#"))return e;const{values:t}=gL(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 hL(e,t){return e=gL(e),t=pL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,SL(e)}function mL(e,t){if(e=gL(e),t=pL(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 SL(e)}function AL(e,t){if(e=gL(e),t=pL(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 SL(e)}const bL=e=>{if(e)return{main:e,light:vL(AL(e,.4)),dark:vL(mL(e,.15)),hover:vL(mL(e,.15)),active:vL(mL(e,.2))}},TL=e=>{if(e)return{main:e,light:AL(e,.7),dark:mL(e,.2)}},EL=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?R({},t,{palette:{primary:R({},bL(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:R({},bL(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:R({},bL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:R({},TL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:R({},TL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:R({},TL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:R({},TL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},kL={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",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class OL{constructor(){this._theme=kL.theme,this._themeV2=kL.themeV2,this._navigation=kL.navigation,this._localizations=kL.localizations,this._integrations=kL.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new OL;return n.set(e),OL._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,i,o,a,r,s,l,c;this._navigation=fL().all([null!=(t=kL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=fL().all([null!=(i=kL.theme)?i:{},EL(null==e?void 0:e.theme,kL.theme)]),this._themeV2=fL().all([null!=(o=kL.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=fL().all([null!=(r=kL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=fL().all([null!=(l=kL.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=kL.navigation,this._theme=kL.theme,this._themeV2=kL.themeV2,this._localizations=kL.localizations,this._integrations=kL.integrations}}}OL._instances={};var IL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},PL=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},_L=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))},LL=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 wL,UL,CL,DL,RL,NL,ML,FL,GL,$L,VL,xL;!function(e){e.phoneNumber="phoneNumber"}(wL||(wL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(UL||(UL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(CL||(CL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(DL||(DL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(RL||(RL={})),function(e){e.Invoices="invoices"}(NL||(NL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(ML||(ML={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(FL||(FL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(GL||(GL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}($L||($L={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(VL||(VL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(xL||(xL={}));const jL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},BL={hidden:"hidden",edit:"edit"};var WL="6.163.0",zL={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"},KL=function(){function e(t,n){var i,o,a=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];I(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(WL),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,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Dr,a.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,a.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:OL.set(a.options.metadata,a.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=null==(t=a.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,a.options.builderMode||"nextjs"===a.options.framework||(a.options.hostedLoginBox&&!a.options.customLoginBox?i&&a.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):a.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(!a.options.previewMode&&!a.options.builderMode){e.next=4;break}Br.set(zL,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Wr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Br.set(t,a.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){Br.set(R({},zL,e),a.name)},this.queryFeatureFlags=function(e){return Br.getFeatureFlags(e,a.name)},this.updateLocalizationsSetter=function(e){a.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=a.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return a.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=a.getUserFromStore();return{entitlements:a.getEntitlementsFromStore(),attributes:{custom:e,jwt:t},isV2:D(a.queryFeatureFlags([xr]),1)[0]}};var l=IL(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=R({},t,{contextOptions:R({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?R({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.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=lL({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);U.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),xa.setAppName(l)}var t,n,i,o;return w(e,[{key:"setEntitlementsOptions",value:function(e){xa.setEntitlementsOptions(R({},e))}},{key:"setSessionContext",value:function(e){xa.setSessionContext(R({},e))}},{key:"initContainers",value:(o=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,i=void 0,void 0,a=void 0,null==(a=null==(o=OL.getInstance(n))||null==(i=o.integrations)?void 0:i.gtm)||a.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,i,o,a}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;OL.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:O})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=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 i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xa.setRequestSource(ui.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),LL(t),xa.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,R({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,i)=>{var o;return uL(),i?(0,cL.tE)(t,e,n):dL(null==e||null==(o=e.features)?void 0:o[t],Hs.MISSING_FEATURE)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return uL(),i?(0,cL.wJ)(t,e,n):dL(null==e||null==(o=e.permissions)?void 0:o[t],Hs.MISSING_PERMISSION)})(n.entitlements,e,n.attributes,n.isV2)}},{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:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),HL=function(){function e(){I(this,e)}return w(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=U.getInstance(i);e&&t?(xa.setAccessToken(t),xa.setUser(R({},n,{accessToken:t})),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ji.loadTenants())):(xa.setAccessToken(null),xa.setUser(null),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),qL=function(){function e(){I(this,e)}return w(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideAdminPortal()}}]),e}(),JL=function(){function e(){I(this,e)}return w(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";U.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";U.getInstance(e).hideCheckoutDialog()}}]),e}(),YL=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},QL=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=lL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new KL(this.options,t,!0),OL.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,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,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,_L(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}(),XL="modern",ZL=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[XL]},ew=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];I(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=lL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=R({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new KL(this.options,t,!0,a),OL.set({},t)}var t;return w(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,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,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,_L(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 tw(e,t){return tw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},tw(e,t)}function nw(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&&tw(e,t)}function iw(e,t){if(t&&("object"===P(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 ow(e){return ow=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ow(e)}function aw(){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 rw(e,t,n){return rw=aw()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&tw(o,n.prototype),o},rw.apply(null,arguments)}function sw(e){var t="function"==typeof Map?new Map:void 0;return sw=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 rw(e,arguments,ow(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),tw(n,e)},sw(e)}function lw(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=ow(e);if(t){var o=ow(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return iw(this,n)}}var cw=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new KL(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){nw(n,e);var t=lw(n);function n(){var e;I(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return w(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=U.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=PL(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=PL(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=PL(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=PL(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=PL(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=PL(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(sw(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={987:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createConditionEvaluator=void 0;const i=n(651),o=n(82);t.createConditionEvaluator=function(e){const t=(0,o.useSanitizer)(e.condition.op);if(!t)return()=>!1;const{isSanitized:n,sanitizedValue:a}=t(e.condition.value);if(!n||void 0===a)return()=>!1;const r=(0,i.useOperation)(e.condition.op,a);return t=>{const n=t[e.condition.attribute],{isValid:i}=void 0!==n&&r?r(n):{isValid:!1};return e.condition.negate?!i:i}}},898:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(987),t),o(n(371),t)},371:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},840:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateFeatureFlag=void 0;const i=n(380);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,i.createRuleEvaluator)({rule:e})(t)===i.RuleEvaluationResultEnum.Treatable))}(e,t);return n?{treatment:n.treatment}:{treatment:e.defaultTreatment}}},95:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(840),t)},314:function(e,t,n){"use strict";t.wJ=t.tE=void 0;n(95),n(380),n(379);var i=n(535);Object.defineProperty(t,"tE",{enumerable:!0,get:function(){return i.evaluateIsEntitledToFeature}}),Object.defineProperty(t,"wJ",{enumerable:!0,get:function(){return i.evaluateIsEntitledToPermissions}})},195:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanOperationsMapper=void 0;const a=n(379),r=n(615);o(n(615),t),o(n(226),t),t.BooleanOperationsMapper={[a.OperationEnum.Is]:e=>(0,r.useIsOperation)(e)}},615:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useIsOperation=void 0,t.useIsOperation=function(e){return t=>({isValid:t===e.boolean})}},226:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanSanitizersMapper=t.singleBooleanSanitizer=void 0;const i=n(379);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={[i.OperationEnum.Is]:t.singleBooleanSanitizer}},651:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useOperation=void 0;const i=n(943),o=n(610),a=n(4),r=n(195),s={...i.StringOperationsMapper,...o.NumericOperationsMapper,...a.DateOperationsMapper,...r.BooleanOperationsMapper};t.useOperation=function(e,t){const n=s[e];return n?n(t):void 0}},82:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useSanitizer=void 0;const i=n(195),o=n(903),a=n(886),r=n(610),s={...o.StringSanitizersMapper,...r.NumericSanitizersMapper,...a.DateSanitizersMapper,...i.BooleanSanitizersMapper};t.useSanitizer=function(e){return s[e]}},4:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateOperationsMapper=void 0;const a=n(379),r=n(569);o(n(569),t),o(n(931),t),t.DateOperationsMapper={[a.OperationEnum.On]:e=>(0,r.useDateOnOperation)(e),[a.OperationEnum.OnOrAfter]:e=>(0,r.useDateOnOrAfterOperation)(e),[a.OperationEnum.OnOrBefore]:e=>(0,r.useDateOnOrBeforeOperation)(e),[a.OperationEnum.BetweenDate]:e=>(0,r.useDateBetweenOperation)(e)}},569:function(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()})}},886:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateSanitizersMapper=t.sanitizeDateRange=t.sanitizeSingleDate=t.isValidDate=t.sanitizeDateValue=void 0;const i=n(379);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,i=n&&(0,t.isValidDate)(n)?{date:n}:void 0;return{isSanitized:!!i,sanitizedValue:i}},t.sanitizeDateRange=e=>{const n=e.start?(0,t.sanitizeDateValue)(e.start):void 0,i=e.end?(0,t.sanitizeDateValue)(e.end):void 0,o=n&&i&&(0,t.isValidDate)(n)&&(0,t.isValidDate)(i)?{start:n,end:i}:void 0;return{isSanitized:!!o,sanitizedValue:o}},t.DateSanitizersMapper={[i.OperationEnum.On]:t.sanitizeSingleDate,[i.OperationEnum.OnOrAfter]:t.sanitizeSingleDate,[i.OperationEnum.OnOrBefore]:t.sanitizeSingleDate,[i.OperationEnum.BetweenDate]:t.sanitizeDateRange}},931:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},610:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.NumericOperationsMapper=void 0;const a=n(379),r=n(217);t.NumericOperationsMapper={[a.OperationEnum.Equal]:e=>(0,r.useEqualsOperation)(e),[a.OperationEnum.GreaterThan]:e=>(0,r.useGreaterThanOperation)(e),[a.OperationEnum.GreaterThanEqual]:e=>(0,r.useGreaterThanEqualOperation)(e),[a.OperationEnum.LesserThan]:e=>(0,r.useLesserThanOperation)(e),[a.OperationEnum.LesserThanEqual]:e=>(0,r.useLesserThanEqualOperation)(e),[a.OperationEnum.BetweenNumeric]:e=>(0,r.useBetweenNumericOperation)(e)},o(n(217),t),o(n(326),t),o(n(764),t)},217:function(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})}},326:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NumericSanitizersMapper=t.sanitizeNumericRange=t.sanitizeSingleNumber=void 0;const i=n(379),o=e=>"number"==typeof e;t.sanitizeSingleNumber=e=>{const t=void 0!==e.number&&o(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&&o(e.start)&&o(e.end)?{start:e.start,end:e.end}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.NumericSanitizersMapper={[i.OperationEnum.Equal]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThan]:t.sanitizeSingleNumber,[i.OperationEnum.GreaterThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThan]:t.sanitizeSingleNumber,[i.OperationEnum.LesserThanEqual]:t.sanitizeSingleNumber,[i.OperationEnum.BetweenNumeric]:t.sanitizeNumericRange}},764:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},943:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.StringOperationsMapper=void 0;const a=n(379),r=n(431);o(n(431),t),o(n(97),t),t.StringOperationsMapper={[a.OperationEnum.StartsWith]:e=>(0,r.useStartsWithOperation)(e),[a.OperationEnum.EndsWith]:e=>(0,r.useEndsWithOperation)(e),[a.OperationEnum.Contains]:e=>(0,r.useContainsOperation)(e),[a.OperationEnum.InList]:e=>(0,r.useInListOperation)(e),[a.OperationEnum.Matches]:e=>(0,r.useMatchesOperation)(e)}},431:function(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)}}}},903:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringSanitizersMapper=t.sanitizeListString=t.sanitizeSingleString=void 0;const i=n(379),o=e=>"string"==typeof e;t.sanitizeSingleString=e=>{const t=void 0!==e.string&&o(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=>o(e)))?{list:e.list}:void 0;return{isSanitized:!!t,sanitizedValue:t}},t.StringSanitizersMapper={[i.OperationEnum.Matches]:t.sanitizeSingleString,[i.OperationEnum.Contains]:t.sanitizeListString,[i.OperationEnum.StartsWith]:t.sanitizeListString,[i.OperationEnum.EndsWith]:t.sanitizeListString,[i.OperationEnum.InList]:t.sanitizeListString}},97:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0})},379:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(982),t)},982:function(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"},380:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(930),t),o(n(304),t)},304:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createRuleEvaluator=void 0;const i=n(930),o=n(898);t.createRuleEvaluator=function(e){return t=>e.rule.conditions.every((e=>(0,o.createConditionEvaluator)({condition:e})(t)))?i.RuleEvaluationResultEnum.Treatable:i.RuleEvaluationResultEnum.Insufficient}},930:function(e,t){"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.RuleEvaluationResultEnum=t.TreatmentEnum=t.ConditionLogicEnum=void 0,(t.ConditionLogicEnum||(t.ConditionLogicEnum={})).And="and",(i=t.TreatmentEnum||(t.TreatmentEnum={})).True="true",i.False="false",(n=t.RuleEvaluationResultEnum||(t.RuleEvaluationResultEnum={})).Treatable="treatable",n.Insufficient="insufficient"},950:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.modifyObjectKeysWithPrefix=t.defaultFronteggAttributesMapper=t.prepareAttributes=void 0;const i=n(137);function o(e){return{email:e.email,emailVerified:e.email_verified,tenantId:e.tenantId,userId:e.id}}function a(e,t){return Object.keys(e).reduce(((n,i)=>(n[`${t}${i}`]=e[i],n)),{})}t.prepareAttributes=function(e={},t){const{custom:n={},jwt:r={}}=e,s=(0,i.flatten)(r);return{...n,...a(t?t(r):o(r),"frontegg."),...a(s,"jwt.")}},t.defaultFronteggAttributesMapper=o,t.modifyObjectKeysWithPrefix=a},137:function(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 i=(null==(t=t||{})?void 0:t.delimiter)||".",o=null==t?void 0:t.maxDepth,a=(null==t?void 0:t.transformKey)||n,r={};return function e(n,s,l){l=l||1,Object.keys(n).forEach((function(c){const u=n[c],d=(null==t?void 0:t.safe)&&Array.isArray(u),y=Object.prototype.toString.call(u),f=(p=u)&&p.constructor&&"function"==typeof p.constructor.isBuffer&&p.constructor.isBuffer(p);var p;const g="[object Object]"===y||"[object Array]"===y,S=s?s+i+a(c):a(c);if(!d&&!f&&g&&Object.keys(u).length&&(!(null==t?void 0:t.maxDepth)||o&&l<o))return e(u,S,l+1);r[S]=u}))}(e),r}},535:function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,o)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(405),t),o(n(113),t),o(n(950),t),o(n(387),t)},405:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateIsEntitledToPermissions=t.evaluateIsEntitledToFeature=void 0;const i=n(113),o=n(95),a=n(950),r=n(380),s=n(387);function l(e,t,n={}){const s=t.features[e];let l=!1;if(s&&null!==s.expireTime&&(l=s.expireTime!==i.NO_EXPIRATION_TIME&&s.expireTime<Date.now(),!l))return{isEntitled:!0};if(s&&s.featureFlag){const e=(0,a.prepareAttributes)(n),{treatment:t}=(0,o.evaluateFeatureFlag)(s.featureFlag,e);if(t===r.TreatmentEnum.True)return{isEntitled:!0}}return{isEntitled:!1,justification:l?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}t.evaluateIsEntitledToFeature=l,t.evaluateIsEntitledToPermissions=function(e,t,n){if(!(0,s.checkPermission)(t.permissions,e))return{isEntitled:!1,justification:i.NotEntitledJustification.MISSING_PERMISSION};const o=function(e,t){return Object.keys(t.features).filter((n=>t.features[n].linkedPermissions.includes(e)))}(e,t);if(!o.length)return{isEntitled:!0};let a=!1;for(const e of o){const{isEntitled:o,justification:r}=l(e,t,n);if(o)return{isEntitled:!0};r===i.NotEntitledJustification.BUNDLE_EXPIRED&&(a=!0)}return{isEntitled:!1,justification:a?i.NotEntitledJustification.BUNDLE_EXPIRED:i.NotEntitledJustification.MISSING_FEATURE}}},387:function(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},113:function(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},714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},378:function(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 i,o,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(o=i;0!=o--;)if(!e(t[o],n[o]))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((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,a[o]))return!1;for(o=i;0!=o--;){var r=a[o];if(!e(t[r],n[r]))return!1}return!0}return t!=t&&n!=n}},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new _(i||[]);return r(a,"_invoke",{value:k(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,A=m&&m(m(L([])));A&&A!==n&&a.call(A,l)&&(h=A);var b=v.prototype=g.prototype=Object.create(h);function T(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function k(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var l=f(e,t,n);if("normal"===l.type){if(i=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i="completed",n.method="throw",n.arg=l.arg)}}}function I(e,t){var n=t.method,i=e.iterator[n];if(void 0===i)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),p;var o=f(i,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,p;var a=o.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function 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,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:U}}function U(){return{value:void 0,done:!0}}return S.prototype=v,r(b,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},t.awrap=function(e){return{__await:e}},T(E.prototype),d(E.prototype,c,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new E(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},T(b),d(b,u,"Generator"),d(b,l,(function(){return this})),d(b,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=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)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,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 i=n.completion;if("throw"===i.type){var o=i.arg;P(n)}return o}}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=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return iU},AdminPortalRenderer:function(){return rU},AppHolder:function(){return w},CheckoutDialog:function(){return oU},FronteggApp:function(){return tU},HostedLogin:function(){return nU},LoginBoxRenderer:function(){return cU},createElement:function(){return ML},defaultTheme:function(){return sU},formatName:function(){return NL},getThemeAdminByName:function(){return aU},getThemeByName:function(){return lU},initialize:function(){return hU},mockFlagsList:function(){return eU},restoreSearchParams:function(){return GL},waitThemeSetter:function(){return FL}});var e={};n.r(e),n.d(e,{Delete:function(){return Fr},Get:function(){return Rr},Patch:function(){return Nr},Post:function(){return Dr},PostDownload:function(){return Gr},Put:function(){return Mr},extractHeadersFromOptions:function(){return $r},getBaseUrl:function(){return Lr},getMetadataHeaders:function(){return Ur},getScopedTenant:function(){return wr}});var t={};n.r(t),n.d(t,{FeatureFlags:function(){return Br},loadFeatureFlags:function(){return Wr}});var o={};n.r(o),n.d(o,{GetUserJwt:function(){return zr},getCurrentUserTenantsV1:function(){return Xr},getCurrentUserTenantsV3:function(){return Yr},getUsersGroups:function(){return Jr},getUsersRoles:function(){return qr},getUsersV2:function(){return Kr},getUsersV3:function(){return Hr},sendResetBreachedPasswordEmails:function(){return Qr},updateUserProfileV2:function(){return Zr}});var a={};n.r(a),n.d(a,{getHierarchyMetadata:function(){return ds},getParentTenants:function(){return ss},getParentTenantsById:function(){return ls},getSubTenants:function(){return as},getSubTenantsAsTree:function(){return rs},getTenants:function(){return os},getTenantsUsersCount:function(){return cs},searchSubTenants:function(){return us},switchTenant:function(){return is}});var r={};n.r(r),n.d(r,{loadEntitlements:function(){return zs},loadEntitlementsV2:function(){return Ks}});var s={};n.r(s),n.d(s,{AuthStrategyEnum:function(){return Ii},MachineToMachineAuthStrategy:function(){return Oi},OAuthLogout:function(){return El},SocialLoginProviders:function(){return ki},acceptInvitation:function(){return hl},activateAccount:function(){return fl},activateAccountV2:function(){return pl},bulkCreateIPRestriction:function(){return Cs},changePhoneNumber:function(){return Ou},changePhoneNumberWithVerification:function(){return ku},checkIfAllowToRememberMfaDevice:function(){return qc},createDomainRestriction:function(){return Os},createIPRestriction:function(){return ws},createOrUpdateSessionConfigrations:function(){return Cc},createSSOConfiguration:function(){return eu},createSSOConfigurationByMetadata:function(){return iu},createSSOConfigurationByMetadataUrl:function(){return au},createSSODomain:function(){return su},createSSOGroup:function(){return yu},createSamlGroup:function(){return Sc},createTenantAccessToken:function(){return xc},createUserAccessToken:function(){return $c},deleteAllSessionsForUser:function(){return Dc},deleteDomainRestriction:function(){return _s},deleteIPRestriction:function(){return Ds},deleteSSOConfiguration:function(){return nu},deleteSSODomain:function(){return lu},deleteSSOGroup:function(){return pu},deleteSamlGroup:function(){return hc},deleteSessionForUser:function(){return Rc},deleteTenantAccessToken:function(){return Fc},deleteTenantApiToken:function(){return zc},deleteUserAccessToken:function(){return Gc},deleteUserApiToken:function(){return Kc},deleteWebAuthnDevice:function(){return Cu},disableMFAAuthenticatorApp:function(){return Fl},disableMFASMS:function(){return $l},disableMFAWebAuthn:function(){return Vl},disableMfa:function(){return Ml},enrollMFAAuthenticatorApp:function(){return Ul},enrollMFAAuthenticatorAppForLogin:function(){return Wl},enrollMFAAuthenticatorAppForLoginV2:function(){return zl},enrollMFASMS:function(){return Cl},enrollMFASMSForLogin:function(){return Xl},enrollMFASMSForLoginV2:function(){return Ql},enrollMFAWebAuthn:function(){return Dl},enrollMFAWebAuthnForLogin:function(){return ic},enrollMFAWebAuthnForLoginV2:function(){return oc},enrollMfa:function(){return _l},exchangeOAuthTokens:function(){return Au},exchangeOAuthTokensV2:function(){return hu},forgotPassword:function(){return kl},generateLoginResponse:function(){return Qs},generateLoginResponseFromOAuthResponse:function(){return il},generateLoginResponseFromOAuthResponseV2:function(){return ol},generateLoginResponseV2:function(){return Zs},generateLoginResponseV3:function(){return nl},generateStepupSession:function(){return xu},getActivateAccountStrategy:function(){return gl},getCaptchaPolicy:function(){return ms},getCurrentUserSession:function(){return Lc},getCurrentUserSessions:function(){return _c},getCurrentUserTenantsFunction:function(){return ns},getCustomSocialLoginProvidersV1:function(){return kc},getDomainRestrictions:function(){return ks},getDomainRestrictionsConfig:function(){return Is},getGlobalSecurityPolicy:function(){return ys},getIPRestrictions:function(){return Ls},getIPRestrictionsConfig:function(){return Us},getLockoutPolicy:function(){return Ss},getMFADevices:function(){return jl},getMFAStrategiesConfig:function(){return Mu},getMeAndEntitlements:function(){return $u},getMeV2:function(){return Gu},getMfaPolicy:function(){return fs},getOidcConfiguration:function(){return mc},getPasswordConfigPolicy:function(){return Es},getPasswordHistoryPolicy:function(){return As},getPublicAuthStrategiesConfigForAuthenticatedUser:function(){return Nu},getSSOConfigurations:function(){return Zc},getSSODefaultRoles:function(){return uu},getSSOGroups:function(){return gu},getSSOPublicConfiguration:function(){return Ac},getSamlConfiguration:function(){return lc},getSamlRoles:function(){return fc},getSamlRolesGroups:function(){return pc},getSamlVendorConfiguration:function(){return uc},getSessionConfigurations:function(){return wc},getSocialLoginProviders:function(){return bc},getSocialLoginProvidersV2:function(){return Tc},getSocialLoginProvidersV2ForAuthenticatedUser:function(){return Ec},getTabTenantFromSessionStorage:function(){return ts},getTenantAccessTokensData:function(){return Mc},getTenantApiTokensData:function(){return jc},getUserAccessTokensData:function(){return Nc},getUserApiTokensData:function(){return Vc},getUserAuthorization:function(){return Fu},getUserById:function(){return Hc},getVendorConfig:function(){return Oc},getVendorLockoutPolicy:function(){return vs},getVendorMfaPolicy:function(){return ps},getVendorPasswordHistoryPolicy:function(){return bs},getVendorPublicAuthStrategiesConfig:function(){return Du},getWebAuthnDevices:function(){return wu},loadPasswordConfig:function(){return Ol},login:function(){return cl},loginViaSocialLogin:function(){return Ic},loginWithMfa:function(){return dl},loginWithMfaV2:function(){return yl},loginv2:function(){return ul},logout:function(){return Tl},oidcPostLogin:function(){return ll},oidcPostLoginV2:function(){return vu},passwordlessPostLogin:function(){return Xc},passwordlessPostLoginV2:function(){return Yc},passwordlessPreLogin:function(){return Jc},postLogin:function(){return sl},preDisableMFASMS:function(){return Gl},preDisableMFAWebAuthn:function(){return xl},preEnrollMFAAuthenticatorApp:function(){return Ll},preEnrollMFAAuthenticatorAppForLogin:function(){return Bl},preEnrollMFASMS:function(){return wl},preEnrollMFASMSForLogin:function(){return Yl},preEnrollMFAWebAuthn:function(){return Rl},preEnrollMFAWebAuthnForLogin:function(){return nc},preLogin:function(){return al},preLoginV2:function(){return Su},preLoginWithIdpType:function(){return rl},preVerifyMFAEmailCode:function(){return Hl},preVerifyMFASMSForLogin:function(){return Zl},preVerifyMFAWebAuthnForLogin:function(){return ac},recoverMfaToken:function(){return Pl},refreshToken:function(){return ml},refreshTokenV2:function(){return Al},refreshTokenV3:function(){return bl},resendActivationEmail:function(){return Sl},resendInvitationEmail:function(){return vl},resetPassword:function(){return Il},resetPhoneNumber:function(){return Tu},revokeSessionsForUser:function(){return Uc},saveLockoutPolicy:function(){return hs},saveMfaPolicy:function(){return gs},savePasswordHistoryPolicy:function(){return Ts},setSSODefaultRoles:function(){return du},setTabTenantInSessionStorage:function(){return es},signUpUser:function(){return Pc},silentOAuthRefreshToken:function(){return bu},silentOAuthRefreshTokenV2:function(){return mu},testCurrentIp:function(){return Ns},testCurrentIpInAllowList:function(){return Ms},updateDomainRestrictionConfig:function(){return Ps},updateIPRestrictionConfig:function(){return Rs},updateSSOConfiguration:function(){return tu},updateSSOConfigurationByMetadata:function(){return ou},updateSSOConfigurationByMetadataUrl:function(){return ru},updateSSOGroup:function(){return fu},updateSamlConfiguration:function(){return cc},updateSamlGroup:function(){return vc},updateSamlRoles:function(){return gc},updateSamlVendorMetadata:function(){return dc},updateTenantApiTokensData:function(){return Wc},updateUserApiTokensData:function(){return Bc},validateSSODomain:function(){return cu},validateSamlDomain:function(){return yc},verifyChangePhoneNumber:function(){return Iu},verifyInviteToken:function(){return Qc},verifyMFAAuthenticatorAppForLogin:function(){return Kl},verifyMFAEmailCode:function(){return ql},verifyMFAEmailCodeV2:function(){return Jl},verifyMFASMSForLogin:function(){return ec},verifyMFASMSForLoginV2:function(){return tc},verifyMFAWebAuthnForLogin:function(){return rc},verifyMFAWebAuthnForLoginV2:function(){return sc},verifyMfa:function(){return Nl},verifyNewDeviceSession:function(){return Ru},verifyResetPhoneNumber:function(){return Eu},webAuthnCreateNewDeviceSession:function(){return Uu},webAuthnPostLogin:function(){return _u},webAuthnPostLoginV2:function(){return Lu},webAuthnPreLogin:function(){return Pu}});var l={};n.r(l),n.d(l,{addUser:function(){return Ku},changePassword:function(){return Wu},createInviteUserLink:function(){return Qu},deleteInviteUserLink:function(){return ed},deleteUser:function(){return Hu},getInviteLinkConfiguration:function(){return nd},getInviteUserLink:function(){return td},getProfile:function(){return Vu},getTemporaryUserConfiguration:function(){return Xu},loadAvailablePermissions:function(){return od},loadAvailableRoles:function(){return id},loadStats:function(){return ad},loadUsers:function(){return zu},resendActivationLink:function(){return rd},resendInvitationLink:function(){return sd},resendInvitationLinkToAllTenants:function(){return ld},setPermanentUser:function(){return Yu},updateInviteUserLink:function(){return Zu},updateProfile:function(){return ju},updateProfileImage:function(){return Bu},updateUser:function(){return qu},updateUserExpirationTime:function(){return Ju}});var c={};n.r(c),n.d(c,{getAdminBoxMetadata:function(){return ud},getAuditsMetadata:function(){return gd},getCurrentUserIpMetadata:function(){return yd},getIpAdressMetadata:function(){return Sd},getNotificationsMetadata:function(){return fd},getSamlMetadata:function(){return pd},updateAdminBoxMetadata:function(){return dd}});var u={};n.r(u),n.d(u,{downloadReport:function(){return kd},getReport:function(){return bd},getReports:function(){return Ad},renderReport:function(){return Td},scheduleReport:function(){return Ed},sendReport:function(){return Id}});var d={};n.r(d),n.d(d,{getNotifications:function(){return Od},markAllAsRead:function(){return Ld},updateNotificationIsPinned:function(){return _d},updateNotificationStatus:function(){return Pd}});var y={};n.r(y),n.d(y,{exportAudits:function(){return Rd},getAudits:function(){return wd},getAuditsStats:function(){return Cd}});var f={};n.r(f),n.d(f,{deleteEmailConfiguration:function(){return Hd},deleteEmailSubscriptions:function(){return zd},deleteSMSConfiguration:function(){return Zd},deleteSMSSubscriptions:function(){return Xd},deleteSlackConfiguration:function(){return xd},deleteWebhooksConfiguration:function(){return ny},getCategories:function(){return ry},getChannelMaps:function(){return sy},getEmailConfiguration:function(){return jd},getSMSConfiguration:function(){return qd},getSlackChannels:function(){return Gd},getSlackConfiguration:function(){return Md},getSlackScope:function(){return Fd},getWebhookLog:function(){return iy},getWebhooksConfigurations:function(){return ey},patchEmailConfiguration:function(){return Wd},patchSMSConfiguration:function(){return Yd},postEmailConfiguration:function(){return Bd},postSMSConfiguration:function(){return Jd},postSlackCode:function(){return Vd},postSlackConfiguration:function(){return $d},postWebhookRetry:function(){return ay},postWebhookTest:function(){return oy},postWebhooksConfiguration:function(){return ty},putEmailSubscriptions:function(){return Kd},putSMSSubscriptions:function(){return Qd}});var p={};n.r(p),n.d(p,{getPublicSettings:function(){return uy},getSettings:function(){return cy},updateSettings:function(){return ly}});var g={};n.r(g),n.d(g,{addRole:function(){return gy},attachPermissionToRoles:function(){return Ay},attachPermissionsToRole:function(){return hy},deleteRole:function(){return Sy},getPermissionCategories:function(){return by},getPermissions:function(){return my},getRoles:function(){return py},updateRole:function(){return vy}});var S={};n.r(S),n.d(S,{ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Xy},PaymentMethodType:function(){return Qy},ProviderType:function(){return ef},TenantCreatedAction:function(){return nf},TrialEndAction:function(){return tf},cancelManagedSubscription:function(){return Ly},cancelSubscription:function(){return ky},createStripeCustomer:function(){return By},createStripePaymentMethodSetupIntentSecret:function(){return zy},createSubscription:function(){return Vy},createTenantConfiguration:function(){return qy},getManagedSubscription:function(){return Py},getManagedSubscriptions:function(){return _y},getPaymentMethod:function(){return $y},getPaymentMethods:function(){return Gy},getPaymentProviders:function(){return Jy},getStripeCustomer:function(){return jy},getStripePaymentProviderConfiguration:function(){return Wy},getSubscription:function(){return Ey},getSubscriptionInvoice:function(){return Ny},getSubscriptionInvoicePdf:function(){return My},getSubscriptionInvoices:function(){return Dy},getSubscriptionPlan:function(){return Ry},getSubscriptionPlans:function(){return Cy},getSubscriptionSummaries:function(){return Ky},getSubscriptions:function(){return Ty},getTenantConfiguration:function(){return Hy},getVendorPublicConfigurations:function(){return Yy},renewManagedSubscription:function(){return Uy},renewSubscription:function(){return Iy},updateManagedSubscription:function(){return wy},updatePaymentMethodBillingDetails:function(){return xy},updateSubscription:function(){return Oy}});var v={};n.r(v),n.d(v,{getVendorPublicInfo:function(){return of}});var h={};n.r(h),n.d(h,{addUserRolesForSubTenants:function(){return lf},addUserToTenantAndSubTenants:function(){return rf},addUsersToSubTenant:function(){return gf},createSubTenant:function(){return df},deleteSubTenant:function(){return yf},loadAllUsers:function(){return af},removeUserFromTenantAndSubTenants:function(){return sf},removeUserRolesFromSubTenants:function(){return cf},setUserRolesForSubTenants:function(){return uf},updateSubAccountAccess:function(){return pf},updateSubTenant:function(){return ff}});var m={};n.r(m),n.d(m,{countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},deleteConfiguration:function(){return mf},getConfigs:function(){return Sf},updateConfiguration:function(){return vf}});var A={};n.r(A),n.d(A,{impersonate:function(){return bf}});var b={};n.r(b),n.d(b,{addRolesToGroup:function(){return Lf},addUsersToGroup:function(){return wf},createGroup:function(){return Of},deleteGroup:function(){return _f},deleteRolesFromGroup:function(){return Uf},deleteUsersFromGroup:function(){return Cf},getGroupById:function(){return Ef},getGroupConfiguration:function(){return Rf},getGroups:function(){return kf},getGroupsByIds:function(){return If},updateGroup:function(){return Pf},updateGroupConfiguration:function(){return Df}});var T={};n.r(T),n.d(T,{getInsights:function(){return Mf},getRecommendations:function(){return Nf}});var E={};n.r(E),n.d(E,{createPhoneNumber:function(){return Gf},deletePhoneNumber:function(){return $f},getUserPhoneNumbers:function(){return Ff},preVerifyPhoneNumber:function(){return xf},verifyDeletePhoneNumber:function(){return jf},verifyPhoneNumber:function(){return Vf}});var k={};n.r(k),n.d(k,{ADMIN_PORTAL_ENTITLEMENTS_FF:function(){return qs},AuthStrategyEnum:function(){return Ii},ContextHolder:function(){return Va},FeatureFlags:function(){return Br},FronteggApiError:function(){return Ba},FronteggContext:function(){return ja},FronteggFrameworks:function(){return di},GetUsersFilterPreset:function(){return pi},GroupManagedByEnum:function(){return ep},GroupRelations:function(){return Zf},ISubscriptionCancellationPolicy:function(){return Zy},ISubscriptionStatus:function(){return Xy},InsightCode:function(){return np},LOAD_AUTHORIZATION_FF:function(){return Ws},MFAStrategyEnum:function(){return Bs},MachineToMachineAuthStrategy:function(){return Oi},NotEntitledJustification:function(){return Hs},PaginationOrderEnum:function(){return yi},PaymentMethodType:function(){return Qy},ProviderType:function(){return ef},RecommendationActionKey:function(){return ip},RecommendationCode:function(){return tp},RecommendationSeverity:function(){return op},RequestSource:function(){return ui},RestrictionType:function(){return zn},ScimConnectionSource:function(){return Qf},SecondaryAuthStrategy:function(){return Vs},SecurityCategory:function(){return ap},SocialLoginProviders:function(){return ki},SortByEnum:function(){return fi},TenantSortByEnum:function(){return Wf},TenantType:function(){return zf},USE_ENTITLEMENTS_V2_ENDPOINT_FF:function(){return Vr},UserManagedByEnum:function(){return Bf},WebAuthnDeviceType:function(){return js},api:function(){return rp},countConfigurationUsers:function(){return Af},createConfiguration:function(){return hf},default:function(){return sp},deleteConfiguration:function(){return mf},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Kf},fronteggHeaders:function(){return ci},fronteggRefreshTokenUrl:function(){return Hf},fronteggSilentRefreshTokenUrl:function(){return qf},fronteggTenantsUrl:function(){return Yf},fronteggTenantsV3Url:function(){return Xf},fronteggUsersUrl:function(){return Jf},getConfigs:function(){return Sf},getCurrentUserTenantsFunction:function(){return ns},getTabTenantFromSessionStorage:function(){return ts},loadFeatureFlags:function(){return Wr},providersArray:function(){return gi},setTabTenantInSessionStorage:function(){return es},updateConfiguration:function(){return vf}});var I={};function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function P(e){return P="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},P(e)}function _(e){var t=function(e,t){if("object"!==P(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===P(t)?t:String(t)}function L(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,_(i.key),i)}}function U(e,t,n){return t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(I),n.d(I,{AccountDetailsPageTabs:function(){return YL},AccountPageFields:function(){return BL},DomainRestrictionsTabFields:function(){return JL},GeneralSettingsTabFields:function(){return HL},InviteUserModalFields:function(){return jL},IpRestrictionsTabFields:function(){return qL},Metadata:function(){return DL},PrivacyPageFields:function(){return VL},ProfilePageFields:function(){return xL},SecurityPageTabs:function(){return zL},SessionManagementTabFields:function(){return KL},SignupFields:function(){return $L},SubscriptionsPageFields:function(){return WL},alpha:function(){return PL},fieldAppearance:function(){return XL},tabAppearance:function(){return QL}});var w=function(){function e(){O(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 C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function R(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 i,o,a,r,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return C(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)?C(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 D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},D.apply(this,arguments)}function N(e,t,n,i,o,a,r){try{var s=e[a](r),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){N(a,i,o,r,s,"next",e)}function s(e){N(a,i,o,r,s,"throw",e)}r(void 0)}))}}w._apps={};var F=n(841),G=n.n(F);function $(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function x(e){return!!e&&!!e[Oe]}function V(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)===Pe}(e)||Array.isArray(e)||!!e[Ie]||!!e.constructor[Ie]||H(e)||q(e))}function j(e,t,n){void 0===n&&(n=!1),0===B(e)?(n?Object.keys:_e)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function B(e){var t=e[Oe];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:H(e)?2:q(e)?3:0}function W(e,t){return 2===B(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function z(e,t,n){var i=B(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function K(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function H(e){return be&&e instanceof Map}function q(e){return Te&&e instanceof Set}function J(e){return e.o||e.t}function Y(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Le(e);delete t[Oe];for(var n=_e(t),i=0;i<n.length;i++){var o=n[i],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(Object.getPrototypeOf(e),t)}function X(e,t){return void 0===t&&(t=!1),Z(e)||x(e)||!V(e)||(B(e)>1&&(e.set=e.add=e.clear=e.delete=Q),Object.freeze(e),t&&j(e,(function(e,t){return X(t,!0)}),!0)),e}function Q(){$(2)}function Z(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function ee(e){var t=Ue[e];return t||$(18,e),t}function te(){return me}function ne(e,t){t&&(ee("Patches"),e.u=[],e.s=[],e.v=t)}function ie(e){oe(e),e.p.forEach(re),e.p=null}function oe(e){e===me&&(me=e.l)}function ae(e){return me={p:[],l:me,h:e,m:!0,_:0}}function re(e){var t=e[Oe];0===t.i||1===t.i?t.j():t.O=!0}function se(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||ee("ES5").S(t,e,i),i?(n[Oe].P&&(ie(t),$(4)),V(e)&&(e=le(t,e),t.l||ue(t,e)),t.u&&ee("Patches").M(n[Oe].t,e,t.u,t.s)):e=le(t,n,[]),ie(t),t.u&&t.v(t.u,t.s),e!==ke?e:void 0}function le(e,t,n){if(Z(t))return t;var i=t[Oe];if(!i)return j(t,(function(o,a){return ce(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ue(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=Y(i.k):i.o;j(3===i.i?new Set(o):o,(function(t,a){return ce(e,i,o,t,a,n)})),ue(e,o,!1),n&&e.u&&ee("Patches").R(i,n,e.u,e.s)}return i.o}function ce(e,t,n,i,o,a){if(x(o)){var r=le(e,o,a&&t&&3!==t.i&&!W(t.D,i)?a.concat(i):void 0);if(z(n,i,r),!x(r))return;e.m=!1}if(V(o)&&!Z(o)){if(!e.h.F&&e._<1)return;le(e,o),t&&t.A.l||ue(e,o)}}function ue(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&X(t,n)}function de(e,t){var n=e[Oe];return(n?J(n):e)[t]}function ye(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var i=Object.getOwnPropertyDescriptor(n,t);if(i)return i;n=Object.getPrototypeOf(n)}}function fe(e){e.P||(e.P=!0,e.l&&fe(e.l))}function pe(e){e.o||(e.o=Y(e.t))}function ge(e,t,n){var i=H(t)?ee("MapSet").N(t,n):q(t)?ee("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:te(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=we;n&&(o=[i],a=Ce);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):ee("ES5").J(t,n);return(n?n.A:te()).p.push(i),i}function Se(e){return x(e)||$(22,e),function e(t){if(!V(t))return t;var n,i=t[Oe],o=B(t);if(i){if(!i.P&&(i.i<4||!ee("ES5").K(i)))return i.t;i.I=!0,n=ve(t,o),i.I=!1}else n=ve(t,o);return j(n,(function(t,o){i&&function(e,t){return 2===B(e)?e.get(t):e[t]}(i.t,t)===o||z(n,t,e(o))})),3===o?new Set(n):n}(e)}function ve(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Y(e)}var he,me,Ae="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),be="undefined"!=typeof Map,Te="undefined"!=typeof Set,Ee="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,ke=Ae?Symbol.for("immer-nothing"):((he={})["immer-nothing"]=!0,he),Ie=Ae?Symbol.for("immer-draftable"):"__$immer_draftable",Oe=Ae?Symbol.for("immer-state"):"__$immer_state",Pe=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),_e="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Le=Object.getOwnPropertyDescriptors||function(e){var t={};return _e(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Ue={},we={get:function(e,t){if(t===Oe)return e;var n=J(e);if(!W(n,t))return function(e,t,n){var i,o=ye(t,n);return o?"value"in o?o.value:null===(i=o.get)||void 0===i?void 0:i.call(e.k):void 0}(e,n,t);var i=n[t];return e.I||!V(i)?i:i===de(e.t,t)?(pe(e),e.o[t]=ge(e.A.h,i,e)):i},has:function(e,t){return t in J(e)},ownKeys:function(e){return Reflect.ownKeys(J(e))},set:function(e,t,n){var i=ye(J(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=de(J(e),t),a=null==o?void 0:o[Oe];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(K(n,o)&&(void 0!==n||W(e.t,t)))return!0;pe(e),fe(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!==de(e.t,t)||t in e.t?(e.D[t]=!1,pe(e),fe(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=J(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){$(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){$(12)}},Ce={};j(we,(function(e,t){Ce[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ce.deleteProperty=function(e,t){return Ce.set.call(this,e,t,void 0)},Ce.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};var Re=function(){function e(e){var t=this;this.g=Ee,this.F=!0,this.produce=function(e,n,i){if("function"==typeof e&&"function"!=typeof n){var o=n;n=e;var a=t;return function(e){var t=this;void 0===e&&(e=o);for(var i=arguments.length,r=Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return a.produce(e,(function(e){var i;return(i=n).call.apply(i,[t,e].concat(r))}))}}var r;if("function"!=typeof n&&$(6),void 0!==i&&"function"!=typeof i&&$(7),V(e)){var s=ae(t),l=ge(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 ne(s,i),se(e,s)}),(function(e){throw ie(s),e})):(ne(s,i),se(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===ke&&(r=void 0),t.F&&X(r,!0),i){var u=[],d=[];ee("Patches").M(e,r,u,d),i(u,d)}return r}$(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){V(e)||$(8),x(e)&&(e=Se(e));var t=ae(this),n=ge(this,e,void 0);return n[Oe].C=!0,oe(t),n},t.finishDraft=function(e,t){var n=(e&&e[Oe]).A;return ne(n,t),se(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!Ee&&$(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=ee("Patches").$;return x(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),De=new Re,Ne=De.produce,Me=(De.produceWithPatches.bind(De),De.setAutoFreeze.bind(De),De.setUseProxies.bind(De),De.applyPatches.bind(De),De.createDraft.bind(De),De.finishDraft.bind(De),Ne);function Fe(e,t,n){return(t=_(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){Fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(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 Ve="function"==typeof Symbol&&Symbol.observable||"@@observable",je=function(){return Math.random().toString(36).substring(7).split("").join(".")},Be={INIT:"@@redux/INIT"+je(),REPLACE:"@@redux/REPLACE"+je(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+je()}};function We(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 ze(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(xe(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(xe(1));return n(ze)(e,t)}if("function"!=typeof e)throw new Error(xe(2));var o=e,a=t,r=[],s=r,l=!1;function c(){s===r&&(s=r.slice())}function u(){if(l)throw new Error(xe(3));return a}function d(e){if("function"!=typeof e)throw new Error(xe(4));if(l)throw new Error(xe(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(xe(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!We(e))throw new Error(xe(7));if(void 0===e.type)throw new Error(xe(8));if(l)throw new Error(xe(9));try{l=!0,a=o(a,e)}finally{l=!1}for(var t=r=s,n=0;n<t.length;n++)(0,t[n])();return e}function f(e){if("function"!=typeof e)throw new Error(xe(10));o=e,y({type:Be.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(xe(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Ve]=function(){return this},e}return y({type:Be.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Ve]=p,i}function Ke(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Be.INIT}))throw new Error(xe(12));if(void 0===n(void 0,{type:Be.PROBE_UNKNOWN_ACTION()}))throw new Error(xe(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},s=0;s<r.length;s++){var l=r[s],c=n[l],u=e[l],d=c(u,t);if(void 0===d)throw t&&t.type,new Error(xe(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function He(){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 qe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(xe(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=He.apply(void 0,a)(n.dispatch),$e($e({},n),{},{dispatch:i})}}}function Je(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ye=Je();Ye.withExtraArgument=Je;var Xe,Qe=Ye,Ze=(Xe=function(e,t){return Xe=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])},Xe(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}Xe(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),et=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},tt=Object.defineProperty,nt=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),it=Object.prototype.hasOwnProperty,ot=Object.prototype.propertyIsEnumerable,at=function(e,t,n){return t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},rt=function(e,t){for(var n in t||(t={}))it.call(t,n)&&at(e,n,t[n]);if(nt)for(var i=0,o=nt(t);i<o.length;i++)n=o[i],ot.call(t,n)&&at(e,n,t[n]);return e},st="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?He:He.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var lt=function(e){function t(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=e.apply(this,n)||this;return Object.setPrototypeOf(o,t.prototype),o}return Ze(t,e),Object.defineProperty(t,Symbol.species,{get:function(){return t},enumerable:!1,configurable:!0}),t.prototype.concat=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.prototype.concat.apply(this,t)},t.prototype.prepend=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return 1===e.length&&Array.isArray(e[0])?new(t.bind.apply(t,et([void 0],e[0].concat(this)))):new(t.bind.apply(t,et([void 0],e.concat(this))))},t}(Array);function ct(e){return V(e)?Me(e,(function(){})):e}function ut(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new lt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(Qe):i.push(Qe.withExtraArgument(n.extraArgument))),i}function dt(e){var t,n=function(e){return ut(e)},i=e||{},o=i.reducer,a=void 0===o?void 0:o,r=i.middleware,s=void 0===r?n():r,l=i.devTools,c=void 0===l||l,u=i.preloadedState,d=void 0===u?void 0:u,y=i.enhancers,f=void 0===y?void 0:y;if("function"==typeof a)t=a;else{if(!function(e){if("object"!=typeof e||null===e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n}(a))throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');t=Ke(a)}var p=s;"function"==typeof p&&(p=p(n));var g=qe.apply(void 0,p),S=He;c&&(S=st(rt({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=et([g],f):"function"==typeof f&&(v=f(v)),ze(t,d,S.apply(void 0,v))}function yt(e,t){function n(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(t){var o=t.apply(void 0,n);if(!o)throw new Error("prepareAction did not return an object");return rt(rt({type:e,payload:o.payload},"meta"in o&&{meta:o.meta}),"error"in o&&{error:o.error})}return{type:e,payload:n[0]}}return n.toString=function(){return""+e},n.type=e,n.match=function(t){return t.type===e},n}function ft(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function pt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:ct(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?ft(e.extraReducers):[e.extraReducers],n=t[0],o=void 0===n?{}:n,a=t[1],r=void 0===a?[]:a,l=t[2],c=void 0===l?void 0:l,u=rt(rt({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?ft(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return ct(e())};else{var c=ct(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=et([r[t.type]],s.filter((function(e){return(0,e.matcher)(t)})).map((function(e){return e.reducer})));return 0===n.filter((function(e){return!!e})).length&&(n=[l]),n.reduce((function(e,n){if(n){var i;if(x(e))return void 0===(i=n(e,t))?e:i;if(V(e))return Me(e,(function(e){return n(e,t)}));if(void 0===(i=n(e,t))){if(null===e)return e;throw Error("A case reducer on a non-draftable value must not return undefined")}return i}return e}),e)}return u.getInitialState=o,u}(i,u,r,c)}return a.forEach((function(e){var n,i,a=o[e],c=t+"/"+e;"reducer"in a?(n=a.reducer,i=a.prepare):n=a,r[e]=n,s[c]=n,l[e]=i?yt(c,i):yt(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 gt="listenerMiddleware";yt(gt+"/add"),yt(gt+"/removeAll"),yt(gt+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[Oe];return we.get(t,e)},set:function(t){var n=this[Oe];we.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][Oe];if(!o.P)switch(o.i){case 5:i(o)&&fe(o);break;case 4:n(o)&&fe(o)}}}function n(e){for(var t=e.t,n=e.k,i=_e(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==Oe){var r=t[a];if(void 0===r&&!W(t,a))return!0;var s=n[a],l=s&&s[Oe];if(l?l.t!==r:!K(s,r))return!0}}var c=!!t[Oe];return i.length!==_e(t).length+(c?0:1)}function i(e){var t=e.k;if(t.length!==e.t.length)return!0;var n=Object.getOwnPropertyDescriptor(t,t.length-1);if(n&&!n.get)return!0;for(var i=0;i<t.length;i++)if(!t.hasOwnProperty(i))return!0;return!1}var o={};!function(e,t){Ue[e]||(Ue[e]=t)}("ES5",{J:function(t,n){var i=Array.isArray(t),o=function(t,n){if(t){for(var i=Array(n.length),o=0;o<n.length;o++)Object.defineProperty(i,""+o,e(o,!0));return i}var a=Le(n);delete a[Oe];for(var r=_e(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:te(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,Oe,{value:a,writable:!0}),o},S:function(e,n,o){o?x(n)&&n[Oe].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[Oe];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)j(a,(function(t){t!==Oe&&(void 0!==o[t]||W(o,t)?r[t]||e(a[t]):(r[t]=!0,fe(n)))})),j(o,(function(e){void 0!==a[e]||W(a,e)||(r[e]=!1,fe(n))}));else if(5===s){if(i(n)&&(fe(n),r.length=!0),a.length<o.length)for(var l=a.length;l<o.length;l++)r[l]=!1;else for(var c=o.length;c<a.length;c++)r[c]=!0;for(var u=Math.min(a.length,o.length),d=0;d<u;d++)a.hasOwnProperty(d)||(r[d]=!0),void 0===r[d]&&e(a[d])}}}}(e.p[0]),t(e.p))},K:function(e){return 4===e.i?n(e):i(e)}})}();const St=(e,t)=>n=>D({},n,{[e]:t[e]}),vt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),ht=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return D({},n,{[e]:D({},n[e],{[t]:D({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),mt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i,o;return D({},t,{[e]:D({},t[e],{loaders:D({},null==(i=t[e])?void 0:i.loaders,{[n.key]:null==(o=n.value)||o})})})}}),At=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return D({},t,{[e]:D({},t[e],{errors:D({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),bt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return D({},i,{[e]:D({},i[e],{[t]:D({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),Tt=(e,t,n)=>i=>{var o;return D({},i,{[e]:D({},i[e],{[t]:D({},null==i||null==(o=i[e])?void 0:o[t],n)})})},Et=(e=500)=>new Promise((t=>setTimeout(t,e))),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",It=new Uint8Array(256);for(let e=0;e<kt.length;e++)It[kt.charCodeAt(e)]=e;const Ot=e=>{const t=.75*e.length,n=e.length;let i,o,a,r,s,l=0;const c=new Uint8Array(t);for(i=0;i<n;i+=4)o=It[e.charCodeAt(i)],a=It[e.charCodeAt(i+1)],r=It[e.charCodeAt(i+2)],s=It[e.charCodeAt(i+3)],c[l++]=o<<2|a>>4,c[l++]=(15&a)<<4|r>>2,c[l++]=(3&r)<<6|63&s;return c.buffer},Pt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(Pt(n));return t}if(e instanceof ArrayBuffer)return(e=>{const t=new Uint8Array(e),n=t.length;let i,o="";for(i=0;i<n;i+=3)o+=kt[t[i]>>2],o+=kt[(3&t[i])<<4|t[i+1]>>4],o+=kt[(15&t[i+1])<<2|t[i+2]>>6],o+=kt[63&t[i+2]];return n%3==2?o=o.substring(0,o.length-1):n%3==1&&(o=o.substring(0,o.length-2)),o})(e);if(e instanceof Object){const t={};for(const n in e)t[n]=Pt(e[n]);return t}return e};let _t,Lt,Ut,wt;!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"}(_t||(_t={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Lt||(Lt={})),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"}(wt||(wt={}));const Ct="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Rt="HOSTED_LOGIN_VERIFIER_KEY",Dt="auth",Nt="connectivity",Mt="auditLogs",Ft="vendor",Gt={flow:Lt.Login,step:_t.preLogin,loading:!1,email:"",tenants:[]},$t={setLoginState:vt("loginState"),resetLoginState:St("loginState",{loginState:Gt})},xt={requestAuthorize:yt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:yt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:yt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),requestHostedLoginAuthorizeV2:yt("auth/requestHostedLoginAuthorizeV2",(e=>({payload:e}))),handleHostedLoginCallback:yt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:yt("auth/afterAuthNavigation"),preLogin:yt("auth/preLogin",(e=>({payload:e}))),postLogin:yt("auth/postLogin",(e=>({payload:e}))),login:yt("auth/login",(e=>({payload:e}))),loginWithMfa:yt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:yt("auth/recoverMfa",(e=>({payload:e}))),logout:yt("auth/logout",(e=>({payload:e}))),silentLogout:yt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:yt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:yt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:yt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:yt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:yt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:yt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:yt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:yt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:yt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:yt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:yt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:yt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:yt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:yt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:yt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:yt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:yt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:yt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:yt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:yt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:yt("auth/verifyMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAEmailCode:yt("auth/preVerifyMFAEmailCode",(e=>({payload:e}))),verifyMFAEmailCode:yt("auth/verifyMFAEmailCode",(e=>({payload:e}))),resetBreachedPassword:yt("auth/resetBreachedPassword",(e=>({payload:e})))};let Vt;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Vt||(Vt={}));const jt={step:Vt.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Bt={setActivateState:vt("activateState"),resetActivateState:St("activateState",{activateState:jt}),setActivateStrategyState:ht("activateState","activationStrategy")},Wt={activateAccount:yt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:yt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:yt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:yt("auth/resendActivationEmail",(e=>({payload:e})))};let zt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(zt||(zt={}));const Kt={step:zt.validate},Ht={setAcceptInvitationState:vt("acceptInvitationState"),resetAcceptInvitationState:St("acceptInvitationState",{acceptInvitationState:Kt})},qt={acceptInvitation:yt("auth/acceptInvitation",(e=>({payload:e})))};let Jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(Jt||(Jt={}));const Yt={step:Jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Xt={setForgotPasswordState:vt("forgotPasswordState"),resetForgotPasswordState:St("forgotPasswordState",{forgotPasswordState:Yt})},Qt={forgotPassword:yt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:yt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:yt("auth/loadPasswordConfig",(e=>({payload:e})))};let Zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(Zt||(Zt={}));const en={step:Zt.ResetPhoneNumber,loading:!1},tn={setResetPhoneNumberState:vt("resetPhoneNumberState"),resetResetPhoneNumberState:St("resetPhoneNumberState",{resetPhoneNumberState:en})},nn={resetPhoneNumber:yt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:yt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:yt("auth/changePhoneNumber",(e=>({payload:e})))},on={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},an={setSSOLoader:mt("ssoState"),setSSOError:At("ssoState"),setSSOState:vt("ssoState"),resetSSOState:St("ssoState",{ssoState:on})},rn={loadSSOConfigurationsV2:yt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:yt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:yt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:yt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:yt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:yt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:yt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:yt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:yt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:yt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:yt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:yt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:yt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:yt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:yt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:yt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:yt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:yt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:yt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:yt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:yt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:yt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:yt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:yt("auth/oidcPostlogin",(e=>({payload:e})))},sn={loading:!1,error:null},ln={setProfileState:vt("profileState"),resetProfileState:St("profileState",{profileState:sn})},cn={loadProfile:yt("auth/loadProfile"),saveProfile:yt("auth/saveProfile",(e=>({payload:e}))),changePassword:yt("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 dn={step:un.verify,loading:!1,saving:!1},yn={setMfaState:vt("mfaState"),resetMfaState:St("mfaState",{mfaState:dn})},fn={enrollMfa:yt("auth/enrollMfa"),getMFADevices:yt("auth/getMFADevices"),getMFAStrategies:yt("auth/getMFAStrategies"),verifyMfa:yt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:yt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:yt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:yt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:yt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:yt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:yt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:yt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:yt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:yt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:yt("auth/disableMfaWebAuthn",(e=>({payload:e})))},pn={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}},gn={setTeamLoader:mt("teamState"),setTeamError:At("teamState"),setTeamState:vt("teamState"),resetTeamState:St("teamState",{teamState:pn})},Sn={loadUsersV2:yt("auth/loadUsersV2",(e=>({payload:e}))),loadUsers:yt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:yt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:yt("auth/loadRoles",(e=>({payload:e}))),addUser:yt("auth/addUser",(e=>({payload:e}))),addUsersBulk:yt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:yt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:yt("auth/updateUser",(e=>({payload:e}))),deleteUser:yt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:yt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:yt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:yt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:yt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:yt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:yt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:yt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getTemporaryUsersConfig:yt("auth/getTemporaryUsersConfig"),updateUserExpirationTime:yt("auth/updateUserExpirationTime",(e=>({payload:e}))),setUserAsPermanent:yt("auth/setUserAsPermanent",(e=>({payload:e}))),getInvitationLink:yt("auth/getInvitationLink"),createInvitationLink:yt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:yt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:yt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:yt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:yt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:yt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:yt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:yt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:yt("auth/closeLockUserDialog",(e=>({payload:e})))},vn={firstLoad:!0,loading:!1,error:""},hn={setSocialLoginsState:vt("socialLoginState"),resetSocialLoginsState:St("socialLoginState",{socialLoginState:vn})},mn={loadSocialLoginsConfiguration:yt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:yt("auth/loadSocialLoginsConfigurationV2",(e=>({payload:e}))),loginViaSocialLogin:yt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:yt("auth/setSocialLoginError",(e=>({payload:e})))};let An;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(An||(An={}));const bn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:An.SignUp},Tn={setSignUpState:vt("signUpState"),resetSignUpState:St("signUpState",{signUpState:bn})},En={signUpUser:yt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:yt("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:{}},In={setApiTokensLoader:mt("apiTokensState"),setApiTokensError:At("apiTokensState"),setApiTokensState:vt("apiTokensState"),resetApiTokensState:St("apiTokensState",{apiTokensState:kn})},On={loadApiTokens:yt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:yt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:yt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:yt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:yt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:yt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:yt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:yt("auth/deleteTenantApiToken",(e=>({payload:e})))},Pn={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}},_n={setSecurityPolicyState:vt("securityPolicyState"),setSecurityPolicyGlobalState:ht("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ht("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ht("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ht("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ht("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ht("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ht("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ht("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ht("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ht("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ht("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:St("securityPolicyState",{securityPolicyState:Pn})},Ln={loadSecurityPolicy:yt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:yt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:yt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:yt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:yt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:yt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:yt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:yt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:yt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:yt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:yt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:yt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:yt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:yt("auth/loadPublicAuthStrategiesPolicy")},Un={loading:!1},wn={setAccountSettingsState:vt("accountSettingsState"),resetAccountSettingsState:St("accountSettingsState",{accountSettingsState:Un})},Cn={loadAccountSettings:yt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:yt("auth/saveAccountSettings",(e=>({payload:e})))},Rn={tenants:[],subTenants:[],loading:!0,tenantTree:null},Dn={setTenantsState:vt("tenantsState"),resetTenantsState:St("tenantsState",{tenantsState:Rn})},Nn={switchTenant:yt("auth/switchTenant",(e=>({payload:e}))),loadTenants:yt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:yt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:yt("auth/loadSubTenantsTree",(e=>({payload:e})))},Mn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Fn={setRolesState:vt("rolesState"),resetRolesState:St("rolesState",{rolesState:Mn})},Gn={loadRolesAndPermissions:yt("auth/loadRoles",(e=>({payload:e}))),addRole:yt("auth/addRole",(e=>({payload:e}))),updateRole:yt("auth/updateRole",(e=>({payload:e}))),deleteRole:yt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:yt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:yt("auth/attachPermissionToRoles",(e=>({payload:e})))},$n={loading:!1,sessions:[]},xn={setSessionsState:vt("sessionsState"),resetSessionsState:St("sessionsState",{sessionsState:$n})},Vn={loadUserSessions:yt("auth/loadUserSessions"),loadCurrentUserSession:yt("auth/loadCurrentUserSession"),deleteUserSession:yt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:yt("auth/deleteAllUserSessions"),revokeUserSessions:yt("auth/revokeUserSessions",(e=>({payload:e})))},jn={loading:!1,configurations:{}},Bn={setSessionsPolicyState:vt("sessionsPolicyState"),resetSessionsPolicyState:St("sessionsPolicyState",{sessionsPolicyState:jn})},Wn={loadSessionsPolicy:yt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:yt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let zn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(zn||(zn={}));const Kn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:zn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},Hn={setRestrictionsState:vt("restrictionsState"),setIpRestrictionsState:ht("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ht("restrictionsState","emailDomainRestrictions")},qn={checkIfUserIpValid:yt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:yt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:yt("auth/loadIpRestrictions"),saveIpRestriction:yt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:yt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:yt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:yt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:yt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:yt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:yt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},Jn={loading:!1},Yn={setProvisioningState:vt("provisioningState"),resetProvisioningState:St("provisioningState",{provisioningState:Jn})},Xn={loadProvisionConnections:yt("auth/loadProvisionConnections"),createProvisionConnection:yt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:yt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:yt("auth/updateProvisionConnection",(e=>({payload:e})))},Qn={devices:[],loading:!1,error:null},Zn={setPasskeysState:vt("passkeysState"),resetPasskeysState:St("passkeysState",{passkeysState:Qn})},ei={loadWebAuthnDevices:yt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:yt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},ti={loaders:{},errors:{},groups:[],groupsConfiguration:{}},ni={setUsersGroupsLoader:mt("groupsState"),setUsersGroupsError:At("groupsState"),setGroupsState:vt("groupsState"),resetUsersGroupsState:St("groupsState",{groupsState:ti})},ii={loadGroups:yt("auth/loadUsersGroups"),getGroupById:yt("auth/getGroupById",(e=>({payload:e}))),createGroup:yt("auth/createGroup",(e=>({payload:e}))),updateGroup:yt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:yt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:yt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:yt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:yt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:yt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:yt("auth/getGroupConfiguration"),updateGroupConfiguration:yt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:yt("auth/getUsers",(e=>({payload:e})))},oi={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}},ai={setGroupsDialogsState:vt("groupsDialogsState"),resetGroupsDialogsState:St("groupsState",{groupsDialogsState:oi}),openAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:Tt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:bt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:Tt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:bt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:Tt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:Tt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:bt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:Tt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},ri={loading:!0,error:null},si={setCustomLoginState:vt("customLoginState"),resetCustomLoginState:St("customLoginState",{customLoginState:ri})},li={loadTenantMetadata:yt("auth/loadTenantMetadata"),updateTenantMetadata:yt("auth/updateTenantMetadata",(e=>({payload:e})))},ci={frameWork:"x-frontegg-framework",fronteggSdkVersion:"x-frontegg-sdk",contentType:"Content-Type",source:"frontegg-source",scopedTenant:"frontegg-scoped-tenant"};let ui,di,yi,fi,pi;!function(e){e.AdminPortal="admin-portal",e.LoginBox="login-box"}(ui||(ui={})),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"}(di||(di={})),function(e){e.ASC="ASC",e.DESC="DESC"}(yi||(yi={})),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"}(fi||(fi={})),function(e){e.MFA_UNENROLLED="mfa-unenrolled",e.BREACHED_PASSWORDS="breached-passwords",e.INACTIVE="inactive"}(pi||(pi={}));const gi=["local","saml","google","github","facebook","microsoft","scim2","slack"],Si={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:yi.DESC,_sortBy:fi.name},usersPageOffset:0,accountSettings:{}}},vi={setAllAccountsLoader:mt("allAccountsState"),setAllAccountsError:At("allAccountsState"),setAllAccountsState:vt("allAccountsState"),setSelectedAccountState:ht("allAccountsState","selectedAccount"),resetAllAccountsState:St("allAccountsState",{allAccountsState:Si})},hi={loadAccounts:yt("auth/loadAccounts",(e=>({payload:e}))),searchAccounts:yt("auth/searchAccounts",(e=>({payload:e}))),updateSubAccountAccessForUser:yt("auth/updateSubAccountAccessForUser",(e=>({payload:e}))),createSubAccount:yt("auth/createSubAccount",(e=>({payload:e}))),updateSubAccount:yt("auth/updateAccount",(e=>({payload:e}))),deleteSubAccount:yt("auth/deleteAccount",(e=>({payload:e}))),updateSubAccountSettings:yt("auth/updateSubAccountSettings",(e=>({payload:e}))),addUsersToAccount:yt("auth/addUsersToAccount",(e=>({payload:e}))),getAccountUsers:yt("auth/getAccountUsers",(e=>({payload:e}))),deleteUsersFromAccount:yt("auth/deleteUsersFromAccount",(e=>({payload:e}))),setUserRolesForSubAccount:yt("auth/setUserRolesForSubAccount",(e=>({payload:e}))),getUserJwtForSubAccount:yt("auth/getUserJwtForSubAccount",(e=>({payload:e}))),setRootAccountData:yt("auth/setRootAccountData"),setSelectedSubAccountData:yt("auth/setSelectedSubAccountData",(e=>({payload:e}))),loadNumberOfUsersForSelectedSubAccount:yt("auth/loadNumberOfUsersForSelectedSubAccount",(e=>({payload:e})))},mi={createSubAccountDialog:{loading:!1,open:!1,error:!1,jwt:"",canSelectParentAccount:!1},updateSubAccountDialog:{accountId:"",accountName:"",loading:!1,open:!1,error:!1,jwt:""},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:[]}},Ai={setAllAccountDialogsState:vt("allAccountsDialogsState"),resetAllAccountDialogsState:St("allAccountsDialogsState",{allAccountsDialogsState:mi}),openCreateSubAccountDialog:bt("allAccountsDialogsState","createSubAccountDialog",{open:!0}),closeCreateSubAccountDialog:Tt("allAccountsDialogsState","createSubAccountDialog",mi.createSubAccountDialog),openUpdateSubAccountDialog:bt("allAccountsDialogsState","updateSubAccountDialog",{open:!0}),closeUpdateSubAccountDialog:Tt("allAccountsDialogsState","updateSubAccountDialog",mi.updateSubAccountDialog),openDeleteSubAccountDialog:bt("allAccountsDialogsState","deleteSubAccountDialog",{open:!0}),closeDeleteSubAccountDialog:Tt("allAccountsDialogsState","deleteSubAccountDialog",mi.deleteSubAccountDialog),openAddUsersToAccountDialog:bt("allAccountsDialogsState","addUsersToAccountDialog",{open:!0}),closeAddUsersToAccountDialog:Tt("allAccountsDialogsState","addUsersToAccountDialog",mi.addUsersToAccountDialog),openDeleteUserFromAccountDialog:bt("allAccountsDialogsState","deleteUserFromAccountDialog",{open:!0}),closeDeleteUserFromAccountDialog:Tt("allAccountsDialogsState","deleteUserFromAccountDialog",mi.deleteUserFromAccountDialog),openEditUserRolesDialog:bt("allAccountsDialogsState","editUserRolesDialog",{open:!0}),closeEditUserRolesDialog:Tt("allAccountsDialogsState","editUserRolesDialog",mi.editUserRolesDialog)},bi={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}}},Ti={setSecurityCenterState:vt("securityCenterState"),resetSecurityCenterState:St("securityCenterState",{securityCenterState:bi}),setSecurityCenterStateLoader:mt("securityCenterState"),setSecurityCenterStateError:At("securityCenterState")},Ei={loadRecommendations:yt("auth/loadRecommendations"),loadInsights:yt("auth/loadInsights"),sendResetBreachedPasswordEmail:yt("auth/sendResetBreachedPasswordEmail",(e=>({payload:e}))),sendBulkResetBreachedPasswordEmails:yt("auth/sendBulkResetBreachedPasswordEmails",(e=>({payload:e}))),loadBreachedPasswordUsers:yt("auth/loadBreachedPasswordUsers",(e=>({payload:e}))),loadUnenrolledMfaUsers:yt("auth/loadUnenrolledMfaUsers",(e=>({payload:e}))),loadInactiveUsers:yt("auth/loadInactiveUsers",(e=>({payload:e})))};let ki,Ii,Oi;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(ki||(ki={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Ii||(Ii={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Oi||(Oi={}));const Pi={[Ii.Code]:_t.loginWithOtc,[Ii.EmailAndPassword]:_t.loginWithPassword,[Ii.MagicLink]:_t.magicLinkPreLoginSuccess,[Ii.SmsCode]:_t.loginWithSmsOtc},_i={loading:!1,error:null,phoneNumbers:void 0},Li={setSmsState:vt("smsState"),resetSmsState:St("smsState",{smsState:_i})},Ui={loadPhoneNumbers:yt("auth/loadPhoneNumbers"),setUpPhoneNumber:yt("auth/setUpPhoneNumber",(e=>({payload:e}))),verifyPhoneNumber:yt("auth/verifyPhoneNumber",(e=>({payload:e}))),deletePhoneNumber:yt("auth/deletePhoneNumber",(e=>({payload:e}))),verifyDeletePhoneNumber:yt("auth/verifyDeletePhoneNumber",(e=>({payload:e}))),preVerifyPhoneNumber:yt("auth/preVerifyPhoneNumber",(e=>({payload:e})))},wi={loading:!1,mfaDevices:void 0,mfaToken:""},Ci={setStepUpState:vt("stepUpState"),resetStepUpState:St("stepUpState",{stepUpState:wi})},Ri={generateStepUpSession:yt("auth/generateStepUpSession",(e=>({payload:e}))),stepUpWithAuthenticator:yt("auth/stepUpWithAuthenticator",(e=>({payload:e}))),preVerifyMFASMSForStepUp:yt("auth/preVerifyMFASMSForStepUp",(e=>({payload:e}))),verifyMFASMSForStepUp:yt("auth/verifyMFASMSForStepUp",(e=>({payload:e}))),preVerifyMFAWebAuthnForStepUp:yt("auth/preVerifyMFAWebAuthnForStepUp",(e=>({payload:e}))),verifyMFAWebAuthnForStepUp:yt("auth/verifyMFAWebAuthnForStepUp",(e=>({payload:e}))),preVerifyMFAEmailCodeForStepUp:yt("auth/preVerifyMFAEmailCodeForStepUp",(e=>({payload:e}))),verifyMFAEmailCodeForStepUp:yt("auth/verifyMFAEmailCodeForStepUp",(e=>({payload:e})))},Di={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:bn,loginState:Gt,stepUpState:wi,activateState:jt,acceptInvitationState:Kt,forgotPasswordState:Yt,ssoState:on,profileState:sn,customLoginState:ri,mfaState:dn,teamState:pn,groupsState:ti,groupsDialogsState:oi,socialLoginState:vn,apiTokensState:kn,securityPolicyState:Pn,accountSettingsState:Un,tenantsState:Rn,rolesState:Mn,resetPhoneNumberState:en,sessionsState:$n,sessionsPolicyState:jn,restrictionsState:Kn,provisioningState:Jn,passkeysState:Qn,allAccountsState:Si,allAccountsDialogsState:mi,securityCenterState:bi,smsState:_i},Ni=D({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"},onRedirectTo:()=>{}},Di);let Mi;!function(e){e.impersonating="impersonating",e.success="success"}(Mi||(Mi={}));const Fi={step:Mi.impersonating,loading:!1},Gi={setImpersonateState:vt("impersonateState"),resetImpersonateState:St("impersonateState",{impersonateState:Fi})},$i={impersonate:yt("impersonation/impersonate",(e=>({payload:e})))},{reducer:xi,actions:Vi}=pt({name:Dt,initialState:Ni,reducers:D({resetState:e=>D({},e,Di),setState:(e,{payload:t})=>D({},e,t),setUser:("user",(e,{payload:t})=>D({},e,{user:t})),setEntitlements:ht("user","entitlements")},$t,Ci,hn,Bt,Gi,Ht,Xt,tn,Tn,ln,si,an,yn,gn,ni,ai,In,_n,wn,Dn,Fn,xn,Bn,Hn,Yn,Zn,vi,Ai,Ti,Li)});const ji=D({loadEntitlements:yt("auth/loadEntitlements",(e=>({payload:e})))},Vi,xt,Ri,mn,Wt,qt,Qt,nn,En,cn,li,rn,fn,Sn,ii,{},On,Ln,Cn,Nn,Gn,Vn,Wn,qn,Xn,$i,ei,hi,Ei,Ui);var Bi=function(e){return"@@redux-saga/"+e},Wi=Bi("CANCEL_PROMISE"),zi=Bi("CHANNEL_END"),Ki=Bi("IO"),Hi=Bi("MATCH"),qi=Bi("MULTICAST"),Ji=Bi("SAGA_ACTION"),Yi=Bi("SELF_CANCELLATION"),Xi=Bi("TASK"),Qi=Bi("TASK_CANCEL"),Zi=Bi("TERMINATE"),eo=Bi("LOCATION");function to(e,t){if(null==e)return{};var n,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)n=a[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}var no=function(e){return null==e},io=function(e){return null!=e},oo=function(e){return"function"==typeof e},ao=function(e){return"string"==typeof e},ro=Array.isArray,so=function(e){return e&&oo(e.then)},lo=function(e){return e&&oo(e.next)&&oo(e.throw)},co=function e(t){return t&&(ao(t)||fo(t)||oo(t)||ro(t)&&t.every(e))},uo=function(e){return e&&oo(e.take)&&oo(e.close)},yo=function(e){return oo(e)&&e.hasOwnProperty("toString")},fo=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},po=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[Wi]=function(){clearTimeout(n)},i},go=function(e){return function(){return e}},So=go(!0),vo=function(){},ho=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var mo=function(e,t){D(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ao(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var bo=function(e){throw e},To=function(e){return{value:e,done:!0}};function Eo(e,t,n){void 0===t&&(t=bo),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:To,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function ko(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Io=function(e){return Array.apply(null,new Array(e))},Oo=function(e){return function(t){return e(Object.defineProperty(t,Ji,{value:!0}))}},Po=function(e){return e===Zi},_o=function(e){return e===Qi},Lo=function(e){return Po(e)||_o(e)};function Uo(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=ro(e)?Io(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Lo(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=vo,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function wo(e){return{name:e.name||"anonymous",location:Co(e)}}function Co(e){return e[eo]}var Ro=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},s=function(){if(0!=i){var t=n[a];return n[a]=null,i--,a=(a+1)%e,t}},l=function(){for(var e=[];i;)e.push(s());return e};return{isEmpty:function(){return 0==i},put:function(s){var c;if(i<e)r(s);else switch(t){case 1:throw new Error("Channel's Buffer overflow!");case 3:n[o]=s,a=o=(o+1)%e;break;case 4:c=2*e,n=l(),i=n.length,o=n.length,a=0,n.length=c,e=c,r(s)}},take:s,flush:l}}(e,4)},Do="TAKE",No="CALL",Mo="FORK",Fo="SELECT",Go=function(e,t){var n;return(n={})[Ki]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function $o(e,t){return void 0===e&&(e="*"),co(e)?(io(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),Go(Do,{pattern:e})):uo(n=e)&&n[qi]&&io(t)&&co(t)?Go(Do,{channel:e,pattern:t}):uo(e)?(io(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),Go(Do,{channel:e})):void 0;var n}function xo(e,t){return no(t)&&(t=e,e=void 0),Go("PUT",{channel:e,action:t})}function Vo(e){var t=Go("ALL",e);return t.combinator=!0,t}function jo(e,t){var n,i=null;return oo(e)?n=e:(ro(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ao(n)&&oo(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function Bo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(No,jo(e,n))}function Wo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Mo,jo(e,n))}function zo(e){return void 0===e&&(e=Yi),Go("CANCEL",e)}function Ko(e){void 0===e&&(e=ho);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Go(Fo,{selector:e,args:n})}var Ho=Bo.bind(null,po);var qo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},Jo=[],Yo=0;function Xo(e){try{ea(),e()}finally{ta()}}function Qo(e){Jo.push(e),Yo||(ea(),na())}function Zo(e){try{return ea(),e()}finally{na()}}function ea(){Yo++}function ta(){Yo--}function na(){var e;for(ta();!Yo&&void 0!==(e=Jo.shift());)Xo(e)}var ia=function(e){return function(t){return e.some((function(e){return la(e)(t)}))}},oa=function(e){return function(t){return e(t)}},aa=function(e){return function(t){return t.type===String(e)}},ra=function(e){return function(t){return t.type===e}},sa=function(){return So};function la(e){var t="*"===e?sa:ao(e)?aa:ro(e)?ia:yo(e)?aa:oo(e)?oa:fo(e)?ra:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var ca={type:zi},ua=function(e){return e&&e.type===zi};function da(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(ca)}))},(e={})[qi]=!0,e.put=function(e){if(!t)if(ua(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[Hi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=sa),t?e(ca):(e[Hi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ao(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[Ji]?s(e):Qo((function(){s(e)}))},r}function ya(e,t){var n=e[Wi];oo(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var fa,pa=0,ga=function(){return++pa};function Sa(e){e.isRunning()&&e.cancel()}var va=((fa={}).TAKE=function(e,t,n){var i=t.channel,o=void 0===i?e.channel:i,a=t.pattern,r=t.maybe,s=function(e){e instanceof Error?n(e,!0):!ua(e)||r?n(e):n(Zi)};try{o.take(s,io(a)?la(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},fa.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;Qo((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&so(t)?ya(t,n):n(t)}))},fa.ALL=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t);if(0!==r.length){var s=Uo(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(ro(t)?[]:{})},fa.RACE=function(e,t,n,i){var o=i.digestEffect,a=pa,r=Object.keys(t),s=ro(t)?Io(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Lo(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=vo,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},fa.CALL=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=i.task;try{var l=a.apply(o,r);if(so(l))return void ya(l,n);if(lo(l))return void Pa(e,l,s.context,pa,wo(a),!1,n);n(l)}catch(e){n(e,!0)}},fa.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){no(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},fa.FORK=function(e,t,n,i){var o=t.context,a=t.fn,r=t.args,s=t.detached,l=i.task,c=function(e){var t=e.context,n=e.fn,i=e.args;try{var o=n.apply(t,i);if(lo(o))return o;var a=!1;return Eo((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!so(o)})}))}catch(e){return Eo((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:wo(t)}(c,a);Zo((function(){var t=Pa(e,c,l.context,pa,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},fa.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&Ao(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(ro(t)){if(0===t.length)return void n([]);var r=Uo(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},fa.CANCEL=function(e,t,n,i){var o=i.task;t===Yi?Sa(o):ro(t)?t.forEach(Sa):Sa(t),n()},fa.SELECT=function(e,t,n){var i=t.selector,o=t.args;try{n(i.apply(void 0,[e.getState()].concat(o)))}catch(e){n(e,!0)}},fa.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Ro());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(ca):e.isEmpty()?(n.push(i),i.cancel=function(){Ao(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(ca):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(ca)}}}}(t.buffer),a=la(i),r=function t(n){ua(n)||e.channel.take(t,a),o.put(n)},s=o.close;o.close=function(){r.cancel(),s()},e.channel.take(r,a),n(o)},fa.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},fa.FLUSH=function(e,t,n){t.flush(n)},fa.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},fa.SET_CONTEXT=function(e,t,n,i){var o=i.task;mo(o.context,t),n()},fa);function ha(e,t){return e+"?"+t}function ma(e){var t=e.name,n=e.location;return n?t+" "+ha(n.fileName,n.lineNumber):t}function Aa(e){var t,n,i,o=(t=function(e){return e.cancelledTasks},n=e,(i=[]).concat.apply(i,n.map(t)));return o.length?["Tasks cancelled due to error:"].concat(o).join("\n"):""}var ba=null,Ta=[],Ea=function(e){e.crashedEffect=ba,Ta.push(e)},ka=function(){ba=null,Ta.length=0},Ia=function(){var e,t,n=Ta[0],i=Ta.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Co(e))?t.code+" "+ha(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+ma(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+ma(e.meta)})),[Aa(Ta)]).join("\n")};function Oa(e,t,n,i,o,a,r){var s;void 0===r&&(r=vo);var l,c,u=0,d=null,y=[],f=Object.create(n),p=function(e,t,n){var i,o=[],a=!1;function r(e){y.push.apply(y,p.getTasks().map((function(e){return e.meta.name}))),l(),n(e,!0)}function s(t){o.push(t),t.cont=function(s,l){a||(Ao(o,t),t.cont=vo,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=vo,e.cancel()})),o=[])}return s(e),{addTask:s,cancelAll:l,abort:r,getTasks:function(){return o}}}(t,0,g);function g(t,n){if(n){if(u=2,Ea({meta:o,cancelledTasks:y}),S.isRoot){var i=Ia();ka(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===Qi?u=1:1!==u&&(u=3),l=t,d&&d.resolve(t);S.cont(t,n),S.joiners.forEach((function(e){e.cb(t,n)})),S.joiners=null}var S=((s={})[Xi]=!0,s.id=i,s.meta=o,s.isRoot=a,s.context=f,s.joiners=[],s.queue=p,s.cancel=function(){0===u&&(u=1,p.cancelAll(),g(Qi,!1))},s.cont=r,s.end=g,s.setContext=function(e){mo(f,e)},s.toPromise=function(){return d||(d=qo(),2===u?d.reject(c):0!==u&&d.resolve(l)),d.promise},s.isRunning=function(){return 0===u},s.isCancelled=function(){return 1===u||0===u&&1===t.status},s.isAborted=function(){return 2===u},s.result=function(){return l},s.error=function(){return c},s);return S}function Pa(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){so(t)?ya(t,i):lo(t)?Pa(e,t,c.context,n,o,!1,i):t&&t[Ki]?(0,va[t.type])(e,t.payload,i,u):i(t)}));d.cancel=vo;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(Qi))},status:0},c=Oa(e,l,n,i,o,a,r),u={task:c,digestEffect:y};return r&&(r.cancel=c.cancel),d(),c;function d(e,n){try{var o;n?(o=t.throw(e),ka()):_o(e)?(l.status=1,d.cancel(),o=oo(t.return)?t.return(Qi):{done:!0,value:Qi}):o=Po(e)?oo(t.return)?t.return():{done:!0}:t.next(e),o.done?(1!==l.status&&(l.status=3),l.cont(o.value)):y(o.value,i,d)}catch(e){if(1===l.status)throw e;l.status=2,l.cont(e,!0)}}function y(t,n,i,o){void 0===o&&(o="");var a,r=ga();function l(n,o){a||(a=!0,i.cancel=vo,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){ba=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=vo,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=vo,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function _a(e,t){for(var n=e.channel,i=void 0===n?da():n,o=e.dispatch,a=e.getState,r=e.context,s=void 0===r?{}:r,l=e.sagaMonitor,c=e.effectMiddlewares,u=e.onError,d=void 0===u?ko:u,y=arguments.length,f=new Array(y>2?y-2:0),p=2;p<y;p++)f[p-2]=arguments[p];var g,S=t.apply(void 0,f),v=ga();if(l&&(l.rootSagaStarted=l.rootSagaStarted||vo,l.effectTriggered=l.effectTriggered||vo,l.effectResolved=l.effectResolved||vo,l.effectRejected=l.effectRejected||vo,l.effectCancelled=l.effectCancelled||vo,l.actionDispatched=l.actionDispatched||vo,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=He.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=ho;var m={channel:i,dispatch:Oo(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return Zo((function(){var e=Pa(m,S,s,v,wo(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var La=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?da():a,s=n.sagaMonitor,l=to(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=_a.bind(null,D({},l,{context:o,channel:r,dispatch:i,getState:n,sagaMonitor:s})),function(e){return function(t){s&&s.actionDispatched&&s.actionDispatched(t);var n=e(t);return r.put(t),n}}}return c.run=function(){return t.apply(void 0,arguments)},c.setContext=function(e){mo(o,e)},c},Ua=function(e){return{done:!0,value:e}},wa={};function Ca(e){return uo(e)?"channel":yo(e)?String(e):oo(e)?e.name:String(e)}function Ra(e,t,n){var i,o,a,r=t;function s(t,n){if(r===wa)return Ua(t);if(n&&!o)throw r=wa,n;i&&i(t);var s=n?e[o](n):e[r]();return r=s.nextState,a=s.effect,i=s.stateUpdater,o=s.errorState,r===wa?Ua(t):a}return Eo(s,(function(e){return s(null,e)}),n)}function Da(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ra({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Ca(e)+", "+t.name+")")}function Na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:$o(e)},l=function(e){return{done:!1,value:Wo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:zo(e)}},u=function(e){return a=e},d=function(e){return r=e};return Ra({q1:function(){return{nextState:"q2",effect:s,stateUpdater:d}},q2:function(){return a?{nextState:"q3",effect:c(a)}:{nextState:"q1",effect:l(r),stateUpdater:u}},q3:function(){return{nextState:"q1",effect:l(r),stateUpdater:u}}},"q1","takeLatest("+Ca(e)+", "+t.name+")")}function Ma(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:$o(e)},s=function(e){return{done:!1,value:Bo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Ra({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Ca(e)+", "+t.name+")")}function Fa(e,t,n){for(var i=e,o=arguments.length,a=new Array(o>3?o-3:0),r=3;r<o;r++)a[r-3]=arguments[r];var s={done:!1,value:Bo.apply(void 0,[n].concat(a))},l={done:!1,value:Ho(t)};return Ra({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:wa}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function Ga(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Da,e,t].concat(i))}function $a(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Na,e,t].concat(i))}function xa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return Wo.apply(void 0,[Ma,e,t].concat(i))}class Va{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 Va.instance||(Va.instance=new Va),Va.instance}static setContext(e){Va.getInstance().context=e}static setAccessToken(e){Va.getInstance().accessToken=e}static setUser(e){Va.getInstance().user=e}static setRequestSource(e){Va.getInstance().requestSource=e}static setOnRedirectTo(e){Va.getInstance().onRedirectTo=e}static setLogout(e,t){Va.getInstance().logout=n=>{n?e(n):Va.onRedirectTo(t)}}static setEntitlementsOptions(e){Va.getInstance().entitlementsOptions=e}static setSessionContext(e){Va.getInstance().sessionContext=e}static setAppName(e){Va.getInstance().appName=e}static getContext(){var e;return null!=(e=Va.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return Va.getInstance().accessToken}static getRequestSource(){return Va.getInstance().requestSource}static getUser(){return Va.getInstance().user}static onRedirectTo(e,t){return Va.getInstance().onRedirectTo(e,t)}static logout(e){return Va.getInstance().logout(e)}static shouldLoadEntitlements(){var e;return(null==(e=Va.getInstance().entitlementsOptions)?void 0:e.enabled)||!1}static isSessionPerTenantEnabled(){var e;return(null==(e=Va.getInstance().sessionContext)?void 0:e.enableSessionPerTenant)||!1}static getAppName(){return Va.getInstance().appName}}Va.instance=void 0;const ja={getContext:()=>Va.getContext(),getAccessToken:()=>Va.getAccessToken(),getUser:()=>Va.getUser(),onRedirectTo:(e,t)=>Va.onRedirectTo(e,t),logout:e=>Va.logout(e)};class Ba extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}const Wa={v1:"/identity/resources/users/webauthn/v1/devices"},za={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},Ka={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"}}},Ha={v1:"/identity/resources/configurations/v1"},qa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},Ja={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ya={v1:"/identity/resources/permissions/v1"},Xa={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"}},Qa={v1:"/identity/resources/roles/v1"},Za={v1:"/identity/resources/sub-tenants/users/v1",v2:"/identity/resources/sub-tenants/users/v2"},er={v1:"/identity/resources/impersonation/v1"},tr={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},nr={v1:"/identity/resources/users/phone-numbers/v1"},ir={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},or={v1:"/team/resources/members/v1"},ar={v1:"/team/resources/roles/v1"},rr={v1:"/team/resources/stats/v1"},sr={v1:"/team/resources/profile"},lr={v1:"/tenants/resources/account-settings/v1"},cr={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"}},ur={v1:"/tenants/resources/sub-tenants/v1"},dr={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},yr={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"}}}},fr={v1:"/subscriptions/resources/payment-providers/v1"},pr={v1:"/subscriptions/resources/subscriptions/v1"},gr={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Sr={v1:"/reports/engine/resources/triggers/v1"},vr="/notification",hr="/audits",mr={v1:"/event/resources/configurations/v1"},Ar="/webhook",br="/oauth",Tr="/flags",Er="/directory/resources/v1/configurations/scim2",kr="/directory/resources/scim/temp",Ir="/entitlements/api/v1/user-entitlements",Or="/entitlements/api/v2/user-entitlements",Pr={v1:"/security-center/resources/recommendations/v1"},_r={v1:"/security-center/resources/insights/v1"};function Lr(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}function Ur(e){var t,n;const i={};return null!=e&&null!=(t=e.metadataHeaders)&&t.fronteggSdkVersion&&(i[ci.fronteggSdkVersion]=e.metadataHeaders.fronteggSdkVersion),null!=e&&null!=(n=e.metadataHeaders)&&n.framework&&(i[ci.frameWork]=e.metadataHeaders.framework),i}function wr(){return new URLSearchParams(window.location.search).get("tenantId")||null}const Cr=async e=>{var t,n,i;const o=Va.getContext(),a=await async function(e,t){var n;const i=Ur(e),o=await(null!=(n=null==e?void 0:e.tokenResolver)?n:Va.getAccessToken)(),a=Va.getRequestSource(),r=wr();t&&(i[ci.contentType]=t),a&&(i[ci.source]=a),o&&(i.Authorization=`Bearer ${o}`),r&&(i[ci.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 t}(e))i[`${t.key}`]=`${t.value}`;return i}(o,e.contentType),r=await async function(e,t,n){const i=Lr(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),s=await fetch(r,{body:e.body?"application/json"===e.contentType?JSON.stringify(e.body):e.body:null,method:null!=(t=e.method)?t:"GET",headers:D({},a,e.headers),credentials:null!=(n=null!=(i=e.credentials)?i:o.requestCredentials)?n:"same-origin"});if(302===s.status)return window.location.href=await s.text(),new Promise((()=>{}));if(!s.ok){var l,c;if(413===s.status)throw new Ba("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=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new Ba(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{}}},Rr=async(e,t,n)=>Cr(D({url:e,method:"GET",contentType:"application/json",params:t},n)),Dr=async(e,t,n)=>Cr(D({url:e,method:"POST",contentType:"application/json",body:t},n)),Nr=async(e,t,n)=>Cr(D({url:e,method:"PATCH",contentType:"application/json",body:t},n)),Mr=async(e,t,n)=>Cr(D({url:e,method:"PUT",contentType:"application/json",body:t},n)),Fr=async(e,t,n)=>Cr(D({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Gr=async(e,t,n,i)=>Cr(D({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),$r=(e={})=>D({},e.jwt?{Authorization:e.jwt}:{}),xr="FRONTEGG_SEPARATE_TABS_BY_TENANT",Vr="admin_portal_use_entitlements_v2_endpoint",jr={flags:{}};class Br{constructor(){var e;this._flags={},this._flags=null!=(e=jr.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new Br;return n.set(e),Br._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=D({},null!=(t=null==jr?void 0:jr.flags)?t:{},null!=e?e:{})}}async function Wr(){return Rr(Tr)}async function zr(e){return Dr(`${Ka.v3}/me/token`,e)}async function Kr(e,t){return Rr(Ka.v2,e,{headers:$r(t)})}async function Hr(e,t){return Rr(Ka.v3,e,{headers:$r(t)})}async function qr(e,t){return Rr(Ka.roles.v3,D({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Jr(e,t){return Rr(Ka.groups.v3,D({},e,{ids:e.ids.join(",")}),{headers:$r(t)})}async function Yr(e){return Rr(Ka.tenants.me.v3,void 0,{headers:$r(e)})}async function Xr(e){return Rr(Ka.tenants.me.v1,void 0,{headers:$r(e)})}async function Qr(){return Dr(Ka.passwords.resetBreachedPasswords.v1)}async function Zr(e){return Mr(`${Ka.v2}/me`,e)}function es(e){e&&sessionStorage.setItem(xr,e)}function ts(){return Va.isSessionPerTenantEnabled()?sessionStorage.getItem(xr):null}function ns(){const[e]=Br.getFeatureFlags(["admin_portal_use_current_user_tenants_v1_endpoint"],Va.getAppName()||"");return Va.isSessionPerTenantEnabled()||e?Xr:Yr}async function is(e){return Va.isSessionPerTenantEnabled()&&es(e.tenantId),Mr(`${Ka.v1}/tenant`,e)}async function os(){return Rr(`${Ka.v2}/me/tenants`)}async function as(e){return Rr(cr.v1,void 0,{headers:$r(e)})}async function rs(e){return Rr(cr.tree.v1,void 0,{headers:$r(e)})}async function ss(e){return Rr(cr.parents.v1,void 0,{headers:$r(e)})}async function ls(e,t){return Rr(`${cr.parents.v1}/${e}`,void 0,{headers:$r(t)})}async function cs(e,t){return Dr(`${Xa.users.v1}/count`,e,{headers:$r(t)})}async function us(e,t){return Rr(cr.v2,e,{headers:$r(t)})}async function ds(e,t){return Rr(cr.metadata.v2,D({},e,{_tenantIds:e._tenantIds.join(",")}),{headers:$r(t)})}async function ys(){return Rr(Ha.v1)}async function fs(){return Rr(`${Ha.v1}/mfa-policy`)}async function ps(){return Rr(`${Ha.v1}/mfa-policy/vendor`)}async function gs(e){return e.id?Nr(`${Ha.v1}/mfa-policy`,e):Dr(`${Ha.v1}/mfa-policy`,e)}async function Ss(){return Rr(`${Ha.v1}/lockout-policy`)}async function vs(){return Rr(`${Ha.v1}/lockout-policy/vendor`)}async function hs(e){return e.id?Nr(`${Ha.v1}/lockout-policy`,e):Dr(`${Ha.v1}/lockout-policy`,e)}async function ms(){try{return await Rr(`${Ha.v1}/captcha-policy/public`)}catch{return null}}async function As(){return Rr(`${Ha.v1}/password-history-policy`)}async function bs(){return Rr(`${Ha.v1}/password-history-policy/vendor`)}async function Ts(e){return e.id?Nr(`${Ha.v1}/password-history-policy`,e):Dr(`${Ha.v1}/password-history-policy`,e)}async function Es(){return Rr(`${Ha.v1}/password`)}async function ks(){return Rr(`${qa.emailDomain.v1}`)}async function Is(){return Rr(`${qa.emailDomain.v1}/config`)}async function Os(e){return Dr(`${qa.emailDomain.v1}`,e)}async function Ps(e){return Dr(`${qa.emailDomain.v1}/config`,e)}async function _s(e){return Fr(`${qa.emailDomain.v1}/${e}`)}async function Ls(e){return Rr(`${qa.ip.v1}`,e)}async function Us(){return Rr(`${qa.ip.v1}/config`)}async function ws(e){return Dr(`${qa.ip.v1}`,e)}async function Cs(e){return Dr(`${qa.ip.v1}/bulk`,e)}async function Rs(e){return Dr(`${qa.ip.v1}/config`,e)}async function Ds(e){return Fr(`${qa.ip.v1}/${e}`)}async function Ns(){return Dr(`${qa.ip.v1}/verify`)}async function Ms(){return Dr(`${qa.ip.v1}/verify/allow`)}Br._instances={};class Fs extends Error{constructor(e){super(e)}}const Gs="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Fs("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class $s extends Error{constructor(e){super(e)}}const xs=(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(Gs(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 Gs(t)}})(e.split(".")[n]))}catch(e){throw new $s("Invalid token specified: "+e.message)}};let Vs,js,Bs;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.SmsCodeV2="SmsCodeV2",e.Passkeys="Passkeys"}(Vs||(Vs={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(js||(js={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS",e.EmailCode="EmailCode"}(Bs||(Bs={}));const Ws="admin_portal_should_load_authorization";async function zs(){return Rr(Ir)}async function Ks(){return Rr(Or)}let Hs;!function(e){e.MISSING_PERMISSION="MISSING_PERMISSION",e.MISSING_FEATURE="MISSING_FEATURE",e.BUNDLE_EXPIRED="BUNDLE_EXPIRED"}(Hs||(Hs={}));const qs="admin_portal_entitlements",Js=["type"],Ys=["type"],Xs=["type"];async function Qs(e){if(!e.accessToken)return e;Va.setAccessToken(e.accessToken);const t=await $u(),n=D({},e,e.accessToken?xs(e.accessToken):{},t);return Va.setUser(n),n}async function Zs(e){if(!e.accessToken)return{user:e};Va.setAccessToken(e.accessToken);const[t,n]=await Promise.all([$u(),os()]),i=D({},e,e.accessToken?xs(e.accessToken):{},t);return Va.setUser(i),{user:i,tenants:n}}function el(){if(!Va.shouldLoadEntitlements())return!1;const[e]=Br.getFeatureFlags([qs],Va.getAppName()||"");return e}function tl(){const[e]=Br.getFeatureFlags([Ws],Va.getAppName()||"");return e}async function nl(e){const{accessToken:t}=e;if(!t)return{user:e};Va.setAccessToken(t);const[n,i]=await Promise.all([$u(),ns()()]),o=D({},e,t?xs(t):{},n);return Va.isSessionPerTenantEnabled()&&es(o.tenantId),Va.setUser(o),{user:o,tenants:i.tenants,activeTenant:i.activeTenant}}async function il(e){Va.setAccessToken(e.id_token);const t=await $u(),n=e.id_token?xs(e.id_token):{},i=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:e.expires_in||300});return Va.setUser(i),i}async function ol(e){Va.setAccessToken(e.id_token);const[t,n]=await Promise.all([$u(),ns()()]),i=e.id_token?xs(e.id_token):{},o=D({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},i,t,{expiresIn:e.expires_in||300});return Va.isSessionPerTenantEnabled()&&es(o.tenantId),Va.setUser(o),{user:o,tenants:n.tenants,activeTenant:n.activeTenant}}async function al(e){try{const{address:t}=await Dr(`${za.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function rl(e){return Dr(`${za.v1}/user/saml/prelogin`,e)}async function sl(e){return Qs(await Dr(`${za.v1}/user/saml/postlogin`,e))}async function ll(e){return Qs(await Dr(`${za.v1}/user/oidc/postlogin`,e))}async function cl(e){return Qs(await Dr(`${za.v1}/user`,e))}async function ul(e){return nl(await Dr(`${za.v1}/user`,e))}async function dl(e){return Qs(await Dr(`${za.v1}/user/mfa/verify`,e))}async function yl(e){return nl(await Dr(`${za.v1}/user/mfa/verify`,e))}async function fl(e){return Dr(`${Ka.v1}/activate`,e)}async function pl(e){return nl(await Dr(`${Ka.v1}/activate`,e))}async function gl(e){return Rr(`${Ka.v1}/activate/strategy`,e)}async function Sl(e){return Dr(`${Ka.v1}/activate/reset`,e)}async function vl(e){return Dr(`${Ka.v1}/invitation/reset`,e)}async function hl(e){return Dr(`${Ka.v1}/invitation/accept`,e)}async function ml(){const e=ts();return Qs(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Al(){const e=ts();return Zs(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function bl(){const e=ts();return nl(await Dr(`${za.v1}/user/token/refresh`,{tenantId:e}))}async function Tl(){return Dr(`${za.v1}/logout`)}async function El(e){return Rr(`${br}/logout`,e)}async function kl(e){return Dr(`${Ka.v1}/passwords/reset`,e)}async function Il(e){return Dr(`${Ka.v1}/passwords/reset/verify`,e)}async function Ol(e){return Rr(`${Ka.v1}/passwords/config`,e)}async function Pl(e){return Dr(`${za.v1}/user/mfa/recover`,e)}async function _l(){return Dr(`${Ka.v1}/mfa/enroll`)}async function Ll(){return Dr(`${Ka.v1}/mfa/authenticator/enroll`)}async function Ul(e){return Dr(`${Ka.v1}/mfa/authenticator/enroll/verify`,e)}async function wl(e){return Dr(`${Ka.v1}/mfa/sms/enroll`,e)}async function Cl(e){return Dr(`${Ka.v1}/mfa/sms/enroll/verify`,e)}async function Rl(){return Dr(`${Ka.v1}/mfa/webauthn/enroll`)}async function Dl(e){return Dr(`${Ka.v1}/mfa/webauthn/enroll/verify`,e)}async function Nl(e){return Dr(`${Ka.v1}/mfa/enroll/verify`,e)}async function Ml(e){return Dr(`${Ka.v1}/mfa/disable`,e)}async function Fl(e,t){return Dr(`${Ka.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function Gl(e){return Dr(`${Ka.v1}/mfa/sms/${e}/disable`)}async function $l(e,t){return Dr(`${Ka.v1}/mfa/sms/${e}/disable/verify`,t)}async function xl(e){return Dr(`${Ka.v1}/mfa/webauthn/${e}/disable`)}async function Vl(e,t){return Dr(`${Ka.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function jl(){return Rr(`${Ka.v1}/mfa/devices`)}async function Bl(e){return Dr(`${za.v1}/user/mfa/authenticator/enroll`,e)}async function Wl(e){return Dr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e)}async function zl(e){return nl(await Dr(`${za.v1}/user/mfa/authenticator/enroll/verify`,e))}async function Kl(e,t){return Dr(`${za.v1}/user/mfa/authenticator/${e}/verify`,t)}async function Hl(e){return Dr(`${za.v1}/user/mfa/emailcode`,e)}async function ql(e){return Dr(`${za.v1}/user/mfa/emailcode/verify`,e)}async function Jl(e){return nl(await Dr(`${za.v1}/user/mfa/emailcode/verify`,e))}async function Yl(e){return Dr(`${za.v1}/user/mfa/sms/enroll`,e)}async function Xl(e){return Dr(`${za.v1}/user/mfa/sms/enroll/verify`,e)}async function Ql(e){return nl(await Dr(`${za.v1}/user/mfa/sms/enroll/verify`,e))}async function Zl(e,t){return Dr(`${za.v1}/user/mfa/sms/${e}`,t)}async function ec(e,t){return Dr(`${za.v1}/user/mfa/sms/${e}/verify`,t)}async function tc(e,t){return nl(await Dr(`${za.v1}/user/mfa/sms/${e}/verify`,t))}async function nc(e){return Dr(`${za.v1}/user/mfa/webauthn/enroll`,e)}async function ic(e){return Dr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e)}async function oc(e){return nl(await Dr(`${za.v1}/user/mfa/webauthn/enroll/verify`,e))}async function ac(e,t){return Dr(`${za.v1}/user/mfa/webauthn/${e}`,t)}async function rc(e,t){return Dr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t)}async function sc(e,t){return nl(await Dr(`${za.v1}/user/mfa/webauthn/${e}/verify`,t))}async function lc(){return Rr(`${ir.v1}/saml/configurations`)}async function cc(e){return Dr(`${ir.v1}/saml/configurations`,e)}async function uc(){return Rr(`${ir.v1}/saml/configurations/vendor-config`)}async function dc(e){return Mr(`${ir.v1}/saml/configurations/metadata`,e)}async function yc(){return Mr(`${ir.v1}/saml/validations/domain`)}async function fc(){return Rr(`${ir.v1}/saml/configurations/roles/default`)}async function pc(){return Rr(`${ir.v2}/saml/configurations/groups`)}async function gc({roleIds:e}){return Dr(`${ir.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Sc({roleIds:e,group:t}){return Dr(`${ir.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function vc({roleIds:e,group:t,id:n}){return Nr(`${ir.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function hc({id:e}){return Fr(`${ir.v2}/saml/configurations/groups/${e}`)}async function mc(){return Rr(`${ir.v1}/oidc/configurations`)}async function Ac(){return Rr(`${ir.v2}/configurations/public`)}async function bc(){return Rr(Ja.v1)}async function Tc(){return Rr(Ja.v2)}async function Ec(){return Rr(`${Ja.v2}/authenticated`)}async function kc(){return Rr(Ja.custom.v1)}async function Ic({provider:e,code:t,idToken:n,redirectUri:i,codeVerifier:o,metadata:a,invitationToken:r,state:s}){const l={};return t&&(l.code=t),n&&(l.id_token=n),i&&(l.redirectUri=i),o&&(l.code_verifier=o),s&&(l.state=s),Dr(`${za.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Oc(){return Rr(`${Ha.v1}/public`)}async function Pc(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await Dr(`${Ka.v1}/signUp`,e),a={shouldActivate:t,userId:i,tenantId:o};if(!t&&n){const{user:e,tenants:t,activeTenant:i}=await nl(n);return D({},a,{user:e,tenants:t,activeTenant:i})}return a}async function _c(){return Rr(Ka.sessions.currentUser.v1)}async function Lc(){return Rr(`${Ka.sessions.currentUser.v1}/current`)}async function Uc(e){return Dr(`${Ka.sessions.v1}/revoke`,{userId:e})}async function wc(){return Rr(Ka.sessions.configurations.v1)}async function Cc(e){await Dr(Ka.sessions.configurations.v1,e)}async function Rc(e){await Fr(`${Ka.sessions.currentUser.v1}/${e}`)}async function Dc(){await Fr(`${Ka.sessions.currentUser.v1}/all`)}async function Nc(){return Rr(Ka.accessTokens.v1)}async function Mc(){return Rr(Xa.accessTokens.v1)}async function Fc({id:e}){return Fr(`${Xa.accessTokens.v1}/${e}`)}async function Gc({id:e}){return Fr(`${Ka.accessTokens.v1}/${e}`)}async function $c(e){return Dr(Ka.accessTokens.v1,e)}async function xc(e){return Dr(Xa.accessTokens.v1,e)}async function Vc(){return Rr(Ka.apiTokens.v1)}async function jc(){return Rr(Xa.apiTokens.v1)}async function Bc(e){return Dr(Ka.apiTokens.v1,e)}async function Wc(e){return Dr(Xa.apiTokens.v2,e)}async function zc({tokenId:e}){return Fr(`${Xa.apiTokens.v1}/${e}`)}async function Kc({tokenId:e}){return Fr(`${Ka.apiTokens.v1}/${e}`)}async function Hc({userId:e}){return Rr(`${Ka.v1}/${e}`)}async function qc(e){return Rr(`${Ha.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function Jc(e){let{type:t}=e,n=to(e,Js);return Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function Yc(e){let{type:t}=e,n=to(e,Ys);return nl(await Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n))}async function Xc(e){let{type:t}=e,n=to(e,Xs);return Dr(`${za.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Qc({token:e}){return Dr(Xa.invites.verify.v1,{token:e})}async function Zc(){return Rr(`${ir.v1}/configurations`)}async function eu(e){return Dr(`${ir.v1}/configurations`,e)}async function tu(e,t){return Nr(`${ir.v1}/configurations/${e}`,t)}async function nu(e){return Fr(`${ir.v1}/configurations/${e}`)}async function iu(e){return Dr(`${ir.v1}/configurations/metadata`,e)}async function ou(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata`,t)}async function au(e){return Dr(`${ir.v1}/configurations/metadata-url`,e)}async function ru(e,t){return Mr(`${ir.v1}/configurations/${e}/metadata-url`,t)}async function su(e,t){return Dr(`${ir.v1}/configurations/${e}/domains`,t)}async function lu(e,t){return Fr(`${ir.v1}/configurations/${e}/domains/${t}`)}async function cu(e,t){return Mr(`${ir.v1}/configurations/${e}/domains/${t}/validate`)}async function uu(e){return Rr(`${ir.v1}/configurations/${e}/roles`)}async function du(e,t){return Mr(`${ir.v1}/configurations/${e}/roles`,t)}async function yu(e,t){return Dr(`${ir.v1}/configurations/${e}/groups`,t)}async function fu(e,{roleIds:t,group:n,id:i}){return Nr(`${ir.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function pu(e,t){return Fr(`${ir.v1}/configurations/${e}/groups/${t}`)}async function gu(e){return Rr(`${ir.v1}/configurations/${e}/groups`)}async function Su(e){return Dr(`${za.v2}/user/sso/prelogin`,e)}async function vu(e){return Qs(await Dr(`${za.v2}/user/oidc/postlogin`,e))}async function hu(e){return ol(await Dr(`${br}/token`,e))}async function mu(){const e=ts();return ol(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Au(e){return il(await Dr(`${br}/token`,e))}async function bu(){const e=ts();return il(await Dr(`${br}/authorize/silent`,{tenantId:e}))}async function Tu(e){return Dr(`${Ka.v1}/phone/reset`,e)}async function Eu(e){return Dr(`${Ka.v1}/phone/reset/verify`,e)}async function ku(e){return Dr(`${Ka.v1}/phone`,e)}async function Iu(e){return Dr(`${Ka.v1}/phone/verify`,e)}async function Ou(e){return Mr(`${Ka.v1}/phone/change`,e)}async function Pu(e){return Dr(`${za.v1}/webauthn/prelogin`,e)}async function _u(e){return Dr(`${za.v1}/webauthn/postlogin`,e)}async function Lu(e){return nl(await Dr(`${za.v1}/webauthn/postlogin`,e))}async function Uu(){return Dr(Wa.v1)}async function wu(){return Rr(Wa.v1)}async function Cu(e){return Fr(`${Wa.v1}/${e}`)}async function Ru(e){return Dr(`${Wa.v1}/verify`,e)}async function Du(){return Rr(`${Ha.v1}/auth/strategies/public`)}async function Nu(){return Rr(`${Ha.v1}/auth/strategies`)}async function Mu(){return Rr(`${Ha.v1}/mfa/strategies`)}async function Fu(){return Rr(`${Ka.authorization.v1}`)}async function Gu(){return Rr(`${Ka.v2}/me`)}async function $u(){const[e]=Br.getFeatureFlags([Vr],Va.getAppName()||""),t=[{action:Gu,shouldLoad:!0},{action:e?Ks:zs,shouldLoad:el()},{action:Fu,shouldLoad:tl()}].map((e=>async function({shouldLoad:e,action:t}){if(e)return await t()}(e))),[n,i,o]=await Promise.all(t),a=ts();return a&&(n.tenantId=a),D({},n,null!=o?o:{},{entitlements:i})}async function xu(e){const t=await Dr(`${za.v1}/user/step-up/generate`,e);return t.accessToken?nl(t):t}async function Vu(e){return Rr(`${Ka.v2}/me`,null!=e?e:{addRoles:!0})}async function ju(e){return Mr(`${Ka.v2}/me`,e)}async function Bu(e){return Mr(`${sr.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Wu(e){return Dr(`${Ka.v1}/passwords/change`,e)}async function zu(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>D({},e,{[t.id]:t.value})),{}),l=null!=(t=e.sort)&&t.length?{sortBy:null!=(n=null==(i=e.sort)||null==(o=i[0])?void 0:o.id)?n:"name",sortDirection:null!=(a=e.sort)&&null!=(r=a[0])&&r.desc?"desc":"asc"}:null;return Rr(or.v1,D({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ku(e){return Dr(Ka.v2,D({},e,{provider:"local"}))}async function Hu(e){return Fr(`${or.v1}/${e.userId}`)}async function qu(e){return Mr(or.v1,e)}async function Ju(e){const{userId:t,expirationInSeconds:n}=e;return Mr(`${Ka.temporary.v1}/${t}`,{expirationInSeconds:n})}async function Yu(e){return Fr(`${Ka.temporary.v1}/${e}`)}async function Xu(){return Rr(Ka.temporary.configuration.v1)}async function Qu(e){return Dr(Xa.invites.user.v1,D({},e))}async function Zu(e){return Nr(Xa.invites.user.v1,D({},e))}async function ed(){return Fr(Xa.invites.user.v1)}async function td(){return Rr(Xa.invites.user.v1)}async function nd(){return Rr(Xa.invites.configuration.v1)}async function id(){return Rr(ar.v1)}async function od(){return Rr(Ya.v1)}async function ad(){return Rr(`${rr.v1}/members`)}async function rd(e){return Dr(`${or.v1}/${e.userId}/resendActivationEmail`,{})}async function sd(e){return Dr(Ka.v2,D({},e,{provider:"local"}))}async function ld(e){return Dr(Ka.invitation.resendAll.v1,D({},e))}async function cd(e){var t,n;const i=await Rr("/metadata",e);if(null!=i&&null!=(t=i.rows)&&t[0])return null==i||null==(n=i.rows)?void 0:n[0];throw new Error(`metadata not found: ${e.entityName}`)}async function ud(){return Rr("/metadata/admin-box")}async function dd(e){return Dr("/metadata/admin-box",e)}async function yd(){const e=await Rr("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const fd=async()=>cd({entityName:"notifications"}),pd=async()=>cd({entityName:"saml"}),gd=async()=>cd({entityName:"audits"}),Sd=async e=>async function(e){const t=await Rr(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vd=["dataFilters"],hd=["templateId","dataFilters"],md=["dataFilters"];async function Ad(e){return Rr(`${gr.v2}/tenant-reports`,e)}async function bd(e){return Rr(`${gr.v2}/${e.id}/tenant-reports`)}async function Td(e){let{dataFilters:t}=e,n=to(e,vd);return{html:await Rr(`${Sr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Ed(e){let{templateId:t,dataFilters:n}=e,i=to(e,hd);return Dr(`${gr.v2}/${t}/tenant-reports`,D({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function kd(e){let{dataFilters:t}=e,n=to(e,md);const i=await Rr(`${Sr.v1}/preview-report`,D({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),s=URL.createObjectURL(r),l=document.createElement("a");l.href=s,l.setAttribute("download",`report_${n.name||""}.${a}`),l.click(),setTimeout(l.remove.bind(l))}async function Id(e){return Dr(`${Sr.v1}/tenant-reports`,e)}async function Od(e){return Rr(vr,{params:e})}async function Pd(e){return Mr(`${vr}/status`,{params:e})}async function _d(e){const{notificationId:t,pinStatus:n}=e;return Mr(`${vr}/${n}`,{notificationId:t})}async function Ld(){return Dr(`${vr}/status/mark-all-read`)}const Ud=["endpoint","headerProps"];async function wd(e){return Rr(hr,e)}async function Cd(e){return Rr(`${hr}/stats`,e)}async function Rd(e){const{endpoint:t,headerProps:n}=e,i=to(e,Ud);return Gr(`${hr}/export/${t}`,{properties:n},i)}const Dd=["eventKey"],Nd=["eventKey"],Md=()=>Rr(`${dr.v1}/slack`),Fd=()=>Rr(`${dr.v1}/slack/applications`),Gd=()=>Rr(`${dr.v1}/slack/channels`),$d=e=>e.id?Nr(`${dr.v1}/slack/subscription/${e.id}`,e):Dr(`${dr.v1}/slack/subscriptions`,e),xd=e=>Fr(`${dr.v1}/slack/subscriptions/${e.id}`),Vd=e=>Dr(`${dr.v1}/slack/applications/registrations`,{code:e}),jd=()=>Rr(`${dr.v1}/emails`),Bd=e=>{let{eventKey:t}=e,n=to(e,Dd);return Dr(`${dr.v1}/emails/${t}`,n)},Wd=({eventKey:e,enabled:t})=>Nr(`${dr.v1}/emails/${e}`,{enabled:t}),zd=(e,t)=>Fr(`${dr.v1}/emails/${e}/subscriptions/${t}`),Kd=(e,t,n)=>Mr(`${dr.v1}/emails/${t}/subscriptions/${e}`,n),Hd=e=>Fr(`${dr.v1}/emails/${e}`),qd=()=>Rr(`${dr.v2}/sms`),Jd=e=>{let{eventKey:t}=e,n=to(e,Nd);return Dr(`${dr.v2}/sms/${t}`,n)},Yd=({eventKey:e,enabled:t})=>Nr(`${dr.v2}/sms/${e}`,{enabled:t}),Xd=(e,t)=>Fr(`${dr.v2}/sms/${e}/subscriptions/${t}`),Qd=(e,t,n)=>Mr(`${dr.v2}/sms/${t}/subscriptions/${e}`,n),Zd=e=>Fr(`${dr.v2}/sms/${e}`),ey=()=>Rr(Ar),ty=e=>e._id?Nr(`${Ar}/${e._id}`,e):Dr(`${Ar}/custom`,e),ny=e=>Fr(`${Ar}/${e}`),iy=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return Rr(`${Ar}/logs/?${i.toString()}`)},oy=e=>Dr(`${Ar}/test`,e),ay=e=>Dr(`${Ar}/logs/${e}/retries`),ry=()=>Rr(`${mr.v1}/categories`),sy=e=>Rr(mr.v1,{channels:e});async function ly(e,t){return Mr(lr.v1,e,{headers:$r(t)})}async function cy(e){return Rr(lr.v1,void 0,{headers:$r(e)})}async function uy(){return Rr(`${lr.v1}/public`)}const dy=["roleId"],yy=["roleId"],fy=["permissionId"];async function py(){return Rr(Qa.v1)}async function gy(e){return Dr(Qa.v1,e)}async function Sy({roleId:e}){return Fr(`${Qa.v1}/${e}`)}async function vy(e){let{roleId:t}=e,n=to(e,dy);return Nr(`${Qa.v1}/${t}`,n)}async function hy(e){let{roleId:t}=e,n=to(e,yy);return Mr(`${Qa.v1}/${t}/permissions`,n)}async function my(){return Rr(Ya.v1)}async function Ay(e){let{permissionId:t}=e,n=to(e,fy);return Mr(`${Ya.v1}/${t}/roles`,n)}async function by(){return Rr(`${Ya.v1}/categories`)}async function Ty(){return Rr(yr.subscriptions.v1)}async function Ey(e){return Rr(`${yr.subscriptions.v1}/${e}`)}async function ky(e){return Mr(`${yr.subscriptions.v1}/${e}/cancellations/`,{})}async function Iy(e){return Mr(`${yr.subscriptions.v1}/${e}/renewals/`,{})}async function Oy(e,{paymentMethodId:t,planId:n}){return Mr(`${yr.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Py(e){return Rr(`${pr.v1}/${e}`)}async function _y(){return Rr(`${pr.v1}`)}async function Ly(e){return Mr(`${pr.v1}/${e}/cancellations/`,{})}async function Uy(e){return Mr(`${pr.v1}/${e}/renewals/`,{})}async function wy(e,{paymentMethodId:t,planId:n}){return Mr(`${pr.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cy(){return Rr(yr.plans.v1)}async function Ry(e){return Rr(`${yr.plans.v1}/${e}`)}async function Dy(){return Rr(yr.invoices.v1)}async function Ny(e){return Rr(`${yr.invoices.v1}/${e}`)}async function My(e,t){return Rr(`${yr.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fy=["email"];async function Gy(){return Rr(yr.paymentMethods.v1)}async function $y(e){return Rr(`${yr.paymentMethods.v1}/${e}`)}async function xy(e,t){let{email:n}=t,i=to(t,Fy);return Nr(`${yr.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Vy(e){return Dr(yr.paymentProviders.stripe.subscriptions.v1,e)}async function jy(e){return Rr(`${yr.paymentProviders.stripe.customers.v1}/${e}`)}async function By(e){return Dr(`${yr.paymentProviders.stripe.customers.v1}`,e)}async function Wy(){return Rr(`${yr.paymentProviders.stripe.publicConfigurations.v1}`)}async function zy(e){return Dr(`${yr.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ky(e){return Rr(`${yr.summaries.v1}/${e}`)}async function Hy(e){return Rr(`${yr.tenantConfiguration.v1}/${e}`)}async function qy(e){return Dr(`${yr.tenantConfiguration.v1}`,e)}async function Jy(){return Rr(fr.v1)}async function Yy(){return Rr(`${yr.configurations.vendorPublicConfigurations.v1}`)}let Xy,Qy,Zy,ef,tf,nf;async function of(){return Rr("/vendors/public")}async function af(e){return Rr(Za.v1,e)}async function rf(e){return Dr(Za.v1,e)}async function sf(e,t){return Fr(Za.v1,e,{headers:$r(t)})}async function lf(e,t,n){return Dr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function cf(e,t,n){return Fr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function uf(e,t,n){return Nr(`${Za.v1}/${e}/roles`,t,{headers:$r(n)})}async function df(e,t){return Dr(ur.v1,e,{headers:$r(t)})}async function yf(e,t){return Fr(`${ur.v1}/${e}`,void 0,{headers:$r(t)})}async function ff({tenantId:e},t,n){return Nr(`${ur.v1}/${e}`,t,{headers:$r(n)})}async function pf(e,t,n){return Mr(`${Za.v1}/${e}/access`,t,{headers:$r(n)})}async function gf(e,t){return Dr(`${Za.v2}/`,e,{headers:$r(t)})}async function Sf(){return Rr(`${Er}`)}async function vf(e,t){return Nr(`${Er}/${e}`,t)}async function hf(e){return Dr(`${Er}`,e)}async function mf(e){return Fr(`${Er}/${e}`)}async function Af(e){return Rr(`${kr}/${e}/Users/count`)}async function bf(e){return Dr(`${er.v1}`,e)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Xy||(Xy={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qy||(Qy={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zy||(Zy={})),(ef||(ef={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(tf||(tf={})),function(e){e.CREATE="create_customer"}(nf||(nf={}));const Tf=["groupId"];async function Ef({groupId:e},t){return Rr(`${tr.v1}/${e}`,D({},t))}async function kf(e){return Rr(`${tr.v1}`,D({},e))}async function If(e,t){return Dr(`${tr.getByIds.v1}`,e,{params:t})}async function Of(e){return Dr(`${tr.v1}`,e)}async function Pf(e){let{groupId:t}=e,n=to(e,Tf);return Nr(`${tr.v1}/${t}`,n)}async function _f(e){return Fr(`${tr.v1}/${e}`)}async function Lf(e,t){return Dr(`${tr.v1}/${e}/roles`,t)}async function Uf(e,t){return Fr(`${tr.v1}/${e}/roles`,t)}async function wf(e,t){return Dr(`${tr.v1}/${e}/users`,t)}async function Cf(e,t){return Fr(`${tr.v1}/${e}/users`,t)}async function Rf(){return Rr(`${tr.configurations.v1}`)}async function Df(e){return Dr(`${tr.configurations.v1}`,e)}async function Nf(){return Rr(Pr.v1)}async function Mf(){return Rr(_r.v1)}async function Ff(e){return Rr(`${nr.v1}`,e)}async function Gf(e){return Dr(`${nr.v1}`,e)}async function $f(e){return Fr(`${nr.v1}/${e}`)}async function xf(e){return Dr(`${nr.v1}/preverify`,e)}async function Vf(e){return Dr(`${nr.v1}/verify`,e)}async function jf(e,t){return Dr(`${nr.v1}/${e}/delete/verify`,t)}let Bf,Wf,zf;!function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Bf||(Bf={})),function(e){e.createdAt="createdAt",e.name="name",e.tenantId="tenantId"}(Wf||(Wf={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(zf||(zf={}));const Kf=[/^(.*)\/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],Hf=`${za.v1}/user/token/refresh`,qf=`${br}/authorize/silent`,Jf=`${Ka.v2}/me`,Yf=`${Ka.v2}/me/tenants`,Xf=`${Ka.v3}/me/tenants`;let Qf,Zf,ep,tp,np,ip,op,ap;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Qf||(Qf={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Zf||(Zf={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(ep||(ep={})),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"}(tp||(tp={})),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"}(np||(np={})),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"}(ip||(ip={})),function(e){e.SEVERE="SEVERE",e.WARNING="WARNING",e.INFO="INFO"}(op||(op={})),function(e){e.MFA="MFA",e.SESSIONS="SESSIONS",e.PASSWORD="PASSWORD",e.INACTIVITY="INACTIVITY",e.IP="IP",e.DOMAIN="DOMAIN",e.SSO="SSO"}(ap||(ap={}));const rp={auth:s,teams:l,metadata:c,reports:u,connectivity:f,notifications:d,audits:y,tenants:a,accountSettings:p,roles:g,subscriptions:S,vendor:v,subTenants:h,featureFlags:t,directory:m,impersonate:A,groups:b,users:o,entitlements:r,securityCenter:T,userPhoneNumbers:E};var sp={fetch:e,ContextHolder:Va,FronteggContext:ja,api:rp,FronteggApiError:Ba,AuthStrategyEnum:Ii,MachineToMachineAuthStrategy:Oi,SocialLoginProviders:ki,ISubscriptionCancellationPolicy:Zy,ISubscriptionStatus:Xy,PaymentMethodType:Qy,ProviderType:ef};let lp,cp;!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"}(lp||(lp={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(cp||(cp={}));const up="input is invalid type",dp="undefined"!=typeof ArrayBuffer,yp="0123456789abcdef".split(""),fp=[-2147483648,8388608,32768,128],pp=[24,16,8,0],gp=[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],Sp=["hex","array","digest","arrayBuffer"],vp=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),dp&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const hp=function(e){return function(t){const n=new Ap(!0).update(t);return null==n?void 0:n[e]()}},mp=function(e){return function(t,n){const i=new bp(t,!0).update(n);return null==i?void 0:i[e]()}};class Ap{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=()=>Ap.prototype.digest(),e?(vp[0]=vp[16]=vp[1]=vp[2]=vp[3]=vp[4]=vp[5]=vp[6]=vp[7]=vp[8]=vp[9]=vp[10]=vp[11]=vp[12]=vp[13]=vp[14]=vp[15]=0,this.blocks=vp):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(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up);t=!0}let i,o,a=0;const r=e.length,s=this.blocks;for(;a<r;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(o=this.start;a<r&&o<64;++a)s[o>>2]|=e[a]<<pp[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<pp[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<pp[3&o++],s[o>>2]|=(128|i>>12&63)<<pp[3&o++],s[o>>2]|=(128|i>>6&63)<<pp[3&o++],s[o>>2]|=(128|63&i)<<pp[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=s[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}finalize(){if(this.finalized)return;this.finalized=!0;const e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=fp[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}hash(){let e,t,n,i,o,a,r,s,l,c,u,d=this.h0,y=this.h1,f=this.h2,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)o=m[e-15],t=(o>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,o=m[e-2],n=(o>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,m[e]=m[e-16]+t+m[e-7]+n<<0;for(u=y&f,e=0;e<64;e+=4)this.first?(s=704751109,o=m[0]-210244248,h=o-1521486534<<0,p=o+143694565<<0,this.first=!1):(t=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),s=d&y,i=s^d&f^u,r=g&S^~g&v,o=h+n+r+gp[e]+m[e],a=t+i,h=p+o<<0,p=o+a<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7),l=p&d,i=l^p&y^s,r=h&g^~h&S,o=v+n+r+gp[e+1]+m[e+1],a=t+i,v=f+o<<0,f=o+a<<0,t=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),n=(v>>>6|v<<26)^(v>>>11|v<<21)^(v>>>25|v<<7),c=f&p,i=c^f&d^l,r=v&h^~v&g,o=S+n+r+gp[e+2]+m[e+2],a=t+i,S=y+o<<0,y=o+a<<0,t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),u=y&f,i=u^y&p^c,r=S&v^~S&h,o=g+n+r+gp[e+3]+m[e+3],a=t+i,g=d+o<<0,d=o+a<<0;this.h0=this.h0+d<<0,this.h1=this.h1+y<<0,this.h2=this.h2+f<<0,this.h3=this.h3+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,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7;let l=yp[e>>28&15]+yp[e>>24&15]+yp[e>>20&15]+yp[e>>16&15]+yp[e>>12&15]+yp[e>>8&15]+yp[e>>4&15]+yp[15&e]+yp[t>>28&15]+yp[t>>24&15]+yp[t>>20&15]+yp[t>>16&15]+yp[t>>12&15]+yp[t>>8&15]+yp[t>>4&15]+yp[15&t]+yp[n>>28&15]+yp[n>>24&15]+yp[n>>20&15]+yp[n>>16&15]+yp[n>>12&15]+yp[n>>8&15]+yp[n>>4&15]+yp[15&n]+yp[i>>28&15]+yp[i>>24&15]+yp[i>>20&15]+yp[i>>16&15]+yp[i>>12&15]+yp[i>>8&15]+yp[i>>4&15]+yp[15&i]+yp[o>>28&15]+yp[o>>24&15]+yp[o>>20&15]+yp[o>>16&15]+yp[o>>12&15]+yp[o>>8&15]+yp[o>>4&15]+yp[15&o]+yp[a>>28&15]+yp[a>>24&15]+yp[a>>20&15]+yp[a>>16&15]+yp[a>>12&15]+yp[a>>8&15]+yp[a>>4&15]+yp[15&a]+yp[r>>28&15]+yp[r>>24&15]+yp[r>>20&15]+yp[r>>16&15]+yp[r>>12&15]+yp[r>>8&15]+yp[r>>4&15]+yp[15&r];return l+=yp[s>>28&15]+yp[s>>24&15]+yp[s>>20&15]+yp[s>>16&15]+yp[s>>12&15]+yp[s>>8&15]+yp[s>>4&15]+yp[15&s],l}digest(){this.finalize();const e=this.h0,t=this.h1,n=this.h2,i=this.h3,o=this.h4,a=this.h5,r=this.h6,s=this.h7,l=[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a,r>>24&255,r>>16&255,r>>8&255,255&r];return l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l}arrayBuffer(){this.finalize();const e=new ArrayBuffer(32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),t.setUint32(28,this.h7),e}}class bp extends Ap{constructor(e,t=!1){let n;super(t),this.inner=void 0,this.oKeyPad=void 0;const i=typeof e;if("string"===i){const t=[],i=e.length;let o,a=0;for(n=0;n<i;++n)o=e.charCodeAt(n),o<128?t[a++]=o:o<2048?(t[a++]=192|o>>6,t[a++]=128|63&o):o<55296||o>=57344?(t[a++]=224|o>>12,t[a++]=128|o>>6&63,t[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++n)),t[a++]=240|o>>18,t[a++]=128|o>>12&63,t[a++]=128|o>>6&63,t[a++]=128|63&o);e=t}else{if("object"!==i)throw new Error(up);if(null===e)throw new Error(up);if(dp&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||dp&&ArrayBuffer.isView(e)))throw new Error(up)}var o;e.length>64&&(e=null==(o=new Ap(!0).update(e))?void 0:o.array());const a=[],r=[];for(n=0;n<64;++n){const t=e[n]||0;a[n]=92^t,r[n]=54^t}Ap.call(this,t),this.update(r),this.oKeyPad=a,this.inner=!0,this.sharedMemory=t}finalize(){if(super.finalize(),this.inner){this.inner=!1;const e=this.array();Ap.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Ap.prototype.finalize.call(this)}}}const Tp=function(){const e=hp("hex");e.create=function(){return new Ap},e.update=function(t){return e.create().update(t)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=hp(n)}return e}();function Ep(e,t){const n=D({},e);return t.forEach((e=>{delete n[e]})),n}async function kp(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=Tp.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Ip(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=mp("hex");e.create=function(e){return new bp(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<Sp.length;++t){const n=Sp[t];e[n]=mp(n)}}();const Op=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*Pp(e){const t=yield Ko((e=>e.root.appName));return Br.getFeatureFlags(e,t)}const _p={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Lp=D({},_p,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),Up=[{id:"a040dcf6-b907-4e83-9970-6bd23c88fd40",key:"ReadOnly",name:"Read Only",description:null,isDefault:!1,createdAt:new Date,updatedAt:new Date,permissions:["5b7dafe6-12a1-402b-9082-8eb2777cfcd8","da1d1990-c99c-4086-b845-2d465de3227b"],tenantId:"tenantId",vendorId:"vendorId"},{id:"b43b2c4b-e056-4eec-8c55-d200a475bbc0",key:"Admin",name:"Admin",description:null,isDefault:!0,createdAt:new Date,updatedAt:new Date,permissions:["502b112e-50fd-4e8d-875e-3abda628d94a","da015508-7cb1-4dcd-9436-d0518a2ecd21"],tenantId:"tenantId",vendorId:"vendorId"}],wp={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:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",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},Cp=D({},wp,{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}),Rp={loading:!1,error:void 0,saving:!0,profile:wp},Dp={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"},Np={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Ii.EmailAndPassword,machineToMachineAuthStrategy:Oi.ClientCredentials},Mp={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Fp={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Gp={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},$p={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},xp={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Vp=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],jp={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:$p,roles:Vp,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Bp=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Wp={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:[Up[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[Up[0]],managedBy:ep.FRONTEGG}]},zp={id:Wp.id,email:Wp.email,name:Wp.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:[Up[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},Kp={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:[Up[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[Up[0]],managedBy:ep.FRONTEGG}]},Hp={id:Kp.id,email:Kp.email,name:Kp.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:[Up[1]],tenantIds:[],metadata:"",sub:"",tenants:[]},qp={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},Jp=[Kp,Wp],Yp=[Hp,zp],Xp=[qp],Qp=[{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}],Zp=[{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"}],eg={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},tg={isActive:!0,strategy:zn.ALLOW},ng=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:zn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:zn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:zn.BLOCK,description:"IP 4"}],ig=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(D({},Kp,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},og=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"}),ag=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:ig(6),roles:[og("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:ep.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:ig(44),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:ig(8),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:ig(5),roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:ig(21),description:"BDR, AE, and inside sales",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:ig(23),description:"Dev success and customer success",roles:[og("Admin")],managedBy:ep.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:ig(10),description:"The marketing department",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:ig(4),description:"Human resources",roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:ig(3),roles:[og("Viewer")],managedBy:ep.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:ig(8),roles:[og("Editor")],managedBy:ep.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:ig(4),roles:[og("Viewer")],managedBy:ep.FRONTEGG}],rg={scoring:{score:79},recommendations:{items:[{code:tp.FORCE_MFA,severity:op.WARNING,category:ap.MFA},{code:tp.ENABLE_FORCE_RELOGIN,severity:op.WARNING,category:ap.SESSIONS}]}},sg={insights:{items:[{category:ap.MFA,code:np.PARTIALLY_FORCED_MFA,metadata:{totalUsers:2,mfa:{enrolledUsersCount:1}}},{category:ap.SESSIONS,code:np.PARTIAL_SESSION_SETTINGS,metadata:{totalUsers:2,sessions:{idleTimeoutRecommendation:1800}}},{category:ap.PASSWORD,code:np.IMPROVE_PASSWORD_HISTORY_POLICY,metadata:{password:{userLockoutRecommendation:5,historyRecommendations:5}}},{category:ap.DOMAIN,code:np.NO_IP_RESTRICTIONS,metadata:{restrictions:{ipsCount:1,domainsCount:1}}}]}},lg={users:Yp,totalUsersItems:2,totalUsersPages:1,usersPageOffset:0},cg={users:[Yp[0]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0,queryParams:{_maxInactiveSeconds:7776e3}},ug={users:[Yp[1]],totalUsersItems:1,totalUsersPages:1,usersPageOffset:0};let dg,yg,fg;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(dg||(dg={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(yg||(yg={})),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"}(fg||(fg={})),fg.profile,fg.privacy,fg.personalApiTokens,fg.account,fg.users,fg.groups,fg.security,fg.sso,fg.audits,fg.webhooks,fg.apiTokens,fg.roles,fg.subscriptions,fg.allAccounts;const pg=e=>{try{return new URL(e),!0}catch(e){return!1}},gg=e=>{const{searchParams:t}=new URL(e),n=t.toString();if(n)return`?${n}`},Sg=e=>{const t=new URLSearchParams(window.location.search).get(e);return null!=t?t:void 0},vg="tenantId",hg=e=>e.mfaRequired&&e.mfaToken?(Va.setAccessToken(null),Va.setUser(null),!0):(Va.setAccessToken(e.accessToken),Va.setUser(e),!1),mg=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,numberOfEmails:i,totalDevices:o}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length),o=+Boolean(e.emails.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,numberOfEmails:o,totalDevices:t+n+i+o}})(e);if(1===o){if(n)return un.authenticatorApp;if(t)return un.smsVerifyCode;if(i)return un.emailVerifyCode}return un.verify},Ag=e=>{if(1===e.length){const[t]=e;if(t===Bs.AuthenticatorApp)return un.authenticatorApp;if(t===Bs.SMS)return un.smsSetPhoneNumber;if(t===Bs.EmailCode)return un.emailVerifyCode}return un.verify};function*bg(e){let t=_t.loginWithTwoFactor,n={};const{loginState:i}=yield Ko((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield Bo(rp.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:mg(e.mfaDevices)}:(n={step:Ag(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=_t.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Lt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:D({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a,isBreachedPassword:e.isBreachedPassword})}}const Tg=(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 Eg;function kg(e,t){var n,i;null==(n=(i=window).onFronteggEvent)||n.call(i,e,t)}!function(e){e.SIGNUP_COMPLETED="signup_completed",e.USER_VERIFIED="user_verified"}(Eg||(Eg={}));const Ig=(e,t=[])=>Object.entries(e).reduce(((e,[n,i])=>"object"==typeof i?[...e,...Ig(i,[...t,n])]:[...e,{type:[...t,n].join("/"),payload:i}]),[]),Og=["callback"];function*Pg(){yield xo(ji.setCustomLoginState({loading:!0}));try{const e=yield Bo(rp.metadata.getAdminBoxMetadata);yield xo(ji.setCustomLoginState({tenantMetadata:e,loading:!1}))}catch(e){yield xo(ji.setCustomLoginState({loading:!1,error:Tg(e)}))}}function*_g(e){let{payload:{callback:t}}=e,n=to(e.payload,Og);try{yield xo(ji.setCustomLoginState({error:null,saving:!0}));const e=Ig(n);if(0===e.length)throw new Error("No changes to update");yield Bo(rp.metadata.updateAdminBoxMetadata,{actions:e});const i=yield Bo(rp.metadata.getAdminBoxMetadata);yield xo(ji.setCustomLoginState({tenantMetadata:i,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setCustomLoginState({error:Tg(e,"No changes to update"),saving:!1})),null==t||t(null,e)}}function*Lg(){var e,t,n;if(yield Ko((e=>e.auth.isAuthenticated))){var i;const e=yield null!=(i=Ko((({auth:e})=>{var t;return null==(t=e.tenantsState.activeTenant)?void 0:t.hasCustomLogin})))&&i;return e}return!!(null==(e=yield null==(t=Va.getContext())||null==(n=t.tenantResolver)?void 0:n.call(t))?void 0:e.tenant)}function*Ug(){try{var e;if(!(yield Bo(Lg)))return;const t=yield Ko((e=>e.auth.isAuthenticated)),{getSettings:n,getPublicSettings:i}=rp.accountSettings,{applicationUrl:o}=yield Bo(t?n:i);if(!o)return;const{routes:a}=yield Ko((e=>e.auth)),r=null!=(e=gg(o))?e:"";yield xo(ji.setState({routes:D({},a,{customLoginAuthenticatedUrl:o,customLoginUrl:a.loginUrl+r})})),yield xo(ji.setCustomLoginState({customLoginSearchParams:null!=r?r:void 0}))}catch{}}function*wg(){yield xa(ji.loadTenantMetadata,Pg),yield xa(ji.updateTenantMetadata,_g)}let Cg;!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"}(Cg||(Cg={}));const Rg=["callback"];function Dg(e){return function*(t){const[n]=yield Bo(Pp,["security-center-admin-portal-major-version"]);yield e(t),n&&(yield Ng(),yield Mg())}}function*Ng(){const e=Cg.RECOMMENDATIONS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{var t;const{recommendations:n,scoring:i}=yield Bo(rp.securityCenter.getRecommendations);yield xo(ji.setSecurityCenterState({recommendations:n.items,score:null!=(t=null==i?void 0:i.score)?t:0}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Mg(){const e=Cg.INSIGHTS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));try{const{insights:t}=yield Bo(rp.securityCenter.getInsights);yield xo(ji.setSecurityCenterState({insights:t.items}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*Fg(e){let{payload:{callback:t}}=e,n=to(e.payload,Rg);const i=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield xo(ji.setSecurityCenterStateError({key:i,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:i,value:!0}));try{yield Bo(rp.auth.forgotPassword,n),null==t||t(!0)}catch(e){yield xo(ji.setSecurityCenterStateError({key:i,value:Tg(e)})),null==t||t(!1,e)}finally{yield xo(ji.setSecurityCenterStateLoader({key:i,value:!1}))}}function*Gg({payload:{callback:e}}){const t=Cg.SEND_BULK_RESET_BREACHED_PASSWORD_EMAILS;yield xo(ji.setSecurityCenterStateError({key:t,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:t,value:!0}));try{yield Bo(rp.users.sendResetBreachedPasswordEmails),null==e||e(!0)}catch(n){yield xo(ji.setSecurityCenterStateError({key:t,value:Tg(n)})),null==e||e(!1)}finally{yield xo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}}function*$g({key:e,tableState:t,updateStateKey:n,_offset:i,_limit:o,_preset:a,_email:r,_maxInactiveSeconds:s}){var l,c,u,d;yield xo(ji.setSecurityCenterStateError({key:e,value:!1})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0}));const y=null!=(l=null!=i?i:null==t||null==(c=t.queryParams)?void 0:c._offset)?l:0,f=null!=(u=null!=o?o:null==t||null==(d=t.queryParams)?void 0:d._limit)?u:10,p=D({_offset:y,_limit:f,_includeSubTenants:!1,_preset:a,_maxInactiveSeconds:s},!!r&&{_email:r});try{const{items:t,_metadata:{totalItems:i,totalPages:o}}=yield Bo(rp.users.getUsersV3,p),a={totalUsersItems:i,totalUsersPages:o,usersPageOffset:y,queryParams:D({_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 Bo(rp.roles.getRoles),i=yield Bo(rp.users.getUsersRoles,{ids:t});return e.map((e=>{var t,o;const a=null==i||null==(t=i.find((t=>t.userId===e.id)))?void 0:t.roleIds;return D({},e,{roles:null!=(o=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?o:[]})}))}(t);yield xo(ji.setSecurityCenterState({[n]:D({users:e},a)}))}else yield xo(ji.setSecurityCenterState({[n]:D({users:[]},a)}))}catch(t){yield xo(ji.setSecurityCenterStateError({key:e,value:Tg(t)}))}finally{yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}}function*xg({payload:e}){var t;const n=Cg.BREACHED_PASSWORD_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.breachedPasswordUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"breachedPasswordUsersTable",_preset:pi.BREACHED_PASSWORDS,tableState:i},e))}function*Vg({payload:e}){var t;const n=Cg.UNENROLLED_MFA_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.unenrolledMfaUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"unenrolledMfaUsersTable",_preset:pi.MFA_UNENROLLED,tableState:i},e))}function*jg({payload:e}){var t;const n=Cg.INACTIVE_USERS_TABLE,i=yield null!=(t=Ko((e=>{var t;return null==(t=e.auth.securityCenterState)?void 0:t.inactiveUsersTable})))?t:{};yield $g(D({key:n,updateStateKey:"inactiveUsersTable",_preset:pi.INACTIVE,tableState:i},e))}function*Bg(){yield Ga(ji.loadRecommendations,Ng),yield Ga(ji.loadInsights,Mg),yield Ga(ji.sendResetBreachedPasswordEmail,Fg),yield Ga(ji.sendBulkResetBreachedPasswordEmails,Gg),yield Ga(ji.loadBreachedPasswordUsers,xg),yield Ga(ji.loadUnenrolledMfaUsers,Vg),yield Ga(ji.loadInactiveUsers,jg)}function*Wg(){const e=Cg.RECOMMENDATIONS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({recommendations:rg.recommendations.items,score:rg.scoring.score})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*zg(){const e=Cg.INSIGHTS;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({insights:sg.insights.items})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Kg(){const e=Cg.BREACHED_PASSWORD_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({breachedPasswordUsersTable:lg})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Hg(){const e=Cg.UNENROLLED_MFA_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({unenrolledMfaUsersTable:ug})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*qg(){const e=Cg.INACTIVE_USERS_TABLE;yield xo(ji.setSecurityCenterStateLoader({key:e,value:!0})),yield Ho(500),yield xo(ji.setSecurityCenterState({inactiveUsersTable:cg})),yield xo(ji.setSecurityCenterStateLoader({key:e,value:!1}))}function*Jg({payload:{callback:e}}){const t=Cg.SEND_BREACHED_PASSWORD_EMAIL;yield xo(ji.setSecurityCenterStateLoader({key:t,value:!0})),yield Ho(500),null==e||e(!0),yield xo(ji.setSecurityCenterStateLoader({key:t,value:!1}))}function*Yg(){yield Ga(ji.loadRecommendations,Wg),yield Ga(ji.loadInsights,zg),yield Ga(ji.loadBreachedPasswordUsers,Kg),yield Ga(ji.loadUnenrolledMfaUsers,Hg),yield Ga(ji.loadInactiveUsers,qg),yield Ga(ji.sendResetBreachedPasswordEmail,Jg)}const Xg=["callback"],Qg=["callback"],Zg=["callback"],eS=["callback"],tS=["callback"],nS=["callback"];function*iS(){yield xo(ji.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getGlobalSecurityPolicy);yield xo(ji.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyGlobalState({error:Tg(e),loading:!1}))}yield xo(ji.loadSecurityPolicyMfa()),yield xo(ji.loadSecurityPolicyVendorMfa()),yield xo(ji.loadSecurityPolicyLockout()),yield xo(ji.loadSecurityPolicyVendorLockout()),yield xo(ji.loadSecurityPolicyVendorPasswordHistory()),yield xo(ji.loadSecurityPolicyCaptcha()),yield xo(ji.loadPublicAuthStrategiesPolicy())}function*oS(e){var t,n;if(!(yield Bo(Lg)))return e;const i=yield Bo(rS);return null!=i&&null!=(t=i.mainAuthStrategies)&&null!=(n=t[0])&&n.strategy?D({},e,{authStrategy:i.mainAuthStrategies[0].strategy}):e}function*aS(){yield xo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e);yield xo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*rS(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getPublicAuthStrategiesConfigForAuthenticatedUser):yield Bo(rp.auth.getVendorPublicAuthStrategiesConfig),t}function*sS(){yield xo(ji.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{var e,t;const n=yield Bo(rS);yield function*(e){const t=yield Bo(Lg);if(!e||!t)return;const{policy:n}=yield Ko((({auth:e})=>{var t;return null==(t=e.securityPolicyState)?void 0:t.publicPolicy}));yield xo(ji.setSecurityPolicyPublicState({policy:D({},n,{authStrategy:e}),loading:!1}))}(null==n||null==(e=n.mainAuthStrategies)||null==(t=e[0])?void 0:t.strategy),yield xo(ji.setSecurityPolicyAuthStrategyPublicState({policy:n,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyAuthStrategyPublicState({error:Tg(e),loading:!1}))}}function*lS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getMfaPolicy);yield xo(ji.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyMfaState({error:Tg(e),loading:!1}))}}function*cS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorMfaPolicy);yield xo(ji.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorMfaState({error:Tg(e),loading:!1}))}}function*uS(e){let{payload:{callback:t}}=e,n=to(e.payload,Xg);yield xo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveMfaPolicy,n);yield xo(ji.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*dS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getLockoutPolicy);yield xo(ji.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyLockoutState({error:Tg(e),loading:!1}))}}function*yS(e){let{payload:{callback:t}}=e,n=to(e.payload,Qg);yield xo(ji.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.saveLockoutPolicy,n);yield xo(ji.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyLockoutState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*fS(){yield xo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorLockoutPolicy);yield xo(ji.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorLockoutState({error:Tg(e),loading:!1}))}}function*pS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCaptchaPolicy);yield xo(ji.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyCaptchaState({error:Tg(e),loading:!1}))}}function*gS(){yield xo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordHistoryPolicy);yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPasswordHistoryState({error:Tg(e),loading:!1}))}}function*SS(){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getVendorPasswordHistoryPolicy);yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({error:Tg(e),loading:!1}))}}function*vS(e){let{payload:{callback:t}}=e,n=to(e.payload,Zg);yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.savePasswordHistoryPolicy,n);yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*hS(){yield xo(ji.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getPasswordConfigPolicy);yield xo(ji.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPasswordState({error:Tg(e),loading:!1}))}}function*mS(){yield xa(ji.loadSecurityPolicy,iS),yield Ga(ji.saveSecurityPolicyMfa,Dg(uS)),yield Ga(ji.loadSecurityPolicyMfa,lS),yield Ga(ji.loadSecurityPolicyVendorMfa,cS),yield Ga(ji.saveSecurityPolicyLockout,Dg(yS)),yield Ga(ji.loadSecurityPolicyLockout,dS),yield Ga(ji.loadSecurityPolicyVendorLockout,fS),yield Ga(ji.loadSecurityPolicyCaptcha,pS),yield Ga(ji.saveSecurityPolicyPasswordHistory,Dg(vS)),yield Ga(ji.loadSecurityPolicyPasswordHistory,gS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,SS),yield Ga(ji.loadVendorPasswordConfig,hS),yield Ga(ji.loadPublicSecurityPolicy,aS),yield Ga(ji.loadPublicAuthStrategiesPolicy,sS)}function*AS(){yield xo(ji.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield xo(ji.setSecurityPolicyPublicState({policy:Np,loading:!1}))}catch(e){yield xo(ji.setSecurityPolicyPublicState({error:Tg(e),loading:!1}))}}function*bS(){yield xo(ji.setSecurityPolicyGlobalState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyGlobalState({policy:Dp,loading:!1})),yield xo(ji.loadSecurityPolicyMfa()),yield xo(ji.loadSecurityPolicyVendorMfa()),yield xo(ji.loadSecurityPolicyLockout()),yield xo(ji.loadSecurityPolicyVendorLockout()),yield xo(ji.loadSecurityPolicyPasswordHistory()),yield xo(ji.loadSecurityPolicyVendorPasswordHistory()),yield xo(ji.loadSecurityPolicyCaptcha())}function*TS(){yield xo(ji.setSecurityPolicyMfaState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyMfaState({policy:Mp,loading:!1}))}function*ES(){yield xo(ji.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorMfaState({policy:Mp,loading:!1}))}function*kS(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,eS);yield xo(ji.setSecurityPolicyMfaState({saving:!0,error:null}));const o=D({},Fp,{id:null!=(t=i.id)?t:Fp.id,enforceMFAType:i.enforceMFAType});yield Et(),yield xo(ji.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*IS(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*OS(){yield xo(ji.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorLockoutState({policy:Fp,loading:!1}))}function*PS(e){let{payload:{callback:t}}=e,n=to(e.payload,tS);yield xo(ji.setSecurityPolicyLockoutState({saving:!0,error:null})),yield Et();const i=D({},Fp,n,{id:n.id?n.id:Fp.id});null==t||t(i),yield xo(ji.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*_S(){yield xo(ji.setSecurityPolicyLockoutState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyLockoutState({policy:Fp,loading:!1}))}function*LS(){yield xo(ji.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:Gp,loading:!1}))}function*US(){yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield Et(),yield xo(ji.setSecurityPolicyVendorPasswordHistoryState({policy:Gp,loading:!1}))}function*wS(e){let{payload:{callback:t}}=e,n=to(e.payload,nS);yield xo(ji.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield Et();const i=D({},Gp,n,{id:n.id?n.id:Gp.id});null==t||t(i),yield xo(ji.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*CS(){yield xa(ji.loadSecurityPolicy,bS),yield Ga(ji.loadPublicSecurityPolicy,AS),yield Ga(ji.saveSecurityPolicyMfa,kS),yield Ga(ji.loadSecurityPolicyMfa,TS),yield Ga(ji.loadSecurityPolicyVendorMfa,ES),yield Ga(ji.saveSecurityPolicyLockout,PS),yield Ga(ji.loadSecurityPolicyLockout,IS),yield Ga(ji.loadSecurityPolicyVendorLockout,OS),yield Ga(ji.loadSecurityPolicyCaptcha,_S),yield Ga(ji.saveSecurityPolicyPasswordHistory,wS),yield Ga(ji.loadSecurityPolicyPasswordHistory,LS),yield Ga(ji.loadSecurityPolicyVendorPasswordHistory,US)}const RS=["phoneNumber"],DS=["events","url"];function*NS(){yield xo(ji.setSignUpState({loading:!0}));try{const e=yield Bo(rp.auth.getVendorConfig),t=yield oS(e),{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield xo(ji.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield xo(ji.setSecurityPolicyPublicState({policy:t,loading:!1}))}catch(e){yield xo(ji.setSignUpState({loading:!1,error:Tg(e),firstLoad:!1}))}}function*MS(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,DS);yield xo(ji.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:r}=yield Ko((e=>e.auth)),{shouldActivate:s,user:l,tenantId:c,userId:u,tenants:d=[],activeTenant:y}=yield Bo(rp.auth.signUpUser,(a=i,to(a,RS)));if(!i.invitationToken){var o;const{email:e,name:a,companyName:r,phoneNumber:s}=i,l={email:e,name:a,companyName:r,url:n,phoneNumber:s||void 0,authenticationType:yg.PASSWORD,id:u,tenantId:c,createdAt:new Date};null==t||null==(o=t.signUpComplete)||o.call(t,l),kg(Eg.SIGNUP_COMPLETED,l)}if(!s&&l&&hg(l)){const t=yield bg(l);yield xo(ji.setState(t)),r(e.loginUrl)}else{const{tenantsState:e}=yield Ko((e=>e.auth));yield xo(ji.setSignUpState({loading:!1,shouldActivate:s,stage:An.SignUpSuccess})),yield xo(ji.setState({user:l,isAuthenticated:!(null==l||!l.accessToken),tenantsState:D({},e,{tenants:d,activeTenant:y})}))}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setSignUpState({loading:!1,error:Tg(e)}))}var a;yield xo(ji.setSignUpState({loading:!1}))}function*FS(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield Ko((e=>e.auth.signUpState));yield xo(ji.resetSignUpState()),yield xo(ji.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*GS(){yield xa(ji.signUpUser,MS),yield xa(ji.resetSignUpStateSoft,FS)}const $S={setVendorState:(e,{payload:t})=>D({},e,t)},xS={loadVendorPublicInfo:yt("vendor/loadVendorPublicInfo")},VS={loading:!1},{reducer:jS,actions:BS}=pt({name:Ft,initialState:VS,reducers:D({},$S)}),WS=D({},BS,xS);function*zS(){yield xo(WS.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield rp.vendor.getVendorPublicInfo();yield xo(WS.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield xo(WS.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}var KS=n(378),HS=n.n(KS);function qS(e,t){return HS()(e,t)}function*JS({payload:e}){const t=null==e?void 0:e.callback,[n]=yield Bo(Pp,[Vr]);try{const e=yield Bo(n?rp.entitlements.loadEntitlementsV2:rp.entitlements.loadEntitlements);yield function*(e){qS(yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements})),e)||(yield xo(ji.setEntitlements(e)))}(e),null==t||t(!0)}catch(e){null==t||t(!1)}}function*YS(){yield xa(ji.loadEntitlements,JS)}var XS=new class{constructor(){this.loginWithSSO=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSSO",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSSO(e)}},this.loginWithSocialLogin=e=>{if(this.isWebkitAvailable()){var t,n,i;null==(t=window.webkit)||null==(n=t.messageHandlers)||null==(i=n.FronteggNativeBridge)||i.postMessage(JSON.stringify({action:"loginWithSocialLogin",payload:e}))}else{if(!this.isJsInterfaceAvailable())throw new Error("FronteggNativeBridge is not available");var o;null==(o=window.FronteggNativeBridge)||o.loginWithSocialLogin(e)}}}isWebkitAvailable(){var e,t;return null!=(null==(e=window.webkit)||null==(t=e.messageHandlers)?void 0:t.FronteggNativeBridge)}isJsInterfaceAvailable(){return null!=window.FronteggNativeBridge}isAvailable(e){var t,n;return!(!this.isWebkitAvailable()&&!this.isJsInterfaceAvailable())&&null!=(t=null==(n=window.FronteggNativeBridgeFunctions)?void 0:n[e])&&t}};function*QS(){const{publicAuthStrategyPolicy:e}=yield Ko((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===Vs.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield Bo(Pp,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);return yield xo(ji.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*ZS({user:e,tenants:t=[],activeTenant:n},i={}){const{tenantsState:o}=yield Ko((e=>e.auth));yield xo(ji.setState(D({user:e,tenantsState:D({},o,{tenants:t,activeTenant:n,loading:!1})},i)))}const ev=["otp","sms","hwk"],tv="SHOULD_STEP_UP";function*nv(e){const{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield Ko((e=>e.auth));if(e)return(e=>{const{pathname:t}=new URL(e),n=gg(e);return n?t+n:t})(e);const{authenticatedUrl:a,loginUrl:r,logoutUrl:s,socialLoginCallbackUrl:l,activateUrl:c}=t;let u=window.localStorage.getItem(Ct);u&&![r,s,l,c].includes(u)||(u=a);const d=(({authenticatedUrl:e,enforceRedirectToSameSite:t,allowedRedirectOrigins:n,includeQueryParam:i})=>{let o=e;const a=new URL(window.location.href).searchParams.get("redirectUrl");return a?t&&pg(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:u,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});return(y=d).startsWith(null==(f=window)?void 0:f.location.origin)?y.replace(null==(p=window)?void 0:p.location.origin,""):y;var y,f,p}function*iv(e,{customLoginAuthenticatedUrl:t,forceStepUpUrl:n,shouldStepUpDuringLogin:i}={}){const o=Va.onRedirectTo;let a;if(n)a=n;else{var r;if(i){const e=window.localStorage.getItem(Ct);e&&!pg(e)&&(a=e)}a||(a=yield Bo(nv,t)),null==(r=window)||r.localStorage.removeItem(Ct)}yield Ho(200),xo(e()),o(a,{refresh:a.startsWith("http")})}function*ov(){var e;const{routes:{customLoginAuthenticatedUrl:t,stepUpUrl:n}}=yield Ko((e=>e.auth)),i=null==(e=window)?void 0:e.localStorage.getItem(tv),o=yield Ko((({auth:e})=>e.user));var a;if(i&&(null==(a=window)||a.localStorage.removeItem(tv)),n&&i&&!(({amr:e=[],acr:t="",auth_time:n,maxAge:i}={})=>{if(i&&n&&!(Date.now()/1e3-n<=i))return!1;const o="http://schemas.openid.net/pape/policies/2007/06/multi-factor"===t,a=-1!==e.indexOf("mfa"),r=void 0!==ev.find((t=>e.indexOf(t)));return o&&a&&r})(o))return void(yield Bo(iv,ji.resetLoginState,{forceStepUpUrl:n}));let r=t;t||(yield Bo(Ug),r=yield Ko((e=>{var t;return null==(t=e.auth.routes)?void 0:t.customLoginAuthenticatedUrl}))),yield Bo(iv,ji.resetLoginState,{customLoginAuthenticatedUrl:r,shouldStepUpDuringLogin:!!i})}function*av(){yield Bo(iv,ji.resetStepUpState)}const rv=["callback"];function*sv(e,t,n){const{loginState:i}=yield Ko((e=>e.auth));let o={};if(!n){const t=i.flow===Lt.Login?_t.success:i.step;o={loginState:{flow:i.flow,quickLoginToRegister:i.quickLoginToRegister,loading:!1,step:t,error:void 0,tenants:e}}}return D({},o,{isAuthenticated:t})}function*lv(e,t){const{loginState:n}=yield Ko((e=>e.auth));if(n.flow!==Lt.Login)return;const[i]=yield Bo(Pp,["security-center-show-login-flows"]);i&&n.isBreachedPassword&&!e?yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):(yield Bo(QS))?yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield ov(),null==t||t(!0)}function*cv(e){yield av(),null==e||e(!0)}function*uv(e,t,n){let{callback:i}=e,o=to(e,rv);yield xo(t({loading:!0,error:void 0}));try{const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.loginWithMfaV2,o),s=!!e.accessToken,l=yield Bo(sv,a,s,n);if(yield Bo(ZS,{user:e,tenants:a,activeTenant:r},l),e.id&&localStorage.setItem("userId",e.id),yield xo(t({loading:!1,error:void 0})),n)return void(yield Bo(cv,i));yield Bo(lv,s,i)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(!1,e)}}function*dv({payload:e}){yield uv(e,ji.setLoginState,!1)}function*yv(){yield Bo(av)}function*fv(e){const{loginState:t}=yield Ko((e=>e.auth)),{step:n}=yield Ko((e=>e.auth.mfaState)),[i]=yield Bo(Pp,["security-center-show-login-flows"]);if(t.flow===Lt.Login)if(i&&t.isBreachedPassword&&!e)yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1}));else{const e=yield Bo(QS);n===un.smsVerifyCode&&e?yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})):yield ov()}}function*pv({user:e,tenants:t,activeTenant:n},i=!1){yield xo(ji.setUser(e)),yield xo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const o=!!e.accessToken;yield xo(ji.setState({isAuthenticated:o})),i?yield Bo(yv):yield Bo(fv,o)}const gv=["callback","deviceId"],Sv=["callback","deviceId"];function*vv(e,t){let{callback:n,deviceId:i}=e,o=to(e,gv);yield xo(t({loading:!1,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFASMSForLogin,i,o);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*hv(e,t,n=!1){let{callback:i,deviceId:o}=e,a=to(e,Sv);yield xo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFASMSForLoginV2,o,a);yield pv(e,n),yield xo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*mv({payload:e}){yield vv(e,ji.setLoginState)}function*Av({payload:e}){yield hv(e,ji.setLoginState,!1)}const bv=["callback","deviceId"],Tv=["callback","deviceId"];function*Ev(e,t){let{callback:n,deviceId:i}=e,o=to(e,bv);yield xo(t({loading:!0}));try{var a;const e=yield Bo(rp.auth.preVerifyMFAWebAuthnForLogin,i,o),r=D({},e.options,{challenge:Ot(e.options.challenge),allowCredentials:null==(a=e.options.allowCredentials)?void 0:a.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(t({loading:!1,error:void 0})),null==n||n({options:r,webauthnToken:e.webauthnToken})}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*kv(e,t,n){let{callback:i,deviceId:o}=e,a=to(e,Tv);yield xo(t({loading:!0}));try{const e=Pt(a.publicKey),r=yield Bo(rp.auth.verifyMFAWebAuthnForLoginV2,o,D({},a,{options:e}));yield pv(r,n),yield xo(t({loading:!1,error:void 0})),null==i||i(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==i||i(null)}}function*Iv({payload:e}){yield Ev(e,ji.setLoginState)}function*Ov({payload:e}){yield kv(e,ji.setLoginState,!1)}const Pv=["callback"],_v=["callback"];function*Lv(e,t){let{callback:n}=e,i=to(e,Pv);yield xo(t({loading:!0,error:void 0}));try{const e=yield Bo(rp.auth.preVerifyMFAEmailCode,i);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.emailVerifyCode})),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({error:Tg(e)})),null==n||n(null)}}function*Uv(e,t){let{callback:n}=e,i=to(e,_v);yield xo(t({loading:!0}));try{const e=yield Bo(rp.auth.verifyMFAEmailCodeV2,i);yield pv(e),yield xo(t({loading:!1,error:void 0})),null==n||n(!0)}catch(e){yield xo(t({loading:!1,error:Tg(e)})),null==n||n(null)}}function*wv({payload:e}){yield Lv(e,ji.setLoginState)}function*Cv({payload:e}){yield Uv(e,ji.setLoginState)}const Rv=["callback"],Dv=["callback"],Nv=["callback"],Mv=["callback"],Fv=["callback","events"],Gv=["callback"],$v=["callback"],xv=["callback"],Vv=["callback"],jv=["user"],Bv=["callback"],Wv=["callback"],zv=["callback"],Kv=["callback"],Hv=["callback"];function*qv(e){const t=yield Ko((e=>{var t;return null==(t=e.auth.user)?void 0:t.entitlements}));return qS(t,null==e?void 0:e.entitlements)?D({},e,{entitlements:t}):e}function*Jv(){let e;try{var t;const n=yield Bo(rp.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield xo(ji.setState({ssoACS:e}))}function*Yv(){try{const{isActive:e}=yield Bo(rp.auth.getSSOPublicConfiguration);yield xo(ji.setState({isSSOAuth:e}))}catch(e){console.error(e)}}function*Xv(e){var t;const{routes:n,loginState:i}=yield Ko((e=>e.auth)),o=null!=(t=localStorage.getItem("register-quick-login"))?t:i.quickLoginToRegister;return o&&"true"!==localStorage.getItem(`${e.id}-${o}`)&&!window.location.pathname.endsWith(n.logoutUrl)}function*Qv(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(Zv):yield Bo(th)}function*Zv(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield xo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(qv,n.user);yield Bo(ZS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:null,isAuthenticated:!1}))}}function*eh(){const{user:e}=yield Ko((e=>e.auth));if(null==e||!e.refreshToken)return Va.setAccessToken(null),Va.setUser(null),void(yield xo(ji.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield Bo(rp.auth.exchangeOAuthTokensV2,t),i=yield Bo(qv,n.user);yield Bo(ZS,D({},n,{user:i}),{isAuthenticated:!0})}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:null,isAuthenticated:!1}))}}function*th(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield xo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Xv(o),s=yield Bo(qv,o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield ih(n)}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*nh(){try{const t=Va.onRedirectTo,{routes:n,loginState:i}=yield Ko((e=>e.auth)),{user:o,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.refreshTokenV3);if(hg(o)){const e=yield bg(o);yield xo(ji.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else{const s=yield Bo(qv,o);if(yield Bo(QS))yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{isLoading:!1}),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Xv(o);yield Bo(ZS,{user:s,tenants:a,activeTenant:r},{loginState:D({},i,{quickLoginToRegister:t,flow:n?Lt.RegisterQuickLogin:Lt.Login}),isAuthenticated:!0}),yield ih(n)}}}catch(e){Va.setAccessToken(null),Va.setUser(null),yield xo(ji.setState({user:void 0,isAuthenticated:!1}))}}function*ih(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=Va.onRedirectTo,{routes:o,loginState:a}=yield Ko((e=>e.auth)),r=n.searchParams.get("invitationToken"),s=[o.socialLoginCallbackUrl,o.oidcRedirectUrl,o.samlCallbackUrl];r||s.push(o.loginUrl,o.signUpUrl),e?i(o.loginUrl):s.some((e=>e&&window.location.pathname.endsWith(e)))&&(a.isNewUser&&o.signUpSuccessUrl&&o.socialLoginCallbackUrl===window.location.pathname?i(o.signUpSuccessUrl,{refresh:o.signUpSuccessUrl.startsWith("http")}):yield ov())}function*oh({payload:{callback:e}}){try{const{ip:t}=yield Bo(rp.metadata.getCurrentUserIpMetadata);yield xo(ji.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*ah({payload:e}){const t=[];(yield Bo(Lg))?yield Bo(Qv):t.push(Bo(Qv)),e&&(yield xo(ji.setState({isLoading:!0})),yield xo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(sS)),t.push(Bo(Yv)),t.push(Bo(zS)),t.push(Bo(Jv)),t.push(Bo(Ug))),yield Vo(t),yield xo(ji.setState({isLoading:!1}))}function*rh({accessToken:e,user:t}){if(!e)return void(yield xo(ji.setState({user:void 0,isAuthenticated:!1})));const n=Va.onRedirectTo,{routes:i}=yield Ko((e=>e.auth));if(hg(t)){const e=yield bg(t);yield xo(ji.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*sh({payload:e}){const t=[];yield xo(ji.loadSocialLoginsConfigurationV2()),t.push(Bo(NS)),t.push(Bo(Yv)),t.push(Bo(zS)),t.push(Bo(Jv)),t.push(Bo(rh,e)),t.push(Bo(Ug)),yield Vo(t)}const lh=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*ch(){const e=yield Bo(rp.auth.silentOAuthRefreshTokenV2);if(null==e||!e.user)throw new Error("couldn't refresh user token with oauth service");yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}function*uh({payload:e}){const{disableSilentRefresh:t}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if("login"!==(null==e?void 0:e.prompt))try{if(t)throw new Error("silent refresh is disabled");yield ch()}catch(t){yield yh(e)}else yield yh(e)}function*dh({payload:{additionalParams:e,shouldRedirectToLogin:t,firstTime:n,loginDirectAction:i}}){var o;if(n){const{urlStrategy:e}=yield Ko((e=>({urlStrategy:e.root.urlStrategy}))),t=lh(e);if(yield xo(ji.setState({isLoading:!0})),(e=>"/oauth/callback"===e)(t))return}const{disableSilentRefresh:a}=yield Ko((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));if(i&&((e=e||{}).login_direct_action=btoa(JSON.stringify(i))),"login"!==(null==(o=e)?void 0:o.prompt))try{if(a)throw new Error("silent refresh is disabled");yield ch()}catch(n){if(!t)return void(yield xo(ji.setState({isLoading:!1})));yield yh(e)}else yield yh(e)}function*yh(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield Ko((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if(lh(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield xo(ji.setState({isLoading:!0}));const a=Ip(),r=Ip(),s=yield Bo(kp,r);localStorage.setItem(Rt,r);let l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`;yield Bo(Ug);const c=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));c&&(l.endsWith("/")&&(l=l.slice(0,-1)),l+=c);const u=`${Lr(n,"/oauth/authorize")}/oauth/authorize`,d=D({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var y;const e=yield null==(y=n.tenantResolver)?void 0:y.call(n);null!=e&&e.tenant&&(d.organization=e.tenant)}const f=Sg(vg);f&&(d.tenantId=f),i(`${u}?${new URLSearchParams(d).toString()}`,{refresh:!0})}function*fh({payload:e}){const t=localStorage.getItem(Rt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield Ko((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy})));let o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`;yield Bo(Ug);const a=yield Ko((e=>{var t;return null==(t=e.auth.customLoginState)?void 0:t.customLoginSearchParams}));a&&(o.endsWith("/")&&(o=o.slice(0,-1)),o+=a);const r={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield Bo(rp.auth.exchangeOAuthTokensV2,r);yield Bo(ZS,e,{isAuthenticated:!0,isLoading:!1})}catch(e){yield xo(ji.setState({isLoading:!1})),console.error("Failed to exchangeOAuthTokens",e)}finally{yield ov()}}function*ph(e){let{payload:{callback:t}}=e,n=to(e.payload,Rv);try{yield xo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.changePhoneNumberWithVerification,n);yield xo(ji.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:_t.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*gh(e){let{payload:{callback:t}}=e,n=to(e.payload,Dv);try{yield xo(ji.setLoginState({loading:!0})),yield Bo(rp.auth.verifyChangePhoneNumber,n),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1}))}}function*Sh(e){let{payload:{callback:t}}=e,n=to(e.payload,Nv);try{yield xo(ji.setLoginState({loading:!0}));const e=yield Bo(rp.auth.passwordlessPreLogin,D({},n,{type:Ii.SmsCode}));yield xo(ji.setLoginState({step:_t.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t(e)}}function*vh(e){let{payload:{callback:t}}=e,n=to(e.payload,Mv);try{let e;yield xo(ji.setLoginState({loading:!0})),function(e){return"email"in e}(n)&&(e=n.email);const i=yield Bo(rp.auth.passwordlessPreLogin,n),o=Pi[n.type];yield xo(ji.setLoginState({step:o,loading:!1,phoneNumber:null==i?void 0:i.phoneNumber,email:e,error:void 0})),null==t||t()}catch(e){yield xo(ji.setLoginState({error:Tg(e),loading:!1})),null==t||t()}}function*hh(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,Fv);try{yield xo(ji.setLoginState({loading:!0}));const{user:e,tenants:a=[],activeTenant:r}=yield Bo(rp.auth.passwordlessPostLoginV2,i),s=Va.onRedirectTo,{routes:l}=yield Ko((e=>e.auth));if(hg(e)){const t=yield bg(e);yield xo(ji.setState(t)),s(l.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield Ko((e=>e.auth));if(e.emailVerified){var o;const t={email:e.email,origin:dg.PASSWORDLESS,id:e.id,tenantId:e.tenantId,createdAt:new Date,name:e.name};null==n||null==(o=n.userVerified)||o.call(n,t),kg(Eg.USER_VERIFIED,t)}e.id&&localStorage.setItem("userId",e.id),yield Bo(ZS,{user:e,tenants:a,activeTenant:r}),yield xo(ji.setLoginState({error:void 0})),yield xo(ji.setState({isLoading:!1})),i.flow===Lt.Login?(yield Bo(QS))?(yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),s(l.loginUrl,{preserveQueryParams:!0})):(yield xo(ji.setState({isAuthenticated:!0})),yield ov()):s(l.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){yield xo(ji.setLoginState({error:Tg(e,"Failed to authenticate")}))}finally{yield xo(ji.setLoginState({loading:!1}))}}function*mh({payload:e}){try{yield xo(ji.setLoginState({loading:!0}));const{name:t}=yield Bo(rp.auth.verifyInviteToken,e);yield xo(ji.setLoginState({inviteTokenTenantName:t}))}catch(e){yield xo(ji.setLoginState({inviteTokenError:Tg(e,"We couldn't verify your invitation")}))}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Ah({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield xo(ji.setLoginState({loading:!0}));try{const o=yield Ko((({auth:{onRedirectTo:e}})=>e)),a=Sg(vg),{address:r,idpType:s}=yield Bo(rp.auth.preLoginV2,{email:e,tenantId:a});if(r){let t=r;if(s===cp.Oidc&&!t.includes("redirect_uri")){const{routes:{oidcRedirectUrl:e}}=yield Ko((({auth:{routes:e}})=>({routes:e})));t+=`&redirect_uri=${window.location.origin}${e}`}XS.isAvailable("loginWithSSO")?(XS.loginWithSSO(e),yield xo(ji.setLoginState({loading:!1,step:_t.redirectToSSO})),null==i||i()):(yield xo(ji.setLoginState({step:_t.redirectToSSO,loading:!1,ssoRedirectUrl:t})),setTimeout((()=>{o(t,{refresh:!0})}),2e3))}else yield bh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield bh({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*bh(e){let{callback:t}=e,n=to(e,Gv);const i=yield Ko((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Ii.EmailAndPassword?(yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t()):[Ii.MagicLink,Ii.Code,Ii.SmsCode].includes(null==i?void 0:i.authStrategy)?yield xo(ji.passwordlessPreLogin(D({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield xo(ji.setLoginState({step:_t.loginWithPassword,loading:!1})),null==t||t())}function*Th({payload:{callback:e}}){try{yield xo(ji.setLoginState({loading:!0}));const{options:t}=yield Bo(rp.auth.webAuthnCreateNewDeviceSession);t.user.id=Ot(t.user.id),t.challenge=Ot(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield xo(ji.setLoginState({error:Tg(t)})),null==e||e(null)}finally{yield xo(ji.setLoginState({loading:!1}))}}function*Eh(e){let{payload:{callback:t}}=e,n=to(e.payload,$v);try{yield xo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?js.Platform:js.CrossPlatform;yield Bo(rp.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setLoginState({loading:!1}))}}function*kh(e){let{payload:{callback:t}}=e,n=to(e.payload,xv);try{var i;yield xo(ji.setPasskeysState({loading:!0})),yield xo(ji.setLoginState({loading:!0}));const{options:e}=yield Bo(rp.auth.webAuthnPreLogin,n);e.challenge=Ot(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)}))),yield xo(ji.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setPasskeysState({loading:!1})),yield xo(ji.setLoginState({loading:!1}))}}function*Ih(e){let{payload:{callback:t}}=e,n=to(e.payload,Vv);try{var i;yield xo(ji.setPasskeysState({loading:!0})),yield xo(ji.setLoginState({loading:!0}));const e=Pt(n.publicKey),o=yield Bo(rp.auth.webAuthnPostLoginV2,D({},e,{response:D({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken})),{user:a}=o,r=to(o,jv);if(hg(a)){const e=Va.onRedirectTo,{routes:t}=yield Ko((e=>e.auth)),n=yield bg(a);yield xo(ji.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,D({user:a},r),{isAuthenticated:!0}),yield xo(ji.setLoginState({error:void 0})),yield ov(),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({error:Tg(e)})),null==t||t(null)}finally{yield xo(ji.setPasskeysState({loading:!1})),yield xo(ji.setLoginState({loading:!1}))}}function*Oh({payload:e}){const{onRedirectTo:t,routes:n}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield xo(ji.setLoginState({loading:!0}));try{const t=yield Bo(rp.auth.postLogin,e);yield xo(ji.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield ov()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield xo(ji.setLoginState({step:_t.loginWithSSOFailed,loading:!1}))}}function*Ph({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield xo(ji.setLoginState({loading:!0}));try{const{user:a,tenants:r=[],activeTenant:s}=yield Bo(rp.auth.loginv2,{email:e,password:t,recaptchaToken:n,invitationToken:i}),l=Va.onRedirectTo,{routes:c}=yield Ko((e=>e.auth));if(hg(a)){const e=yield bg(a);yield xo(ji.setState(e)),l(c.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield Ko((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield Bo(ZS,{user:a,tenants:r,activeTenant:s},{loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Lt.Login?_t.success:t.step,tenants:r,tenantsLoading:!0,isBreachedPassword:a.isBreachedPassword},isAuthenticated:n});const[i]=yield Bo(Pp,["security-center-show-login-flows"]);t.flow===Lt.Login&&(i&&a.isBreachedPassword&&!n?yield xo(ji.setLoginState({step:_t.breachedPassword,loading:!1})):n&&((yield Bo(QS))?(yield xo(ji.setLoginState({step:_t.promptPasskeys,loading:!1})),l(c.loginUrl,{preserveQueryParams:!0})):yield ov()))}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){Va.setAccessToken(null),Va.setUser(null),null==o||o(!1,t),yield xo(ji.setLoginState({email:e,error:Tg(t),loading:!1}))}}function*_h({payload:e}){yield xo(ji.setLoginState({loading:!0}));try{var t;yield Bo(rp.auth.recoverMfaToken,e),yield xo(ji.setLoginState({loading:!1,error:void 0,step:_t.preLogin})),yield xo(ji.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setLoginState({error:Tg(t),loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lh({payload:e}){const{hostedLoginBox:t}=yield Ko((e=>e.auth));yield xo(ji.setState({isLoading:!0}));try{t?yield Bo(rp.auth.OAuthLogout):yield Bo(rp.auth.logout)}catch{}yield xo(ji.resetState()),yield xo(ji.requestAuthorize(!0)),null==e||e()}function*Uh({payload:e}){var t;try{yield Bo(rp.auth.logout)}catch{}setTimeout((()=>{var t;return null==e||null==(t=e.callback)?void 0:t.call(e,!0)}),null!=(t=null==e?void 0:e.callbackTimeout)?t:500)}function*wh({user:e,tenants:t,activeTenant:n}){const i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield xo(ji.setMfaState(i)),yield xo(ji.setUser(e)),yield xo(ji.setTenantsState({tenants:t,activeTenant:n,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Ch(e){let{payload:{callback:t}}=e,n=to(e.payload,Bv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.preEnrollMFASMSForLogin,n);yield xo(ji.setMfaState({otcToken:e.otcToken,step:un.smsVerifyCode,phoneNumber:e.phoneNumber})),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Rh(e){let{payload:{callback:t}}=e,n=to(e.payload,Wv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFASMSForLoginV2,n);yield wh(e),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Dh(e){let{payload:{callback:t}}=e,n=to(e.payload,zv);yield xo(ji.setLoginState({loading:!0}));try{var i;const e=yield Bo(rp.auth.preEnrollMFAWebAuthnForLogin,n),o=D({},e.options,{challenge:Ot(e.options.challenge),user:D({},e.options.user,{id:Ot(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Nh(e){let{payload:{callback:t}}=e,n=to(e.payload,Kv);yield xo(ji.setLoginState({loading:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthnForLoginV2,D({},n,{options:e}));yield wh(i),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Mh(e){let{payload:{callback:t}}=e,n=to(e.payload,Hv);yield xo(ji.setLoginState({loading:!0}));try{const e=yield Bo(rp.auth.enrollMFAAuthenticatorAppForLoginV2,n);yield wh(e),yield xo(ji.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)})),null==t||t(null)}}function*Fh({payload:e}){yield xo(ji.setLoginState({loading:!0}));try{yield Bo(rp.auth.forgotPassword,e),yield xo(ji.setLoginState({loading:!1,error:void 0,step:_t.breachedPasswordSuccess})),yield xo(ji.setState({isAuthenticated:!1}))}catch(e){yield xo(ji.setLoginState({loading:!1,error:Tg(e)}))}}function*Gh(){yield xa(ji.requestAuthorize,ah),yield xa(ji.requestAuthorizeSSR,sh),yield xa(ji.requestHostedLoginAuthorize,uh),yield xa(ji.requestHostedLoginAuthorizeV2,dh),yield xa(ji.handleHostedLoginCallback,fh),yield xa(ji.preLogin,Ah),yield xa(ji.postLogin,Oh),yield xa(ji.login,Ph),yield xa(ji.logout,Lh),yield xa(ji.silentLogout,Uh),yield xa(ji.loginWithMfa,dv),yield xa(ji.recoverMfa,_h),yield xa(ji.quickSmsPasswordlessPreLogin,Sh),yield xa(ji.changePhoneNumberWithVerification,ph),yield xa(ji.verifyChangePhoneNumber,gh),yield xa(ji.passwordlessPreLogin,vh),yield xa(ji.passwordlessPostLogin,hh),yield xa(ji.verifyInviteToken,mh),yield xa(ji.webAuthnPrelogin,kh),yield xa(ji.webAuthnPostLogin,Ih),yield xa(ji.webAuthnCreateNewDeviceSession,Th),yield xa(ji.webAuthnVerifyNewDeviceSession,Eh),yield xa(ji.afterAuthNavigation,ov),yield xa(ji.getUserIP,oh),yield xa(ji.preEnrollMFASMSForLogin,Ch),yield xa(ji.enrollMFASMSForLogin,Rh),yield xa(ji.preEnrollMFAWebAuthnForLogin,Dh),yield xa(ji.enrollMFAWebAuthnForLogin,Nh),yield xa(ji.enrollMFAAuthenticatorAppForLogin,Mh),yield xa(ji.preVerifyMFASMSForLogin,mv),yield xa(ji.verifyMFASMSForLogin,Av),yield xa(ji.preVerifyMFAWebAuthnForLogin,Iv),yield xa(ji.verifyMFAWebAuthnForLogin,Ov),yield xa(ji.preVerifyMFAEmailCode,wv),yield xa(ji.verifyMFAEmailCode,Cv),yield xa(ji.resetBreachedPassword,Fh)}function*$h({payload:e}){e&&(yield xo(ji.setState({isLoading:!0})));const t=Cp;yield xo(ji.loadTenants()),yield xo(ji.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*xh({payload:{callback:e}}){try{const{ip:t}=ng[0];yield xo(ji.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*Vh(){yield xa(ji.requestAuthorize,$h),yield xa(ji.afterAuthNavigation,ov),yield xa(ji.getUserIP,xh)}const jh=["callback","samlVendor"],Bh=["callback","samlVendor"];function*Wh(){try{var e,t;yield xo(ji.setSSOState({loading:!0}));const n=yield Bo(rp.auth.getSamlConfiguration),i=yield Bo(rp.auth.getOidcConfiguration),o=yield Bo(rp.metadata.getSamlMetadata);n.acsUrl=null==o||null==(e=o.configuration)?void 0:e.acsUrl,n.spEntityId=null==o||null==(t=o.configuration)?void 0:t.spEntityId,n.isSamlActive=null==o?void 0:o.isActive,yield xo(ji.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield xo(ji.setSSOState({error:Tg(e),loading:!1}))}}function*zh({payload:e}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield xo(ji.setSSOState({error:void 0,[n]:!0}));try{const i=yield Op(e[0]),o=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield xo(ji.setSSOState({samlConfiguration:t,error:Tg(e),[n]:!1}))}}function*Kh({payload:e}){const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield xo(ji.setSSOState({error:void 0,[o]:!0}));try{const e=yield Op(t),a=yield Bo(rp.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield xo(ji.setSSOState({samlConfiguration:i,error:Tg(e),[o]:!1})),null==n||n(null,e)}}function*Hh({payload:e}){const{callback:t,samlVendor:n}=e,i=to(e,jh),o=yield Ko((e=>e.auth.ssoState.samlConfiguration)),a=D({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield xo(ji.setSSOState({samlConfiguration:D({},o,a)})));if(yield xo(ji.setSSOState({error:void 0,[r]:!0})),e.type===cp.Saml){var s,l;const e=yield Bo(rp.metadata.getSamlMetadata);a.acsUrl=null==e||null==(s=e.configuration)?void 0:s.acsUrl,a.spEntityId=null==e||null==(l=e.configuration)?void 0:l.spEntityId}const i=Ep(a,["validated","generatedVerification","createdAt","updatedAt"]);(null==o?void 0:o.domain)!==(null==i?void 0:i.domain)&&(i.ssoEndpoint="",i.publicCertificate="",i.signRequest=!1),i.type=null==n?void 0:n.toLowerCase();const c=yield Bo(rp.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield xo(ji.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield xo(ji.setSSOState({samlConfiguration:o,error:Tg(e),[r]:!1})),null==t||t(null,e)}}function*qh({payload:{callback:e}={}}){const t=yield Ko((e=>e.auth.ssoState.samlConfiguration));try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.validateSamlDomain),yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!1}),error:Tg(n),saving:!1})),null==e||e(null,n)}}function*Jh(){try{const e=yield Bo(rp.auth.getSamlRoles),t=yield Bo(rp.auth.getSamlRolesGroups);yield xo(ji.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield xo(ji.setSSOState({error:Tg(e)}))}}function*Yh({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield Vo(e.map((e=>Bo(rp.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield xo(ji.setSSOState({error:Tg(e)}))}}(n)),yield Jh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*Xh({payload:{callback:e,id:t}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.deleteSamlGroup,{id:t}),yield Jh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setSSOState({error:Tg(t),saving:!1})),null==e||e(null,t)}}function*Qh({payload:{group:e,roleIds:t,callback:n}}){try{yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Bo(rp.auth.createSamlGroup,{group:e,roleIds:t}),yield Jh(),yield xo(ji.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield xo(ji.setSSOState({error:Tg(e),saving:!1})),null==n||n(null,e)}}function*Zh({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield xo(ji.setSSOState({loading:!0})),yield Bo(rp.auth.oidcPostLoginV2,t),yield Bo(Qv),yield xo(ji.setSSOState({loading:!1}))}catch(e){yield xo(ji.setSSOState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*em(){yield Ga(ji.loadSSOConfigurations,Wh),yield Ga(ji.saveSSOConfigurations,Hh),yield Ga(ji.saveSSOConfigurationsFile,zh),yield Ga(ji.saveSSOConfigurationsFileWithCallback,Kh),yield Ga(ji.validateSSODomain,qh),yield Ga(ji.loadSSOAuthorizationRoles,Jh),yield Ga(ji.updateSSOAuthorizationRoles,Yh),yield Ga(ji.deleteSamlGroup,Xh),yield Ga(ji.createSamlGroup,Qh),yield Ga(ji.oidcPostlogin,Zh)}function*tm(){yield xo(ji.setSSOState({loading:!0})),yield Et(),yield xo(ji.setSSOState({samlConfiguration:$p,loading:!1,firstLoad:!1}))}function*nm({payload:e}){const t="saving";yield xo(ji.setSSOState({error:void 0,[t]:!0}));const n=D({},yield Ko((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield xo(ji.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*im({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=to(e,Bh),r=jp.samlConfiguration,s=D({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield xo(ji.setSSOState({samlConfiguration:D({},r,s)})));yield xo(ji.setSSOState({error:void 0,[l]:!0})),yield Et(),s.acsUrl=null==xp||null==(t=xp.configuration)?void 0:t.acsUrl,s.spEntityId=null==xp||null==(n=xp.configuration)?void 0:n.spEntityId;const c=Ep(s,["validated","generatedVerification","createdAt","updatedAt"]);(null==r?void 0:r.domain)!==(null==c?void 0:c.domain)&&(c.ssoEndpoint="",c.publicCertificate="",c.signRequest=!1),c.type=null==o?void 0:o.toLowerCase(),yield Et(),yield xo(ji.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*om({payload:{callback:e}={}}){const t=jp.samlConfiguration;yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield xo(ji.setSSOState({samlConfiguration:D({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*am(){yield Et(),yield xo(ji.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*rm({payload:{callback:e,authorizationRoles:t}}){yield xo(ji.setSSOState({error:void 0,saving:!0})),yield Et(),yield xo(ji.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*sm(){yield Ga(ji.loadSSOConfigurations,tm),yield Ga(ji.saveSSOConfigurations,im),yield Ga(ji.saveSSOConfigurationsFile,nm),yield Ga(ji.validateSSODomain,om),yield Ga(ji.loadSSOAuthorizationRoles,am),yield Ga(ji.updateSSOAuthorizationRoles,rm)}const lm=["callback"],cm=["callback","ssoConfigId"],um=["callback","ssoConfigId"],dm=["callback","ssoConfigId"];function*ym(){try{return yield Bo(rp.auth.getOidcConfiguration)}catch(e){return null}}function*fm(){try{return yield Bo(rp.metadata.getSamlMetadata)}catch(e){return null}}function*pm(){try{yield xo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield Vo([Bo(ym),Bo(fm)]),n=yield Bo(rp.auth.getSSOConfigurations);yield xo(ji.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield xo(ji.setSSOError({key:lp.LOAD_SSO_CONFIGURATIONS,value:Tg(e)}))}finally{yield xo(ji.setSSOLoader({key:lp.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*gm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=to(e,lm),i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield Bo(rp.auth.createSSOConfiguration,D({},n,{enabled:null!=(o=n.enabled)&&o}));yield xo(ji.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Sm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Op(t),o=yield Bo(rp.auth.createSSOConfigurationByMetadata,{metadata:e});yield xo(ji.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*vm({payload:e}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,cm),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*hm({payload:e}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Op(i),a=yield Bo(rp.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield xo(ji.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_CONFIGURATION,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*mm({payload:e}){yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSOConfiguration,t),yield xo(ji.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield xo(ji.setSSOError({key:lp.DELETE_SSO_CONFIGURATION,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Am({payload:e}){const{callback:t,ssoConfigId:n}=e,i=to(e,um);yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Bo(rp.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?D({},t,{domains:[...t.domains,e]}):t));yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_DOMAIN,value:!1}))}}function*bm({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?D({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield xo(ji.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield xo(ji.setSSOError({key:lp.DELETE_SSO_DOMAIN,value:Tg(e)})),null==i||i(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.DELETE_SSO_DOMAIN,value:!1}))}}function*Tm({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield xo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?D({},e,{domains:e.domains.map((e=>e.id===n?D({},e,{validated:!0}):e))}):e));yield xo(ji.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield xo(ji.setSSOError({key:lp.VALIDATE_SSO_DOMAIN,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Em({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Bo(rp.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?D({},e,{roleIds:n}):e));yield xo(ji.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield xo(ji.setSSOError({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:Tg(t)})),null==e||e(null,t)}finally{yield xo(ji.setSSOLoader({key:lp.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*km({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!0}));const o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{yield Vo(t.map((e=>Bo(rp.auth.deleteSSOGroup,n,e)))),yield Vo(e.map((e=>Bo(rp.auth.createSSOGroup,n,e))));const a=yield Bo(rp.auth.getSSOGroups,n),r=o.map((e=>e.id===n?D({},e,{groups:a}):e));yield xo(ji.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==i||i(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Im({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield Vo(t.map((t=>Bo(rp.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield xo(ji.setSSOError({key:lp.SAVE_SSO_GROUPS,value:Tg(e)})),null==n||n(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_GROUPS,value:!1}))}}function*Om({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{const e={url:t,configMetadata:n};let r,s;i?(r=yield Bo(rp.auth.updateSSOConfigurationByMetadataUrl,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield Bo(rp.auth.createSSOConfigurationByMetadataUrl,e),s=[r,...a]),yield xo(ji.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Pm({payload:e}){yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=to(e,dm),o=yield Ko((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield Bo(rp.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield Bo(rp.auth.createSSOConfiguration,i),a=[e,...o]),yield xo(ji.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield xo(ji.setSSOLoader({key:lp.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*_m(){yield Ga(ji.loadSSOConfigurationsV2,pm),yield Ga(ji.saveSSOConfigurationV2,gm),yield Ga(ji.saveSSODomain,Am),yield Ga(ji.deleteSSODomain,bm),yield Ga(ji.validateSSODomainV2,Tm),yield Ga(ji.updateSSOConfiguration,vm),yield Ga(ji.deleteSSOConfiguration,mm),yield Ga(ji.setSSOGroups,km),yield Ga(ji.updateSSOGroups,Im),yield Ga(ji.setSSODefaultRoles,Em),yield Ga(ji.saveSSOConfigurationByMetadata,Sm),yield Ga(ji.updateSSOConfigurationByMetadata,hm),yield Ga(ji.saveSSOConfigurationByUrl,Om),yield Ga(ji.saveSSOConfigurationByData,Pm)}const Lm=["callback","profilePictureUrl"],Um=["callback","profilePictureUrl"];function*wm(){yield xo(ji.setProfileState({loading:!0}));try{const e=yield function(e,t,n){for(var i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return Bo.apply(void 0,[Fa,e,t,n].concat(o))}(3,2e3,rp.teams.getProfile),t=yield Ko((e=>e.auth.user));ji.setUser(D({},t,e)),yield xo(ji.setProfileState({profile:e,loading:!1}))}catch(e){yield xo(ji.setProfileState({loading:!1,error:Tg(e)}))}}function*Cm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,Lm);yield xo(ji.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield Ko((e=>e.auth.profileState.profile));let o=e.profilePictureUrl;if(n!==e.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)){const e=function(e,t="file"){const n=e.match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/);if(null==n)return null;const i=`image/${n[1]}`,o=function(e,t){const n=atob(e),i=[];for(let e=0;e<n.length;e+=512){const t=n.slice(e,e+512),o=new Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);i.push(new Uint8Array(o))}return new Blob(i,{type:t})}(n[2],i),a=new FormData;return a.append(t,new File([o],t,{type:i})),a}(n,"image");if(e){o=yield Bo(rp.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=D({},e,i,{profilePictureUrl:o}),r=yield Bo(rp.users.updateUserProfileV2,a),s=yield Ko((e=>e.auth.user));yield xo(ji.setUser(D({},s,r))),yield xo(ji.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield xo(ji.setProfileState({saving:!1,error:Tg(e),loading:!1})),null==t||t(null,e)}}function*Rm({payload:e}){yield xo(ji.setProfileState({loading:!0}));try{var t;yield Bo(rp.teams.changePassword,e),yield xo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setProfileState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*Dm(){yield xa(ji.loadProfile,wm),yield Ga(ji.saveProfile,Cm),yield Ga(ji.changePassword,Rm)}function*Nm(){yield xo(ji.setProfileState({loading:!0})),yield Et(),yield xo(ji.setUser(D({},Cp,wp))),yield xo(ji.setProfileState({loading:!1,profile:wp}))}function*Mm(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=to(e.payload,Um);yield xo(ji.setProfileState({saving:!0,error:null}));const o=Rp;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=D({},o.profile,i,{profilePictureUrl:a}),s=Cp;yield Et(),yield xo(ji.setUser(D({},s,r))),yield xo(ji.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*Fm({payload:e}){var t;yield xo(ji.setProfileState({loading:!0})),yield Et(),yield xo(ji.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Gm(){yield xa(ji.loadProfile,Nm),yield Ga(ji.saveProfile,Mm),yield Ga(ji.changePassword,Fm)}const $m=["callback"],xm=["callback"],Vm=["user"],jm=["callback"],Bm=["deviceId","callback"],Wm=["deviceId","callback"],zm=["callback"],Km=["deviceId"],Hm=["deviceId"],qm=["callback"],Jm=["deviceId"],Ym=["callback"];function*Xm(e){const{step:t}=yield Ko((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*Qm(){yield xo(ji.setMfaState({saving:!0}));try{const{qrCode:e}=yield Bo(rp.auth.enrollMfa);yield xo(ji.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)}))}}function*Zm(e){let{payload:{callback:t}}=e,n=to(e.payload,$m);yield xo(ji.setMfaState({saving:!0}));try{const e=yield Ko((e=>e.auth.user)),i=yield Bo(rp.auth.verifyMfa,n),o=yield Bo(rp.auth.getMFADevices),a=yield Xm(i);yield xo(ji.setMfaState(D({},a,{mfaDevices:o}))),yield xo(ji.setUser(D({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*eA(e){let{payload:{callback:t}}=e,n=to(e.payload,xm);yield xo(ji.setMfaState({loading:!0}));try{const e=yield Bo(rp.auth.loginWithMfaV2,n),{user:i}=e,o=to(e,Vm),a={step:un.recoveryCode,loading:!1,saving:!1,error:void 0};null!=i&&i.recoveryCode&&(a.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(a)),yield ZS(D({user:i},o)),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*tA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t;yield Bo(rp.auth.disableMfa,e);const n=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*nA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t,n;const i=yield Bo(rp.auth.preEnrollMFAWebAuthn),o=D({},i.options,{challenge:Ot(i.options.challenge),user:D({},i.options.user,{id:Ot(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(i=e.callback)||i.call(e,null,t)}}function*iA(e){let{payload:{callback:t}}=e,n=to(e.payload,jm);yield xo(ji.setMfaState({saving:!0}));try{const e=Pt(n.publicKey),i=yield Bo(rp.auth.enrollMFAWebAuthn,D({},n,{options:e})),o=yield Bo(rp.auth.getMFADevices),a=yield Xm(i);yield xo(ji.setMfaState(D({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*oA(e){let{payload:{deviceId:t,callback:n}}=e;to(e.payload,Bm),yield xo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFAWebAuthn,t),o=D({},e.options,{challenge:Ot(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>D({},e,{id:Ot(e.id)})))});yield xo(ji.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(null,e)}}function*aA(e){let{payload:{deviceId:t,callback:n}}=e,i=to(e.payload,Wm);yield xo(ji.setMfaState({saving:!0}));try{const e=Pt(i.publicKey);yield Bo(rp.auth.disableMFAWebAuthn,t,D({},i,{options:e}));const o=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==n||n(!1,e)}}function*rA({payload:e}){yield xo(ji.setMfaState({saving:!0}));try{var t;const n=yield Bo(rp.auth.preEnrollMFASMS,e);yield xo(ji.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 xo(ji.setMfaState({saving:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,!1,t)}}function*sA(e){let{payload:{callback:t}}=e,n=to(e.payload,zm);yield xo(ji.setMfaState({saving:!0}));try{const e=yield Bo(rp.auth.enrollMFASMS,n),i=yield Bo(rp.auth.getMFADevices),o=yield Xm(e);yield xo(ji.setMfaState(D({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*lA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Km);yield xo(ji.setMfaState({saving:!0}));try{var i;const e=yield Bo(rp.auth.preDisableMFASMS,t);yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:e.otcToken,phoneNumber:e.phoneNumber})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*cA(e){let{payload:{deviceId:t}}=e,n=to(e.payload,Hm);yield xo(ji.setMfaState({saving:!0}));try{var i;yield Bo(rp.auth.disableMFASMS,t,n);const e=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(o=n.callback)||o.call(n,!1,e)}}function*uA(){yield xo(ji.setMfaState({loading:!0}));try{yield Ko((e=>e.auth.user));const e=yield Bo(rp.auth.getMFADevices);yield xo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*dA(){yield xo(ji.setMfaState({loading:!0}));try{const e=(yield Bo(rp.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield xo(ji.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield xo(ji.setMfaState({loading:!1,error:Tg(e)}))}}function*yA(){yield Ga(ji.enrollMfa,Qm),yield Ga(ji.getMFADevices,uA),yield Ga(ji.getMFAStrategies,dA),yield Ga(ji.verifyMfa,Zm),yield Ga(ji.disableMfa,tA),yield Ga(ji.verifyMfaAfterForce,eA),yield Ga(ji.preDisableMfaSms,lA),yield Ga(ji.disableMfaSms,cA),yield Ga(ji.preEnrollMfaSms,rA),yield Ga(ji.enrollMfaSms,sA),yield Ga(ji.preEnrollMfaWebAuthn,nA),yield Ga(ji.enrollMfaWebAuthn,iA),yield Ga(ji.preDisableMfaWebAuthn,oA),yield Ga(ji.disableMfaWebAuthn,aA)}function*fA(){yield xo(ji.setMfaState({saving:!0})),yield xo(ji.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*pA({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et();const n={token:"token",recoveryCode:"recoveryCode"},i={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield xo(ji.setMfaState(i)),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*gA(e){let{payload:{callback:t}}=e,n=to(e.payload,qm);yield xo(ji.setMfaState({loading:!0})),yield Et();const i=D({},n,{recoveryCode:"recoveryCode"}),o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(o)),yield Et(),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*SA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({saving:!1,error:void 0,mfaDevices:D({},n,{authenticators:[]})})),yield xo(ji.setUser(D({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*vA(e){let{}=e,t=to(e.payload,Jm);yield xo(ji.setMfaState({saving:!0}));try{var n;yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield xo(ji.setMfaState({saving:!1,error:Tg(e)})),null==(i=t.callback)||i.call(t,!1,e)}}function*hA({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({loading:!1,error:void 0,mfaDevices:D({},n,{phones:[]})})),yield xo(ji.setUser(D({},Cp))),null==(t=e.callback)||t.call(e,!0)}function*mA({payload:e}){var t;yield xo(ji.setMfaState({saving:!0})),yield Et(),yield xo(ji.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*AA(e){let{payload:{callback:t}}=e;to(e.payload,Ym);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[],emails:[]}}=yield Ko((e=>e.auth.mfaState));yield xo(ji.setMfaState({saving:!0})),yield Et();const i={token:"token",recoveryCode:"recoveryCode"},o={step:un.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:D({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield xo(ji.setMfaState(o)),yield xo(ji.setUser(D({},Cp,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*bA(){yield Ga(ji.enrollMfa,fA),yield Ga(ji.verifyMfa,pA),yield Ga(ji.disableMfa,SA),yield Ga(ji.verifyMfaAfterForce,gA),yield Ga(ji.preDisableMfaSms,vA),yield Ga(ji.disableMfaSms,hA),yield Ga(ji.preEnrollMfaSms,mA),yield Ga(ji.enrollMfaSms,AA)}const TA=["callback"];function*EA({payload:e}){yield xo(ji.setForgotPasswordState({loading:!0}));try{var t;yield Bo(rp.auth.forgotPassword,e),yield xo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(t,"Unknown error occurred")})),null==(n=e.callback)||n.call(e,!1,t)}}function*kA(e){let{payload:{callback:t}}=e,n=to(e.payload,TA);yield xo(ji.setForgotPasswordState({loading:!0}));try{yield Bo(rp.auth.resetPassword,n),yield xo(ji.setForgotPasswordState({loading:!1,error:void 0,step:Jt.success})),null==t||t(!0)}catch(e){yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(e)})),null==t||t(!1,e)}}function*IA({payload:e}){yield xo(ji.setForgotPasswordState({loading:!0}));try{const t=yield Bo(rp.auth.loadPasswordConfig,e);yield xo(ji.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield xo(ji.setForgotPasswordState({loading:!1,error:Tg(e)}))}}function*OA(){yield xa(ji.forgotPassword,EA),yield xa(ji.resetPassword,kA),yield xa(ji.loadPasswordConfig,IA)}let PA;!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"}(PA||(PA={}));const _A=["callback","events"],LA=["user"],UA=["callback"],wA=["callback"];function*CA({payload:{userId:e,token:t}}){yield xo(ji.setActivateState({loading:!0,step:Vt.activating}));try{const{isAuthenticated:n}=yield Ko((e=>e.auth));n&&(yield xo(ji.silentLogout()));const i=yield Bo(rp.auth.getActivateAccountStrategy,{userId:e,token:t});yield xo(ji.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield xo(ji.setActivateState({loading:!1,step:Vt.activatingForm})))}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*RA(e){let{payload:{callback:t,events:n}}=e,i=to(e.payload,_A);yield xo(ji.setActivateState({loading:!0}));try{const e=Va.onRedirectTo,{routes:a}=yield Ko((e=>e.auth)),r=yield Bo(rp.auth.activateAccountV2,i),{user:s}=r,l=to(r,LA);if(s.redirectLocation)return void(window.location.href=s.redirectLocation);if(hg(s)){yield xo(ji.setActivateState({step:Vt.success}));const t=yield bg(s);yield xo(ji.setState(t)),yield Ho(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield xo(ji.setActivateState({step:Vt.success}));const e={email:s.email,origin:dg.ACTIVATION_LINK,id:s.id,tenantId:s.tenantId,name:s.name,createdAt:new Date};null==n||null==(o=n.userVerified)||o.call(n,e),kg(Eg.USER_VERIFIED,e),yield Bo(ZS,D({user:s},l),{isAuthenticated:!0}),yield Ho(1e3),yield ov(),yield xo(ji.resetActivateState())}null==t||t(!0)}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)}))}}function*DA({payload:e}){const{callback:t}=e,n=to(e,UA);yield xo(ji.setActivateStrategyState({loading:!0}));try{const e=yield Bo(rp.auth.getActivateAccountStrategy,n);yield xo(ji.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield xo(ji.setActivateStrategyState({loading:!1,error:Tg(e)}))}}function*NA({payload:e}){const{callback:t}=e,n=to(e,wA);yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.email})),yield xo(ji.setActivateState({loading:!0}));try{yield Bo(rp.auth.resendActivationEmail,n),yield xo(ji.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield xo(ji.setActivateState({loading:!1,error:Tg(e)})),yield xo(ji.setTeamError({key:PA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*MA(){yield xa(ji.activateAccount,RA),yield xa(ji.preActivateAccount,CA),yield xa(ji.getActivateAccountStrategy,DA),yield xa(ji.resendActivationEmail,NA)}function*FA({payload:e}){if(e.token&&e.userId)try{yield xo(ji.setAcceptInvitationState({error:void 0,step:zt.pending})),yield Bo(rp.auth.acceptInvitation,e),yield xo(ji.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:zt.success}}))}catch(e){yield xo(ji.setAcceptInvitationState({step:zt.failed,error:Tg(e)}))}else yield xo(ji.setAcceptInvitationState({error:void 0,step:zt.invalid}))}function*GA(){yield xa(ji.acceptInvitation,FA)}var $A,xA=new Uint8Array(16);function VA(){if(!$A&&!($A="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 $A(xA)}for(var jA=/^(?:[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,BA=function(e){return"string"==typeof e&&jA.test(e)},WA=[],zA=0;zA<256;++zA)WA.push((zA+256).toString(16).substr(1));var KA=function(e,t,n){var i=(e=e||{}).random||(e.rng||VA)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=i[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(WA[e[t+0]]+WA[e[t+1]]+WA[e[t+2]]+WA[e[t+3]]+"-"+WA[e[t+4]]+WA[e[t+5]]+"-"+WA[e[t+6]]+WA[e[t+7]]+"-"+WA[e[t+8]]+WA[e[t+9]]+"-"+WA[e[t+10]]+WA[e[t+11]]+WA[e[t+12]]+WA[e[t+13]]+WA[e[t+14]]+WA[e[t+15]]).toLowerCase();if(!BA(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let HA,qA;!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"}(HA||(HA={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(qA||(qA={}));const JA=["callback"],YA=["roles"],XA=["callback"],QA=["callback","profileImage"],ZA=["callback"],eb=["callback","userId"],tb=["callback"],nb=["callback"],ib=["callback"],ob=["callback"],ab=["callback"],rb=["callback"],sb=["callback"],lb=["callback"],cb=["callback"],ub=["callback","profileImage"],db=["callback"],yb=["callback"],fb=["callback"],pb=["callback"],gb=["callback"],Sb=["callback"],vb=["callback"],hb=["callback"],mb=()=>Ko((e=>e.auth.teamState));function*Ab(){try{const{groups:e}=yield Bo(rp.groups.getGroups,{_groupsRelations:qA.roles});return e}catch(e){return[]}}function*bb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield mb(),c=null!=(t=e.pageSize)?t:l.pageSize,u=null!=(n=e.pageOffset)?n:l.pageOffset,d=null!=(i=e.filter)?i:l.filterV2,y=null!=(o=e.sort)?o:l.sortV2,f=null!=(a=null==e?void 0:e.shouldShowSubTenantUsersIfReseller)?a:null==l?void 0:l.shouldShowSubTenantUsersIfReseller;yield xo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield xo(ji.setTeamState({pageSize:c,pageOffset:u,filterV2:d,sortV2:y}));try{const[{items:t,_metadata:{totalPages:n,totalItems:i}},{items:o},{items:a},r]=yield Vo([Bo(rp.users.getUsersV2,D({},(null==d?void 0:d.length)&&{_filter:d},y&&{_sortBy:y},e.order&&{_order:e.order},{_offset:u,_limit:c,_includeSubTenants:f})),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions),Bo(Ab)]),l=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 D({},e,{groups:n})}));yield xo(ji.setTeamState({users:l.map((e=>D({},e,{roleIds:e.roles.map((e=>e.id))}))),totalPages:n,totalItems:i,roles:o,permissions:a})),null==s||s(t)}catch(e){yield xo(ji.setTeamError({key:PA.USERS,value:Tg(e)})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield xo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*Tb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield mb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filter,d=null!=(o=e.sort)?o:s.sort;yield xo(ji.setTeamLoader({key:PA.USERS,value:!a})),yield xo(ji.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o}]=yield Vo([Bo(rp.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({users:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield xo(ji.setTeamError({key:PA.USERS,value:e.message})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield xo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*Eb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield mb(),c={_limit:(null!=(t=e._limit)?t:l.allUsersQueryParams._limit)||20,_offset:(null!=(n=e._offset)?n:l.allUsersQueryParams._offset)||0,_filter:(null!=(i=e._filter)?i:l.allUsersQueryParams._filter)||"",_sortBy:(null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy)||"name",_order:(null!=(a=e._order)?a:l.allUsersQueryParams._order)||"DESC"};yield xo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield xo(ji.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield Vo([Bo(rp.subTenants.loadAllUsers,D({},c)),Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield xo(ji.setTeamError({key:PA.USERS,value:Tg(e)})),yield xo(ji.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield xo(ji.setTeamLoader({key:PA.USERS,value:!1}))}function*kb({payload:e}){yield xo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield Vo([Bo(rp.teams.loadAvailableRoles),Bo(rp.teams.loadAvailablePermissions)]);yield xo(ji.setTeamState({roles:n,permissions:i})),null==e||null==(t=e.callback)||t.call(e,{roles:n,permissions:i})}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,null,t),yield xo(ji.setTeamError({key:PA.ROLES_AND_PERMISSIONS,value:Tg(t)}))}yield xo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0}))}function*Ib({payload:e}){const{callback:t}=e,n=to(e,JA),i=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield Bo(rp.teams.addUser,n),{roles:a}=e,r=D({},to(e,YA),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield xo(ji.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Ob({payload:e}){const{callback:t}=e,n=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>D({email:t,roleIds:e.roleIds},e.expirationInSeconds&&{expirationInSeconds:e.expirationInSeconds})));yield xo(ji.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield Bo(rp.teams.addUser,t),i.push(t.email)}catch(e){o.push(t.email)}}const r={pageOffset:0,pageSize:10,filter:"",silentLoading:e.emails.length>0};yield xo(ji.loadUsersV2(r)),yield xo(ji.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*Pb({payload:e}){const{callback:t}=e,n=to(e,XA),i=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield Bo(rp.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield xo(ji.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*_b({payload:e}){const{callback:t}=e,n=to(e,QA),{id:i}=n,o=yield mb(),a=o.users.find((e=>e.id===n.id));yield xo(ji.setTeamLoader({key:PA.UPDATE_USER,value:i||""})),yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})})),yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?D({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield Bo(rp.teams.updateUser,n);null==t||t(e),yield xo(ji.setTeamState({users:o.users.map((t=>t.id===e.id?D({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield xo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1}))}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Tg(e)}),users:o.users.map((e=>e.id===n.id?D({},e,a):e))})),yield xo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1})),null==t||t(null,e)}}function*Lb({payload:e}){const{callback:t}=e,n=to(e,ZA),i=yield mb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.teams.deleteUser,n),null==t||t(!0),yield xo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Ub({payload:e}){const{callback:t,userId:n}=e,i=to(e,eb),o=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return D({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield xo(ji.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[D({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield xo(ji.setTeamState({addUserDialogState:D({},o.addUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*wb({payload:e}){const{callback:t}=e,n=to(e,tb),i=yield mb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})}));try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield xo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!1,error:Tg(e)})})),null==t||t(null,e)}}function*Cb({payload:e}){const{callback:t}=e,n=to(e,nb);yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield Bo(rp.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.RESEND_ACTIVATE_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*Rb({payload:e}){const{callback:t}=e,n=to(e,ib);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Db({payload:e}){const{callback:t}=e,n=to(e,ob);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Nb({payload:e}){const{callback:t}=e,n=to(e,ab);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email}));try{yield Bo(rp.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.RESEND_INVITATION_LINK,value:Tg(e)})),null==t||t(null,e)}yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*Mb(){yield xo(ji.setTeamError({key:PA.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield Bo(rp.teams.getInviteLinkConfiguration);yield xo(ji.setTeamState({inviteTokenState:D({},e)}))}catch(e){yield xo(ji.setTeamError({key:PA.CONFIG_TOKEN_LINK,value:Tg(e)}))}}function*Fb(){yield xo(ji.setTeamError({key:PA.CONFIG_TEMPORARY_USERS,value:!1}));try{const e=yield Bo(rp.teams.getTemporaryUserConfiguration);yield xo(ji.setTeamState({temporaryUsersConfig:e}))}catch(e){yield xo(ji.setTeamError({key:PA.CONFIG_TEMPORARY_USERS,value:Tg(e)}))}}function*Gb({payload:e}){const{callback:t}=e,n=to(e,rb),i=yield mb();yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{const e=yield Bo(rp.teams.updateUserExpirationTime,n);yield xo(ji.setTeamState({users:i.users.map((t=>t.id===n.userId?D({},t,{temporaryExpirationDate:new Date(e.temporaryExpirationDate)}):t))})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*$b({payload:e}){const{callback:t}=e,n=to(e,sb),i=yield mb();yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!0}));try{yield Bo(rp.teams.setPermanentUser,n.userId),yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:void 0}):e))})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.UPDATE_USER_EXPIRATION_TIME,value:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}}function*xb(){yield xo(ji.setTeamError({key:PA.GET_TOKEN_LINK,value:!1}));try{yield Bo(Mb);const e=yield Bo(rp.teams.getInviteUserLink),{inviteTokenState:t}=yield mb();yield xo(ji.setTeamState({inviteTokenState:D({},t,e)}))}catch(e){yield xo(ji.setTeamError({key:PA.GET_TOKEN_LINK,value:Tg(e)}))}}function*Vb({payload:{callback:e}}){yield xo(ji.setTeamError({key:PA.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield mb();try{const n=yield Bo(rp.teams.createInviteUserLink,{expiresInMinutes:43200});yield xo(ji.setTeamState({inviteTokenState:D({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t),yield xo(ji.setTeamError({key:PA.CREATE_TOKEN_LINK,value:Tg(t)}))}}function*jb({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield mb();yield xo(ji.setTeamError({key:PA.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield Bo(rp.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield xo(ji.setTeamState({inviteTokenState:D({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t),yield xo(ji.setTeamError({key:PA.UPDATE_TOKEN_LINK,value:Tg(t)}))}}function*Bb({payload:e}){const{callback:t}=null!=e?e:{};yield xo(ji.setTeamError({key:PA.DELETE_TOKEN_LINK,value:!1}));try{yield Bo(rp.teams.deleteInviteUserLink),yield xo(ji.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield xo(ji.setTeamError({key:PA.DELETE_TOKEN_LINK,value:Tg(e)})),null==t||t(!1,e)}}function*Wb({payload:e}){yield xo(ji.setTeamState({addUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*zb({payload:e}){const t=yield mb(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield xo(ji.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Kb({payload:e}){yield xo(ji.setTeamState({deleteUserDialogState:D({open:!0,loading:!1,error:!1},e)}))}function*Hb({payload:e}){const t=yield mb(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield xo(ji.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*qb(){yield $a(ji.loadUsers,Tb),yield $a(ji.loadUsersV2,bb),yield $a(ji.loadAllSubTenantsUsers,Eb),yield $a(ji.loadRoles,kb),yield Ga(ji.addUser,Ib),yield Ga(ji.addUsersBulk,Ob),yield Ga(ji.addUserToSubTenants,Pb),yield Ga(ji.updateUser,_b),yield Ga(ji.setUserRolesForSubTenants,Ub),yield Ga(ji.deleteUser,Lb),yield Ga(ji.deleteUserFromSubTenants,wb),yield Ga(ji.resendActivationLink,Cb),yield Ga(ji.resendInvitationLink,Rb),yield Ga(ji.resendInvitationEmail,Db),yield Ga(ji.resendInvitationLinkToAllSubTenants,Nb),yield Ga(ji.getTemporaryUsersConfig,Fb),yield Ga(ji.updateUserExpirationTime,Gb),yield Ga(ji.setUserAsPermanent,$b),yield Ga(ji.getInvitationLink,xb),yield Ga(ji.createInvitationLink,Vb),yield Ga(ji.updateInvitationLink,jb),yield Ga(ji.deleteInvitationLink,Bb),yield Ga(ji.openAddUserDialog,Wb),yield Ga(ji.closeAddUserDialog,zb),yield Ga(ji.openDeleteUserDialog,Kb),yield Ga(ji.closeDeleteUserDialog,Hb)}function*Jb({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield mb(),l=null!=(t=e.pageSize)?t:s.pageSize,c=null!=(n=e.pageOffset)?n:s.pageOffset,u=null!=(i=e.filter)?i:s.filterV2,d=null!=(o=e.sort)?o:s.sortV2;yield xo(ji.setTeamLoader({key:PA.USERS,value:!a})),yield xo(ji.setTeamState({pageSize:l,pageOffset:c,filterV2:u,sortV2:d})),yield Et(),yield xo(ji.setTeamState({users:Jp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:PA.USERS,value:!1})),null==r||r(Jp)}function*Yb({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield mb(),c=null!=(t=e._limit)?t:l.allUsersQueryParams._limit,u=null!=(n=e._offset)?n:l.allUsersQueryParams._offset,d=null!=(i=e._filter)?i:l.allUsersQueryParams._filter,y=null!=(o=e._sortBy)?o:l.allUsersQueryParams._sortBy,f=null!=(a=e._order)?a:l.allUsersQueryParams._order;yield xo(ji.setTeamLoader({key:PA.USERS,value:!r})),yield xo(ji.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield Et(),yield xo(ji.setTeamState({allUsers:Xp,totalPages:2,totalItems:10,roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:PA.USERS,value:!1})),null==s||s(Xp)}function*Xb({payload:e}){var t;yield xo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0})),yield Et(),yield xo(ji.setTeamState({roles:Vp,permissions:Bp})),yield xo(ji.setTeamLoader({key:PA.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Vp,permissions:Bp})}function*Qb({payload:e}){const{callback:t}=e,n=to(e,lb),i=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=new Date,a=D({},Kp,{groups:[]},n,{id:`${KA()}`,temporaryExpirationDate:n.expirationInSeconds?new Date(o.setSeconds(o.getSeconds()+n.expirationInSeconds)):void 0});null==t||t(a),yield xo(ji.setTeamState({users:[a,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Zb({payload:e}){const{callback:t}=e,n=to(e,cb),i=yield mb();yield xo(ji.setTeamState({addUserDialogState:D({},i.addUserDialogState,{loading:!0})})),yield Et();const o=D({},Kp,n,{id:`${KA()}`});yield xo(ji.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*eT({payload:e}){var t;const{callback:n}=e,i=to(e,ub),{id:o}=i,a=yield mb(),r=a.users.find((e=>e.id===i.id));yield xo(ji.setTeamLoader({key:PA.UPDATE_USER,value:o||""})),yield xo(ji.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0})})),yield xo(ji.setTeamState({addUserDialogState:D({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?D({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield Et();const s=D({},r,i);null==n||n(s),yield xo(ji.setTeamState({users:a.users.map((e=>e.id===s.id?D({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield xo(ji.setTeamLoader({key:PA.UPDATE_USER,value:!1}))}function*tT({payload:e}){const{callback:t}=e,n=to(e,db),i=yield mb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield xo(ji.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*nT({payload:e}){const{callback:t}=e,n=to(e,yb),i=yield mb();yield xo(ji.setTeamState({deleteUserDialogState:D({},i.deleteUserDialogState,{loading:!0})})),yield Et(),null==t||t(!0),yield xo(ji.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*iT({payload:e}){const{callback:t}=e,n=to(e,fb);yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:n.userId})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.RESEND_ACTIVATE_LINK,value:!1}))}function*oT({payload:e}){const{callback:t}=e,n=to(e,pb);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*aT({payload:e}){const{callback:t}=e,n=to(e,gb);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*rT({payload:e}){const{callback:t}=e,n=to(e,Sb);yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:n.email})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.RESEND_INVITATION_LINK,value:!1}))}function*sT({payload:e}){const{callback:t}=e,n=to(e,vb),i=yield mb();yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!0}));const o=new Date;yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:n.expirationInSeconds?new Date(o.setSeconds(o.getSeconds()+n.expirationInSeconds)):void 0}):e))})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*lT({payload:e}){const{callback:t}=e,n=to(e,hb),i=yield mb();yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!0})),yield xo(ji.setTeamState({users:i.users.map((e=>e.id===n.userId?D({},e,{temporaryExpirationDate:void 0}):e))})),yield Et(),null==t||t(!0),yield xo(ji.setTeamLoader({key:PA.UPDATE_USER_EXPIRATION_TIME,value:!1}))}function*cT(){yield $a(ji.loadUsersV2,Jb),yield $a(ji.loadAllSubTenantsUsers,Yb),yield $a(ji.loadRoles,Xb),yield Ga(ji.addUser,Qb),yield Ga(ji.addUserToSubTenants,Zb),yield Ga(ji.updateUser,eT),yield Ga(ji.deleteUser,tT),yield Ga(ji.updateUserExpirationTime,sT),yield Ga(ji.setUserAsPermanent,lT),yield Ga(ji.deleteUserFromSubTenants,nT),yield Ga(ji.resendActivationLink,iT),yield Ga(ji.resendInvitationLink,oT),yield Ga(ji.resendInvitationEmail,aT),yield Ga(ji.resendInvitationLinkToAllSubTenants,rT),yield Ga(ji.openAddUserDialog,Wb),yield Ga(ji.closeAddUserDialog,zb),yield Ga(ji.openDeleteUserDialog,Kb),yield Ga(ji.closeDeleteUserDialog,Hb)}const uT=["authorizationUrl"],dT=["events","url"];function*yT(){try{yield xo(ji.setSocialLoginsState({loading:!0}));const e=yield Bo(rp.auth.getSocialLoginProviders);yield xo(ji.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield xo(ji.setSocialLoginsState({error:Tg(e),loading:!1,firstLoad:!1}))}}function*fT(){const e=yield Ko((({auth:e})=>e.isAuthenticated));let t;return t=e?yield Bo(rp.auth.getSocialLoginProvidersV2ForAuthenticatedUser):yield Bo(rp.auth.getSocialLoginProvidersV2),t}function*pT(e){try{var t,n;const i=yield Ko((e=>e.root.context));yield xo(ji.setSocialLoginsState({loading:!0}));const o=yield Bo(fT),{providers:a}=yield Bo(rp.auth.getCustomSocialLoginProvidersV1),r={socialLoginsConfigV2:o.map((e=>{let{authorizationUrl:t}=e,n=to(e,uT);const o=Lr(i,null!=t?t:"");return D({},n,{authorizationUrl:t?`${o}${t}`:null})})),customSocialLoginsConfig:a,loading:!1,firstLoad:!1};yield xo(ji.setSocialLoginsState(r)),null==e||null==(t=e.payload)||null==(n=t.callback)||n.call(t,r)}catch(t){var i,o;null==e||null==(i=e.payload)||null==(o=i.callback)||o.call(i,null,t),yield xo(ji.setSocialLoginsState({error:Tg(t),loading:!1,firstLoad:!1}))}}function*gT(e){let{payload:{events:t,url:n}}=e,i=to(e.payload,dT);try{yield xo(ji.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield Bo(rp.auth.loginViaSocialLogin,i);if(r){var o,a;const r={email:e,url:n,createdAt:new Date,id:s,tenantId:l},u=D({},r,{socialProvider:i.provider,authenticationType:yg.SOCIAL_LOGIN});null==t||null==(o=t.signUpComplete)||o.call(t,u),kg(Eg.SIGNUP_COMPLETED,u);const d=D({},r,{origin:dg.SOCIAL_LOGIN,name:c});null==t||null==(a=t.userVerified)||a.call(t,d),kg(Eg.USER_VERIFIED,d)}s&&localStorage.setItem("userId",s),yield xo(ji.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield Ko((e=>e.auth));e?yield Bo(eh):yield Bo(nh)}(),localStorage.removeItem("register-quick-login"),yield xo(ji.setSocialLoginsState({loading:!1}))}catch(e){yield xo(ji.setSocialLoginsState({loading:!1,error:Tg(e,"Failed to authenticate"),firstLoad:!1}))}}function*ST({payload:e}){yield xo(ji.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*vT(){yield xa(ji.loadSocialLoginsConfiguration,yT),yield Ga(ji.loadSocialLoginsConfigurationV2,pT),yield xa(ji.loginViaSocialLogin,gT),yield $a(ji.setSocialLoginError,ST)}let hT;function*mT({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield Ko((e=>e.auth.apiTokensState)),{policy:a}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),r=(null==a?void 0:a.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!0}));let a=null;n&&(a=1440*n),e=r?yield Bo(rp.auth.createUserAccessToken,{description:t,expiresInMinutes:a}):yield Bo(rp.auth.updateUserApiTokensData,{description:t,expiresInMinutes:a}),yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataUser:[D({},e,{type:r?Oi.AccessToken:Oi.ClientCredentials}),...o],successDialog:{open:!0,secret:e.secret,clientId:r?void 0:e.clientId}})),yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield xo(ji.setApiTokensError({key:hT.ADD_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!1})),null==i||i(null,e)}}function*AT({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield Ko((e=>e.auth.apiTokensState)),{policy:r}=yield Ko((e=>e.auth.securityPolicyState.publicPolicy)),s=(null==r?void 0:r.machineToMachineAuthStrategy)===Oi.AccessToken;try{let e;yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!0}));let r=null;i&&(r=1440*i),e=s?yield Bo(rp.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n}):yield Bo(rp.auth.updateTenantApiTokensData,{description:t,roleIds:n,expiresInMinutes:r}),yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataTenant:[D({},e,{type:s?Oi.AccessToken:Oi.ClientCredentials}),...a],successDialog:{open:!0,secret:e.secret,clientId:s?void 0:e.clientId}})),yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield xo(ji.setApiTokensError({key:hT.ADD_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!1})),null==o||o(null,e)}}function*bT({payload:e}){const{apiTokensDataUser:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteUserAccessToken,{id:e}),yield xo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield Bo(rp.auth.deleteUserApiToken,{tokenId:e}),yield xo(ji.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!1}))}catch(e){yield xo(ji.setApiTokensError({key:hT.DELETE_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!1}))}}function*TT({payload:e}){const{apiTokensDataTenant:t}=yield Ko((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!0})),n?(yield Bo(rp.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield Bo(rp.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield xo(ji.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!1}))}catch(e){yield xo(ji.setApiTokensError({key:hT.DELETE_API_TOKEN,value:Tg(e)})),yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!1}))}}function*ET({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield Vo([Bo(rp.auth.getUserApiTokensData),Bo(rp.auth.getTenantApiTokensData)]);yield xo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setApiTokensError({key:hT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*kT({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=Bo(rp.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).map((e=>D({},e,{type:Oi.AccessToken}))).concat(a.map((e=>D({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield xo(ji.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield xo(ji.setApiTokensError({key:hT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*IT({payload:e}){null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=Bo(rp.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=Bo(rp.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).map((e=>D({},e,{type:Oi.AccessToken}))).concat(a.map((e=>D({},e,{type:Oi.ClientCredentials})))).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield xo(ji.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield xo(ji.setApiTokensError({key:hT.LOAD_API_TOKENS,value:Tg(t)})),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*OT(){yield xa(ji.loadApiTokens,ET),yield xa(ji.loadUserApiTokens,kT),yield xa(ji.loadTenantApiTokens,IT),yield Ga(ji.addUserApiToken,mT),yield Ga(ji.addTenantApiToken,AT),yield $a(ji.deleteTenantApiToken,TT),yield $a(ji.deleteUserApiToken,bT)}function*PT({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield Ko((e=>e.auth.apiTokensState)),a=D({},Lp,{description:t,roleIds:n,clientId:`CLIENT_ID_${KA()}`});yield xo(ji.setApiTokensState({showAddTokenDialog:!1})),yield Ho(200),yield xo(ji.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:hT.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*_T({payload:e}){yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!0})),yield Ho(200);const t=[Lp];yield xo(ji.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield xo(ji.setApiTokensLoader({key:hT.DELETE_API_TOKEN,value:!1}))}function*LT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));const n=[_p],i=[Lp];yield xo(ji.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*UT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));const n=[_p];yield xo(ji.setApiTokensState({apiTokensDataUser:n})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*wT({payload:e}){var t;null!=e&&e.silentLoading||(yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!0})));const n=[Lp];yield xo(ji.setApiTokensState({apiTokensDataTenant:n})),yield Ho(200),yield xo(ji.setApiTokensLoader({key:hT.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*CT(){yield xa(ji.loadApiTokens,LT),yield xa(ji.loadUserApiTokens,UT),yield xa(ji.loadTenantApiTokens,wT),yield Ga(ji.addTenantApiToken,PT),yield $a(ji.deleteTenantApiToken,_T)}function*RT({payload:e}){try{var t;yield xo(ji.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield Bo(rp.accountSettings.updateSettings,D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield xo(ji.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield xo(ji.setAccountSettingsState({loading:!1,error:Tg(t)})),null==(n=e.callback)||n.call(e,null,t)}}function*DT({payload:e}){yield xo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield Bo(rp.accountSettings.getSettings);yield xo(ji.setAccountSettingsState(D({},e,{loading:!1})))}catch(e){yield xo(ji.setAccountSettingsState({loading:!1,error:Tg(e)}))}}function*NT(){yield xa(ji.saveAccountSettings,RT),yield xa(ji.loadAccountSettings,DT)}function*MT({payload:e}){var t;yield xo(ji.setAccountSettingsState({loading:!0})),yield Et();const{accountSettingsState:n}=yield Ko((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=D({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield xo(ji.setAccountSettingsState(D({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*FT({payload:e}){yield xo(ji.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield Et(),yield xo(ji.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*GT(){yield xa(ji.saveAccountSettings,MT),yield xa(ji.loadAccountSettings,FT)}function*$T({payload:{tenantId:e,callback:t}}){yield xo(ji.setState({isLoading:!0}));try{yield Bo(rp.tenants.switchTenant,{tenantId:e}),yield Bo(Qv),(null==t?void 0:t(!0))||(yield xo(ji.setState({isLoading:!1})))}catch(e){yield xo(ji.setState({isLoading:!1})),null==t||t(!1,e)}}function*xT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(ns());yield xo(ji.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 xo(ji.setTenantsState({loading:!1}))}}function*VT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenants);yield xo(ji.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*jT({payload:e}){yield xo(ji.setTenantsState({loading:!0}));try{var t;const n=yield Bo(rp.tenants.getSubTenantsAsTree);yield xo(ji.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield xo(ji.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*BT(){yield Ga(ji.loadTenants,xT),yield Ga(ji.loadSubTenants,VT),yield Ga(ji.switchTenant,$T),yield Ga(ji.loadSubTenantsTree,jT)}function*WT(){yield xo(ji.setTenantsState({loading:!0})),yield Et(),yield xo(ji.setTenantsState({tenants:Qp,activeTenant:Qp[0],loading:!1}))}function*zT(){yield Ga(ji.loadTenants,WT)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(hT||(hT={}));const KT=["callback"],HT=["callback"],qT=["callback"],JT=["callback"],YT=["callback"];function*XT({payload:e}){var t;yield xo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield Vo([Bo(rp.roles.getRoles),Bo(rp.roles.getPermissions),Bo(rp.roles.getPermissionCategories)]),[t,n,i]=e;yield xo(ji.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield xo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*QT(e){let{payload:{callback:t}}=e,n=to(e.payload,KT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.addRole,n),i=yield Bo(rp.roles.getRoles);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*ZT(e){let{payload:{callback:t}}=e,n=to(e.payload,HT);yield xo(ji.setRolesState({saving:!0}));try{yield Bo(rp.roles.deleteRole,n),yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(!1,e)}}function*eE(e){let{payload:{callback:t}}=e,n=to(e.payload,qT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.updateRole,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*tE(e){let{payload:{callback:t}}=e,n=to(e.payload,JT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionsToRole,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*nE(e){let{payload:{callback:t}}=e,n=to(e.payload,YT);yield xo(ji.setRolesState({saving:!0}));try{const e=yield Bo(rp.roles.attachPermissionToRoles,n);yield xo(ji.loadRolesAndPermissions({silentLoading:!0})),yield xo(ji.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield xo(ji.setRolesState({error:Tg(e),saving:!1})),null==t||t(null,e)}}function*iE(){yield xa(ji.loadRolesAndPermissions,XT),yield Ga(ji.addRole,QT),yield Ga(ji.deleteRole,ZT),yield Ga(ji.updateRole,eE),yield Ga(ji.attachPermissionsToRole,tE),yield Ga(ji.attachPermissionToRoles,nE)}function*oE({payload:e}){var t;yield xo(ji.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield xo(ji.setRolesState({roles:Up,loading:!1}))}catch(e){yield xo(ji.setRolesState({error:Tg(e),loading:!1}))}}function*aE(){yield xa(ji.loadRolesAndPermissions,oE)}const rE=["callback"],sE=["callback"],lE=["callback"];function*cE(e){let{payload:{callback:t}}=e,n=to(e.payload,rE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.resetPhoneNumber,n);yield xo(ji.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:Zt.VerifyResetPhoneNumber})),yield xo(ji.setLoginState({email:n.email}))}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*uE(e){let{payload:{callback:t}}=e,n=to(e.payload,sE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const e=yield Bo(rp.auth.verifyResetPhoneNumber,n);yield xo(ji.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:Zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*dE(e){let{payload:{callback:t}}=e,n=to(e.payload,lE);yield xo(ji.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield Ko((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield Bo(rp.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield xo(ji.setLoginState({step:_t.loginWithSmsOtc})),yield xo(ji.passwordlessPreLogin({type:Ii.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield xo(ji.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setResetPhoneNumberState({loading:!1,error:Tg(e)})),null==t||t(null,e)}}function*yE(){yield xa(ji.resetPhoneNumber,cE),yield xa(ji.verifyResetPhoneNumber,uE),yield xa(ji.changePhoneNumber,dE)}function*fE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSessions);yield xo(ji.setSessionsState({sessions:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*pE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getCurrentUserSession);yield xo(ji.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*gE({payload:{id:e}}){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteSessionForUser,e),yield xo(ji.loadUserSessions())}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*SE({payload:{callback:e,userId:t}}){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield xo(ji.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*vE(){yield xo(ji.setSessionsState({loading:!0,error:null}));try{yield Bo(rp.auth.deleteAllSessionsForUser),yield xo(ji.loadUserSessions())}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*hE(){yield $a(ji.loadUserSessions,fE),yield $a(ji.deleteUserSession,gE),yield $a(ji.deleteAllUserSessions,vE),yield $a(ji.loadCurrentUserSession,pE),yield Ga(ji.revokeUserSessions,SE)}function*mE(){yield xo(ji.setSessionsState({loading:!0,error:null})),yield xo(ji.setSessionsState({sessions:Zp,loading:!1}))}function*AE({payload:{id:e}}){yield xo(ji.setSessionsState({loading:!0,error:null}));const t=(yield Ko((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield xo(ji.setSessionsState({sessions:t,loading:!1}))}function*bE(){yield xo(ji.setSessionsState({loading:!0,error:null}));const e=Zp.filter((e=>e.current));yield xo(ji.setSessionsState({sessions:e,loading:!1}))}function*TE(){yield $a(ji.loadUserSessions,mE),yield $a(ji.deleteUserSession,AE),yield $a(ji.deleteAllUserSessions,bE)}const EE=["callback"],kE=["callback"];function*IE(){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getSessionConfigurations);yield xo(ji.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield xo(ji.setSessionsState({error:e,loading:!1}))}}function*OE({payload:e}){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=to(e,EE);yield Bo(rp.auth.createOrUpdateSessionConfigrations,n),yield xo(ji.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield xo(ji.setSessionsPolicyState({error:e,loading:!1}))}}function*PE(){yield xa(ji.loadSessionsPolicy,IE),yield $a(ji.createOrUpdateSessionsPolicy,Dg(OE))}function*_E(){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));const e=yield Ko((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:eg}));yield xo(ji.setSessionsPolicyState(D({},e,{loading:!1})))}function*LE({payload:e}){yield xo(ji.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=to(e,kE);null==t||t(!0),yield xo(ji.setSessionsPolicyState({configurations:n,loading:!1}))}function*UE(){yield xa(ji.loadSessionsPolicy,_E),yield $a(ji.createOrUpdateSessionsPolicy,LE)}const wE=["callback"],CE=["callback"],RE=["callback"],DE=["callback"],NE=["callback"],ME=["callback"],FE=["callback"],GE=["callback"],$E=()=>Ko((e=>e.auth.restrictionsState.ipRestrictions)),xE=()=>Ko((e=>e.auth.restrictionsState.emailDomainRestrictions));function*VE(){yield xo(ji.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield Bo(rp.auth.getDomainRestrictionsConfig),t=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield xo(ji.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield xo(ji.setEmailDomainRestrictionsState({error:Tg(e),loading:!1}))}}function*jE(e){let{payload:{callback:t}}=e,n=to(e.payload,wE);yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield xE();try{var o;yield Bo(rp.auth.createDomainRestriction,n);const e=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(o=i.data)?void 0:o.config)||{active:!1,blockPublicDomains:!1,listType:n.type},restrictions:e},saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*BE(e){let{payload:{callback:t}}=e,n=to(e.payload,CE);yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield Bo(rp.auth.updateDomainRestrictionConfig,n),i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield xo(ji.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*WE({payload:{id:e}}){yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield xE();try{var n;yield Bo(rp.auth.deleteDomainRestriction,e);const i=(yield Bo(rp.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield xo(ji.setEmailDomainRestrictionsState({saving:!1,error:Tg(e)}))}}const zE=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:zn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*KE(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield $E(),t=yield Bo(rp.auth.getIPRestrictionsConfig),n=zE({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield Bo(rp.auth.getIPRestrictions,n);yield xo(ji.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*HE(){try{const{valid:e}=yield Bo(rp.auth.testCurrentIpInAllowList);yield xo(ji.setIpRestrictionsState({userIpValid:e}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e)}))}}function*qE({payload:{callback:e}}){yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield Ko((e=>e.auth.userIp));yield Vo([Bo(rp.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:zn.ALLOW}),Bo(rp.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield $E(),i=zE(n.pagination),{items:o,_metadata:{totalPages:a}}=yield Bo(rp.auth.getIPRestrictions,i);yield xo(ji.setIpRestrictionsState({data:{config:{isActive:!0,strategy:zn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield xo(ji.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*JE(e){let{payload:{callback:t}}=e,n=to(e.payload,RE);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield $E();try{var o,a;yield Bo(rp.auth.createIPRestriction,n);const e=yield $E(),r=zE(e.pagination),{items:s,_metadata:{totalPages:l}}=yield Bo(rp.auth.getIPRestrictions,r);yield HE(),yield xo(ji.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:zn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*YE(e){let{payload:{callback:t}}=e,n=to(e.payload,DE);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));try{yield Bo(rp.auth.updateIPRestrictionConfig,n);const e=yield $E(),i=yield Bo(rp.auth.getIPRestrictionsConfig),o=zE(D({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield Bo(rp.auth.getIPRestrictions,o);yield HE(),yield xo(ji.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*XE({payload:{id:e,callback:t}}){yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const n=yield $E();try{var i;yield Bo(rp.auth.deleteIPRestriction,e);const o=yield $E(),a=zE(o.pagination),{items:r,_metadata:{totalPages:s}}=yield Bo(rp.auth.getIPRestrictions,a);yield HE(),yield xo(ji.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield xo(ji.setIpRestrictionsState({saving:!1,error:Tg(e)})),null==t||t(null,e)}}function*QE(){yield xa(ji.loadIpRestrictions,Dg(KE)),yield xa(ji.loadEmailDomainRestrictions,Dg(VE)),yield Ga(ji.saveIpRestriction,Dg(JE)),yield Ga(ji.saveIpRestrictionsConfig,Dg(YE)),yield Ga(ji.deleteIpRestriction,Dg(XE)),yield Ga(ji.checkIfUserIpValid,Dg(HE)),yield Ga(ji.addCurrentUserIpAndActivate,Dg(qE)),yield Ga(ji.saveEmailDomainRestriction,Dg(jE)),yield Ga(ji.saveEmailDomainRestrictionsConfig,Dg(BE)),yield Ga(ji.deleteEmailDomainRestriction,Dg(WE))}function*ZE(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null})),yield xo(ji.setIpRestrictionsState({data:{restrictions:ng.filter((e=>e.strategy===tg.strategy)),config:tg},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*ek(){yield xo(ji.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield $E(),t=ng[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield xo(ji.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield xo(ji.setIpRestrictionsState({error:Tg(e),loading:!1}))}}function*tk(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,NE);yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const r=yield $E(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield xo(ji.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:zn.ALLOW},restrictions:[...s,D({},a,{createdAt:new Date,updatedAt:new Date,id:KA(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*nk(e){var t,n,i;let{payload:{callback:o}}=e,a=to(e.payload,ME);const r=yield $E();yield xo(ji.setIpRestrictionsState({saving:!0,error:null})),yield xo(ji.setIpRestrictionsState({data:{config:D({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield xo(ji.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*ik({payload:{id:e,callback:t}}){var n;yield xo(ji.setIpRestrictionsState({saving:!0,error:null}));const i=yield $E();yield xo(ji.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:zn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:zn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*ok(){yield xo(ji.setEmailDomainRestrictionsState({loading:!0,error:null})),yield xo(ji.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:zn.ALLOW}],config:{active:!0,listType:zn.ALLOW,blockPublicDomains:!1}}}))}function*ak(e){var t,n;let{payload:{callback:i}}=e,o=to(e.payload,FE);const a=yield xE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==i||i(!0),yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],D({},o,{id:Date.now().toString()})]},saving:!1}))}function*rk(e){var t;let{payload:{callback:n}}=e,i=to(e.payload,GE);const o=yield xE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),null==n||n(!0),yield xo(ji.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||zn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*sk({payload:{id:e}}){var t,n;const i=yield xE();yield xo(ji.setEmailDomainRestrictionsState({saving:!0,error:null})),yield Et(),yield xo(ji.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:zn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*lk(){yield xa(ji.loadIpRestrictions,ZE),yield xa(ji.loadEmailDomainRestrictions,ok),yield Ga(ji.saveIpRestriction,tk),yield Ga(ji.saveIpRestrictionsConfig,nk),yield Ga(ji.deleteIpRestriction,ik),yield Ga(ji.checkIfUserIpValid,ek),yield Ga(ji.saveEmailDomainRestriction,ak),yield Ga(ji.saveEmailDomainRestrictionsConfig,rk),yield Ga(ji.deleteEmailDomainRestriction,sk)}const ck=["callback"],uk=["id"];function*dk(e){const{count:t}=yield Bo(rp.directory.countConfigurationUsers,e.id);return D({},e,{count:t})}function*yk(){yield xo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.getConfigs),t=yield Vo(e.map((e=>dk(e))));yield xo(ji.setProvisioningState({connections:t,loading:!1}))}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*fk(e){let{payload:{callback:t}}=e,n=to(e.payload,ck);yield xo(ji.setProvisioningState({loading:!0,error:null}));try{const e=yield Bo(rp.directory.createConfiguration,n),i=yield Bo(rp.directory.getConfigs),o=yield Vo(i.map((e=>dk(e))));yield xo(ji.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*pk(e){let{payload:{id:t}}=e,n=to(e.payload,uk);yield xo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.updateConfiguration,t,n);const e=yield Bo(rp.directory.getConfigs),i=yield Vo(e.map((e=>dk(e))));yield xo(ji.setProvisioningState({connections:i,loading:!1}))}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1}))}}function*gk({payload:{id:e,callback:t}}){yield xo(ji.setProvisioningState({loading:!0,error:null}));try{yield Bo(rp.directory.deleteConfiguration,e);const n=yield Bo(rp.directory.getConfigs),i=yield Vo(n.map((e=>dk(e))));yield xo(ji.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setProvisioningState({error:Tg(e),loading:!1})),null==t||t(!1,e)}}function*Sk(){yield xa(ji.loadProvisionConnections,yk),yield Ga(ji.createProvisionConnection,fk),yield Ga(ji.deleteProvisionConnection,gk),yield Ga(ji.updateProvisionConnection,pk)}const vk=["callback","events"];function*hk(e){let{payload:{callback:t}}=e,n=to(e.payload,vk);yield xo(ji.setImpersonateState({loading:!0}));try{yield Bo(rp.impersonate.impersonate,n),yield xo(ji.setImpersonateState({step:Mi.success})),yield Ho(1e3),yield ov(),yield xo(ji.resetImpersonateState()),null==t||t(!0)}catch(e){yield xo(ji.setImpersonateState({loading:!1,error:Tg(e)}))}}function*mk(){yield xa(ji.impersonate,hk)}function*Ak({payload:e}){const{callback:t,deviceId:n}=e;yield xo(ji.setPasskeysState({loading:!0}));try{yield Bo(rp.auth.deleteWebAuthnDevice,n);const{devices:e}=yield Ko((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield xo(ji.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield xo(ji.setPasskeysState({loading:!1,error:Tg(e,null)})),null==t||t(null,e)}}function*bk(){yield xo(ji.setPasskeysState({loading:!0}));try{const{devices:e}=yield Bo(rp.auth.getWebAuthnDevices);yield xo(ji.setPasskeysState({devices:e,loading:!1}))}catch(e){yield xo(ji.setPasskeysState({loading:!1,error:Tg(e,null)}))}}function*Tk(){yield Ga(ji.loadWebAuthnDevices,bk),yield Ga(ji.deleteWebAuthnDevice,Ak)}const Ek=["roleIds","userIds"],kk=()=>Ko((e=>e.auth.groupsState));function*Ik({payload:e}){const t=HA.GET_TEAM_USERS;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield Bo(rp.users.getUsersV2,{_filter:e.filter,_offset:e.pageOffset,_limit:e.pageSize,_includeSubTenants:!1});yield xo(ji.setGroupsState({teamUsers:n}))}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ok({payload:e}){const t=HA.GET_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield Bo(rp.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:qA.rolesAndUsers});yield xo(ji.setGroupsState({selectedGroup:n}))}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Pk(){const e=HA.GET_GROUPS,t=yield kk();yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield Bo(rp.groups.getGroups,{_groupsRelations:qA.rolesAndUsers});yield xo(ji.setGroupsState(D({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield xo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*_k({payload:e}){const t=HA.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=to(e,Ek);yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield Bo(rp.groups.createGroup,D({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield xo(ji.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield xo(ji.addRolesToGroup({groupId:r.id,roleIds:n}))),yield xo(ji.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Lk({payload:e}){const t=HA.UPDATE_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.updateGroup,e),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Uk({payload:e}){const t=HA.DELETE_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteGroup,e.groupId),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1,n)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*wk({payload:e}){const t=HA.ADD_ROLES_TO_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Ck({payload:e}){const t=HA.DELETE_ROLES_FROM_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Rk({payload:e}){const t=HA.ADD_USERS_TO_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;null==e||null==(i=e.callback)||i.call(e,!1),yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Dk({payload:e}){const t=HA.DELETE_USERS_FROM_GROUP;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield Bo(rp.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield xo(ji.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield xo(ji.setUsersGroupsError({key:t,value:Tg(n)})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Nk(){const e=HA.GET_GROUP_CONFIGURATION;yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield Bo(rp.groups.getGroupConfiguration);yield xo(ji.setGroupsState({groupsConfiguration:t}))}catch(t){yield xo(ji.setUsersGroupsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}}function*Mk({payload:e}){const t=HA.UPDATE_GROUP_CONFIGURATION;yield xo(ji.setUsersGroupsLoader({key:t,value:!0}));try{yield Bo(rp.groups.updateGroupConfiguration,e),yield xo(ji.getGroupConfiguration())}catch(e){yield xo(ji.setUsersGroupsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}}function*Fk(){yield $a(ji.loadGroups,Pk),yield $a(ji.getGroupById,Ok),yield $a(ji.createGroup,_k),yield $a(ji.updateGroup,Lk),yield $a(ji.deleteGroup,Uk),yield $a(ji.addRolesToGroup,wk),yield $a(ji.deleteRolesFromGroup,Ck),yield $a(ji.addUsersToGroup,Rk),yield $a(ji.deleteUsersFromGroup,Dk),yield $a(ji.getGroupConfiguration,Nk),yield $a(ji.updateGroupConfiguration,Mk),yield $a(ji.getTeamUsers,Ik)}function*Gk(){const e=HA.GET_GROUPS;yield xo(ji.setUsersGroupsLoader({key:e,value:!0}));const t=ag;yield xo(ji.setGroupsState({groups:t})),yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*$k({payload:e}){var t;const n=HA.CREATE_GROUP,{groups:i}=yield kk();yield xo(ji.setUsersGroupsLoader({key:n,value:!0})),yield xo(ji.setGroupsState({groups:[D({},e,{id:`${e.name}ID`,managedBy:ep.FRONTEGG}),...null!=i?i:[]]})),yield Ho(500),null==e||null==(t=e.callback)||t.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:n,value:!1}))}function*xk({payload:e}){var t,n,i,o,a;const r=HA.UPDATE_GROUP,s=yield kk();yield xo(ji.setUsersGroupsLoader({key:r,value:!0})),yield xo(ji.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:ep.FRONTEGG}):t})),selectedGroup:D({},null==s?void 0:s.selectedGroup,{name:null!=(n=null==e?void 0:e.name)?n:"",color:null!=(i=null==e?void 0:e.color)?i:"",description:null!=(o=null==e?void 0:e.description)?o:""})})),yield Ho(500),null==e||null==(a=e.callback)||a.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:r,value:!1}))}function*Vk({payload:e}){var t,n;const i=HA.DELETE_GROUP,o=yield kk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*jk({payload:e}){var t,n;const i=HA.ADD_ROLES_TO_GROUP,o=yield kk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Bk({payload:e}){var t,n;const i=HA.DELETE_ROLES_FROM_GROUP,o=yield kk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Wk({payload:e}){var t,n;const i=HA.ADD_USERS_TO_GROUP,o=yield kk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*zk({payload:e}){var t,n;const i=HA.DELETE_USERS_FROM_GROUP,o=yield kk();yield xo(ji.setUsersGroupsLoader({key:i,value:!0})),yield xo(ji.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?D({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield Ho(500),null==e||null==(n=e.callback)||n.call(e,!0),yield xo(ji.setUsersGroupsLoader({key:i,value:!1}))}function*Kk(){const e=HA.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield kk();yield xo(ji.setUsersGroupsLoader({key:e,value:!0})),t&&(yield xo(ji.setGroupsState({groupsConfiguration:D({},t)}))),yield xo(ji.setUsersGroupsLoader({key:e,value:!1}))}function*Hk({payload:e}){const t=HA.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield kk();yield xo(ji.setUsersGroupsLoader({key:t,value:!0})),n&&(yield xo(ji.setGroupsState({groupsConfiguration:D({},n,e)}))),yield xo(ji.setUsersGroupsLoader({key:t,value:!1}))}function*qk(){yield $a(ji.loadGroups,Gk),yield $a(ji.createGroup,$k),yield $a(ji.updateGroup,xk),yield $a(ji.deleteGroup,Vk),yield $a(ji.addRolesToGroup,jk),yield $a(ji.deleteRolesFromGroup,Bk),yield $a(ji.addUsersToGroup,Wk),yield $a(ji.deleteUsersFromGroup,zk),yield $a(ji.getGroupConfiguration,Kk),yield $a(ji.updateGroupConfiguration,Hk)}let Jk;!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.GET_USER_JWT="GET_USER_JWT",e.GET_TEAM_USERS="GET_TEAM_USERS"}(Jk||(Jk={}));const Yk=(e,t,n)=>{var i,o;return e.tenantId===t?D({},e,{name:n}):D({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Yk(e,t,n))))?i:[]})};function Xk(e,t){var n;return D({},e,{children:null!=(n=e.children)&&n.length?e.children.filter((e=>e.tenantId!==t)).map((e=>Xk(e,t))):[]})}function Qk(e,t,n){var i,o;if(e.tenantId===t){var a;const t=[...null!=(a=null==e?void 0:e.children)?a:[],...n].filter(((e,t,n)=>t===n.findIndex((t=>t.tenantId===e.tenantId))));return D({},e,{children:t})}return D({},e,{children:null!=(i=null==e||null==(o=e.children)?void 0:o.map((e=>Qk(e,t,n))))?i:[]})}const Zk=({items:e},t)=>e.map((e=>{var n,i;return{name:e.name,tenantId:e.tenantId,numberOfUsers:null!=(n=null==(i=t.find((t=>t.tenantId===e.tenantId)))?void 0:i.totalUsers)?n:0,createdAt:e.createdAt,metadata:e.metadata}})),eI=()=>Ko((e=>e.auth.allAccountsState));function*tI({payload:e}){const t=Jk.GET_ACCOUNTS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{accountsQueryParams:n}=yield eI(),{jwt:i,_limit:o,_offset:a}=e,r={_offset:null!=a?a:n._offset,_limit:null!=o?o:n._limit,_subTenantId:null==e?void 0:e._subTenantId};try{if(i){var s;const{selectedAccount:t}=yield eI(),{items:n,_links:o}=yield Bo(rp.tenants.searchSubTenants,r,{jwt:i}),a=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))},{jwt:i}),l=Zk({items:n},a),c=Qk(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==o?void 0:o.next}))));yield xo(ji.setSelectedAccountState({accounts:c}))}else{var l;const{accounts:t}=yield eI(),{items:n,_links:i}=yield Bo(rp.tenants.searchSubTenants,r),o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:n.map((e=>e.tenantId))}),a=Zk({items:n},o),s=Qk(t,null!=(l=null==e?void 0:e._subTenantId)?l:"",a.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}))));yield xo(ji.setAllAccountsState({accounts:s}))}}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*nI({payload:e}){const t=Jk.SEARCH_ACCOUNTS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{rootAccount:n}=yield eI(),{jwt:i}=e;try{if(null!=e&&e._subTenantId){var o;const{items:t}=yield Bo(rp.tenants.searchSubTenants,{_offset:0,_limit:50,_filter:null!=(o=null==e?void 0:e._filter)?o:"",_subTenantId:e._subTenantId},{jwt:i});yield xo(ji.setAllAccountsState({searchAccountsData:[...t,{name:n.name,tenantId:n.tenantId}]}))}}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*iI({payload:e}){const t=Jk.GET_USER_JWT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,callback:i}=e;try{const e=yield Bo(rp.users.GetUserJwt,{tenantId:n});yield xo(ji.setSelectedAccountState({userJwt:e,accessPermission:!0})),null==i||i(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),yield xo(ji.setSelectedAccountState({accessPermission:!1})),null==i||i(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*oI({payload:e}){const t=Jk.CREATE_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{name:n,parentTenantId:i,tenantId:o,jwt:a,callback:r}=e;try{if(a){const{accounts:e}=yield eI(),{selectedAccount:t}=yield eI(),r=yield Bo(rp.subTenants.createSubTenant,{name:n,parentTenantId:i,tenantId:o},{jwt:a}),s=Qk(e,null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]),l=Qk(D({name:"",tenantId:""},null==t?void 0:t.accounts),null!=i?i:"",[{name:r.name,tenantId:r.tenantId,numberOfUsers:0,createdAt:new Date}]);yield xo(ji.setAllAccountsState({accounts:s})),yield xo(ji.setSelectedAccountState({accounts:l}))}else{const{accounts:e}=yield eI(),t=yield Bo(rp.subTenants.createSubTenant,{name:n,tenantId:o,parentTenantId:i}),a=Qk(e,null!=i?i:"",[{name:t.name,tenantId:t.tenantId,numberOfUsers:0,createdAt:new Date}]);yield xo(ji.setAllAccountsState({accounts:a}))}null==r||r(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*aI({payload:e}){const t=Jk.DELETE_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,tenantId:i,callback:o}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield eI();yield Bo(rp.subTenants.deleteSubTenant,i,{jwt:n});const o=Xk(t,i),a=Xk(null==e?void 0:e.accounts,i);yield xo(ji.setAllAccountsState({accounts:o})),yield xo(ji.setSelectedAccountState({accounts:a}))}else{const{accounts:e}=yield eI();yield Bo(rp.subTenants.deleteSubTenant,i);const t=Xk(e,i);yield xo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*rI({payload:e}){const t=Jk.UPDATE_SUB_ACCOUNT_SETTINGS;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n,name:i,callback:o,tenantId:a}=e;try{if(n){const{selectedAccount:e,accounts:t}=yield eI();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i},{jwt:n});const o=Yk(e.accounts,a,i);yield xo(ji.setSelectedAccountState({name:i,accounts:o}));const r=Yk(t,a,i);yield xo(ji.setAllAccountsState({accounts:r}))}else{const{accounts:e}=yield eI();yield Bo(rp.subTenants.updateSubTenant,{tenantId:a},{name:i});const t=Yk(e,a,i);yield xo(ji.setAllAccountsState({accounts:t}))}null==o||o(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==o||o(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*sI({payload:e}){const t=Jk.DELETE_USERS_FROM_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenants:i,jwt:o,callback:a}=e;try{yield Bo(rp.subTenants.removeUserFromTenantAndSubTenants,{userId:n,subTenants:i},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:i[0].tenantId})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*lI({payload:e}){const t=Jk.SET_USER_ROLES_FOR_SUB_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{userId:n,subTenantsRoles:i,jwt:o,callback:a}=e,{selectedAccount:r}=yield eI();try{yield Bo(rp.subTenants.setUserRolesForSubTenants,n,{subTenantsRoles:i},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:r.tenantId})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*cI({payload:e}){const t=Jk.ADD_USERS_TO_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{users:n,tenantId:i,jwt:o,callback:a,allowSubAccountAccess:r=!1,roleIds:s}=e;try{yield Bo(rp.subTenants.addUsersToSubTenant,{users:n,tenantId:i,allowSubAccountAccess:r,roleIds:s},{jwt:o}),yield xo(ji.getAccountUsers({jwt:o,_tenantId:i})),null==a||a(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==a||a(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*uI({payload:e}){const t=Jk.UPDATE_SUB_ACCOUNT_ACCESS_FOR_USER;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{selectedAccount:n}=yield eI(),{userId:i,allowAccess:o,jwt:a,callback:r}=e;try{var s;yield Bo(rp.subTenants.updateSubAccountAccess,i,{allowAccess:o},{jwt:a}),yield xo(ji.setSelectedAccountState({users:null==n||null==(s=n.users)?void 0:s.map((e=>e.id===i?D({},e,{subAccountAccessAllowed:o}):e))})),null==r||r(!0)}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)})),null==r||r(!1)}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*dI({payload:e}){var t,n,i,o,a,r,s,l;const c=Jk.GET_ACCOUNT_USERS;yield xo(ji.setAllAccountsLoader({key:c,value:!0}));const u=yield eI(),{jwt:d,_tenantId:y,_email:f}=e,p=null!=(t=null!=(n=null==e?void 0:e._offset)?n:null==u||null==(i=u.selectedAccount)||null==(o=i.usersQueryParams)?void 0:o._offset)?t:0,g=null!=(a=null!=(r=null==e?void 0:e._limit)?r:null==u||null==(s=u.selectedAccount)||null==(l=s.usersQueryParams)?void 0:l._limit)?a:10,S=D({_offset:p,_limit:g,_tenantId:y,_includeSubTenants:!1},!!f&&{_email:f});try{const{items:e,_metadata:{totalItems:t,totalPages:n}}=yield Bo(rp.users.getUsersV3,S,{jwt:d}),i={totalUsersItems:t,totalUsersPages:n,usersQueryParams:D({_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 Bo(rp.roles.getRoles),o=yield Bo(rp.users.getUsersRoles,{ids:t},{jwt:d}),a=e.map((e=>{var t,i;const a=null==o||null==(t=o.find((t=>t.userId===e.id)))?void 0:t.roleIds;return D({},e,{roles:null!=(i=null==a?void 0:a.map((e=>{var t;return null!=(t=null==n?void 0:n.find((t=>t.id===e)))?t:[]})))?i:[]})}));yield xo(ji.setSelectedAccountState(D({users:a},i)))}else yield xo(ji.setSelectedAccountState(D({users:[]},i)))}catch(e){yield xo(ji.setAllAccountsError({key:c,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:c,value:!1}))}}function*yI({payload:e}){const t=Jk.SET_SELECTED_SUB_ACCOUNT_DATA;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{jwt:n}=e;try{var i,o,a,r,s,l,c;const e=yield Bo(rp.accountSettings.getSettings,{jwt:n}),u=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null!=(i=null==e?void 0:e.tenantId)?i:""]},{jwt:n}),d=yield Bo(rp.tenants.getParentTenants,{jwt:n}),y=yield Bo(rp.tenants.getHierarchyMetadata,{_tenantIds:[null!=(o=null==e?void 0:e.tenantId)?o:""]},{jwt:n});yield xo(ji.setSelectedAccountState({tenantId:null!=(a=e.tenantId)?a:"",name:e.name,numberOfUsersObject:u[0],parentsAccounts:d,numberOfSubAccounts:null==(r=y[0])?void 0:r.totalSubTenants,accountSettings:e,accounts:{name:e.name,tenantId:null!=(s=e.tenantId)?s:"",numberOfUsers:null==(l=u[0])?void 0:l.totalUsers,createdAt:void 0,children:[]}})),yield xo(ji.getAccountUsers({jwt:n,_tenantId:null!=(c=null==e?void 0:e.tenantId)?c:""}))}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*fI(){const e=Jk.SET_ROOT_ACCOUNT_DATA;yield xo(ji.setAllAccountsLoader({key:e,value:!0}));const{activeTenant:t}=yield Ko((e=>e.auth.tenantsState)),{accounts:n}=yield eI();if(t)try{var i;const o=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[null==t?void 0:t.tenantId]}),a={name:null==t?void 0:t.name,tenantId:null==t?void 0:t.tenantId,numberOfUsers:null==(i=o[0])?void 0:i.totalUsers,createdAt:null==t?void 0:t.createdAt};yield xo(ji.setAllAccountsState({rootAccount:a,accounts:D({},n,a)}))}catch(t){yield xo(ji.setAllAccountsError({key:e,value:Tg(t)}))}finally{yield xo(ji.setAllAccountsLoader({key:e,value:!1}))}}function*pI({payload:e}){const t=Jk.LOAD_NUMBER_OF_USERS_FOR_ACCOUNT;yield xo(ji.setAllAccountsLoader({key:t,value:!0}));const{tenantId:n,jwt:i}=e;try{const e=yield Bo(rp.tenants.getTenantsUsersCount,{tenantIds:[n]},{jwt:i});yield xo(ji.setSelectedAccountState({numberOfUsersObject:e[0]}))}catch(e){yield xo(ji.setAllAccountsError({key:t,value:Tg(e)}))}finally{yield xo(ji.setAllAccountsLoader({key:t,value:!1}))}}function*gI(){yield $a(ji.loadAccounts,tI),yield $a(ji.searchAccounts,nI),yield $a(ji.updateSubAccountAccessForUser,uI),yield $a(ji.getUserJwtForSubAccount,iI),yield $a(ji.createSubAccount,oI),yield $a(ji.deleteSubAccount,aI),yield $a(ji.updateSubAccountSettings,rI),yield $a(ji.addUsersToAccount,cI),yield $a(ji.deleteUsersFromAccount,sI),yield $a(ji.setUserRolesForSubAccount,lI),yield $a(ji.getAccountUsers,dI),yield $a(ji.setRootAccountData,fI),yield $a(ji.setSelectedSubAccountData,yI),yield $a(ji.loadNumberOfUsersForSelectedSubAccount,pI)}const SI=["callback"],vI=["callback"],hI=["callback","phoneId"],mI=["callback","phoneId"],AI=["callback"];function*bI(){yield xo(ji.setSmsState({loading:!0}));const e={_limit:10,_offset:0};try{const{items:t}=yield Bo(rp.userPhoneNumbers.getUserPhoneNumbers,e);yield xo(ji.setSmsState({phoneNumbers:t}))}catch(e){yield xo(ji.setSmsState({error:Tg(e)}))}finally{yield xo(ji.setSmsState({loading:!1}))}}function*TI(e){let{payload:{callback:t}}=e,n=to(e.payload,SI);yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.createPhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),yield Bo(bI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*EI(e){let{payload:{callback:t}}=e,n=to(e.payload,vI);yield xo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyPhoneNumber,n),yield Bo(bI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*kI(e){let{payload:{callback:t,phoneId:n}}=e;to(e.payload,hI),yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.deletePhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*II(e){let{payload:{callback:t,phoneId:n}}=e,i=to(e.payload,mI);yield xo(ji.setSmsState({loading:!0}));try{yield Bo(rp.userPhoneNumbers.verifyDeletePhoneNumber,n,i),yield Bo(bI),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*OI(e){let{payload:{callback:t}}=e,n=to(e.payload,AI);yield xo(ji.setSmsState({loading:!0}));try{const e=yield Bo(rp.userPhoneNumbers.preVerifyPhoneNumber,n);yield xo(ji.setSmsState({otcToken:e.otcToken})),null==t||t(!0)}catch(e){yield xo(ji.setSmsState({error:Tg(e)})),null==t||t(null,e)}finally{yield xo(ji.setSmsState({loading:!1}))}}function*PI(){yield Ga(ji.loadPhoneNumbers,bI),yield Ga(ji.setUpPhoneNumber,TI),yield Ga(ji.verifyPhoneNumber,EI),yield Ga(ji.deletePhoneNumber,kI),yield Ga(ji.verifyDeletePhoneNumber,II),yield Ga(ji.preVerifyPhoneNumber,OI)}function*_I(e){yield Bo(ZS,e),yield Bo(av)}function*LI({mfaToken:e,mfaDevices:t}){yield xo(ji.setStepUpState({mfaDevices:t,mfaToken:e}));const n=yield Bo(mg,t);yield xo(ji.setMfaState({step:n}))}function*UI(e){if((e=>"MFA is not enrolled"===(null==e?void 0:e.message))(e))return void(yield xo(ji.setMfaState({step:un.noMFAEnrolledStepUp})));window.localStorage.setItem(tv,"true");const{routes:t}=yield Ko((e=>e.auth));Va.onRedirectTo(t.logoutUrl,{preserveQueryParams:!0})}function*wI({payload:{maxAge:e,callback:t}}){yield xo(ji.setStepUpState({mfaDevices:void 0,mfaToken:""}));try{const n=yield Bo(rp.auth.generateStepupSession,{maxAge:e});n.user?yield Bo(_I,n):yield Bo(LI,n),null==t||t(!0)}catch(e){null==t||t(!1),yield Bo(UI,e)}}function*CI({payload:e}){yield uv(e,ji.setStepUpState,!0)}function*RI({payload:e}){yield Ev(e,ji.setStepUpState)}function*DI({payload:e}){yield kv(e,ji.setStepUpState,!0)}function*NI({payload:e}){yield vv(e,ji.setStepUpState)}function*MI({payload:e}){yield hv(e,ji.setStepUpState,!0)}function*FI({payload:e}){yield Uv(e,ji.setStepUpState)}function*GI({payload:e}){yield Lv(e,ji.setStepUpState)}function*$I(){yield xa(ji.generateStepUpSession,wI),yield xa(ji.stepUpWithAuthenticator,CI),yield xa(ji.preVerifyMFASMSForStepUp,NI),yield xa(ji.verifyMFASMSForStepUp,MI),yield xa(ji.preVerifyMFAWebAuthnForStepUp,RI),yield xa(ji.verifyMFAWebAuthnForStepUp,DI),yield xa(ji.verifyMFAEmailCodeForStepUp,FI),yield xa(ji.preVerifyMFAEmailCodeForStepUp,GI)}var xI={sagas:function*(){yield Vo([Bo(Gh),Bo($I),Bo(MA),Bo(GA),Bo(OA),Bo(yE),Bo(em),Bo(_m),Bo(Dm),Bo(wg),Bo(yA),Bo(qb),Bo(Fk),Bo(vT),Bo(GS),Bo(OT),Bo(mS),Bo(NT),Bo(BT),Bo(iE),Bo(hE),Bo(PE),Bo(QE),Bo(Sk),Bo(mk),Bo(Tk),Bo(gI),Bo(YS),Bo(Bg),Bo(PI)])},mockSagas:function*(){yield Vo([Bo(Vh),Bo(sm),Bo(Gm),Bo(bA),Bo(cT),Bo(CT),Bo(CS),Bo(TE),Bo(GT),Bo(zT),Bo(UE),Bo(lk),Bo(aE),Bo(qk),Bo(Yg)])},storeName:Dt,initialState:Ni,reducer:xi,actions:ji};const VI=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>D({},t,{[e]:D({},t[e],n)})}),jI={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},BI={setAuditLogsState:VI("auditLogsState"),resetAuditLogsState:e=>D({},e,{auditLogsState:jI})},WI={exportAuditsCsv:yt("auditLogs/exportAuditsCsv"),loadAuditLogs:yt("auditLogs/loadAuditLogs",(e=>({payload:e})))},zI={loading:!0},KI={setAuditsMetadataState:VI("auditsMetadataState"),resetAuditsMetadataState:e=>D({},e,{auditsMetadataState:zI})},HI={loadAuditsMetadata:yt("auditLogs/loadAuditsMetadata")},qI={auditLogsState:jI,auditsMetadataState:zI},{reducer:JI,actions:YI}=pt({name:Mt,initialState:qI,reducers:D({resetState:e=>D({},e,qI),setState:(e,{payload:t})=>D({},e,t)},BI,KI)}),XI=D({},YI,WI,HI),QI=e=>"createdAt"!==e.id,ZI={total:20,data:Array.from(Array(5).keys()).map((e=>D({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`})))},eO={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}]},tO=()=>Ko((e=>e.auditLogs.auditLogsState)),nO=()=>Ko((e=>e.auditLogs.auditsMetadataState));function*iO(){const e=yield tO(),{columns:t}=yield nO();try{const n=e.filter,i=e.sort.reduce(((e,t)=>D({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>D({},e,{[t.id]:t.value})),{});yield xo(XI.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield rp.audits.exportAudits(D({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield xo(XI.setAuditLogsState({isDownloadingCsv:!1}))}function*oO({payload:e}){yield xo(XI.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield tO(),{columns:n}=yield nO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield xo(XI.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>D({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>D({},e,{[t.id]:t.value})),{});n||(yield xo(XI.loadAuditsMetadata()));const{data:p,total:g}=yield Bo(rp.audits.getAudits,D({offset:c,count:l},y,f));yield xo(XI.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 xo(XI.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*aO(){yield Ga(XI.exportAuditsCsv,iO),yield Ga(XI.loadAuditLogs,oO)}function*rO({payload:e}){yield xo(XI.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield tO(),{columns:n}=yield nO();try{var i,o,a,r,s;const l=null!=(i=e.pageSize)?i:t.pageSize,c=null!=(o=e.pageOffset)?o:t.pageOffset,u=null!=(a=e.filter)?a:t.filter,d=null!=(r=e.sort)?r:t.sort;yield xo(XI.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield xo(XI.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=ZI;let i=n.filter((e=>t=>e.filter(QI).every((e=>t[e.id].includes(e.value))))(e));if(t.length){const{id:e,desc:n=!1}=t[0];i=i.sort(((e,t)=>(n,i)=>n[e]>i[e]?t?-1:1:i[e]>n[e]?t?1:-1:0)(e,n))}return{data:i,total:i.length}})(u,d);yield xo(XI.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 xo(XI.setAuditLogsState({loading:!1,error:Tg(t)})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*sO(){yield Ga(XI.loadAuditLogs,rO)}function*lO(){yield xo(XI.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield Bo(rp.metadata.getAuditsMetadata);yield xo(XI.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield xo(XI.setAuditsMetadataState({error:e,loading:!1}))}}function*cO(){yield Ga(XI.loadAuditsMetadata,lO)}function*uO(){yield xo(XI.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=eO;yield xo(XI.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield xo(XI.setAuditsMetadataState({error:e,loading:!1}))}}function*dO(){yield Ga(XI.loadAuditsMetadata,uO)}var yO={sagas:function*(){yield Vo([Bo(aO),Bo(cO)])},mockSagas:function*(){yield Vo([Bo(sO),Bo(dO)])},storeName:Mt,initialState:qI,reducer:JI,actions:XI};const fO={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:pO,actions:gO,reducer:SO}=pt({name:"audits",initialState:fO,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=D({},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]})))}}}),vO=D({},gO,{initData:yt(`${pO}/initData`),loadAudits:yt(`${pO}/loadAudits`),removeFilter:yt(`${pO}/removeFilter`),filterData:yt(`${pO}/filterData`),exportCSV:yt(`${pO}/exportCSV`),deleteAudits:yt(`${pO}/deleteAudits`)}),hO=()=>Ko((e=>e[pO]));function*mO(){const{sortBy:e,sortDirection:t}=yield hO();try{const n=yield Bo(rp.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield xo(vO.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield xo(vO.loadItemFailedAction(t))}}function*AO(){try{const e=yield Bo(rp.metadata.getAuditsMetadata);yield xo(vO.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield xo(vO.loadItemFailedAction(t))}}const bO=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*TO({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield hO(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield hO():{rowsData:[]};try{const e=bO(t),{data:s,total:d}=yield Bo(rp.audits.getAudits,D({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield xo(vO.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield xo(vO.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield xo(vO.loadItemFailedAction(t))}}function*EO(){yield xo(vO.startLoading()),yield Vo([mO(),AO(),TO({payload:{onlyOneLoad:!1},type:""})]),yield xo(vO.finishLoading())}function*kO({payload:e}){const{filters:t}=yield hO(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield xo(vO.setFilterData(i))}function*IO({payload:e}){const{filters:t}=yield hO();let n=t.findIndex((t=>t.key===e.key));n<0&&(n=t.length);const i=[...t.slice(0,n),e,...t.slice(n+1)];yield xo(vO.setFilterData(i))}function*OO(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield hO(),a=bO(e);yield xo(vO.startDownloadingCsv());try{yield rp.audits.exportAudits(D({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield xo(vO.stopDownloadingCsv())}}function*PO(){yield $a(vO.initData,EO),yield $a(vO.removeFilter,kO),yield $a(vO.filterData,IO),yield $a([vO.loadAudits,vO.textSearch,vO.onPageChange],TO),yield $a([vO.setFilterData,vO.setDataSorting,vO.startRefresh],(()=>TO({payload:{appendMode:!1},type:""}))),yield $a(vO.exportCSV,OO)}const _O={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LO={initData:()=>D({},_O),setConnectivityState:(e,{payload:t})=>D({},e,t),cleanWebhookTestData:e=>D({},e,{testResult:void 0}),cleanWebhookLogsData:e=>D({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return D({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>D({},e,{error:void 0}),cleanSlackData:e=>D({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>D({},e,{retryResult:D({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>D({},e,{retryResult:D({},e.retryResult,t)})}},UO={loadSlackActions:yt("connectivity/loadSlackActions"),loadDataAction:yt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:yt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:yt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:yt("connectivity/loadScope"),deleteWebhookConfigAction:yt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:yt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:yt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},wO={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:CO,actions:RO}=pt({name:Nt,initialState:wO,reducers:D({},LO)}),DO=D({},RO,UO),NO={slack:rp.connectivity.getSlackConfiguration,email:rp.connectivity.getEmailConfiguration,sms:rp.connectivity.getSMSConfiguration,webhook:rp.connectivity.getWebhooksConfigurations,categories:rp.connectivity.getCategories,channelMap:rp.connectivity.getChannelMaps},MO={slack:rp.connectivity.postSlackConfiguration,email:rp.connectivity.postEmailConfiguration,sms:rp.connectivity.postSMSConfiguration,webhook:rp.connectivity.postWebhooksConfiguration},FO=["email","slack","sms","webhook"],GO={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"}},$O=["id"],xO=["id","enabled"],VO=["categories","channelMap"];function*jO(e){return yield Bo(WO,{payload:{api:e},type:""})}function*BO({payload:e=FO}){yield xo(DO.setConnectivityState({isLoading:!0}));try{const t=yield Vo([...e.map(jO),yield WO({payload:{api:"categories"},type:""}),yield function*(){return(yield Vo(e.map((function*(e){return yield WO({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>D({},t,{[`${e[i]}`]:n})),{})}()]),n=yield WO({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?D({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:GO[e[o]].events(i),active:GO[e[o]].isActive(i),platform:GO[e[o]].title,image:GO[e[o]].image}]}):n:D({},n,{[`${VO[o-e.length]}`]:i})),{list:[],webhook:n});yield xo(DO.setConnectivityState(D({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield xo(DO.setConnectivityState({isLoading:!1}))}}function*WO({payload:{api:e,params:t}}){try{return yield Bo(NO[e],t)}catch(e){return}}function*zO(){try{yield xo(DO.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield Bo(rp.connectivity.getSlackChannels);yield xo(DO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield xo(DO.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*KO(e,t){const{connectivity:{list:n}}=yield Ko(),i=n.find((({key:t})=>t===e));if(!i)return;const o=GO[e].isActive(t);o!==i.active&&(yield xo(DO.setConnectivityState({list:n.map((t=>t.key===e?D({},t,{active:o}):t))})))}function*HO({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield Ko((e=>e.connectivity));try{if(yield xo(DO.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield Ko();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield Vo([...i.reduce(((e,t)=>{var i,o;return!t.id&&t.slackEvents&&null!=(i=t.slackEvents[0].channelIds)&&i.length||(null==n?void 0:n.find((e=>{let{id:n}=e,i=to(e,$O);return n===t.id&&JSON.stringify(D({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield Bo(MO.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield Bo(rp.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield Ko(),{processIds:i}=yield Ko((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield Vo([...e.reduce(((e,t)=>!o.find((({eventKey:e})=>e===t.eventKey))&&t.subscriptions[0].recipients.filter((e=>e)).length?[...e,t]:e),[]).map((function*(e){return yield Bo("email"===t?rp.connectivity.postEmailConfiguration:rp.connectivity.postSMSConfiguration,e)})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&JSON.stringify(n)!==JSON.stringify(t)?[...e,t]:e}),[]).map((function*(e){const{subscriptions:n,eventKey:i}=e,o=n[0],{id:a="",enabled:r}=o,s=to(o,xO);return yield Vo([yield Bo("email"===t?rp.connectivity.patchEmailConfiguration:rp.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield Bo("email"===t?rp.connectivity.putEmailSubscriptions:rp.connectivity.putSMSSubscriptions,a,i,D({},s,{enabled:r}))])})),...e.reduce(((e,t)=>{const n=o.find((({eventKey:e})=>e===t.eventKey));return n&&n.subscriptions[0].recipients.length&&!t.subscriptions[0].recipients.filter((e=>!!e)).length?[...e,t]:e}),[]).map((function*({eventKey:e,subscriptions:n}){return Bo("email"===t?rp.connectivity.deleteEmailSubscriptions:rp.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield WO({payload:{api:t},type:""});yield xo(DO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield KO(t,e)}else yield xo(DO.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield Bo(MO[e],t),!["sms","email"].includes(e)){const o=yield WO({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield xo(DO.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield KO(e,o),null==n||n(!0)}}catch(e){yield xo(DO.setConnectivityState({error:Tg(e,e.toString()),isSaving:!1,isLoading:!1}))}}function*qO({payload:e}){try{yield rp.connectivity.postSlackCode(e)}catch{}yield xo(DO.setConnectivityState({error:void 0,isSaving:!1}))}function*JO(){const{slackChannels:e}=yield Ko((e=>e.connectivity));try{yield xo(DO.setConnectivityState({slackChannels:D({},e,{isLoadingScope:!0})}));const{clientId:t}=yield Bo(rp.connectivity.getSlackScope);yield xo(DO.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield xo(DO.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*YO({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield Ko((e=>e.connectivity));try{yield xo(DO.setConnectivityState({isSaving:!0})),yield Bo(rp.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,Tg(e))}const o=yield WO({payload:{api:"webhook"},type:""});o&&(yield xo(DO.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*XO({payload:e}){try{yield xo(DO.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield Bo(rp.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield xo(DO.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield xo(DO.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield xo(DO.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*QO({payload:e}){try{const{statusCode:t}=yield Bo(rp.connectivity.postWebhookRetry,e);yield xo(DO.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield xo(DO.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*ZO({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield Ko((e=>e.connectivity));try{yield xo(DO.setConnectivityState({webhookLogs:D({},i,{isLoading:!0})}));const o=yield Bo(rp.connectivity.getWebhookLog,e,n,t);yield xo(DO.setConnectivityState({error:void 0,webhookLogs:D({isLoading:!1},o)}))}catch(e){yield xo(DO.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var eP={sagas:function*(){yield Ga(DO.loadDataAction,BO),yield $a(DO.loadSlackActions,zO),yield Ga(DO.postDataAction,HO),yield Ga(DO.postCodeAction,qO),yield Ga(DO.loadScope,JO),yield Ga(DO.deleteWebhookConfigAction,YO),yield Ga(DO.postWebhookTestAction,XO),yield Ga(DO.postWebhookRetryAction,QO),yield $a(DO.loadWebhookLogsAction,ZO)},storeName:Nt,initialState:wO,reducer:CO,actions:DO};function tP(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}}function nP(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>D({},n,{[e]:t(n[e],i)})}}function iP(e){return nP(e,((e,t)=>D({},e,{loading:t.payload})))}function oP(e){return nP(e,((e,t)=>D({},e,{error:t.payload,loading:!1})))}const aP={loading:!1,error:null,fetching:!0,plans:[]},{actions:rP,reducer:sP,name:lP}=pt({name:"subscriptions/plans",initialState:aP,reducers:D({},tP())}),cP=D({loadPlans:yt(`${lP}/loadPlans`)},rP),uP={loading:!1,error:null,fetching:!0,config:null},dP=D({},tP()),{actions:yP,reducer:fP,name:pP}=pt({name:"subscriptions/config",initialState:uP,reducers:dP}),gP=D({loadPaymentConfiguration:yt(`${pP}/loadPaymentConfiguration`)},yP),SP={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},vP=D({},tP(),{setCancellationLoading:iP("cancellation"),setCancellationError:oP("cancellation"),setRenewalLoading:iP("renewal"),setRenewalError:oP("renewal")}),{reducer:hP,actions:mP,name:AP}=pt({name:"subscriptions/billing/subscription",initialState:SP,reducers:vP}),bP=D({load:yt(`${AP}/loadSubscription`),cancelSubscription:yt(`${AP}/cancelSubscription`),renewSubscription:yt(`${AP}/renewSubscription`)},mP),TP={loading:!1,error:null,fetching:!0},EP=D({},tP()),{reducer:kP,actions:IP,name:OP}=pt({name:"subscriptions/billing/information",initialState:TP,reducers:EP}),PP=D({loadBillingInformation:yt(`${OP}/loadBillingInformation`),cancelSubscription:bP.cancelSubscription,renewSubscription:bP.renewSubscription},IP),_P={loading:!1,error:null,fetching:!0},LP=D({},tP(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,t.payload)}}),{reducer:UP,actions:wP,name:CP}=pt({name:"subscriptions/billing/payment",initialState:_P,reducers:LP}),RP=D({loadPaymentMethod:yt(`${CP}/loadPaymentMethod`),submitPaymentMethod:yt(`${CP}/submitPaymentMethod`),submitPaymentMethodError:yt(`${CP}/submitPaymentMethodError`),submitPaymentMethodSuccess:yt(`${CP}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:yt(`${CP}/updateBillingDetails`,(e=>({payload:e})))},wP),DP={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},NP=D({},tP(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>D({},e,{invoiceDownload:D({},e.invoiceDownload,t.payload)})}}),{reducer:MP,actions:FP,name:GP}=pt({name:"subscriptions/billing/invoices",initialState:DP,reducers:NP}),$P=D({loadInvoices:yt(`${GP}/loadInvoices`),downloadInvoice:yt(`${GP}/downloadInvoice`,(e=>({payload:e})))},FP),xP={information:TP,invoices:DP,paymentMethod:_P,subscription:SP},VP={invoices:$P,information:PP,paymentMethod:RP,subscription:bP},jP=Ke({invoices:MP,information:kP,paymentMethod:UP,subscription:hP}),BP={fetching:!0,loading:!1,error:null,confirmed:!1},WP=D({},tP()),{actions:zP,reducer:KP,name:HP}=pt({name:"subscriptions/checkout",initialState:BP,reducers:WP}),qP=D({loadCheckout:yt(`${HP}/loadCheckout`),resetCheckout:yt(`${HP}/resetCheckout`),submitCheckout:yt(`${HP}/submitCheckout`),confirmCheckout:yt(`${HP}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:yt(`${HP}/errorCheckout`,(e=>({payload:e})))},zP),JP={loading:!1,error:null,cardSetupIntentSecret:null},YP=D({},tP()),{reducer:XP,actions:QP,name:ZP}=pt({name:"subscriptions/stripe",initialState:JP,reducers:YP}),e_=D({loadCustomer:yt(`${ZP}/loadCustomer`),createCardSetupIntentSecret:yt(`${ZP}/createCardSetupIntentSecret`)},QP),t_={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:n_,reducer:i_,name:o_}=pt({name:"subscriptions/vendorPublicConfig",initialState:t_,reducers:D({},tP())}),a_=D({loadVendorPublicConfiguration:yt(`${o_}/loadVendorPublicConfiguration`)},n_),r_={config:uP,plans:aP,checkout:BP,billing:xP,stripe:JP,vendorPublicConfig:t_},s_={config:gP,billing:VP,plans:cP,checkout:qP,stripe:e_,vendorPublicConfig:a_},l_=Ke({config:fP,billing:jP,plans:sP,checkout:KP,stripe:XP,vendorPublicConfig:i_});let c_,u_,d_;function y_({policy:e}){return{policy:d_.AT_PERIOD_END}}function f_(e){switch(e){case Xy.ACTIVE:return u_.ACTIVE;case Xy.INCOMPLETE:return u_.INCOMPLETE;case Xy.CANCELED:return u_.CANCELED;case Xy.EXPIRED:return u_.EXPIRED;case Xy.TRIALING:return u_.TRIALING;default:return u_.EXPIRED}}!function(e){e.STRIPE="Stripe"}(c_||(c_={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(u_||(u_={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(d_||(d_={}));const p_={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Xy.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},g_=[{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"}],S_=[{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:""}],v_=[{id:"id",externalId:"externalId",type:Qy.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],h_={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*m_(){yield xo(bP.setLoading(!0));try{const[e]=yield Bo(rp.subscriptions.getManagedSubscriptions);yield xo(bP.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield xo(bP.setError(e))}}function*A_(){yield Ga(PP.loadBillingInformation,b_)}function*b_(){yield function*(e){const t=yield Ko((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield T_(n,!1):yield xo(PP.setError(t?"Not authorized":"Internal feature failure"))}()}function*T_(e,t){yield xo(PP.setLoading(!0));try{var n,i;const o=yield Bo(rp.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield Bo(rp.subscriptions.getSubscriptionPlan,a):([,s]=yield Vo([Bo(m_),Bo(rp.subscriptions.getSubscriptionPlan,a)]),l=yield Ko((e=>e.subscriptions.billing.subscription.subscription||null))),yield xo(PP.setState(D({loading:!1,fetching:!1,summary:o},l?{subscription:{id:l.id,externalId:l.externalId,startDate:l.startDate,currentPeriodStart:l.currentPeriodStart,currentPeriodEnd:l.currentPeriodEnd,status:t?u_.ACTIVE:f_(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==(i=s.price)?void 0:i.currency)||"usd",recurringInterval:"month",slug:s.slug}}:{})))}catch(e){yield xo(PP.setError(Tg(e)))}}function*E_(){yield function*(){var e,t;yield xo(PP.setLoading(!0)),yield Ho(500),yield xo(PP.setState({loading:!1,fetching:!1,summary:{subscriptionId:p_.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ef.Stripe,externallyManaged:!1,currentPlanId:g_[0].id,defaultPlanId:g_[0].id},plan:D({},g_[0],{price:null==(e=g_[0].price)?void 0:e.amount,currency:null==(t=g_[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*k_(){yield Ga(PP.loadBillingInformation,E_)}function*I_(){yield Ga(RP.loadPaymentMethod,O_),yield Ga(RP.submitPaymentMethod,__),yield Ga(RP.submitPaymentMethodError,L_),yield Ga(RP.submitPaymentMethodSuccess,U_),yield Ga(RP.updatePaymentMethodBillingDetails,P_)}function*O_(){yield xo(RP.setLoading(!0));try{const e=(yield Bo(rp.subscriptions.getPaymentMethods))[0];yield xo(RP.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield xo(RP.setError(Tg(e)))}}function*P_({payload:e}){yield xo(RP.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield Bo(rp.subscriptions.updatePaymentMethodBillingDetails,t,D({email:n},i)),yield Bo(O_),null==o||o(!0)}catch(e){yield xo(RP.setError(Tg(e))),null==o||o(!1)}yield xo(RP.setLoading(!1))}function*__(){yield xo(RP.setLoading(!0))}function*L_({payload:e}){yield xo(RP.setError(e))}function*U_(){yield xo(RP.loadPaymentMethod())}function*w_(){yield xo(RP.setLoading(!0)),yield Ho(500);const e=v_[0];yield xo(RP.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*C_(){yield Ga(RP.loadPaymentMethod,w_)}function*R_(){yield Ga($P.loadInvoices,D_),yield Ga($P.downloadInvoice,N_)}function*D_(){yield xo($P.setLoading(!0));try{const e=(yield Bo(rp.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 xo($P.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield xo($P.setError(Tg(e)))}}function*N_({payload:e}){yield xo($P.setInvoiceDownloadState({loading:!0,error:null}));try{yield Bo(rp.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield xo($P.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield xo($P.setInvoiceDownloadState({loading:!1,error:Tg(e,null)}))}}function*M_(){yield xo($P.setLoading(!0)),yield Ho(500),yield xo($P.setState({loading:!1,fetching:!1,invoices:S_.map((e=>D({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield xo($P.setLoading(!1))}function*F_(){yield Ga($P.loadInvoices,M_)}function*G_(){yield Ga(bP.load,$_),yield Ga(bP.cancelSubscription,x_),yield Ga(bP.renewSubscription,V_)}function*$_(){const e=yield Ko((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield T_(e)}function*x_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield xo(bP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield xo(bP.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Xy.ACTIVE)try{yield xo(bP.setCancellationLoading(!0)),yield Bo(rp.subscriptions.cancelManagedSubscription,t),yield m_(),yield xo(bP.setCancellationLoading(!1))}catch(e){yield xo(bP.setCancellationError(Tg(e)))}}function*V_(){const{subscription:e}=yield Ko((e=>e.subscriptions.billing.subscription));if(!e)return void(yield xo(bP.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield xo(bP.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zy.AT_PERIOD_END)try{yield xo(bP.setRenewalLoading(!0)),yield Bo(rp.subscriptions.renewManagedSubscription,t),yield m_(),yield xo(bP.setRenewalLoading(!1))}catch(e){yield xo(bP.setCancellationError(Tg(e)))}}function*j_(){yield xo(bP.setLoading(!0)),yield Ho(500),yield xo(bP.setState({subscription:p_,fetching:!1,loading:!1,error:null}))}function*B_(){yield Ga(bP.load,j_)}function*W_(){yield Vo([Bo(A_),Bo(I_),Bo(R_),Bo(G_)])}function*z_(){yield Vo([Bo(k_),Bo(C_),Bo(F_),Bo(B_)])}function*K_(){yield Ga(qP.loadCheckout,H_),yield Ga(qP.resetCheckout,q_),yield Ga(qP.submitCheckout,J_),yield Ga(qP.confirmCheckout,Y_),yield Ga(qP.errorCheckout,Q_)}function*H_(){yield xo(qP.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*q_(){yield xo(qP.setState({loading:!1,error:null,confirmed:!1}))}function*J_(){yield xo(qP.setState({loading:!0,error:null}))}function*Y_({payload:{paymentMethodId:e,planId:t}}){const n=yield Ko((e=>e.subscriptions.billing.subscription.subscription)),i=yield Ko((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Xy.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield xo(qP.setState({loading:!0,error:null})),o&&a)return yield X_(),void(yield xo(bP.setState({subscription:D({},n,{status:Xy.ACTIVE})})));try{yield Bo(rp.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield Vo([b_(),O_(),D_()]),yield X_()}catch(e){yield xo(qP.setState({loading:!1,error:Tg(e)}))}}else yield xo(qP.setState({loading:!1,error:"Subscription not found"}))}function*X_(){yield xo(qP.setState({loading:!1,error:null,confirmed:!0}))}function*Q_({payload:e}){yield xo(qP.setState({loading:!1,error:e}))}function*Z_(){yield Ga(qP.resetCheckout,q_)}function*eL(){yield Ga(cP.loadPlans,tL)}function*tL(){yield xo(cP.setLoading(!0));try{const e=(yield Bo(rp.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 xo(cP.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield xo(cP.setError(Tg(e)))}}function*nL(){yield xo(cP.setLoading(!0)),yield Ho(500),yield xo(cP.setState({fetching:!1,loading:!1,plans:g_.map((e=>{var t,n;return D({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*iL(){yield Ga(cP.loadPlans,nL)}function*oL(){yield Ga(gP.loadPaymentConfiguration,aL)}function*aL(){yield xo(gP.setLoading(!0));try{(yield Bo(rp.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ef.Stripe))?yield function*(){yield xo(gP.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getStripePaymentProviderConfiguration);yield xo(gP.setState({loading:!1,fetching:!1,config:{paymentProvider:c_.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield xo(gP.setError(Tg(e)))}}():yield xo(gP.setError("Payment provider not configured"))}catch(e){yield xo(gP.setError(Tg(e)))}}function*rL(){yield xo(gP.setLoading(!0)),yield Ho(500),yield xo(gP.setState({loading:!1,fetching:!1,config:{paymentProvider:c_.STRIPE,apiKey:""}}))}function*sL(){yield Ga(gP.loadPaymentConfiguration,rL)}function*lL(){yield Ga(e_.createCardSetupIntentSecret,cL)}function*cL({payload:e}){yield xo(e_.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield Bo(rp.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield xo(e_.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield xo(e_.setError(Tg(e)))}}function*uL(){yield Ga(a_.loadVendorPublicConfiguration,dL)}function*dL(){yield xo(a_.setLoading(!0));try{const e=yield Bo(rp.subscriptions.getVendorPublicConfigurations);yield xo(a_.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield xo(a_.setError(Tg(e)))}}function*yL(){yield xo(a_.setLoading(!0)),yield Ho(500),yield xo(a_.setState({fetching:!1,loading:!1,vendorPublicConfig:h_}))}function*fL(){yield Ga(a_.loadVendorPublicConfiguration,yL)}var pL={sagas:function*(){yield Vo([Bo(W_),Bo(K_),Bo(eL),Bo(oL),Bo(lL),Bo(uL)])},mockSagas:function*(){yield Vo([Bo(z_),Bo(Z_),Bo(iL),Bo(sL),Bo(fL)])},reducer:l_,actions:s_,initialState:r_,storeName:"subscriptions"},gL={sagas:function*(){yield Ga(WS.loadVendorPublicInfo,zS)},storeName:Ft,initialState:VS,reducer:jS,actions:WS};const{reducer:SL}=pt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(Va.setContext(t),D({},e,{context:t}))}}}),vL=(e,t,n=!1,i,o,a=!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,u,d,y,f,p,g,S,v,h;n||a||Va.setContext(e.context);const t=La(),s=[...ut({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];l.store=dt({middleware:s,preloadedState:{root:D({},e,{previewMode:n,urlStrategy:r}),[xI.storeName]:D({},xI.initialState,i,null!=(c=null==o?void 0:o.auth)?c:{},{routes:D({},xI.initialState.routes,null!=(u=null==i?void 0:i.routes)?u:{},null!=(d=null==o||null==(y=o.auth)?void 0:y.routes)?d:{})}),[yO.storeName]:D({},yO.initialState,null!=(f=null==o?void 0:o.auditLogs)?f:{},{auditLogsState:D({},yO.initialState.auditLogsState,null!=(p=null==o||null==(g=o.auditLogs)?void 0:g.auditLogsState)?p:{}),auditsMetadataState:D({},yO.initialState.auditsMetadataState,null!=(S=null==o||null==(v=o.auditLogs)?void 0:v.auditsMetadataState)?S:{})}),[pO]:D({},fO,null!=(h=null==o?void 0:o.audits)?h:{}),[eP.storeName]:eP.initialState,[pL.storeName]:pL.initialState,[gL.storeName]:gL.initialState},reducer:Ke({root:SL,[xI.storeName]:xI.reducer,[yO.storeName]:yO.reducer,[pO]:SO,[eP.storeName]:eP.reducer,[pL.storeName]:pL.reducer,[gL.storeName]:gL.reducer})});const m=function*(){yield Vo([Bo(xI.sagas),Bo(yO.sagas),Bo(PO),Bo(eP.sagas),Bo(pL.sagas),Bo(gL.sagas)])},A=function*(){yield Vo([Bo(xI.mockSagas),Bo(yO.mockSagas),Bo(pL.mockSagas)])};n?(l.store.destroy=t.run(A).cancel,l.store.dispatch(ji.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 hL=n(314);const mL=()=>{if(!Va.shouldLoadEntitlements())throw new Error("You must first enable entitlements via Frontegg options to use this function")},AL=(e,t)=>e?e.isEntitled?{isEntitled:!0}:{isEntitled:!1,justification:e.justification}:{isEntitled:!1,justification:t};var bL=n(714),TL=n.n(bL);function EL(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function kL(e){if(e.type)return e;if("#"===e.charAt(0))return kL(function(e){e=e.substr(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map((e=>e+e))),n?`rgb${4===n.length?"a":""}(${n.map(((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}(e));const t=e.indexOf("("),n=e.substring(0,t);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw new Error("MUI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color(). "+e);const i=e.substring(t+1,e.length-1);let o,a;if("color"===n){if(a=i.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].substr(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(o))throw new Error("MUI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020."+o)}else a=i.split(",");return{type:n,values:a.map((e=>parseFloat(e))),colorSpace:o}}function IL(e){const{type:t,colorSpace:n}=e;let{values:i}=e;return-1!==t.indexOf("rgb")?i=i.map(((e,t)=>t<3?parseInt(e,10):e)):-1!==t.indexOf("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),i=-1!==t.indexOf("color")?`${n} ${i.join(" ")}`:`${i.join(", ")}`,`${t}(${i})`}function OL(e){if(0===e.indexOf("#"))return e;const{values:t}=kL(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 PL(e,t){return e=kL(e),t=EL(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,IL(e)}function _L(e,t){if(e=kL(e),t=EL(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 IL(e)}function LL(e,t){if(e=kL(e),t=EL(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 IL(e)}const UL=e=>{if(e)return{main:e,light:OL(LL(e,.4)),dark:OL(_L(e,.15)),hover:OL(_L(e,.15)),active:OL(_L(e,.2))}},wL=e=>{if(e)return{main:e,light:LL(e,.7),dark:_L(e,.2)}},CL=(e,t)=>{var n,i,o,a,r,s,l,c,u,d,y,f;return null!=e&&e.palette&&"string"==typeof(null==e||null==(n=e.palette)?void 0:n.primary)?D({},t,{palette:{primary:D({},UL(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:D({},UL(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:D({},UL(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:D({},wL(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:D({},wL(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:D({},wL(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:D({},wL(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},RL={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",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},provisioning:{visibility:"hidden",permissions:["fe.secure.read.provisioningConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]},allAccounts:{visibility:"byPermissions",permissions:["fe.account-hierarchy.read.subAccount"]},groups:{visibility:"hidden",permissions:["fe.secure.read.groups"]}}};class DL{constructor(){this._theme=RL.theme,this._themeV2=RL.themeV2,this._navigation=RL.navigation,this._localizations=RL.localizations,this._integrations=RL.integrations}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new DL;return n.set(e),DL._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,i,o,a,r,s,l,c;this._navigation=TL().all([null!=(t=RL.navigation)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=TL().all([null!=(i=RL.theme)?i:{},CL(null==e?void 0:e.theme,RL.theme)]),this._themeV2=TL().all([null!=(o=RL.themeV2)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=TL().all([null!=(r=RL.localizations)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}]),this._integrations=TL().all([null!=(l=RL.integrations)?l:{},null!=(c=null==e?void 0:e.integrations)?c:{}])}catch(e){this._navigation=RL.navigation,this._theme=RL.theme,this._themeV2=RL.themeV2,this._localizations=RL.localizations,this._integrations=RL.integrations}}}DL._instances={};var NL=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},ML=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=document.createElement(t);return Object.keys(n).forEach((function(e){return i.setAttribute(e,n[e])})),e.appendChild(i),i},FL=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))},GL=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 $L,xL,VL,jL,BL,WL,zL,KL,HL,qL,JL,YL;!function(e){e.phoneNumber="phoneNumber"}($L||($L={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(xL||(xL={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(VL||(VL={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(jL||(jL={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(BL||(BL={})),function(e){e.Invoices="invoices"}(WL||(WL={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(zL||(zL={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(KL||(KL={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(HL||(HL={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(qL||(qL={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(JL||(JL={})),function(e){e.Settings="settings",e.CustomLogin="customLogin"}(YL||(YL={}));const XL={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},QL={hidden:"hidden",edit:"edit"};var ZL="6.164.0",eU={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"},tU=function(){function e(t,n){var i,o,a=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];O(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(ZL),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,i,o,r;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Rr,a.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,a.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(o=i[0])?void 0:o.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:DL.set(a.options.metadata,a.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=M(G().mark((function e(){var t,n,i;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=null==(t=a.options.authOptions)||null==(n=t.hostedLoginOptions)?void 0:n.loadUserOnFirstLoad,a.options.builderMode||"nextjs"===a.options.framework||(a.options.hostedLoginBox&&!a.options.customLoginBox?i&&a.store.dispatch({type:"auth/requestHostedLoginAuthorizeV2",payload:{shouldRedirectToLogin:!1,firstTime:!0}}):a.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(!a.options.previewMode&&!a.options.builderMode){e.next=4;break}Br.set(eU,a.name),e.next=15;break;case 4:return e.prev=4,e.next=7,Wr();case 7:t=e.sent,a.options.overrideFeatureFlags&&Object.assign(t,a.options.overrideFeatureFlags),Br.set(t,a.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){Br.set(D({},eU,e),a.name)},this.queryFeatureFlags=function(e){return Br.getFeatureFlags(e,a.name)},this.updateLocalizationsSetter=function(e){a.updateLocalizations=e},this.getEntitlementsFromStore=function(){var e;return null==(e=a.store.getState().auth.user)?void 0:e.entitlements},this.getUserFromStore=function(){return a.store.getState().auth.user},this.getEntitlementsQueryData=function(e){var t=a.getUserFromStore();return{entitlements:a.getEntitlementsFromStore(),attributes:{custom:e,jwt:t},isV2:R(a.queryFeatureFlags([Vr]),1)[0]}};var l=NL(n),c="frontegg-app-".concat(l);this.iframeRendering=r,this.name=l,this.options=D({},t,{contextOptions:D({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=c;var u,d,y=this.options.authOptions?D({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(y.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.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=vL({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,y,{auth:null!=(u=this.options.authOptions)?u:{},audits:null!=(d=this.options.auditsOptions)?d:{}},!1,this.options.urlStrategy);w.setInstance(l,this),this.setEntitlementsOptions(t.entitlementsOptions),this.setSessionContext({enableSessionPerTenant:null==(o=t.authOptions)?void 0:o.enableSessionPerTenant}),Va.setAppName(l)}var t,n,i,o;return U(e,[{key:"setEntitlementsOptions",value:function(e){Va.setEntitlementsOptions(D({},e))}},{key:"setSessionContext",value:function(e){Va.setSessionContext(D({},e))}},{key:"initContainers",value:(o=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,i=void 0,void 0,a=void 0,null==(a=null==(o=DL.getInstance(n))||null==(i=o.integrations)?void 0:i.gtm)||a.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,i,o,a}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;DL.set(e,this.name),null!=e&&e.localizations&&(null==(t=this.updateLocalizations)||t.call(this,e.localizations))}},{key:"addOnLoadedListener",value:function(e){this.loading?this.loadingListeners.push(e):e()}},{key:"ready",value:function(e){this.loading?e():this.addOnLoadedListener(e)}},{key:"loginWithRedirect",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/requestHostedLoginAuthorize"})}},{key:"logout",value:function(){this.store.dispatch({type:"auth/setState",payload:{isLoading:!0}}),this.store.dispatch({type:"auth/logout"})}},{key:"loadScript",value:function(e){var t=this;return new Promise((function(n,i){if(window[e])n(window[e]);else{var o=document.createElement("script");o.src="".concat(t.cdnUrl,"/").concat({FronteggLoginBox:"login-box/index.js",FronteggAdminPortal:"admin-portal/index.js"}[e]),o.setAttribute("id","".concat(e,"Script")),o.setAttribute("cdn-url",t.cdnUrl),o.onload=function(){window["".concat(e,"Init")]?n(window["".concat(e,"Init")]({FronteggRestApi:k,FronteggTypes:I})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=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 i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=M(G().mark((function e(){var t;return G().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Va.setRequestSource(ui.AdminPortal),e.next=3,this.loadScript("FronteggAdminPortal");case 3:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e,t=new URLSearchParams(window.location.search);null==(e=this.adminPortalRenderer)||e.unmount(),GL(t),Va.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,D({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,i)=>{var o;return mL(),i?(0,hL.tE)(t,e,n):AL(null==e||null==(o=e.features)?void 0:o[t],Hs.MISSING_FEATURE)})(n.entitlements,e,n.attributes,n.isV2)}},{key:"getPermissionEntitlements",value:function(e,t){var n=this.getEntitlementsQueryData(t);return((e,t,n,i)=>{var o;return mL(),i?(0,hL.wJ)(t,e,n):AL(null==e||null==(o=e.permissions)?void 0:o[t],Hs.MISSING_PERMISSION)})(n.entitlements,e,n.attributes,n.isV2)}},{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:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),nU=function(){function e(){O(this,e)}return U(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=w.getInstance(i);e&&t?(Va.setAccessToken(t),Va.setUser(D({},n,{accessToken:t})),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ji.loadTenants())):(Va.setAccessToken(null),Va.setUser(null),o.store.dispatch(ji.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),iU=function(){function e(){O(this,e)}return U(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideAdminPortal()}}]),e}(),oU=function(){function e(){O(this,e)}return U(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";w.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";w.getInstance(e).hideCheckoutDialog()}}]),e}(),aU=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},rU=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];O(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.setRoute=function(){},this.themeSetter=void 0,this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=vL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=D({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new tU(this.options,t,!0),DL.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,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,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggAdminPortal");case 8:return a=e.sent,this.app.adminPortalRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o}),this.app.loading=!1,e.next=13,FL(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}(),sU="modern",lU=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[sU]},cU=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];O(this,e),this.app=void 0,this.options=void 0,this.store=void 0,this.themeSetter=void 0,this.setRoute=function(){},this.themeOptions={};var r={baseUrl:"preview"};if(i){if(this.store=i,!a&&i.getState().root.appName!==t)throw Error("Mismatch in store names")}else this.store=vL({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=D({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new tU(this.options,t,!0,a),DL.set({},t)}var t;return U(e,[{key:"render",value:(t=M(G().mark((function e(t){var n,i,o,a,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,i=function(e){r.themeSetter=e},o=function(e){r.setRoute=e},e.next=8,this.app.loadScript("FronteggLoginBox");case 8:return a=e.sent,this.app.loginBoxRenderer=a.renderPage(n,{options:this.options,injector:this.app,setThemeSetter:i,setStaticRouteSetter:o,staticRoute:"/account/login"}),e.next=12,FL(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 uU(e,t){return uU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},uU(e,t)}function dU(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&&uU(e,t)}function yU(e,t){if(t&&("object"===P(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 fU(e){return fU=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fU(e)}function pU(){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 gU(e,t,n){return gU=pU()?Reflect.construct.bind():function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&uU(o,n.prototype),o},gU.apply(null,arguments)}function SU(e){var t="function"==typeof Map?new Map:void 0;return SU=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 gU(e,arguments,fU(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),uU(n,e)},SU(e)}function vU(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=fU(e);if(t){var o=fU(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return yU(this,n)}}var hU=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new tU(e,t);if("undefined"!=typeof document){var i;if(!e.contextOptions.baseUrl){var o=new Error('Edit <FronteggProvider/> options { ContextOptions: { baseUrl: "" } } in order to connect your application');throw document.body.innerHTML="",alert(o.message),o}if(!customElements.get("frontegg-app")){var a=function(e){dU(n,e);var t=vU(n);function n(){var e;O(this,n);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return(e=t.call.apply(t,[this].concat(o))).app=null,e}return 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=w.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=ML(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=ML(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=ML(this,"div",{id:"frontegg-checkout-dialog-container-".concat(n.name)}),r=i.attachShadow({mode:"open"}),s=o.attachShadow({mode:"open"}),l=a.attachShadow({mode:"open"}),c=ML(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=ML(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=ML(l,"div",{id:"frontegg-checkout-dialog-".concat(n.name),class:"frontegg-root-content"});n.initContainers({adminPortalEl:c,loginBoxEl:u,adminPortalContainer:i,loginBoxContainer:o,checkoutDialogContainer:a,checkoutDialogEl:d})}}],[{key:"observedAttributes",get:function(){return["app-name"]}}]),n}(SU(HTMLElement));customElements.define("frontegg-app",a)}null==(i=document.querySelector('frontegg-app[app-name="'.concat(n.name,'"]')))||i.remove();var r=document.createElement("frontegg-app");r.setAttribute("app-name",n.name),document.body.appendChild(r)}return n}}(),i}()}));