@frontegg/js 6.87.0 → 6.89.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 __webpack_modules__={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},965:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_SHA256_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];!root.JS_SHA256_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e,t){return function(n){return new Sha256(t,!0).update(n)[e]()}},createMethod=function(e){var t=createOutputMethod("hex",e);NODE_JS&&(t=nodeWrap(t,e)),t.create=function(){return new Sha256(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];t[i]=createOutputMethod(i,e)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(e){if("string"==typeof e)return crypto.createHash(algorithm).update(e,"utf8").digest("hex");if(null==e)throw new Error(ERROR);return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod},createHmacOutputMethod=function(e,t){return function(n,i){return new HmacSha256(n,t,!0).update(i)[e]()}},createHmacMethod=function(e){var t=createHmacOutputMethod("hex",e);t.create=function(t){return new HmacSha256(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<OUTPUT_TYPES.length;++n){var i=OUTPUT_TYPES[n];t[i]=createHmacOutputMethod(i,e)}return t};function Sha256(e,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(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.is224=e}function HmacSha256(e,t,n){var i,o=typeof e;if("string"===o){var a,r=[],s=e.length,l=0;for(i=0;i<s;++i)(a=e.charCodeAt(i))<128?r[l++]=a:a<2048?(r[l++]=192|a>>6,r[l++]=128|63&a):a<55296||a>=57344?(r[l++]=224|a>>12,r[l++]=128|a>>6&63,r[l++]=128|63&a):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++i)),r[l++]=240|a>>18,r[l++]=128|a>>12&63,r[l++]=128|a>>6&63,r[l++]=128|63&a);e=r}else{if("object"!==o)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR)}e.length>64&&(e=new Sha256(t,!0).update(e).array());var c=[],u=[];for(i=0;i<64;++i){var d=e[i]||0;c[i]=92^d,u[i]=54^d}Sha256.call(this,t,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}Sha256.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR);t=!0}for(var i,o,a=0,r=e.length,s=this.blocks;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]<<SHIFT[3&o++];else for(o=this.start;a<r&&o<64;++a)(i=e.charCodeAt(a))<128?s[o>>2]|=i<<SHIFT[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<SHIFT[3&o++],s[o>>2]|=(128|i>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<SHIFT[3&o++],s[o>>2]|=(128|i>>12&63)<<SHIFT[3&o++],s[o>>2]|=(128|i>>6&63)<<SHIFT[3&o++],s[o>>2]|=(128|63&i)<<SHIFT[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}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[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()}},Sha256.prototype.hash=function(){var e,t,n,i,o,a,r,s,l,c=this.h0,u=this.h1,d=this.h2,y=this.h3,f=this.h4,p=this.h5,g=this.h6,S=this.h7,h=this.blocks;for(e=16;e<64;++e)t=((o=h[e-15])>>>7|o<<25)^(o>>>18|o<<14)^o>>>3,n=((o=h[e-2])>>>17|o<<15)^(o>>>19|o<<13)^o>>>10,h[e]=h[e-16]+t+h[e-7]+n<<0;for(l=u&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,S=(o=h[0]-1413257819)-150054599<<0,y=o+24177077<<0):(a=704751109,S=(o=h[0]-210244248)-1521486534<<0,y=o+143694565<<0),this.first=!1):(t=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),i=(a=c&u)^c&d^l,S=y+(o=S+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&p^~f&g)+K[e]+h[e])<<0,y=o+(t+i)<<0),t=(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10),i=(r=y&c)^y&u^a,g=d+(o=g+(n=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7))+(S&f^~S&p)+K[e+1]+h[e+1])<<0,t=((d=o+(t+i)<<0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),i=(s=d&y)^d&c^r,p=u+(o=p+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(g&S^~g&f)+K[e+2]+h[e+2])<<0,t=((u=o+(t+i)<<0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),i=(l=u&d)^u&y^s,f=c+(o=f+(n=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&g^~p&S)+K[e+3]+h[e+3])<<0,c=o+(t+i)<<0;this.h0=this.h0+c<<0,this.h1=this.h1+u<<0,this.h2=this.h2+d<<0,this.h3=this.h3+y<<0,this.h4=this.h4+f<<0,this.h5=this.h5+p<<0,this.h6=this.h6+g<<0,this.h7=this.h7+S<<0},Sha256.prototype.hex=function(){this.finalize();var 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=HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[15&a]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r];return this.is224||(l+=HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[15&s]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var 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 this.is224||l.push(s>>24&255,s>>16&255,s>>8&255,255&s),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28: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),this.is224||t.setUint32(28,this.h7),e},HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()},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 L(i||[]);return r(a,"_invoke",{value:_(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 h(){}var v={};d(v,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(O([])));b&&b!==n&&a.call(b,l)&&(v=b);var A=h.prototype=g.prototype=Object.create(v);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function _(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=P(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 P(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,P(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 E(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function O(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=h,r(A,"constructor",{value:h,configurable:!0}),r(h,"constructor",{value:S,configurable:!0}),S.displayName=d(h,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,h):(e.__proto__=h,d(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=O,L.prototype={constructor:L,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(I),!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),I(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;I(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:O(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)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__webpack_require__),n.exports}__webpack_require__.amdO={},__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return function(){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{AdminPortal:function(){return eP},AdminPortalRenderer:function(){return iP},AppHolder:function(){return P},CheckoutDialog:function(){return tP},FronteggApp:function(){return Q_},HostedLogin:function(){return Z_},LoginBoxRenderer:function(){return rP},createElement:function(){return M_},defaultTheme:function(){return oP},formatName:function(){return U_},getThemeAdminByName:function(){return nP},getThemeByName:function(){return aP},initialize:function(){return gP},mockFlagsList:function(){return Y_},waitThemeSetter:function(){return N_}});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{Delete:function(){return fa},Get:function(){return ca},Patch:function(){return da},Post:function(){return ua},PostDownload:function(){return pa},Put:function(){return ya},getBaseUrl:function(){return sa}});var t={};__webpack_require__.r(t),__webpack_require__.d(t,{getSubTenants:function(){return Ja},getSubTenantsAsTree:function(){return Ya},getTenants:function(){return Xa},switchTenant:function(){return za}});var n={};__webpack_require__.r(n),__webpack_require__.d(n,{AuthStrategyEnum:function(){return _r},MachineToMachineAuthStrategy:function(){return Pr},OAuthLogout:function(){return Xr},SocialLoginProviders:function(){return Tr},acceptInvitation:function(){return Br},activateAccount:function(){return Vr},bulkCreateIPRestriction:function(){return vr},changePhoneNumber:function(){return $l},changePhoneNumberWithVerification:function(){return Nl},checkIfAllowToRememberMfaDevice:function(){return dl},createDomainRestriction:function(){return yr},createIPRestriction:function(){return hr},createOrUpdateSessionConfigrations:function(){return Xs},createSSOConfiguration:function(){return Sl},createSSOConfigurationByMetadata:function(){return ml},createSSODomain:function(){return Al},createSSOGroup:function(){return El},createSamlGroup:function(){return Us},createTenantAccessToken:function(){return il},createUserAccessToken:function(){return nl},deleteAllSessionsForUser:function(){return Ys},deleteDomainRestriction:function(){return pr},deleteIPRestriction:function(){return br},deleteSSOConfiguration:function(){return vl},deleteSSODomain:function(){return kl},deleteSSOGroup:function(){return Ll},deleteSamlGroup:function(){return Ns},deleteSessionForUser:function(){return Js},deleteTenantAccessToken:function(){return el},deleteTenantApiToken:function(){return ll},deleteUserAccessToken:function(){return tl},deleteUserApiToken:function(){return cl},deleteWebAuthnDevice:function(){return Wl},disableMFAAuthenticatorApp:function(){return cs},disableMFASMS:function(){return ds},disableMFAWebAuthn:function(){return fs},disableMfa:function(){return ls},enrollMFAAuthenticatorApp:function(){return ns},enrollMFAAuthenticatorAppForLogin:function(){return Ss},enrollMFASMS:function(){return os},enrollMFASMSForLogin:function(){return ms},enrollMFAWebAuthn:function(){return rs},enrollMFAWebAuthnForLogin:function(){return Ts},enrollMfa:function(){return es},exchangeOAuthTokens:function(){return Cl},forgotPassword:function(){return Jr},generateLoginResponse:function(){return Cr},generateLoginResponseFromOAuthResponse:function(){return Ur},generateLoginResponseV2:function(){return Dr},getActivateAccountStrategy:function(){return Hr},getCaptchaPolicy:function(){return ar},getCurrentUserSession:function(){return Ks},getCurrentUserSessions:function(){return Bs},getCustomSocialLoginProvidersV1:function(){return Vs},getDomainRestrictions:function(){return ur},getDomainRestrictionsConfig:function(){return dr},getGlobalSecurityPolicy:function(){return Qa},getIPRestrictions:function(){return gr},getIPRestrictionsConfig:function(){return Sr},getLockoutPolicy:function(){return nr},getMFADevices:function(){return ps},getMFAStrategiesConfig:function(){return Kl},getMfaPolicy:function(){return Za},getOidcConfiguration:function(){return Fs},getPasswordConfigPolicy:function(){return cr},getPasswordHistoryPolicy:function(){return rr},getSSOConfigurations:function(){return gl},getSSODefaultRoles:function(){return _l},getSSOGroups:function(){return Ol},getSSOPublicConfiguration:function(){return $s},getSamlConfiguration:function(){return Es},getSamlRoles:function(){return Rs},getSamlRolesGroups:function(){return Cs},getSamlVendorConfiguration:function(){return Ls},getSessionConfigurations:function(){return zs},getSocialLoginProviders:function(){return Gs},getSocialLoginProvidersV2:function(){return xs},getTenantAccessTokensData:function(){return Zs},getTenantApiTokensData:function(){return al},getUserAccessTokensData:function(){return Qs},getUserApiTokensData:function(){return ol},getUserById:function(){return ul},getVendorConfig:function(){return Ws},getVendorLockoutPolicy:function(){return ir},getVendorMfaPolicy:function(){return er},getVendorPasswordHistoryPolicy:function(){return sr},getVendorPublicAuthStrategiesConfig:function(){return Bl},getWebAuthnDevices:function(){return Hl},loadPasswordConfig:function(){return Qr},login:function(){return Gr},loginViaSocialLogin:function(){return Hs},loginWithMfa:function(){return xr},logout:function(){return zr},oidcPostLogin:function(){return $r},oidcPostLoginV2:function(){return Rl},passwordlessPostLogin:function(){return fl},passwordlessPreLogin:function(){return yl},postLogin:function(){return Fr},preDisableMFASMS:function(){return us},preDisableMFAWebAuthn:function(){return ys},preEnrollMFAAuthenticatorApp:function(){return ts},preEnrollMFAAuthenticatorAppForLogin:function(){return gs},preEnrollMFASMS:function(){return is},preEnrollMFASMSForLogin:function(){return vs},preEnrollMFAWebAuthn:function(){return as},preEnrollMFAWebAuthnForLogin:function(){return ks},preLogin:function(){return Mr},preLoginV2:function(){return wl},preLoginWithIdpType:function(){return Nr},preVerifyMFASMSForLogin:function(){return bs},preVerifyMFAWebAuthnForLogin:function(){return _s},recoverMfaToken:function(){return Zr},refreshToken:function(){return Kr},refreshTokenV2:function(){return qr},resendActivationEmail:function(){return Wr},resendInvitationEmail:function(){return jr},resetPassword:function(){return Yr},resetPhoneNumber:function(){return Ul},revokeSessionsForUser:function(){return qs},saveLockoutPolicy:function(){return or},saveMfaPolicy:function(){return tr},savePasswordHistoryPolicy:function(){return lr},setSSODefaultRoles:function(){return Pl},signUpUser:function(){return js},silentOAuthRefreshToken:function(){return Dl},testCurrentIp:function(){return Ar},testCurrentIpInAllowList:function(){return kr},updateDomainRestrictionConfig:function(){return fr},updateIPRestrictionConfig:function(){return mr},updateSSOConfiguration:function(){return hl},updateSSOConfigurationByMetadata:function(){return bl},updateSSOGroup:function(){return Il},updateSamlConfiguration:function(){return Is},updateSamlGroup:function(){return Ms},updateSamlRoles:function(){return Ds},updateSamlVendorMetadata:function(){return Os},updateTenantApiTokensData:function(){return sl},updateUserApiTokensData:function(){return rl},validateSSODomain:function(){return Tl},validateSamlDomain:function(){return ws},verifyChangePhoneNumber:function(){return Fl},verifyInviteToken:function(){return pl},verifyMFAAuthenticatorAppForLogin:function(){return hs},verifyMFASMSForLogin:function(){return As},verifyMFAWebAuthnForLogin:function(){return Ps},verifyMfa:function(){return ss},verifyNewDeviceSession:function(){return jl},verifyResetPhoneNumber:function(){return Ml},webAuthnCreateNewDeviceSession:function(){return Vl},webAuthnPostLogin:function(){return xl},webAuthnPreLogin:function(){return Gl}});var i={};__webpack_require__.r(i),__webpack_require__.d(i,{addUser:function(){return Ql},changePassword:function(){return Jl},createInviteUserLink:function(){return tc},deleteInviteUserLink:function(){return ic},deleteUser:function(){return Zl},getInviteLinkConfiguration:function(){return ac},getInviteUserLink:function(){return oc},getProfile:function(){return ql},loadAvailablePermissions:function(){return sc},loadAvailableRoles:function(){return rc},loadStats:function(){return lc},loadUsers:function(){return Yl},resendActivationLink:function(){return cc},resendInvitationLink:function(){return uc},resendInvitationLinkToAllTenants:function(){return dc},updateInviteUserLink:function(){return nc},updateProfile:function(){return zl},updateProfileImage:function(){return Xl},updateUser:function(){return ec}});var o={};__webpack_require__.r(o),__webpack_require__.d(o,{getAuditsMetadata:function(){return Sc},getCurrentUserIpMetadata:function(){return fc},getIpAdressMetadata:function(){return hc},getNotificationsMetadata:function(){return pc},getSamlMetadata:function(){return gc}});var a={};__webpack_require__.r(a),__webpack_require__.d(a,{downloadReport:function(){return Pc},getReport:function(){return kc},getReports:function(){return Ac},renderReport:function(){return Tc},scheduleReport:function(){return _c},sendReport:function(){return Ec}});var r={};__webpack_require__.r(r),__webpack_require__.d(r,{getNotifications:function(){return Ic},markAllAsRead:function(){return wc},updateNotificationIsPinned:function(){return Oc},updateNotificationStatus:function(){return Lc}});var s={};__webpack_require__.r(s),__webpack_require__.d(s,{exportAudits:function(){return Uc},getAudits:function(){return Cc},getAuditsStats:function(){return Dc}});var l={};__webpack_require__.r(l),__webpack_require__.d(l,{deleteEmailConfiguration:function(){return zc},deleteEmailSubscriptions:function(){return Kc},deleteSMSConfiguration:function(){return eu},deleteSMSSubscriptions:function(){return Qc},deleteSlackConfiguration:function(){return Vc},deleteWebhooksConfiguration:function(){return iu},getCategories:function(){return su},getChannelMaps:function(){return lu},getEmailConfiguration:function(){return Wc},getSMSConfiguration:function(){return Xc},getSlackChannels:function(){return Gc},getSlackConfiguration:function(){return Fc},getSlackScope:function(){return $c},getWebhookLog:function(){return ou},getWebhooksConfigurations:function(){return tu},patchEmailConfiguration:function(){return Bc},patchSMSConfiguration:function(){return Yc},postEmailConfiguration:function(){return jc},postSMSConfiguration:function(){return Jc},postSlackCode:function(){return Hc},postSlackConfiguration:function(){return xc},postWebhookRetry:function(){return ru},postWebhookTest:function(){return au},postWebhooksConfiguration:function(){return nu},putEmailSubscriptions:function(){return qc},putSMSSubscriptions:function(){return Zc}});var c={};__webpack_require__.r(c),__webpack_require__.d(c,{getSettings:function(){return uu},updateSettings:function(){return cu}});var u={};__webpack_require__.r(u),__webpack_require__.d(u,{addRole:function(){return gu},attachPermissionToRoles:function(){return bu},attachPermissionsToRole:function(){return vu},deleteRole:function(){return Su},getPermissionCategories:function(){return Au},getPermissions:function(){return mu},getRoles:function(){return pu},updateRole:function(){return hu}});var d={};__webpack_require__.r(d),__webpack_require__.d(d,{ISubscriptionCancellationPolicy:function(){return Zu},ISubscriptionStatus:function(){return Yu},PaymentMethodType:function(){return Qu},ProviderType:function(){return ed},TenantCreatedAction:function(){return nd},TrialEndAction:function(){return td},cancelManagedSubscription:function(){return Ou},cancelSubscription:function(){return _u},createStripeCustomer:function(){return Wu},createStripePaymentMethodSetupIntentSecret:function(){return Bu},createSubscription:function(){return Vu},createTenantConfiguration:function(){return zu},getManagedSubscription:function(){return Iu},getManagedSubscriptions:function(){return Lu},getPaymentMethod:function(){return Gu},getPaymentMethods:function(){return $u},getPaymentProviders:function(){return Xu},getStripeCustomer:function(){return Hu},getStripePaymentProviderConfiguration:function(){return ju},getSubscription:function(){return Tu},getSubscriptionInvoice:function(){return Mu},getSubscriptionInvoicePdf:function(){return Nu},getSubscriptionInvoices:function(){return Uu},getSubscriptionPlan:function(){return Du},getSubscriptionPlans:function(){return Cu},getSubscriptionSummaries:function(){return Ku},getSubscriptions:function(){return ku},getTenantConfiguration:function(){return qu},getVendorPublicConfigurations:function(){return Ju},renewManagedSubscription:function(){return wu},renewSubscription:function(){return Pu},updateManagedSubscription:function(){return Ru},updatePaymentMethodBillingDetails:function(){return xu},updateSubscription:function(){return Eu}});var y={};__webpack_require__.r(y),__webpack_require__.d(y,{getVendorPublicInfo:function(){return id}});var f={};__webpack_require__.r(f),__webpack_require__.d(f,{addUserRolesForSubTenants:function(){return sd},addUserToTenantAndSubTenants:function(){return ad},loadAllUsers:function(){return od},removeUserFromTenantAndSubTenants:function(){return rd},removeUserRolesFromSubTenants:function(){return ld},setUserRolesForSubTenants:function(){return cd}});var p={};__webpack_require__.r(p),__webpack_require__.d(p,{FeatureFlags:function(){return dd},loadFeatureFlags:function(){return yd}});var g={};__webpack_require__.r(g),__webpack_require__.d(g,{countConfigurationUsers:function(){return hd},createConfiguration:function(){return gd},deleteConfiguration:function(){return Sd},getConfigs:function(){return fd},updateConfiguration:function(){return pd}});var S={};__webpack_require__.r(S),__webpack_require__.d(S,{impersonate:function(){return vd}});var h={};__webpack_require__.r(h),__webpack_require__.d(h,{addRolesToGroup:function(){return Ed},addUsersToGroup:function(){return Ld},createGroup:function(){return Td},deleteGroup:function(){return Pd},deleteRolesFromGroup:function(){return Id},deleteUsersFromGroup:function(){return Od},getGroupById:function(){return bd},getGroupConfiguration:function(){return wd},getGroups:function(){return Ad},getGroupsByIds:function(){return kd},updateGroup:function(){return _d},updateGroupConfiguration:function(){return Rd}});var v={};__webpack_require__.r(v),__webpack_require__.d(v,{AuthStrategyEnum:function(){return _r},ContextHolder:function(){return oa},FeatureFlags:function(){return dd},FronteggApiError:function(){return ra},FronteggContext:function(){return aa},GroupManagedByEnum:function(){return jd},GroupRelations:function(){return Wd},ISubscriptionCancellationPolicy:function(){return Zu},ISubscriptionStatus:function(){return Yu},MFAStrategyEnum:function(){return Ud},MachineToMachineAuthStrategy:function(){return Pr},PaymentMethodType:function(){return Qu},ProviderType:function(){return ed},RestrictionType:function(){return Nn},ScimConnectionSource:function(){return Hd},SecondaryAuthStrategy:function(){return Cd},SocialLoginProviders:function(){return Tr},TenantType:function(){return Nd},UserManagedByEnum:function(){return Md},WebAuthnDeviceType:function(){return Dd},api:function(){return Bd},countConfigurationUsers:function(){return hd},createConfiguration:function(){return gd},default:function(){return Kd},deleteConfiguration:function(){return Sd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Fd},fronteggRefreshTokenUrl:function(){return $d},fronteggSilentRefreshTokenUrl:function(){return Gd},fronteggTenantsUrl:function(){return Vd},fronteggUsersUrl:function(){return xd},getConfigs:function(){return fd},loadFeatureFlags:function(){return yd},updateConfiguration:function(){return pd}});var m={};function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e){return A="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},A(e)}function k(e){var t=function(e,t){if("object"!==A(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==A(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===A(t)?t:String(t)}function T(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,k(i.key),i)}}function _(e,t,n){return t&&T(e.prototype,t),n&&T(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}__webpack_require__.r(m),__webpack_require__.d(m,{AccountPageFields:function(){return x_},DomainRestrictionsTabFields:function(){return K_},GeneralSettingsTabFields:function(){return j_},InviteUserModalFields:function(){return G_},IpRestrictionsTabFields:function(){return B_},Metadata:function(){return D_},PrivacyPageFields:function(){return $_},ProfilePageFields:function(){return F_},SecurityPageTabs:function(){return H_},SessionManagementTabFields:function(){return W_},SsoPageTabs:function(){return q_},SubscriptionsPageFields:function(){return V_},alpha:function(){return T_},fieldAppearance:function(){return z_},tabAppearance:function(){return X_}});var P=function(){function e(){b(this,e)}return _(e,null,[{key:"setInstance",value:function(t,n){e._apps[t]=n}},{key:"getInstance",value:function(t){var n=e._apps[t];if(!n)throw Error("[".concat(t,"] FronteggApp not found"));return n}}]),e}();function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},E.apply(this,arguments)}function I(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 L(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){I(a,i,o,r,s,"next",e)}function s(e){I(a,i,o,r,s,"throw",e)}r(void 0)}))}}P._apps={};var O=__webpack_require__(841),w=__webpack_require__.n(O);function R(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function C(e){return!!e&&!!e[ve]}function D(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)===me}(e)||Array.isArray(e)||!!e[he]||!!e.constructor[he]||G(e)||x(e))}function U(e,t,n){void 0===n&&(n=!1),0===M(e)?(n?Object.keys:be)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function M(e){var t=e[ve];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:G(e)?2:x(e)?3:0}function N(e,t){return 2===M(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function F(e,t,n){var i=M(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function $(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function G(e){return fe&&e instanceof Map}function x(e){return pe&&e instanceof Set}function V(e){return e.o||e.t}function H(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ae(e);delete t[ve];for(var n=be(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 W(e,t){return void 0===t&&(t=!1),B(e)||C(e)||!D(e)||(M(e)>1&&(e.set=e.add=e.clear=e.delete=j),Object.freeze(e),t&&U(e,(function(e,t){return W(t,!0)}),!0)),e}function j(){R(2)}function B(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function K(e){var t=ke[e];return t||R(18,e),t}function q(){return de}function z(e,t){t&&(K("Patches"),e.u=[],e.s=[],e.v=t)}function X(e){J(e),e.p.forEach(Q),e.p=null}function J(e){e===de&&(de=e.l)}function Y(e){return de={p:[],l:de,h:e,m:!0,_:0}}function Q(e){var t=e[ve];0===t.i||1===t.i?t.j():t.O=!0}function Z(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||K("ES5").S(t,e,i),i?(n[ve].P&&(X(t),R(4)),D(e)&&(e=ee(t,e),t.l||ne(t,e)),t.u&&K("Patches").M(n[ve].t,e,t.u,t.s)):e=ee(t,n,[]),X(t),t.u&&t.v(t.u,t.s),e!==Se?e:void 0}function ee(e,t,n){if(B(t))return t;var i=t[ve];if(!i)return U(t,(function(o,a){return te(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return ne(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=H(i.k):i.o;U(3===i.i?new Set(o):o,(function(t,a){return te(e,i,o,t,a,n)})),ne(e,o,!1),n&&e.u&&K("Patches").R(i,n,e.u,e.s)}return i.o}function te(e,t,n,i,o,a){if(C(o)){var r=ee(e,o,a&&t&&3!==t.i&&!N(t.D,i)?a.concat(i):void 0);if(F(n,i,r),!C(r))return;e.m=!1}if(D(o)&&!B(o)){if(!e.h.F&&e._<1)return;ee(e,o),t&&t.A.l||ne(e,o)}}function ne(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&W(t,n)}function ie(e,t){var n=e[ve];return(n?V(n):e)[t]}function oe(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 ae(e){e.P||(e.P=!0,e.l&&ae(e.l))}function re(e){e.o||(e.o=H(e.t))}function se(e,t,n){var i=G(t)?K("MapSet").N(t,n):x(t)?K("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:q(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Te;n&&(o=[i],a=_e);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):K("ES5").J(t,n);return(n?n.A:q()).p.push(i),i}function le(e){return C(e)||R(22,e),function e(t){if(!D(t))return t;var n,i=t[ve],o=M(t);if(i){if(!i.P&&(i.i<4||!K("ES5").K(i)))return i.t;i.I=!0,n=ce(t,o),i.I=!1}else n=ce(t,o);return U(n,(function(t,o){i&&function(e,t){return 2===M(e)?e.get(t):e[t]}(i.t,t)===o||F(n,t,e(o))})),3===o?new Set(n):n}(e)}function ce(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return H(e)}var ue,de,ye="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),fe="undefined"!=typeof Map,pe="undefined"!=typeof Set,ge="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,Se=ye?Symbol.for("immer-nothing"):((ue={})["immer-nothing"]=!0,ue),he=ye?Symbol.for("immer-draftable"):"__$immer_draftable",ve=ye?Symbol.for("immer-state"):"__$immer_state",me=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),be="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ae=Object.getOwnPropertyDescriptors||function(e){var t={};return be(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},ke={},Te={get:function(e,t){if(t===ve)return e;var n=V(e);if(!N(n,t))return function(e,t,n){var i,o=oe(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||!D(i)?i:i===ie(e.t,t)?(re(e),e.o[t]=se(e.A.h,i,e)):i},has:function(e,t){return t in V(e)},ownKeys:function(e){return Reflect.ownKeys(V(e))},set:function(e,t,n){var i=oe(V(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ie(V(e),t),a=null==o?void 0:o[ve];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if($(n,o)&&(void 0!==n||N(e.t,t)))return!0;re(e),ae(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!==ie(e.t,t)||t in e.t?(e.D[t]=!1,re(e),ae(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=V(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){R(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){R(12)}},_e={};U(Te,(function(e,t){_e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),_e.deleteProperty=function(e,t){return _e.set.call(this,e,t,void 0)},_e.set=function(e,t,n){return Te.set.call(this,e[0],t,n,e[0])};var Pe=function(){function e(e){var t=this;this.g=ge,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&&R(6),void 0!==i&&"function"!=typeof i&&R(7),D(e)){var s=Y(t),l=se(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?X(s):J(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return z(s,i),Z(e,s)}),(function(e){throw X(s),e})):(z(s,i),Z(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===Se&&(r=void 0),t.F&&W(r,!0),i){var u=[],d=[];K("Patches").M(e,r,u,d),i(u,d)}return r}R(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){D(e)||R(8),C(e)&&(e=le(e));var t=Y(this),n=se(this,e,void 0);return n[ve].C=!0,J(t),n},t.finishDraft=function(e,t){var n=(e&&e[ve]).A;return z(n,t),Z(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ge&&R(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=K("Patches").$;return C(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Ee=new Pe,Ie=Ee.produce,Le=(Ee.produceWithPatches.bind(Ee),Ee.setAutoFreeze.bind(Ee),Ee.setUseProxies.bind(Ee),Ee.applyPatches.bind(Ee),Ee.createDraft.bind(Ee),Ee.finishDraft.bind(Ee),Ie);function Oe(e,t,n){return(t=k(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){Oe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ce(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 De="function"==typeof Symbol&&Symbol.observable||"@@observable",Ue=function(){return Math.random().toString(36).substring(7).split("").join(".")},Me={INIT:"@@redux/INIT"+Ue(),REPLACE:"@@redux/REPLACE"+Ue(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ue()}};function Ne(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Fe(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(Ce(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(Ce(1));return n(Fe)(e,t)}if("function"!=typeof e)throw new Error(Ce(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(Ce(3));return a}function d(e){if("function"!=typeof e)throw new Error(Ce(4));if(l)throw new Error(Ce(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(Ce(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!Ne(e))throw new Error(Ce(7));if(void 0===e.type)throw new Error(Ce(8));if(l)throw new Error(Ce(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(Ce(10));o=e,y({type:Me.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(Ce(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[De]=function(){return this},e}return y({type:Me.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[De]=p,i}function $e(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:Me.INIT}))throw new Error(Ce(12));if(void 0===n(void 0,{type:Me.PROBE_UNKNOWN_ACTION()}))throw new Error(Ce(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(Ce(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Ge(){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 xe(){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(Ce(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Ge.apply(void 0,a)(n.dispatch),Re(Re({},n),{},{dispatch:i})}}}function Ve(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 He=Ve();He.withExtraArgument=Ve;var We,je=He,Be=(We=function(e,t){return We=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])},We(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}We(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),Ke=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},qe=Object.defineProperty,ze=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Xe=Object.prototype.hasOwnProperty,Je=Object.prototype.propertyIsEnumerable,Ye=function(e,t,n){return t in e?qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Qe=function(e,t){for(var n in t||(t={}))Xe.call(t,n)&&Ye(e,n,t[n]);if(ze)for(var i=0,o=ze(t);i<o.length;i++)n=o[i],Je.call(t,n)&&Ye(e,n,t[n]);return e},Ze="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ge:Ge.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var et=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 Be(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,Ke([void 0],e[0].concat(this)))):new(t.bind.apply(t,Ke([void 0],e.concat(this))))},t}(Array);function tt(e){return D(e)?Le(e,(function(){})):e}function nt(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new et);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(je):i.push(je.withExtraArgument(n.extraArgument))),i}function it(e){var t,n=function(e){return nt(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=$e(a)}var p=s;"function"==typeof p&&(p=p(n));var g=xe.apply(void 0,p),S=Ge;c&&(S=Ze(Qe({trace:!1},"object"==typeof c&&c)));var h=[g];return Array.isArray(f)?h=Ke([g],f):"function"==typeof f&&(h=f(h)),Fe(t,d,S.apply(void 0,h))}function ot(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 Qe(Qe({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 at(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 rt(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:tt(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?at(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=Qe(Qe({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?at(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return tt(e())};else{var c=tt(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=Ke([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(C(e))return void 0===(i=n(e,t))?e:i;if(D(e))return Le(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?ot(c,i):ot(c)})),{name:t,reducer:function(e,t){return n||(n=c()),n(e,t)},actions:l,caseReducers:r,getInitialState:function(){return n||(n=c()),n.getInitialState()}}}Object.assign;var st="listenerMiddleware";ot(st+"/add"),ot(st+"/removeAll"),ot(st+"/remove"),function(){function e(e,t){var n=o[e];return n?n.enumerable=t:o[e]=n={configurable:!0,enumerable:t,get:function(){var t=this[ve];return Te.get(t,e)},set:function(t){var n=this[ve];Te.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][ve];if(!o.P)switch(o.i){case 5:i(o)&&ae(o);break;case 4:n(o)&&ae(o)}}}function n(e){for(var t=e.t,n=e.k,i=be(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==ve){var r=t[a];if(void 0===r&&!N(t,a))return!0;var s=n[a],l=s&&s[ve];if(l?l.t!==r:!$(s,r))return!0}}var c=!!t[ve];return i.length!==be(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){ke[e]||(ke[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=Ae(n);delete a[ve];for(var r=be(a),s=0;s<r.length;s++){var l=r[s];a[l]=e(l,t||!!a[l].enumerable)}return Object.create(Object.getPrototypeOf(n),a)}(i,t),a={i:i?5:4,A:n?n.A:q(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,ve,{value:a,writable:!0}),o},S:function(e,n,o){o?C(n)&&n[ve].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[ve];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)U(a,(function(t){t!==ve&&(void 0!==o[t]||N(o,t)?r[t]||e(a[t]):(r[t]=!0,ae(n)))})),U(o,(function(e){void 0!==a[e]||N(a,e)||(r[e]=!1,ae(n))}));else if(5===s){if(i(n)&&(ae(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 lt=(e,t)=>n=>E({},n,{[e]:t[e]}),ct=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),ut=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return E({},n,{[e]:E({},n[e],{[t]:E({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{loaders:E({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),yt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return E({},t,{[e]:E({},t[e],{errors:E({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),ft=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),pt=(e,t,n)=>i=>{var o;return E({},i,{[e]:E({},i[e],{[t]:E({},null==i||null==(o=i[e])?void 0:o[t],n)})})},gt=(e=500)=>new Promise((t=>setTimeout(t,e))),St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ht=new Uint8Array(256);for(let e=0;e<St.length;e++)ht[St.charCodeAt(e)]=e;const vt=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=ht[e.charCodeAt(i)],a=ht[e.charCodeAt(i+1)],r=ht[e.charCodeAt(i+2)],s=ht[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},mt=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(mt(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+=St[t[i]>>2],o+=St[(3&t[i])<<4|t[i+1]>>4],o+=St[(15&t[i+1])<<2|t[i+2]>>6],o+=St[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]=mt(e[n]);return t}return e};let bt,At,kt;!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"}(bt||(bt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(At||(At={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(kt||(kt={}));const Tt="FRONTEGG_AFTER_AUTH_REDIRECT_URL",_t="HOSTED_LOGIN_VERIFIER_KEY",Pt="auth",Et="connectivity",It="auditLogs",Lt="vendor",Ot={flow:At.Login,step:bt.preLogin,loading:!1,email:"",tenants:[]},wt={setLoginState:ct("loginState"),resetLoginState:lt("loginState",{loginState:Ot})},Rt={requestAuthorize:ot("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:ot("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:ot("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:ot("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:ot("auth/afterAuthNavigation"),preLogin:ot("auth/preLogin",(e=>({payload:e}))),postLogin:ot("auth/postLogin",(e=>({payload:e}))),login:ot("auth/login",(e=>({payload:e}))),loginWithMfa:ot("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:ot("auth/recoverMfa",(e=>({payload:e}))),logout:ot("auth/logout",(e=>({payload:e}))),silentLogout:ot("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:ot("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:ot("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:ot("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:ot("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:ot("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:ot("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:ot("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:ot("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:ot("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:ot("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:ot("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:ot("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:ot("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:ot("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:ot("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:ot("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:ot("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:ot("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:ot("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:ot("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:ot("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let Ct;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(Ct||(Ct={}));const Dt={step:Ct.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Ut={setActivateState:ct("activateState"),resetActivateState:lt("activateState",{activateState:Dt}),setActivateStrategyState:ut("activateState","activationStrategy")},Mt={activateAccount:ot("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:ot("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:ot("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:ot("auth/resendActivationEmail",(e=>({payload:e})))};let Nt;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}(Nt||(Nt={}));const Ft={step:Nt.validate},$t={setAcceptInvitationState:ct("acceptInvitationState"),resetAcceptInvitationState:lt("acceptInvitationState",{acceptInvitationState:Ft})},Gt={acceptInvitation:ot("auth/acceptInvitation",(e=>({payload:e})))};let xt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(xt||(xt={}));const Vt={step:xt.forgotPassword,loading:!1,email:"",passwordConfig:null},Ht={setForgotPasswordState:ct("forgotPasswordState"),resetForgotPasswordState:lt("forgotPasswordState",{forgotPasswordState:Vt})},Wt={forgotPassword:ot("auth/forgotPassword",(e=>({payload:e}))),resetPassword:ot("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:ot("auth/loadPasswordConfig",(e=>({payload:e})))};let jt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(jt||(jt={}));const Bt={step:jt.ResetPhoneNumber,loading:!1},Kt={setResetPhoneNumberState:ct("resetPhoneNumberState"),resetResetPhoneNumberState:lt("resetPhoneNumberState",{resetPhoneNumberState:Bt})},qt={resetPhoneNumber:ot("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:ot("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:ot("auth/changePhoneNumber",(e=>({payload:e})))},zt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Xt={setSSOLoader:dt("ssoState"),setSSOError:yt("ssoState"),setSSOState:ct("ssoState"),resetSSOState:lt("ssoState",{ssoState:zt})},Jt={loadSSOConfigurationsV2:ot("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:ot("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:ot("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:ot("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:ot("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:ot("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:ot("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:ot("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:ot("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:ot("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:ot("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:ot("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:ot("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:ot("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:ot("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:ot("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:ot("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:ot("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:ot("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:ot("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:ot("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:ot("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:ot("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:ot("auth/oidcPostlogin",(e=>({payload:e})))},Yt={loading:!1,error:null},Qt={setProfileState:ct("profileState"),resetProfileState:lt("profileState",{profileState:Yt})},Zt={loadProfile:ot("auth/loadProfile"),saveProfile:ot("auth/saveProfile",(e=>({payload:e}))),changePassword:ot("auth/changePassword",(e=>({payload:e})))};let en;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(en||(en={}));const tn={step:en.verify,loading:!1,saving:!1},nn={setMfaState:ct("mfaState"),resetMfaState:lt("mfaState",{mfaState:tn})},on={enrollMfa:ot("auth/enrollMfa"),getMFADevices:ot("auth/getMFADevices"),getMFAStrategies:ot("auth/getMFAStrategies"),verifyMfa:ot("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:ot("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:ot("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:ot("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:ot("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:ot("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:ot("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:ot("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:ot("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:ot("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:ot("auth/disableMfaWebAuthn",(e=>({payload:e})))},an={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},rn={setTeamLoader:dt("teamState"),setTeamError:yt("teamState"),setTeamState:ct("teamState"),resetTeamState:lt("teamState",{teamState:an})},sn={loadUsers:ot("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:ot("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:ot("auth/loadRoles",(e=>({payload:e}))),addUser:ot("auth/addUser",(e=>({payload:e}))),addUsersBulk:ot("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:ot("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:ot("auth/updateUser",(e=>({payload:e}))),deleteUser:ot("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:ot("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:ot("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:ot("auth/lockUser",(e=>({payload:e}))),resendActivationLink:ot("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:ot("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:ot("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:ot("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:ot("auth/getInvitationLink"),createInvitationLink:ot("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:ot("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:ot("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:ot("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:ot("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:ot("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:ot("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:ot("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:ot("auth/closeLockUserDialog",(e=>({payload:e})))},ln={firstLoad:!0,loading:!1,error:""},cn={setSocialLoginsState:ct("socialLoginState"),resetSocialLoginsState:lt("socialLoginState",{socialLoginState:ln})},un={loadSocialLoginsConfiguration:ot("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:ot("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:ot("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:ot("auth/setSocialLoginError",(e=>({payload:e})))};let dn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(dn||(dn={}));const yn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:dn.SignUp},fn={setSignUpState:ct("signUpState"),resetSignUpState:lt("signUpState",{signUpState:yn})},pn={signUpUser:ot("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:ot("auth/resetSignUpStateSoft")},gn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},Sn={setApiTokensLoader:dt("apiTokensState"),setApiTokensError:yt("apiTokensState"),setApiTokensState:ct("apiTokensState"),resetApiTokensState:lt("apiTokensState",{apiTokensState:gn})},hn={loadApiTokens:ot("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:ot("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:ot("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:ot("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:ot("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:ot("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:ot("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:ot("auth/deleteTenantApiToken",(e=>({payload:e})))},vn={globalPolicy:{loading:!0},publicPolicy:{loading:!1},vendorMfaPolicy:{loading:!0},mfaPolicy:{loading:!0},vendorLockoutPolicy:{loading:!0},lockoutPolicy:{loading:!0},captchaPolicy:{loading:!0},passwordHistoryPolicy:{loading:!0},passwordPolicy:{loading:!0},vendorPasswordHistoryPolicy:{loading:!0},publicAuthStrategyPolicy:{loading:!0}},mn={setSecurityPolicyState:ct("securityPolicyState"),setSecurityPolicyGlobalState:ut("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:ut("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:ut("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:ut("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:ut("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:ut("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:ut("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:ut("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:ut("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:ut("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:ut("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:lt("securityPolicyState",{securityPolicyState:vn})},bn={loadSecurityPolicy:ot("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:ot("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:ot("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:ot("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:ot("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:ot("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:ot("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:ot("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:ot("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:ot("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:ot("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:ot("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:ot("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:ot("auth/loadPublicAuthStrategiesPolicy")},An={loading:!1},kn={setAccountSettingsState:ct("accountSettingsState"),resetAccountSettingsState:lt("accountSettingsState",{accountSettingsState:An})},Tn={loadAccountSettings:ot("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:ot("auth/saveAccountSettings",(e=>({payload:e})))},_n={tenants:[],subTenants:[],loading:!0,tenantTree:null},Pn={setTenantsState:ct("tenantsState"),resetTenantsState:lt("tenantsState",{tenantsState:_n})},En={switchTenant:ot("auth/switchTenant",(e=>({payload:e}))),loadTenants:ot("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:ot("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:ot("auth/loadSubTenantsTree",(e=>({payload:e})))},In={loading:!1,roles:[],permissions:[],permissionCategories:[]},Ln={setRolesState:ct("rolesState"),resetRolesState:lt("rolesState",{rolesState:In})},On={loadRolesAndPermissions:ot("auth/loadRoles",(e=>({payload:e}))),addRole:ot("auth/addRole",(e=>({payload:e}))),updateRole:ot("auth/updateRole",(e=>({payload:e}))),deleteRole:ot("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:ot("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:ot("auth/attachPermissionToRoles",(e=>({payload:e})))},wn={loading:!1,sessions:[]},Rn={setSessionsState:ct("sessionsState"),resetSessionsState:lt("sessionsState",{sessionsState:wn})},Cn={loadUserSessions:ot("auth/loadUserSessions"),loadCurrentUserSession:ot("auth/loadCurrentUserSession"),deleteUserSession:ot("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:ot("auth/deleteAllUserSessions"),revokeUserSessions:ot("auth/revokeUserSessions",(e=>({payload:e})))},Dn={loading:!1,configurations:{}},Un={setSessionsPolicyState:ct("sessionsPolicyState"),resetSessionsPolicyState:lt("sessionsPolicyState",{sessionsPolicyState:Dn})},Mn={loadSessionsPolicy:ot("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:ot("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let Nn;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}(Nn||(Nn={}));const Fn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:Nn.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},$n={setRestrictionsState:ct("restrictionsState"),setIpRestrictionsState:ut("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:ut("restrictionsState","emailDomainRestrictions")},Gn={checkIfUserIpValid:ot("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:ot("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:ot("auth/loadIpRestrictions"),saveIpRestriction:ot("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:ot("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:ot("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:ot("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:ot("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:ot("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:ot("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},xn={loading:!1},Vn={setProvisioningState:ct("provisioningState"),resetProvisioningState:lt("provisioningState",{provisioningState:xn})},Hn={loadProvisionConnections:ot("auth/loadProvisionConnections"),createProvisionConnection:ot("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:ot("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:ot("auth/updateProvisionConnection",(e=>({payload:e})))},Wn={devices:[],loading:!1,error:null},jn={setPasskeysState:ct("passkeysState"),resetPasskeysState:lt("passkeysState",{passkeysState:Wn})},Bn={loadWebAuthnDevices:ot("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:ot("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Kn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},qn={setUsersGroupsLoader:dt("groupsState"),setUsersGroupsError:yt("groupsState"),setGroupsState:ct("groupsState"),resetUsersGroupsState:lt("groupsState",{groupsState:Kn})},zn={loadGroups:ot("auth/loadUsersGroups"),getGroupById:ot("auth/getGroupById",(e=>({payload:e}))),createGroup:ot("auth/createGroup",(e=>({payload:e}))),updateGroup:ot("auth/updateGroup",(e=>({payload:e}))),deleteGroup:ot("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:ot("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:ot("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:ot("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:ot("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:ot("auth/getGroupConfiguration"),updateGroupConfiguration:ot("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:ot("auth/getUsers",(e=>({payload:e})))},Xn={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}},Jn={setGroupsDialogsState:ct("groupsDialogsState"),resetGroupsDialogsState:lt("groupsState",{groupsDialogsState:Xn}),openAddGroupDialog:pt("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:pt("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:ft("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:pt("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:ft("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:pt("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:pt("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:pt("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:ft("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:pt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Yn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:yn,loginState:Ot,activateState:Dt,acceptInvitationState:Ft,forgotPasswordState:Vt,ssoState:zt,profileState:Yt,mfaState:tn,teamState:an,groupsState:Kn,groupsDialogsState:Xn,socialLoginState:ln,apiTokensState:gn,securityPolicyState:vn,accountSettingsState:An,tenantsState:_n,rolesState:In,resetPhoneNumberState:Bt,sessionsState:wn,sessionsPolicyState:Dn,restrictionsState:Fn,provisioningState:xn,passkeysState:Wn},Qn=E({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Yn);let Zn;!function(e){e.impersonating="impersonating",e.success="success"}(Zn||(Zn={}));const ei={step:Zn.impersonating,loading:!1},ti={setImpersonateState:ct("impersonateState"),resetImpersonateState:lt("impersonateState",{impersonateState:ei})},ni={impersonate:ot("impersonation/impersonate",(e=>({payload:e})))},{reducer:ii,actions:oi}=rt({name:Pt,initialState:Qn,reducers:E({resetState:e=>E({},e,Yn),setState:(e,{payload:t})=>E({},e,t),setUser:("user",(e,{payload:t})=>E({},e,{user:t}))},wt,cn,Ut,ti,$t,Ht,Kt,fn,Qt,Xt,nn,rn,qn,Jn,Sn,mn,kn,Pn,Ln,Rn,Un,$n,Vn,jn)});const ai=E({},oi,Rt,un,Mt,Gt,Wt,qt,pn,Zt,Jt,on,sn,zn,{},hn,bn,Tn,En,On,Cn,Mn,Gn,Hn,ni,Bn);var ri=function(e){return"@@redux-saga/"+e},si=ri("CANCEL_PROMISE"),li=ri("CHANNEL_END"),ci=ri("IO"),ui=ri("MATCH"),di=ri("MULTICAST"),yi=ri("SAGA_ACTION"),fi=ri("SELF_CANCELLATION"),pi=ri("TASK"),gi=ri("TASK_CANCEL"),Si=ri("TERMINATE"),hi=ri("LOCATION");function vi(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 mi=function(e){return null==e},bi=function(e){return null!=e},Ai=function(e){return"function"==typeof e},ki=function(e){return"string"==typeof e},Ti=Array.isArray,_i=function(e){return e&&Ai(e.then)},Pi=function(e){return e&&Ai(e.next)&&Ai(e.throw)},Ei=function e(t){return t&&(ki(t)||Oi(t)||Ai(t)||Ti(t)&&t.every(e))},Ii=function(e){return e&&Ai(e.take)&&Ai(e.close)},Li=function(e){return Ai(e)&&e.hasOwnProperty("toString")},Oi=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},wi=function(e,t){var n;void 0===t&&(t=!0);var i=new Promise((function(i){n=setTimeout(i,Math.min(2147483647,e),t)}));return i[si]=function(){clearTimeout(n)},i},Ri=function(e){return function(){return e}},Ci=Ri(!0),Di=function(){},Ui=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Mi=function(e,t){E(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function Ni(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Fi=function(e){throw e},$i=function(e){return{value:e,done:!0}};function Gi(e,t,n){void 0===t&&(t=Fi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:$i,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function xi(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Vi=function(e){return Array.apply(null,new Array(e))},Hi=function(e){return function(t){return e(Object.defineProperty(t,yi,{value:!0}))}},Wi=function(e){return e===Si},ji=function(e){return e===gi},Bi=function(e){return Wi(e)||ji(e)};function Ki(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ti(e)?Vi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||Bi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=Di,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function qi(e){return{name:e.name||"anonymous",location:zi(e)}}function zi(e){return e[hi]}var Xi=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)},Ji="TAKE",Yi="CALL",Qi="FORK",Zi="SELECT",eo=function(e,t){var n;return(n={})[ci]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function to(e,t){return void 0===e&&(e="*"),Ei(e)?(bi(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),eo(Ji,{pattern:e})):Ii(n=e)&&n[di]&&bi(t)&&Ei(t)?eo(Ji,{channel:e,pattern:t}):Ii(e)?(bi(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),eo(Ji,{channel:e})):void 0;var n}function no(e,t){return mi(t)&&(t=e,e=void 0),eo("PUT",{channel:e,action:t})}function io(e){var t=eo("ALL",e);return t.combinator=!0,t}function oo(e,t){var n,i=null;return Ai(e)?n=e:(Ti(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&ki(n)&&Ai(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function ao(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 eo(Yi,oo(e,n))}function ro(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return eo(Qi,oo(e,n))}function so(e){return void 0===e&&(e=fi),eo("CANCEL",e)}function lo(e){void 0===e&&(e=Ui);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return eo(Zi,{selector:e,args:n})}var co=ao.bind(null,wi);var uo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},yo=[],fo=0;function po(e){try{ho(),e()}finally{vo()}}function go(e){yo.push(e),fo||(ho(),mo())}function So(e){try{return ho(),e()}finally{mo()}}function ho(){fo++}function vo(){fo--}function mo(){var e;for(vo();!fo&&void 0!==(e=yo.shift());)po(e)}var bo=function(e){return function(t){return e.some((function(e){return Po(e)(t)}))}},Ao=function(e){return function(t){return e(t)}},ko=function(e){return function(t){return t.type===String(e)}},To=function(e){return function(t){return t.type===e}},_o=function(){return Ci};function Po(e){var t="*"===e?_o:ki(e)?ko:Ti(e)?bo:Li(e)?ko:Ai(e)?Ao:Oi(e)?To:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Eo={type:li},Io=function(e){return e&&e.type===li};function Lo(){var e,t,n,i,o,a,r=(t=!1,i=n=[],o=function(){i===n&&(i=n.slice())},a=function(){t=!0;var e=n=i;i=[],e.forEach((function(e){e(Eo)}))},(e={})[di]=!0,e.put=function(e){if(!t)if(Io(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[ui](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=_o),t?e(Eo):(e[ui]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),Ni(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[yi]?s(e):go((function(){s(e)}))},r}function Oo(e,t){var n=e[si];Ai(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var wo,Ro=0,Co=function(){return++Ro};function Do(e){e.isRunning()&&e.cancel()}var Uo=((wo={}).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):!Io(e)||r?n(e):n(Si)};try{o.take(s,bi(a)?Po(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},wo.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;go((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&_i(t)?Oo(t,n):n(t)}))},wo.ALL=function(e,t,n,i){var o=i.digestEffect,a=Ro,r=Object.keys(t);if(0!==r.length){var s=Ki(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ti(t)?[]:{})},wo.RACE=function(e,t,n,i){var o=i.digestEffect,a=Ro,r=Object.keys(t),s=Ti(t)?Vi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||Bi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=Di,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)}))},wo.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(_i(l))return void Oo(l,n);if(Pi(l))return void jo(e,l,s.context,Ro,qi(a),!1,n);n(l)}catch(e){n(e,!0)}},wo.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){mi(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},wo.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(Pi(o))return o;var a=!1;return Gi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!_i(o)})}))}catch(e){return Gi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:qi(t)}(c,a);So((function(){var t=jo(e,c,l.context,Ro,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},wo.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()&&Ni(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ti(t)){if(0===t.length)return void n([]);var r=Ki(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},wo.CANCEL=function(e,t,n,i){var o=i.task;t===fi?Do(o):Ti(t)?t.forEach(Do):Do(t),n()},wo.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)}},wo.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Xi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Eo):e.isEmpty()?(n.push(i),i.cancel=function(){Ni(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Eo):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var i=0,o=e.length;i<o;i++)(0,e[i])(Eo)}}}}(t.buffer),a=Po(i),r=function t(n){Io(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)},wo.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},wo.FLUSH=function(e,t,n){t.flush(n)},wo.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},wo.SET_CONTEXT=function(e,t,n,i){var o=i.task;Mi(o.context,t),n()},wo);function Mo(e,t){return e+"?"+t}function No(e){var t=e.name,n=e.location;return n?t+" "+Mo(n.fileName,n.lineNumber):t}function Fo(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 $o=null,Go=[],xo=function(e){e.crashedEffect=$o,Go.push(e)},Vo=function(){$o=null,Go.length=0},Ho=function(){var e,t,n=Go[0],i=Go.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=zi(e))?t.code+" "+Mo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+No(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+No(e.meta)})),[Fo(Go)]).join("\n")};function Wo(e,t,n,i,o,a,r){var s;void 0===r&&(r=Di);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||(Ni(o,t),t.cont=Di,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=Di,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,xo({meta:o,cancelledTasks:y}),S.isRoot){var i=Ho();Vo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===gi?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={})[pi]=!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(gi,!1))},s.cont=r,s.end=g,s.setContext=function(e){Mi(f,e)},s.toPromise=function(){return d||(d=uo(),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 jo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){_i(t)?Oo(t,i):Pi(t)?jo(e,t,c.context,n,o,!1,i):t&&t[ci]?(0,Uo[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Di;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(gi))},status:0},c=Wo(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),Vo()):ji(e)?(l.status=1,d.cancel(),o=Ai(t.return)?t.return(gi):{done:!0,value:gi}):o=Wi(e)?Ai(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=Co();function l(n,o){a||(a=!0,i.cancel=Di,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){$o=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=Di,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=Di,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function Bo(e,t){for(var n=e.channel,i=void 0===n?Lo():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?xi: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),h=Co();if(l&&(l.rootSagaStarted=l.rootSagaStarted||Di,l.effectTriggered=l.effectTriggered||Di,l.effectResolved=l.effectResolved||Di,l.effectRejected=l.effectRejected||Di,l.effectCancelled=l.effectCancelled||Di,l.actionDispatched=l.actionDispatched||Di,l.rootSagaStarted({effectId:h,saga:t,args:f})),c){var v=Ge.apply(void 0,c);g=function(e){return function(t,n,i){return v((function(t){return e(t,n,i)}))(t)}}}else g=Ui;var m={channel:i,dispatch:Hi(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return So((function(){var e=jo(m,S,s,h,qi(t),!0,void 0);return l&&l.effectResolved(h,e),e}))}var Ko=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Lo():a,s=n.sagaMonitor,l=vi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=Bo.bind(null,E({},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){Mi(o,e)},c},qo=function(e){return{done:!0,value:e}},zo={};function Xo(e){return Ii(e)?"channel":Li(e)?String(e):Ai(e)?e.name:String(e)}function Jo(e,t,n){var i,o,a,r=t;function s(t,n){if(r===zo)return qo(t);if(n&&!o)throw r=zo,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===zo?qo(t):a}return Gi(s,(function(e){return s(null,e)}),n)}function Yo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:to(e)},s=function(e){return{done:!1,value:ro.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Xo(e)+", "+t.name+")")}function Qo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:to(e)},l=function(e){return{done:!1,value:ro.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:so(e)}},u=function(e){return a=e},d=function(e){return r=e};return Jo({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("+Xo(e)+", "+t.name+")")}function Zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:to(e)},s=function(e){return{done:!1,value:ao.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Jo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Xo(e)+", "+t.name+")")}function ea(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:ao.apply(void 0,[n].concat(a))},l={done:!1,value:co(t)};return Jo({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:zo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function ta(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ro.apply(void 0,[Yo,e,t].concat(i))}function na(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ro.apply(void 0,[Qo,e,t].concat(i))}function ia(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return ro.apply(void 0,[Zo,e,t].concat(i))}class oa{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return oa.instance||(oa.instance=new oa),oa.instance}static setContext(e){oa.getInstance().context=e}static setAccessToken(e){oa.getInstance().accessToken=e}static setUser(e){oa.getInstance().user=e}static setOnRedirectTo(e){oa.getInstance().onRedirectTo=e}static setLogout(e,t){oa.getInstance().logout=n=>{n?e(n):oa.onRedirectTo(t)}}static getContext(){var e;return null!=(e=oa.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return oa.getInstance().accessToken}static getUser(){return oa.getInstance().user}static onRedirectTo(e,t){return oa.getInstance().onRedirectTo(e,t)}static logout(e){return oa.getInstance().logout(e)}}oa.instance=void 0;const aa={getContext:()=>oa.getContext(),getAccessToken:()=>oa.getAccessToken(),getUser:()=>oa.getUser(),onRedirectTo:(e,t)=>oa.onRedirectTo(e,t),logout:e=>oa.logout(e)};class ra extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function sa(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const la=async e=>{var t,n,i;const o=oa.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:oa.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=sa(e,t),o=await async function(e,t){t||(t={});const n=await async function(e){let t=[];return e.additionalQueryParamsResolver&&(t=await e.additionalQueryParamsResolver()),t}(e);for(const e of n)t[e.key]=e.value;const i=Object.keys(t);for(const e of i){const n=t[e];t[e]="object"==typeof n?JSON.stringify(n):n}return t}(e,n);let a=t.startsWith("http")?t:`${i}${t}`;const r=Object.keys(o).length>0;return o&&r&&(a+=`?${new URLSearchParams(o)}`),a}(o,e.url,e.params),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:E({},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 ra("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new ra(e,s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},ca=async(e,t,n)=>la(E({url:e,method:"GET",contentType:"application/json",params:t},n)),ua=async(e,t,n)=>la(E({url:e,method:"POST",contentType:"application/json",body:t},n)),da=async(e,t,n)=>la(E({url:e,method:"PATCH",contentType:"application/json",body:t},n)),ya=async(e,t,n)=>la(E({url:e,method:"PUT",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>la(E({url:e,method:"DELETE",contentType:"application/json",body:t},n)),pa=async(e,t,n,i)=>la(E({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),ga={v1:"/identity/resources/users/webauthn/v1/devices"},Sa={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ha={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},va={v1:"/identity/resources/configurations/v1"},ma={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ba={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Aa={v1:"/identity/resources/permissions/v1"},ka={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"}}},Ta={v1:"/identity/resources/roles/v1"},_a={v1:"/identity/resources/sub-tenants/users/v1"},Pa={v1:"/identity/resources/impersonation/v1"},Ea={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},Ia={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},La={v1:"/team/resources/members/v1"},Oa={v1:"/team/resources/roles/v1"},wa={v1:"/team/resources/stats/v1"},Ra={v1:"/team/resources/profile"},Ca={v1:"/tenants/resources/account-settings/v1"},Da={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Ua={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Ma={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"}}}},Na={v1:"/subscriptions/resources/payment-providers/v1"},Fa={v1:"/subscriptions/resources/subscriptions/v1"},$a={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Ga={v1:"/reports/engine/resources/triggers/v1"},xa="/notification",Va="/audits",Ha={v1:"/event/resources/configurations/v1"},Wa="/webhook",ja="/oauth",Ba="/flags",Ka="/directory/resources/v1/configurations/scim2",qa="/directory/resources/scim/temp";async function za(e){return ya(`${ha.v1}/tenant`,e)}async function Xa(){return ca(`${ha.v2}/me/tenants`)}async function Ja(){return ca(Da.v1)}async function Ya(){return ca(Da.tree.v1)}async function Qa(){return ca(va.v1)}async function Za(){return ca(`${va.v1}/mfa-policy`)}async function er(){return ca(`${va.v1}/mfa-policy/vendor`)}async function tr(e){return e.id?da(`${va.v1}/mfa-policy`,e):ua(`${va.v1}/mfa-policy`,e)}async function nr(){return ca(`${va.v1}/lockout-policy`)}async function ir(){return ca(`${va.v1}/lockout-policy/vendor`)}async function or(e){return e.id?da(`${va.v1}/lockout-policy`,e):ua(`${va.v1}/lockout-policy`,e)}async function ar(){try{return await ca(`${va.v1}/captcha-policy/public`)}catch{return null}}async function rr(){return ca(`${va.v1}/password-history-policy`)}async function sr(){return ca(`${va.v1}/password-history-policy/vendor`)}async function lr(e){return e.id?da(`${va.v1}/password-history-policy`,e):ua(`${va.v1}/password-history-policy`,e)}async function cr(){return ca(`${va.v1}/password`)}async function ur(){return ca(`${ma.emailDomain.v1}`)}async function dr(){return ca(`${ma.emailDomain.v1}/config`)}async function yr(e){return ua(`${ma.emailDomain.v1}`,e)}async function fr(e){return ua(`${ma.emailDomain.v1}/config`,e)}async function pr(e){return fa(`${ma.emailDomain.v1}/${e}`)}async function gr(e){return ca(`${ma.ip.v1}`,e)}async function Sr(){return ca(`${ma.ip.v1}/config`)}async function hr(e){return ua(`${ma.ip.v1}`,e)}async function vr(e){return ua(`${ma.ip.v1}/bulk`,e)}async function mr(e){return ua(`${ma.ip.v1}/config`,e)}async function br(e){return fa(`${ma.ip.v1}/${e}`)}async function Ar(){return ua(`${ma.ip.v1}/verify`)}async function kr(){return ua(`${ma.ip.v1}/verify/allow`)}let Tr,_r,Pr;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Tr||(Tr={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(_r||(_r={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Pr||(Pr={}));class Er extends Error{constructor(e){super(e)}}const Ir="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Er("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e,i,o=0,a=0;i=t.charAt(a++);~i&&(e=o%4?64*e+i:i,o++%4)?n+=String.fromCharCode(255&e>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return n};class Lr extends Error{constructor(e){super(e)}}const Or=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(Ir(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Ir(t)}})(e.split(".")[n]))}catch(e){throw new Lr("Invalid token specified: "+e.message)}},wr=["type"],Rr=["type"];async function Cr(e){if(!e.accessToken)return e;oa.setAccessToken(e.accessToken);const t=await ca(`${ha.v2}/me`),n=E({},e,e.accessToken?Or(e.accessToken):{},t);return oa.setUser(n),n}async function Dr(e){if(!e.accessToken)return{user:e};oa.setAccessToken(e.accessToken);const[t,n]=await Promise.all([ca(`${ha.v2}/me`),Xa()]),i=E({},e,e.accessToken?Or(e.accessToken):{},t);return oa.setUser(i),{user:i,tenants:n}}async function Ur(e){oa.setAccessToken(e.id_token);const t=await ca(`${ha.v2}/me`),n=e.id_token?Or(e.id_token):{},i=E({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return oa.setUser(i),i}async function Mr(e){try{const{address:t}=await ua(`${Sa.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function Nr(e){return ua(`${Sa.v1}/user/saml/prelogin`,e)}async function Fr(e){return Cr(await ua(`${Sa.v1}/user/saml/postlogin`,e))}async function $r(e){return Cr(await ua(`${Sa.v1}/user/oidc/postlogin`,e))}async function Gr(e){return Cr(await ua(`${Sa.v1}/user`,e))}async function xr(e){return Cr(await ua(`${Sa.v1}/user/mfa/verify`,e))}async function Vr(e){return ua(`${ha.v1}/activate`,e)}async function Hr(e){return ca(`${ha.v1}/activate/strategy`,e)}async function Wr(e){return ua(`${ha.v1}/activate/reset`,e)}async function jr(e){return ua(`${ha.v1}/invitation/reset`,e)}async function Br(e){return ua(`${ha.v1}/invitation/accept`,e)}async function Kr(){return Cr(await ua(`${Sa.v1}/user/token/refresh`))}async function qr(){return Dr(await ua(`${Sa.v1}/user/token/refresh`))}async function zr(){return ua(`${Sa.v1}/logout`)}async function Xr(e){return ca(`${ja}/logout`,e)}async function Jr(e){return ua(`${ha.v1}/passwords/reset`,e)}async function Yr(e){return ua(`${ha.v1}/passwords/reset/verify`,e)}async function Qr(e){return ca(`${ha.v1}/passwords/config`,e)}async function Zr(e){return ua(`${Sa.v1}/user/mfa/recover`,e)}async function es(){return ua(`${ha.v1}/mfa/enroll`)}async function ts(){return ua(`${ha.v1}/mfa/authenticator/enroll`)}async function ns(e){return ua(`${ha.v1}/mfa/authenticator/enroll/verify`,e)}async function is(e){return ua(`${ha.v1}/mfa/sms/enroll`,e)}async function os(e){return ua(`${ha.v1}/mfa/sms/enroll/verify`,e)}async function as(){return ua(`${ha.v1}/mfa/webauthn/enroll`)}async function rs(e){return ua(`${ha.v1}/mfa/webauthn/enroll/verify`,e)}async function ss(e){return ua(`${ha.v1}/mfa/enroll/verify`,e)}async function ls(e){return ua(`${ha.v1}/mfa/disable`,e)}async function cs(e,t){return ua(`${ha.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function us(e){return ua(`${ha.v1}/mfa/sms/${e}/disable`)}async function ds(e,t){return ua(`${ha.v1}/mfa/sms/${e}/disable/verify`,t)}async function ys(e){return ua(`${ha.v1}/mfa/webauthn/${e}/disable`)}async function fs(e,t){return ua(`${ha.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function ps(){return ca(`${ha.v1}/mfa/devices`)}async function gs(e){return ua(`${Sa.v1}/user/mfa/authenticator/enroll`,e)}async function Ss(e){return ua(`${Sa.v1}/user/mfa/authenticator/enroll/verify`,e)}async function hs(e,t){return ua(`${Sa.v1}/user/mfa/authenticator/${e}/verify`,t)}async function vs(e){return ua(`${Sa.v1}/user/mfa/sms/enroll`,e)}async function ms(e){return ua(`${Sa.v1}/user/mfa/sms/enroll/verify`,e)}async function bs(e,t){return ua(`${Sa.v1}/user/mfa/sms/${e}`,t)}async function As(e,t){return ua(`${Sa.v1}/user/mfa/sms/${e}/verify`,t)}async function ks(e){return ua(`${Sa.v1}/user/mfa/webauthn/enroll`,e)}async function Ts(e){return ua(`${Sa.v1}/user/mfa/webauthn/enroll/verify`,e)}async function _s(e,t){return ua(`${Sa.v1}/user/mfa/webauthn/${e}`,t)}async function Ps(e,t){return ua(`${Sa.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Es(){return ca(`${Ia.v1}/saml/configurations`)}async function Is(e){return ua(`${Ia.v1}/saml/configurations`,e)}async function Ls(){return ca(`${Ia.v1}/saml/configurations/vendor-config`)}async function Os(e){return ya(`${Ia.v1}/saml/configurations/metadata`,e)}async function ws(){return ya(`${Ia.v1}/saml/validations/domain`)}async function Rs(){return ca(`${Ia.v1}/saml/configurations/roles/default`)}async function Cs(){return ca(`${Ia.v2}/saml/configurations/groups`)}async function Ds({roleIds:e}){return ua(`${Ia.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Us({roleIds:e,group:t}){return ua(`${Ia.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Ms({roleIds:e,group:t,id:n}){return da(`${Ia.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function Ns({id:e}){return fa(`${Ia.v2}/saml/configurations/groups/${e}`)}async function Fs(){return ca(`${Ia.v1}/oidc/configurations`)}async function $s(){return ca(`${Ia.v2}/configurations/public`)}async function Gs(){return ca(ba.v1)}async function xs(){return ca(ba.v2)}async function Vs(){return ca(ba.custom.v1)}async function Hs({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),ua(`${Sa.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Ws(){return ca(`${va.v1}/public`)}async function js(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await ua(`${ha.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await Cr(n):void 0,userId:i,tenantId:o}}async function Bs(){return ca(ha.sessions.currentUser.v1)}async function Ks(){return ca(`${ha.sessions.currentUser.v1}/current`)}async function qs(e){return ua(`${ha.sessions.v1}/revoke`,{userId:e})}async function zs(){return ca(ha.sessions.configurations.v1)}async function Xs(e){await ua(ha.sessions.configurations.v1,e)}async function Js(e){await fa(`${ha.sessions.currentUser.v1}/${e}`)}async function Ys(){await fa(`${ha.sessions.currentUser.v1}/all`)}async function Qs(){return ca(ha.accessTokens.v1)}async function Zs(){return ca(ka.accessTokens.v1)}async function el({id:e}){return fa(`${ka.accessTokens.v1}/${e}`)}async function tl({id:e}){return fa(`${ha.accessTokens.v1}/${e}`)}async function nl(e){return ua(ha.accessTokens.v1,e)}async function il(e){return ua(ka.accessTokens.v1,e)}async function ol(){return ca(ha.apiTokens.v1)}async function al(){return ca(ka.apiTokens.v1)}async function rl(e){return ua(ha.apiTokens.v1,e)}async function sl(e){return ua(ka.apiTokens.v2,e)}async function ll({tokenId:e}){return fa(`${ka.apiTokens.v1}/${e}`)}async function cl({tokenId:e}){return fa(`${ha.apiTokens.v1}/${e}`)}async function ul({userId:e}){return ca(`${ha.v1}/${e}`)}async function dl(e){return ca(`${va.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function yl(e){let{type:t}=e,n=vi(e,wr);return ua(`${Sa.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function fl(e){let{type:t}=e,n=vi(e,Rr);return ua(`${Sa.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function pl({token:e}){return ua(ka.invites.verify.v1,{token:e})}async function gl(){return ca(`${Ia.v1}/configurations`)}async function Sl(e){return ua(`${Ia.v1}/configurations`,e)}async function hl(e,t){return da(`${Ia.v1}/configurations/${e}`,t)}async function vl(e){return fa(`${Ia.v1}/configurations/${e}`)}async function ml(e){return ua(`${Ia.v1}/configurations/metadata`,e)}async function bl(e,t){return ya(`${Ia.v1}/configurations/${e}/metadata`,t)}async function Al(e,t){return ua(`${Ia.v1}/configurations/${e}/domains`,t)}async function kl(e,t){return fa(`${Ia.v1}/configurations/${e}/domains/${t}`)}async function Tl(e,t){return ya(`${Ia.v1}/configurations/${e}/domains/${t}/validate`)}async function _l(e){return ca(`${Ia.v1}/configurations/${e}/roles`)}async function Pl(e,t){return ya(`${Ia.v1}/configurations/${e}/roles`,t)}async function El(e,t){return ua(`${Ia.v1}/configurations/${e}/groups`,t)}async function Il(e,{roleIds:t,group:n,id:i}){return da(`${Ia.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Ll(e,t){return fa(`${Ia.v1}/configurations/${e}/groups/${t}`)}async function Ol(e){return ca(`${Ia.v1}/configurations/${e}/groups`)}async function wl(e){return ua(`${Sa.v2}/user/sso/prelogin`,e)}async function Rl(e){return Cr(await ua(`${Sa.v2}/user/oidc/postlogin`,e))}async function Cl(e){return Ur(await ua(`${ja}/token`,e))}async function Dl(){return Ur(await ua(`${ja}/authorize/silent`))}async function Ul(e){return ua(`${ha.v1}/phone/reset`,e)}async function Ml(e){return ua(`${ha.v1}/phone/reset/verify`,e)}async function Nl(e){return ua(`${ha.v1}/phone`,e)}async function Fl(e){return ua(`${ha.v1}/phone/verify`,e)}async function $l(e){return ya(`${ha.v1}/phone/change`,e)}async function Gl(e){return ua(`${Sa.v1}/webauthn/prelogin`,e)}async function xl(e){return ua(`${Sa.v1}/webauthn/postlogin`,e)}async function Vl(){return ua(ga.v1)}async function Hl(){return ca(ga.v1)}async function Wl(e){return fa(`${ga.v1}/${e}`)}async function jl(e){return ua(`${ga.v1}/verify`,e)}async function Bl(){return ca(`${va.v1}/auth/strategies/public`)}async function Kl(){return ca(`${va.v1}/mfa/strategies`)}async function ql(e){return ca(`${ha.v2}/me`,null!=e?e:{addRoles:!0})}async function zl(e){return ya(`${ha.v2}/me`,e)}async function Xl(e){return ya(`${Ra.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Jl(e){return ua(`${ha.v1}/passwords/change`,e)}async function Yl(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>E({},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 ca(La.v1,E({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function Ql(e){return ua(ha.v2,E({},e,{provider:"local"}))}async function Zl(e){return fa(`${La.v1}/${e.userId}`)}async function ec(e){return ya(La.v1,e)}async function tc(e){return ua(ka.invites.user.v1,E({},e))}async function nc(e){return da(ka.invites.user.v1,E({},e))}async function ic(){return fa(ka.invites.user.v1)}async function oc(){return ca(ka.invites.user.v1)}async function ac(){return ca(ka.invites.configuration.v1)}async function rc(){return ca(Oa.v1)}async function sc(){return ca(Aa.v1)}async function lc(){return ca(`${wa.v1}/members`)}async function cc(e){return ua(`${La.v1}/${e.userId}/resendActivationEmail`,{})}async function uc(e){return ua(ha.v2,E({},e,{provider:"local"}))}async function dc(e){return ua(ha.invitation.resendAll.v1,E({},e))}async function yc(e){var t,n;const i=await ca("/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 fc(){const e=await ca("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const pc=async()=>yc({entityName:"notifications"}),gc=async()=>yc({entityName:"saml"}),Sc=async()=>yc({entityName:"audits"}),hc=async e=>async function(e){const t=await ca(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),vc=["dataFilters"],mc=["templateId","dataFilters"],bc=["dataFilters"];async function Ac(e){return ca(`${$a.v2}/tenant-reports`,e)}async function kc(e){return ca(`${$a.v2}/${e.id}/tenant-reports`)}async function Tc(e){let{dataFilters:t}=e,n=vi(e,vc);return{html:await ca(`${Ga.v1}/preview-report`,E({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function _c(e){let{templateId:t,dataFilters:n}=e,i=vi(e,mc);return ua(`${$a.v2}/${t}/tenant-reports`,E({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Pc(e){let{dataFilters:t}=e,n=vi(e,bc);const i=await ca(`${Ga.v1}/preview-report`,E({},n,{dataFilters:btoa(JSON.stringify(t||{}))}),{responseType:"blob"});let o="text/html",a="html";"pdf"===n.responseType?(o="application/pdf",a="pdf"):"image"===n.responseType&&(o="image/jpeg",a="jpg");const r=new Blob([i],{type:o}),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 Ec(e){return ua(`${Ga.v1}/tenant-reports`,e)}async function Ic(e){return ca(xa,{params:e})}async function Lc(e){return ya(`${xa}/status`,{params:e})}async function Oc(e){const{notificationId:t,pinStatus:n}=e;return ya(`${xa}/${n}`,{notificationId:t})}async function wc(){return ua(`${xa}/status/mark-all-read`)}const Rc=["endpoint","headerProps"];async function Cc(e){return ca(Va,e)}async function Dc(e){return ca(`${Va}/stats`,e)}async function Uc(e){const{endpoint:t,headerProps:n}=e,i=vi(e,Rc);return pa(`${Va}/export/${t}`,{properties:n},i)}const Mc=["eventKey"],Nc=["eventKey"],Fc=()=>ca(`${Ua.v1}/slack`),$c=()=>ca(`${Ua.v1}/slack/applications`),Gc=()=>ca(`${Ua.v1}/slack/channels`),xc=e=>e.id?da(`${Ua.v1}/slack/subscription/${e.id}`,e):ua(`${Ua.v1}/slack/subscriptions`,e),Vc=e=>fa(`${Ua.v1}/slack/subscriptions/${e.id}`),Hc=e=>ua(`${Ua.v1}/slack/applications/registrations`,{code:e}),Wc=()=>ca(`${Ua.v1}/emails`),jc=e=>{let{eventKey:t}=e,n=vi(e,Mc);return ua(`${Ua.v1}/emails/${t}`,n)},Bc=({eventKey:e,enabled:t})=>da(`${Ua.v1}/emails/${e}`,{enabled:t}),Kc=(e,t)=>fa(`${Ua.v1}/emails/${e}/subscriptions/${t}`),qc=(e,t,n)=>ya(`${Ua.v1}/emails/${t}/subscriptions/${e}`,n),zc=e=>fa(`${Ua.v1}/emails/${e}`),Xc=()=>ca(`${Ua.v2}/sms`),Jc=e=>{let{eventKey:t}=e,n=vi(e,Nc);return ua(`${Ua.v2}/sms/${t}`,n)},Yc=({eventKey:e,enabled:t})=>da(`${Ua.v2}/sms/${e}`,{enabled:t}),Qc=(e,t)=>fa(`${Ua.v2}/sms/${e}/subscriptions/${t}`),Zc=(e,t,n)=>ya(`${Ua.v2}/sms/${t}/subscriptions/${e}`,n),eu=e=>fa(`${Ua.v2}/sms/${e}`),tu=()=>ca(Wa),nu=e=>e._id?da(`${Wa}/${e._id}`,e):ua(`${Wa}/custom`,e),iu=e=>fa(`${Wa}/${e}`),ou=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return ca(`${Wa}/logs/?${i.toString()}`)},au=e=>ua(`${Wa}/test`,e),ru=e=>ua(`${Wa}/logs/${e}/retries`),su=()=>ca(`${Ha.v1}/categories`),lu=e=>ca(Ha.v1,{channels:e});async function cu(e){return ya(Ca.v1,e)}async function uu(){return ca(Ca.v1)}const du=["roleId"],yu=["roleId"],fu=["permissionId"];async function pu(){return ca(Ta.v1)}async function gu(e){return ua(Ta.v1,e)}async function Su({roleId:e}){return fa(`${Ta.v1}/${e}`)}async function hu(e){let{roleId:t}=e,n=vi(e,du);return da(`${Ta.v1}/${t}`,n)}async function vu(e){let{roleId:t}=e,n=vi(e,yu);return ya(`${Ta.v1}/${t}/permissions`,n)}async function mu(){return ca(Aa.v1)}async function bu(e){let{permissionId:t}=e,n=vi(e,fu);return ya(`${Aa.v1}/${t}/roles`,n)}async function Au(){return ca(`${Aa.v1}/categories`)}async function ku(){return ca(Ma.subscriptions.v1)}async function Tu(e){return ca(`${Ma.subscriptions.v1}/${e}`)}async function _u(e){return ya(`${Ma.subscriptions.v1}/${e}/cancellations/`,{})}async function Pu(e){return ya(`${Ma.subscriptions.v1}/${e}/renewals/`,{})}async function Eu(e,{paymentMethodId:t,planId:n}){return ya(`${Ma.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Iu(e){return ca(`${Fa.v1}/${e}`)}async function Lu(){return ca(`${Fa.v1}`)}async function Ou(e){return ya(`${Fa.v1}/${e}/cancellations/`,{})}async function wu(e){return ya(`${Fa.v1}/${e}/renewals/`,{})}async function Ru(e,{paymentMethodId:t,planId:n}){return ya(`${Fa.v1}/${e}`,{paymentMethodId:t,planId:n})}async function Cu(){return ca(Ma.plans.v1)}async function Du(e){return ca(`${Ma.plans.v1}/${e}`)}async function Uu(){return ca(Ma.invoices.v1)}async function Mu(e){return ca(`${Ma.invoices.v1}/${e}`)}async function Nu(e,t){return ca(`${Ma.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Fu=["email"];async function $u(){return ca(Ma.paymentMethods.v1)}async function Gu(e){return ca(`${Ma.paymentMethods.v1}/${e}`)}async function xu(e,t){let{email:n}=t,i=vi(t,Fu);return da(`${Ma.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Vu(e){return ua(Ma.paymentProviders.stripe.subscriptions.v1,e)}async function Hu(e){return ca(`${Ma.paymentProviders.stripe.customers.v1}/${e}`)}async function Wu(e){return ua(`${Ma.paymentProviders.stripe.customers.v1}`,e)}async function ju(){return ca(`${Ma.paymentProviders.stripe.publicConfigurations.v1}`)}async function Bu(e){return ua(`${Ma.paymentProviders.stripe.setupIntents.v1}`,e)}async function Ku(e){return ca(`${Ma.summaries.v1}/${e}`)}async function qu(e){return ca(`${Ma.tenantConfiguration.v1}/${e}`)}async function zu(e){return ua(`${Ma.tenantConfiguration.v1}`,e)}async function Xu(){return ca(Na.v1)}async function Ju(){return ca(`${Ma.configurations.vendorPublicConfigurations.v1}`)}let Yu,Qu,Zu,ed,td,nd;async function id(){return ca("/vendors/public")}async function od(e){return ca(_a.v1,e)}async function ad(e){return ua(_a.v1,e)}async function rd(e){return fa(_a.v1,e)}async function sd(e,t){return ua(`${_a.v1}/${e}/roles`,t)}async function ld(e,t){return fa(`${_a.v1}/${e}/roles`,t)}async function cd(e,t){return da(`${_a.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Yu||(Yu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(Qu||(Qu={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(Zu||(Zu={})),(ed||(ed={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(td||(td={})),function(e){e.CREATE="create_customer"}(nd||(nd={}));const ud={flags:{}};class dd{constructor(){var e;this._flags={},this._flags=null!=(e=ud.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new dd;return n.set(e),dd._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=E({},null!=(t=null==ud?void 0:ud.flags)?t:{},null!=e?e:{})}}async function yd(){return ca(Ba)}async function fd(){return ca(`${Ka}`)}async function pd(e,t){return da(`${Ka}/${e}`,t)}async function gd(e){return ua(`${Ka}`,e)}async function Sd(e){return fa(`${Ka}/${e}`)}async function hd(e){return ca(`${qa}/${e}/Users/count`)}async function vd(e){return ua(`${Pa.v1}`,e)}dd._instances={};const md=["groupId"];async function bd({groupId:e},t){return ca(`${Ea.v1}/${e}`,E({},t))}async function Ad(e){return ca(`${Ea.v1}`,E({},e))}async function kd(e,t){return ua(`${Ea.getByIds.v1}`,e,{params:t})}async function Td(e){return ua(`${Ea.v1}`,e)}async function _d(e){let{groupId:t}=e,n=vi(e,md);return da(`${Ea.v1}/${t}`,n)}async function Pd(e){return fa(`${Ea.v1}/${e}`)}async function Ed(e,t){return ua(`${Ea.v1}/${e}/roles`,t)}async function Id(e,t){return fa(`${Ea.v1}/${e}/roles`,t)}async function Ld(e,t){return ua(`${Ea.v1}/${e}/users`,t)}async function Od(e,t){return fa(`${Ea.v1}/${e}/users`,t)}async function wd(){return ca(`${Ea.configurations.v1}`)}async function Rd(e){return ua(`${Ea.configurations.v1}`,e)}let Cd,Dd,Ud,Md,Nd;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(Cd||(Cd={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Dd||(Dd={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Ud||(Ud={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Md||(Md={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}(Nd||(Nd={}));const Fd=[/^(.*)\/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],$d=`${Sa.v1}/user/token/refresh`,Gd=`${ja}/authorize/silent`,xd=`${ha.v2}/me`,Vd=`${ha.v2}/me/tenants`;let Hd,Wd,jd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Hd||(Hd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Wd||(Wd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(jd||(jd={}));const Bd={auth:n,teams:i,metadata:o,reports:a,connectivity:l,notifications:r,audits:s,tenants:t,accountSettings:c,roles:u,subscriptions:d,vendor:y,subTenants:f,featureFlags:p,directory:g,impersonate:S,groups:h};var Kd={fetch:e,ContextHolder:oa,FronteggContext:aa,api:Bd,FronteggApiError:ra,AuthStrategyEnum:_r,MachineToMachineAuthStrategy:Pr,SocialLoginProviders:Tr,ISubscriptionCancellationPolicy:Zu,ISubscriptionStatus:Yu,PaymentMethodType:Qu,ProviderType:ed};let qd,zd;!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"}(qd||(qd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(zd||(zd={}));var Xd=__webpack_require__(965);function Jd(e,t){const n=E({},e);return t.forEach((e=>{delete n[e]})),n}async function Yd(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=Xd.sha256.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function Qd(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}const Zd=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*ey(e){const t=yield lo((e=>e.root.appName));return dd.getFeatureFlags(e,t)}const ty={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},ny=E({},ty,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),iy=[{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"}],oy={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},ay=E({},oy,{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}),ry={loading:!1,error:void 0,saving:!0,profile:oy},sy={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"},ly={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:_r.EmailAndPassword,machineToMachineAuthStrategy:Pr.ClientCredentials},cy={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},uy={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},dy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},yy={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},fy={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},py=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],gy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:yy,roles:py,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Sy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],hy={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:[iy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[iy[0]],managedBy:jd.FRONTEGG}]},vy={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:[iy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[iy[0]],managedBy:jd.FRONTEGG}]},my={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},by=[vy,hy],Ay=[my],ky=[{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}],Ty=[{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"}],_y={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Py={isActive:!0,strategy:Nn.ALLOW},Ey=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:Nn.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:Nn.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:Nn.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:Nn.BLOCK,description:"IP 4"}],Iy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(E({},vy,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},Ly=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"}),Oy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Iy(6),roles:[Ly("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:jd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Iy(44),roles:[Ly("Editor")],managedBy:jd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Iy(8),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Iy(5),roles:[Ly("Admin")],managedBy:jd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Iy(21),description:"BDR, AE, and inside sales",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Iy(23),description:"Dev success and customer success",roles:[Ly("Admin")],managedBy:jd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Iy(10),description:"The marketing department",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Iy(4),description:"Human resources",roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Iy(3),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Iy(8),roles:[Ly("Editor")],managedBy:jd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Iy(4),roles:[Ly("Viewer")],managedBy:jd.FRONTEGG}];let wy,Ry,Cy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(wy||(wy={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(Ry||(Ry={})),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"}(Cy||(Cy={})),Cy.profile,Cy.privacy,Cy.personalApiTokens,Cy.account,Cy.users,Cy.groups,Cy.security,Cy.sso,Cy.audits,Cy.webhooks,Cy.apiTokens,Cy.roles,Cy.subscriptions;const Dy=["events","url"];function*Uy(){yield no(ai.setSignUpState({loading:!0}));try{const e=yield ao(Bd.auth.getVendorConfig),[t]=(yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig),yield ao(ey,["admin_portal_login_per_tenant"]));if(t){const t=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield no(ai.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield no(ai.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*My(e){let{payload:{events:t,url:n}}=e,i=vi(e.payload,Dy);yield no(ai.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield lo((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield ao(Bd.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:Ry.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(oa.setAccessToken(null==s?void 0:s.accessToken),oa.setUser(s),!r&&s&&zf(s)){const t=yield Yf(s);yield no(ai.setState(t)),a(e.loginUrl)}else yield no(ai.setSignUpState({loading:!1,shouldActivate:r,stage:dn.SignUpSuccess})),yield no(ai.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield no(ai.loadTenants()))}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setSignUpState({loading:!1,error:e.message}))}yield no(ai.setSignUpState({loading:!1}))}function*Ny(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield lo((e=>e.auth.signUpState));yield no(ai.resetSignUpState()),yield no(ai.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Fy(){yield ia(ai.signUpUser,My),yield ia(ai.resetSignUpStateSoft,Ny)}const $y={setVendorState:(e,{payload:t})=>E({},e,t)},Gy={loadVendorPublicInfo:ot("vendor/loadVendorPublicInfo")},xy={loading:!1},{reducer:Vy,actions:Hy}=rt({name:Lt,initialState:xy,reducers:E({},$y)}),Wy=E({},Hy,Gy);function*jy(){yield no(Wy.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield Bd.vendor.getVendorPublicInfo();yield no(Wy.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield no(Wy.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const By=["callback"],Ky=["callback"],qy=["callback"],zy=["callback"],Xy=["callback"],Jy=["callback"];function*Yy(){yield no(ai.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getGlobalSecurityPolicy);yield no(ai.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield no(ai.loadSecurityPolicyMfa()),yield no(ai.loadSecurityPolicyVendorMfa()),yield no(ai.loadSecurityPolicyLockout()),yield no(ai.loadSecurityPolicyVendorLockout()),yield no(ai.loadSecurityPolicyVendorPasswordHistory()),yield no(ai.loadSecurityPolicyCaptcha()),yield no(ai.loadPublicAuthStrategiesPolicy())}function*Qy(){yield no(ai.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorConfig),[t]=yield ao(ey,["admin_portal_login_per_tenant"]);if(t){const t=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield no(ai.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Zy(){yield no(ai.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorPublicAuthStrategiesConfig);yield no(ai.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*ef(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getMfaPolicy);yield no(ai.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*tf(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorMfaPolicy);yield no(ai.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*nf(e){let{payload:{callback:t}}=e,n=vi(e.payload,By);yield no(ai.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.saveMfaPolicy,n);yield no(ai.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*of(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getLockoutPolicy);yield no(ai.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*af(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ky);yield no(ai.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.saveLockoutPolicy,n);yield no(ai.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rf(){yield no(ai.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorLockoutPolicy);yield no(ai.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*sf(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCaptchaPolicy);yield no(ai.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*lf(){yield no(ai.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getPasswordHistoryPolicy);yield no(ai.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*cf(){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getVendorPasswordHistoryPolicy);yield no(ai.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*uf(e){let{payload:{callback:t}}=e,n=vi(e.payload,qy);yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.savePasswordHistoryPolicy,n);yield no(ai.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*df(){yield no(ai.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getPasswordConfigPolicy);yield no(ai.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*yf(){yield ia(ai.loadSecurityPolicy,Yy),yield ta(ai.saveSecurityPolicyMfa,nf),yield ta(ai.loadSecurityPolicyMfa,ef),yield ta(ai.loadSecurityPolicyVendorMfa,tf),yield ta(ai.saveSecurityPolicyLockout,af),yield ta(ai.loadSecurityPolicyLockout,of),yield ta(ai.loadSecurityPolicyVendorLockout,rf),yield ta(ai.loadSecurityPolicyCaptcha,sf),yield ta(ai.saveSecurityPolicyPasswordHistory,uf),yield ta(ai.loadSecurityPolicyPasswordHistory,lf),yield ta(ai.loadSecurityPolicyVendorPasswordHistory,cf),yield ta(ai.loadVendorPasswordConfig,df),yield ta(ai.loadPublicSecurityPolicy,Qy),yield ta(ai.loadPublicAuthStrategiesPolicy,Zy)}function*ff(){yield no(ai.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield no(ai.setSecurityPolicyPublicState({policy:ly,loading:!1}))}catch(e){yield no(ai.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*pf(){yield no(ai.setSecurityPolicyGlobalState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyGlobalState({policy:sy,loading:!1})),yield no(ai.loadSecurityPolicyMfa()),yield no(ai.loadSecurityPolicyVendorMfa()),yield no(ai.loadSecurityPolicyLockout()),yield no(ai.loadSecurityPolicyVendorLockout()),yield no(ai.loadSecurityPolicyPasswordHistory()),yield no(ai.loadSecurityPolicyVendorPasswordHistory()),yield no(ai.loadSecurityPolicyCaptcha())}function*gf(){yield no(ai.setSecurityPolicyMfaState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyMfaState({policy:cy,loading:!1}))}function*Sf(){yield no(ai.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorMfaState({policy:cy,loading:!1}))}function*hf(e){var t;let{payload:{callback:n}}=e,i=vi(e.payload,zy);yield no(ai.setSecurityPolicyMfaState({saving:!0,error:null}));const o=E({},uy,{id:null!=(t=i.id)?t:uy.id,enforceMFAType:i.enforceMFAType});yield gt(),yield no(ai.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*vf(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyLockoutState({policy:uy,loading:!1}))}function*mf(){yield no(ai.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorLockoutState({policy:uy,loading:!1}))}function*bf(e){let{payload:{callback:t}}=e,n=vi(e.payload,Xy);yield no(ai.setSecurityPolicyLockoutState({saving:!0,error:null})),yield gt();const i=E({},uy,n,{id:n.id?n.id:uy.id});null==t||t(i),yield no(ai.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Af(){yield no(ai.setSecurityPolicyLockoutState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyLockoutState({policy:uy,loading:!1}))}function*kf(){yield no(ai.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyPasswordHistoryState({policy:dy,loading:!1}))}function*Tf(){yield no(ai.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield gt(),yield no(ai.setSecurityPolicyVendorPasswordHistoryState({policy:dy,loading:!1}))}function*_f(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jy);yield no(ai.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield gt();const i=E({},dy,n,{id:n.id?n.id:dy.id});null==t||t(i),yield no(ai.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Pf(){yield ia(ai.loadSecurityPolicy,pf),yield ta(ai.loadPublicSecurityPolicy,ff),yield ta(ai.saveSecurityPolicyMfa,hf),yield ta(ai.loadSecurityPolicyMfa,gf),yield ta(ai.loadSecurityPolicyVendorMfa,Sf),yield ta(ai.saveSecurityPolicyLockout,bf),yield ta(ai.loadSecurityPolicyLockout,vf),yield ta(ai.loadSecurityPolicyVendorLockout,mf),yield ta(ai.loadSecurityPolicyCaptcha,Af),yield ta(ai.saveSecurityPolicyPasswordHistory,_f),yield ta(ai.loadSecurityPolicyPasswordHistory,kf),yield ta(ai.loadSecurityPolicyVendorPasswordHistory,Tf)}const Ef=["callback"],If=["callback"],Lf=["callback"],Of=["callback"],wf=["callback","events"],Rf=["callback"],Cf=["callback"],Df=["callback"],Uf=["callback"],Mf=["callback"],Nf=["callback"],Ff=["callback"],$f=["callback"],Gf=["callback"],xf=["callback","deviceId"],Vf=["callback","deviceId"],Hf=["callback","deviceId"],Wf=["callback","deviceId"],jf={[_r.Code]:bt.loginWithOtc,[_r.EmailAndPassword]:bt.loginWithPassword,[_r.MagicLink]:bt.magicLinkPreLoginSuccess,[_r.SmsCode]:bt.loginWithSmsOtc};function*Bf(){const e=oa.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield lo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(Tt);u&&![a,r,s,l].includes(u)&&(c=u),window.localStorage.removeItem(Tt),yield gt(200),no(ai.resetLoginState());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&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(d,{refresh:d.startsWith("http")})}function*Kf(){let e;try{var t;const n=yield ao(Bd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield no(ai.setState({ssoACS:e}))}function*qf(){try{const{isActive:e}=yield ao(Bd.auth.getSSOPublicConfiguration);yield no(ai.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const zf=e=>e.mfaRequired&&e.mfaToken?(oa.setAccessToken(null),oa.setUser(null),!0):(oa.setAccessToken(e.accessToken),oa.setUser(e),!1),Xf=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return en.authenticatorApp;if(t)return en.smsVerifyCode}return en.verify},Jf=e=>{if(1===e.length){const[t]=e;if(t===Ud.AuthenticatorApp)return en.authenticatorApp;if(t===Ud.SMS)return en.smsSetPhoneNumber}return en.verify};function*Yf(e){let t=bt.loginWithTwoFactor,n={};const{loginState:i}=yield lo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield ao(Bd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:Xf(e.mfaDevices)}:(n={step:Jf(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=bt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:At.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:E({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*Qf(e){var t;const{routes:n,loginState:i}=yield lo((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*Zf(){const{hostedLoginBox:e}=yield lo((e=>e.auth));e?yield ao(ep):yield ao(np)}function*ep(){const{user:e}=yield lo((e=>e.auth));if(null==e||!e.refreshToken)return oa.setAccessToken(null),oa.setUser(null),void(yield no(ai.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ao(Bd.auth.exchangeOAuthTokens,t);yield no(ai.setState({user:n,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:null,isAuthenticated:!1}))}}function*tp(){const{user:e}=yield lo((e=>e.auth));if(null==e||!e.refreshToken)return oa.setAccessToken(null),oa.setUser(null),void(yield no(ai.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield ao(Bd.auth.exchangeOAuthTokens,t);yield no(ai.setState({user:n,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:null,isAuthenticated:!1}))}}function*np(){try{const t=oa.onRedirectTo,{routes:n,loginState:i}=yield lo((e=>e.auth)),{user:o,tenants:a}=yield ao(Bd.auth.refreshTokenV2);if(zf(o)){const e=yield Yf(o);yield no(ai.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 Qf(o);yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?At.RegisterQuickLogin:At.Login})})),yield op(n)}}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:void 0,isAuthenticated:!1}))}}function*ip(){try{const t=oa.onRedirectTo,{routes:n,loginState:i}=yield lo((e=>e.auth)),{user:o,tenants:a}=yield ao(Bd.auth.refreshTokenV2);if(zf(o)){const e=yield Yf(o);yield no(ai.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield ao(gp))yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.setState({user:o})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield Qf(o);yield no(ai.setTenantsState({tenants:a,loading:!1})),yield no(ai.setState({user:o,isAuthenticated:!0,loginState:E({},i,{quickLoginToRegister:t,flow:n?At.RegisterQuickLogin:At.Login})})),yield op(n)}}catch(e){oa.setAccessToken(null),oa.setUser(null),yield no(ai.setState({user:void 0,isAuthenticated:!1}))}}function*op(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=oa.onRedirectTo,{routes:o,loginState:a}=yield lo((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 Bf())}function*ap({payload:{callback:e}}){try{const{ip:t}=yield ao(Bd.metadata.getCurrentUserIpMetadata);yield no(ai.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*rp({payload:e}){const t=[];e&&(yield no(ai.setState({isLoading:!0})),yield no(ai.loadSocialLoginsConfigurationV2()),t.push(ao(Uy)),t.push(ao(Zy)),t.push(ao(qf)),t.push(ao(jy)),t.push(ao(Kf))),t.push(ao(Zf)),yield io(t),yield no(ai.setState({isLoading:!1}))}function*sp({accessToken:e,user:t}){if(!e)return void(yield no(ai.setState({user:void 0,isAuthenticated:!1})));const n=oa.onRedirectTo,{routes:i}=yield lo((e=>e.auth));if(zf(t)){const e=yield Yf(t);yield no(ai.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*lp({payload:e}){const t=[];yield no(ai.loadSocialLoginsConfigurationV2()),t.push(ao(Uy)),t.push(ao(qf)),t.push(ao(jy)),t.push(ao(Kf)),t.push(ao(sp,e)),yield io(t)}function*cp({payload:e}){const{disableSilentRefresh:t}=yield lo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield ao(Bd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.loadTenants()),yield no(ai.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield lo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield no(ai.setState({isLoading:!0}));const a=Qd(),r=Qd(),s=yield ao(Yd,r);localStorage.setItem(_t,r);const l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${sa(n,"/oauth/authorize")}/oauth/authorize`,u=E({response_type:"code",client_id:n.clientId||"INVALID-CLIENT-ID",scope:"openid email profile",redirect_uri:l,code_challenge:s,code_challenge_method:"S256",nonce:a},e);if(n.tenantResolver){var d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*up({payload:e}){const t=localStorage.getItem(_t)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield lo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield ao(Bd.auth.exchangeOAuthTokens,a);yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield Bf()}}function*dp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ef);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.changePhoneNumberWithVerification,n);yield no(ai.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:bt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1}))}}function*yp(e){let{payload:{callback:t}}=e,n=vi(e.payload,If);try{yield no(ai.setLoginState({loading:!0})),yield ao(Bd.auth.verifyChangePhoneNumber,n),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1}))}}function*fp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Lf);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.passwordlessPreLogin,E({},n,{type:_r.SmsCode}));yield no(ai.setLoginState({step:bt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*pp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Of);try{const{onRedirectTo:e,routes:i}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield no(ai.setLoginState({loading:!0}));const o=yield ao(Bd.auth.passwordlessPreLogin,n),a=jf[n.type];if(a===bt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield no(ai.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield no(ai.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*gp(){const{publicAuthStrategyPolicy:e}=yield lo((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===Cd.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield ao(ey,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield ao(Bd.auth.getWebAuthnDevices);return yield no(ai.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Sp(e){let{payload:{callback:t,events:n}}=e,i=vi(e.payload,wf);try{yield no(ai.setLoginState({loading:!0}));const e=yield ao(Bd.auth.passwordlessPostLogin,i),a=oa.onRedirectTo,{routes:r}=yield lo((e=>e.auth));if(zf(e)){const t=yield Yf(e);yield no(ai.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield lo((e=>e.auth)),s=yield ao(Bd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:wy.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield no(ai.setState({user:s})),yield no(ai.setLoginState({error:void 0})),yield no(ai.loadTenants()),yield no(ai.setState({isLoading:!1})),i.flow===At.Login?(yield ao(gp))?(yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield no(ai.setState({isAuthenticated:!0})),yield Bf()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield no(ai.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield no(ai.setLoginState({loading:!1}))}}function*hp({payload:e}){try{yield no(ai.setLoginState({loading:!0}));const{name:t}=yield ao(Bd.auth.verifyInviteToken,e);yield no(ai.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield no(ai.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield no(ai.setLoginState({loading:!1}))}}function*vp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield no(ai.setLoginState({loading:!0}));try{const o=yield lo((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield ao(Bd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===zd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield lo((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield no(ai.setLoginState({step:bt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield mp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield mp({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*mp(e){let{callback:t}=e,n=vi(e,Rf);const i=yield lo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===_r.EmailAndPassword?(yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),null==t||t()):[_r.MagicLink,_r.Code,_r.SmsCode].includes(null==i?void 0:i.authStrategy)?yield no(ai.passwordlessPreLogin(E({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield no(ai.setLoginState({step:bt.loginWithPassword,loading:!1})),null==t||t())}function*bp({payload:{callback:e}}){try{yield no(ai.setLoginState({loading:!0}));const{options:t}=yield ao(Bd.auth.webAuthnCreateNewDeviceSession);t.user.id=vt(t.user.id),t.challenge=vt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield no(ai.setLoginState({error:t.message})),null==e||e(null)}finally{yield no(ai.setLoginState({loading:!1}))}}function*Ap(e){let{payload:{callback:t}}=e,n=vi(e.payload,Cf);try{yield no(ai.setLoginState({loading:!0}));const e=mt(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Dd.Platform:Dd.CrossPlatform;yield ao(Bd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setLoginState({loading:!1}))}}function*kp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Df);try{var i;yield no(ai.setPasskeysState({loading:!0})),yield no(ai.setLoginState({loading:!0}));const{options:e}=yield ao(Bd.auth.webAuthnPreLogin,n);e.challenge=vt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)}))),yield no(ai.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setPasskeysState({loading:!1})),yield no(ai.setLoginState({loading:!1}))}}function*Tp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Uf);try{var i;yield no(ai.setPasskeysState({loading:!0})),yield no(ai.setLoginState({loading:!0}));const e=mt(n.publicKey),o=yield ao(Bd.auth.webAuthnPostLogin,E({},e,{response:E({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(zf(o)){const e=oa.onRedirectTo,{routes:t}=yield lo((e=>e.auth)),n=yield Yf(o);yield no(ai.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield ao(Bd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield no(ai.loadTenants()),yield no(ai.setState({user:e,isAuthenticated:!0})),yield no(ai.setLoginState({error:void 0})),yield Bf(),null==t||t(!0)}}catch(e){yield no(ai.setLoginState({error:e.message})),null==t||t(null)}finally{yield no(ai.setPasskeysState({loading:!1})),yield no(ai.setLoginState({loading:!1}))}}function*_p({payload:e}){const{onRedirectTo:t,routes:n}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield no(ai.setLoginState({loading:!0}));try{const t=yield ao(Bd.auth.postLogin,e);oa.setAccessToken(t.accessToken),oa.setUser(t),yield no(ai.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield Bf()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield no(ai.setLoginState({step:bt.loginWithSSOFailed,loading:!1}))}}function*Pp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield no(ai.setLoginState({loading:!0}));try{const a=yield ao(Bd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});oa.setAccessToken(a.accessToken),oa.setUser(a);const r=oa.onRedirectTo,{routes:s}=yield lo((e=>e.auth));if(zf(a)){const e=yield Yf(a);yield no(ai.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield lo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield no(ai.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===At.Login?bt.success:t.step,tenants:[],tenantsLoading:!0}})),yield no(ai.loadTenants()),n&&t.flow===At.Login&&((yield ao(gp))?(yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield Bf())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){oa.setAccessToken(null),oa.setUser(null),null==o||o(!1,t),yield no(ai.setLoginState({email:e,error:t.message,loading:!1}))}}function*Ep({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield no(ai.setLoginState({loading:!0}));try{const o=yield ao(Bd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield lo((e=>e.auth)),r=a.flow===At.Login?bt.success:a.step;yield no(ai.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield no(ai.loadTenants()),yield no(ai.setLoginState({error:void 0,loading:!1})),a.flow===At.Login&&((yield ao(gp))?yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})):yield Bf()),null==i||i(!0)}catch(e){yield no(ai.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Ip({payload:e}){yield no(ai.setLoginState({loading:!0}));try{var t;yield ao(Bd.auth.recoverMfaToken,e),yield no(ai.setLoginState({loading:!1,error:void 0,step:bt.preLogin})),yield no(ai.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*Lp({payload:e}){const{hostedLoginBox:t}=yield lo((e=>e.auth));yield no(ai.setState({isLoading:!0}));try{t?yield ao(Bd.auth.OAuthLogout):yield ao(Bd.auth.logout)}catch{}yield no(ai.resetState()),yield no(ai.requestAuthorize(!0)),null==e||e()}function*Op({payload:e}){var t;try{yield ao(Bd.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*wp({user:e,tenants:t}){const n={step:en.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield no(ai.setMfaState(n)),yield no(ai.setUser(e)),yield no(ai.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Rp({user:e,tenants:t}){const{loginState:n}=yield lo((e=>e.auth));yield no(ai.setUser(e)),yield no(ai.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield lo((e=>e.auth.mfaState));if(n.flow===At.Login){const e=yield ao(gp);i===en.smsVerifyCode&&e?yield no(ai.setLoginState({step:bt.promptPasskeys,loading:!1})):yield Bf()}yield no(ai.setState({isAuthenticated:!0}))}function*Cp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Mf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.preEnrollMFASMSForLogin,n);yield no(ai.setMfaState({otcToken:e.otcToken,step:en.smsVerifyCode,phoneNumber:e.phoneNumber})),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Dp(e){let{payload:{callback:t}}=e,n=vi(e.payload,Nf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.enrollMFASMSForLogin,n),i=yield ao(Bd.auth.generateLoginResponseV2,e);yield wp(i),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Up(e){let{payload:{callback:t}}=e,n=vi(e.payload,Ff);yield no(ai.setLoginState({loading:!0}));try{var i;const e=yield ao(Bd.auth.preEnrollMFAWebAuthnForLogin,n),o=E({},e.options,{challenge:vt(e.options.challenge),user:E({},e.options.user,{id:vt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Mp(e){let{payload:{callback:t}}=e,n=vi(e.payload,$f);yield no(ai.setLoginState({loading:!0}));try{const e=mt(n.publicKey),i=yield ao(Bd.auth.enrollMFAWebAuthnForLogin,E({},n,{options:e})),o=yield ao(Bd.auth.generateLoginResponseV2,i);yield wp(o),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Np(e){let{payload:{callback:t}}=e,n=vi(e.payload,Gf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield ao(Bd.auth.generateLoginResponseV2,e);yield wp(i),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Fp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,xf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.preVerifyMFASMSForLogin,n,i);yield no(ai.setMfaState({otcToken:e.otcToken,step:en.smsVerifyCode,phoneNumber:e.phoneNumber})),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*$p(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Vf);yield no(ai.setLoginState({loading:!0}));try{const e=yield ao(Bd.auth.verifyMFASMSForLogin,n,i),o=yield ao(Bd.auth.generateLoginResponseV2,e);yield Rp(o),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Gp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Hf);yield no(ai.setLoginState({loading:!0}));try{var o;const e=yield ao(Bd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=E({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*xp(e){let{payload:{callback:t,deviceId:n}}=e,i=vi(e.payload,Wf);yield no(ai.setLoginState({loading:!0}));try{const e=mt(i.publicKey),o=yield ao(Bd.auth.verifyMFAWebAuthnForLogin,n,E({},i,{options:e})),a=yield ao(Bd.auth.generateLoginResponseV2,o);yield Rp(a),yield no(ai.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Vp(){yield ia(ai.requestAuthorize,rp),yield ia(ai.requestAuthorizeSSR,lp),yield ia(ai.requestHostedLoginAuthorize,cp),yield ia(ai.handleHostedLoginCallback,up),yield ia(ai.preLogin,vp),yield ia(ai.postLogin,_p),yield ia(ai.login,Pp),yield ia(ai.logout,Lp),yield ia(ai.silentLogout,Op),yield ia(ai.loginWithMfa,Ep),yield ia(ai.recoverMfa,Ip),yield ia(ai.quickSmsPasswordlessPreLogin,fp),yield ia(ai.changePhoneNumberWithVerification,dp),yield ia(ai.verifyChangePhoneNumber,yp),yield ia(ai.passwordlessPreLogin,pp),yield ia(ai.passwordlessPostLogin,Sp),yield ia(ai.verifyInviteToken,hp),yield ia(ai.webAuthnPrelogin,kp),yield ia(ai.webAuthnPostLogin,Tp),yield ia(ai.webAuthnCreateNewDeviceSession,bp),yield ia(ai.webAuthnVerifyNewDeviceSession,Ap),yield ia(ai.afterAuthNavigation,Bf),yield ia(ai.getUserIP,ap),yield ia(ai.preEnrollMFASMSForLogin,Cp),yield ia(ai.enrollMFASMSForLogin,Dp),yield ia(ai.preEnrollMFAWebAuthnForLogin,Up),yield ia(ai.enrollMFAWebAuthnForLogin,Mp),yield ia(ai.enrollMFAAuthenticatorAppForLogin,Np),yield ia(ai.preVerifyMFASMSForLogin,Fp),yield ia(ai.verifyMFASMSForLogin,$p),yield ia(ai.preVerifyMFAWebAuthnForLogin,Gp),yield ia(ai.verifyMFAWebAuthnForLogin,xp)}function*Hp({payload:e}){e&&(yield no(ai.setState({isLoading:!0})));const t=ay;yield no(ai.loadTenants()),yield no(ai.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*Wp({payload:{callback:e}}){try{const{ip:t}=Ey[0];yield no(ai.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*jp(){yield ia(ai.requestAuthorize,Hp),yield ia(ai.afterAuthNavigation,Bf),yield ia(ai.getUserIP,Wp)}const Bp=["callback","samlVendor"],Kp=["callback","samlVendor"];function*qp(){try{var e,t;yield no(ai.setSSOState({loading:!0}));const n=yield ao(Bd.auth.getSamlConfiguration),i=yield ao(Bd.auth.getOidcConfiguration),o=yield ao(Bd.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 no(ai.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSSOState({error:e.message,loading:!1}))}}function*zp({payload:e}){const t=yield lo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield no(ai.setSSOState({error:void 0,[n]:!0}));try{const i=yield Zd(e[0]),o=yield ao(Bd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield no(ai.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield no(ai.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*Xp({payload:e}){const{configFile:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield no(ai.setSSOState({error:void 0,[o]:!0}));try{const e=yield Zd(t),a=yield ao(Bd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield no(ai.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield no(ai.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*Jp({payload:e}){const{callback:t,samlVendor:n}=e,i=vi(e,Bp),o=yield lo((e=>e.auth.ssoState.samlConfiguration)),a=E({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield no(ai.setSSOState({samlConfiguration:E({},o,a)})));if(yield no(ai.setSSOState({error:void 0,[r]:!0})),e.type===zd.Saml){var s,l;const e=yield ao(Bd.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=Jd(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 ao(Bd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield no(ai.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield no(ai.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*Yp({payload:{callback:e}={}}){const t=yield lo((e=>e.auth.ssoState.samlConfiguration));try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.validateSamlDomain),yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*Qp(){try{const e=yield ao(Bd.auth.getSamlRoles),t=yield ao(Bd.auth.getSamlRolesGroups);yield no(ai.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield no(ai.setSSOState({error:e.message}))}}function*Zp({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield io(e.map((e=>ao(Bd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield no(ai.setSSOState({error:e.message}))}}(n)),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*eg({payload:{callback:e,id:t}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.deleteSamlGroup,{id:t}),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*tg({payload:{group:e,roleIds:t,callback:n}}){try{yield no(ai.setSSOState({error:void 0,saving:!0})),yield ao(Bd.auth.createSamlGroup,{group:e,roleIds:t}),yield Qp(),yield no(ai.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield no(ai.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*ng({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield no(ai.setSSOState({loading:!0})),yield ao(Bd.auth.oidcPostLoginV2,t),yield ao(Zf),yield no(ai.setSSOState({loading:!1}))}catch(e){var n;yield no(ai.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*ig(){yield ta(ai.loadSSOConfigurations,qp),yield ta(ai.saveSSOConfigurations,Jp),yield ta(ai.saveSSOConfigurationsFile,zp),yield ta(ai.saveSSOConfigurationsFileWithCallback,Xp),yield ta(ai.validateSSODomain,Yp),yield ta(ai.loadSSOAuthorizationRoles,Qp),yield ta(ai.updateSSOAuthorizationRoles,Zp),yield ta(ai.deleteSamlGroup,eg),yield ta(ai.createSamlGroup,tg),yield ta(ai.oidcPostlogin,ng)}function*og(){yield no(ai.setSSOState({loading:!0})),yield gt(),yield no(ai.setSSOState({samlConfiguration:yy,loading:!1,firstLoad:!1}))}function*ag({payload:e}){const t="saving";yield no(ai.setSSOState({error:void 0,[t]:!0}));const n=E({},yield lo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield no(ai.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*rg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=vi(e,Kp),r=gy.samlConfiguration,s=E({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield no(ai.setSSOState({samlConfiguration:E({},r,s)})));yield no(ai.setSSOState({error:void 0,[l]:!0})),yield gt(),s.acsUrl=null==fy||null==(t=fy.configuration)?void 0:t.acsUrl,s.spEntityId=null==fy||null==(n=fy.configuration)?void 0:n.spEntityId;const c=Jd(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 gt(),yield no(ai.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*sg({payload:{callback:e}={}}){const t=gy.samlConfiguration;yield no(ai.setSSOState({error:void 0,saving:!0})),yield gt(),yield no(ai.setSSOState({samlConfiguration:E({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*lg(){yield gt(),yield no(ai.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*cg({payload:{callback:e,authorizationRoles:t}}){yield no(ai.setSSOState({error:void 0,saving:!0})),yield gt(),yield no(ai.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*ug(){yield ta(ai.loadSSOConfigurations,og),yield ta(ai.saveSSOConfigurations,rg),yield ta(ai.saveSSOConfigurationsFile,ag),yield ta(ai.validateSSODomain,sg),yield ta(ai.loadSSOAuthorizationRoles,lg),yield ta(ai.updateSSOAuthorizationRoles,cg)}const dg=["callback"],yg=["callback","ssoConfigId"],fg=["callback","ssoConfigId"],pg=["callback","ssoConfigId"];function*gg(){try{return yield ao(Bd.auth.getOidcConfiguration)}catch(e){return null}}function*Sg(){try{return yield ao(Bd.metadata.getSamlMetadata)}catch(e){return null}}function*hg(){try{yield no(ai.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield io([ao(gg),ao(Sg)]),n=yield ao(Bd.auth.getSSOConfigurations);yield no(ai.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield no(ai.setSSOError({key:qd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield no(ai.setSSOLoader({key:qd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*vg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=vi(e,dg),i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield ao(Bd.auth.createSSOConfiguration,E({},n,{enabled:null!=(o=n.enabled)&&o}));yield no(ai.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*mg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Zd(t),o=yield ao(Bd.auth.createSSOConfigurationByMetadata,{metadata:e});yield no(ai.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*bg({payload:e}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=vi(e,yg),o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ao(Bd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ag({payload:e}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield Zd(i),a=yield ao(Bd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield no(ai.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield no(ai.setSSOError({key:qd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*kg({payload:e}){yield no(ai.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.deleteSSOConfiguration,t),yield no(ai.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield no(ai.setSSOError({key:qd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Tg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=vi(e,fg);yield no(ai.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield ao(Bd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?E({},t,{domains:[...t.domains,e]}):t));yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_DOMAIN,value:!1}))}}function*_g({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield no(ai.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?E({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield no(ai.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield no(ai.setSSOError({key:qd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield no(ai.setSSOLoader({key:qd.DELETE_SSO_DOMAIN,value:!1}))}}function*Pg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield no(ai.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?E({},e,{domains:e.domains.map((e=>e.id===n?E({},e,{validated:!0}):e))}):e));yield no(ai.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield no(ai.setSSOError({key:qd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*Eg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(Bd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?E({},e,{roleIds:n}):e));yield no(ai.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield no(ai.setSSOError({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield no(ai.setSSOLoader({key:qd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Ig({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!0}));const o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{yield io(t.map((e=>ao(Bd.auth.deleteSSOGroup,n,e)))),yield io(e.map((e=>ao(Bd.auth.createSSOGroup,n,e))));const a=yield ao(Bd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?E({},e,{groups:a}):e));yield no(ai.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Lg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield io(t.map((t=>ao(Bd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield no(ai.setSSOError({key:qd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_GROUPS,value:!1}))}}function*Og({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield ao(ca,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield ao(Bd.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield ao(Bd.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield no(ai.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*wg({payload:e}){yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=vi(e,pg),o=yield lo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield ao(Bd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield ao(Bd.auth.createSSOConfiguration,i),a=[e,...o]),yield no(ai.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield no(ai.setSSOLoader({key:qd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Rg(){yield ta(ai.loadSSOConfigurationsV2,hg),yield ta(ai.saveSSOConfigurationV2,vg),yield ta(ai.saveSSODomain,Tg),yield ta(ai.deleteSSODomain,_g),yield ta(ai.validateSSODomainV2,Pg),yield ta(ai.updateSSOConfiguration,bg),yield ta(ai.deleteSSOConfiguration,kg),yield ta(ai.setSSOGroups,Ig),yield ta(ai.updateSSOGroups,Lg),yield ta(ai.setSSODefaultRoles,Eg),yield ta(ai.saveSSOConfigurationByMetadata,mg),yield ta(ai.updateSSOConfigurationByMetadata,Ag),yield ta(ai.saveSSOConfigurationByUrl,Og),yield ta(ai.saveSSOConfigurationByData,wg)}const Cg=["callback","profilePictureUrl"],Dg=["callback","profilePictureUrl"];function*Ug(){yield no(ai.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 ao.apply(void 0,[ea,e,t,n].concat(o))}(3,2e3,Bd.teams.getProfile),t=yield lo((e=>e.auth.user));ai.setUser(E({},t,e)),yield no(ai.setProfileState({profile:e,loading:!1}))}catch(e){yield no(ai.setProfileState({loading:!1,error:e.message}))}}function*Mg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=vi(e.payload,Cg);yield no(ai.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield lo((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 ao(Bd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=E({},e,i,{profilePictureUrl:o}),r=yield ao(Bd.teams.updateProfile,a),s=yield lo((e=>e.auth.user));yield no(ai.setUser(E({},s,r))),yield no(ai.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield no(ai.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*Ng({payload:e}){yield no(ai.setProfileState({loading:!0}));try{var t;yield ao(Bd.teams.changePassword,e),yield no(ai.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Fg(){yield ia(ai.loadProfile,Ug),yield ta(ai.saveProfile,Mg),yield ta(ai.changePassword,Ng)}function*$g(){yield no(ai.setProfileState({loading:!0})),yield gt(),yield no(ai.setUser(E({},ay,oy))),yield no(ai.setProfileState({loading:!1,profile:oy}))}function*Gg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=vi(e.payload,Dg);yield no(ai.setProfileState({saving:!0,error:null}));const o=ry;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=E({},o.profile,i,{profilePictureUrl:a}),s=ay;yield gt(),yield no(ai.setUser(E({},s,r))),yield no(ai.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*xg({payload:e}){var t;yield no(ai.setProfileState({loading:!0})),yield gt(),yield no(ai.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*Vg(){yield ia(ai.loadProfile,$g),yield ta(ai.saveProfile,Gg),yield ta(ai.changePassword,xg)}const Hg=["callback"],Wg=["callback"],jg=["callback"],Bg=["deviceId","callback"],Kg=["deviceId","callback"],qg=["callback"],zg=["deviceId"],Xg=["deviceId"],Jg=["callback"],Yg=["deviceId"],Qg=["callback"];function*Zg(e){const{step:t}=yield lo((e=>e.auth.mfaState));return{step:e.recoveryCode?en.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*eS(){yield no(ai.setMfaState({saving:!0}));try{const{qrCode:e}=yield ao(Bd.auth.enrollMfa);yield no(ai.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message}))}}function*tS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Hg);yield no(ai.setMfaState({saving:!0}));try{const e=yield lo((e=>e.auth.user)),i=yield ao(Bd.auth.verifyMfa,n),o=yield ao(Bd.auth.getMFADevices),a=yield Zg(i);yield no(ai.setMfaState(E({},a,{mfaDevices:o}))),yield no(ai.setUser(E({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Wg);yield no(ai.setMfaState({loading:!0}));try{const e=yield ao(Bd.auth.loginWithMfa,n),i={step:en.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield no(ai.setMfaState(i)),yield no(ai.setState({user:e})),yield no(ai.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*iS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t;yield ao(Bd.auth.disableMfa,e);const n=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*oS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t,n;const i=yield ao(Bd.auth.preEnrollMFAWebAuthn),o=E({},i.options,{challenge:vt(i.options.challenge),user:E({},i.options.user,{id:vt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield no(ai.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*aS(e){let{payload:{callback:t}}=e,n=vi(e.payload,jg);yield no(ai.setMfaState({saving:!0}));try{const e=mt(n.publicKey),i=yield ao(Bd.auth.enrollMFAWebAuthn,E({},n,{options:e})),o=yield ao(Bd.auth.getMFADevices),a=yield Zg(i);yield no(ai.setMfaState(E({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*rS(e){let{payload:{deviceId:t,callback:n}}=e;vi(e.payload,Bg),yield no(ai.setMfaState({saving:!0}));try{var i;const e=yield ao(Bd.auth.preDisableMFAWebAuthn,t),o=E({},e.options,{challenge:vt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>E({},e,{id:vt(e.id)})))});yield no(ai.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*sS(e){let{payload:{deviceId:t,callback:n}}=e,i=vi(e.payload,Kg);yield no(ai.setMfaState({saving:!0}));try{const e=mt(i.publicKey);yield ao(Bd.auth.disableMFAWebAuthn,t,E({},i,{options:e}));const o=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*lS({payload:e}){yield no(ai.setMfaState({saving:!0}));try{var t;const n=yield ao(Bd.auth.preEnrollMFASMS,e);yield no(ai.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 no(ai.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*cS(e){let{payload:{callback:t}}=e,n=vi(e.payload,qg);yield no(ai.setMfaState({saving:!0}));try{const e=yield ao(Bd.auth.enrollMFASMS,n),i=yield ao(Bd.auth.getMFADevices),o=yield Zg(e);yield no(ai.setMfaState(E({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield no(ai.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*uS(e){let{payload:{deviceId:t}}=e,n=vi(e.payload,zg);yield no(ai.setMfaState({saving:!0}));try{var i;const e=yield ao(Bd.auth.preDisableMFASMS,t);yield no(ai.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 no(ai.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*dS(e){let{payload:{deviceId:t}}=e,n=vi(e.payload,Xg);yield no(ai.setMfaState({saving:!0}));try{var i;yield ao(Bd.auth.disableMFASMS,t,n);const e=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield no(ai.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*yS(){yield no(ai.setMfaState({loading:!0}));try{yield lo((e=>e.auth.user));const e=yield ao(Bd.auth.getMFADevices);yield no(ai.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message}))}}function*fS(){yield no(ai.setMfaState({loading:!0}));try{const e=(yield ao(Bd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield no(ai.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield no(ai.setMfaState({loading:!1,error:e.message}))}}function*pS(){yield ta(ai.enrollMfa,eS),yield ta(ai.getMFADevices,yS),yield ta(ai.getMFAStrategies,fS),yield ta(ai.verifyMfa,tS),yield ta(ai.disableMfa,iS),yield ta(ai.verifyMfaAfterForce,nS),yield ta(ai.preDisableMfaSms,uS),yield ta(ai.disableMfaSms,dS),yield ta(ai.preEnrollMfaSms,lS),yield ta(ai.enrollMfaSms,cS),yield ta(ai.preEnrollMfaWebAuthn,oS),yield ta(ai.enrollMfaWebAuthn,aS),yield ta(ai.preDisableMfaWebAuthn,rS),yield ta(ai.disableMfaWebAuthn,sS)}function*gS(){yield no(ai.setMfaState({saving:!0})),yield no(ai.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*SS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:en.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield no(ai.setMfaState(i)),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*hS(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jg);yield no(ai.setMfaState({loading:!0})),yield gt();const i=E({},n,{recoveryCode:"recoveryCode"}),o={step:en.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield no(ai.setMfaState(o)),yield gt(),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*vS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({saving:!1,error:void 0,mfaDevices:E({},n,{authenticators:[]})})),yield no(ai.setUser(E({},ay))),null==(t=e.callback)||t.call(e,!0)}function*mS(e){let{}=e,t=vi(e.payload,Yg);yield no(ai.setMfaState({saving:!0}));try{var n;yield no(ai.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield no(ai.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*bS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({loading:!1,error:void 0,mfaDevices:E({},n,{phones:[]})})),yield no(ai.setUser(E({},ay))),null==(t=e.callback)||t.call(e,!0)}function*AS({payload:e}){var t;yield no(ai.setMfaState({saving:!0})),yield gt(),yield no(ai.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*kS(e){let{payload:{callback:t}}=e;vi(e.payload,Qg);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield lo((e=>e.auth.mfaState));yield no(ai.setMfaState({saving:!0})),yield gt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:en.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:E({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield no(ai.setMfaState(o)),yield no(ai.setUser(E({},ay,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*TS(){yield ta(ai.enrollMfa,gS),yield ta(ai.verifyMfa,SS),yield ta(ai.disableMfa,vS),yield ta(ai.verifyMfaAfterForce,hS),yield ta(ai.preDisableMfaSms,mS),yield ta(ai.disableMfaSms,bS),yield ta(ai.preEnrollMfaSms,AS),yield ta(ai.enrollMfaSms,kS)}const _S=["callback"];function*PS({payload:e}){yield no(ai.setForgotPasswordState({loading:!0}));try{var t;yield ao(Bd.auth.forgotPassword,e),yield no(ai.setForgotPasswordState({loading:!1,error:void 0,step:xt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*ES(e){let{payload:{callback:t}}=e,n=vi(e.payload,_S);yield no(ai.setForgotPasswordState({loading:!0}));try{yield ao(Bd.auth.resetPassword,n),yield no(ai.setForgotPasswordState({loading:!1,error:void 0,step:xt.success})),null==t||t(!0)}catch(e){yield no(ai.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*IS({payload:e}){yield no(ai.setForgotPasswordState({loading:!0}));try{const t=yield ao(Bd.auth.loadPasswordConfig,e);yield no(ai.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield no(ai.setForgotPasswordState({loading:!1,error:e.message}))}}function*LS(){yield ia(ai.forgotPassword,PS),yield ia(ai.resetPassword,ES),yield ia(ai.loadPasswordConfig,IS)}let OS;!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"}(OS||(OS={}));const wS=["callback","events"],RS=["callback"],CS=["callback"];function*DS({payload:{userId:e,token:t}}){yield no(ai.setActivateState({loading:!0,step:Ct.activating}));try{const{isAuthenticated:n}=yield lo((e=>e.auth));n&&(yield no(ai.silentLogout()));const i=yield ao(Bd.auth.getActivateAccountStrategy,{userId:e,token:t});yield no(ai.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield no(ai.setActivateState({loading:!1,step:Ct.activatingForm})))}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message}))}}function*US(e){let{payload:{callback:t,events:n}}=e,i=vi(e.payload,wS);yield no(ai.setActivateState({loading:!0}));try{const e=oa.onRedirectTo,{routes:a}=yield lo((e=>e.auth)),r=yield ao(Bd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(zf(r)){yield no(ai.setActivateState({step:Ct.success}));const t=yield Yf(r);yield no(ai.setState(t)),yield co(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield no(ai.setActivateState({step:Ct.success}));const{user:e,tenants:t}=yield ao(Bd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:wy.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield no(ai.setTenantsState({tenants:t,loading:!1})),yield no(ai.setState({user:e,isAuthenticated:!0})),yield co(1e3),yield Bf(),yield no(ai.resetActivateState())}null==t||t(!0)}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message}))}}function*MS({payload:e}){const{callback:t}=e,n=vi(e,RS);yield no(ai.setActivateStrategyState({loading:!0}));try{const e=yield ao(Bd.auth.getActivateAccountStrategy,n);yield no(ai.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield no(ai.setActivateStrategyState({loading:!1,error:e.message}))}}function*NS({payload:e}){const{callback:t}=e,n=vi(e,CS);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.email})),yield no(ai.setActivateState({loading:!0}));try{yield ao(Bd.auth.resendActivationEmail,n),yield no(ai.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield no(ai.setActivateState({loading:!1,error:e.message})),yield no(ai.setTeamError({key:OS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*FS(){yield ia(ai.activateAccount,US),yield ia(ai.preActivateAccount,DS),yield ia(ai.getActivateAccountStrategy,MS),yield ia(ai.resendActivationEmail,NS)}function*$S({payload:e}){if(e.token&&e.userId)try{yield no(ai.setAcceptInvitationState({error:void 0,step:Nt.pending})),yield ao(Bd.auth.acceptInvitation,e),yield no(ai.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:Nt.success}}))}catch(e){yield no(ai.setAcceptInvitationState({step:Nt.failed,error:e.message}))}else yield no(ai.setAcceptInvitationState({error:void 0,step:Nt.invalid}))}function*GS(){yield ia(ai.acceptInvitation,$S)}var xS,VS=new Uint8Array(16);function HS(){if(!xS&&!(xS="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 xS(VS)}for(var WS=/^(?:[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,jS=function(e){return"string"==typeof e&&WS.test(e)},BS=[],KS=0;KS<256;++KS)BS.push((KS+256).toString(16).substr(1));var qS=function(e,t,n){var i=(e=e||{}).random||(e.rng||HS)();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=(BS[e[t+0]]+BS[e[t+1]]+BS[e[t+2]]+BS[e[t+3]]+"-"+BS[e[t+4]]+BS[e[t+5]]+"-"+BS[e[t+6]]+BS[e[t+7]]+"-"+BS[e[t+8]]+BS[e[t+9]]+"-"+BS[e[t+10]]+BS[e[t+11]]+BS[e[t+12]]+BS[e[t+13]]+BS[e[t+14]]+BS[e[t+15]]).toLowerCase();if(!jS(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let zS,XS;!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"}(zS||(zS={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(XS||(XS={}));const JS=["callback"],YS=["roles"],QS=["callback"],ZS=["callback","profileImage"],eh=["callback"],th=["callback","userId"],nh=["callback"],ih=["callback"],oh=["callback"],ah=["callback"],rh=["callback"],sh=["callback"],lh=["callback"],ch=["callback","profileImage"],uh=["callback"],dh=["callback"],yh=["callback"],fh=["callback"],ph=["callback"],gh=["callback"],Sh=()=>lo((e=>e.auth.teamState));function*hh(){try{const{groups:e}=yield ao(Bd.groups.getGroups,{_groupsRelations:XS.roles});return e}catch(e){return[]}}function*vh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!a})),yield no(ai.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield io([ao(Bd.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions),ao(hh)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return E({},e,{groups:n})}));yield no(ai.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield no(ai.setTeamError({key:OS.USERS,value:e.message})),yield no(ai.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield no(ai.setTeamLoader({key:OS.USERS,value:!1}))}function*mh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!r})),yield no(ai.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield io([ao(Bd.subTenants.loadAllUsers,E({},c)),ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions)]);yield no(ai.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield no(ai.setTeamError({key:OS.USERS,value:e.message})),yield no(ai.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield no(ai.setTeamLoader({key:OS.USERS,value:!1}))}function*bh({payload:e}){yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield io([ao(Bd.teams.loadAvailableRoles),ao(Bd.teams.loadAvailablePermissions)]);yield no(ai.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 no(ai.setTeamError({key:OS.ROLES_AND_PERMISSIONS,value:t.message}))}yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0}))}function*Ah({payload:e}){const{callback:t}=e,n=vi(e,JS),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield ao(Bd.teams.addUser,n),{roles:a}=e,r=E({},vi(e,YS),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield no(ai.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*kh({payload:e}){const{callback:t}=e,n=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield no(ai.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield ao(Bd.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 no(ai.loadUsers(r)),yield no(ai.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*Th({payload:e}){const{callback:t}=e,n=vi(e,QS),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield ao(Bd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield no(ai.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*_h({payload:e}){const{callback:t}=e,n=vi(e,ZS),{id:i}=n,o=yield Sh(),a=o.users.find((e=>e.id===n.id));yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:i||""})),yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})})),yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?E({},e,n):e))}));try{var r;a.roleIds.length>0&&0===(null==(r=n.roleIds)?void 0:r.length)&&(n.roleIds=[""]);const{item:e}=yield ao(Bd.teams.updateUser,n);null==t||t(e),yield no(ai.setTeamState({users:o.users.map((t=>t.id===e.id?E({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1}))}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?E({},e,a):e))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Ph({payload:e}){const{callback:t}=e,n=vi(e,eh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ao(Bd.teams.deleteUser,n),null==t||t(!0),yield no(ai.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Eh({payload:e}){const{callback:t,userId:n}=e,i=vi(e,th),o=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return E({},e,{roles:(null==(t=i.subTenantsRoles.find((t=>t.tenantId===e.tenantId)))?void 0:t.roleIds.map((e=>o.roles.find((({id:t})=>e===t)))).filter((e=>e)))||e.roles})}))),yield no(ai.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[E({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield no(ai.setTeamState({addUserDialogState:E({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Ih({payload:e}){const{callback:t}=e,n=vi(e,nh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})}));try{yield ao(Bd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield no(ai.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Lh({payload:e}){const{callback:t}=e,n=vi(e,ih);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield ao(Bd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*Oh({payload:e}){const{callback:t}=e,n=vi(e,oh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*wh({payload:e}){const{callback:t}=e,n=vi(e,ah);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Rh({payload:e}){const{callback:t}=e,n=vi(e,rh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email}));try{yield ao(Bd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Ch(){yield no(ai.setTeamError({key:OS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield ao(Bd.teams.getInviteLinkConfiguration);yield no(ai.setTeamState({inviteTokenState:E({},e)}))}catch(e){yield no(ai.setTeamError({key:OS.CONFIG_TOKEN_LINK,value:e.message}))}}function*Dh(){yield no(ai.setTeamError({key:OS.GET_TOKEN_LINK,value:!1}));try{yield ao(Ch);const e=yield ao(Bd.teams.getInviteUserLink),{inviteTokenState:t}=yield Sh();yield no(ai.setTeamState({inviteTokenState:E({},t,e)}))}catch(e){yield no(ai.setTeamError({key:OS.GET_TOKEN_LINK,value:e.message}))}}function*Uh({payload:{callback:e}}){yield no(ai.setTeamError({key:OS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Sh();try{const n=yield ao(Bd.teams.createInviteUserLink,{expiresInMinutes:43200});yield no(ai.setTeamState({inviteTokenState:E({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield no(ai.setTeamError({key:OS.CREATE_TOKEN_LINK,value:t.message}))}}function*Mh({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Sh();yield no(ai.setTeamError({key:OS.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield ao(Bd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield no(ai.setTeamState({inviteTokenState:E({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield no(ai.setTeamError({key:OS.UPDATE_TOKEN_LINK,value:t.message}))}}function*Nh({payload:e}){const{callback:t}=null!=e?e:{};yield no(ai.setTeamError({key:OS.DELETE_TOKEN_LINK,value:!1}));try{yield ao(Bd.teams.deleteInviteUserLink),yield no(ai.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield no(ai.setTeamError({key:OS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Fh({payload:e}){yield no(ai.setTeamState({addUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*$h({payload:e}){const t=yield Sh(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield no(ai.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Gh({payload:e}){yield no(ai.setTeamState({deleteUserDialogState:E({open:!0,loading:!1,error:!1},e)}))}function*xh({payload:e}){const t=yield Sh(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield no(ai.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Vh(){yield na(ai.loadUsers,vh),yield na(ai.loadAllSubTenantsUsers,mh),yield na(ai.loadRoles,bh),yield ta(ai.addUser,Ah),yield ta(ai.addUsersBulk,kh),yield ta(ai.addUserToSubTenants,Th),yield ta(ai.updateUser,_h),yield ta(ai.setUserRolesForSubTenants,Eh),yield ta(ai.deleteUser,Ph),yield ta(ai.deleteUserFromSubTenants,Ih),yield ta(ai.resendActivationLink,Lh),yield ta(ai.resendInvitationLink,Oh),yield ta(ai.resendInvitationEmail,wh),yield ta(ai.resendInvitationLinkToAllSubTenants,Rh),yield ta(ai.getInvitationLink,Dh),yield ta(ai.createInvitationLink,Uh),yield ta(ai.updateInvitationLink,Mh),yield ta(ai.deleteInvitationLink,Nh),yield ta(ai.openAddUserDialog,Fh),yield ta(ai.closeAddUserDialog,$h),yield ta(ai.openDeleteUserDialog,Gh),yield ta(ai.closeDeleteUserDialog,xh)}function*Hh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!a})),yield no(ai.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield gt(),yield no(ai.setTeamState({users:by,totalPages:2,totalItems:10,roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.USERS,value:!1})),null==r||r(by)}function*Wh({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Sh(),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 no(ai.setTeamLoader({key:OS.USERS,value:!r})),yield no(ai.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield gt(),yield no(ai.setTeamState({allUsers:Ay,totalPages:2,totalItems:10,roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.USERS,value:!1})),null==s||s(Ay)}function*jh({payload:e}){var t;yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0})),yield gt(),yield no(ai.setTeamState({roles:py,permissions:Sy})),yield no(ai.setTeamLoader({key:OS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:py,permissions:Sy})}function*Bh({payload:e}){const{callback:t}=e,n=vi(e,sh),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield gt();const o=E({},vy,{groups:[]},n,{id:`${qS()}`});null==t||t(o),yield no(ai.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*Kh({payload:e}){const{callback:t}=e,n=vi(e,lh),i=yield Sh();yield no(ai.setTeamState({addUserDialogState:E({},i.addUserDialogState,{loading:!0})})),yield gt();const o=E({},vy,n,{id:`${qS()}`});yield no(ai.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*qh({payload:e}){var t;const{callback:n}=e,i=vi(e,ch),{id:o}=i,a=yield Sh(),r=a.users.find((e=>e.id===i.id));yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:o||""})),yield no(ai.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0})})),yield no(ai.setTeamState({addUserDialogState:E({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?E({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield gt();const s=E({},r,i);null==n||n(s),yield no(ai.setTeamState({users:a.users.map((e=>e.id===s.id?E({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield no(ai.setTeamLoader({key:OS.UPDATE_USER,value:!1}))}function*zh({payload:e}){const{callback:t}=e,n=vi(e,uh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield no(ai.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Xh({payload:e}){const{callback:t}=e,n=vi(e,dh),i=yield Sh();yield no(ai.setTeamState({deleteUserDialogState:E({},i.deleteUserDialogState,{loading:!0})})),yield gt(),null==t||t(!0),yield no(ai.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*Jh({payload:e}){const{callback:t}=e,n=vi(e,yh);yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:n.userId})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_ACTIVATE_LINK,value:!1}))}function*Yh({payload:e}){const{callback:t}=e,n=vi(e,fh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Qh({payload:e}){const{callback:t}=e,n=vi(e,ph);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*Zh({payload:e}){const{callback:t}=e,n=vi(e,gh);yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:n.email})),yield gt(),null==t||t(!0),yield no(ai.setTeamLoader({key:OS.RESEND_INVITATION_LINK,value:!1}))}function*ev(){yield na(ai.loadUsers,Hh),yield na(ai.loadAllSubTenantsUsers,Wh),yield na(ai.loadRoles,jh),yield ta(ai.addUser,Bh),yield ta(ai.addUserToSubTenants,Kh),yield ta(ai.updateUser,qh),yield ta(ai.deleteUser,zh),yield ta(ai.deleteUserFromSubTenants,Xh),yield ta(ai.resendActivationLink,Jh),yield ta(ai.resendInvitationLink,Yh),yield ta(ai.resendInvitationEmail,Qh),yield ta(ai.resendInvitationLinkToAllSubTenants,Zh),yield ta(ai.openAddUserDialog,Fh),yield ta(ai.closeAddUserDialog,$h),yield ta(ai.openDeleteUserDialog,Gh),yield ta(ai.closeDeleteUserDialog,xh)}const tv=["authorizationUrl"],nv=["events","url"];function*iv(){try{yield no(ai.setSocialLoginsState({loading:!0}));const e=yield ao(Bd.auth.getSocialLoginProviders);yield no(ai.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*ov(){try{const e=yield lo((e=>e.root.context));yield no(ai.setSocialLoginsState({loading:!0}));const t=yield ao(Bd.auth.getSocialLoginProvidersV2),{providers:n}=yield ao(Bd.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=vi(t,tv);const o=sa(e,null!=n?n:"");return E({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield no(ai.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield no(ai.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*av(e){let{payload:{events:t,url:n}}=e,i=vi(e.payload,nv);try{yield no(ai.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield ao(Bd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:Ry.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:wy.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield no(ai.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield lo((e=>e.auth));e?yield ao(tp):yield ao(ip)}(),localStorage.removeItem("register-quick-login"),yield no(ai.setSocialLoginsState({loading:!1}))}catch(e){var r;yield no(ai.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*rv({payload:e}){yield no(ai.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*sv(){yield ia(ai.loadSocialLoginsConfiguration,iv),yield ia(ai.loadSocialLoginsConfigurationV2,ov),yield ia(ai.loginViaSocialLogin,av),yield na(ai.setSocialLoginError,rv)}let lv;function*cv({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield lo((e=>e.auth.apiTokensState));try{let e,a;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield ao(Bd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield ao(Bd.auth.updateUserApiTokensData,{description:t}),yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield no(ai.setApiTokensError({key:lv.ADD_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*uv({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield lo((e=>e.auth.apiTokensState));try{let e,r;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield ao(Bd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield ao(Bd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield no(ai.setApiTokensError({key:lv.ADD_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*dv({payload:e}){const{apiTokensDataUser:t}=yield lo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),n?(yield ao(Bd.auth.deleteUserAccessToken,{id:e}),yield no(ai.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield ao(Bd.auth.deleteUserApiToken,{tokenId:e}),yield no(ai.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}catch(e){yield no(ai.setApiTokensError({key:lv.DELETE_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}}function*yv({payload:e}){const{apiTokensDataTenant:t}=yield lo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),n?(yield ao(Bd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield ao(Bd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield no(ai.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}catch(e){yield no(ai.setApiTokensError({key:lv.DELETE_API_TOKEN,value:e.message})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}}function*fv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield io([ao(Bd.auth.getUserApiTokensData),ao(Bd.auth.getTenantApiTokensData)]);yield no(ai.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*pv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ao(Bd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=ao(Bd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield no(ai.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*gv({payload:e}){null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=ao(Bd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=ao(Bd.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield no(ai.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield no(ai.setApiTokensError({key:lv.LOAD_API_TOKENS,value:t.message})),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Sv(){yield ia(ai.loadApiTokens,fv),yield ia(ai.loadUserApiTokens,pv),yield ia(ai.loadTenantApiTokens,gv),yield ta(ai.addUserApiToken,cv),yield ta(ai.addTenantApiToken,uv),yield na(ai.deleteTenantApiToken,yv),yield na(ai.deleteUserApiToken,dv)}function*hv({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield lo((e=>e.auth.apiTokensState)),a=E({},ny,{description:t,roleIds:n,clientId:`CLIENT_ID_${qS()}`});yield no(ai.setApiTokensState({showAddTokenDialog:!1})),yield co(200),yield no(ai.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*vv({payload:e}){yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!0})),yield co(200);const t=[ny];yield no(ai.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield no(ai.setApiTokensLoader({key:lv.DELETE_API_TOKEN,value:!1}))}function*mv({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ty],i=[ny];yield no(ai.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*bv({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ty];yield no(ai.setApiTokensState({apiTokensDataUser:n})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Av({payload:e}){var t;null!=e&&e.silentLoading||(yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!0})));const n=[ny];yield no(ai.setApiTokensState({apiTokensDataTenant:n})),yield co(200),yield no(ai.setApiTokensLoader({key:lv.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*kv(){yield ia(ai.loadApiTokens,mv),yield ia(ai.loadUserApiTokens,bv),yield ia(ai.loadTenantApiTokens,Av),yield ta(ai.addTenantApiToken,hv),yield na(ai.deleteTenantApiToken,vv)}function*Tv({payload:e}){try{var t;yield no(ai.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield lo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield ao(Bd.accountSettings.updateSettings,E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield no(ai.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield no(ai.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*_v({payload:e}){yield no(ai.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield ao(Bd.accountSettings.getSettings);yield no(ai.setAccountSettingsState(E({},e,{loading:!1})))}catch(e){yield no(ai.setAccountSettingsState({loading:!1,error:e.message}))}}function*Pv(){yield ia(ai.saveAccountSettings,Tv),yield ia(ai.loadAccountSettings,_v)}function*Ev({payload:e}){var t;yield no(ai.setAccountSettingsState({loading:!0})),yield gt();const{accountSettingsState:n}=yield lo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=E({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield no(ai.setAccountSettingsState(E({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Iv({payload:e}){yield no(ai.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield gt(),yield no(ai.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*Lv(){yield ia(ai.saveAccountSettings,Ev),yield ia(ai.loadAccountSettings,Iv)}function*Ov({payload:{tenantId:e,callback:t}}){yield no(ai.setState({isLoading:!0}));try{yield ao(Bd.tenants.switchTenant,{tenantId:e}),yield ao(Zf),(null==t?void 0:t(!0))||(yield no(ai.setState({isLoading:!1})))}catch(e){yield no(ai.setState({isLoading:!1})),null==t||t(!1,e)}}function*wv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getTenants);yield no(ai.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield no(ai.setTenantsState({loading:!1}))}}function*Rv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getSubTenants);yield no(ai.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Cv({payload:e}){yield no(ai.setTenantsState({loading:!0}));try{var t;const n=yield ao(Bd.tenants.getSubTenantsAsTree);yield no(ai.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield no(ai.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Dv(){yield ta(ai.loadTenants,wv),yield ta(ai.loadSubTenants,Rv),yield ta(ai.switchTenant,Ov),yield ta(ai.loadSubTenantsTree,Cv)}function*Uv(){yield no(ai.setTenantsState({loading:!0})),yield gt(),yield no(ai.setTenantsState({tenants:ky,loading:!1}))}function*Mv(){yield ta(ai.loadTenants,Uv)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(lv||(lv={}));const Nv=["callback"],Fv=["callback"],$v=["callback"],Gv=["callback"],xv=["callback"];function*Vv({payload:e}){var t;yield no(ai.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield io([ao(Bd.roles.getRoles),ao(Bd.roles.getPermissions),ao(Bd.roles.getPermissionCategories)]),[t,n,i]=e;yield no(ai.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield no(ai.setRolesState({error:e.message,loading:!1}))}}function*Hv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Nv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.addRole,n),i=yield ao(Bd.roles.getRoles);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Wv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Fv);yield no(ai.setRolesState({saving:!0}));try{yield ao(Bd.roles.deleteRole,n),yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*jv(e){let{payload:{callback:t}}=e,n=vi(e.payload,$v);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.updateRole,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Bv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Gv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.attachPermissionsToRole,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*Kv(e){let{payload:{callback:t}}=e,n=vi(e.payload,xv);yield no(ai.setRolesState({saving:!0}));try{const e=yield ao(Bd.roles.attachPermissionToRoles,n);yield no(ai.loadRolesAndPermissions({silentLoading:!0})),yield no(ai.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield no(ai.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*qv(){yield ia(ai.loadRolesAndPermissions,Vv),yield ta(ai.addRole,Hv),yield ta(ai.deleteRole,Wv),yield ta(ai.updateRole,jv),yield ta(ai.attachPermissionsToRole,Bv),yield ta(ai.attachPermissionToRoles,Kv)}function*zv({payload:e}){var t;yield no(ai.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield no(ai.setRolesState({roles:iy,loading:!1}))}catch(e){yield no(ai.setRolesState({error:e.message,loading:!1}))}}function*Xv(){yield ia(ai.loadRolesAndPermissions,zv)}const Jv=["callback"],Yv=["callback"],Qv=["callback"];function*Zv(e){let{payload:{callback:t}}=e,n=vi(e.payload,Jv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const e=yield ao(Bd.auth.resetPhoneNumber,n);yield no(ai.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:jt.VerifyResetPhoneNumber})),yield no(ai.setLoginState({email:n.email}))}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*em(e){let{payload:{callback:t}}=e,n=vi(e.payload,Yv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const e=yield ao(Bd.auth.verifyResetPhoneNumber,n);yield no(ai.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:jt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*tm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Qv);yield no(ai.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield lo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield ao(Bd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield no(ai.setLoginState({step:bt.loginWithSmsOtc})),yield no(ai.passwordlessPreLogin({type:_r.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield no(ai.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*nm(){yield ia(ai.resetPhoneNumber,Zv),yield ia(ai.verifyResetPhoneNumber,em),yield ia(ai.changePhoneNumber,tm)}function*im(){yield no(ai.setSessionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCurrentUserSessions);yield no(ai.setSessionsState({sessions:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*om(){yield no(ai.setSessionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getCurrentUserSession);yield no(ai.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*am({payload:{id:e}}){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.deleteSessionForUser,e),yield no(ai.loadUserSessions())}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*rm({payload:{callback:e,userId:t}}){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield no(ai.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*sm(){yield no(ai.setSessionsState({loading:!0,error:null}));try{yield ao(Bd.auth.deleteAllSessionsForUser),yield no(ai.loadUserSessions())}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*lm(){yield na(ai.loadUserSessions,im),yield na(ai.deleteUserSession,am),yield na(ai.deleteAllUserSessions,sm),yield na(ai.loadCurrentUserSession,om),yield ta(ai.revokeUserSessions,rm)}function*cm(){yield no(ai.setSessionsState({loading:!0,error:null})),yield no(ai.setSessionsState({sessions:Ty,loading:!1}))}function*um({payload:{id:e}}){yield no(ai.setSessionsState({loading:!0,error:null}));const t=(yield lo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield no(ai.setSessionsState({sessions:t,loading:!1}))}function*dm(){yield no(ai.setSessionsState({loading:!0,error:null}));const e=Ty.filter((e=>e.current));yield no(ai.setSessionsState({sessions:e,loading:!1}))}function*ym(){yield na(ai.loadUserSessions,cm),yield na(ai.deleteUserSession,um),yield na(ai.deleteAllUserSessions,dm)}const fm=["callback"],pm=["callback"];function*gm(){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getSessionConfigurations);yield no(ai.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield no(ai.setSessionsState({error:e,loading:!1}))}}function*Sm({payload:e}){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=vi(e,fm);yield ao(Bd.auth.createOrUpdateSessionConfigrations,n),yield no(ai.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield no(ai.setSessionsPolicyState({error:e,loading:!1}))}}function*hm(){yield ia(ai.loadSessionsPolicy,gm),yield na(ai.createOrUpdateSessionsPolicy,Sm)}function*vm(){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));const e=yield lo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:_y}));yield no(ai.setSessionsPolicyState(E({},e,{loading:!1})))}function*mm({payload:e}){yield no(ai.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=vi(e,pm);null==t||t(!0),yield no(ai.setSessionsPolicyState({configurations:n,loading:!1}))}function*bm(){yield ia(ai.loadSessionsPolicy,vm),yield na(ai.createOrUpdateSessionsPolicy,mm)}const Am=["callback"],km=["callback"],Tm=["callback"],_m=["callback"],Pm=["callback"],Em=["callback"],Im=["callback"],Lm=["callback"],Om=()=>lo((e=>e.auth.restrictionsState.ipRestrictions)),wm=()=>lo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Rm(){yield no(ai.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield ao(Bd.auth.getDomainRestrictionsConfig),t=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield no(ai.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield no(ai.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*Cm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Am);yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield wm();try{var o;yield ao(Bd.auth.createDomainRestriction,n);const e=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield no(ai.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 no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Dm(e){let{payload:{callback:t}}=e,n=vi(e.payload,km);yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield ao(Bd.auth.updateDomainRestrictionConfig,n),i=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield no(ai.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Um({payload:{id:e}}){yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield wm();try{var n;yield ao(Bd.auth.deleteDomainRestriction,e);const i=(yield ao(Bd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield no(ai.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:Nn.ALLOW},restrictions:i},saving:!1}))}catch(e){yield no(ai.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Mm=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:Nn.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Nm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Om(),t=yield ao(Bd.auth.getIPRestrictionsConfig),n=Mm({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield ao(Bd.auth.getIPRestrictions,n);yield no(ai.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Fm(){try{const{valid:e}=yield ao(Bd.auth.testCurrentIpInAllowList);yield no(ai.setIpRestrictionsState({userIpValid:e}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message}))}}function*$m({payload:{callback:e}}){yield no(ai.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield lo((e=>e.auth.userIp));yield io([ao(Bd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:Nn.ALLOW}),ao(Bd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Om(),i=Mm(n.pagination),{items:o,_metadata:{totalPages:a}}=yield ao(Bd.auth.getIPRestrictions,i);yield no(ai.setIpRestrictionsState({data:{config:{isActive:!0,strategy:Nn.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield no(ai.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Gm(e){let{payload:{callback:t}}=e,n=vi(e.payload,Tm);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const i=yield Om();try{var o,a;yield ao(Bd.auth.createIPRestriction,n);const e=yield Om(),r=Mm(e.pagination),{items:s,_metadata:{totalPages:l}}=yield ao(Bd.auth.getIPRestrictions,r);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:Nn.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*xm(e){let{payload:{callback:t}}=e,n=vi(e.payload,_m);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));try{yield ao(Bd.auth.updateIPRestrictionConfig,n);const e=yield Om(),i=yield ao(Bd.auth.getIPRestrictionsConfig),o=Mm(E({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield ao(Bd.auth.getIPRestrictions,o);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Vm({payload:{id:e,callback:t}}){yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const n=yield Om();try{var i;yield ao(Bd.auth.deleteIPRestriction,e);const o=yield Om(),a=Mm(o.pagination),{items:r,_metadata:{totalPages:s}}=yield ao(Bd.auth.getIPRestrictions,a);yield Fm(),yield no(ai.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:Nn.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield no(ai.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hm(){yield ia(ai.loadIpRestrictions,Nm),yield ia(ai.loadEmailDomainRestrictions,Rm),yield ta(ai.saveIpRestriction,Gm),yield ta(ai.saveIpRestrictionsConfig,xm),yield ta(ai.deleteIpRestriction,Vm),yield ta(ai.checkIfUserIpValid,Fm),yield ta(ai.addCurrentUserIpAndActivate,$m),yield ta(ai.saveEmailDomainRestriction,Cm),yield ta(ai.saveEmailDomainRestrictionsConfig,Dm),yield ta(ai.deleteEmailDomainRestriction,Um)}function*Wm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null})),yield no(ai.setIpRestrictionsState({data:{restrictions:Ey.filter((e=>e.strategy===Py.strategy)),config:Py},totalPages:1,pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},loading:!1}))}function*jm(){yield no(ai.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Om(),t=Ey[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield no(ai.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield no(ai.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Bm(e){var t,n,i;let{payload:{callback:o}}=e,a=vi(e.payload,Pm);yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const r=yield Om(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield no(ai.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:Nn.ALLOW},restrictions:[...s,E({},a,{createdAt:new Date,updatedAt:new Date,id:qS(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*Km(e){var t,n,i;let{payload:{callback:o}}=e,a=vi(e.payload,Em);const r=yield Om();yield no(ai.setIpRestrictionsState({saving:!0,error:null})),yield no(ai.setIpRestrictionsState({data:{config:E({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield no(ai.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*qm({payload:{id:e,callback:t}}){var n;yield no(ai.setIpRestrictionsState({saving:!0,error:null}));const i=yield Om();yield no(ai.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:Nn.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:Nn.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*zm(){yield no(ai.setEmailDomainRestrictionsState({loading:!0,error:null})),yield no(ai.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:Nn.ALLOW}],config:{active:!0,listType:Nn.ALLOW,blockPublicDomains:!1}}}))}function*Xm(e){var t,n;let{payload:{callback:i}}=e,o=vi(e.payload,Im);const a=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==i||i(!0),yield no(ai.setEmailDomainRestrictionsState({data:{config:(null==(t=a.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:o.type},restrictions:[...(null==(n=a.data)?void 0:n.restrictions)||[],E({},o,{id:Date.now().toString()})]},saving:!1}))}function*Jm(e){var t;let{payload:{callback:n}}=e,i=vi(e.payload,Lm);const o=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),null==n||n(!0),yield no(ai.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||Nn.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*Ym({payload:{id:e}}){var t,n;const i=yield wm();yield no(ai.setEmailDomainRestrictionsState({saving:!0,error:null})),yield gt(),yield no(ai.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:Nn.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*Qm(){yield ia(ai.loadIpRestrictions,Wm),yield ia(ai.loadEmailDomainRestrictions,zm),yield ta(ai.saveIpRestriction,Bm),yield ta(ai.saveIpRestrictionsConfig,Km),yield ta(ai.deleteIpRestriction,qm),yield ta(ai.checkIfUserIpValid,jm),yield ta(ai.saveEmailDomainRestriction,Xm),yield ta(ai.saveEmailDomainRestrictionsConfig,Jm),yield ta(ai.deleteEmailDomainRestriction,Ym)}const Zm=["callback"],eb=["id"];function*tb(e){const{count:t}=yield ao(Bd.directory.countConfigurationUsers,e.id);return E({},e,{count:t})}function*nb(){yield no(ai.setProvisioningState({loading:!0,error:null}));try{const e=yield ao(Bd.directory.getConfigs),t=yield io(e.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:t,loading:!1}))}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ib(e){let{payload:{callback:t}}=e,n=vi(e.payload,Zm);yield no(ai.setProvisioningState({loading:!0,error:null}));try{const e=yield ao(Bd.directory.createConfiguration,n),i=yield ao(Bd.directory.getConfigs),o=yield io(i.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ob(e){let{payload:{id:t}}=e,n=vi(e.payload,eb);yield no(ai.setProvisioningState({loading:!0,error:null}));try{yield ao(Bd.directory.updateConfiguration,t,n);const e=yield ao(Bd.directory.getConfigs),i=yield io(e.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:i,loading:!1}))}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1}))}}function*ab({payload:{id:e,callback:t}}){yield no(ai.setProvisioningState({loading:!0,error:null}));try{yield ao(Bd.directory.deleteConfiguration,e);const n=yield ao(Bd.directory.getConfigs),i=yield io(n.map((e=>tb(e))));yield no(ai.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*rb(){yield ia(ai.loadProvisionConnections,nb),yield ta(ai.createProvisionConnection,ib),yield ta(ai.deleteProvisionConnection,ab),yield ta(ai.updateProvisionConnection,ob)}const sb=["callback","events"];function*lb(e){let{payload:{callback:t}}=e,n=vi(e.payload,sb);yield no(ai.setImpersonateState({loading:!0}));try{yield ao(Bd.impersonate.impersonate,n),yield no(ai.setImpersonateState({step:Zn.success})),yield co(1e3),yield Bf(),yield no(ai.resetImpersonateState()),null==t||t(!0)}catch(e){yield no(ai.setImpersonateState({loading:!1,error:e.message}))}}function*cb(){yield ia(ai.impersonate,lb)}function*ub({payload:e}){const{callback:t,deviceId:n}=e;yield no(ai.setPasskeysState({loading:!0}));try{yield ao(Bd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield lo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield no(ai.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield no(ai.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*db(){yield no(ai.setPasskeysState({loading:!0}));try{const{devices:e}=yield ao(Bd.auth.getWebAuthnDevices);yield no(ai.setPasskeysState({devices:e,loading:!1}))}catch(e){yield no(ai.setPasskeysState({loading:!1,error:e.message||null}))}}function*yb(){yield ta(ai.loadWebAuthnDevices,db),yield ta(ai.deleteWebAuthnDevice,ub)}const fb=["roleIds","userIds"],pb=()=>lo((e=>e.auth.groupsState));function*gb({payload:e}){const t=zS.GET_TEAM_USERS;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield ao(Bd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield no(ai.setGroupsState({teamUsers:n}))}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Sb({payload:e}){const t=zS.GET_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield ao(Bd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:XS.rolesAndUsers});yield no(ai.setGroupsState({selectedGroup:n}))}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*hb(){const e=zS.GET_GROUPS,t=yield pb();yield no(ai.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield ao(Bd.groups.getGroups,{_groupsRelations:XS.rolesAndUsers});yield no(ai.setGroupsState(E({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield no(ai.setUsersGroupsError({key:e,value:t.message}))}finally{yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}}function*vb({payload:e}){const t=zS.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=vi(e,fb);yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield ao(Bd.groups.createGroup,E({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield no(ai.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield no(ai.addRolesToGroup({groupId:r.id,roleIds:n}))),yield no(ai.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*mb({payload:e}){const t=zS.UPDATE_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.updateGroup,e),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*bb({payload:e}){const t=zS.DELETE_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteGroup,e.groupId),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Ab({payload:e}){const t=zS.ADD_ROLES_TO_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*kb({payload:e}){const t=zS.DELETE_ROLES_FROM_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Tb({payload:e}){const t=zS.ADD_USERS_TO_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield no(ai.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 no(ai.setUsersGroupsError({key:t,value:n.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*_b({payload:e}){const t=zS.DELETE_USERS_FROM_GROUP;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield ao(Bd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield no(ai.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield no(ai.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Pb(){const e=zS.GET_GROUP_CONFIGURATION;yield no(ai.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield ao(Bd.groups.getGroupConfiguration);yield no(ai.setGroupsState({groupsConfiguration:t}))}catch(t){yield no(ai.setUsersGroupsError({key:e,value:t.message}))}finally{yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}}function*Eb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION;yield no(ai.setUsersGroupsLoader({key:t,value:!0}));try{yield ao(Bd.groups.updateGroupConfiguration,e),yield no(ai.getGroupConfiguration())}catch(e){yield no(ai.setUsersGroupsError({key:t,value:e.message}))}finally{yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}}function*Ib(){yield na(ai.loadGroups,hb),yield na(ai.getGroupById,Sb),yield na(ai.createGroup,vb),yield na(ai.updateGroup,mb),yield na(ai.deleteGroup,bb),yield na(ai.addRolesToGroup,Ab),yield na(ai.deleteRolesFromGroup,kb),yield na(ai.addUsersToGroup,Tb),yield na(ai.deleteUsersFromGroup,_b),yield na(ai.getGroupConfiguration,Pb),yield na(ai.updateGroupConfiguration,Eb),yield na(ai.getTeamUsers,gb)}function*Lb(){const e=zS.GET_GROUPS;yield no(ai.setUsersGroupsLoader({key:e,value:!0}));const t=Oy;yield no(ai.setGroupsState({groups:t})),yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}function*Ob({payload:e}){var t;const n=zS.CREATE_GROUP,{groups:i}=yield pb();yield no(ai.setUsersGroupsLoader({key:n,value:!0})),yield no(ai.setGroupsState({groups:[E({},e,{id:`${e.name}ID`,managedBy:jd.FRONTEGG}),...null!=i?i:[]]})),yield co(500),null==e||null==(t=e.callback)||t.call(e,!0),yield no(ai.setUsersGroupsLoader({key:n,value:!1}))}function*wb({payload:e}){var t,n,i,o,a;const r=zS.UPDATE_GROUP,s=yield pb();yield no(ai.setUsersGroupsLoader({key:r,value:!0})),yield no(ai.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:jd.FRONTEGG}):t})),selectedGroup:E({},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 co(500),null==e||null==(a=e.callback)||a.call(e,!0),yield no(ai.setUsersGroupsLoader({key:r,value:!1}))}function*Rb({payload:e}){var t,n;const i=zS.DELETE_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Cb({payload:e}){var t,n;const i=zS.ADD_ROLES_TO_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Db({payload:e}){var t,n;const i=zS.DELETE_ROLES_FROM_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Ub({payload:e}){var t,n;const i=zS.ADD_USERS_TO_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Mb({payload:e}){var t,n;const i=zS.DELETE_USERS_FROM_GROUP,o=yield pb();yield no(ai.setUsersGroupsLoader({key:i,value:!0})),yield no(ai.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?E({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield co(500),null==e||null==(n=e.callback)||n.call(e,!0),yield no(ai.setUsersGroupsLoader({key:i,value:!1}))}function*Nb(){const e=zS.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield pb();yield no(ai.setUsersGroupsLoader({key:e,value:!0})),t&&(yield no(ai.setGroupsState({groupsConfiguration:E({},t)}))),yield no(ai.setUsersGroupsLoader({key:e,value:!1}))}function*Fb({payload:e}){const t=zS.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield pb();yield no(ai.setUsersGroupsLoader({key:t,value:!0})),n&&(yield no(ai.setGroupsState({groupsConfiguration:E({},n,e)}))),yield no(ai.setUsersGroupsLoader({key:t,value:!1}))}function*$b(){yield na(ai.loadGroups,Lb),yield na(ai.createGroup,Ob),yield na(ai.updateGroup,wb),yield na(ai.deleteGroup,Rb),yield na(ai.addRolesToGroup,Cb),yield na(ai.deleteRolesFromGroup,Db),yield na(ai.addUsersToGroup,Ub),yield na(ai.deleteUsersFromGroup,Mb),yield na(ai.getGroupConfiguration,Nb),yield na(ai.updateGroupConfiguration,Fb)}var Gb={sagas:function*(){yield io([ao(Vp),ao(FS),ao(GS),ao(LS),ao(nm),ao(ig),ao(Rg),ao(Fg),ao(pS),ao(Vh),ao(Ib),ao(sv),ao(Fy),ao(Sv),ao(yf),ao(Pv),ao(Dv),ao(qv),ao(lm),ao(hm),ao(Hm),ao(rb),ao(cb),ao(yb)])},mockSagas:function*(){yield io([ao(jp),ao(ug),ao(Vg),ao(TS),ao(ev),ao(kv),ao(Pf),ao(ym),ao(Lv),ao(Mv),ao(bm),ao(Qm),ao(Xv),ao($b)])},storeName:Pt,initialState:Qn,reducer:ii,actions:ai};const xb=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>E({},t,{[e]:E({},t[e],n)})}),Vb={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},Hb={setAuditLogsState:xb("auditLogsState"),resetAuditLogsState:e=>E({},e,{auditLogsState:Vb})},Wb={exportAuditsCsv:ot("auditLogs/exportAuditsCsv"),loadAuditLogs:ot("auditLogs/loadAuditLogs",(e=>({payload:e})))},jb={loading:!0},Bb={setAuditsMetadataState:xb("auditsMetadataState"),resetAuditsMetadataState:e=>E({},e,{auditsMetadataState:jb})},Kb={loadAuditsMetadata:ot("auditLogs/loadAuditsMetadata")},qb={auditLogsState:Vb,auditsMetadataState:jb},{reducer:zb,actions:Xb}=rt({name:It,initialState:qb,reducers:E({resetState:e=>E({},e,qb),setState:(e,{payload:t})=>E({},e,t)},Hb,Bb)}),Jb=E({},Xb,Wb,Kb),Yb=e=>"createdAt"!==e.id,Qb={total:20,data:Array.from(Array(5).keys()).map((e=>E({ip:"198.143.51.1",user:"Demo User Name",email:"demo-user@frontegg.com"},(()=>{switch(Math.floor(6*Math.random())){case 0:return{action:"Updated profile",description:"User updated profile details",severity:"Info"};case 1:return{action:"User logged in",severity:"Info",description:"User logged in to the product"};case 2:return{action:"User failed to login",severity:"High",description:"User failed to login with password"};case 3:return{action:"Added user",severity:"Info",description:"Added user david+535@frontegg.com to tenant"};case 4:return{action:"Assigned roles",severity:"Info",description:"Assigned 0 roles for user"};case 5:return{action:"Removed user david+108@frontegg.com from account",severity:"Info",description:"Removed access from the account for user david+108@frontegg.com"}}})(),{json:{key1:"value1",key2:"value2",key3:"value3",key4:"value4"},tenantId:"my-tenant-id",vendorId:"my-vendor-id",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",createdAt:`2022-04-07 10:${50-e}:40.201`})))},Zb={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}]},eA=()=>lo((e=>e.auditLogs.auditLogsState)),tA=()=>lo((e=>e.auditLogs.auditsMetadataState));function*nA(){const e=yield eA(),{columns:t}=yield tA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});yield no(Jb.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield Bd.audits.exportAudits(E({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield no(Jb.setAuditLogsState({isDownloadingCsv:!1}))}function*iA({payload:e}){yield no(Jb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eA(),{columns:n}=yield tA();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 no(Jb.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>E({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>E({},e,{[t.id]:t.value})),{});n||(yield no(Jb.loadAuditsMetadata()));const{data:p,total:g}=yield ao(Bd.audits.getAudits,E({offset:c,count:l},y,f));yield no(Jb.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 no(Jb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*oA(){yield ta(Jb.exportAuditsCsv,nA),yield ta(Jb.loadAuditLogs,iA)}function*aA({payload:e}){yield no(Jb.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield eA(),{columns:n}=yield tA();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 no(Jb.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield no(Jb.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=Qb;let i=n.filter((e=>t=>e.filter(Yb).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 no(Jb.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 no(Jb.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*rA(){yield ta(Jb.loadAuditLogs,aA)}function*sA(){yield no(Jb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield ao(Bd.metadata.getAuditsMetadata);yield no(Jb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield no(Jb.setAuditsMetadataState({error:e,loading:!1}))}}function*lA(){yield ta(Jb.loadAuditsMetadata,sA)}function*cA(){yield no(Jb.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=Zb;yield no(Jb.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield no(Jb.setAuditsMetadataState({error:e,loading:!1}))}}function*uA(){yield ta(Jb.loadAuditsMetadata,cA)}var dA={sagas:function*(){yield io([ao(oA),ao(lA)])},mockSagas:function*(){yield io([ao(rA),ao(uA)])},storeName:It,initialState:qb,reducer:zb,actions:Jb};const yA={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:fA,actions:pA,reducer:gA}=rt({name:"audits",initialState:yA,reducers:{setContext:(e,{payload:t})=>{e.context=t},startLoading:e=>{e.isLoading=!0},setVirtualScroll:(e,{payload:t})=>{e.virtualScroll=t},startRefresh:e=>{e.isLoading=!0},startFetching:e=>{e.isFetchMore=!0},finishLoading:e=>{e.isLoading=!1},startDownloadingCsv:e=>{e.isDownloadingCsv=!0},stopDownloadingCsv:e=>{e.isDownloadingCsv=!1},loadStatsSuccess:(e,{payload:t})=>{e.error=void 0,e.totalToday=t.totalToday,e.severeThisWeek=t.severeThisWeek},loadItemFailedAction:(e,{payload:t})=>{e.error=E({},e.error,{[t.name]:t.error})},loadMetadataSuccess:(e,{payload:t})=>{e.error={},e.headerProps=t.properties,e.themeAudits=t.theme?t.theme.styles:{}},loadAuditsSuccess:(e,{payload:t})=>{e.error={},e.rowsData=t.rowsData,e.lastUpdated=new Date,e.total=t.total},fetchMoreSuccess:(e,{payload:t})=>{e.error={},e.offset=t.offset,e.currentPage=t.currentPage,e.isFetchMore=!1},setFilterData:(e,{payload:t})=>{e.filters=t,e.currentPage=0,e.offset=0,e.isLoading=!0},textSearch:(e,{payload:t})=>{e.filter=t,e.currentPage=0,e.offset=0,e.isLoading=!0},onPageChange:(e,{payload:t})=>{e.currentPage=t-1,e.offset=20*e.currentPage,e.isLoading=!0},setDataSorting:(e,{payload:t})=>{e.sortBy=t.sortBy,e.currentPage=0,e.sortDirection="asc"===t.sortDirection?"desc":"asc",e.offset=0,e.isLoading=!0},setPredefinedFilters:(e,{payload:t})=>{e.predefinedFilters=t,e.filters=Object.keys(t).map((e=>({key:e,value:t[e]})))}}}),SA=E({},pA,{initData:ot(`${fA}/initData`),loadAudits:ot(`${fA}/loadAudits`),removeFilter:ot(`${fA}/removeFilter`),filterData:ot(`${fA}/filterData`),exportCSV:ot(`${fA}/exportCSV`),deleteAudits:ot(`${fA}/deleteAudits`)}),hA=()=>lo((e=>e[fA]));function*vA(){const{sortBy:e,sortDirection:t}=yield hA();try{const n=yield ao(Bd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield no(SA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield no(SA.loadItemFailedAction(t))}}function*mA(){try{const e=yield ao(Bd.metadata.getAuditsMetadata);yield no(SA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield no(SA.loadItemFailedAction(t))}}const bA=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*AA({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield hA(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield hA():{rowsData:[]};try{const e=bA(t),{data:s,total:d}=yield ao(Bd.audits.getAudits,E({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield no(SA.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield no(SA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield no(SA.loadItemFailedAction(t))}}function*kA(){yield no(SA.startLoading()),yield io([vA(),mA(),AA({payload:{onlyOneLoad:!1},type:""})]),yield no(SA.finishLoading())}function*TA({payload:e}){const{filters:t}=yield hA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield no(SA.setFilterData(i))}function*_A({payload:e}){const{filters:t}=yield hA();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 no(SA.setFilterData(i))}function*PA(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield hA(),a=bA(e);yield no(SA.startDownloadingCsv());try{yield Bd.audits.exportAudits(E({endpoint:"csv/v2",headerProps:o,sortDirection:n,sortBy:t,filter:i},a,{offset:0,outputFileName:"audits.csv"}))}catch(e){console.error("failed to export audits - ",e)}finally{yield no(SA.stopDownloadingCsv())}}function*EA(){yield na(SA.initData,kA),yield na(SA.removeFilter,TA),yield na(SA.filterData,_A),yield na([SA.loadAudits,SA.textSearch,SA.onPageChange],AA),yield na([SA.setFilterData,SA.setDataSorting,SA.startRefresh],(()=>AA({payload:{appendMode:!1},type:""}))),yield na(SA.exportCSV,PA)}const IA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},LA={initData:()=>E({},IA),setConnectivityState:(e,{payload:t})=>E({},e,t),cleanWebhookTestData:e=>E({},e,{testResult:void 0}),cleanWebhookLogsData:e=>E({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return E({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>E({},e,{error:void 0}),cleanSlackData:e=>E({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>E({},e,{retryResult:E({},e.retryResult,t)})}},OA={loadSlackActions:ot("connectivity/loadSlackActions"),loadDataAction:ot("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:ot("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:ot("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:ot("connectivity/loadScope"),deleteWebhookConfigAction:ot("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:ot("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:ot("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},wA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:RA,actions:CA}=rt({name:Et,initialState:wA,reducers:E({},LA)}),DA=E({},CA,OA),UA={slack:Bd.connectivity.getSlackConfiguration,email:Bd.connectivity.getEmailConfiguration,sms:Bd.connectivity.getSMSConfiguration,webhook:Bd.connectivity.getWebhooksConfigurations,categories:Bd.connectivity.getCategories,channelMap:Bd.connectivity.getChannelMaps},MA={slack:Bd.connectivity.postSlackConfiguration,email:Bd.connectivity.postEmailConfiguration,sms:Bd.connectivity.postSMSConfiguration,webhook:Bd.connectivity.postWebhooksConfiguration},NA=["email","slack","sms","webhook"],FA={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"}},$A=["id"],GA=["id","enabled"],xA=["categories","channelMap"];function*VA(e){return yield ao(WA,{payload:{api:e},type:""})}function*HA({payload:e=NA}){yield no(DA.setConnectivityState({isLoading:!0}));try{const t=yield io([...e.map(VA),yield WA({payload:{api:"categories"},type:""}),yield function*(){return(yield io(e.map((function*(e){return yield WA({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>E({},t,{[`${e[i]}`]:n})),{})}()]),n=yield WA({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?E({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:FA[e[o]].events(i),active:FA[e[o]].isActive(i),platform:FA[e[o]].title,image:FA[e[o]].image}]}):n:E({},n,{[`${xA[o-e.length]}`]:i})),{list:[],webhook:n});yield no(DA.setConnectivityState(E({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield no(DA.setConnectivityState({isLoading:!1}))}}function*WA({payload:{api:e,params:t}}){try{return yield ao(UA[e],t)}catch(e){return}}function*jA(){try{yield no(DA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield ao(Bd.connectivity.getSlackChannels);yield no(DA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield no(DA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*BA(e,t){const{connectivity:{list:n}}=yield lo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=FA[e].isActive(t);o!==i.active&&(yield no(DA.setConnectivityState({list:n.map((t=>t.key===e?E({},t,{active:o}):t))})))}function*KA({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield lo((e=>e.connectivity));try{if(yield no(DA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield lo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield io([...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=vi(e,$A);return n===t.id&&JSON.stringify(E({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield ao(MA.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield ao(Bd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield lo(),{processIds:i}=yield lo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield io([...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 ao("email"===t?Bd.connectivity.postEmailConfiguration:Bd.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=vi(o,GA);return yield io([yield ao("email"===t?Bd.connectivity.patchEmailConfiguration:Bd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield ao("email"===t?Bd.connectivity.putEmailSubscriptions:Bd.connectivity.putSMSSubscriptions,a,i,E({},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 ao("email"===t?Bd.connectivity.deleteEmailSubscriptions:Bd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield WA({payload:{api:t},type:""});yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield BA(t,e)}else yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield ao(MA[e],t),!["sms","email"].includes(e)){const o=yield WA({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield no(DA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield BA(e,o),null==n||n(!0)}}catch(e){var o;yield no(DA.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*qA({payload:e}){try{yield Bd.connectivity.postSlackCode(e)}catch{}yield no(DA.setConnectivityState({error:void 0,isSaving:!1}))}function*zA(){const{slackChannels:e}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({slackChannels:E({},e,{isLoadingScope:!0})}));const{clientId:t}=yield ao(Bd.connectivity.getSlackScope);yield no(DA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield no(DA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*XA({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({isSaving:!0})),yield ao(Bd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield WA({payload:{api:"webhook"},type:""});o&&(yield no(DA.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*JA({payload:e}){try{yield no(DA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield ao(Bd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield no(DA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*YA({payload:e}){try{const{statusCode:t}=yield ao(Bd.connectivity.postWebhookRetry,e);yield no(DA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield no(DA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*QA({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield lo((e=>e.connectivity));try{yield no(DA.setConnectivityState({webhookLogs:E({},i,{isLoading:!0})}));const o=yield ao(Bd.connectivity.getWebhookLog,e,n,t);yield no(DA.setConnectivityState({error:void 0,webhookLogs:E({isLoading:!1},o)}))}catch(e){yield no(DA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var ZA={sagas:function*(){yield ta(DA.loadDataAction,HA),yield na(DA.loadSlackActions,jA),yield ta(DA.postDataAction,KA),yield ta(DA.postCodeAction,qA),yield ta(DA.loadScope,zA),yield ta(DA.deleteWebhookConfigAction,XA),yield ta(DA.postWebhookTestAction,JA),yield ta(DA.postWebhookRetryAction,YA),yield na(DA.loadWebhookLogsAction,QA)},storeName:Et,initialState:wA,reducer:RA,actions:DA};function ek(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}}function tk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>E({},n,{[e]:t(n[e],i)})}}function nk(e){return tk(e,((e,t)=>E({},e,{loading:t.payload})))}function ik(e){return tk(e,((e,t)=>E({},e,{error:t.payload,loading:!1})))}const ok={loading:!1,error:null,fetching:!0,plans:[]},{actions:ak,reducer:rk,name:sk}=rt({name:"subscriptions/plans",initialState:ok,reducers:E({},ek())}),lk=E({loadPlans:ot(`${sk}/loadPlans`)},ak),ck={loading:!1,error:null,fetching:!0,config:null},uk=E({},ek()),{actions:dk,reducer:yk,name:fk}=rt({name:"subscriptions/config",initialState:ck,reducers:uk}),pk=E({loadPaymentConfiguration:ot(`${fk}/loadPaymentConfiguration`)},dk),gk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Sk=E({},ek(),{setCancellationLoading:nk("cancellation"),setCancellationError:ik("cancellation"),setRenewalLoading:nk("renewal"),setRenewalError:ik("renewal")}),{reducer:hk,actions:vk,name:mk}=rt({name:"subscriptions/billing/subscription",initialState:gk,reducers:Sk}),bk=E({load:ot(`${mk}/loadSubscription`),cancelSubscription:ot(`${mk}/cancelSubscription`),renewSubscription:ot(`${mk}/renewSubscription`)},vk),Ak={loading:!1,error:null,fetching:!0},kk=E({},ek()),{reducer:Tk,actions:_k,name:Pk}=rt({name:"subscriptions/billing/information",initialState:Ak,reducers:kk}),Ek=E({loadBillingInformation:ot(`${Pk}/loadBillingInformation`),cancelSubscription:bk.cancelSubscription,renewSubscription:bk.renewSubscription},_k),Ik={loading:!1,error:null,fetching:!0},Lk=E({},ek(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,t.payload)}}),{reducer:Ok,actions:wk,name:Rk}=rt({name:"subscriptions/billing/payment",initialState:Ik,reducers:Lk}),Ck=E({loadPaymentMethod:ot(`${Rk}/loadPaymentMethod`),submitPaymentMethod:ot(`${Rk}/submitPaymentMethod`),submitPaymentMethodError:ot(`${Rk}/submitPaymentMethodError`),submitPaymentMethodSuccess:ot(`${Rk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:ot(`${Rk}/updateBillingDetails`,(e=>({payload:e})))},wk),Dk={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Uk=E({},ek(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>E({},e,{invoiceDownload:E({},e.invoiceDownload,t.payload)})}}),{reducer:Mk,actions:Nk,name:Fk}=rt({name:"subscriptions/billing/invoices",initialState:Dk,reducers:Uk}),$k=E({loadInvoices:ot(`${Fk}/loadInvoices`),downloadInvoice:ot(`${Fk}/downloadInvoice`,(e=>({payload:e})))},Nk),Gk={information:Ak,invoices:Dk,paymentMethod:Ik,subscription:gk},xk={invoices:$k,information:Ek,paymentMethod:Ck,subscription:bk},Vk=$e({invoices:Mk,information:Tk,paymentMethod:Ok,subscription:hk}),Hk={fetching:!0,loading:!1,error:null,confirmed:!1},Wk=E({},ek()),{actions:jk,reducer:Bk,name:Kk}=rt({name:"subscriptions/checkout",initialState:Hk,reducers:Wk}),qk=E({loadCheckout:ot(`${Kk}/loadCheckout`),resetCheckout:ot(`${Kk}/resetCheckout`),submitCheckout:ot(`${Kk}/submitCheckout`),confirmCheckout:ot(`${Kk}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:ot(`${Kk}/errorCheckout`,(e=>({payload:e})))},jk),zk={loading:!1,error:null,cardSetupIntentSecret:null},Xk=E({},ek()),{reducer:Jk,actions:Yk,name:Qk}=rt({name:"subscriptions/stripe",initialState:zk,reducers:Xk}),Zk=E({loadCustomer:ot(`${Qk}/loadCustomer`),createCardSetupIntentSecret:ot(`${Qk}/createCardSetupIntentSecret`)},Yk),eT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:tT,reducer:nT,name:iT}=rt({name:"subscriptions/vendorPublicConfig",initialState:eT,reducers:E({},ek())}),oT=E({loadVendorPublicConfiguration:ot(`${iT}/loadVendorPublicConfiguration`)},tT),aT={config:ck,plans:ok,checkout:Hk,billing:Gk,stripe:zk,vendorPublicConfig:eT},rT={config:pk,billing:xk,plans:lk,checkout:qk,stripe:Zk,vendorPublicConfig:oT},sT=$e({config:yk,billing:Vk,plans:rk,checkout:Bk,stripe:Jk,vendorPublicConfig:nT});let lT,cT,uT;function dT({policy:e}){return{policy:uT.AT_PERIOD_END}}function yT(e){switch(e){case Yu.ACTIVE:return cT.ACTIVE;case Yu.INCOMPLETE:return cT.INCOMPLETE;case Yu.CANCELED:return cT.CANCELED;case Yu.EXPIRED:return cT.EXPIRED;case Yu.TRIALING:return cT.TRIALING;default:return cT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(lT||(lT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(cT||(cT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(uT||(uT={}));const fT={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Yu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},pT=[{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"}],gT=[{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:""}],ST=[{id:"id",externalId:"externalId",type:Qu.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],hT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*vT(){yield ta(bk.load,mT),yield ta(bk.cancelSubscription,AT),yield ta(bk.renewSubscription,kT)}function*mT(){const e=yield lo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield IT(e)}function*bT(){yield no(bk.setLoading(!0));try{const[e]=yield ao(Bd.subscriptions.getManagedSubscriptions);yield no(bk.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield no(bk.setError(e))}}function*AT(){const{subscription:e}=yield lo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield no(bk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield no(bk.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Yu.ACTIVE)try{yield no(bk.setCancellationLoading(!0)),yield ao(Bd.subscriptions.cancelManagedSubscription,t),yield bT(),yield no(bk.setCancellationLoading(!1))}catch(e){yield no(bk.setCancellationError(e.message))}}function*kT(){const{subscription:e}=yield lo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield no(bk.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield no(bk.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===Zu.AT_PERIOD_END)try{yield no(bk.setRenewalLoading(!0)),yield ao(Bd.subscriptions.renewManagedSubscription,t),yield bT(),yield no(bk.setRenewalLoading(!1))}catch(e){yield no(bk.setCancellationError(e.message))}}function*TT(){yield no(bk.setLoading(!0)),yield co(500),yield no(bk.setState({subscription:fT,fetching:!1,loading:!1,error:null}))}function*_T(){yield ta(bk.load,TT)}function*PT(){yield ta(Ek.loadBillingInformation,ET)}function*ET(){yield function*(e){const t=yield lo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield lo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield IT(n,!1):yield no(Ek.setError(t?"Not authorized":"Internal feature failure"))}()}function*IT(e,t){yield no(Ek.setLoading(!0));try{var n,i;const o=yield ao(Bd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield ao(Bd.subscriptions.getSubscriptionPlan,a):([,s]=yield io([ao(bT),ao(Bd.subscriptions.getSubscriptionPlan,a)]),l=yield lo((e=>e.subscriptions.billing.subscription.subscription||null))),yield no(Ek.setState(E({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?cT.ACTIVE:yT(l.status),cancellation:l.cancellation&&dT(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 no(Ek.setError(e.message))}}function*LT(){yield function*(){var e,t;yield no(Ek.setLoading(!0)),yield co(500),yield no(Ek.setState({loading:!1,fetching:!1,summary:{subscriptionId:fT.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:ed.Stripe,externallyManaged:!1,currentPlanId:pT[0].id,defaultPlanId:pT[0].id},plan:E({},pT[0],{price:null==(e=pT[0].price)?void 0:e.amount,currency:null==(t=pT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*OT(){yield ta(Ek.loadBillingInformation,LT)}function*wT(){yield ta(Ck.loadPaymentMethod,RT),yield ta(Ck.submitPaymentMethod,DT),yield ta(Ck.submitPaymentMethodError,UT),yield ta(Ck.submitPaymentMethodSuccess,MT),yield ta(Ck.updatePaymentMethodBillingDetails,CT)}function*RT(){yield no(Ck.setLoading(!0));try{const e=(yield ao(Bd.subscriptions.getPaymentMethods))[0];yield no(Ck.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield no(Ck.setError(e.message))}}function*CT({payload:e}){yield no(Ck.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield ao(Bd.subscriptions.updatePaymentMethodBillingDetails,t,E({email:n},i)),yield ao(RT),null==o||o(!0)}catch(e){yield no(Ck.setError(e.message)),null==o||o(!1)}yield no(Ck.setLoading(!1))}function*DT(){yield no(Ck.setLoading(!0))}function*UT({payload:e}){yield no(Ck.setError(e))}function*MT(){yield no(Ck.loadPaymentMethod())}function*NT(){yield no(Ck.setLoading(!0)),yield co(500);const e=ST[0];yield no(Ck.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*FT(){yield ta(Ck.loadPaymentMethod,NT)}function*$T(){yield ta($k.loadInvoices,GT),yield ta($k.downloadInvoice,xT)}function*GT(){yield no($k.setLoading(!0));try{const e=(yield ao(Bd.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 no($k.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield no($k.setError(e.message))}}function*xT({payload:e}){yield no($k.setInvoiceDownloadState({loading:!0,error:null}));try{yield ao(Bd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield no($k.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield no($k.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*VT(){yield no($k.setLoading(!0)),yield co(500),yield no($k.setState({loading:!1,fetching:!1,invoices:gT.map((e=>E({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield no($k.setLoading(!1))}function*HT(){yield ta($k.loadInvoices,VT)}function*WT(){yield io([ao(PT),ao(wT),ao($T),ao(vT)])}function*jT(){yield io([ao(OT),ao(FT),ao(HT),ao(_T)])}function*BT(){yield ta(qk.loadCheckout,KT),yield ta(qk.resetCheckout,qT),yield ta(qk.submitCheckout,zT),yield ta(qk.confirmCheckout,XT),yield ta(qk.errorCheckout,YT)}function*KT(){yield no(qk.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*qT(){yield no(qk.setState({loading:!1,error:null,confirmed:!1}))}function*zT(){yield no(qk.setState({loading:!0,error:null}))}function*XT({payload:{paymentMethodId:e,planId:t}}){const n=yield lo((e=>e.subscriptions.billing.subscription.subscription)),i=yield lo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Yu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield no(qk.setState({loading:!0,error:null})),o&&a)return yield JT(),void(yield no(bk.setState({subscription:E({},n,{status:Yu.ACTIVE})})));try{yield ao(Bd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield io([ET(),RT(),GT()]),yield JT()}catch(e){yield no(qk.setState({loading:!1,error:e.message}))}}else yield no(qk.setState({loading:!1,error:"Subscription not found"}))}function*JT(){yield no(qk.setState({loading:!1,error:null,confirmed:!0}))}function*YT({payload:e}){yield no(qk.setState({loading:!1,error:e}))}function*QT(){yield ta(qk.resetCheckout,qT)}function*ZT(){yield ta(lk.loadPlans,e_)}function*e_(){yield no(lk.setLoading(!0));try{const e=(yield ao(Bd.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 no(lk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield no(lk.setError(e.message))}}function*t_(){yield no(lk.setLoading(!0)),yield co(500),yield no(lk.setState({fetching:!1,loading:!1,plans:pT.map((e=>{var t,n;return E({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*n_(){yield ta(lk.loadPlans,t_)}function*i_(){yield ta(pk.loadPaymentConfiguration,o_)}function*o_(){yield no(pk.setLoading(!0));try{(yield ao(Bd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===ed.Stripe))?yield function*(){yield no(pk.setLoading(!0));try{const e=yield ao(Bd.subscriptions.getStripePaymentProviderConfiguration);yield no(pk.setState({loading:!1,fetching:!1,config:{paymentProvider:lT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield no(pk.setError(e.message))}}():yield no(pk.setError("Payment provider not configured"))}catch(e){yield no(pk.setError(e.message))}}function*a_(){yield no(pk.setLoading(!0)),yield co(500),yield no(pk.setState({loading:!1,fetching:!1,config:{paymentProvider:lT.STRIPE,apiKey:""}}))}function*r_(){yield ta(pk.loadPaymentConfiguration,a_)}function*s_(){yield ta(Zk.createCardSetupIntentSecret,l_)}function*l_({payload:e}){yield no(Zk.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield ao(Bd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield no(Zk.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield no(Zk.setError(e.message))}}function*c_(){yield ta(oT.loadVendorPublicConfiguration,u_)}function*u_(){yield no(oT.setLoading(!0));try{const e=yield ao(Bd.subscriptions.getVendorPublicConfigurations);yield no(oT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield no(oT.setError(e.message))}}function*d_(){yield no(oT.setLoading(!0)),yield co(500),yield no(oT.setState({fetching:!1,loading:!1,vendorPublicConfig:hT}))}function*y_(){yield ta(oT.loadVendorPublicConfiguration,d_)}var f_={sagas:function*(){yield io([ao(WT),ao(BT),ao(ZT),ao(i_),ao(s_),ao(c_)])},mockSagas:function*(){yield io([ao(jT),ao(QT),ao(n_),ao(r_),ao(y_)])},reducer:sT,actions:rT,initialState:aT,storeName:"subscriptions"},p_={sagas:function*(){yield ta(Wy.loadVendorPublicInfo,jy)},storeName:Lt,initialState:xy,reducer:Vy,actions:Wy};const{reducer:g_}=rt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(oa.setContext(t),E({},e,{context:t}))}}}),S_=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,p,g,S,h;n||a||oa.setContext(e.context);const t=Ko(),v=[...nt({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=it({middleware:v,preloadedState:{root:E({},e,{previewMode:n,urlStrategy:r}),[Gb.storeName]:E({},Gb.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:E({},Gb.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[dA.storeName]:E({},dA.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:E({},dA.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:E({},dA.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[fA]:E({},yA,null!=(h=null==o?void 0:o.audits)?h:{}),[ZA.storeName]:ZA.initialState,[f_.storeName]:f_.initialState,[p_.storeName]:p_.initialState},reducer:$e({root:g_,[Gb.storeName]:Gb.reducer,[dA.storeName]:dA.reducer,[fA]:gA,[ZA.storeName]:ZA.reducer,[f_.storeName]:f_.reducer,[p_.storeName]:p_.reducer})});const m=function*(){yield io([ao(Gb.sagas),ao(dA.sagas),ao(EA),ao(ZA.sagas),ao(f_.sagas),ao(p_.sagas)])},b=function*(){yield io([ao(Gb.mockSagas),ao(dA.mockSagas),ao(f_.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(ai.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var h_=__webpack_require__(714),v_=__webpack_require__.n(h_);function m_(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function b_(e){if(e.type)return e;if("#"===e.charAt(0))return b_(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 A_(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 k_(e){if(0===e.indexOf("#"))return e;const{values:t}=b_(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 T_(e,t){return e=b_(e),t=m_(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,A_(e)}function __(e,t){if(e=b_(e),t=m_(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 A_(e)}function P_(e,t){if(e=b_(e),t=m_(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 A_(e)}const E_=e=>{if(e)return{main:e,light:k_(P_(e,.4)),dark:k_(__(e,.15)),hover:k_(__(e,.15)),active:k_(__(e,.2))}},I_=e=>{if(e)return{main:e,light:P_(e,.7),dark:__(e,.2)}},L_=(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)?E({},t,{palette:{primary:E({},E_(null==e||null==(i=e.palette)?void 0:i.primary),{contrastText:null!=(o=null==e||null==(a=e.palette)?void 0:a.primaryText)?o:"#000000"}),secondary:E({},E_(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:E({},E_(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:E({},I_(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:E({},I_(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:E({},I_(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:E({},I_(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},O_={},w_={},R_={},C_={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class D_{constructor(){this._theme=O_,this._themeV2=w_,this._navigation=C_,this._localizations=R_}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new D_;return n.set(e),D_._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=v_().all([null!=(t=C_)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=v_().all([null!=(i=O_)?i:{},L_(null==e?void 0:e.theme,O_)]),this._themeV2=v_().all([null!=(o=w_)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=v_().all([null!=(r=R_)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=C_,this._theme=O_,this._themeV2=w_,this._localizations=R_}}}D_._instances={};var U_=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},M_=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},N_=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let F_,$_,G_,x_,V_,H_,W_,j_,B_,K_,q_;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(F_||(F_={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}($_||($_={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(G_||(G_={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(x_||(x_={})),function(e){e.Invoices="invoices"}(V_||(V_={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(H_||(H_={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(W_||(W_={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(j_||(j_={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(B_||(B_={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(K_||(K_={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(q_||(q_={}));const z_={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},X_={hidden:"hidden",edit:"edit"};var J_="6.87.0",Y_={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts":"on"},Q_=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];b(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(J_),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=L(w().mark((function e(){var t,n,i,a,r;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=ca,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:D_.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=L(w().mark((function e(){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=L(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}dd.set(Y_,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,yd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),dd.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=U_(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=E({},t,{contextOptions:E({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?E({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=S_({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);P.setInstance(s,this)}var t,n,i,o;return _(e,[{key:"initContainers",value:(o=L(w().mark((function e(t){return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;D_.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:v,FronteggTypes:m})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=L(w().mark((function e(){return w().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=L(w().mark((function e(){var t;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=L(w().mark((function e(t){var n;return w().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,E({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),Z_=function(){function e(){b(this,e)}return _(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=P.getInstance(i);e&&t?(oa.setAccessToken(t),oa.setUser(E({},n,{accessToken:t})),o.store.dispatch(ai.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(ai.loadTenants())):(oa.setAccessToken(null),oa.setUser(null),o.store.dispatch(ai.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),eP=function(){function e(){b(this,e)}return _(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideAdminPortal()}}]),e}(),tP=function(){function e(){b(this,e)}return _(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";P.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";P.getInstance(e).hideCheckoutDialog()}}]),e}(),nP=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},iP=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];b(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=S_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new Q_(this.options,t,!0),D_.set({},t)}var t;return _(e,[{key:"render",value:(t=L(w().mark((function e(t){var n,i,o,a,r=this;return w().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,N_(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}(),oP="modern",aP=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[oP]},rP=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];b(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=S_({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=E({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new Q_(this.options,t,!0,a),D_.set({},t)}var t;return _(e,[{key:"render",value:(t=L(w().mark((function e(t){var n,i,o,a,r=this;return w().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,N_(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 sP(e,t){return sP=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},sP(e,t)}function lP(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&&sP(e,t)}function cP(e,t){if(t&&("object"===A(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 uP(e){return uP=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},uP(e)}function dP(){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 yP(e,t,n){return yP=dP()?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&&sP(o,n.prototype),o},yP.apply(null,arguments)}function fP(e){var t="function"==typeof Map?new Map:void 0;return fP=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 yP(e,arguments,uP(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),sP(n,e)},fP(e)}function pP(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=uP(e);if(t){var o=uP(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return cP(this,n)}}var gP=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new Q_(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){lP(n,e);var t=pP(n);function n(){var e;b(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 _(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=P.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=M_(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=M_(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=M_(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=M_(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=M_(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=M_(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}(fP(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}}(),__webpack_exports__}()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Frontegg=t():e.Frontegg=t()}(window,(function(){return function(){var e={714:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===n}(e)}(e)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map((function(e){return i(e,n)}))}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}(e))}function r(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||o,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):function(e,t,n){var o={};return n.isMergeableObject(e)&&a(e).forEach((function(t){o[t]=i(e[t],n)})),a(t).forEach((function(a){(function(e,t){return r(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(r(e,a)&&n.isMergeableObject(t[a])?o[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):o[a]=i(t[a],n))})),o}(e,n,l):i(n,l)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,n){return s(e,n,t)}),{})};var l=s;e.exports=l},609:function(e,t,n){var i=n(425).default;function o(){"use strict";e.exports=o=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function y(e,t,n,i){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),s=new O(i||[]);return r(a,"_invoke",{value:P(e,n,s)}),a}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=y;var p={};function g(){}function S(){}function v(){}var h={};d(h,l,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(w([])));b&&b!==n&&a.call(b,l)&&(h=b);var A=v.prototype=g.prototype=Object.create(h);function k(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}))}function T(e,t){function n(o,r,s,l){var c=f(e[o],e,r);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==i(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,l)}),(function(e){n("throw",e,s,l)})):t.resolve(d).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,l)}))}l(c.arg)}var o;r(this,"_invoke",{value:function(e,i){function a(){return new t((function(t,o){n(e,i,t,o)}))}return o=o?o.then(a,a):a()}})}function P(e,t,n){var i="suspendedStart";return function(o,a){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===o)throw a;return{value:void 0,done:!0}}for(n.method=o,n.arg=a;;){var r=n.delegate;if(r){var s=I(r,n);if(s){if(s===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 L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function w(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(a.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:D}}function D(){return{value:void 0,done:!0}}return S.prototype=v,r(A,"constructor",{value:v,configurable:!0}),r(v,"constructor",{value:S,configurable:!0}),S.displayName=d(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===S||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,d(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},k(T.prototype),d(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,i,o,a){void 0===a&&(a=Promise);var r=new T(y(e,n,i,o),a);return t.isGeneratorFunction(n)?r:r.next().then((function(e){return e.done?e.value:r.next()}))},k(A),d(A,u,"Generator"),d(A,l,(function(){return this})),d(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=w,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,i){return r.type="throw",r.arg=e,t.next=n,i&&(t.method="next",t.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=a.call(o,"catchLoc"),l=a.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=e,r.arg=t,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(r)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},425:function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},841:function(e,t,n){var i=n(609)();e.exports=i;try{regeneratorRuntime=i}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return function(){"use strict";n.r(i),n.d(i,{AdminPortal:function(){return pI},AdminPortalRenderer:function(){return vI},AppHolder:function(){return E},CheckoutDialog:function(){return gI},FronteggApp:function(){return yI},HostedLogin:function(){return fI},LoginBoxRenderer:function(){return bI},createElement:function(){return JP},defaultTheme:function(){return hI},formatName:function(){return HP},getThemeAdminByName:function(){return SI},getThemeByName:function(){return mI},initialize:function(){return wI},mockFlagsList:function(){return dI},waitThemeSetter:function(){return YP}});var e={};n.r(e),n.d(e,{Delete:function(){return ga},Get:function(){return da},Patch:function(){return fa},Post:function(){return ya},PostDownload:function(){return Sa},Put:function(){return pa},getBaseUrl:function(){return ca}});var t={};n.r(t),n.d(t,{getSubTenants:function(){return Xa},getSubTenantsAsTree:function(){return Za},getTenants:function(){return Qa},switchTenant:function(){return Ya}});var o={};n.r(o),n.d(o,{AuthStrategyEnum:function(){return Lr},MachineToMachineAuthStrategy:function(){return Er},OAuthLogout:function(){return Qr},SocialLoginProviders:function(){return Ir},acceptInvitation:function(){return qr},activateAccount:function(){return Wr},bulkCreateIPRestriction:function(){return br},changePhoneNumber:function(){return xl},changePhoneNumberWithVerification:function(){return $l},checkIfAllowToRememberMfaDevice:function(){return fl},createDomainRestriction:function(){return pr},createIPRestriction:function(){return mr},createOrUpdateSessionConfigrations:function(){return Qs},createSSOConfiguration:function(){return hl},createSSOConfigurationByMetadata:function(){return Al},createSSODomain:function(){return Tl},createSSOGroup:function(){return Ol},createSamlGroup:function(){return Ns},createTenantAccessToken:function(){return al},createUserAccessToken:function(){return ol},deleteAllSessionsForUser:function(){return Zs},deleteDomainRestriction:function(){return Sr},deleteIPRestriction:function(){return kr},deleteSSOConfiguration:function(){return bl},deleteSSODomain:function(){return Pl},deleteSSOGroup:function(){return Dl},deleteSamlGroup:function(){return $s},deleteSessionForUser:function(){return Xs},deleteTenantAccessToken:function(){return nl},deleteTenantApiToken:function(){return ul},deleteUserAccessToken:function(){return il},deleteUserApiToken:function(){return dl},deleteWebAuthnDevice:function(){return Bl},disableMFAAuthenticatorApp:function(){return ds},disableMFASMS:function(){return fs},disableMFAWebAuthn:function(){return gs},disableMfa:function(){return us},enrollMFAAuthenticatorApp:function(){return os},enrollMFAAuthenticatorAppForLogin:function(){return hs},enrollMFASMS:function(){return rs},enrollMFASMSForLogin:function(){return As},enrollMFAWebAuthn:function(){return ls},enrollMFAWebAuthnForLogin:function(){return Is},enrollMfa:function(){return ns},exchangeOAuthTokens:function(){return _l},forgotPassword:function(){return Xr},generateLoginResponse:function(){return _r},generateLoginResponseFromOAuthResponse:function(){return Nr},generateLoginResponseV2:function(){return Mr},getActivateAccountStrategy:function(){return Kr},getCaptchaPolicy:function(){return sr},getCurrentUserSession:function(){return Hs},getCurrentUserSessions:function(){return qs},getCustomSocialLoginProvidersV1:function(){return Ws},getDomainRestrictions:function(){return yr},getDomainRestrictionsConfig:function(){return fr},getGlobalSecurityPolicy:function(){return er},getIPRestrictions:function(){return vr},getIPRestrictionsConfig:function(){return hr},getLockoutPolicy:function(){return or},getMFADevices:function(){return Ss},getMFAStrategiesConfig:function(){return Hl},getMfaPolicy:function(){return tr},getOidcConfiguration:function(){return Gs},getPasswordConfigPolicy:function(){return dr},getPasswordHistoryPolicy:function(){return lr},getSSOConfigurations:function(){return vl},getSSODefaultRoles:function(){return Ll},getSSOGroups:function(){return Cl},getSSOPublicConfiguration:function(){return xs},getSamlConfiguration:function(){return Os},getSamlRoles:function(){return Us},getSamlRolesGroups:function(){return _s},getSamlVendorConfiguration:function(){return Ds},getSessionConfigurations:function(){return Ys},getSocialLoginProviders:function(){return Vs},getSocialLoginProvidersV2:function(){return js},getTenantAccessTokensData:function(){return tl},getTenantApiTokensData:function(){return sl},getUserAccessTokensData:function(){return el},getUserApiTokensData:function(){return rl},getUserById:function(){return yl},getVendorConfig:function(){return Bs},getVendorLockoutPolicy:function(){return ar},getVendorMfaPolicy:function(){return nr},getVendorPasswordHistoryPolicy:function(){return cr},getVendorPublicAuthStrategiesConfig:function(){return ql},getWebAuthnDevices:function(){return Kl},loadPasswordConfig:function(){return es},login:function(){return Vr},loginViaSocialLogin:function(){return Ks},loginWithMfa:function(){return jr},logout:function(){return Yr},oidcPostLogin:function(){return xr},oidcPostLoginV2:function(){return Ul},passwordlessPostLogin:function(){return gl},passwordlessPreLogin:function(){return pl},postLogin:function(){return Gr},preDisableMFASMS:function(){return ys},preDisableMFAWebAuthn:function(){return ps},preEnrollMFAAuthenticatorApp:function(){return is},preEnrollMFAAuthenticatorAppForLogin:function(){return vs},preEnrollMFASMS:function(){return as},preEnrollMFASMSForLogin:function(){return bs},preEnrollMFAWebAuthn:function(){return ss},preEnrollMFAWebAuthnForLogin:function(){return Ps},preLogin:function(){return Fr},preLoginV2:function(){return Rl},preLoginWithIdpType:function(){return $r},preVerifyMFASMSForLogin:function(){return ks},preVerifyMFAWebAuthnForLogin:function(){return Ls},recoverMfaToken:function(){return ts},refreshToken:function(){return Hr},refreshTokenV2:function(){return Jr},resendActivationEmail:function(){return Br},resendInvitationEmail:function(){return zr},resetPassword:function(){return Zr},resetPhoneNumber:function(){return Nl},revokeSessionsForUser:function(){return Js},saveLockoutPolicy:function(){return rr},saveMfaPolicy:function(){return ir},savePasswordHistoryPolicy:function(){return ur},setSSODefaultRoles:function(){return El},signUpUser:function(){return zs},silentOAuthRefreshToken:function(){return Ml},testCurrentIp:function(){return Tr},testCurrentIpInAllowList:function(){return Pr},updateDomainRestrictionConfig:function(){return gr},updateIPRestrictionConfig:function(){return Ar},updateSSOConfiguration:function(){return ml},updateSSOConfigurationByMetadata:function(){return kl},updateSSOGroup:function(){return wl},updateSamlConfiguration:function(){return ws},updateSamlGroup:function(){return Fs},updateSamlRoles:function(){return Ms},updateSamlVendorMetadata:function(){return Cs},updateTenantApiTokensData:function(){return cl},updateUserApiTokensData:function(){return ll},validateSSODomain:function(){return Il},validateSamlDomain:function(){return Rs},verifyChangePhoneNumber:function(){return Gl},verifyInviteToken:function(){return Sl},verifyMFAAuthenticatorAppForLogin:function(){return ms},verifyMFASMSForLogin:function(){return Ts},verifyMFAWebAuthnForLogin:function(){return Es},verifyMfa:function(){return cs},verifyNewDeviceSession:function(){return zl},verifyResetPhoneNumber:function(){return Fl},webAuthnCreateNewDeviceSession:function(){return Wl},webAuthnPostLogin:function(){return jl},webAuthnPreLogin:function(){return Vl}});var a={};n.r(a),n.d(a,{addUser:function(){return ec},changePassword:function(){return Xl},createInviteUserLink:function(){return ic},deleteInviteUserLink:function(){return ac},deleteUser:function(){return tc},getInviteLinkConfiguration:function(){return sc},getInviteUserLink:function(){return rc},getProfile:function(){return Jl},loadAvailablePermissions:function(){return cc},loadAvailableRoles:function(){return lc},loadStats:function(){return uc},loadUsers:function(){return Zl},resendActivationLink:function(){return dc},resendInvitationLink:function(){return yc},resendInvitationLinkToAllTenants:function(){return fc},updateInviteUserLink:function(){return oc},updateProfile:function(){return Yl},updateProfileImage:function(){return Ql},updateUser:function(){return nc}});var r={};n.r(r),n.d(r,{getAuditsMetadata:function(){return hc},getCurrentUserIpMetadata:function(){return gc},getIpAdressMetadata:function(){return mc},getNotificationsMetadata:function(){return Sc},getSamlMetadata:function(){return vc}});var s={};n.r(s),n.d(s,{downloadReport:function(){return Ec},getReport:function(){return Pc},getReports:function(){return Tc},renderReport:function(){return Ic},scheduleReport:function(){return Lc},sendReport:function(){return Oc}});var l={};n.r(l),n.d(l,{getNotifications:function(){return wc},markAllAsRead:function(){return Rc},updateNotificationIsPinned:function(){return Cc},updateNotificationStatus:function(){return Dc}});var c={};n.r(c),n.d(c,{exportAudits:function(){return Nc},getAudits:function(){return _c},getAuditsStats:function(){return Mc}});var u={};n.r(u),n.d(u,{deleteEmailConfiguration:function(){return Yc},deleteEmailSubscriptions:function(){return Hc},deleteSMSConfiguration:function(){return nu},deleteSMSSubscriptions:function(){return eu},deleteSlackConfiguration:function(){return Wc},deleteWebhooksConfiguration:function(){return au},getCategories:function(){return cu},getChannelMaps:function(){return uu},getEmailConfiguration:function(){return Bc},getSMSConfiguration:function(){return Qc},getSlackChannels:function(){return Vc},getSlackConfiguration:function(){return Gc},getSlackScope:function(){return xc},getWebhookLog:function(){return ru},getWebhooksConfigurations:function(){return iu},patchEmailConfiguration:function(){return qc},patchSMSConfiguration:function(){return Zc},postEmailConfiguration:function(){return zc},postSMSConfiguration:function(){return Xc},postSlackCode:function(){return Kc},postSlackConfiguration:function(){return jc},postWebhookRetry:function(){return lu},postWebhookTest:function(){return su},postWebhooksConfiguration:function(){return ou},putEmailSubscriptions:function(){return Jc},putSMSSubscriptions:function(){return tu}});var d={};n.r(d),n.d(d,{getSettings:function(){return yu},updateSettings:function(){return du}});var y={};n.r(y),n.d(y,{addRole:function(){return vu},attachPermissionToRoles:function(){return ku},attachPermissionsToRole:function(){return bu},deleteRole:function(){return hu},getPermissionCategories:function(){return Tu},getPermissions:function(){return Au},getRoles:function(){return Su},updateRole:function(){return mu}});var f={};n.r(f),n.d(f,{ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},TenantCreatedAction:function(){return od},TrialEndAction:function(){return id},cancelManagedSubscription:function(){return Cu},cancelSubscription:function(){return Lu},createStripeCustomer:function(){return Bu},createStripePaymentMethodSetupIntentSecret:function(){return qu},createSubscription:function(){return Wu},createTenantConfiguration:function(){return Yu},getManagedSubscription:function(){return wu},getManagedSubscriptions:function(){return Du},getPaymentMethod:function(){return Vu},getPaymentMethods:function(){return xu},getPaymentProviders:function(){return Qu},getStripeCustomer:function(){return Ku},getStripePaymentProviderConfiguration:function(){return zu},getSubscription:function(){return Iu},getSubscriptionInvoice:function(){return Fu},getSubscriptionInvoicePdf:function(){return $u},getSubscriptionInvoices:function(){return Nu},getSubscriptionPlan:function(){return Mu},getSubscriptionPlans:function(){return _u},getSubscriptionSummaries:function(){return Hu},getSubscriptions:function(){return Pu},getTenantConfiguration:function(){return Ju},getVendorPublicConfigurations:function(){return Xu},renewManagedSubscription:function(){return Ru},renewSubscription:function(){return Eu},updateManagedSubscription:function(){return Uu},updatePaymentMethodBillingDetails:function(){return ju},updateSubscription:function(){return Ou}});var p={};n.r(p),n.d(p,{getVendorPublicInfo:function(){return ad}});var g={};n.r(g),n.d(g,{addUserRolesForSubTenants:function(){return cd},addUserToTenantAndSubTenants:function(){return sd},loadAllUsers:function(){return rd},removeUserFromTenantAndSubTenants:function(){return ld},removeUserRolesFromSubTenants:function(){return ud},setUserRolesForSubTenants:function(){return dd}});var S={};n.r(S),n.d(S,{FeatureFlags:function(){return fd},loadFeatureFlags:function(){return pd}});var v={};n.r(v),n.d(v,{countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},deleteConfiguration:function(){return hd},getConfigs:function(){return gd},updateConfiguration:function(){return Sd}});var h={};n.r(h),n.d(h,{impersonate:function(){return bd}});var m={};n.r(m),n.d(m,{addRolesToGroup:function(){return Od},addUsersToGroup:function(){return Dd},createGroup:function(){return Id},deleteGroup:function(){return Ed},deleteRolesFromGroup:function(){return wd},deleteUsersFromGroup:function(){return Cd},getGroupById:function(){return kd},getGroupConfiguration:function(){return Rd},getGroups:function(){return Td},getGroupsByIds:function(){return Pd},updateGroup:function(){return Ld},updateGroupConfiguration:function(){return Ud}});var b={};n.r(b),n.d(b,{AuthStrategyEnum:function(){return Lr},ContextHolder:function(){return ra},FeatureFlags:function(){return fd},FronteggApiError:function(){return la},FronteggContext:function(){return sa},GroupManagedByEnum:function(){return zd},GroupRelations:function(){return Bd},ISubscriptionCancellationPolicy:function(){return td},ISubscriptionStatus:function(){return Zu},MFAStrategyEnum:function(){return Nd},MachineToMachineAuthStrategy:function(){return Er},PaymentMethodType:function(){return ed},ProviderType:function(){return nd},RestrictionType:function(){return $n},ScimConnectionSource:function(){return Kd},SecondaryAuthStrategy:function(){return _d},SocialLoginProviders:function(){return Ir},TenantType:function(){return $d},UserManagedByEnum:function(){return Fd},WebAuthnDeviceType:function(){return Md},api:function(){return qd},countConfigurationUsers:function(){return md},createConfiguration:function(){return vd},default:function(){return Hd},deleteConfiguration:function(){return hd},fetch:function(){return e},fronteggAuthApiRoutesRegex:function(){return Gd},fronteggRefreshTokenUrl:function(){return xd},fronteggSilentRefreshTokenUrl:function(){return Vd},fronteggTenantsUrl:function(){return Wd},fronteggUsersUrl:function(){return jd},getConfigs:function(){return gd},loadFeatureFlags:function(){return pd},updateConfiguration:function(){return Sd}});var A={};function k(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(e){return 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},T(e)}function P(e){var t=function(e,t){if("object"!==T(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!==T(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"===T(t)?t:String(t)}function I(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,P(i.key),i)}}function L(e,t,n){return t&&I(e.prototype,t),n&&I(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}n.r(A),n.d(A,{AccountPageFields:function(){return eI},DomainRestrictionsTabFields:function(){return rI},GeneralSettingsTabFields:function(){return oI},InviteUserModalFields:function(){return ZP},IpRestrictionsTabFields:function(){return aI},Metadata:function(){return qP},PrivacyPageFields:function(){return XP},ProfilePageFields:function(){return QP},SecurityPageTabs:function(){return nI},SessionManagementTabFields:function(){return iI},SsoPageTabs:function(){return sI},SubscriptionsPageFields:function(){return tI},alpha:function(){return FP},fieldAppearance:function(){return lI},tabAppearance:function(){return cI}});var E=function(){function e(){k(this,e)}return L(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 O(){return O=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},O.apply(this,arguments)}function w(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 D(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var a=e.apply(t,n);function r(e){w(a,i,o,r,s,"next",e)}function s(e){w(a,i,o,r,s,"throw",e)}r(void 0)}))}}E._apps={};var C=n(841),R=n.n(C);function U(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function _(e){return!!e&&!!e[be]}function M(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)===Ae}(e)||Array.isArray(e)||!!e[me]||!!e.constructor[me]||V(e)||j(e))}function N(e,t,n){void 0===n&&(n=!1),0===F(e)?(n?Object.keys:ke)(e).forEach((function(i){n&&"symbol"==typeof i||t(i,e[i],e)})):e.forEach((function(n,i){return t(i,n,e)}))}function F(e){var t=e[be];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:V(e)?2:j(e)?3:0}function $(e,t){return 2===F(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function G(e,t,n){var i=F(e);2===i?e.set(t,n):3===i?(e.delete(t),e.add(n)):e[t]=n}function x(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function V(e){return ge&&e instanceof Map}function j(e){return Se&&e instanceof Set}function W(e){return e.o||e.t}function K(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Te(e);delete t[be];for(var n=ke(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 B(e,t){return void 0===t&&(t=!1),q(e)||_(e)||!M(e)||(F(e)>1&&(e.set=e.add=e.clear=e.delete=z),Object.freeze(e),t&&N(e,(function(e,t){return B(t,!0)}),!0)),e}function z(){U(2)}function q(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function H(e){var t=Pe[e];return t||U(18,e),t}function J(){return fe}function Y(e,t){t&&(H("Patches"),e.u=[],e.s=[],e.v=t)}function Q(e){X(e),e.p.forEach(ee),e.p=null}function X(e){e===fe&&(fe=e.l)}function Z(e){return fe={p:[],l:fe,h:e,m:!0,_:0}}function ee(e){var t=e[be];0===t.i||1===t.i?t.j():t.O=!0}function te(e,t){t._=t.p.length;var n=t.p[0],i=void 0!==e&&e!==n;return t.h.g||H("ES5").S(t,e,i),i?(n[be].P&&(Q(t),U(4)),M(e)&&(e=ne(t,e),t.l||oe(t,e)),t.u&&H("Patches").M(n[be].t,e,t.u,t.s)):e=ne(t,n,[]),Q(t),t.u&&t.v(t.u,t.s),e!==he?e:void 0}function ne(e,t,n){if(q(t))return t;var i=t[be];if(!i)return N(t,(function(o,a){return ie(e,i,t,o,a,n)}),!0),t;if(i.A!==e)return t;if(!i.P)return oe(e,i.t,!0),i.t;if(!i.I){i.I=!0,i.A._--;var o=4===i.i||5===i.i?i.o=K(i.k):i.o;N(3===i.i?new Set(o):o,(function(t,a){return ie(e,i,o,t,a,n)})),oe(e,o,!1),n&&e.u&&H("Patches").R(i,n,e.u,e.s)}return i.o}function ie(e,t,n,i,o,a){if(_(o)){var r=ne(e,o,a&&t&&3!==t.i&&!$(t.D,i)?a.concat(i):void 0);if(G(n,i,r),!_(r))return;e.m=!1}if(M(o)&&!q(o)){if(!e.h.F&&e._<1)return;ne(e,o),t&&t.A.l||oe(e,o)}}function oe(e,t,n){void 0===n&&(n=!1),e.h.F&&e.m&&B(t,n)}function ae(e,t){var n=e[be];return(n?W(n):e)[t]}function re(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 se(e){e.P||(e.P=!0,e.l&&se(e.l))}function le(e){e.o||(e.o=K(e.t))}function ce(e,t,n){var i=V(t)?H("MapSet").N(t,n):j(t)?H("MapSet").T(t,n):e.g?function(e,t){var n=Array.isArray(e),i={i:n?1:0,A:t?t.A:J(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},o=i,a=Ie;n&&(o=[i],a=Le);var r=Proxy.revocable(o,a),s=r.revoke,l=r.proxy;return i.k=l,i.j=s,l}(t,n):H("ES5").J(t,n);return(n?n.A:J()).p.push(i),i}function ue(e){return _(e)||U(22,e),function e(t){if(!M(t))return t;var n,i=t[be],o=F(t);if(i){if(!i.P&&(i.i<4||!H("ES5").K(i)))return i.t;i.I=!0,n=de(t,o),i.I=!1}else n=de(t,o);return N(n,(function(t,o){i&&function(e,t){return 2===F(e)?e.get(t):e[t]}(i.t,t)===o||G(n,t,e(o))})),3===o?new Set(n):n}(e)}function de(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return K(e)}var ye,fe,pe="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),ge="undefined"!=typeof Map,Se="undefined"!=typeof Set,ve="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,he=pe?Symbol.for("immer-nothing"):((ye={})["immer-nothing"]=!0,ye),me=pe?Symbol.for("immer-draftable"):"__$immer_draftable",be=pe?Symbol.for("immer-state"):"__$immer_state",Ae=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ke="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Te=Object.getOwnPropertyDescriptors||function(e){var t={};return ke(e).forEach((function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)})),t},Pe={},Ie={get:function(e,t){if(t===be)return e;var n=W(e);if(!$(n,t))return function(e,t,n){var i,o=re(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||!M(i)?i:i===ae(e.t,t)?(le(e),e.o[t]=ce(e.A.h,i,e)):i},has:function(e,t){return t in W(e)},ownKeys:function(e){return Reflect.ownKeys(W(e))},set:function(e,t,n){var i=re(W(e),t);if(null==i?void 0:i.set)return i.set.call(e.k,n),!0;if(!e.P){var o=ae(W(e),t),a=null==o?void 0:o[be];if(a&&a.t===n)return e.o[t]=n,e.D[t]=!1,!0;if(x(n,o)&&(void 0!==n||$(e.t,t)))return!0;le(e),se(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!==ae(e.t,t)||t in e.t?(e.D[t]=!1,le(e),se(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=W(e),i=Reflect.getOwnPropertyDescriptor(n,t);return i?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:i.enumerable,value:n[t]}:i},defineProperty:function(){U(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){U(12)}},Le={};N(Ie,(function(e,t){Le[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Le.deleteProperty=function(e,t){return Le.set.call(this,e,t,void 0)},Le.set=function(e,t,n){return Ie.set.call(this,e[0],t,n,e[0])};var Ee=function(){function e(e){var t=this;this.g=ve,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&&U(6),void 0!==i&&"function"!=typeof i&&U(7),M(e)){var s=Z(t),l=ce(t,e,void 0),c=!0;try{r=n(l),c=!1}finally{c?Q(s):X(s)}return"undefined"!=typeof Promise&&r instanceof Promise?r.then((function(e){return Y(s,i),te(e,s)}),(function(e){throw Q(s),e})):(Y(s,i),te(r,s))}if(!e||"object"!=typeof e){if(void 0===(r=n(e))&&(r=e),r===he&&(r=void 0),t.F&&B(r,!0),i){var u=[],d=[];H("Patches").M(e,r,u,d),i(u,d)}return r}U(21,e)},this.produceWithPatches=function(e,n){if("function"==typeof e)return function(n){for(var i=arguments.length,o=Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return t.produceWithPatches(n,(function(t){return e.apply(void 0,[t].concat(o))}))};var i,o,a=t.produce(e,n,(function(e,t){i=e,o=t}));return"undefined"!=typeof Promise&&a instanceof Promise?a.then((function(e){return[e,i,o]})):[a,i,o]},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){M(e)||U(8),_(e)&&(e=ue(e));var t=Z(this),n=ce(this,e,void 0);return n[be].C=!0,X(t),n},t.finishDraft=function(e,t){var n=(e&&e[be]).A;return Y(n,t),te(void 0,n)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!ve&&U(20),this.g=e},t.applyPatches=function(e,t){var n;for(n=t.length-1;n>=0;n--){var i=t[n];if(0===i.path.length&&"replace"===i.op){e=i.value;break}}n>-1&&(t=t.slice(n+1));var o=H("Patches").$;return _(e)?o(e,t):this.produce(e,(function(e){return o(e,t)}))},e}(),Oe=new Ee,we=Oe.produce,De=(Oe.produceWithPatches.bind(Oe),Oe.setAutoFreeze.bind(Oe),Oe.setUseProxies.bind(Oe),Oe.applyPatches.bind(Oe),Oe.createDraft.bind(Oe),Oe.finishDraft.bind(Oe),we);function Ce(e,t,n){return(t=P(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach((function(t){Ce(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _e(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Me="function"==typeof Symbol&&Symbol.observable||"@@observable",Ne=function(){return Math.random().toString(36).substring(7).split("").join(".")},Fe={INIT:"@@redux/INIT"+Ne(),REPLACE:"@@redux/REPLACE"+Ne(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Ne()}};function $e(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Ge(e,t,n){var i;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error(_e(1));return n(Ge)(e,t)}if("function"!=typeof e)throw new Error(_e(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(_e(3));return a}function d(e){if("function"!=typeof e)throw new Error(_e(4));if(l)throw new Error(_e(5));var t=!0;return c(),s.push(e),function(){if(t){if(l)throw new Error(_e(6));t=!1,c();var n=s.indexOf(e);s.splice(n,1),r=null}}}function y(e){if(!$e(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(l)throw new Error(_e(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(_e(10));o=e,y({type:Fe.REPLACE})}function p(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(_e(11));function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[Me]=function(){return this},e}return y({type:Fe.INIT}),(i={dispatch:y,subscribe:d,getState:u,replaceReducer:f})[Me]=p,i}function xe(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var a,r=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:Fe.INIT}))throw new Error(_e(12));if(void 0===n(void 0,{type:Fe.PROBE_UNKNOWN_ACTION()}))throw new Error(_e(13))}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var i=!1,o={},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(_e(14));o[l]=d,i=i||d!==u}return(i=i||r.length!==Object.keys(e).length)?o:e}}function Ve(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function je(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),i=function(){throw new Error(_e(15))},o={getState:n.getState,dispatch:function(){return i.apply(void 0,arguments)}},a=t.map((function(e){return e(o)}));return i=Ve.apply(void 0,a)(n.dispatch),Ue(Ue({},n),{},{dispatch:i})}}}function We(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(o){return"function"==typeof o?o(n,i,e):t(o)}}}}var Ke=We();Ke.withExtraArgument=We;var Be,ze=Ke,qe=(Be=function(e,t){return Be=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])},Be(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}Be(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),He=function(e,t){for(var n=0,i=t.length,o=e.length;n<i;n++,o++)e[o]=t[n];return e},Je=Object.defineProperty,Ye=(Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols),Qe=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,Ze=function(e,t,n){return t in e?Je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},et=function(e,t){for(var n in t||(t={}))Qe.call(t,n)&&Ze(e,n,t[n]);if(Ye)for(var i=0,o=Ye(t);i<o.length;i++)n=o[i],Xe.call(t,n)&&Ze(e,n,t[n]);return e},tt="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(0!==arguments.length)return"object"==typeof arguments[0]?Ve:Ve.apply(null,arguments)};"undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__;var nt=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 qe(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,He([void 0],e[0].concat(this)))):new(t.bind.apply(t,He([void 0],e.concat(this))))},t}(Array);function it(e){return M(e)?De(e,(function(){})):e}function ot(e){void 0===e&&(e={});var t=e.thunk,n=void 0===t||t,i=(e.immutableCheck,e.serializableCheck,new nt);return n&&(function(e){return"boolean"==typeof e}(n)?i.push(ze):i.push(ze.withExtraArgument(n.extraArgument))),i}function at(e){var t,n=function(e){return ot(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=xe(a)}var p=s;"function"==typeof p&&(p=p(n));var g=je.apply(void 0,p),S=Ve;c&&(S=tt(et({trace:!1},"object"==typeof c&&c)));var v=[g];return Array.isArray(f)?v=He([g],f):"function"==typeof f&&(v=f(v)),Ge(t,d,S.apply(void 0,v))}function rt(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 et(et({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 st(e){var t,n={},i=[],o={addCase:function(e,t){var i="string"==typeof e?e:e.type;if(i in n)throw new Error("addCase cannot be called with two reducers for the same action type");return n[i]=t,o},addMatcher:function(e,t){return i.push({matcher:e,reducer:t}),o},addDefaultCase:function(e){return t=e,o}};return e(o),[n,i,t]}function lt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");var n,i="function"==typeof e.initialState?e.initialState:it(e.initialState),o=e.reducers||{},a=Object.keys(o),r={},s={},l={};function c(){var t="function"==typeof e.extraReducers?st(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=et(et({},o),s);return function(e,t,n,i){void 0===n&&(n=[]);var o,a="function"==typeof t?st(t):[t,n,i],r=a[0],s=a[1],l=a[2];if(function(e){return"function"==typeof e}(e))o=function(){return it(e())};else{var c=it(e);o=function(){return c}}function u(e,t){void 0===e&&(e=o());var n=He([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(_(e))return void 0===(i=n(e,t))?e:i;if(M(e))return De(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?rt(c,i):rt(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 ct="listenerMiddleware";rt(ct+"/add"),rt(ct+"/removeAll"),rt(ct+"/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[be];return Ie.get(t,e)},set:function(t){var n=this[be];Ie.set(n,e,t)}},n}function t(e){for(var t=e.length-1;t>=0;t--){var o=e[t][be];if(!o.P)switch(o.i){case 5:i(o)&&se(o);break;case 4:n(o)&&se(o)}}}function n(e){for(var t=e.t,n=e.k,i=ke(n),o=i.length-1;o>=0;o--){var a=i[o];if(a!==be){var r=t[a];if(void 0===r&&!$(t,a))return!0;var s=n[a],l=s&&s[be];if(l?l.t!==r:!x(s,r))return!0}}var c=!!t[be];return i.length!==ke(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){Pe[e]||(Pe[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=Te(n);delete a[be];for(var r=ke(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:J(),P:!1,I:!1,D:{},l:n,t:t,k:o,o:null,O:!1,C:!1};return Object.defineProperty(o,be,{value:a,writable:!0}),o},S:function(e,n,o){o?_(n)&&n[be].A===e&&t(e.p):(e.u&&function e(t){if(t&&"object"==typeof t){var n=t[be];if(n){var o=n.t,a=n.k,r=n.D,s=n.i;if(4===s)N(a,(function(t){t!==be&&(void 0!==o[t]||$(o,t)?r[t]||e(a[t]):(r[t]=!0,se(n)))})),N(o,(function(e){void 0!==a[e]||$(a,e)||(r[e]=!1,se(n))}));else if(5===s){if(i(n)&&(se(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 ut=(e,t)=>n=>O({},n,{[e]:t[e]}),dt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),yt=(e,t)=>({prepare:e=>({payload:e}),reducer:(n,{payload:i})=>{var o;return O({},n,{[e]:O({},n[e],{[t]:O({},null==n||null==(o=n[e])?void 0:o[t],i)})})}}),ft=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return O({},t,{[e]:O({},t[e],{loaders:O({},t[e].loaders,{[n.key]:null==(i=n.value)||i})})})}}),pt=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>{var i;return O({},t,{[e]:O({},t[e],{errors:O({},t[e].errors,{[n.key]:null==(i=n.value)||i})})})}}),gt=(e,t,n)=>({prepare:e=>({payload:e}),reducer:(i,{payload:o})=>{var a;return O({},i,{[e]:O({},i[e],{[t]:O({},null==i||null==(a=i[e])?void 0:a[t],o,n)})})}}),St=(e,t,n)=>i=>{var o;return O({},i,{[e]:O({},i[e],{[t]:O({},null==i||null==(o=i[e])?void 0:o[t],n)})})},vt=(e=500)=>new Promise((t=>setTimeout(t,e))),ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",mt=new Uint8Array(256);for(let e=0;e<ht.length;e++)mt[ht.charCodeAt(e)]=e;const bt=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=mt[e.charCodeAt(i)],a=mt[e.charCodeAt(i+1)],r=mt[e.charCodeAt(i+2)],s=mt[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},At=e=>{if(e instanceof Array){const t=[];for(const n of e)t.push(At(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+=ht[t[i]>>2],o+=ht[(3&t[i])<<4|t[i+1]>>4],o+=ht[(15&t[i+1])<<2|t[i+2]>>6],o+=ht[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]=At(e[n]);return t}return e};let kt,Tt,Pt;!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"}(kt||(kt={})),function(e){e.Login="login",e.RegisterQuickLogin="registerQuickLogin"}(Tt||(Tt={})),function(e){e.Internal="internal",e.UsbKey="usb-key",e.Android="android",e.Sms="sms"}(Pt||(Pt={}));const It="FRONTEGG_AFTER_AUTH_REDIRECT_URL",Lt="HOSTED_LOGIN_VERIFIER_KEY",Et="auth",Ot="connectivity",wt="auditLogs",Dt="vendor",Ct={flow:Tt.Login,step:kt.preLogin,loading:!1,email:"",tenants:[]},Rt={setLoginState:dt("loginState"),resetLoginState:ut("loginState",{loginState:Ct})},Ut={requestAuthorize:rt("auth/requestAuthorize",((e=!1)=>({payload:e}))),requestAuthorizeSSR:rt("auth/requestAuthorizeSSR",(e=>({payload:e}))),requestHostedLoginAuthorize:rt("auth/requestHostedLoginAuthorize",(e=>({payload:e}))),handleHostedLoginCallback:rt("auth/handleHostedLoginCallback",(e=>({payload:e}))),afterAuthNavigation:rt("auth/afterAuthNavigation"),preLogin:rt("auth/preLogin",(e=>({payload:e}))),postLogin:rt("auth/postLogin",(e=>({payload:e}))),login:rt("auth/login",(e=>({payload:e}))),loginWithMfa:rt("auth/loginWithMfa",(e=>({payload:e}))),recoverMfa:rt("auth/recoverMfa",(e=>({payload:e}))),logout:rt("auth/logout",(e=>({payload:e}))),silentLogout:rt("auth/silentLogout",(e=>({payload:e}))),checkIfAllowToRememberMfaDevice:rt("auth/checkIfAllowToRememberMfaDevice",(e=>({payload:e}))),changePhoneNumberWithVerification:rt("auth/changePhoneNumberWithVerification",(e=>({payload:e}))),verifyChangePhoneNumber:rt("auth/verifyChangePhoneNumber",(e=>({payload:e}))),quickSmsPasswordlessPreLogin:rt("auth/quickSmsPasswordlessPreLogin",(e=>({payload:e}))),passwordlessPreLogin:rt("auth/passwordlessPreLogin",(e=>({payload:e}))),passwordlessPostLogin:rt("auth/passwordlessPostLogin",(e=>({payload:e}))),verifyInviteToken:rt("auth/verifyInviteToken",(e=>({payload:e}))),webAuthnPrelogin:rt("auth/webAuthnPrelogin",(e=>({payload:e}))),webAuthnPostLogin:rt("auth/webAuthnPostLogin",(e=>({payload:e}))),webAuthnCreateNewDeviceSession:rt("auth/webAuthnCreateNewDeviceSession",(e=>({payload:e}))),webAuthnVerifyNewDeviceSession:rt("auth/webAuthnVerifyNewDeviceSession",(e=>({payload:e}))),getUserIP:rt("auth/getUserIP",(e=>({payload:e}))),preEnrollMFAWebAuthnForLogin:rt("auth/preEnrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAWebAuthnForLogin:rt("auth/enrollWebAuthNForLogin",(e=>({payload:e}))),enrollMFAAuthenticatorAppForLogin:rt("auth/enrollMFAAuthenticatorAppForLogin",(e=>({payload:e}))),preEnrollMFASMSForLogin:rt("auth/preEnrollMFASMSForLogin",(e=>({payload:e}))),enrollMFASMSForLogin:rt("auth/enrollMFASMSForLogin",(e=>({payload:e}))),preVerifyMFAWebAuthnForLogin:rt("auth/preVerifyMFAWebAuthnForLogin",(e=>({payload:e}))),verifyMFAWebAuthnForLogin:rt("auth/verifyMFAWebAuthnForLogin",(e=>({payload:e}))),preVerifyMFASMSForLogin:rt("auth/preVerifyMFASMSForLogin",(e=>({payload:e}))),verifyMFASMSForLogin:rt("auth/verifyMFASMSForLogin",(e=>({payload:e})))};let _t;!function(e){e.activating="activating",e.success="success",e.resend="resend",e.activatingForm="activatingForm"}(_t||(_t={}));const Mt={step:_t.activating,loading:!1,resentEmail:!1,activationStrategy:{loading:!1}},Nt={setActivateState:dt("activateState"),resetActivateState:ut("activateState",{activateState:Mt}),setActivateStrategyState:yt("activateState","activationStrategy")},Ft={activateAccount:rt("auth/activateAccount",(e=>({payload:e}))),preActivateAccount:rt("auth/preActivateAccount",(e=>({payload:e}))),getActivateAccountStrategy:rt("auth/getActivateAccountStrategy",(e=>({payload:e}))),resendActivationEmail:rt("auth/resendActivationEmail",(e=>({payload:e})))};let $t;!function(e){e.validate="validate",e.invalid="invalid",e.pending="pending",e.success="success",e.failed="failed"}($t||($t={}));const Gt={step:$t.validate},xt={setAcceptInvitationState:dt("acceptInvitationState"),resetAcceptInvitationState:ut("acceptInvitationState",{acceptInvitationState:Gt})},Vt={acceptInvitation:rt("auth/acceptInvitation",(e=>({payload:e})))};let jt;!function(e){e.forgotPassword="forgotPassword",e.success="success"}(jt||(jt={}));const Wt={step:jt.forgotPassword,loading:!1,email:"",passwordConfig:null},Kt={setForgotPasswordState:dt("forgotPasswordState"),resetForgotPasswordState:ut("forgotPasswordState",{forgotPasswordState:Wt})},Bt={forgotPassword:rt("auth/forgotPassword",(e=>({payload:e}))),resetPassword:rt("auth/resetPassword",(e=>({payload:e}))),loadPasswordConfig:rt("auth/loadPasswordConfig",(e=>({payload:e})))};let zt;!function(e){e.ResetPhoneNumber="ResetPhoneNumber",e.VerifyResetPhoneNumber="VerifyResetPhoneNumber",e.ChangePhoneNumber="ChangePhoneNumber"}(zt||(zt={}));const qt={step:zt.ResetPhoneNumber,loading:!1},Ht={setResetPhoneNumberState:dt("resetPhoneNumberState"),resetResetPhoneNumberState:ut("resetPhoneNumberState",{resetPhoneNumberState:qt})},Jt={resetPhoneNumber:rt("auth/resetPhoneNumber",(e=>({payload:e}))),verifyResetPhoneNumber:rt("auth/verifyResetPhoneNumber",(e=>({payload:e}))),changePhoneNumber:rt("auth/changePhoneNumber",(e=>({payload:e})))},Yt={firstLoad:!0,loading:!0,saving:!1,errors:{},loaders:{},ssoConfigurations:[]},Qt={setSSOLoader:ft("ssoState"),setSSOError:pt("ssoState"),setSSOState:dt("ssoState"),resetSSOState:ut("ssoState",{ssoState:Yt})},Xt={loadSSOConfigurationsV2:rt("auth/loadSSOConfigurationsV2"),saveSSOConfigurationV2:rt("auth/saveSSOConfigurationV2",(e=>({payload:e}))),updateSSOConfiguration:rt("auth/updateSSOConfiguration",(e=>({payload:e}))),deleteSSOConfiguration:rt("auth/deleteSSOConfiguration",(e=>({payload:e}))),saveSSODomain:rt("auth/saveSSODomain",(e=>({payload:e}))),deleteSSODomain:rt("auth/deleteSSODomain",(e=>({payload:e}))),validateSSODomainV2:rt("auth/validateSSODomainV2",(e=>({payload:e}))),setSSODefaultRoles:rt("auth/setSSODefaultRoles",(e=>({payload:e}))),setSSOGroups:rt("auth/setSSOGroups",(e=>({payload:e}))),updateSSOGroups:rt("auth/updateSSOGroups",(e=>({payload:e}))),saveSSOConfigurationByMetadata:rt("auth/saveSSOConfigurationByMetadata",(e=>({payload:e}))),updateSSOConfigurationByMetadata:rt("auth/updateSSOConfigurationByMetadata",(e=>({payload:e}))),loadSSOConfigurations:rt("auth/loadSSOConfigurations"),loadSSOAuthorizationRoles:rt("auth/loadSSOAuthorizationRoles"),saveSSOConfigurations:rt("auth/saveSSOConfigurations",(e=>({payload:e}))),saveSSOConfigurationsFile:rt("auth/saveSSOConfigurationsFile",(e=>({payload:e}))),saveSSOConfigurationByData:rt("auth/saveSSOConfigurationByData",(e=>({payload:e}))),saveSSOConfigurationByUrl:rt("auth/saveSSOConfigurationByUrl",(e=>({payload:e}))),saveSSOConfigurationsFileWithCallback:rt("auth/saveSSOConfigurationsFileWithCallback",(e=>({payload:e}))),validateSSODomain:rt("auth/validateSSODomain",(e=>({payload:e}))),updateSSOAuthorizationRoles:rt("auth/updateSSOAuthorizationRoles",(e=>({payload:e}))),deleteSamlGroup:rt("auth/deleteSamlGroup",(e=>({payload:e}))),createSamlGroup:rt("auth/createSamlGroup",(e=>({payload:e}))),oidcPostlogin:rt("auth/oidcPostlogin",(e=>({payload:e})))},Zt={loading:!1,error:null},en={setProfileState:dt("profileState"),resetProfileState:ut("profileState",{profileState:Zt})},tn={loadProfile:rt("auth/loadProfile"),saveProfile:rt("auth/saveProfile",(e=>({payload:e}))),changePassword:rt("auth/changePassword",(e=>({payload:e})))};let nn;!function(e){e.verify="verify",e.recoveryCode="recoveryCode",e.authenticatorApp="authenticatorApp",e.smsSetPhoneNumber="smsSetPhoneNumber",e.smsVerifyCode="smsVerifyCode"}(nn||(nn={}));const on={step:nn.verify,loading:!1,saving:!1},an={setMfaState:dt("mfaState"),resetMfaState:ut("mfaState",{mfaState:on})},rn={enrollMfa:rt("auth/enrollMfa"),getMFADevices:rt("auth/getMFADevices"),getMFAStrategies:rt("auth/getMFAStrategies"),verifyMfa:rt("auth/verifyMfa",(e=>({payload:e}))),verifyMfaAfterForce:rt("auth/verifyMfaAfterForce",(e=>({payload:e}))),disableMfa:rt("auth/disableMfa",(e=>({payload:e}))),preDisableMfaSms:rt("auth/preDisableMfaSms",(e=>({payload:e}))),disableMfaSms:rt("auth/disableMfaSms",(e=>({payload:e}))),preEnrollMfaSms:rt("auth/preEnrollMfaSms",(e=>({payload:e}))),enrollMfaSms:rt("auth/enrollMfaSms",(e=>({payload:e}))),preEnrollMfaWebAuthn:rt("auth/preEnrollMfaWebAuthn",(e=>({payload:e}))),enrollMfaWebAuthn:rt("auth/enrollMfaWebAuthn",(e=>({payload:e}))),preDisableMfaWebAuthn:rt("auth/preDisableMfaWebAuthn",(e=>({payload:e}))),disableMfaWebAuthn:rt("auth/disableMfaWebAuthn",(e=>({payload:e})))},sn={loaders:{},pageOffset:0,pageSize:20,errors:{},users:[],allUsers:[],roles:[],permissions:[],totalPages:0,filter:[],sort:[],allUsersQueryParams:{_filter:null,_offset:0,_limit:20,_order:"DESC",_sortBy:"name"},addUserDialogState:{loading:!1,open:!1},deleteUserDialogState:{loading:!1,open:!1},lockUserDialogState:{loading:!1,open:!1}},ln={setTeamLoader:ft("teamState"),setTeamError:pt("teamState"),setTeamState:dt("teamState"),resetTeamState:ut("teamState",{teamState:sn})},cn={loadUsers:rt("auth/loadUsers",(e=>({payload:e}))),loadAllSubTenantsUsers:rt("auth/loadAllSubTenantsUsers",(e=>({payload:e}))),loadRoles:rt("auth/loadRoles",(e=>({payload:e}))),addUser:rt("auth/addUser",(e=>({payload:e}))),addUsersBulk:rt("auth/addUsersBulk",(e=>({payload:e}))),addUserToSubTenants:rt("auth/addUserToSubTenants",(e=>({payload:e}))),updateUser:rt("auth/updateUser",(e=>({payload:e}))),deleteUser:rt("auth/deleteUser",(e=>({payload:e}))),setUserRolesForSubTenants:rt("auth/setUserRolesForSubTenants",(e=>({payload:e}))),deleteUserFromSubTenants:rt("auth/deleteUserFromSubTenants",(e=>({payload:e}))),lockUser:rt("auth/lockUser",(e=>({payload:e}))),resendActivationLink:rt("auth/resendActivationLink",(e=>({payload:e}))),resendInvitationLink:rt("auth/resendInvitationLink",(e=>({payload:e}))),resendInvitationEmail:rt("auth/resendInvitationEmail",(e=>({payload:e}))),resendInvitationLinkToAllSubTenants:rt("auth/resendInvitationLinkToAllSubTenants",(e=>({payload:e}))),getInvitationLink:rt("auth/getInvitationLink"),createInvitationLink:rt("auth/createInvitationLink",(e=>({payload:e}))),updateInvitationLink:rt("auth/updateInvitationLink",(e=>({payload:e}))),deleteInvitationLink:rt("auth/deleteInvitationLink",(e=>({payload:e}))),openAddUserDialog:rt("auth/openAddUserDialog",(e=>({payload:e}))),closeAddUserDialog:rt("auth/closeAddUserDialog",(e=>({payload:e}))),openDeleteUserDialog:rt("auth/openDeleteUserDialog",(e=>({payload:e}))),closeDeleteUserDialog:rt("auth/closeDeleteUserDialog",(e=>({payload:e}))),openLockUserDialog:rt("auth/openLockUserDialog",(e=>({payload:e}))),closeLockUserDialog:rt("auth/closeLockUserDialog",(e=>({payload:e})))},un={firstLoad:!0,loading:!1,error:""},dn={setSocialLoginsState:dt("socialLoginState"),resetSocialLoginsState:ut("socialLoginState",{socialLoginState:un})},yn={loadSocialLoginsConfiguration:rt("auth/loadSocialLoginsConfiguration"),loadSocialLoginsConfigurationV2:rt("auth/loadSocialLoginsConfigurationV2"),loginViaSocialLogin:rt("auth/loginViaSocialLogin",(e=>({payload:e}))),setSocialLoginError:rt("auth/setSocialLoginError",(e=>({payload:e})))};let fn;!function(e){e.SignUp="SignUp",e.SignUpSuccess="SignUpSuccess"}(fn||(fn={}));const pn={loading:!1,allowSignUps:!1,allowNotVerifiedUsersLogin:!1,firstLoad:!0,stage:fn.SignUp},gn={setSignUpState:dt("signUpState"),resetSignUpState:ut("signUpState",{signUpState:pn})},Sn={signUpUser:rt("auth/signUpUser",(e=>({payload:e}))),resetSignUpStateSoft:rt("auth/resetSignUpStateSoft")},vn={apiTokenType:null,searchValue:"",showAddTokenDialog:!1,createdByUserIdColumn:"show",deleteTokenDialog:{open:!1,clientId:""},successDialog:{open:!1,secret:"",clientId:""},loaders:{},apiTokensDataTenant:[],apiTokensDataUser:[],roles:[],permissions:[],errors:{}},hn={setApiTokensLoader:ft("apiTokensState"),setApiTokensError:pt("apiTokensState"),setApiTokensState:dt("apiTokensState"),resetApiTokensState:ut("apiTokensState",{apiTokensState:vn})},mn={loadApiTokens:rt("auth/loadApiTokens",(e=>({payload:e}))),loadUserApiTokens:rt("auth/loadUserApiTokens",(e=>({payload:e}))),loadTenantApiTokens:rt("auth/loadTenantApiTokens",(e=>({payload:e}))),initApiTokensData:rt("auth/initApiTokensData",(e=>({payload:e}))),addTenantApiToken:rt("auth/addTenantApiToken",(e=>({payload:e}))),addUserApiToken:rt("auth/addUserApiToken",(e=>({payload:e}))),deleteUserApiToken:rt("auth/deleteUserApiToken",(e=>({payload:e}))),deleteTenantApiToken:rt("auth/deleteTenantApiToken",(e=>({payload:e})))},bn={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}},An={setSecurityPolicyState:dt("securityPolicyState"),setSecurityPolicyGlobalState:yt("securityPolicyState","globalPolicy"),setSecurityPolicyPublicState:yt("securityPolicyState","publicPolicy"),setSecurityPolicyAuthStrategyPublicState:yt("securityPolicyState","publicAuthStrategyPolicy"),setSecurityPolicyMfaState:yt("securityPolicyState","mfaPolicy"),setSecurityPolicyVendorMfaState:yt("securityPolicyState","vendorMfaPolicy"),setSecurityPolicyVendorLockoutState:yt("securityPolicyState","vendorLockoutPolicy"),setSecurityPolicyVendorPasswordHistoryState:yt("securityPolicyState","vendorPasswordHistoryPolicy"),setSecurityPolicyLockoutState:yt("securityPolicyState","lockoutPolicy"),setSecurityPolicyCaptchaState:yt("securityPolicyState","captchaPolicy"),setSecurityPolicyPasswordHistoryState:yt("securityPolicyState","passwordHistoryPolicy"),setSecurityPolicyPasswordState:yt("securityPolicyState","passwordPolicy"),resetSecurityPolicyState:ut("securityPolicyState",{securityPolicyState:bn})},kn={loadSecurityPolicy:rt("auth/loadSecurityPolicy"),loadPublicSecurityPolicy:rt("auth/loadPublicSecurityPolicy"),loadSecurityPolicyMfa:rt("auth/loadSecurityPolicyMfa"),loadSecurityPolicyVendorMfa:rt("auth/loadSecurityPolicyVendorMfa"),saveSecurityPolicyMfa:rt("auth/saveSecurityPolicyMfa",(e=>({payload:e}))),loadSecurityPolicyLockout:rt("auth/loadSecurityPolicyLockout"),loadSecurityPolicyVendorLockout:rt("auth/loadSecurityPolicyVendorLockout"),saveSecurityPolicyLockout:rt("auth/saveSecurityPolicyLockout",(e=>({payload:e}))),loadSecurityPolicyCaptcha:rt("auth/loadSecurityPolicyCaptcha"),loadSecurityPolicyPasswordHistory:rt("auth/loadSecurityPolicyPasswordHistory"),loadSecurityPolicyVendorPasswordHistory:rt("auth/loadSecurityPolicyVendorPasswordHistory"),saveSecurityPolicyPasswordHistory:rt("auth/saveSecurityPolicyPasswordHistory",(e=>({payload:e}))),loadVendorPasswordConfig:rt("auth/loadVendorPasswordConfig"),loadPublicAuthStrategiesPolicy:rt("auth/loadPublicAuthStrategiesPolicy")},Tn={loading:!1},Pn={setAccountSettingsState:dt("accountSettingsState"),resetAccountSettingsState:ut("accountSettingsState",{accountSettingsState:Tn})},In={loadAccountSettings:rt("auth/loadAccountSettings",(e=>({payload:e}))),saveAccountSettings:rt("auth/saveAccountSettings",(e=>({payload:e})))},Ln={tenants:[],subTenants:[],loading:!0,tenantTree:null},En={setTenantsState:dt("tenantsState"),resetTenantsState:ut("tenantsState",{tenantsState:Ln})},On={switchTenant:rt("auth/switchTenant",(e=>({payload:e}))),loadTenants:rt("auth/loadTenants",(e=>({payload:e}))),loadSubTenants:rt("auth/loadSubTenants",(e=>({payload:e}))),loadSubTenantsTree:rt("auth/loadSubTenantsTree",(e=>({payload:e})))},wn={loading:!1,roles:[],permissions:[],permissionCategories:[]},Dn={setRolesState:dt("rolesState"),resetRolesState:ut("rolesState",{rolesState:wn})},Cn={loadRolesAndPermissions:rt("auth/loadRoles",(e=>({payload:e}))),addRole:rt("auth/addRole",(e=>({payload:e}))),updateRole:rt("auth/updateRole",(e=>({payload:e}))),deleteRole:rt("auth/deleteRole",(e=>({payload:e}))),attachPermissionsToRole:rt("auth/attachPermissionsToRole",(e=>({payload:e}))),attachPermissionToRoles:rt("auth/attachPermissionToRoles",(e=>({payload:e})))},Rn={loading:!1,sessions:[]},Un={setSessionsState:dt("sessionsState"),resetSessionsState:ut("sessionsState",{sessionsState:Rn})},_n={loadUserSessions:rt("auth/loadUserSessions"),loadCurrentUserSession:rt("auth/loadCurrentUserSession"),deleteUserSession:rt("auth/deleteUserSession",(e=>({payload:e}))),deleteAllUserSessions:rt("auth/deleteAllUserSessions"),revokeUserSessions:rt("auth/revokeUserSessions",(e=>({payload:e})))},Mn={loading:!1,configurations:{}},Nn={setSessionsPolicyState:dt("sessionsPolicyState"),resetSessionsPolicyState:ut("sessionsPolicyState",{sessionsPolicyState:Mn})},Fn={loadSessionsPolicy:rt("auth/loadSessionsPolicy"),createOrUpdateSessionsPolicy:rt("auth/createOrUpdateSessionsPolicy",(e=>({payload:e})))};let $n;!function(e){e.ALLOW="ALLOW",e.BLOCK="BLOCK"}($n||($n={}));const Gn={ipRestrictions:{loading:!1,pagination:{_offset:0,_limit:4,_filter:$n.ALLOW},totalPages:1,userIpValid:!1},emailDomainRestrictions:{loading:!0}},xn={setRestrictionsState:dt("restrictionsState"),setIpRestrictionsState:yt("restrictionsState","ipRestrictions"),setEmailDomainRestrictionsState:yt("restrictionsState","emailDomainRestrictions")},Vn={checkIfUserIpValid:rt("auth/checkIfUserIpValid"),addCurrentUserIpAndActivate:rt("auth/addCurrentUserIpAndActivate",(e=>({payload:e}))),loadIpRestrictions:rt("auth/loadIpRestrictions"),saveIpRestriction:rt("auth/saveIpRestriction",(e=>({payload:e}))),saveIpRestrictionsConfig:rt("auth/saveIpRestrictionsConfig",(e=>({payload:e}))),deleteIpRestriction:rt("auth/deleteIpRestriction",(e=>({payload:e}))),loadEmailDomainRestrictions:rt("auth/loadEmailDomainRestrictions"),saveEmailDomainRestriction:rt("auth/saveEmailDomainRestriction",(e=>({payload:e}))),saveEmailDomainRestrictionsConfig:rt("auth/saveEmailDomainRestrictionsConfig",(e=>({payload:e}))),deleteEmailDomainRestriction:rt("auth/deleteEmailDomainRestriction",(e=>({payload:e})))},jn={loading:!1},Wn={setProvisioningState:dt("provisioningState"),resetProvisioningState:ut("provisioningState",{provisioningState:jn})},Kn={loadProvisionConnections:rt("auth/loadProvisionConnections"),createProvisionConnection:rt("auth/createProvisionConnection",(e=>({payload:e}))),deleteProvisionConnection:rt("auth/deleteProvisionConnection",(e=>({payload:e}))),updateProvisionConnection:rt("auth/updateProvisionConnection",(e=>({payload:e})))},Bn={devices:[],loading:!1,error:null},zn={setPasskeysState:dt("passkeysState"),resetPasskeysState:ut("passkeysState",{passkeysState:Bn})},qn={loadWebAuthnDevices:rt("auth/loadWebAuthnDevices"),deleteWebAuthnDevice:rt("auth/deleteWebAuthnDevice",(e=>({payload:e})))},Hn={loaders:{},errors:{},groups:[],groupsConfiguration:{}},Jn={setUsersGroupsLoader:ft("groupsState"),setUsersGroupsError:pt("groupsState"),setGroupsState:dt("groupsState"),resetUsersGroupsState:ut("groupsState",{groupsState:Hn})},Yn={loadGroups:rt("auth/loadUsersGroups"),getGroupById:rt("auth/getGroupById",(e=>({payload:e}))),createGroup:rt("auth/createGroup",(e=>({payload:e}))),updateGroup:rt("auth/updateGroup",(e=>({payload:e}))),deleteGroup:rt("auth/deleteGroup",(e=>({payload:e}))),addRolesToGroup:rt("auth/addRolesToGroup",(e=>({payload:e}))),deleteRolesFromGroup:rt("auth/deleteRolesFromGroup",(e=>({payload:e}))),addUsersToGroup:rt("auth/addUsersToGroup",(e=>({payload:e}))),deleteUsersFromGroup:rt("auth/deleteUsersFromGroup",(e=>({payload:e}))),getGroupConfiguration:rt("auth/getGroupConfiguration"),updateGroupConfiguration:rt("auth/updateGroupConfiguration",(e=>({payload:e}))),getTeamUsers:rt("auth/getUsers",(e=>({payload:e})))},Qn={addGroupDialogState:{loading:!1,open:!1},editGroupDialogState:{loading:!1,open:!1},deleteGroupDialogState:{loading:!1,open:!1},addMembersToGroupDialogState:{loading:!1,open:!1,userIds:[]},deleteMemberFromGroupDialogState:{loading:!1,open:!1}},Xn={setGroupsDialogsState:dt("groupsDialogsState"),resetGroupsDialogsState:ut("groupsState",{groupsDialogsState:Qn}),openAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!0}),closeAddGroupDialog:St("groupsDialogsState","addGroupDialogState",{open:!1}),openEditGroupDialog:gt("groupsDialogsState","editGroupDialogState",{open:!0}),closeEditGroupDialog:St("groupsDialogsState","editGroupDialogState",{open:!1,loading:!1,group:void 0}),openDeleteGroupDialog:gt("groupsDialogsState","deleteGroupDialogState",{open:!0}),closeDeleteGroupDialog:St("groupsDialogsState","deleteGroupDialogState",{open:!1,loading:!1,group:void 0}),openAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!0}),closeAddMembersToGroupDialog:St("groupsDialogsState","addMembersToGroupDialogState",{open:!1,userIds:[]}),openDeleteMemberFromGroupDialog:gt("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!0}),closeDeleteMemberFromGroupDialog:St("groupsDialogsState","deleteMemberFromGroupDialogState",{open:!1,userId:void 0})},Zn={isAuthenticated:!1,isLoading:!0,isSSOAuth:!1,user:null,signUpState:pn,loginState:Ct,activateState:Mt,acceptInvitationState:Gt,forgotPasswordState:Wt,ssoState:Yt,profileState:Zt,mfaState:on,teamState:sn,groupsState:Hn,groupsDialogsState:Qn,socialLoginState:un,apiTokensState:vn,securityPolicyState:bn,accountSettingsState:Tn,tenantsState:Ln,rolesState:wn,resetPhoneNumberState:qt,sessionsState:Rn,sessionsPolicyState:Mn,restrictionsState:Gn,provisioningState:jn,passkeysState:Bn},ei=O({routes:{authenticatedUrl:"/",loginUrl:"/account/login",logoutUrl:"/account/logout",activateUrl:"/account/activate",impersonationUrl:"/account/impersonate",acceptInvitationUrl:"/account/invitation/accept",forgetPasswordUrl:"/account/forget-password",resetPhoneNumberUrl:"/account/reset-phone-number",resetPasswordUrl:"/account/reset-password",socialLoginCallbackUrl:"/account/social/success",signUpUrl:"/account/sign-up",oidcRedirectUrl:"/account/oidc/callback",samlCallbackUrl:"/account/saml/callback",magicLinkCallbackUrl:"/account/login/magic-link",hostedLoginRedirectUrl:"/oauth/callback"},onRedirectTo:()=>{}},Zn);let ti;!function(e){e.impersonating="impersonating",e.success="success"}(ti||(ti={}));const ni={step:ti.impersonating,loading:!1},ii={setImpersonateState:dt("impersonateState"),resetImpersonateState:ut("impersonateState",{impersonateState:ni})},oi={impersonate:rt("impersonation/impersonate",(e=>({payload:e})))},{reducer:ai,actions:ri}=lt({name:Et,initialState:ei,reducers:O({resetState:e=>O({},e,Zn),setState:(e,{payload:t})=>O({},e,t),setUser:("user",(e,{payload:t})=>O({},e,{user:t}))},Rt,dn,Nt,ii,xt,Kt,Ht,gn,en,Qt,an,ln,Jn,Xn,hn,An,Pn,En,Dn,Un,Nn,xn,Wn,zn)});const si=O({},ri,Ut,yn,Ft,Vt,Bt,Jt,Sn,tn,Xt,rn,cn,Yn,{},mn,kn,In,On,Cn,_n,Fn,Vn,Kn,oi,qn);var li=function(e){return"@@redux-saga/"+e},ci=li("CANCEL_PROMISE"),ui=li("CHANNEL_END"),di=li("IO"),yi=li("MATCH"),fi=li("MULTICAST"),pi=li("SAGA_ACTION"),gi=li("SELF_CANCELLATION"),Si=li("TASK"),vi=li("TASK_CANCEL"),hi=li("TERMINATE"),mi=li("LOCATION");function bi(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 Ai=function(e){return null==e},ki=function(e){return null!=e},Ti=function(e){return"function"==typeof e},Pi=function(e){return"string"==typeof e},Ii=Array.isArray,Li=function(e){return e&&Ti(e.then)},Ei=function(e){return e&&Ti(e.next)&&Ti(e.throw)},Oi=function e(t){return t&&(Pi(t)||Ci(t)||Ti(t)||Ii(t)&&t.every(e))},wi=function(e){return e&&Ti(e.take)&&Ti(e.close)},Di=function(e){return Ti(e)&&e.hasOwnProperty("toString")},Ci=function(e){return Boolean(e)&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},Ri=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[ci]=function(){clearTimeout(n)},i},Ui=function(e){return function(){return e}},_i=Ui(!0),Mi=function(){},Ni=function(e){return e};"function"==typeof Symbol&&Symbol.asyncIterator&&Symbol.asyncIterator;var Fi=function(e,t){O(e,t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach((function(n){e[n]=t[n]}))};function $i(e,t){var n=e.indexOf(t);n>=0&&e.splice(n,1)}var Gi=function(e){throw e},xi=function(e){return{value:e,done:!0}};function Vi(e,t,n){void 0===t&&(t=Gi),void 0===n&&(n="iterator");var i={meta:{name:n},next:e,throw:t,return:xi,isSagaIterator:!0};return"undefined"!=typeof Symbol&&(i[Symbol.iterator]=function(){return i}),i}function ji(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var Wi=function(e){return Array.apply(null,new Array(e))},Ki=function(e){return function(t){return e(Object.defineProperty(t,pi,{value:!0}))}},Bi=function(e){return e===hi},zi=function(e){return e===vi},qi=function(e){return Bi(e)||zi(e)};function Hi(e,t){var n,i=Object.keys(e),o=i.length,a=0,r=Ii(e)?Wi(o):{},s={};return i.forEach((function(e){var i=function(i,s){n||(s||qi(i)?(t.cancel(),t(i,s)):(r[e]=i,++a===o&&(n=!0,t(r))))};i.cancel=Mi,s[e]=i})),t.cancel=function(){n||(n=!0,i.forEach((function(e){return s[e].cancel()})))},s}function Ji(e){return{name:e.name||"anonymous",location:Yi(e)}}function Yi(e){return e[mi]}var Qi=function(e){return function(e,t){void 0===e&&(e=10);var n=new Array(e),i=0,o=0,a=0,r=function(t){n[o]=t,o=(o+1)%e,i++},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)},Xi="TAKE",Zi="CALL",eo="FORK",to="SELECT",no=function(e,t){var n;return(n={})[di]=!0,n.combinator=!1,n.type=e,n.payload=t,n};function io(e,t){return void 0===e&&(e="*"),Oi(e)?(ki(t)&&console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types"),no(Xi,{pattern:e})):wi(n=e)&&n[fi]&&ki(t)&&Oi(t)?no(Xi,{channel:e,pattern:t}):wi(e)?(ki(t)&&console.warn("take(channel) takes one argument but two were provided. Second argument is ignored."),no(Xi,{channel:e})):void 0;var n}function oo(e,t){return Ai(t)&&(t=e,e=void 0),no("PUT",{channel:e,action:t})}function ao(e){var t=no("ALL",e);return t.combinator=!0,t}function ro(e,t){var n,i=null;return Ti(e)?n=e:(Ii(e)?(i=e[0],n=e[1]):(i=e.context,n=e.fn),i&&Pi(n)&&Ti(i[n])&&(n=i[n])),{context:i,fn:n,args:t}}function so(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 no(Zi,ro(e,n))}function lo(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return no(eo,ro(e,n))}function co(e){return void 0===e&&(e=gi),no("CANCEL",e)}function uo(e){void 0===e&&(e=Ni);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return no(to,{selector:e,args:n})}var yo=so.bind(null,Ri);var fo=function(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e},po=[],go=0;function So(e){try{mo(),e()}finally{bo()}}function vo(e){po.push(e),go||(mo(),Ao())}function ho(e){try{return mo(),e()}finally{Ao()}}function mo(){go++}function bo(){go--}function Ao(){var e;for(bo();!go&&void 0!==(e=po.shift());)So(e)}var ko=function(e){return function(t){return e.some((function(e){return Eo(e)(t)}))}},To=function(e){return function(t){return e(t)}},Po=function(e){return function(t){return t.type===String(e)}},Io=function(e){return function(t){return t.type===e}},Lo=function(){return _i};function Eo(e){var t="*"===e?Lo:Pi(e)?Po:Ii(e)?ko:Di(e)?Po:Ti(e)?To:Ci(e)?Io:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var Oo={type:ui},wo=function(e){return e&&e.type===ui};function Do(){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(Oo)}))},(e={})[fi]=!0,e.put=function(e){if(!t)if(wo(e))a();else for(var o=n=i,r=0,s=o.length;r<s;r++){var l=o[r];l[yi](e)&&(l.cancel(),l(e))}},e.take=function(e,n){var a;void 0===n&&(n=Lo),t?e(Oo):(e[yi]=n,o(),i.push(e),e.cancel=(a=!1,function(){a||(a=!0,o(),$i(i,e))}))},e.close=a,e),s=r.put;return r.put=function(e){e[pi]?s(e):vo((function(){s(e)}))},r}function Co(e,t){var n=e[ci];Ti(n)&&(t.cancel=n),e.then(t,(function(e){t(e,!0)}))}var Ro,Uo=0,_o=function(){return++Uo};function Mo(e){e.isRunning()&&e.cancel()}var No=((Ro={}).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):!wo(e)||r?n(e):n(hi)};try{o.take(s,ki(a)?Eo(a):null)}catch(e){return void n(e,!0)}n.cancel=s.cancel},Ro.PUT=function(e,t,n){var i=t.channel,o=t.action,a=t.resolve;vo((function(){var t;try{t=(i?i.put:e.dispatch)(o)}catch(e){return void n(e,!0)}a&&Li(t)?Co(t,n):n(t)}))},Ro.ALL=function(e,t,n,i){var o=i.digestEffect,a=Uo,r=Object.keys(t);if(0!==r.length){var s=Hi(t,n);r.forEach((function(e){o(t[e],a,s[e],e)}))}else n(Ii(t)?[]:{})},Ro.RACE=function(e,t,n,i){var o=i.digestEffect,a=Uo,r=Object.keys(t),s=Ii(t)?Wi(r.length):{},l={},c=!1;r.forEach((function(e){var t=function(t,i){c||(i||qi(t)?(n.cancel(),n(t,i)):(n.cancel(),c=!0,s[e]=t,n(s)))};t.cancel=Mi,l[e]=t})),n.cancel=function(){c||(c=!0,r.forEach((function(e){return l[e].cancel()})))},r.forEach((function(e){c||o(t[e],a,l[e],e)}))},Ro.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(Li(l))return void Co(l,n);if(Ei(l))return void zo(e,l,s.context,Uo,Ji(a),!1,n);n(l)}catch(e){n(e,!0)}},Ro.CPS=function(e,t,n){var i=t.context,o=t.fn,a=t.args;try{var r=function(e,t){Ai(e)?n(t):n(e,!0)};o.apply(i,a.concat(r)),r.cancel&&(n.cancel=r.cancel)}catch(e){n(e,!0)}},Ro.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(Ei(o))return o;var a=!1;return Vi((function(e){return a?{value:e,done:!0}:(a=!0,{value:o,done:!Li(o)})}))}catch(e){return Vi((function(){throw e}))}}({context:o,fn:a,args:r}),u=function(e,t){return e.isSagaIterator?{name:e.meta.name}:Ji(t)}(c,a);ho((function(){var t=zo(e,c,l.context,Uo,u,s,void 0);s?n(t):t.isRunning()?(l.queue.addTask(t),n(t)):t.isAborted()?l.queue.abort(t.error()):n(t)}))},Ro.JOIN=function(e,t,n,i){var o=i.task,a=function(e,t){if(e.isRunning()){var n={task:o,cb:t};t.cancel=function(){e.isRunning()&&$i(e.joiners,n)},e.joiners.push(n)}else e.isAborted()?t(e.error(),!0):t(e.result())};if(Ii(t)){if(0===t.length)return void n([]);var r=Hi(t,n);t.forEach((function(e,t){a(e,r[t])}))}else a(t,n)},Ro.CANCEL=function(e,t,n,i){var o=i.task;t===gi?Mo(o):Ii(t)?t.forEach(Mo):Mo(t),n()},Ro.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)}},Ro.ACTION_CHANNEL=function(e,t,n){var i=t.pattern,o=function(e){void 0===e&&(e=Qi());var t=!1,n=[];return{take:function(i){t&&e.isEmpty()?i(Oo):e.isEmpty()?(n.push(i),i.cancel=function(){$i(n,i)}):i(e.take())},put:function(i){if(!t){if(0===n.length)return e.put(i);n.shift()(i)}},flush:function(n){t&&e.isEmpty()?n(Oo):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])(Oo)}}}}(t.buffer),a=Eo(i),r=function t(n){wo(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)},Ro.CANCELLED=function(e,t,n,i){n(i.task.isCancelled())},Ro.FLUSH=function(e,t,n){t.flush(n)},Ro.GET_CONTEXT=function(e,t,n,i){n(i.task.context[t])},Ro.SET_CONTEXT=function(e,t,n,i){var o=i.task;Fi(o.context,t),n()},Ro);function Fo(e,t){return e+"?"+t}function $o(e){var t=e.name,n=e.location;return n?t+" "+Fo(n.fileName,n.lineNumber):t}function Go(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 xo=null,Vo=[],jo=function(e){e.crashedEffect=xo,Vo.push(e)},Wo=function(){xo=null,Vo.length=0},Ko=function(){var e,t,n=Vo[0],i=Vo.slice(1),o=n.crashedEffect?(e=n.crashedEffect,(t=Yi(e))?t.code+" "+Fo(t.fileName,t.lineNumber):""):null;return["The above error occurred in task "+$o(n.meta)+(o?" \n when executing effect "+o:"")].concat(i.map((function(e){return" created by "+$o(e.meta)})),[Go(Vo)]).join("\n")};function Bo(e,t,n,i,o,a,r){var s;void 0===r&&(r=Mi);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||($i(o,t),t.cont=Mi,l?r(s):(t===e&&(i=s),o.length||(a=!0,n(i))))}}function l(){a||(a=!0,o.forEach((function(e){e.cont=Mi,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,jo({meta:o,cancelledTasks:y}),S.isRoot){var i=Ko();Wo(),e.onError(t,{sagaStack:i})}c=t,d&&d.reject(t)}else t===vi?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={})[Si]=!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(vi,!1))},s.cont=r,s.end=g,s.setContext=function(e){Fi(f,e)},s.toPromise=function(){return d||(d=fo(),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 zo(e,t,n,i,o,a,r){var s=e.finalizeRunEffect((function(t,n,i){Li(t)?Co(t,i):Ei(t)?zo(e,t,c.context,n,o,!1,i):t&&t[di]?(0,No[t.type])(e,t.payload,i,u):i(t)}));d.cancel=Mi;var l={meta:o,cancel:function(){0===l.status&&(l.status=1,d(vi))},status:0},c=Bo(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),Wo()):zi(e)?(l.status=1,d.cancel(),o=Ti(t.return)?t.return(vi):{done:!0,value:vi}):o=Bi(e)?Ti(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=_o();function l(n,o){a||(a=!0,i.cancel=Mi,e.sagaMonitor&&(o?e.sagaMonitor.effectRejected(r,n):e.sagaMonitor.effectResolved(r,n)),o&&function(e){xo=e}(t),i(n,o))}e.sagaMonitor&&e.sagaMonitor.effectTriggered({effectId:r,parentEffectId:n,label:o,effect:t}),l.cancel=Mi,i.cancel=function(){a||(a=!0,l.cancel(),l.cancel=Mi,e.sagaMonitor&&e.sagaMonitor.effectCancelled(r))},s(t,r,l)}}function qo(e,t){for(var n=e.channel,i=void 0===n?Do():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?ji: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=_o();if(l&&(l.rootSagaStarted=l.rootSagaStarted||Mi,l.effectTriggered=l.effectTriggered||Mi,l.effectResolved=l.effectResolved||Mi,l.effectRejected=l.effectRejected||Mi,l.effectCancelled=l.effectCancelled||Mi,l.actionDispatched=l.actionDispatched||Mi,l.rootSagaStarted({effectId:v,saga:t,args:f})),c){var h=Ve.apply(void 0,c);g=function(e){return function(t,n,i){return h((function(t){return e(t,n,i)}))(t)}}}else g=Ni;var m={channel:i,dispatch:Ki(o),getState:a,sagaMonitor:l,onError:d,finalizeRunEffect:g};return ho((function(){var e=zo(m,S,s,v,Ji(t),!0,void 0);return l&&l.effectResolved(v,e),e}))}var Ho=function(e){var t,n=void 0===e?{}:e,i=n.context,o=void 0===i?{}:i,a=n.channel,r=void 0===a?Do():a,s=n.sagaMonitor,l=bi(n,["context","channel","sagaMonitor"]);function c(e){var n=e.getState,i=e.dispatch;return t=qo.bind(null,O({},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){Fi(o,e)},c},Jo=function(e){return{done:!0,value:e}},Yo={};function Qo(e){return wi(e)?"channel":Di(e)?String(e):Ti(e)?e.name:String(e)}function Xo(e,t,n){var i,o,a,r=t;function s(t,n){if(r===Yo)return Jo(t);if(n&&!o)throw r=Yo,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===Yo?Jo(t):a}return Vi(s,(function(e){return s(null,e)}),n)}function Zo(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:io(e)},s=function(e){return{done:!1,value:lo.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeEvery("+Qo(e)+", "+t.name+")")}function ea(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r,s={done:!1,value:io(e)},l=function(e){return{done:!1,value:lo.apply(void 0,[t].concat(i,[e]))}},c=function(e){return{done:!1,value:co(e)}},u=function(e){return a=e},d=function(e){return r=e};return Xo({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("+Qo(e)+", "+t.name+")")}function ta(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var a,r={done:!1,value:io(e)},s=function(e){return{done:!1,value:so.apply(void 0,[t].concat(i,[e]))}},l=function(e){return a=e};return Xo({q1:function(){return{nextState:"q2",effect:r,stateUpdater:l}},q2:function(){return{nextState:"q1",effect:s(a)}}},"q1","takeLeading("+Qo(e)+", "+t.name+")")}function na(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:so.apply(void 0,[n].concat(a))},l={done:!1,value:yo(t)};return Xo({q1:function(){return{nextState:"q2",effect:s,errorState:"q10"}},q2:function(){return{nextState:Yo}},q10:function(e){if((i-=1)<=0)throw e;return{nextState:"q1",effect:l}}},"q1","retry("+n.name+")")}function ia(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return lo.apply(void 0,[Zo,e,t].concat(i))}function oa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return lo.apply(void 0,[ea,e,t].concat(i))}function aa(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return lo.apply(void 0,[ta,e,t].concat(i))}class ra{constructor(){this.context=null,this.accessToken=null,this.user=null,this.onRedirectTo=e=>window.location.href=e,this.logout=()=>window.location.href="/account/logout"}static getInstance(){return ra.instance||(ra.instance=new ra),ra.instance}static setContext(e){ra.getInstance().context=e}static setAccessToken(e){ra.getInstance().accessToken=e}static setUser(e){ra.getInstance().user=e}static setOnRedirectTo(e){ra.getInstance().onRedirectTo=e}static setLogout(e,t){ra.getInstance().logout=n=>{n?e(n):ra.onRedirectTo(t)}}static getContext(){var e;return null!=(e=ra.getInstance().context)?e:{baseUrl:window.location.href,tokenResolver:()=>"my-authentication-token",logLevel:"error"}}static getAccessToken(){return ra.getInstance().accessToken}static getUser(){return ra.getInstance().user}static onRedirectTo(e,t){return ra.getInstance().onRedirectTo(e,t)}static logout(e){return ra.getInstance().logout(e)}}ra.instance=void 0;const sa={getContext:()=>ra.getContext(),getAccessToken:()=>ra.getAccessToken(),getUser:()=>ra.getUser(),onRedirectTo:(e,t)=>ra.onRedirectTo(e,t),logout:e=>ra.logout(e)};class la extends Error{constructor(e,t){super(e),this._statusCode=void 0,this._statusCode=t}get statusCode(){return this._statusCode}}function ca(e,t,n=!0){let i;i="function"==typeof e.baseUrl?e.baseUrl(t):e.baseUrl;const o=e.urlPrefix||"frontegg",a="frontegg"===o&&!n;return i.endsWith("/")||(i+="/"),i.endsWith(o)||a||(i+=o),i}const ua=async e=>{var t,n,i;const o=ra.getContext(),a=await async function(e,t){var n;const i=await(null!=(n=null==e?void 0:e.tokenResolver)?n:ra.getAccessToken)(),o={};i&&(o.Authorization=`Bearer ${i}`),t&&(o["Content-Type"]=t);for(const t of await async function(e){let t=[];if(e.additionalHeadersResolver&&(t=await e.additionalHeadersResolver()),e.tenantResolver){const n=await e.tenantResolver();null!=n&&n.tenant&&t.push({key:"frontegg-login-alias",value:n.tenant})}return t}(e))o[`${t.key}`]=`${t.value}`;return o["x-frontegg-source"]="frontegg-react",o}(o,e.contentType),r=await async function(e,t,n){const i=ca(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:O({},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 la("Error request is too large",s.status);let e;try{e=await s.text(),e=JSON.parse(e)}catch(e){}throw e.errors?e=e.errors.join(", "):"string"!=typeof e&&(e=`Error ${s.status} - ${s.statusText}`),s.status>=400&&s.status<500&&["warn"].includes(null!=(l=o.logLevel)?l:"")?console.warn(e):500===s.status&&["warn","error"].includes(null!=(c=o.logLevel)?c:"")&&console.error(e),new la(e,s.status)}if(e.responseType&&"json"!==e.responseType){if("blob"===e.responseType){const{outputFileName:t}=e.params;return await s.blob().then((e=>URL.createObjectURL(e))).then((e=>{const n=document.createElement("a");n.href=e,n.setAttribute("download",t||"output"),n.click()}))}return await s.text()}try{return await s.json()}catch(e){return{}}},da=async(e,t,n)=>ua(O({url:e,method:"GET",contentType:"application/json",params:t},n)),ya=async(e,t,n)=>ua(O({url:e,method:"POST",contentType:"application/json",body:t},n)),fa=async(e,t,n)=>ua(O({url:e,method:"PATCH",contentType:"application/json",body:t},n)),pa=async(e,t,n)=>ua(O({url:e,method:"PUT",contentType:"application/json",body:t},n)),ga=async(e,t,n)=>ua(O({url:e,method:"DELETE",contentType:"application/json",body:t},n)),Sa=async(e,t,n,i)=>ua(O({url:e,method:"POST",contentType:"application/json",responseType:"blob",body:t,params:n},i)),va={v1:"/identity/resources/users/webauthn/v1/devices"},ha={v1:"/identity/resources/auth/v1",v2:"/identity/resources/auth/v2"},ma={v1:"/identity/resources/users/v1",v2:"/identity/resources/users/v2",apiTokens:{v1:"/identity/resources/users/api-tokens/v1"},accessTokens:{v1:"/identity/resources/users/access-tokens/v1"},sessions:{v1:"/identity/resources/users/sessions/v1",currentUser:{v1:"/identity/resources/users/sessions/v1/me"},configurations:{v1:"/identity/resources/configurations/sessions/v1"}},invitation:{resendAll:{v1:"/identity/resources/users/v1/invitation/reset/all"}}},ba={v1:"/identity/resources/configurations/v1"},Aa={emailDomain:{v1:"/identity/resources/configurations/restrictions/v1/email-domain"},ip:{v1:"/identity/resources/configurations/v1/restrictions/ip"}},ka={v1:"/identity/resources/sso/v1",v2:"/identity/resources/sso/v2",custom:{v1:"/identity/resources/sso/custom/v1"}},Ta={v1:"/identity/resources/permissions/v1"},Pa={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"}}},Ia={v1:"/identity/resources/roles/v1"},La={v1:"/identity/resources/sub-tenants/users/v1"},Ea={v1:"/identity/resources/impersonation/v1"},Oa={v1:"/identity/resources/groups/v1",configurations:{v1:"/identity/resources/groups/v1/config"},getByIds:{v1:"/identity/resources/groups/v1/bulkGet"}},wa={v1:"/team/resources/sso/v1",v2:"/team/resources/sso/v2"},Da={v1:"/team/resources/members/v1"},Ca={v1:"/team/resources/roles/v1"},Ra={v1:"/team/resources/stats/v1"},Ua={v1:"/team/resources/profile"},_a={v1:"/tenants/resources/account-settings/v1"},Ma={v1:"/tenants/resources/hierarchy/v1",tree:{v1:"/tenants/resources/hierarchy/v1/tree"}},Na={v1:"/integrations/resources/configurations/v1",v2:"/integrations/resources/configurations/v2"},Fa={subscriptions:{v1:"/subscriptions/resources/billing/subscriptions/v1"},plans:{v1:"/subscriptions/resources/billing/plans/v1"},invoices:{v1:"/subscriptions/resources/billing/invoices/v1"},paymentMethods:{v1:"/subscriptions/resources/billing/payment-methods/v1"},summaries:{v1:"/subscriptions/resources/billing/summaries/v1"},tenantConfiguration:{v1:"/subscriptions/resources/billing/tenant-configurations/v1"},configurations:{vendorPublicConfigurations:{v1:"/subscriptions/resources/billing/configurations/vendor-public-configurations/v1"}},paymentProviders:{stripe:{customers:{v1:"/subscriptions/resources/billing/payment-providers/stripe/customers/v1"},publicConfigurations:{v1:"/subscriptions/resources/billing/payment-providers/stripe/public-configurations/v1"},subscriptions:{v1:"/subscriptions/resources/billing/payment-providers/stripe/subscriptions/v1"},setupIntents:{v1:"/subscriptions/resources/billing/payment-providers/stripe/setup-intents/v1"}}}},$a={v1:"/subscriptions/resources/payment-providers/v1"},Ga={v1:"/subscriptions/resources/subscriptions/v1"},xa={v1:"/reports/resources/reports/v1",v2:"/reports/resources/reports/v2"},Va={v1:"/reports/engine/resources/triggers/v1"},ja="/notification",Wa="/audits",Ka={v1:"/event/resources/configurations/v1"},Ba="/webhook",za="/oauth",qa="/flags",Ha="/directory/resources/v1/configurations/scim2",Ja="/directory/resources/scim/temp";async function Ya(e){return pa(`${ma.v1}/tenant`,e)}async function Qa(){return da(`${ma.v2}/me/tenants`)}async function Xa(){return da(Ma.v1)}async function Za(){return da(Ma.tree.v1)}async function er(){return da(ba.v1)}async function tr(){return da(`${ba.v1}/mfa-policy`)}async function nr(){return da(`${ba.v1}/mfa-policy/vendor`)}async function ir(e){return e.id?fa(`${ba.v1}/mfa-policy`,e):ya(`${ba.v1}/mfa-policy`,e)}async function or(){return da(`${ba.v1}/lockout-policy`)}async function ar(){return da(`${ba.v1}/lockout-policy/vendor`)}async function rr(e){return e.id?fa(`${ba.v1}/lockout-policy`,e):ya(`${ba.v1}/lockout-policy`,e)}async function sr(){try{return await da(`${ba.v1}/captcha-policy/public`)}catch{return null}}async function lr(){return da(`${ba.v1}/password-history-policy`)}async function cr(){return da(`${ba.v1}/password-history-policy/vendor`)}async function ur(e){return e.id?fa(`${ba.v1}/password-history-policy`,e):ya(`${ba.v1}/password-history-policy`,e)}async function dr(){return da(`${ba.v1}/password`)}async function yr(){return da(`${Aa.emailDomain.v1}`)}async function fr(){return da(`${Aa.emailDomain.v1}/config`)}async function pr(e){return ya(`${Aa.emailDomain.v1}`,e)}async function gr(e){return ya(`${Aa.emailDomain.v1}/config`,e)}async function Sr(e){return ga(`${Aa.emailDomain.v1}/${e}`)}async function vr(e){return da(`${Aa.ip.v1}`,e)}async function hr(){return da(`${Aa.ip.v1}/config`)}async function mr(e){return ya(`${Aa.ip.v1}`,e)}async function br(e){return ya(`${Aa.ip.v1}/bulk`,e)}async function Ar(e){return ya(`${Aa.ip.v1}/config`,e)}async function kr(e){return ga(`${Aa.ip.v1}/${e}`)}async function Tr(){return ya(`${Aa.ip.v1}/verify`)}async function Pr(){return ya(`${Aa.ip.v1}/verify/allow`)}let Ir,Lr,Er;!function(e){e.Microsoft="microsoft",e.Facebook="facebook",e.Google="google",e.Github="github",e.Slack="slack",e.Apple="apple",e.Linkedin="linkedin"}(Ir||(Ir={})),function(e){e.EmailAndPassword="EmailAndPassword",e.MagicLink="MagicLink",e.Code="Code",e.NoLocalAuthentication="NoLocalAuthentication",e.SmsCode="SmsCode"}(Lr||(Lr={})),function(e){e.ClientCredentials="ClientCredentials",e.AccessToken="AccessToken"}(Er||(Er={}));class Or extends Error{constructor(e){super(e)}}const wr="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){const t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Or("'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 Dr extends Error{constructor(e){super(e)}}const Cr=(e,t={})=>{const n=t.header?0:1;try{return JSON.parse((e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(wr(e).replace(/(.)/g,((e,t)=>{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return wr(t)}})(e.split(".")[n]))}catch(e){throw new Dr("Invalid token specified: "+e.message)}},Rr=["type"],Ur=["type"];async function _r(e){if(!e.accessToken)return e;ra.setAccessToken(e.accessToken);const t=await da(`${ma.v2}/me`),n=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(n),n}async function Mr(e){if(!e.accessToken)return{user:e};ra.setAccessToken(e.accessToken);const[t,n]=await Promise.all([da(`${ma.v2}/me`),Qa()]),i=O({},e,e.accessToken?Cr(e.accessToken):{},t);return ra.setUser(i),{user:i,tenants:n}}async function Nr(e){ra.setAccessToken(e.id_token);const t=await da(`${ma.v2}/me`),n=e.id_token?Cr(e.id_token):{},i=O({mfaRequired:!1,accessToken:e.id_token,refreshToken:e.refresh_token},n,t,{expiresIn:n.exp?Math.ceil(n.exp-(new Date).getTime()/1e3):300});return ra.setUser(i),i}async function Fr(e){try{const{address:t}=await ya(`${ha.v1}/user/saml/prelogin`,e);return t}catch{return null}}async function $r(e){return ya(`${ha.v1}/user/saml/prelogin`,e)}async function Gr(e){return _r(await ya(`${ha.v1}/user/saml/postlogin`,e))}async function xr(e){return _r(await ya(`${ha.v1}/user/oidc/postlogin`,e))}async function Vr(e){return _r(await ya(`${ha.v1}/user`,e))}async function jr(e){return _r(await ya(`${ha.v1}/user/mfa/verify`,e))}async function Wr(e){return ya(`${ma.v1}/activate`,e)}async function Kr(e){return da(`${ma.v1}/activate/strategy`,e)}async function Br(e){return ya(`${ma.v1}/activate/reset`,e)}async function zr(e){return ya(`${ma.v1}/invitation/reset`,e)}async function qr(e){return ya(`${ma.v1}/invitation/accept`,e)}async function Hr(){return _r(await ya(`${ha.v1}/user/token/refresh`))}async function Jr(){return Mr(await ya(`${ha.v1}/user/token/refresh`))}async function Yr(){return ya(`${ha.v1}/logout`)}async function Qr(e){return da(`${za}/logout`,e)}async function Xr(e){return ya(`${ma.v1}/passwords/reset`,e)}async function Zr(e){return ya(`${ma.v1}/passwords/reset/verify`,e)}async function es(e){return da(`${ma.v1}/passwords/config`,e)}async function ts(e){return ya(`${ha.v1}/user/mfa/recover`,e)}async function ns(){return ya(`${ma.v1}/mfa/enroll`)}async function is(){return ya(`${ma.v1}/mfa/authenticator/enroll`)}async function os(e){return ya(`${ma.v1}/mfa/authenticator/enroll/verify`,e)}async function as(e){return ya(`${ma.v1}/mfa/sms/enroll`,e)}async function rs(e){return ya(`${ma.v1}/mfa/sms/enroll/verify`,e)}async function ss(){return ya(`${ma.v1}/mfa/webauthn/enroll`)}async function ls(e){return ya(`${ma.v1}/mfa/webauthn/enroll/verify`,e)}async function cs(e){return ya(`${ma.v1}/mfa/enroll/verify`,e)}async function us(e){return ya(`${ma.v1}/mfa/disable`,e)}async function ds(e,t){return ya(`${ma.v1}/mfa/authenticator/${e}/disable/verify`,t)}async function ys(e){return ya(`${ma.v1}/mfa/sms/${e}/disable`)}async function fs(e,t){return ya(`${ma.v1}/mfa/sms/${e}/disable/verify`,t)}async function ps(e){return ya(`${ma.v1}/mfa/webauthn/${e}/disable`)}async function gs(e,t){return ya(`${ma.v1}/mfa/webauthn/${e}/disable/verify`,t)}async function Ss(){return da(`${ma.v1}/mfa/devices`)}async function vs(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll`,e)}async function hs(e){return ya(`${ha.v1}/user/mfa/authenticator/enroll/verify`,e)}async function ms(e,t){return ya(`${ha.v1}/user/mfa/authenticator/${e}/verify`,t)}async function bs(e){return ya(`${ha.v1}/user/mfa/sms/enroll`,e)}async function As(e){return ya(`${ha.v1}/user/mfa/sms/enroll/verify`,e)}async function ks(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}`,t)}async function Ts(e,t){return ya(`${ha.v1}/user/mfa/sms/${e}/verify`,t)}async function Ps(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll`,e)}async function Is(e){return ya(`${ha.v1}/user/mfa/webauthn/enroll/verify`,e)}async function Ls(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}`,t)}async function Es(e,t){return ya(`${ha.v1}/user/mfa/webauthn/${e}/verify`,t)}async function Os(){return da(`${wa.v1}/saml/configurations`)}async function ws(e){return ya(`${wa.v1}/saml/configurations`,e)}async function Ds(){return da(`${wa.v1}/saml/configurations/vendor-config`)}async function Cs(e){return pa(`${wa.v1}/saml/configurations/metadata`,e)}async function Rs(){return pa(`${wa.v1}/saml/validations/domain`)}async function Us(){return da(`${wa.v1}/saml/configurations/roles/default`)}async function _s(){return da(`${wa.v2}/saml/configurations/groups`)}async function Ms({roleIds:e}){return ya(`${wa.v1}/saml/configurations/roles/default`,{roleIds:e})}async function Ns({roleIds:e,group:t}){return ya(`${wa.v2}/saml/configurations/groups`,{group:t,roleIds:e})}async function Fs({roleIds:e,group:t,id:n}){return fa(`${wa.v2}/saml/configurations/groups/${n}`,{group:t,roleIds:e})}async function $s({id:e}){return ga(`${wa.v2}/saml/configurations/groups/${e}`)}async function Gs(){return da(`${wa.v1}/oidc/configurations`)}async function xs(){return da(`${wa.v2}/configurations/public`)}async function Vs(){return da(ka.v1)}async function js(){return da(ka.v2)}async function Ws(){return da(ka.custom.v1)}async function Ks({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),ya(`${ha.v1}/user/sso/${e}/postlogin`,{metadata:a,invitationToken:r},{params:l})}async function Bs(){return da(`${ba.v1}/public`)}async function zs(e){const{shouldActivate:t,authResponse:n,userId:i,tenantId:o}=await ya(`${ma.v1}/signUp`,e);return{shouldActivate:t,user:!t&&n?await _r(n):void 0,userId:i,tenantId:o}}async function qs(){return da(ma.sessions.currentUser.v1)}async function Hs(){return da(`${ma.sessions.currentUser.v1}/current`)}async function Js(e){return ya(`${ma.sessions.v1}/revoke`,{userId:e})}async function Ys(){return da(ma.sessions.configurations.v1)}async function Qs(e){await ya(ma.sessions.configurations.v1,e)}async function Xs(e){await ga(`${ma.sessions.currentUser.v1}/${e}`)}async function Zs(){await ga(`${ma.sessions.currentUser.v1}/all`)}async function el(){return da(ma.accessTokens.v1)}async function tl(){return da(Pa.accessTokens.v1)}async function nl({id:e}){return ga(`${Pa.accessTokens.v1}/${e}`)}async function il({id:e}){return ga(`${ma.accessTokens.v1}/${e}`)}async function ol(e){return ya(ma.accessTokens.v1,e)}async function al(e){return ya(Pa.accessTokens.v1,e)}async function rl(){return da(ma.apiTokens.v1)}async function sl(){return da(Pa.apiTokens.v1)}async function ll(e){return ya(ma.apiTokens.v1,e)}async function cl(e){return ya(Pa.apiTokens.v2,e)}async function ul({tokenId:e}){return ga(`${Pa.apiTokens.v1}/${e}`)}async function dl({tokenId:e}){return ga(`${ma.apiTokens.v1}/${e}`)}async function yl({userId:e}){return da(`${ma.v1}/${e}`)}async function fl(e){return da(`${ba.v1}/mfa-policy/allow-remember-device`,{mfaToken:e})}async function pl(e){let{type:t}=e,n=bi(e,Rr);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/prelogin`,n)}async function gl(e){let{type:t}=e,n=bi(e,Ur);return ya(`${ha.v1}/passwordless/${t.toLocaleLowerCase()}/postlogin`,n)}async function Sl({token:e}){return ya(Pa.invites.verify.v1,{token:e})}async function vl(){return da(`${wa.v1}/configurations`)}async function hl(e){return ya(`${wa.v1}/configurations`,e)}async function ml(e,t){return fa(`${wa.v1}/configurations/${e}`,t)}async function bl(e){return ga(`${wa.v1}/configurations/${e}`)}async function Al(e){return ya(`${wa.v1}/configurations/metadata`,e)}async function kl(e,t){return pa(`${wa.v1}/configurations/${e}/metadata`,t)}async function Tl(e,t){return ya(`${wa.v1}/configurations/${e}/domains`,t)}async function Pl(e,t){return ga(`${wa.v1}/configurations/${e}/domains/${t}`)}async function Il(e,t){return pa(`${wa.v1}/configurations/${e}/domains/${t}/validate`)}async function Ll(e){return da(`${wa.v1}/configurations/${e}/roles`)}async function El(e,t){return pa(`${wa.v1}/configurations/${e}/roles`,t)}async function Ol(e,t){return ya(`${wa.v1}/configurations/${e}/groups`,t)}async function wl(e,{roleIds:t,group:n,id:i}){return fa(`${wa.v1}/configurations/${e}/groups/${i}`,{group:n,roleIds:t})}async function Dl(e,t){return ga(`${wa.v1}/configurations/${e}/groups/${t}`)}async function Cl(e){return da(`${wa.v1}/configurations/${e}/groups`)}async function Rl(e){return ya(`${ha.v2}/user/sso/prelogin`,e)}async function Ul(e){return _r(await ya(`${ha.v2}/user/oidc/postlogin`,e))}async function _l(e){return Nr(await ya(`${za}/token`,e))}async function Ml(){return Nr(await ya(`${za}/authorize/silent`))}async function Nl(e){return ya(`${ma.v1}/phone/reset`,e)}async function Fl(e){return ya(`${ma.v1}/phone/reset/verify`,e)}async function $l(e){return ya(`${ma.v1}/phone`,e)}async function Gl(e){return ya(`${ma.v1}/phone/verify`,e)}async function xl(e){return pa(`${ma.v1}/phone/change`,e)}async function Vl(e){return ya(`${ha.v1}/webauthn/prelogin`,e)}async function jl(e){return ya(`${ha.v1}/webauthn/postlogin`,e)}async function Wl(){return ya(va.v1)}async function Kl(){return da(va.v1)}async function Bl(e){return ga(`${va.v1}/${e}`)}async function zl(e){return ya(`${va.v1}/verify`,e)}async function ql(){return da(`${ba.v1}/auth/strategies/public`)}async function Hl(){return da(`${ba.v1}/mfa/strategies`)}async function Jl(e){return da(`${ma.v2}/me`,null!=e?e:{addRoles:!0})}async function Yl(e){return pa(`${ma.v2}/me`,e)}async function Ql(e){return pa(`${Ua.v1}/me/image/v1`,e,{responseType:"plain",contentType:void 0})}async function Xl(e){return ya(`${ma.v1}/passwords/change`,e)}async function Zl(e){var t,n,i,o,a,r;const s=(e.filter||[]).reduce(((e,t)=>O({},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 da(Da.v1,O({pageOffset:e.pageOffset,pageSize:e.pageSize},s,l))}async function ec(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function tc(e){return ga(`${Da.v1}/${e.userId}`)}async function nc(e){return pa(Da.v1,e)}async function ic(e){return ya(Pa.invites.user.v1,O({},e))}async function oc(e){return fa(Pa.invites.user.v1,O({},e))}async function ac(){return ga(Pa.invites.user.v1)}async function rc(){return da(Pa.invites.user.v1)}async function sc(){return da(Pa.invites.configuration.v1)}async function lc(){return da(Ca.v1)}async function cc(){return da(Ta.v1)}async function uc(){return da(`${Ra.v1}/members`)}async function dc(e){return ya(`${Da.v1}/${e.userId}/resendActivationEmail`,{})}async function yc(e){return ya(ma.v2,O({},e,{provider:"local"}))}async function fc(e){return ya(ma.invitation.resendAll.v1,O({},e))}async function pc(e){var t,n;const i=await da("/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 gc(){const e=await da("/metadata/ipme");if(e)return e;throw new Error("ip metadata not found")}const Sc=async()=>pc({entityName:"notifications"}),vc=async()=>pc({entityName:"saml"}),hc=async()=>pc({entityName:"audits"}),mc=async e=>async function(e){const t=await da(`/metadata/ip/${e}`);if(t)return t;throw new Error("ip metadata not found")}(e),bc=["dataFilters"],Ac=["templateId","dataFilters"],kc=["dataFilters"];async function Tc(e){return da(`${xa.v2}/tenant-reports`,e)}async function Pc(e){return da(`${xa.v2}/${e.id}/tenant-reports`)}async function Ic(e){let{dataFilters:t}=e,n=bi(e,bc);return{html:await da(`${Va.v1}/preview-report`,O({},n,{dataFilters:btoa(JSON.stringify(t||{})),responseType:"html"}),{responseType:"plain"})}}async function Lc(e){let{templateId:t,dataFilters:n}=e,i=bi(e,Ac);return ya(`${xa.v2}/${t}/tenant-reports`,O({},i,{dataFilters:btoa(JSON.stringify(n||{}))}))}async function Ec(e){let{dataFilters:t}=e,n=bi(e,kc);const i=await da(`${Va.v1}/preview-report`,O({},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 Oc(e){return ya(`${Va.v1}/tenant-reports`,e)}async function wc(e){return da(ja,{params:e})}async function Dc(e){return pa(`${ja}/status`,{params:e})}async function Cc(e){const{notificationId:t,pinStatus:n}=e;return pa(`${ja}/${n}`,{notificationId:t})}async function Rc(){return ya(`${ja}/status/mark-all-read`)}const Uc=["endpoint","headerProps"];async function _c(e){return da(Wa,e)}async function Mc(e){return da(`${Wa}/stats`,e)}async function Nc(e){const{endpoint:t,headerProps:n}=e,i=bi(e,Uc);return Sa(`${Wa}/export/${t}`,{properties:n},i)}const Fc=["eventKey"],$c=["eventKey"],Gc=()=>da(`${Na.v1}/slack`),xc=()=>da(`${Na.v1}/slack/applications`),Vc=()=>da(`${Na.v1}/slack/channels`),jc=e=>e.id?fa(`${Na.v1}/slack/subscription/${e.id}`,e):ya(`${Na.v1}/slack/subscriptions`,e),Wc=e=>ga(`${Na.v1}/slack/subscriptions/${e.id}`),Kc=e=>ya(`${Na.v1}/slack/applications/registrations`,{code:e}),Bc=()=>da(`${Na.v1}/emails`),zc=e=>{let{eventKey:t}=e,n=bi(e,Fc);return ya(`${Na.v1}/emails/${t}`,n)},qc=({eventKey:e,enabled:t})=>fa(`${Na.v1}/emails/${e}`,{enabled:t}),Hc=(e,t)=>ga(`${Na.v1}/emails/${e}/subscriptions/${t}`),Jc=(e,t,n)=>pa(`${Na.v1}/emails/${t}/subscriptions/${e}`,n),Yc=e=>ga(`${Na.v1}/emails/${e}`),Qc=()=>da(`${Na.v2}/sms`),Xc=e=>{let{eventKey:t}=e,n=bi(e,$c);return ya(`${Na.v2}/sms/${t}`,n)},Zc=({eventKey:e,enabled:t})=>fa(`${Na.v2}/sms/${e}`,{enabled:t}),eu=(e,t)=>ga(`${Na.v2}/sms/${e}/subscriptions/${t}`),tu=(e,t,n)=>pa(`${Na.v2}/sms/${t}/subscriptions/${e}`,n),nu=e=>ga(`${Na.v2}/sms/${e}`),iu=()=>da(Ba),ou=e=>e._id?fa(`${Ba}/${e._id}`,e):ya(`${Ba}/custom`,e),au=e=>ga(`${Ba}/${e}`),ru=(e,t=0,n=10)=>{const i=new URLSearchParams({id:e,offset:`${t}`,limit:`${n}`});return da(`${Ba}/logs/?${i.toString()}`)},su=e=>ya(`${Ba}/test`,e),lu=e=>ya(`${Ba}/logs/${e}/retries`),cu=()=>da(`${Ka.v1}/categories`),uu=e=>da(Ka.v1,{channels:e});async function du(e){return pa(_a.v1,e)}async function yu(){return da(_a.v1)}const fu=["roleId"],pu=["roleId"],gu=["permissionId"];async function Su(){return da(Ia.v1)}async function vu(e){return ya(Ia.v1,e)}async function hu({roleId:e}){return ga(`${Ia.v1}/${e}`)}async function mu(e){let{roleId:t}=e,n=bi(e,fu);return fa(`${Ia.v1}/${t}`,n)}async function bu(e){let{roleId:t}=e,n=bi(e,pu);return pa(`${Ia.v1}/${t}/permissions`,n)}async function Au(){return da(Ta.v1)}async function ku(e){let{permissionId:t}=e,n=bi(e,gu);return pa(`${Ta.v1}/${t}/roles`,n)}async function Tu(){return da(`${Ta.v1}/categories`)}async function Pu(){return da(Fa.subscriptions.v1)}async function Iu(e){return da(`${Fa.subscriptions.v1}/${e}`)}async function Lu(e){return pa(`${Fa.subscriptions.v1}/${e}/cancellations/`,{})}async function Eu(e){return pa(`${Fa.subscriptions.v1}/${e}/renewals/`,{})}async function Ou(e,{paymentMethodId:t,planId:n}){return pa(`${Fa.subscriptions.v1}/${e}`,{paymentMethodId:t,planId:n})}async function wu(e){return da(`${Ga.v1}/${e}`)}async function Du(){return da(`${Ga.v1}`)}async function Cu(e){return pa(`${Ga.v1}/${e}/cancellations/`,{})}async function Ru(e){return pa(`${Ga.v1}/${e}/renewals/`,{})}async function Uu(e,{paymentMethodId:t,planId:n}){return pa(`${Ga.v1}/${e}`,{paymentMethodId:t,planId:n})}async function _u(){return da(Fa.plans.v1)}async function Mu(e){return da(`${Fa.plans.v1}/${e}`)}async function Nu(){return da(Fa.invoices.v1)}async function Fu(e){return da(`${Fa.invoices.v1}/${e}`)}async function $u(e,t){return da(`${Fa.invoices.v1}/${e}/pdf`,{outputFileName:t},{responseType:"blob"})}const Gu=["email"];async function xu(){return da(Fa.paymentMethods.v1)}async function Vu(e){return da(`${Fa.paymentMethods.v1}/${e}`)}async function ju(e,t){let{email:n}=t,i=bi(t,Gu);return fa(`${Fa.paymentMethods.v1}/${e}/billing-details`,{email:n,address:i})}async function Wu(e){return ya(Fa.paymentProviders.stripe.subscriptions.v1,e)}async function Ku(e){return da(`${Fa.paymentProviders.stripe.customers.v1}/${e}`)}async function Bu(e){return ya(`${Fa.paymentProviders.stripe.customers.v1}`,e)}async function zu(){return da(`${Fa.paymentProviders.stripe.publicConfigurations.v1}`)}async function qu(e){return ya(`${Fa.paymentProviders.stripe.setupIntents.v1}`,e)}async function Hu(e){return da(`${Fa.summaries.v1}/${e}`)}async function Ju(e){return da(`${Fa.tenantConfiguration.v1}/${e}`)}async function Yu(e){return ya(`${Fa.tenantConfiguration.v1}`,e)}async function Qu(){return da($a.v1)}async function Xu(){return da(`${Fa.configurations.vendorPublicConfigurations.v1}`)}let Zu,ed,td,nd,id,od;async function ad(){return da("/vendors/public")}async function rd(e){return da(La.v1,e)}async function sd(e){return ya(La.v1,e)}async function ld(e){return ga(La.v1,e)}async function cd(e,t){return ya(`${La.v1}/${e}/roles`,t)}async function ud(e,t){return ga(`${La.v1}/${e}/roles`,t)}async function dd(e,t){return fa(`${La.v1}/${e}/roles`,t)}!function(e){e.ACTIVE="active",e.CANCELED="canceled",e.INCOMPLETE="incomplete",e.EXPIRED="expired",e.TRIALING="trialing",e.TRIAL_ENDED="trialEnded"}(Zu||(Zu={})),function(e){e.UNKNWON="unknown",e.CARD="card"}(ed||(ed={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(td||(td={})),(nd||(nd={})).Stripe="Stripe",function(e){e.CHANGE_TO_DEFAULT="change_to_default",e.RETAIN_TRIAL="retain_trial"}(id||(id={})),function(e){e.CREATE="create_customer"}(od||(od={}));const yd={flags:{}};class fd{constructor(){var e;this._flags={},this._flags=null!=(e=yd.flags)?e:{}}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new fd;return n.set(e),fd._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=O({},null!=(t=null==yd?void 0:yd.flags)?t:{},null!=e?e:{})}}async function pd(){return da(qa)}async function gd(){return da(`${Ha}`)}async function Sd(e,t){return fa(`${Ha}/${e}`,t)}async function vd(e){return ya(`${Ha}`,e)}async function hd(e){return ga(`${Ha}/${e}`)}async function md(e){return da(`${Ja}/${e}/Users/count`)}async function bd(e){return ya(`${Ea.v1}`,e)}fd._instances={};const Ad=["groupId"];async function kd({groupId:e},t){return da(`${Oa.v1}/${e}`,O({},t))}async function Td(e){return da(`${Oa.v1}`,O({},e))}async function Pd(e,t){return ya(`${Oa.getByIds.v1}`,e,{params:t})}async function Id(e){return ya(`${Oa.v1}`,e)}async function Ld(e){let{groupId:t}=e,n=bi(e,Ad);return fa(`${Oa.v1}/${t}`,n)}async function Ed(e){return ga(`${Oa.v1}/${e}`)}async function Od(e,t){return ya(`${Oa.v1}/${e}/roles`,t)}async function wd(e,t){return ga(`${Oa.v1}/${e}/roles`,t)}async function Dd(e,t){return ya(`${Oa.v1}/${e}/users`,t)}async function Cd(e,t){return ga(`${Oa.v1}/${e}/users`,t)}async function Rd(){return da(`${Oa.configurations.v1}`)}async function Ud(e){return ya(`${Oa.configurations.v1}`,e)}let _d,Md,Nd,Fd,$d;!function(e){e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SmsCode="SmsCode",e.Passkeys="Passkeys"}(_d||(_d={})),function(e){e.Platform="Platform",e.CrossPlatform="CrossPlatform"}(Md||(Md={})),function(e){e.AuthenticatorApp="AuthenticatorApp",e.WebAuthnPlatform="WebAuthnPlatform",e.WebAuthnCrossPlatform="WebAuthnCrossPlatform",e.SMS="SMS"}(Nd||(Nd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(Fd||(Fd={})),function(e){e.CUSTOMER="customer",e.SPAM="spam",e.TEST="test",e.RESELLER="reseller",e.HEADQUARTER="headquarter"}($d||($d={}));const Gd=[/^(.*)\/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],xd=`${ha.v1}/user/token/refresh`,Vd=`${za}/authorize/silent`,jd=`${ma.v2}/me`,Wd=`${ma.v2}/me/tenants`;let Kd,Bd,zd;!function(e){e.FRONTEGG="frontegg",e.OKTA="okta",e.AZURE_AD="azure-ad",e.OTHER="other"}(Kd||(Kd={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(Bd||(Bd={})),function(e){e.FRONTEGG="frontegg",e.SCIM2="scim2"}(zd||(zd={}));const qd={auth:o,teams:a,metadata:r,reports:s,connectivity:u,notifications:l,audits:c,tenants:t,accountSettings:d,roles:y,subscriptions:f,vendor:p,subTenants:g,featureFlags:S,directory:v,impersonate:h,groups:m};var Hd={fetch:e,ContextHolder:ra,FronteggContext:sa,api:qd,FronteggApiError:la,AuthStrategyEnum:Lr,MachineToMachineAuthStrategy:Er,SocialLoginProviders:Ir,ISubscriptionCancellationPolicy:td,ISubscriptionStatus:Zu,PaymentMethodType:ed,ProviderType:nd};let Jd,Yd;!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"}(Jd||(Jd={})),function(e){e.Saml="saml",e.Okta="okta",e.Azure="azure",e.Google="google",e.Oidc="oidc"}(Yd||(Yd={}));const Qd="input is invalid type",Xd="undefined"!=typeof ArrayBuffer,Zd="0123456789abcdef".split(""),ey=[-2147483648,8388608,32768,128],ty=[24,16,8,0],ny=[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],iy=["hex","array","digest","arrayBuffer"],oy=[];Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Xd&&!ArrayBuffer.isView&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});const ay=function(e){return function(t){const n=new sy(!0).update(t);return null==n?void 0:n[e]()}},ry=function(e){return function(t,n){const i=new ly(t,!0).update(n);return null==i?void 0:i[e]()}};class sy{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=()=>sy.prototype.digest(),e?(oy[0]=oy[16]=oy[1]=oy[2]=oy[3]=oy[4]=oy[5]=oy[6]=oy[7]=oy[8]=oy[9]=oy[10]=oy[11]=oy[12]=oy[13]=oy[14]=oy[15]=0,this.blocks=oy):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(Qd);if(null===e)throw new Error(Qd);if(Xd&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Xd&&ArrayBuffer.isView(e)))throw new Error(Qd);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]<<ty[3&o++];else for(o=this.start;a<r&&o<64;++a)i=e.charCodeAt(a),i<128?s[o>>2]|=i<<ty[3&o++]:i<2048?(s[o>>2]|=(192|i>>6)<<ty[3&o++],s[o>>2]|=(128|63&i)<<ty[3&o++]):i<55296||i>=57344?(s[o>>2]|=(224|i>>12)<<ty[3&o++],s[o>>2]|=(128|i>>6&63)<<ty[3&o++],s[o>>2]|=(128|63&i)<<ty[3&o++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++a)),s[o>>2]|=(240|i>>18)<<ty[3&o++],s[o>>2]|=(128|i>>12&63)<<ty[3&o++],s[o>>2]|=(128|i>>6&63)<<ty[3&o++],s[o>>2]|=(128|63&i)<<ty[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]|=ey[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+ny[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+ny[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+ny[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+ny[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=Zd[e>>28&15]+Zd[e>>24&15]+Zd[e>>20&15]+Zd[e>>16&15]+Zd[e>>12&15]+Zd[e>>8&15]+Zd[e>>4&15]+Zd[15&e]+Zd[t>>28&15]+Zd[t>>24&15]+Zd[t>>20&15]+Zd[t>>16&15]+Zd[t>>12&15]+Zd[t>>8&15]+Zd[t>>4&15]+Zd[15&t]+Zd[n>>28&15]+Zd[n>>24&15]+Zd[n>>20&15]+Zd[n>>16&15]+Zd[n>>12&15]+Zd[n>>8&15]+Zd[n>>4&15]+Zd[15&n]+Zd[i>>28&15]+Zd[i>>24&15]+Zd[i>>20&15]+Zd[i>>16&15]+Zd[i>>12&15]+Zd[i>>8&15]+Zd[i>>4&15]+Zd[15&i]+Zd[o>>28&15]+Zd[o>>24&15]+Zd[o>>20&15]+Zd[o>>16&15]+Zd[o>>12&15]+Zd[o>>8&15]+Zd[o>>4&15]+Zd[15&o]+Zd[a>>28&15]+Zd[a>>24&15]+Zd[a>>20&15]+Zd[a>>16&15]+Zd[a>>12&15]+Zd[a>>8&15]+Zd[a>>4&15]+Zd[15&a]+Zd[r>>28&15]+Zd[r>>24&15]+Zd[r>>20&15]+Zd[r>>16&15]+Zd[r>>12&15]+Zd[r>>8&15]+Zd[r>>4&15]+Zd[15&r];return l+=Zd[s>>28&15]+Zd[s>>24&15]+Zd[s>>20&15]+Zd[s>>16&15]+Zd[s>>12&15]+Zd[s>>8&15]+Zd[s>>4&15]+Zd[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 ly extends sy{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(Qd);if(null===e)throw new Error(Qd);if(Xd&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||Xd&&ArrayBuffer.isView(e)))throw new Error(Qd)}var o;e.length>64&&(e=null==(o=new sy(!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}sy.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();sy.call(this,this.sharedMemory),this.update(this.oKeyPad),this.update(e),sy.prototype.finalize.call(this)}}}const cy=function(){const e=ay("hex");e.create=function(){return new sy},e.update=function(t){return e.create().update(t)};for(let t=0;t<iy.length;++t){const n=iy[t];e[n]=ay(n)}return e}();function uy(e,t){const n=O({},e);return t.forEach((e=>{delete n[e]})),n}async function dy(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=cy.digest((new TextEncoder).encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(e))}function yy(e=16){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";for(let i=0;i<e;i++)t+=n.charAt(Math.floor(Math.random()*n.length));return t}!function(){const e=ry("hex");e.create=function(e){return new ly(e)},e.update=function(t,n){return e.create(t).update(n)};for(let t=0;t<iy.length;++t){const n=iy[t];e[n]=ry(n)}}();const fy=e=>new Promise(((t,n)=>{const i=new FileReader;i.readAsText(e),i.onload=()=>t(i.result),i.onerror=n}));function*py(e){const t=yield uo((e=>e.root.appName));return fd.getFeatureFlags(e,t)}const gy={clientId:"CLIENT_ID_16806d3d-8fc3-4450-be97-abdaf66b723e",secret:"SECRET_16806d3d-8fc3-4450-be97-abdaf66b723e",createdAt:"createdAt",description:"Demo API Token (preview only)"},Sy=O({},gy,{roleIds:[],tenantId:"my-tenant-id",createdByUserId:"createdByUserId"}),vy=[{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"}],hy={id:"testId",name:"Demo User Name",email:"demo-user@frontegg.com",mfaEnrolled:!0,profileImage:void 0,profilePictureUrl:"https://www.gravatar.com/avatar/42b2ad2bad6fc9b9db5086dfcf8072ac?d=https://ui-avatars.com/api/fe/128/random?t=1617261890875?t=1617261917434",roles:[{id:"roleId",key:"admin",isDefault:!1,name:"Admin",description:null,permissions:["adminPermissionId"],tenantId:"tenantId",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date}],permissions:[{id:"adminPermissionId",key:"fe.*",name:"General Admin",description:void 0,categoryId:"category",fePermission:!0,createdAt:new Date,updatedAt:new Date}],tenantId:"my-tenant-id",tenantIds:["my-tenant-id"],activatedForTenant:!0,metadata:JSON.stringify({phoneNumber:"+972-54123456",jobTitle:"Developer",address:{city:"Tel Aviv",country:"Israel"}}),roleIds:void 0,verified:void 0},my=O({},hy,{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}),by={loading:!1,error:void 0,saving:!0,profile:hy},Ay={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"},ky={allowSignups:!0,allowNotVerifiedUsersLogin:!1,apiTokensEnabled:!0,forcePermissions:!1,authStrategy:Lr.EmailAndPassword,machineToMachineAuthStrategy:Er.ClientCredentials},Ty={id:"id",enforceMFAType:"DontForce",createdAt:new Date,updatedAt:new Date},Py={id:"id",enabled:!0,maxAttempts:1,createdAt:new Date,updatedAt:new Date},Iy={id:"id",enabled:!0,historySize:1,createdAt:new Date,updatedAt:new Date},Ly={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},Ey={id:"id",createdAt:"createdAt",updatedAt:"updatedAt",properties:[],vendorId:"vendorId",entityName:"saml",isActive:!0,configuration:{acsUrl:"acsUrl",spEntityId:"spEntityId"}},Oy=[{id:"id",description:"description",key:"key",name:"name",permissions:[],permissionLevel:1}],wy={firstLoad:!1,loading:!1,error:void 0,saving:!1,samlConfiguration:Ly,roles:Oy,authorizationRoles:[],errors:{},loaders:{},ssoConfigurations:[]},Dy=[{description:"string",fePermission:!0,id:"id",key:"key",name:"name",roleIds:[],createdAt:new Date,updatedAt:new Date,categoryId:"categoryId"}],Cy={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:[vy[0]],groups:[{id:"id2",name:"Developers",color:"#03A9F4",roles:[vy[0]],managedBy:zd.FRONTEGG}]},Ry={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:[vy[1]],groups:[{id:"id1",name:"Designers",color:"#E1F5E2",roles:[vy[0]],managedBy:zd.FRONTEGG}]},Uy={metadata:"",mfaEnrolled:!1,provider:"",sub:"",tenantIds:[],tenants:[],verified:!1,id:"id",email:"email",name:"name",tenantId:"tenantId",createdAt:new Date},_y=[Ry,Cy],My=[Uy],Ny=[{id:"my-tenant-id",isReseller:!1,name:"Frontegg demo",deletedAt:null,metadata:void 0,tenantId:"my-tenant-id",vendorId:"vendorId",createdAt:new Date,updatedAt:new Date,address:void 0,timezone:void 0,dateFormat:void 0,timeFormat:void 0,currency:void 0,logo:void 0}],Fy=[{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"}],$y={sessionConcurrentConfiguration:{isActive:!0,maxSessions:10},sessionIdleTimeoutConfiguration:{isActive:!0,timeout:3600},sessionTimeoutConfiguration:{isActive:!0,timeout:7776e3}},Gy={isActive:!0,strategy:$n.ALLOW},xy=[{updatedAt:new Date,createdAt:new Date,id:"1",ip:"255.255.255.255",isActive:!0,strategy:$n.ALLOW,description:"My IP"},{updatedAt:new Date,createdAt:new Date,id:"2",ip:"255.255.255.254",isActive:!0,strategy:$n.ALLOW,description:"IP 2"},{updatedAt:new Date,createdAt:new Date,id:"3",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 3"},{updatedAt:new Date,createdAt:new Date,id:"4",ip:"255.255.255.253",isActive:!0,strategy:$n.BLOCK,description:"IP 4"}],Vy=e=>{const t=[];return Array.from({length:e}).forEach(((e,n)=>{t.push(O({},Ry,{name:"Demo User",id:`id${n}`,profilePictureUrl:null,createdAt:new Date}))})),t},jy=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"}),Wy=[{id:"id1",name:"Designers",color:"#E1F5E2",description:"The whole design team",users:Vy(6),roles:[jy("Editor")],metadata:'{"lastTermsCheck":"2022-08-16T10:31:11.270Z"}',managedBy:zd.FRONTEGG},{id:"id2",name:"Developers",color:"#03A9F4",description:"All frontend and backend developers",users:Vy(44),roles:[jy("Editor")],managedBy:zd.FRONTEGG},{id:"id3",name:"Product",color:"#E1583E",description:"PMs and team leads",users:Vy(8),roles:[jy("Viewer")],managedBy:zd.FRONTEGG},{id:"id4",name:"Management",color:"#9AE0FF",description:"Executives",users:Vy(5),roles:[jy("Admin")],managedBy:zd.FRONTEGG},{id:"id5",name:"Sales",color:"#ED8E7C",users:Vy(21),description:"BDR, AE, and inside sales",roles:[jy("Viewer")],managedBy:zd.FRONTEGG},{id:"id6",name:"Support",color:"#A79D7B",users:Vy(23),description:"Dev success and customer success",roles:[jy("Admin")],managedBy:zd.FRONTEGG},{id:"id7",name:"Marketing",color:"#2CA744",users:Vy(10),description:"The marketing department",roles:[jy("Viewer")],managedBy:zd.FRONTEGG},{id:"id8",name:"HR",color:"#EAE1C2",users:Vy(4),description:"Human resources",roles:[jy("Viewer")],managedBy:zd.FRONTEGG},{id:"id9",name:"Finance",color:"#5587C0",users:Vy(3),roles:[jy("Viewer")],managedBy:zd.FRONTEGG},{id:"id10",name:"Operations",color:"#B1CAE7",users:Vy(8),roles:[jy("Editor")],managedBy:zd.FRONTEGG},{id:"id11",name:"Legal",color:"#2CA744",users:Vy(4),roles:[jy("Viewer")],managedBy:zd.FRONTEGG}];let Ky,By,zy;!function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORDLESS="PASSWORDLESS",e.ACTIVATION_LINK="ACTIVATION_LINK"}(Ky||(Ky={})),function(e){e.SOCIAL_LOGIN="SOCIAL_LOGIN",e.PASSWORD="PASSWORD"}(By||(By={})),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"}(zy||(zy={})),zy.profile,zy.privacy,zy.personalApiTokens,zy.account,zy.users,zy.groups,zy.security,zy.sso,zy.audits,zy.webhooks,zy.apiTokens,zy.roles,zy.subscriptions;const qy=["events","url"];function*Hy(){yield oo(si.setSignUpState({loading:!0}));try{const e=yield so(qd.auth.getVendorConfig),[t]=(yield so(qd.auth.getVendorPublicAuthStrategiesConfig),yield so(py,["admin_portal_login_per_tenant"]));if(t){const t=yield so(qd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}const{allowSignups:n,allowNotVerifiedUsersLogin:i}=e;yield oo(si.setSignUpState({loading:!1,allowSignUps:n,allowNotVerifiedUsersLogin:i,firstLoad:!1})),yield oo(si.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield oo(si.setSignUpState({loading:!1,error:e.message,firstLoad:!1}))}}function*Jy(e){let{payload:{events:t,url:n}}=e,i=bi(e.payload,qy);yield oo(si.setSignUpState({loading:!0}));try{const{routes:e,onRedirectTo:a}=yield uo((e=>e.auth)),{shouldActivate:r,user:s,tenantId:l,userId:c}=yield so(qd.auth.signUpUser,i);if(!i.invitationToken){var o;const{email:e,name:a,companyName:r}=i;null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,name:a,companyName:r,url:n,authenticationType:By.PASSWORD,id:c,tenantId:l,createdAt:new Date})}if(ra.setAccessToken(null==s?void 0:s.accessToken),ra.setUser(s),!r&&s&&lp(s)){const t=yield dp(s);yield oo(si.setState(t)),a(e.loginUrl)}else yield oo(si.setSignUpState({loading:!1,shouldActivate:r,stage:fn.SignUpSuccess})),yield oo(si.setState({user:s,isAuthenticated:!(null==s||!s.accessToken)})),r||(yield oo(si.loadTenants()))}catch(e){ra.setAccessToken(null),ra.setUser(null),yield oo(si.setSignUpState({loading:!1,error:e.message}))}yield oo(si.setSignUpState({loading:!1}))}function*Yy(){const{allowSignUps:e,allowNotVerifiedUsersLogin:t}=yield uo((e=>e.auth.signUpState));yield oo(si.resetSignUpState()),yield oo(si.setSignUpState({allowSignUps:e,allowNotVerifiedUsersLogin:t}))}function*Qy(){yield aa(si.signUpUser,Jy),yield aa(si.resetSignUpStateSoft,Yy)}const Xy={setVendorState:(e,{payload:t})=>O({},e,t)},Zy={loadVendorPublicInfo:rt("vendor/loadVendorPublicInfo")},ef={loading:!1},{reducer:tf,actions:nf}=lt({name:Dt,initialState:ef,reducers:O({},Xy)}),of=O({},nf,Zy);function*af(){yield oo(of.setVendorState({loading:!0}));try{const{whiteLabelMode:e=!1}=yield qd.vendor.getVendorPublicInfo();yield oo(of.setVendorState({whiteLabelMode:e,loading:!1}))}catch(e){yield oo(of.setVendorState({loading:!1})),console.error("failed to getVendorPublicInfo - ",e)}}const rf=["callback"],sf=["callback"],lf=["callback"],cf=["callback"],uf=["callback"],df=["callback"];function*yf(){yield oo(si.setSecurityPolicyGlobalState({loading:!0,error:null}));try{const e=yield so(qd.auth.getGlobalSecurityPolicy);yield oo(si.setSecurityPolicyGlobalState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyGlobalState({error:e.message,loading:!1}))}yield oo(si.loadSecurityPolicyMfa()),yield oo(si.loadSecurityPolicyVendorMfa()),yield oo(si.loadSecurityPolicyLockout()),yield oo(si.loadSecurityPolicyVendorLockout()),yield oo(si.loadSecurityPolicyVendorPasswordHistory()),yield oo(si.loadSecurityPolicyCaptcha()),yield oo(si.loadPublicAuthStrategiesPolicy())}function*ff(){yield oo(si.setSecurityPolicyPublicState({loading:!0,error:null}));try{const e=yield so(qd.auth.getVendorConfig),[t]=yield so(py,["admin_portal_login_per_tenant"]);if(t){const t=yield so(qd.auth.getVendorPublicAuthStrategiesConfig);t.mainAuthStrategies.length>0&&(e.authStrategy=t.mainAuthStrategies[0].strategy)}yield oo(si.setSecurityPolicyPublicState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*pf(){yield oo(si.setSecurityPolicyAuthStrategyPublicState({loading:!0,error:null}));try{const e=yield so(qd.auth.getVendorPublicAuthStrategiesConfig);yield oo(si.setSecurityPolicyAuthStrategyPublicState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyAuthStrategyPublicState({error:e.message,loading:!1}))}}function*gf(){yield oo(si.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield so(qd.auth.getMfaPolicy);yield oo(si.setSecurityPolicyMfaState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyMfaState({error:e.message,loading:!1}))}}function*Sf(){yield oo(si.setSecurityPolicyMfaState({loading:!0,error:null}));try{const e=yield so(qd.auth.getVendorMfaPolicy);yield oo(si.setSecurityPolicyVendorMfaState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyVendorMfaState({error:e.message,loading:!1}))}}function*vf(e){let{payload:{callback:t}}=e,n=bi(e.payload,rf);yield oo(si.setSecurityPolicyMfaState({saving:!0,error:null}));try{const e=yield so(qd.auth.saveMfaPolicy,n);yield oo(si.setSecurityPolicyMfaState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield oo(si.setSecurityPolicyMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*hf(){yield oo(si.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield so(qd.auth.getLockoutPolicy);yield oo(si.setSecurityPolicyLockoutState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyLockoutState({error:e.message,loading:!1}))}}function*mf(e){let{payload:{callback:t}}=e,n=bi(e.payload,sf);yield oo(si.setSecurityPolicyLockoutState({saving:!0,error:null}));try{const e=yield so(qd.auth.saveLockoutPolicy,n);yield oo(si.setSecurityPolicyLockoutState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield oo(si.setSecurityPolicyLockoutState({saving:!1,error:e.message})),null==t||t(null,e)}}function*bf(){yield oo(si.setSecurityPolicyVendorLockoutState({loading:!0,error:null}));try{const e=yield so(qd.auth.getVendorLockoutPolicy);yield oo(si.setSecurityPolicyVendorLockoutState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyVendorLockoutState({error:e.message,loading:!1}))}}function*Af(){yield oo(si.setSecurityPolicyLockoutState({loading:!0,error:null}));try{const e=yield so(qd.auth.getCaptchaPolicy);yield oo(si.setSecurityPolicyCaptchaState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyCaptchaState({error:e.message,loading:!1}))}}function*kf(){yield oo(si.setSecurityPolicyPasswordHistoryState({loading:!0,error:null}));try{const e=yield so(qd.auth.getPasswordHistoryPolicy);yield oo(si.setSecurityPolicyPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyPasswordHistoryState({error:e.message,loading:!1}))}}function*Tf(){yield oo(si.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null}));try{const e=yield so(qd.auth.getVendorPasswordHistoryPolicy);yield oo(si.setSecurityPolicyVendorPasswordHistoryState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyVendorPasswordHistoryState({error:e.message,loading:!1}))}}function*Pf(e){let{payload:{callback:t}}=e,n=bi(e.payload,lf);yield oo(si.setSecurityPolicyPasswordHistoryState({saving:!0,error:null}));try{const e=yield so(qd.auth.savePasswordHistoryPolicy,n);yield oo(si.setSecurityPolicyPasswordHistoryState({policy:e,saving:!1})),null==t||t(e)}catch(e){yield oo(si.setSecurityPolicyPasswordHistoryState({saving:!1,error:e.message})),null==t||t(null,e)}}function*If(){yield oo(si.setSecurityPolicyPasswordState({loading:!0,error:null}));try{const e=yield so(qd.auth.getPasswordConfigPolicy);yield oo(si.setSecurityPolicyPasswordState({policy:e,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyPasswordState({error:e.message,loading:!1}))}}function*Lf(){yield aa(si.loadSecurityPolicy,yf),yield ia(si.saveSecurityPolicyMfa,vf),yield ia(si.loadSecurityPolicyMfa,gf),yield ia(si.loadSecurityPolicyVendorMfa,Sf),yield ia(si.saveSecurityPolicyLockout,mf),yield ia(si.loadSecurityPolicyLockout,hf),yield ia(si.loadSecurityPolicyVendorLockout,bf),yield ia(si.loadSecurityPolicyCaptcha,Af),yield ia(si.saveSecurityPolicyPasswordHistory,Pf),yield ia(si.loadSecurityPolicyPasswordHistory,kf),yield ia(si.loadSecurityPolicyVendorPasswordHistory,Tf),yield ia(si.loadVendorPasswordConfig,If),yield ia(si.loadPublicSecurityPolicy,ff),yield ia(si.loadPublicAuthStrategiesPolicy,pf)}function*Ef(){yield oo(si.setSecurityPolicyPublicState({loading:!0,error:null}));try{yield oo(si.setSecurityPolicyPublicState({policy:ky,loading:!1}))}catch(e){yield oo(si.setSecurityPolicyPublicState({error:e.message,loading:!1}))}}function*Of(){yield oo(si.setSecurityPolicyGlobalState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyGlobalState({policy:Ay,loading:!1})),yield oo(si.loadSecurityPolicyMfa()),yield oo(si.loadSecurityPolicyVendorMfa()),yield oo(si.loadSecurityPolicyLockout()),yield oo(si.loadSecurityPolicyVendorLockout()),yield oo(si.loadSecurityPolicyPasswordHistory()),yield oo(si.loadSecurityPolicyVendorPasswordHistory()),yield oo(si.loadSecurityPolicyCaptcha())}function*wf(){yield oo(si.setSecurityPolicyMfaState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyMfaState({policy:Ty,loading:!1}))}function*Df(){yield oo(si.setSecurityPolicyVendorMfaState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyVendorMfaState({policy:Ty,loading:!1}))}function*Cf(e){var t;let{payload:{callback:n}}=e,i=bi(e.payload,cf);yield oo(si.setSecurityPolicyMfaState({saving:!0,error:null}));const o=O({},Py,{id:null!=(t=i.id)?t:Py.id,enforceMFAType:i.enforceMFAType});yield vt(),yield oo(si.setSecurityPolicyMfaState({policy:o,saving:!1})),null==n||n(o)}function*Rf(){yield oo(si.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyLockoutState({policy:Py,loading:!1}))}function*Uf(){yield oo(si.setSecurityPolicyVendorLockoutState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyVendorLockoutState({policy:Py,loading:!1}))}function*_f(e){let{payload:{callback:t}}=e,n=bi(e.payload,uf);yield oo(si.setSecurityPolicyLockoutState({saving:!0,error:null})),yield vt();const i=O({},Py,n,{id:n.id?n.id:Py.id});null==t||t(i),yield oo(si.setSecurityPolicyLockoutState({policy:i,saving:!1}))}function*Mf(){yield oo(si.setSecurityPolicyLockoutState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyLockoutState({policy:Py,loading:!1}))}function*Nf(){yield oo(si.setSecurityPolicyPasswordHistoryState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyPasswordHistoryState({policy:Iy,loading:!1}))}function*Ff(){yield oo(si.setSecurityPolicyVendorPasswordHistoryState({loading:!0,error:null})),yield vt(),yield oo(si.setSecurityPolicyVendorPasswordHistoryState({policy:Iy,loading:!1}))}function*$f(e){let{payload:{callback:t}}=e,n=bi(e.payload,df);yield oo(si.setSecurityPolicyPasswordHistoryState({saving:!0,error:null})),yield vt();const i=O({},Iy,n,{id:n.id?n.id:Iy.id});null==t||t(i),yield oo(si.setSecurityPolicyPasswordHistoryState({policy:i,saving:!1}))}function*Gf(){yield aa(si.loadSecurityPolicy,Of),yield ia(si.loadPublicSecurityPolicy,Ef),yield ia(si.saveSecurityPolicyMfa,Cf),yield ia(si.loadSecurityPolicyMfa,wf),yield ia(si.loadSecurityPolicyVendorMfa,Df),yield ia(si.saveSecurityPolicyLockout,_f),yield ia(si.loadSecurityPolicyLockout,Rf),yield ia(si.loadSecurityPolicyVendorLockout,Uf),yield ia(si.loadSecurityPolicyCaptcha,Mf),yield ia(si.saveSecurityPolicyPasswordHistory,$f),yield ia(si.loadSecurityPolicyPasswordHistory,Nf),yield ia(si.loadSecurityPolicyVendorPasswordHistory,Ff)}const xf=["callback"],Vf=["callback"],jf=["callback"],Wf=["callback"],Kf=["callback","events"],Bf=["callback"],zf=["callback"],qf=["callback"],Hf=["callback"],Jf=["callback"],Yf=["callback"],Qf=["callback"],Xf=["callback"],Zf=["callback"],ep=["callback","deviceId"],tp=["callback","deviceId"],np=["callback","deviceId"],ip=["callback","deviceId"],op={[Lr.Code]:kt.loginWithOtc,[Lr.EmailAndPassword]:kt.loginWithPassword,[Lr.MagicLink]:kt.magicLinkPreLoginSuccess,[Lr.SmsCode]:kt.loginWithSmsOtc};function*ap(){const e=ra.onRedirectTo,{routes:t,includeQueryParam:n,enforceRedirectToSameSite:i=!1,allowedRedirectOrigins:o=[]}=yield uo((e=>e.auth)),{loginUrl:a,logoutUrl:r,socialLoginCallbackUrl:s,activateUrl:l}=t;let{authenticatedUrl:c}=t;const u=window.localStorage.getItem(It);u&&![a,r,s,l].includes(u)&&(c=u),window.localStorage.removeItem(It),yield vt(200),oo(si.resetLoginState());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&&(e=>{try{return new URL(e),!0}catch(e){return!1}})(a)?((e,t)=>{const n=new URL(window.location.href),i=new URL(e),o=i.origin===n.origin;return t.includes(i.origin)||o})(a,n)?o=a:console.warn("The redirect url param is not valid, the origin is a different site"):o=a:i&&(o+=window.location.search),o})({authenticatedUrl:c,includeQueryParam:n,enforceRedirectToSameSite:i,allowedRedirectOrigins:o});e(d,{refresh:d.startsWith("http")})}function*rp(){let e;try{var t;const n=yield so(qd.metadata.getSamlMetadata);e=null==n||null==(t=n.configuration)?void 0:t.acsUrl}catch(e){console.error(e)}yield oo(si.setState({ssoACS:e}))}function*sp(){try{const{isActive:e}=yield so(qd.auth.getSSOPublicConfiguration);yield oo(si.setState({isSSOAuth:e}))}catch(e){console.error(e)}}const lp=e=>e.mfaRequired&&e.mfaToken?(ra.setAccessToken(null),ra.setUser(null),!0):(ra.setAccessToken(e.accessToken),ra.setUser(e),!1),cp=e=>{const{numberOfPhoneDevices:t,numberOfAuthenticators:n,totalDevices:i}=(e=>{const t=+Boolean(e.webauthn.length),n=+Boolean(e.phones.length),i=+Boolean(e.authenticators.length);return{numberOfWebAuthnDevices:t,numberOfPhoneDevices:n,numberOfAuthenticators:i,totalDevices:t+n+i}})(e);if(1===i){if(n)return nn.authenticatorApp;if(t)return nn.smsVerifyCode}return nn.verify},up=e=>{if(1===e.length){const[t]=e;if(t===Nd.AuthenticatorApp)return nn.authenticatorApp;if(t===Nd.SMS)return nn.smsSetPhoneNumber}return nn.verify};function*dp(e){let t=kt.loginWithTwoFactor,n={};const{loginState:i}=yield uo((e=>e.auth)),{isAllowedToRemember:o,mfaDeviceExpiration:a}=yield so(qd.auth.checkIfAllowToRememberMfaDevice,e.mfaToken);!e.hasOwnProperty("mfaEnrolled")||e.mfaEnrolled?n={mfaDevices:e.mfaDevices,step:cp(e.mfaDevices)}:(n={step:up(e.mfaStrategies),qrCode:e.qrCode,recoveryCode:e.recoveryCode,loading:!1,mfaToken:e.mfaToken,mfaStrategies:e.mfaStrategies},t=kt.forceTwoFactor);let r={};const s=localStorage.getItem("register-quick-login");return s&&(r={quickLoginToRegister:s,flow:Tt.RegisterQuickLogin}),{user:void 0,isAuthenticated:!1,mfaState:n,loginState:O({},i,r,{mfaToken:e.mfaToken,mfaRequired:e.mfaRequired,loading:!1,error:void 0,step:t,tenantsLoading:!0,email:e.userEmail,tenants:[],allowRememberMfaDevice:o,mfaDeviceExpiration:a})}}function*yp(e){var t;const{routes:n,loginState:i}=yield uo((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*fp(){const{hostedLoginBox:e}=yield uo((e=>e.auth));e?yield so(pp):yield so(Sp)}function*pp(){const{user:e}=yield uo((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield oo(si.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield so(qd.auth.exchangeOAuthTokens,t);yield oo(si.setState({user:n,isAuthenticated:!0})),yield oo(si.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield oo(si.setState({user:null,isAuthenticated:!1}))}}function*gp(){const{user:e}=yield uo((e=>e.auth));if(null==e||!e.refreshToken)return ra.setAccessToken(null),ra.setUser(null),void(yield oo(si.setState({user:null,isAuthenticated:!1})));try{const t={grant_type:"refresh_token",refresh_token:null==e?void 0:e.refreshToken},n=yield so(qd.auth.exchangeOAuthTokens,t);yield oo(si.setState({user:n,isAuthenticated:!0})),yield oo(si.loadTenants())}catch(e){ra.setAccessToken(null),ra.setUser(null),yield oo(si.setState({user:null,isAuthenticated:!1}))}}function*Sp(){try{const t=ra.onRedirectTo,{routes:n,loginState:i}=yield uo((e=>e.auth)),{user:o,tenants:a}=yield so(qd.auth.refreshTokenV2);if(lp(o)){const e=yield dp(o);yield oo(si.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 yp(o);yield oo(si.setTenantsState({tenants:a,loading:!1})),yield oo(si.setState({user:o,isAuthenticated:!0,loginState:O({},i,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield hp(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield oo(si.setState({user:void 0,isAuthenticated:!1}))}}function*vp(){try{const t=ra.onRedirectTo,{routes:n,loginState:i}=yield uo((e=>e.auth)),{user:o,tenants:a}=yield so(qd.auth.refreshTokenV2);if(lp(o)){const e=yield dp(o);yield oo(si.setState(e)),t(n.loginUrl,{preserveQueryParams:!0})}else if(yield so(wp))yield oo(si.setLoginState({step:kt.promptPasskeys,loading:!1})),yield oo(si.setTenantsState({tenants:a,loading:!1})),yield oo(si.setState({user:o})),t(n.loginUrl,{preserveQueryParams:!0});else{var e;o.id&&localStorage.setItem("userId",o.id);const t=null!=(e=localStorage.getItem("register-quick-login"))?e:i.quickLoginToRegister,n=yield yp(o);yield oo(si.setTenantsState({tenants:a,loading:!1})),yield oo(si.setState({user:o,isAuthenticated:!0,loginState:O({},i,{quickLoginToRegister:t,flow:n?Tt.RegisterQuickLogin:Tt.Login})})),yield hp(n)}}catch(e){ra.setAccessToken(null),ra.setUser(null),yield oo(si.setState({user:void 0,isAuthenticated:!1}))}}function*hp(e){var t;const n=new URL(null==(t=window)?void 0:t.location.href),i=ra.onRedirectTo,{routes:o,loginState:a}=yield uo((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 ap())}function*mp({payload:{callback:e}}){try{const{ip:t}=yield so(qd.metadata.getCurrentUserIpMetadata);yield oo(si.setState({userIp:t})),null==e||e(!0)}catch(t){null==e||e(!1)}}function*bp({payload:e}){const t=[];e&&(yield oo(si.setState({isLoading:!0})),yield oo(si.loadSocialLoginsConfigurationV2()),t.push(so(Hy)),t.push(so(pf)),t.push(so(sp)),t.push(so(af)),t.push(so(rp))),t.push(so(fp)),yield ao(t),yield oo(si.setState({isLoading:!1}))}function*Ap({accessToken:e,user:t}){if(!e)return void(yield oo(si.setState({user:void 0,isAuthenticated:!1})));const n=ra.onRedirectTo,{routes:i}=yield uo((e=>e.auth));if(lp(t)){const e=yield dp(t);yield oo(si.setState(e)),n(i.loginUrl,{preserveQueryParams:!0})}}function*kp({payload:e}){const t=[];yield oo(si.loadSocialLoginsConfigurationV2()),t.push(so(Hy)),t.push(so(sp)),t.push(so(af)),t.push(so(rp)),t.push(so(Ap,e)),yield ao(t)}function*Tp({payload:e}){const{disableSilentRefresh:t}=yield uo((e=>({disableSilentRefresh:e.auth.disableSilentRefresh})));try{if(t)throw new Error("silent refresh is disabled");yield function*(){const e=yield so(qd.auth.silentOAuthRefreshToken);if(!e)throw new Error("couldn't refresh user token with oauth service");yield oo(si.setState({user:e,isAuthenticated:!0})),yield oo(si.loadTenants()),yield oo(si.setState({isLoading:!1}))}()}catch(t){yield function*(e){const{routes:t,context:n,onRedirectTo:i,urlStrategy:o}=yield uo((e=>({routes:e.auth.routes,onRedirectTo:e.auth.onRedirectTo,context:e.root.context,urlStrategy:e.root.urlStrategy})));if((e=>{var t;if("path"===e)return(null!=(t=window)?t:document).location.pathname;{var n;const e=((null!=(n=window)?n:document).location.hash||"#").substring(1);return-1!==e.indexOf("?")?e.substring(0,e.indexOf("?")):e}})(o)===t.hostedLoginRedirectUrl)return void console.debug("Calling loginWithRedirect while in hostedLoginCallback route");yield oo(si.setState({isLoading:!0}));const a=yy(),r=yy(),s=yield so(dy,r);localStorage.setItem(Lt,r);const l=`${window.location.origin}${"path"===o?"":"#"}${t.hostedLoginRedirectUrl}`,c=`${ca(n,"/oauth/authorize")}/oauth/authorize`,u=O({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 d;const e=yield null==(d=n.tenantResolver)?void 0:d.call(n);null!=e&&e.tenant&&(u.organization=e.tenant)}i(`${c}?${new URLSearchParams(u).toString()}`,{refresh:!0})}(e)}}function*Pp({payload:e}){const t=localStorage.getItem(Lt)||"INVALID-CODE-VERIFIER",{routes:n,urlStrategy:i}=yield uo((e=>({routes:e.auth.routes,urlStrategy:e.root.urlStrategy}))),o=`${window.location.origin}${"path"===i?"":"#"}${n.hostedLoginRedirectUrl}`,a={code:e.code,redirect_uri:o,code_verifier:t,grant_type:"authorization_code"};try{const e=yield so(qd.auth.exchangeOAuthTokens,a);yield oo(si.setState({user:e,isAuthenticated:!0})),yield oo(si.loadTenants())}catch(e){console.error("Failed to exchangeOAuthTokens",e)}finally{yield ap()}}function*Ip(e){let{payload:{callback:t}}=e,n=bi(e.payload,xf);try{yield oo(si.setLoginState({loading:!0}));const e=yield so(qd.auth.changePhoneNumberWithVerification,n);yield oo(si.setLoginState({phoneNumber:n.phoneNumber,loading:!1,changePhoneId:e.changePhoneId,step:kt.loginWithQuickSmsOtc,error:void 0})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({error:e.message,loading:!1}))}}function*Lp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Vf);try{yield oo(si.setLoginState({loading:!0})),yield so(qd.auth.verifyChangePhoneNumber,n),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({error:e.message,loading:!1}))}}function*Ep(e){let{payload:{callback:t}}=e,n=bi(e.payload,jf);try{yield oo(si.setLoginState({loading:!0}));const e=yield so(qd.auth.passwordlessPreLogin,O({},n,{type:Lr.SmsCode}));yield oo(si.setLoginState({step:kt.loginWithQuickSmsOtc,loading:!1,phoneNumber:null==e?void 0:e.phoneNumber,error:void 0})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({error:e.message,loading:!1})),null==t||t(e)}}function*Op(e){let{payload:{callback:t}}=e,n=bi(e.payload,Wf);try{const{onRedirectTo:e,routes:i}=yield uo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield oo(si.setLoginState({loading:!0}));const o=yield so(qd.auth.passwordlessPreLogin,n),a=op[n.type];if(a===kt.loginWithSmsOtc&&o.resetPhoneNumberToken)return yield oo(si.setResetPhoneNumberState({resetPhoneNumberToken:o.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),void e(i.resetPhoneNumberUrl);yield oo(si.setLoginState({step:a,loading:!1,phoneNumber:null==o?void 0:o.phoneNumber,email:n.email,error:void 0})),null==t||t()}catch(e){yield oo(si.setLoginState({error:e.message,loading:!1})),null==t||t()}}function*wp(){const{publicAuthStrategyPolicy:e}=yield uo((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===_d.Passkeys)))})(t),i="Passkeys"===localStorage.getItem("preferred-login-method"),o="true"===localStorage.getItem("dont-show-again-prompt-passkeys"),[a]=yield so(py,["show-passkeys-new"]);if(!a||!n||i||o)return!1;{const{devices:e}=yield so(qd.auth.getWebAuthnDevices);return yield oo(si.setPasskeysState({devices:null!=e?e:[]})),0===(null!=e&&e.length?e.length:0)}}function*Dp(e){let{payload:{callback:t,events:n}}=e,i=bi(e.payload,Kf);try{yield oo(si.setLoginState({loading:!0}));const e=yield so(qd.auth.passwordlessPostLogin,i),a=ra.onRedirectTo,{routes:r}=yield uo((e=>e.auth));if(lp(e)){const t=yield dp(e);yield oo(si.setState(t)),a(r.loginUrl,{preserveQueryParams:!0})}else{const{loginState:i}=yield uo((e=>e.auth)),s=yield so(qd.auth.generateLoginResponse,e);var o;e.emailVerified&&(null==n||null==(o=n.userVerified)||o.call(n,{email:s.email,origin:Ky.PASSWORDLESS,id:s.id,tenantId:s.tenantId,createdAt:new Date,name:s.name})),s.id&&localStorage.setItem("userId",s.id),yield oo(si.setState({user:s})),yield oo(si.setLoginState({error:void 0})),yield oo(si.loadTenants()),yield oo(si.setState({isLoading:!1})),i.flow===Tt.Login?(yield so(wp))?(yield oo(si.setLoginState({step:kt.promptPasskeys,loading:!1})),a(r.loginUrl,{preserveQueryParams:!0})):(yield oo(si.setState({isAuthenticated:!0})),yield ap()):a(r.loginUrl,{preserveQueryParams:!0}),localStorage.removeItem("register-quick-login"),null==t||t(!0)}}catch(e){var a;yield oo(si.setLoginState({error:null!=(a=e.message)?a:"Failed to authenticate"}))}finally{yield oo(si.setLoginState({loading:!1}))}}function*Cp({payload:e}){try{yield oo(si.setLoginState({loading:!0}));const{name:t}=yield so(qd.auth.verifyInviteToken,e);yield oo(si.setLoginState({inviteTokenTenantName:t}))}catch(e){var t;console.error(e),yield oo(si.setLoginState({inviteTokenError:null!=(t=e.message)?t:"We couldn't verify your invitation"}))}finally{yield oo(si.setLoginState({loading:!1}))}}function*Rp({payload:{email:e,recaptchaToken:t,invitationToken:n,callback:i}}){yield oo(si.setLoginState({loading:!0}));try{const o=yield uo((({auth:{onRedirectTo:e}})=>e)),{address:a,idpType:r}=yield so(qd.auth.preLoginV2,{email:e});if(a){let e=a;if(r===Yd.Oidc&&!e.includes("redirect_uri")){const{routes:{oidcRedirectUrl:t}}=yield uo((({auth:{routes:e}})=>({routes:e})));e+=`&redirect_uri=${window.location.origin}${t}`}yield oo(si.setLoginState({step:kt.redirectToSSO,loading:!1,ssoRedirectUrl:e})),setTimeout((()=>{o(e,{refresh:!0})}),2e3)}else yield Up({email:e,recaptchaToken:t,callback:i,invitationToken:n})}catch(o){yield Up({email:e,recaptchaToken:t,callback:i,invitationToken:n})}}function*Up(e){let{callback:t}=e,n=bi(e,Bf);const i=yield uo((({auth:{securityPolicyState:{publicPolicy:{policy:e}}}})=>e));if(null==i||!i.authStrategy)return yield oo(si.setLoginState({step:kt.loginWithPassword,loading:!1})),void(null==t||t());(null==i?void 0:i.authStrategy)===Lr.EmailAndPassword?(yield oo(si.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t()):[Lr.MagicLink,Lr.Code,Lr.SmsCode].includes(null==i?void 0:i.authStrategy)?yield oo(si.passwordlessPreLogin(O({},n,{type:null==i?void 0:i.authStrategy,callback:t}))):(yield oo(si.setLoginState({step:kt.loginWithPassword,loading:!1})),null==t||t())}function*_p({payload:{callback:e}}){try{yield oo(si.setLoginState({loading:!0}));const{options:t}=yield so(qd.auth.webAuthnCreateNewDeviceSession);t.user.id=bt(t.user.id),t.challenge=bt(t.challenge),t.excludeCredentials=[],null==e||e(t)}catch(t){yield oo(si.setLoginState({error:t.message})),null==e||e(null)}finally{yield oo(si.setLoginState({loading:!1}))}}function*Mp(e){let{payload:{callback:t}}=e,n=bi(e.payload,zf);try{yield oo(si.setLoginState({loading:!0}));const e=At(n.publicKey),i="platform"===(null==e?void 0:e.authenticatorAttachment)?Md.Platform:Md.CrossPlatform;yield so(qd.auth.verifyNewDeviceSession,{id:e.id,response:e.response,deviceType:i}),null==t||t(!0)}catch(e){yield oo(si.setLoginState({error:e.message})),null==t||t(null)}finally{yield oo(si.setLoginState({loading:!1}))}}function*Np(e){let{payload:{callback:t}}=e,n=bi(e.payload,qf);try{var i;yield oo(si.setPasskeysState({loading:!0})),yield oo(si.setLoginState({loading:!0}));const{options:e}=yield so(qd.auth.webAuthnPreLogin,n);e.challenge=bt(e.challenge),e.allowCredentials=null==(i=e.allowCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)}))),yield oo(si.setLoginState({error:void 0})),null==t||t(e)}catch(e){yield oo(si.setLoginState({error:e.message})),null==t||t(null)}finally{yield oo(si.setPasskeysState({loading:!1})),yield oo(si.setLoginState({loading:!1}))}}function*Fp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Hf);try{var i;yield oo(si.setPasskeysState({loading:!0})),yield oo(si.setLoginState({loading:!0}));const e=At(n.publicKey),o=yield so(qd.auth.webAuthnPostLogin,O({},e,{response:O({},e.response,{userHandle:null!=(i=e.response.userHandle)?i:void 0}),recaptchaToken:n.recaptchaToken,invitationToken:n.invitationToken}));if(lp(o)){const e=ra.onRedirectTo,{routes:t}=yield uo((e=>e.auth)),n=yield dp(o);yield oo(si.setState(n)),e(t.loginUrl,{preserveQueryParams:!0})}else{const e=yield so(qd.auth.generateLoginResponse,o);e.id&&localStorage.setItem("userId",e.id),yield oo(si.loadTenants()),yield oo(si.setState({user:e,isAuthenticated:!0})),yield oo(si.setLoginState({error:void 0})),yield ap(),null==t||t(!0)}}catch(e){yield oo(si.setLoginState({error:e.message})),null==t||t(null)}finally{yield oo(si.setPasskeysState({loading:!1})),yield oo(si.setLoginState({loading:!1}))}}function*$p({payload:e}){const{onRedirectTo:t,routes:n}=yield uo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield oo(si.setLoginState({loading:!0}));try{const t=yield so(qd.auth.postLogin,e);ra.setAccessToken(t.accessToken),ra.setUser(t),yield oo(si.setState({user:t.accessToken?t:void 0,isAuthenticated:!!t.accessToken})),yield ap()}catch(e){setTimeout((()=>{t(n.authenticatedUrl)}),1e3),yield oo(si.setLoginState({step:kt.loginWithSSOFailed,loading:!1}))}}function*Gp({payload:{email:e,password:t,recaptchaToken:n,invitationToken:i,callback:o}}){yield oo(si.setLoginState({loading:!0}));try{const a=yield so(qd.auth.login,{email:e,password:t,recaptchaToken:n,invitationToken:i});ra.setAccessToken(a.accessToken),ra.setUser(a);const r=ra.onRedirectTo,{routes:s}=yield uo((e=>e.auth));if(lp(a)){const e=yield dp(a);yield oo(si.setState(e)),r(s.loginUrl,{preserveQueryParams:!0})}else{const{loginState:t}=yield uo((e=>e.auth)),n=!!a.accessToken;a.id&&localStorage.setItem("userId",a.id),yield oo(si.setState({user:a,isAuthenticated:n,loginState:{flow:t.flow,quickLoginToRegister:t.quickLoginToRegister,email:e,loading:!1,error:void 0,mfaToken:a.mfaToken,step:t.flow===Tt.Login?kt.success:t.step,tenants:[],tenantsLoading:!0}})),yield oo(si.loadTenants()),n&&t.flow===Tt.Login&&((yield so(wp))?(yield oo(si.setLoginState({step:kt.promptPasskeys,loading:!1})),r(s.loginUrl,{preserveQueryParams:!0})):yield ap())}localStorage.removeItem("register-quick-login"),null==o||o(!0)}catch(t){ra.setAccessToken(null),ra.setUser(null),null==o||o(!1,t),yield oo(si.setLoginState({email:e,error:t.message,loading:!1}))}}function*xp({payload:{mfaToken:e,value:t,rememberDevice:n,callback:i}}){yield oo(si.setLoginState({loading:!0}));try{const o=yield so(qd.auth.loginWithMfa,{mfaToken:e,value:t,rememberDevice:n}),{loginState:a}=yield uo((e=>e.auth)),r=a.flow===Tt.Login?kt.success:a.step;yield oo(si.setState({loginState:{flow:a.flow,quickLoginToRegister:a.quickLoginToRegister,loading:!1,step:r,error:void 0,tenantsLoading:!0,tenants:[]},user:o,isAuthenticated:!0})),o.id&&localStorage.setItem("userId",o.id),yield oo(si.loadTenants()),yield oo(si.setLoginState({error:void 0,loading:!1})),a.flow===Tt.Login&&((yield so(wp))?yield oo(si.setLoginState({step:kt.promptPasskeys,loading:!1})):yield ap()),null==i||i(!0)}catch(e){yield oo(si.setLoginState({error:e.message,loading:!1})),null==i||i(!1,e)}}function*Vp({payload:e}){yield oo(si.setLoginState({loading:!0}));try{var t;yield so(qd.auth.recoverMfaToken,e),yield oo(si.setLoginState({loading:!1,error:void 0,step:kt.preLogin})),yield oo(si.setState({user:void 0,isAuthenticated:!1})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setLoginState({error:t.message,loading:!1})),null==(n=e.callback)||n.call(e,!1,t)}}function*jp({payload:e}){const{hostedLoginBox:t}=yield uo((e=>e.auth));yield oo(si.setState({isLoading:!0}));try{t?yield so(qd.auth.OAuthLogout):yield so(qd.auth.logout)}catch{}yield oo(si.resetState()),yield oo(si.requestAuthorize(!0)),null==e||e()}function*Wp({payload:e}){var t;try{yield so(qd.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*Kp({user:e,tenants:t}){const n={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=e&&e.recoveryCode&&(n.recoveryCode=e.recoveryCode),yield oo(si.setMfaState(n)),yield oo(si.setUser(e)),yield oo(si.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id)}function*Bp({user:e,tenants:t}){const{loginState:n}=yield uo((e=>e.auth));yield oo(si.setUser(e)),yield oo(si.setTenantsState({tenants:t,loading:!1})),e.id&&localStorage.setItem("userId",e.id);const{step:i}=yield uo((e=>e.auth.mfaState));if(n.flow===Tt.Login){const e=yield so(wp);i===nn.smsVerifyCode&&e?yield oo(si.setLoginState({step:kt.promptPasskeys,loading:!1})):yield ap()}yield oo(si.setState({isAuthenticated:!0}))}function*zp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Jf);yield oo(si.setLoginState({loading:!0}));try{const e=yield so(qd.auth.preEnrollMFASMSForLogin,n);yield oo(si.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*qp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Yf);yield oo(si.setLoginState({loading:!0}));try{const e=yield so(qd.auth.enrollMFASMSForLogin,n),i=yield so(qd.auth.generateLoginResponseV2,e);yield Kp(i),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Hp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Qf);yield oo(si.setLoginState({loading:!0}));try{var i;const e=yield so(qd.auth.preEnrollMFAWebAuthnForLogin,n),o=O({},e.options,{challenge:bt(e.options.challenge),user:O({},e.options.user,{id:bt(e.options.user.id)}),excludeCredentials:null==(i=e.options.excludeCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)})))});yield oo(si.setLoginState({loading:!1})),null==t||t({options:o,webauthnToken:e.webauthnToken})}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Jp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Xf);yield oo(si.setLoginState({loading:!0}));try{const e=At(n.publicKey),i=yield so(qd.auth.enrollMFAWebAuthnForLogin,O({},n,{options:e})),o=yield so(qd.auth.generateLoginResponseV2,i);yield Kp(o),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Yp(e){let{payload:{callback:t}}=e,n=bi(e.payload,Zf);yield oo(si.setLoginState({loading:!0}));try{const e=yield so(qd.auth.enrollMFAAuthenticatorAppForLogin,n),i=yield so(qd.auth.generateLoginResponseV2,e);yield Kp(i),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Qp(e){let{payload:{callback:t,deviceId:n}}=e,i=bi(e.payload,ep);yield oo(si.setLoginState({loading:!0}));try{const e=yield so(qd.auth.preVerifyMFASMSForLogin,n,i);yield oo(si.setMfaState({otcToken:e.otcToken,step:nn.smsVerifyCode,phoneNumber:e.phoneNumber})),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Xp(e){let{payload:{callback:t,deviceId:n}}=e,i=bi(e.payload,tp);yield oo(si.setLoginState({loading:!0}));try{const e=yield so(qd.auth.verifyMFASMSForLogin,n,i),o=yield so(qd.auth.generateLoginResponseV2,e);yield Bp(o),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*Zp(e){let{payload:{callback:t,deviceId:n}}=e,i=bi(e.payload,np);yield oo(si.setLoginState({loading:!0}));try{var o;const e=yield so(qd.auth.preVerifyMFAWebAuthnForLogin,n,i),a=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(o=e.options.allowCredentials)?void 0:o.map((e=>O({},e,{id:bt(e.id)})))});yield oo(si.setLoginState({loading:!1})),null==t||t({options:a,webauthnToken:e.webauthnToken})}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*eg(e){let{payload:{callback:t,deviceId:n}}=e,i=bi(e.payload,ip);yield oo(si.setLoginState({loading:!0}));try{const e=At(i.publicKey),o=yield so(qd.auth.verifyMFAWebAuthnForLogin,n,O({},i,{options:e})),a=yield so(qd.auth.generateLoginResponseV2,o);yield Bp(a),yield oo(si.setLoginState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setLoginState({loading:!1,error:e.message})),null==t||t(null)}}function*tg(){yield aa(si.requestAuthorize,bp),yield aa(si.requestAuthorizeSSR,kp),yield aa(si.requestHostedLoginAuthorize,Tp),yield aa(si.handleHostedLoginCallback,Pp),yield aa(si.preLogin,Rp),yield aa(si.postLogin,$p),yield aa(si.login,Gp),yield aa(si.logout,jp),yield aa(si.silentLogout,Wp),yield aa(si.loginWithMfa,xp),yield aa(si.recoverMfa,Vp),yield aa(si.quickSmsPasswordlessPreLogin,Ep),yield aa(si.changePhoneNumberWithVerification,Ip),yield aa(si.verifyChangePhoneNumber,Lp),yield aa(si.passwordlessPreLogin,Op),yield aa(si.passwordlessPostLogin,Dp),yield aa(si.verifyInviteToken,Cp),yield aa(si.webAuthnPrelogin,Np),yield aa(si.webAuthnPostLogin,Fp),yield aa(si.webAuthnCreateNewDeviceSession,_p),yield aa(si.webAuthnVerifyNewDeviceSession,Mp),yield aa(si.afterAuthNavigation,ap),yield aa(si.getUserIP,mp),yield aa(si.preEnrollMFASMSForLogin,zp),yield aa(si.enrollMFASMSForLogin,qp),yield aa(si.preEnrollMFAWebAuthnForLogin,Hp),yield aa(si.enrollMFAWebAuthnForLogin,Jp),yield aa(si.enrollMFAAuthenticatorAppForLogin,Yp),yield aa(si.preVerifyMFASMSForLogin,Qp),yield aa(si.verifyMFASMSForLogin,Xp),yield aa(si.preVerifyMFAWebAuthnForLogin,Zp),yield aa(si.verifyMFAWebAuthnForLogin,eg)}function*ng({payload:e}){e&&(yield oo(si.setState({isLoading:!0})));const t=my;yield oo(si.loadTenants()),yield oo(si.setState({user:t,isAuthenticated:!0,isLoading:!1}))}function*ig({payload:{callback:e}}){try{const{ip:t}=xy[0];yield oo(si.setState({userIp:t})),null==e||e(!0,t)}catch(t){null==e||e(!1,t)}}function*og(){yield aa(si.requestAuthorize,ng),yield aa(si.afterAuthNavigation,ap),yield aa(si.getUserIP,ig)}const ag=["callback","samlVendor"],rg=["callback","samlVendor"];function*sg(){try{var e,t;yield oo(si.setSSOState({loading:!0}));const n=yield so(qd.auth.getSamlConfiguration),i=yield so(qd.auth.getOidcConfiguration),o=yield so(qd.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 oo(si.setSSOState({samlConfiguration:n,oidcConfiguration:i,loading:!1,firstLoad:!1}))}catch(e){yield oo(si.setSSOState({error:e.message,loading:!1}))}}function*lg({payload:e}){const t=yield uo((e=>e.auth.ssoState.samlConfiguration)),n="saving";yield oo(si.setSSOState({error:void 0,[n]:!0}));try{const i=yield fy(e[0]),o=yield so(qd.auth.updateSamlVendorMetadata,{metadata:i});o.isSamlActive=null==t?void 0:t.isSamlActive,yield oo(si.setSSOState({samlConfiguration:o,error:void 0,[n]:!1}))}catch(e){yield oo(si.setSSOState({samlConfiguration:t,error:e.message,[n]:!1}))}}function*cg({payload:e}){const{configFile:t,callback:n}=e,i=yield uo((e=>e.auth.ssoState.samlConfiguration)),o="saving";yield oo(si.setSSOState({error:void 0,[o]:!0}));try{const e=yield fy(t),a=yield so(qd.auth.updateSamlVendorMetadata,{metadata:e});a.isSamlActive=null==i?void 0:i.isSamlActive,yield oo(si.setSSOState({samlConfiguration:a,error:void 0,[o]:!1})),null==n||n(!0)}catch(e){yield oo(si.setSSOState({samlConfiguration:i,error:e.message,[o]:!1})),null==n||n(null,e)}}function*ug({payload:e}){const{callback:t,samlVendor:n}=e,i=bi(e,ag),o=yield uo((e=>e.auth.ssoState.samlConfiguration)),a=O({},o,i);let r="saving";(null==a?void 0:a.enabled)!==o.enabled&&(r="loading");try{if(null==a||!a.domain)return void(yield oo(si.setSSOState({samlConfiguration:O({},o,a)})));if(yield oo(si.setSSOState({error:void 0,[r]:!0})),e.type===Yd.Saml){var s,l;const e=yield so(qd.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=uy(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 so(qd.auth.updateSamlConfiguration,i);c.isSamlActive=null==o?void 0:o.isSamlActive,yield oo(si.setSSOState({samlConfiguration:c,error:void 0,[r]:!1})),null==t||t(!0)}catch(e){yield oo(si.setSSOState({samlConfiguration:o,error:e.message,[r]:!1})),null==t||t(null,e)}}function*dg({payload:{callback:e}={}}){const t=yield uo((e=>e.auth.ssoState.samlConfiguration));try{yield oo(si.setSSOState({error:void 0,saving:!0})),yield so(qd.auth.validateSamlDomain),yield oo(si.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}catch(n){yield oo(si.setSSOState({samlConfiguration:O({},t,{validated:!1}),error:n.message,saving:!1})),null==e||e(null,n)}}function*yg(){try{const e=yield so(qd.auth.getSamlRoles),t=yield so(qd.auth.getSamlRolesGroups);yield oo(si.setSSOState({authorizationRoles:e.roleIds,rolesGroups:t,error:void 0}))}catch(e){yield oo(si.setSSOState({error:e.message}))}}function*fg({payload:{callback:e,authorizationRoles:t,groups:n}}){try{yield oo(si.setSSOState({error:void 0,saving:!0})),yield so(qd.auth.updateSamlRoles,{roleIds:t}),n&&(yield function*(e){try{yield ao(e.map((e=>so(qd.auth.updateSamlGroup,{id:e.id,roleIds:e.roleIds,group:e.group}))))}catch(e){yield oo(si.setSSOState({error:e.message}))}}(n)),yield yg(),yield oo(si.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield oo(si.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*pg({payload:{callback:e,id:t}}){try{yield oo(si.setSSOState({error:void 0,saving:!0})),yield so(qd.auth.deleteSamlGroup,{id:t}),yield yg(),yield oo(si.setSSOState({error:void 0,saving:!1})),null==e||e(!0)}catch(t){yield oo(si.setSSOState({error:t.message,saving:!1})),null==e||e(null,t)}}function*gg({payload:{group:e,roleIds:t,callback:n}}){try{yield oo(si.setSSOState({error:void 0,saving:!0})),yield so(qd.auth.createSamlGroup,{group:e,roleIds:t}),yield yg(),yield oo(si.setSSOState({error:void 0,saving:!1})),null==n||n(!0)}catch(e){yield oo(si.setSSOState({error:e.message,saving:!1})),null==n||n(null,e)}}function*Sg({payload:e}){const t={code:e.code,redirectUri:e.redirectUri,RelayState:e.state};try{yield oo(si.setSSOState({loading:!0})),yield so(qd.auth.oidcPostLoginV2,t),yield so(fp),yield oo(si.setSSOState({loading:!1}))}catch(e){var n;yield oo(si.setSSOState({loading:!1,error:null!=(n=e.message)?n:"Failed to authenticate",firstLoad:!1}))}}function*vg(){yield ia(si.loadSSOConfigurations,sg),yield ia(si.saveSSOConfigurations,ug),yield ia(si.saveSSOConfigurationsFile,lg),yield ia(si.saveSSOConfigurationsFileWithCallback,cg),yield ia(si.validateSSODomain,dg),yield ia(si.loadSSOAuthorizationRoles,yg),yield ia(si.updateSSOAuthorizationRoles,fg),yield ia(si.deleteSamlGroup,pg),yield ia(si.createSamlGroup,gg),yield ia(si.oidcPostlogin,Sg)}function*hg(){yield oo(si.setSSOState({loading:!0})),yield vt(),yield oo(si.setSSOState({samlConfiguration:Ly,loading:!1,firstLoad:!1}))}function*mg({payload:e}){const t="saving";yield oo(si.setSSOState({error:void 0,[t]:!0}));const n=O({},yield uo((e=>e.auth.ssoState.samlConfiguration)),{enabled:!0},e[0]);yield oo(si.setSSOState({samlConfiguration:n,error:void 0,[t]:!1}))}function*bg({payload:e}){var t,n;const{callback:i,samlVendor:o}=e,a=bi(e,rg),r=wy.samlConfiguration,s=O({},r,a);let l="saving";if((null==s?void 0:s.enabled)!==r.enabled&&(l="loading"),null==s||!s.domain)return void(yield oo(si.setSSOState({samlConfiguration:O({},r,s)})));yield oo(si.setSSOState({error:void 0,[l]:!0})),yield vt(),s.acsUrl=null==Ey||null==(t=Ey.configuration)?void 0:t.acsUrl,s.spEntityId=null==Ey||null==(n=Ey.configuration)?void 0:n.spEntityId;const c=uy(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 vt(),yield oo(si.setSSOState({samlConfiguration:c,error:void 0,[l]:!1})),null==i||i(!0)}function*Ag({payload:{callback:e}={}}){const t=wy.samlConfiguration;yield oo(si.setSSOState({error:void 0,saving:!0})),yield vt(),yield oo(si.setSSOState({samlConfiguration:O({},t,{validated:!0}),error:void 0,saving:!1})),null==e||e(!0)}function*kg(){yield vt(),yield oo(si.setSSOState({authorizationRoles:["1","2","3"],error:void 0}))}function*Tg({payload:{callback:e,authorizationRoles:t}}){yield oo(si.setSSOState({error:void 0,saving:!0})),yield vt(),yield oo(si.setSSOState({authorizationRoles:t,error:void 0,saving:!1})),null==e||e(!0)}function*Pg(){yield ia(si.loadSSOConfigurations,hg),yield ia(si.saveSSOConfigurations,bg),yield ia(si.saveSSOConfigurationsFile,mg),yield ia(si.validateSSODomain,Ag),yield ia(si.loadSSOAuthorizationRoles,kg),yield ia(si.updateSSOAuthorizationRoles,Tg)}const Ig=["callback"],Lg=["callback","ssoConfigId"],Eg=["callback","ssoConfigId"],Og=["callback","ssoConfigId"];function*wg(){try{return yield so(qd.auth.getOidcConfiguration)}catch(e){return null}}function*Dg(){try{return yield so(qd.metadata.getSamlMetadata)}catch(e){return null}}function*Cg(){try{yield oo(si.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!0}));const[e,t]=yield ao([so(wg),so(Dg)]),n=yield so(qd.auth.getSSOConfigurations);yield oo(si.setSSOState({ssoConfigurations:n,oidcConfiguration:e,samlMetadata:t}))}catch(e){yield oo(si.setSSOError({key:Jd.LOAD_SSO_CONFIGURATIONS,value:e.message}))}finally{yield oo(si.setSSOLoader({key:Jd.LOAD_SSO_CONFIGURATIONS,value:!1}))}}function*Rg({payload:e}){yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t}=e,n=bi(e,Ig),i=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{var o;const e=yield so(qd.auth.createSSOConfiguration,O({},n,{enabled:null!=(o=n.enabled)&&o}));yield oo(si.setSSOState({ssoConfigurations:[...i,e]})),null==t||t(e)}catch(e){yield oo(si.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!1}))}}function*Ug({payload:e}){yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{configFile:t,callback:n}=e,i=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fy(t),o=yield so(qd.auth.createSSOConfigurationByMetadata,{metadata:e});yield oo(si.setSSOState({ssoConfigurations:[...i,o]})),null==n||n(o)}catch(e){yield oo(si.setSSOError({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:e.message})),null==n||n(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*_g({payload:e}){yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=bi(e,Lg),o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield so(qd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t));yield oo(si.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield oo(si.setSSOError({key:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Mg({payload:e}){yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{callback:t,ssoConfigId:n,configFile:i}=e,o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield fy(i),a=yield so(qd.auth.updateSSOConfigurationByMetadata,n,{metadata:e}),r=o.map((e=>e.id===n?a:e));yield oo(si.setSSOState({ssoConfigurations:r})),null==t||t(a)}catch(e){yield oo(si.setSSOError({key:Jd.UPDATE_SSO_CONFIGURATION,value:e.message})),null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_CONFIGURATION,value:!1}))}}function*Ng({payload:e}){yield oo(si.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!0}));const{ssoConfigId:t,callback:n}=e,i=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{yield so(qd.auth.deleteSSOConfiguration,t),yield oo(si.setSSOState({ssoConfigurations:i.filter((({id:e})=>e!==t))})),null==n||n(!0)}catch(e){yield oo(si.setSSOError({key:Jd.DELETE_SSO_CONFIGURATION,value:e.message})),null==n||n(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.DELETE_SSO_CONFIGURATION,value:!1}))}}function*Fg({payload:e}){const{callback:t,ssoConfigId:n}=e,i=bi(e,Eg);yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!0}));const o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{const e=yield so(qd.auth.createSSODomain,n,i),a=o.map((t=>t.id===n?O({},t,{domains:[...t.domains,e]}):t));yield oo(si.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){yield oo(si.setSSOError({key:Jd.SAVE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_DOMAIN,value:!1}))}}function*$g({payload:e}){const{ssoConfigId:t,domainId:n,callback:i}=e;yield oo(si.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!0}));const o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{yield so(qd.auth.deleteSSODomain,t,n);const e=o.map((e=>e.id===t?O({},e,{domains:e.domains.filter((({id:e})=>e!==n))}):e));yield oo(si.setSSOState({ssoConfigurations:e})),null==i||i(!0)}catch(e){yield oo(si.setSSOError({key:Jd.DELETE_SSO_DOMAIN,value:e.message})),null==i||i(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.DELETE_SSO_DOMAIN,value:!1}))}}function*Gg({payload:e}){const{callback:t,domainId:n,ssoConfigId:i}=e;yield oo(si.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!0}));const o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{yield so(qd.auth.validateSSODomain,i,n);const e=o.map((e=>e.id===i?O({},e,{domains:e.domains.map((e=>e.id===n?O({},e,{validated:!0}):e))}):e));yield oo(si.setSSOState({ssoConfigurations:e})),null==t||t(!0)}catch(e){yield oo(si.setSSOError({key:Jd.VALIDATE_SSO_DOMAIN,value:e.message})),null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.VALIDATE_SSO_DOMAIN,value:!1}))}}function*xg({payload:{callback:e,ssoConfigId:t,roleIds:n}}){yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!0}));const i=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{yield so(qd.auth.setSSODefaultRoles,t,{roleIds:n});const o=i.map((e=>e.id===t?O({},e,{roleIds:n}):e));yield oo(si.setSSOState({ssoConfigurations:o})),null==e||e(!0)}catch(t){yield oo(si.setSSOError({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:t.message})),null==e||e(null,t)}finally{yield oo(si.setSSOLoader({key:Jd.UPDATE_SSO_DEFAULT_ROLES,value:!1}))}}function*Vg({payload:{groupsToAdd:e,groupsToDelete:t,ssoConfigId:n,callback:i}}){yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!0}));const o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{yield ao(t.map((e=>so(qd.auth.deleteSSOGroup,n,e)))),yield ao(e.map((e=>so(qd.auth.createSSOGroup,n,e))));const a=yield so(qd.auth.getSSOGroups,n),r=o.map((e=>e.id===n?O({},e,{groups:a}):e));yield oo(si.setSSOState({ssoConfigurations:r})),null==i||i(!0)}catch(e){yield oo(si.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==i||i(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*jg({payload:{ssoConfigId:e,changedGroups:t,callback:n}}){try{yield ao(t.map((t=>so(qd.auth.updateSSOGroup,e,t)))),null==n||n(!0)}catch(e){yield oo(si.setSSOError({key:Jd.SAVE_SSO_GROUPS,value:e.message})),null==n||n(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_GROUPS,value:!1}))}}function*Wg({payload:e}){yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!0}));const{metadataUrl:t,configMetadata:n,ssoConfigId:i,callback:o}=e,a=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{const e={metadata:yield so(da,t,void 0,{responseType:"plain"}),configMetadata:n};let r,s;i?(r=yield so(qd.auth.updateSSOConfigurationByMetadata,i,e),s=a.map((e=>e.id===i?r:e))):(r=yield so(qd.auth.createSSOConfigurationByMetadata,e),s=[r,...a]),yield oo(si.setSSOState({ssoConfigurations:s})),null==o||o(r)}catch(e){null==o||o(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Kg({payload:e}){yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION,value:!0}));const{callback:t,ssoConfigId:n}=e,i=bi(e,Og),o=yield uo((e=>e.auth.ssoState.ssoConfigurations));try{let e,a;n?(e=yield so(qd.auth.updateSSOConfiguration,n,i),a=o.map((t=>t.id===n?e:t))):(e=yield so(qd.auth.createSSOConfiguration,i),a=[e,...o]),yield oo(si.setSSOState({ssoConfigurations:a})),null==t||t(e)}catch(e){null==t||t(null,e)}finally{yield oo(si.setSSOLoader({key:Jd.SAVE_SSO_CONFIGURATION_BY_METADATA,value:!1}))}}function*Bg(){yield ia(si.loadSSOConfigurationsV2,Cg),yield ia(si.saveSSOConfigurationV2,Rg),yield ia(si.saveSSODomain,Fg),yield ia(si.deleteSSODomain,$g),yield ia(si.validateSSODomainV2,Gg),yield ia(si.updateSSOConfiguration,_g),yield ia(si.deleteSSOConfiguration,Ng),yield ia(si.setSSOGroups,Vg),yield ia(si.updateSSOGroups,jg),yield ia(si.setSSODefaultRoles,xg),yield ia(si.saveSSOConfigurationByMetadata,Ug),yield ia(si.updateSSOConfigurationByMetadata,Mg),yield ia(si.saveSSOConfigurationByUrl,Wg),yield ia(si.saveSSOConfigurationByData,Kg)}const zg=["callback","profilePictureUrl"],qg=["callback","profilePictureUrl"];function*Hg(){yield oo(si.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 so.apply(void 0,[na,e,t,n].concat(o))}(3,2e3,qd.teams.getProfile),t=yield uo((e=>e.auth.user));si.setUser(O({},t,e)),yield oo(si.setProfileState({profile:e,loading:!1}))}catch(e){yield oo(si.setProfileState({loading:!1,error:e.message}))}}function*Jg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=bi(e.payload,zg);yield oo(si.setProfileState({saving:!0,error:null,loading:!0}));try{const e=yield uo((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 so(qd.teams.updateProfileImage,e);const t=Date.now().toString(),n=new URL(o);n.searchParams.set("t",t),o=n.href}}const a=O({},e,i,{profilePictureUrl:o}),r=yield so(qd.teams.updateProfile,a),s=yield uo((e=>e.auth.user));yield oo(si.setUser(O({},s,r))),yield oo(si.setProfileState({profile:r,saving:!1,loading:!1})),null==t||t(a)}catch(e){yield oo(si.setProfileState({saving:!1,error:e.message,loading:!1})),null==t||t(null,e)}}function*Yg({payload:e}){yield oo(si.setProfileState({loading:!0}));try{var t;yield so(qd.teams.changePassword,e),yield oo(si.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setProfileState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*Qg(){yield aa(si.loadProfile,Hg),yield ia(si.saveProfile,Jg),yield ia(si.changePassword,Yg)}function*Xg(){yield oo(si.setProfileState({loading:!0})),yield vt(),yield oo(si.setUser(O({},my,hy))),yield oo(si.setProfileState({loading:!1,profile:hy}))}function*Zg(e){let{payload:{callback:t,profilePictureUrl:n}}=e,i=bi(e.payload,qg);yield oo(si.setProfileState({saving:!0,error:null}));const o=by;let a=o.profile.profilePictureUrl;n!==o.profile.profilePictureUrl&&n&&(n||"").match(/^data:image\/([A-Za-z-+\/]+);base64,(.+)$/)&&(a=n);const r=O({},o.profile,i,{profilePictureUrl:a}),s=my;yield vt(),yield oo(si.setUser(O({},s,r))),yield oo(si.setProfileState({loading:!1,error:null,saving:!1,profile:r})),null==t||t(r)}function*eS({payload:e}){var t;yield oo(si.setProfileState({loading:!0})),yield vt(),yield oo(si.setProfileState({loading:!1,error:void 0})),null==(t=e.callback)||t.call(e,!0)}function*tS(){yield aa(si.loadProfile,Xg),yield ia(si.saveProfile,Zg),yield ia(si.changePassword,eS)}const nS=["callback"],iS=["callback"],oS=["callback"],aS=["deviceId","callback"],rS=["deviceId","callback"],sS=["callback"],lS=["deviceId"],cS=["deviceId"],uS=["callback"],dS=["deviceId"],yS=["callback"];function*fS(e){const{step:t}=yield uo((e=>e.auth.mfaState));return{step:e.recoveryCode?nn.recoveryCode:t,loading:!1,saving:!1,error:void 0,recoveryCode:null==e?void 0:e.recoveryCode}}function*pS(){yield oo(si.setMfaState({saving:!0}));try{const{qrCode:e}=yield so(qd.auth.enrollMfa);yield oo(si.setMfaState({saving:!1,error:void 0,qrCode:e}))}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message}))}}function*gS(e){let{payload:{callback:t}}=e,n=bi(e.payload,nS);yield oo(si.setMfaState({saving:!0}));try{const e=yield uo((e=>e.auth.user)),i=yield so(qd.auth.verifyMfa,n),o=yield so(qd.auth.getMFADevices),a=yield fS(i);yield oo(si.setMfaState(O({},a,{mfaDevices:o}))),yield oo(si.setUser(O({},e,{mfaEnrolled:!0}))),null==t||t(a.recoveryCode)}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*SS(e){let{payload:{callback:t}}=e,n=bi(e.payload,iS);yield oo(si.setMfaState({loading:!0}));try{const e=yield so(qd.auth.loginWithMfa,n),i={step:nn.recoveryCode,loading:!1,saving:!1,error:void 0};null!=e&&e.recoveryCode&&(i.recoveryCode=e.recoveryCode),yield oo(si.setMfaState(i)),yield oo(si.setState({user:e})),yield oo(si.loadTenants()),null==t||t(i.recoveryCode)}catch(e){yield oo(si.setMfaState({loading:!1,error:e.message})),null==t||t(null,e)}}function*vS({payload:e}){yield oo(si.setMfaState({saving:!0}));try{var t;yield so(qd.auth.disableMfa,e);const n=yield so(qd.auth.getMFADevices);yield oo(si.setMfaState({saving:!1,error:void 0,mfaDevices:n})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*hS({payload:e}){yield oo(si.setMfaState({saving:!0}));try{var t,n;const i=yield so(qd.auth.preEnrollMFAWebAuthn),o=O({},i.options,{challenge:bt(i.options.challenge),user:O({},i.options.user,{id:bt(i.options.user.id)}),excludeCredentials:null==(t=i.options.excludeCredentials)?void 0:t.map((e=>O({},e,{id:bt(e.id)})))});yield oo(si.setMfaState({saving:!1})),null==(n=e.callback)||n.call(e,{options:o,webauthnToken:i.webauthnToken})}catch(t){var i;yield oo(si.setMfaState({saving:!1,error:t.message})),null==(i=e.callback)||i.call(e,null,t)}}function*mS(e){let{payload:{callback:t}}=e,n=bi(e.payload,oS);yield oo(si.setMfaState({saving:!0}));try{const e=At(n.publicKey),i=yield so(qd.auth.enrollMFAWebAuthn,O({},n,{options:e})),o=yield so(qd.auth.getMFADevices),a=yield fS(i);yield oo(si.setMfaState(O({},a,{mfaDevices:o}))),null==t||t(a.recoveryCode)}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*bS(e){let{payload:{deviceId:t,callback:n}}=e;bi(e.payload,aS),yield oo(si.setMfaState({saving:!0}));try{var i;const e=yield so(qd.auth.preDisableMFAWebAuthn,t),o=O({},e.options,{challenge:bt(e.options.challenge),allowCredentials:null==(i=e.options.allowCredentials)?void 0:i.map((e=>O({},e,{id:bt(e.id)})))});yield oo(si.setMfaState({saving:!1})),null==n||n({options:o,webauthnToken:e.webauthnToken})}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message})),null==n||n(null,e)}}function*AS(e){let{payload:{deviceId:t,callback:n}}=e,i=bi(e.payload,rS);yield oo(si.setMfaState({saving:!0}));try{const e=At(i.publicKey);yield so(qd.auth.disableMFAWebAuthn,t,O({},i,{options:e}));const o=yield so(qd.auth.getMFADevices);yield oo(si.setMfaState({saving:!1,error:void 0,mfaDevices:o})),null==n||n(!0)}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message})),null==n||n(!1,e)}}function*kS({payload:e}){yield oo(si.setMfaState({saving:!0}));try{var t;const n=yield so(qd.auth.preEnrollMFASMS,e);yield oo(si.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 oo(si.setMfaState({saving:!1,error:t.message})),null==(n=e.callback)||n.call(e,!1,t)}}function*TS(e){let{payload:{callback:t}}=e,n=bi(e.payload,sS);yield oo(si.setMfaState({saving:!0}));try{const e=yield so(qd.auth.enrollMFASMS,n),i=yield so(qd.auth.getMFADevices),o=yield fS(e);yield oo(si.setMfaState(O({},o,{mfaDevices:i}))),null==t||t(o.recoveryCode)}catch(e){yield oo(si.setMfaState({saving:!1,error:e.message})),null==t||t(null,e)}}function*PS(e){let{payload:{deviceId:t}}=e,n=bi(e.payload,lS);yield oo(si.setMfaState({saving:!0}));try{var i;const e=yield so(qd.auth.preDisableMFASMS,t);yield oo(si.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 oo(si.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*IS(e){let{payload:{deviceId:t}}=e,n=bi(e.payload,cS);yield oo(si.setMfaState({saving:!0}));try{var i;yield so(qd.auth.disableMFASMS,t,n);const e=yield so(qd.auth.getMFADevices);yield oo(si.setMfaState({saving:!1,error:void 0,mfaDevices:e})),null==(i=n.callback)||i.call(n,!0)}catch(e){var o;yield oo(si.setMfaState({saving:!1,error:e.message})),null==(o=n.callback)||o.call(n,!1,e)}}function*LS(){yield oo(si.setMfaState({loading:!0}));try{yield uo((e=>e.auth.user));const e=yield so(qd.auth.getMFADevices);yield oo(si.setMfaState({loading:!1,error:void 0,mfaDevices:e}))}catch(e){yield oo(si.setMfaState({loading:!1,error:e.message}))}}function*ES(){yield oo(si.setMfaState({loading:!0}));try{const e=(yield so(qd.auth.getMFAStrategiesConfig)).strategies.filter((({isActive:e})=>e)).map((({strategy:e})=>e));yield oo(si.setMfaState({loading:!1,error:void 0,mfaStrategies:e}))}catch(e){yield oo(si.setMfaState({loading:!1,error:e.message}))}}function*OS(){yield ia(si.enrollMfa,pS),yield ia(si.getMFADevices,LS),yield ia(si.getMFAStrategies,ES),yield ia(si.verifyMfa,gS),yield ia(si.disableMfa,vS),yield ia(si.verifyMfaAfterForce,SS),yield ia(si.preDisableMfaSms,PS),yield ia(si.disableMfaSms,IS),yield ia(si.preEnrollMfaSms,kS),yield ia(si.enrollMfaSms,TS),yield ia(si.preEnrollMfaWebAuthn,hS),yield ia(si.enrollMfaWebAuthn,mS),yield ia(si.preDisableMfaWebAuthn,bS),yield ia(si.disableMfaWebAuthn,AS)}function*wS(){yield oo(si.setMfaState({saving:!0})),yield oo(si.setMfaState({saving:!1,error:void 0,qrCode:"test"}))}function*DS({payload:{callback:e}}){const{mfaDevices:t={webauthn:[],phones:[],authenticators:[]}}=yield uo((e=>e.auth.mfaState));yield oo(si.setMfaState({saving:!0})),yield vt();const n={token:"token",recoveryCode:"recoveryCode"},i={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},t,{authenticators:[{id:"authenticator-id"}]})};null!=n&&n.recoveryCode&&(i.recoveryCode=n.recoveryCode),yield oo(si.setMfaState(i)),yield oo(si.setUser(O({},my,{mfaEnrolled:!0}))),null==e||e(i.recoveryCode)}function*CS(e){let{payload:{callback:t}}=e,n=bi(e.payload,uS);yield oo(si.setMfaState({loading:!0})),yield vt();const i=O({},n,{recoveryCode:"recoveryCode"}),o={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield oo(si.setMfaState(o)),yield vt(),yield oo(si.setUser(O({},my,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*RS({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield uo((e=>e.auth.mfaState));yield oo(si.setMfaState({saving:!0})),yield vt(),yield oo(si.setMfaState({saving:!1,error:void 0,mfaDevices:O({},n,{authenticators:[]})})),yield oo(si.setUser(O({},my))),null==(t=e.callback)||t.call(e,!0)}function*US(e){let{}=e,t=bi(e.payload,dS);yield oo(si.setMfaState({saving:!0}));try{var n;yield oo(si.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(n=t.callback)||n.call(t,!0)}catch(e){var i;yield oo(si.setMfaState({saving:!1,error:e.message})),null==(i=t.callback)||i.call(t,!1,e)}}function*_S({payload:e}){var t;const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield uo((e=>e.auth.mfaState));yield oo(si.setMfaState({saving:!0})),yield vt(),yield oo(si.setMfaState({loading:!1,error:void 0,mfaDevices:O({},n,{phones:[]})})),yield oo(si.setUser(O({},my))),null==(t=e.callback)||t.call(e,!0)}function*MS({payload:e}){var t;yield oo(si.setMfaState({saving:!0})),yield vt(),yield oo(si.setMfaState({saving:!1,error:void 0,otcToken:"otc-token",phoneNumber:"+972504589346"})),null==(t=e.callback)||t.call(e,!0)}function*NS(e){let{payload:{callback:t}}=e;bi(e.payload,yS);const{mfaDevices:n={webauthn:[],phones:[],authenticators:[]}}=yield uo((e=>e.auth.mfaState));yield oo(si.setMfaState({saving:!0})),yield vt();const i={token:"token",recoveryCode:"recoveryCode"},o={step:nn.recoveryCode,loading:!1,error:void 0,saving:!1,mfaDevices:O({},n,{phones:[{id:"phone-id",phoneNumber:"+972504589346"}]})};null!=i&&i.recoveryCode&&(o.recoveryCode=i.recoveryCode),yield oo(si.setMfaState(o)),yield oo(si.setUser(O({},my,{mfaEnrolled:!0}))),null==t||t(o.recoveryCode)}function*FS(){yield ia(si.enrollMfa,wS),yield ia(si.verifyMfa,DS),yield ia(si.disableMfa,RS),yield ia(si.verifyMfaAfterForce,CS),yield ia(si.preDisableMfaSms,US),yield ia(si.disableMfaSms,_S),yield ia(si.preEnrollMfaSms,MS),yield ia(si.enrollMfaSms,NS)}const $S=["callback"];function*GS({payload:e}){yield oo(si.setForgotPasswordState({loading:!0}));try{var t;yield so(qd.auth.forgotPassword,e),yield oo(si.setForgotPasswordState({loading:!1,error:void 0,step:jt.success})),null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setForgotPasswordState({loading:!1,error:t.message||"Unknown error occurred"})),null==(n=e.callback)||n.call(e,!1,t)}}function*xS(e){let{payload:{callback:t}}=e,n=bi(e.payload,$S);yield oo(si.setForgotPasswordState({loading:!0}));try{yield so(qd.auth.resetPassword,n),yield oo(si.setForgotPasswordState({loading:!1,error:void 0,step:jt.success})),null==t||t(!0)}catch(e){yield oo(si.setForgotPasswordState({loading:!1,error:e.message})),null==t||t(!1,e)}}function*VS({payload:e}){yield oo(si.setForgotPasswordState({loading:!0}));try{const t=yield so(qd.auth.loadPasswordConfig,e);yield oo(si.setForgotPasswordState({loading:!1,passwordConfig:t}))}catch(e){yield oo(si.setForgotPasswordState({loading:!1,error:e.message}))}}function*jS(){yield aa(si.forgotPassword,GS),yield aa(si.resetPassword,xS),yield aa(si.loadPasswordConfig,VS)}let WS;!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"}(WS||(WS={}));const KS=["callback","events"],BS=["callback"],zS=["callback"];function*qS({payload:{userId:e,token:t}}){yield oo(si.setActivateState({loading:!0,step:_t.activating}));try{const{isAuthenticated:n}=yield uo((e=>e.auth));n&&(yield oo(si.silentLogout()));const i=yield so(qd.auth.getActivateAccountStrategy,{userId:e,token:t});yield oo(si.setActivateStrategyState({strategy:i,loading:!1,error:void 0})),i.shouldSetPassword&&(yield oo(si.setActivateState({loading:!1,step:_t.activatingForm})))}catch(e){yield oo(si.setActivateState({loading:!1,error:e.message}))}}function*HS(e){let{payload:{callback:t,events:n}}=e,i=bi(e.payload,KS);yield oo(si.setActivateState({loading:!0}));try{const e=ra.onRedirectTo,{routes:a}=yield uo((e=>e.auth)),r=yield so(qd.auth.activateAccount,i);if(r.redirectLocation)return void(window.location.href=r.redirectLocation);if(lp(r)){yield oo(si.setActivateState({step:_t.success}));const t=yield dp(r);yield oo(si.setState(t)),yield yo(1e3),e(a.loginUrl,{preserveQueryParams:!0})}else{var o;yield oo(si.setActivateState({step:_t.success}));const{user:e,tenants:t}=yield so(qd.auth.generateLoginResponseV2,r);null==n||null==(o=n.userVerified)||o.call(n,{email:e.email,origin:Ky.ACTIVATION_LINK,id:e.id,tenantId:e.tenantId,name:e.name,createdAt:new Date}),yield oo(si.setTenantsState({tenants:t,loading:!1})),yield oo(si.setState({user:e,isAuthenticated:!0})),yield yo(1e3),yield ap(),yield oo(si.resetActivateState())}null==t||t(!0)}catch(e){yield oo(si.setActivateState({loading:!1,error:e.message}))}}function*JS({payload:e}){const{callback:t}=e,n=bi(e,BS);yield oo(si.setActivateStrategyState({loading:!0}));try{const e=yield so(qd.auth.getActivateAccountStrategy,n);yield oo(si.setActivateStrategyState({strategy:e,loading:!1,error:void 0})),null==t||t(e)}catch(e){yield oo(si.setActivateStrategyState({loading:!1,error:e.message}))}}function*YS({payload:e}){const{callback:t}=e,n=bi(e,zS);yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:n.email})),yield oo(si.setActivateState({loading:!0}));try{yield so(qd.auth.resendActivationEmail,n),yield oo(si.setActivateState({loading:!1,error:void 0,resentEmail:!0})),null==t||t(!0)}catch(e){yield oo(si.setActivateState({loading:!1,error:e.message})),yield oo(si.setTeamError({key:WS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:!1}))}function*QS(){yield aa(si.activateAccount,HS),yield aa(si.preActivateAccount,qS),yield aa(si.getActivateAccountStrategy,JS),yield aa(si.resendActivationEmail,YS)}function*XS({payload:e}){if(e.token&&e.userId)try{yield oo(si.setAcceptInvitationState({error:void 0,step:$t.pending})),yield so(qd.auth.acceptInvitation,e),yield oo(si.setState({isAuthenticated:!1,user:null,acceptInvitationState:{error:void 0,step:$t.success}}))}catch(e){yield oo(si.setAcceptInvitationState({step:$t.failed,error:e.message}))}else yield oo(si.setAcceptInvitationState({error:void 0,step:$t.invalid}))}function*ZS(){yield aa(si.acceptInvitation,XS)}var ev,tv=new Uint8Array(16);function nv(){if(!ev&&!(ev="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 ev(tv)}for(var iv=/^(?:[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,ov=function(e){return"string"==typeof e&&iv.test(e)},av=[],rv=0;rv<256;++rv)av.push((rv+256).toString(16).substr(1));var sv=function(e,t,n){var i=(e=e||{}).random||(e.rng||nv)();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=(av[e[t+0]]+av[e[t+1]]+av[e[t+2]]+av[e[t+3]]+"-"+av[e[t+4]]+av[e[t+5]]+"-"+av[e[t+6]]+av[e[t+7]]+"-"+av[e[t+8]]+av[e[t+9]]+"-"+av[e[t+10]]+av[e[t+11]]+av[e[t+12]]+av[e[t+13]]+av[e[t+14]]+av[e[t+15]]).toLowerCase();if(!ov(n))throw TypeError("Stringified UUID is invalid");return n}(i)};let lv,cv;!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"}(lv||(lv={})),function(e){e.roles="roles",e.users="users",e.rolesAndUsers="rolesAndUsers"}(cv||(cv={}));const uv=["callback"],dv=["roles"],yv=["callback"],fv=["callback","profileImage"],pv=["callback"],gv=["callback","userId"],Sv=["callback"],vv=["callback"],hv=["callback"],mv=["callback"],bv=["callback"],Av=["callback"],kv=["callback"],Tv=["callback","profileImage"],Pv=["callback"],Iv=["callback"],Lv=["callback"],Ev=["callback"],Ov=["callback"],wv=["callback"],Dv=()=>uo((e=>e.auth.teamState));function*Cv(){try{const{groups:e}=yield so(qd.groups.getGroups,{_groupsRelations:cv.roles});return e}catch(e){return[]}}function*Rv({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Dv(),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 oo(si.setTeamLoader({key:WS.USERS,value:!a})),yield oo(si.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d}));try{const[{items:e,totalPages:t,totalItems:n},{items:i},{items:o},a]=yield ao([so(qd.teams.loadUsers,{pageSize:l,pageOffset:c,filter:u,sort:d}),so(qd.teams.loadAvailableRoles),so(qd.teams.loadAvailablePermissions),so(Cv)]),s=e.map((e=>{var t;const n=null==e||null==(t=e.groups)?void 0:t.map((e=>a.filter((t=>t.id===e.id)))).flat();return O({},e,{groups:n})}));yield oo(si.setTeamState({users:s,totalPages:t,totalItems:n,roles:i,permissions:o})),null==r||r(e)}catch(e){yield oo(si.setTeamError({key:WS.USERS,value:e.message})),yield oo(si.setTeamState({totalPages:0,users:[]})),null==r||r(null,e)}yield oo(si.setTeamLoader({key:WS.USERS,value:!1}))}function*Uv({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Dv(),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 oo(si.setTeamLoader({key:WS.USERS,value:!r})),yield oo(si.setTeamState({allUsersQueryParams:c}));try{const[{items:e,_metadata:{totalPages:t,totalItems:n}},{items:i},{items:o}]=yield ao([so(qd.subTenants.loadAllUsers,O({},c)),so(qd.teams.loadAvailableRoles),so(qd.teams.loadAvailablePermissions)]);yield oo(si.setTeamState({allUsers:e,totalPages:t,totalItems:n,roles:i,permissions:o})),null==s||s(e)}catch(e){yield oo(si.setTeamError({key:WS.USERS,value:e.message})),yield oo(si.setTeamState({totalPages:0,users:[]})),null==s||s(null,e)}yield oo(si.setTeamLoader({key:WS.USERS,value:!1}))}function*_v({payload:e}){yield oo(si.setTeamLoader({key:WS.ROLES_AND_PERMISSIONS,value:!0}));try{var t;const[{items:n},{items:i}]=yield ao([so(qd.teams.loadAvailableRoles),so(qd.teams.loadAvailablePermissions)]);yield oo(si.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 oo(si.setTeamError({key:WS.ROLES_AND_PERMISSIONS,value:t.message}))}yield oo(si.setTeamLoader({key:WS.ROLES_AND_PERMISSIONS,value:!0}))}function*Mv({payload:e}){const{callback:t}=e,n=bi(e,uv),i=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{var o;const e=yield so(qd.teams.addUser,n),{roles:a}=e,r=O({},bi(e,dv),{roleIds:null!=(o=null==a?void 0:a.map((e=>e.id)))?o:[]});null==t||t(r),yield oo(si.setTeamState({users:[r,...i.users],addUserDialogState:{open:!1,loading:!1}}))}catch(e){yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Nv({payload:e}){const{callback:t}=e,n=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},n.addUserDialogState,{loading:!0})}));const i=[],o=[],a=e.emails.map((t=>({email:t,roleIds:e.roleIds})));yield oo(si.setTeamState({addUserDialogState:{open:!0,loading:!0}}));for(let e=0;e<a.length;e++){const t=a.at(e);try{yield so(qd.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 oo(si.loadUsers(r)),yield oo(si.setTeamState({addUserDialogState:{loading:!1}})),null==t||t({unallowedEmails:o,allowedEmails:i})}function*Fv({payload:e}){const{callback:t}=e,n=bi(e,yv),i=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})}));try{yield so(qd.subTenants.addUserToTenantAndSubTenants,n);const{items:e,_metadata:{totalPages:i,totalItems:o}}=yield so(qd.subTenants.loadAllUsers,{_limit:20,_offset:0,_filter:"",_sortBy:"name",_order:"DESC"});yield oo(si.setTeamState({allUsers:e,totalPages:i,totalItems:o,addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}catch(e){yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*$v({payload:e}){const{callback:t}=e,n=bi(e,fv),{id:i}=n,o=yield Dv(),a=o.users.find((e=>e.id===n.id));yield oo(si.setTeamLoader({key:WS.UPDATE_USER,value:i||""})),yield oo(si.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})})),yield oo(si.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0}),users:o.users.map((e=>e.id===n.id?O({},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 so(qd.teams.updateUser,n);null==t||t(e),yield oo(si.setTeamState({users:o.users.map((t=>t.id===e.id?O({},t,e,{groups:t.groups,createdAt:t.createdAt,customData:t.customData,lastLogin:t.lastLogin}):t))})),yield oo(si.setTeamLoader({key:WS.UPDATE_USER,value:!1}))}catch(e){yield oo(si.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message}),users:o.users.map((e=>e.id===n.id?O({},e,a):e))})),yield oo(si.setTeamLoader({key:WS.UPDATE_USER,value:!1})),null==t||t(null,e.message)}}function*Gv({payload:e}){const{callback:t}=e,n=bi(e,pv),i=yield Dv();yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!0})}));try{yield so(qd.teams.deleteUser,n),null==t||t(!0),yield oo(si.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*xv({payload:e}){const{callback:t,userId:n}=e,i=bi(e,gv),o=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!0})}));try{yield so(qd.subTenants.setUserRolesForSubTenants,n,i);const e=o.allUsers.find((e=>e.id===n));let a=[];e&&(a=e.tenants.map((e=>{var t;return O({},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 oo(si.setTeamState({allUsers:[...o.allUsers.filter((e=>e.id!==n)),...e?[O({},e,{tenants:a})]:[]],addUserDialogState:{open:!1,loading:!1}})),null==t||t(!0)}catch(e){yield oo(si.setTeamState({addUserDialogState:O({},o.addUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*Vv({payload:e}){const{callback:t}=e,n=bi(e,Sv),i=yield Dv();yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!0})}));try{yield so(qd.subTenants.removeUserFromTenantAndSubTenants,n),null==t||t(!0),yield oo(si.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId&&e.tenants.length===n.subTenants.length)),deleteUserDialogState:{open:!1,loading:!1}}))}catch(e){yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!1,error:e.message})})),null==t||t(null,e.message)}}function*jv({payload:e}){const{callback:t}=e,n=bi(e,vv);yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:n.userId}));try{yield so(qd.teams.resendActivationLink,n),null==t||t(!0)}catch(e){yield oo(si.setTeamError({key:WS.RESEND_ACTIVATE_LINK,value:e.message})),null==t||t(null,e.message)}yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:!1}))}function*Wv({payload:e}){const{callback:t}=e,n=bi(e,hv);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email}));try{yield so(qd.teams.resendInvitationLink,n),null==t||t(!0)}catch(e){yield oo(si.setTeamError({key:WS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*Kv({payload:e}){const{callback:t}=e,n=bi(e,mv);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email}));try{yield so(qd.auth.resendInvitationEmail,n),null==t||t(!0)}catch(e){yield oo(si.setTeamError({key:WS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*Bv({payload:e}){const{callback:t}=e,n=bi(e,bv);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email}));try{yield so(qd.teams.resendInvitationLinkToAllTenants,n),null==t||t(!0)}catch(e){yield oo(si.setTeamError({key:WS.RESEND_INVITATION_LINK,value:e.message})),null==t||t(null,e.message)}yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*zv(){yield oo(si.setTeamError({key:WS.CONFIG_TOKEN_LINK,value:!1}));try{const e=yield so(qd.teams.getInviteLinkConfiguration);yield oo(si.setTeamState({inviteTokenState:O({},e)}))}catch(e){yield oo(si.setTeamError({key:WS.CONFIG_TOKEN_LINK,value:e.message}))}}function*qv(){yield oo(si.setTeamError({key:WS.GET_TOKEN_LINK,value:!1}));try{yield so(zv);const e=yield so(qd.teams.getInviteUserLink),{inviteTokenState:t}=yield Dv();yield oo(si.setTeamState({inviteTokenState:O({},t,e)}))}catch(e){yield oo(si.setTeamError({key:WS.GET_TOKEN_LINK,value:e.message}))}}function*Hv({payload:{callback:e}}){yield oo(si.setTeamError({key:WS.CREATE_TOKEN_LINK,value:!1}));const{inviteTokenState:t}=yield Dv();try{const n=yield so(qd.teams.createInviteUserLink,{expiresInMinutes:43200});yield oo(si.setTeamState({inviteTokenState:O({},t,n)})),null==e||e(n.token)}catch(t){null==e||e(null,t.message),yield oo(si.setTeamError({key:WS.CREATE_TOKEN_LINK,value:t.message}))}}function*Jv({payload:{callback:e,expiresInMinutes:t,shouldSendEmail:n}}){const{inviteTokenState:i}=yield Dv();yield oo(si.setTeamError({key:WS.UPDATE_TOKEN_LINK,value:!1}));try{const o=yield so(qd.teams.updateInviteUserLink,{expiresInMinutes:t,shouldSendEmail:n});yield oo(si.setTeamState({inviteTokenState:O({},i,o)})),null==e||e(!0)}catch(t){null==e||e(null,t.message),yield oo(si.setTeamError({key:WS.UPDATE_TOKEN_LINK,value:t.message}))}}function*Yv({payload:e}){const{callback:t}=null!=e?e:{};yield oo(si.setTeamError({key:WS.DELETE_TOKEN_LINK,value:!1}));try{yield so(qd.teams.deleteInviteUserLink),yield oo(si.setTeamState({inviteTokenState:void 0})),null==t||t(!0)}catch(e){yield oo(si.setTeamError({key:WS.DELETE_TOKEN_LINK,value:e.message})),null==t||t(!1,e.message)}}function*Qv({payload:e}){yield oo(si.setTeamState({addUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*Xv({payload:e}){const t=yield Dv(),{addUserDialogState:{onClose:n}}=t;null==n||n(e),yield oo(si.setTeamState({addUserDialogState:{loading:!1,error:!1,open:!1}}))}function*Zv({payload:e}){yield oo(si.setTeamState({deleteUserDialogState:O({open:!0,loading:!1,error:!1},e)}))}function*eh({payload:e}){const t=yield Dv(),{deleteUserDialogState:{onClose:n}}=t;null==n||n(e),yield oo(si.setTeamState({deleteUserDialogState:{loading:!1,error:!1,open:!1}}))}function*th(){yield oa(si.loadUsers,Rv),yield oa(si.loadAllSubTenantsUsers,Uv),yield oa(si.loadRoles,_v),yield ia(si.addUser,Mv),yield ia(si.addUsersBulk,Nv),yield ia(si.addUserToSubTenants,Fv),yield ia(si.updateUser,$v),yield ia(si.setUserRolesForSubTenants,xv),yield ia(si.deleteUser,Gv),yield ia(si.deleteUserFromSubTenants,Vv),yield ia(si.resendActivationLink,jv),yield ia(si.resendInvitationLink,Wv),yield ia(si.resendInvitationEmail,Kv),yield ia(si.resendInvitationLinkToAllSubTenants,Bv),yield ia(si.getInvitationLink,qv),yield ia(si.createInvitationLink,Hv),yield ia(si.updateInvitationLink,Jv),yield ia(si.deleteInvitationLink,Yv),yield ia(si.openAddUserDialog,Qv),yield ia(si.closeAddUserDialog,Xv),yield ia(si.openDeleteUserDialog,Zv),yield ia(si.closeDeleteUserDialog,eh)}function*nh({payload:e}){var t,n,i,o;const{silentLoading:a,callback:r}=e,s=yield Dv(),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 oo(si.setTeamLoader({key:WS.USERS,value:!a})),yield oo(si.setTeamState({pageSize:l,pageOffset:c,filter:u,sort:d})),yield vt(),yield oo(si.setTeamState({users:_y,totalPages:2,totalItems:10,roles:Oy,permissions:Dy})),yield oo(si.setTeamLoader({key:WS.USERS,value:!1})),null==r||r(_y)}function*ih({payload:e}){var t,n,i,o,a;const{silentLoading:r,callback:s}=e,l=yield Dv(),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 oo(si.setTeamLoader({key:WS.USERS,value:!r})),yield oo(si.setTeamState({allUsersQueryParams:{_limit:c,_offset:u,_filter:d,_sortBy:y,_order:f}})),yield vt(),yield oo(si.setTeamState({allUsers:My,totalPages:2,totalItems:10,roles:Oy,permissions:Dy})),yield oo(si.setTeamLoader({key:WS.USERS,value:!1})),null==s||s(My)}function*oh({payload:e}){var t;yield oo(si.setTeamLoader({key:WS.ROLES_AND_PERMISSIONS,value:!0})),yield vt(),yield oo(si.setTeamState({roles:Oy,permissions:Dy})),yield oo(si.setTeamLoader({key:WS.ROLES_AND_PERMISSIONS,value:!0})),null==e||null==(t=e.callback)||t.call(e,{roles:Oy,permissions:Dy})}function*ah({payload:e}){const{callback:t}=e,n=bi(e,Av),i=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})})),yield vt();const o=O({},Ry,{groups:[]},n,{id:`${sv()}`});null==t||t(o),yield oo(si.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}}))}function*rh({payload:e}){const{callback:t}=e,n=bi(e,kv),i=yield Dv();yield oo(si.setTeamState({addUserDialogState:O({},i.addUserDialogState,{loading:!0})})),yield vt();const o=O({},Ry,n,{id:`${sv()}`});yield oo(si.setTeamState({users:[o,...i.users],addUserDialogState:{open:!1,loading:!1}})),null==t||t(null)}function*sh({payload:e}){var t;const{callback:n}=e,i=bi(e,Tv),{id:o}=i,a=yield Dv(),r=a.users.find((e=>e.id===i.id));yield oo(si.setTeamLoader({key:WS.UPDATE_USER,value:o||""})),yield oo(si.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0})})),yield oo(si.setTeamState({addUserDialogState:O({},a.addUserDialogState,{loading:!0}),users:a.users.map((e=>e.id===i.id?O({},e,i):e))})),r.roleIds.length>0&&0===(null==(t=i.roleIds)?void 0:t.length)&&(i.roleIds=[""]),yield vt();const s=O({},r,i);null==n||n(s),yield oo(si.setTeamState({users:a.users.map((e=>e.id===s.id?O({},e,s,{createdAt:e.createdAt,customData:e.customData,lastLogin:e.lastLogin}):e))})),yield oo(si.setTeamLoader({key:WS.UPDATE_USER,value:!1}))}function*lh({payload:e}){const{callback:t}=e,n=bi(e,Pv),i=yield Dv();yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield oo(si.setTeamState({users:i.users.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*ch({payload:e}){const{callback:t}=e,n=bi(e,Iv),i=yield Dv();yield oo(si.setTeamState({deleteUserDialogState:O({},i.deleteUserDialogState,{loading:!0})})),yield vt(),null==t||t(!0),yield oo(si.setTeamState({allUsers:i.allUsers.filter((e=>e.id!==n.userId)),deleteUserDialogState:{open:!1,loading:!1}}))}function*uh({payload:e}){const{callback:t}=e,n=bi(e,Lv);yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:n.userId})),yield vt(),null==t||t(!0),yield oo(si.setTeamLoader({key:WS.RESEND_ACTIVATE_LINK,value:!1}))}function*dh({payload:e}){const{callback:t}=e,n=bi(e,Ev);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*yh({payload:e}){const{callback:t}=e,n=bi(e,Ov);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*fh({payload:e}){const{callback:t}=e,n=bi(e,wv);yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:n.email})),yield vt(),null==t||t(!0),yield oo(si.setTeamLoader({key:WS.RESEND_INVITATION_LINK,value:!1}))}function*ph(){yield oa(si.loadUsers,nh),yield oa(si.loadAllSubTenantsUsers,ih),yield oa(si.loadRoles,oh),yield ia(si.addUser,ah),yield ia(si.addUserToSubTenants,rh),yield ia(si.updateUser,sh),yield ia(si.deleteUser,lh),yield ia(si.deleteUserFromSubTenants,ch),yield ia(si.resendActivationLink,uh),yield ia(si.resendInvitationLink,dh),yield ia(si.resendInvitationEmail,yh),yield ia(si.resendInvitationLinkToAllSubTenants,fh),yield ia(si.openAddUserDialog,Qv),yield ia(si.closeAddUserDialog,Xv),yield ia(si.openDeleteUserDialog,Zv),yield ia(si.closeDeleteUserDialog,eh)}const gh=["authorizationUrl"],Sh=["events","url"];function*vh(){try{yield oo(si.setSocialLoginsState({loading:!0}));const e=yield so(qd.auth.getSocialLoginProviders);yield oo(si.setSocialLoginsState({socialLoginsConfig:e,loading:!1,firstLoad:!1}))}catch(e){yield oo(si.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*hh(){try{const e=yield uo((e=>e.root.context));yield oo(si.setSocialLoginsState({loading:!0}));const t=yield so(qd.auth.getSocialLoginProvidersV2),{providers:n}=yield so(qd.auth.getCustomSocialLoginProvidersV1),i=t.map((t=>{let{authorizationUrl:n}=t,i=bi(t,gh);const o=ca(e,null!=n?n:"");return O({},i,{authorizationUrl:n?`${o}${n}`:null})}));yield oo(si.setSocialLoginsState({socialLoginsConfigV2:i,customSocialLoginsConfig:n,loading:!1,firstLoad:!1}))}catch(e){yield oo(si.setSocialLoginsState({error:e.message,loading:!1,firstLoad:!1}))}}function*mh(e){let{payload:{events:t,url:n}}=e,i=bi(e.payload,Sh);try{yield oo(si.setSocialLoginsState({loading:!0}));const{email:e,isNewUser:r,userId:s,tenantId:l,name:c}=yield so(qd.auth.loginViaSocialLogin,i);var o,a;r&&(null==t||null==(o=t.signUpComplete)||o.call(t,{email:e,url:n,authenticationType:By.SOCIAL_LOGIN,createdAt:new Date,id:s,socialProvider:i.provider,tenantId:l}),null==t||null==(a=t.userVerified)||a.call(t,{email:e,origin:Ky.SOCIAL_LOGIN,createdAt:new Date,id:s,url:n,tenantId:l,name:c})),s&&localStorage.setItem("userId",s),yield oo(si.setLoginState({email:e,isNewUser:r})),yield function*(){const{hostedLoginBox:e}=yield uo((e=>e.auth));e?yield so(gp):yield so(vp)}(),localStorage.removeItem("register-quick-login"),yield oo(si.setSocialLoginsState({loading:!1}))}catch(e){var r;yield oo(si.setSocialLoginsState({loading:!1,error:null!=(r=e.message)?r:"Failed to authenticate",firstLoad:!1}))}}function*bh({payload:e}){yield oo(si.setSocialLoginsState({error:e.error,loading:!1,firstLoad:!1}))}function*Ah(){yield aa(si.loadSocialLoginsConfiguration,vh),yield aa(si.loadSocialLoginsConfigurationV2,hh),yield aa(si.loginViaSocialLogin,mh),yield oa(si.setSocialLoginError,bh)}let kh;function*Th({payload:e}){const{description:t,expires:n,callback:i}=e,{apiTokensDataUser:o}=yield uo((e=>e.auth.apiTokensState));try{let e,a;yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!0})),void 0!==n?(a=null===n?null:1440*n,e=yield so(qd.auth.createUserAccessToken,{description:t,expiresInMinutes:a})):e=yield so(qd.auth.updateUserApiTokensData,{description:t}),yield oo(si.setApiTokensState({showAddTokenDialog:!1})),yield yo(200),yield oo(si.setApiTokensState({apiTokensDataUser:[e,...o],successDialog:{open:!0,secret:e.secret,clientId:void 0===n?e.clientId:void 0}})),yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!1})),null==i||i(null)}catch(e){yield oo(si.setApiTokensError({key:kh.ADD_API_TOKEN,value:e.message})),yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!1})),null==i||i(null,e.message)}}function*Ph({payload:e}){const{description:t,roleIds:n,expires:i,callback:o}=e,{apiTokensDataTenant:a}=yield uo((e=>e.auth.apiTokensState));try{let e,r;yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!0})),void 0!==i?(r=null===i?null:1440*i,e=yield so(qd.auth.createTenantAccessToken,{description:t,expiresInMinutes:r,roleIds:n})):e=yield so(qd.auth.updateTenantApiTokensData,{description:t,roleIds:n}),yield oo(si.setApiTokensState({showAddTokenDialog:!1})),yield yo(200),yield oo(si.setApiTokensState({apiTokensDataTenant:[e,...a],successDialog:{open:!0,secret:e.secret,clientId:void 0===i?e.clientId:void 0}})),yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!1})),null==o||o(null)}catch(e){yield oo(si.setApiTokensError({key:kh.ADD_API_TOKEN,value:e.message})),yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!1})),null==o||o(null,e.message)}}function*Ih({payload:e}){const{apiTokensDataUser:t}=yield uo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));try{yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!0})),n?(yield so(qd.auth.deleteUserAccessToken,{id:e}),yield oo(si.setApiTokensState({apiTokensDataUser:t.filter((t=>t.id!==e)),deleteTokenDialog:{open:!1,id:e}}))):(yield so(qd.auth.deleteUserApiToken,{tokenId:e}),yield oo(si.setApiTokensState({apiTokensDataUser:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}}))),yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!1}))}catch(e){yield oo(si.setApiTokensError({key:kh.DELETE_API_TOKEN,value:e.message})),yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!1}))}}function*Lh({payload:e}){const{apiTokensDataTenant:t}=yield uo((e=>e.auth.apiTokensState)),n=t.some((t=>t.id===e));let i=t;try{yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!0})),n?(yield so(qd.auth.deleteTenantAccessToken,{id:e}),i=t.filter((t=>t.id!==e))):(yield so(qd.auth.deleteTenantApiToken,{tokenId:e}),i=t.filter((t=>t.clientId!==e))),yield oo(si.setApiTokensState({apiTokensDataTenant:i,deleteTokenDialog:{open:!1,id:e}})),yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!1}))}catch(e){yield oo(si.setApiTokensError({key:kh.DELETE_API_TOKEN,value:e.message})),yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!1}))}}function*Eh({payload:e}){null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));try{var t;const[n=[],i=[]]=yield ao([so(qd.auth.getUserApiTokensData),so(qd.auth.getTenantApiTokensData)]);yield oo(si.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setApiTokensError({key:kh.LOAD_API_TOKENS,value:t.message})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*Oh({payload:e}){null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=so(qd.auth.getUserApiTokensData))?t:[],r=(null!=(i=(yield null!=(n=so(qd.auth.getUserAccessTokensData))?n:[]).accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield oo(si.setApiTokensState({apiTokensDataUser:null!=r?r:[]})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield oo(si.setApiTokensError({key:kh.LOAD_API_TOKENS,value:t.message})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*wh({payload:e}){null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));try{var t,n,i,o;const a=yield null!=(t=so(qd.auth.getTenantApiTokensData))?t:[],r=yield null!=(n=so(qd.auth.getTenantAccessTokensData))?n:[],s=(null!=(i=null==r?void 0:r.accessTokens)?i:[]).concat(a).sort(((e,t)=>new Date(t.createdAt)-new Date(e.createdAt)));yield oo(si.setApiTokensState({apiTokensDataTenant:null!=s?s:[]})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(o=e.callback)||o.call(e,!0)}catch(t){var a;yield oo(si.setApiTokensError({key:kh.LOAD_API_TOKENS,value:t.message})),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(a=e.callback)||a.call(e,null,t)}}function*Dh(){yield aa(si.loadApiTokens,Eh),yield aa(si.loadUserApiTokens,Oh),yield aa(si.loadTenantApiTokens,wh),yield ia(si.addUserApiToken,Th),yield ia(si.addTenantApiToken,Ph),yield oa(si.deleteTenantApiToken,Lh),yield oa(si.deleteUserApiToken,Ih)}function*Ch({payload:e}){const{description:t,roleIds:n,callback:i}=e;yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!0}));const{apiTokensDataTenant:o}=yield uo((e=>e.auth.apiTokensState)),a=O({},Sy,{description:t,roleIds:n,clientId:`CLIENT_ID_${sv()}`});yield oo(si.setApiTokensState({showAddTokenDialog:!1})),yield yo(200),yield oo(si.setApiTokensState({apiTokensDataTenant:[...o,a],successDialog:{open:!0,secret:a.secret,clientId:a.clientId}})),yield yo(200),yield oo(si.setApiTokensLoader({key:kh.ADD_API_TOKEN,value:!1})),null==i||i(null)}function*Rh({payload:e}){yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!0})),yield yo(200);const t=[Sy];yield oo(si.setApiTokensState({apiTokensDataTenant:t.filter((t=>t.clientId!==e)),deleteTokenDialog:{open:!1,clientId:e}})),yield oo(si.setApiTokensLoader({key:kh.DELETE_API_TOKEN,value:!1}))}function*Uh({payload:e}){var t;null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));const n=[gy],i=[Sy];yield oo(si.setApiTokensState({apiTokensDataUser:n,apiTokensDataTenant:i})),yield yo(200),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*_h({payload:e}){var t;null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));const n=[gy];yield oo(si.setApiTokensState({apiTokensDataUser:n})),yield yo(200),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Mh({payload:e}){var t;null!=e&&e.silentLoading||(yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!0})));const n=[Sy];yield oo(si.setApiTokensState({apiTokensDataTenant:n})),yield yo(200),yield oo(si.setApiTokensLoader({key:kh.LOAD_API_TOKENS,value:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}function*Nh(){yield aa(si.loadApiTokens,Uh),yield aa(si.loadUserApiTokens,_h),yield aa(si.loadTenantApiTokens,Mh),yield ia(si.addTenantApiToken,Ch),yield oa(si.deleteTenantApiToken,Rh)}function*Fh({payload:e}){try{var t;yield oo(si.setAccountSettingsState({loading:!0}));const{accountSettingsState:n}=yield uo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=yield so(qd.accountSettings.updateSettings,O({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e));yield oo(si.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}catch(t){var n;yield oo(si.setAccountSettingsState({loading:!1,error:t.message})),null==(n=e.callback)||n.call(e,null,t)}}function*$h({payload:e}){yield oo(si.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null}));try{const e=yield so(qd.accountSettings.getSettings);yield oo(si.setAccountSettingsState(O({},e,{loading:!1})))}catch(e){yield oo(si.setAccountSettingsState({loading:!1,error:e.message}))}}function*Gh(){yield aa(si.saveAccountSettings,Fh),yield aa(si.loadAccountSettings,$h)}function*xh({payload:e}){var t;yield oo(si.setAccountSettingsState({loading:!0})),yield vt();const{accountSettingsState:n}=yield uo((e=>e.auth)),{address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l}=n,c=O({address:i,timezone:o,dateFormat:a,timeFormat:r,currency:s,logo:l},e);yield oo(si.setAccountSettingsState(O({},c,{loading:!1}))),null==(t=e.callback)||t.call(e,c)}function*Vh({payload:e}){yield oo(si.setAccountSettingsState({loading:!(null!=e&&e.silentLoading),error:null})),yield vt(),yield oo(si.setAccountSettingsState({address:"Tel-aviv",timezone:"Asia/Jerusalem",dateFormat:"DD/MM/YYYY",timeFormat:"HH:mm",currency:"USD",loading:!1}))}function*jh(){yield aa(si.saveAccountSettings,xh),yield aa(si.loadAccountSettings,Vh)}function*Wh({payload:{tenantId:e,callback:t}}){yield oo(si.setState({isLoading:!0}));try{yield so(qd.tenants.switchTenant,{tenantId:e}),yield so(fp),(null==t?void 0:t(!0))||(yield oo(si.setState({isLoading:!1})))}catch(e){yield oo(si.setState({isLoading:!1})),null==t||t(!1,e)}}function*Kh({payload:e}){yield oo(si.setTenantsState({loading:!0}));try{var t;const n=yield so(qd.tenants.getTenants);yield oo(si.setTenantsState({tenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,[])}catch(t){var n;null==e||null==(n=e.callback)||n.call(e,[],t),yield oo(si.setTenantsState({loading:!1}))}}function*Bh({payload:e}){yield oo(si.setTenantsState({loading:!0}));try{var t;const n=yield so(qd.tenants.getSubTenants);yield oo(si.setTenantsState({subTenants:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*zh({payload:e}){yield oo(si.setTenantsState({loading:!0}));try{var t;const n=yield so(qd.tenants.getSubTenantsAsTree);yield oo(si.setTenantsState({tenantTree:n,loading:!1})),null==e||null==(t=e.callback)||t.call(e,!0)}catch(t){var n;yield oo(si.setTenantsState({loading:!1})),null==e||null==(n=e.callback)||n.call(e,null,t)}}function*qh(){yield ia(si.loadTenants,Kh),yield ia(si.loadSubTenants,Bh),yield ia(si.switchTenant,Wh),yield ia(si.loadSubTenantsTree,zh)}function*Hh(){yield oo(si.setTenantsState({loading:!0})),yield vt(),yield oo(si.setTenantsState({tenants:Ny,loading:!1}))}function*Jh(){yield ia(si.loadTenants,Hh)}!function(e){e.LOAD_API_TOKENS="LOAD_API_TOKENS",e.ADD_API_TOKEN="ADD_API_TOKEN",e.DELETE_API_TOKEN="DELETE_API_TOKEN"}(kh||(kh={}));const Yh=["callback"],Qh=["callback"],Xh=["callback"],Zh=["callback"],em=["callback"];function*tm({payload:e}){var t;yield oo(si.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{const e=yield ao([so(qd.roles.getRoles),so(qd.roles.getPermissions),so(qd.roles.getPermissionCategories)]),[t,n,i]=e;yield oo(si.setRolesState({roles:t,permissions:n,permissionCategories:i,loading:!1}))}catch(e){yield oo(si.setRolesState({error:e.message,loading:!1}))}}function*nm(e){let{payload:{callback:t}}=e,n=bi(e.payload,Yh);yield oo(si.setRolesState({saving:!0}));try{const e=yield so(qd.roles.addRole,n),i=yield so(qd.roles.getRoles);yield oo(si.loadRolesAndPermissions({silentLoading:!0})),yield oo(si.setRolesState({roles:i,saving:!1})),null==t||t(e)}catch(e){yield oo(si.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*im(e){let{payload:{callback:t}}=e,n=bi(e.payload,Qh);yield oo(si.setRolesState({saving:!0}));try{yield so(qd.roles.deleteRole,n),yield oo(si.loadRolesAndPermissions({silentLoading:!0})),yield oo(si.setRolesState({saving:!1})),null==t||t(!0)}catch(e){yield oo(si.setRolesState({error:e.message,saving:!1})),null==t||t(!1,e)}}function*om(e){let{payload:{callback:t}}=e,n=bi(e.payload,Xh);yield oo(si.setRolesState({saving:!0}));try{const e=yield so(qd.roles.updateRole,n);yield oo(si.loadRolesAndPermissions({silentLoading:!0})),yield oo(si.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield oo(si.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*am(e){let{payload:{callback:t}}=e,n=bi(e.payload,Zh);yield oo(si.setRolesState({saving:!0}));try{const e=yield so(qd.roles.attachPermissionsToRole,n);yield oo(si.loadRolesAndPermissions({silentLoading:!0})),yield oo(si.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield oo(si.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*rm(e){let{payload:{callback:t}}=e,n=bi(e.payload,em);yield oo(si.setRolesState({saving:!0}));try{const e=yield so(qd.roles.attachPermissionToRoles,n);yield oo(si.loadRolesAndPermissions({silentLoading:!0})),yield oo(si.setRolesState({saving:!1})),null==t||t(e)}catch(e){yield oo(si.setRolesState({error:e.message,saving:!1})),null==t||t(null,e)}}function*sm(){yield aa(si.loadRolesAndPermissions,tm),yield ia(si.addRole,nm),yield ia(si.deleteRole,im),yield ia(si.updateRole,om),yield ia(si.attachPermissionsToRole,am),yield ia(si.attachPermissionToRoles,rm)}function*lm({payload:e}){var t;yield oo(si.setRolesState({loading:!(null!=(t=null==e?void 0:e.silentLoading)&&t),error:null}));try{yield oo(si.setRolesState({roles:vy,loading:!1}))}catch(e){yield oo(si.setRolesState({error:e.message,loading:!1}))}}function*cm(){yield aa(si.loadRolesAndPermissions,lm)}const um=["callback"],dm=["callback"],ym=["callback"];function*fm(e){let{payload:{callback:t}}=e,n=bi(e.payload,um);yield oo(si.setResetPhoneNumberState({loading:!0}));try{const e=yield so(qd.auth.resetPhoneNumber,n);yield oo(si.setResetPhoneNumberState({loading:!1,error:void 0,resetPhoneNumberToken:e.resetPhoneNumberToken,step:zt.VerifyResetPhoneNumber})),yield oo(si.setLoginState({email:n.email}))}catch(e){yield oo(si.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*pm(e){let{payload:{callback:t}}=e,n=bi(e.payload,dm);yield oo(si.setResetPhoneNumberState({loading:!0}));try{const e=yield so(qd.auth.verifyResetPhoneNumber,n);yield oo(si.setResetPhoneNumberState({loading:!1,error:void 0,changePhoneNumberToken:e.changePhoneNumberToken,step:zt.ChangePhoneNumber})),null==t||t(!0)}catch(e){yield oo(si.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*gm(e){let{payload:{callback:t}}=e,n=bi(e.payload,ym);yield oo(si.setResetPhoneNumberState({loading:!0}));try{const{onRedirectTo:e,routes:i}=yield uo((({auth:{onRedirectTo:e,routes:t}})=>({onRedirectTo:e,routes:t})));yield so(qd.auth.changePhoneNumber,{phoneNumber:n.phoneNumber,changePhoneNumberToken:n.changePhoneNumberToken}),yield oo(si.setLoginState({step:kt.loginWithSmsOtc})),yield oo(si.passwordlessPreLogin({type:Lr.SmsCode,email:n.email,recaptchaToken:n.recaptchaToken})),e(i.loginUrl),yield oo(si.setResetPhoneNumberState({loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setResetPhoneNumberState({loading:!1,error:e.message})),null==t||t(null,e)}}function*Sm(){yield aa(si.resetPhoneNumber,fm),yield aa(si.verifyResetPhoneNumber,pm),yield aa(si.changePhoneNumber,gm)}function*vm(){yield oo(si.setSessionsState({loading:!0,error:null}));try{const e=yield so(qd.auth.getCurrentUserSessions);yield oo(si.setSessionsState({sessions:e,loading:!1}))}catch(e){yield oo(si.setSessionsState({error:e,loading:!1}))}}function*hm(){yield oo(si.setSessionsState({loading:!0,error:null}));try{const e=yield so(qd.auth.getCurrentUserSession);yield oo(si.setSessionsState({currentSession:e,loading:!1}))}catch(e){yield oo(si.setSessionsState({error:e,loading:!1}))}}function*mm({payload:{id:e}}){yield oo(si.setSessionsState({loading:!0,error:null}));try{yield so(qd.auth.deleteSessionForUser,e),yield oo(si.loadUserSessions())}catch(e){yield oo(si.setSessionsState({error:e,loading:!1}))}}function*bm({payload:{callback:e,userId:t}}){yield oo(si.setSessionsState({loading:!0,error:null}));try{yield so(qd.auth.revokeSessionsForUser,t),null==e||e(!0)}catch(t){yield oo(si.setSessionsState({error:t,loading:!1})),null==e||e(!1)}}function*Am(){yield oo(si.setSessionsState({loading:!0,error:null}));try{yield so(qd.auth.deleteAllSessionsForUser),yield oo(si.loadUserSessions())}catch(e){yield oo(si.setSessionsState({error:e,loading:!1}))}}function*km(){yield oa(si.loadUserSessions,vm),yield oa(si.deleteUserSession,mm),yield oa(si.deleteAllUserSessions,Am),yield oa(si.loadCurrentUserSession,hm),yield ia(si.revokeUserSessions,bm)}function*Tm(){yield oo(si.setSessionsState({loading:!0,error:null})),yield oo(si.setSessionsState({sessions:Fy,loading:!1}))}function*Pm({payload:{id:e}}){yield oo(si.setSessionsState({loading:!0,error:null}));const t=(yield uo((e=>{var t;return null!=(t=e.auth.sessionsState.sessions)?t:[]}))).filter((t=>t.id!==e));yield oo(si.setSessionsState({sessions:t,loading:!1}))}function*Im(){yield oo(si.setSessionsState({loading:!0,error:null}));const e=Fy.filter((e=>e.current));yield oo(si.setSessionsState({sessions:e,loading:!1}))}function*Lm(){yield oa(si.loadUserSessions,Tm),yield oa(si.deleteUserSession,Pm),yield oa(si.deleteAllUserSessions,Im)}const Em=["callback"],Om=["callback"];function*wm(){yield oo(si.setSessionsPolicyState({loading:!0,error:null}));try{const e=yield so(qd.auth.getSessionConfigurations);yield oo(si.setSessionsPolicyState({configurations:e,loading:!1}))}catch(e){yield oo(si.setSessionsState({error:e,loading:!1}))}}function*Dm({payload:e}){yield oo(si.setSessionsPolicyState({loading:!0,error:null}));try{const{callback:t}=e,n=bi(e,Em);yield so(qd.auth.createOrUpdateSessionConfigrations,n),yield oo(si.loadSessionsPolicy()),null==t||t(!0)}catch(e){yield oo(si.setSessionsPolicyState({error:e,loading:!1}))}}function*Cm(){yield aa(si.loadSessionsPolicy,wm),yield oa(si.createOrUpdateSessionsPolicy,Dm)}function*Rm(){yield oo(si.setSessionsPolicyState({loading:!0,error:null}));const e=yield uo((e=>{var t,n;return null!=(t=null==e||null==(n=e.auth)?void 0:n.sessionsPolicyState)?t:$y}));yield oo(si.setSessionsPolicyState(O({},e,{loading:!1})))}function*Um({payload:e}){yield oo(si.setSessionsPolicyState({loading:!0,error:null}));const{callback:t}=e,n=bi(e,Om);null==t||t(!0),yield oo(si.setSessionsPolicyState({configurations:n,loading:!1}))}function*_m(){yield aa(si.loadSessionsPolicy,Rm),yield oa(si.createOrUpdateSessionsPolicy,Um)}const Mm=["callback"],Nm=["callback"],Fm=["callback"],$m=["callback"],Gm=["callback"],xm=["callback"],Vm=["callback"],jm=["callback"],Wm=()=>uo((e=>e.auth.restrictionsState.ipRestrictions)),Km=()=>uo((e=>e.auth.restrictionsState.emailDomainRestrictions));function*Bm(){yield oo(si.setEmailDomainRestrictionsState({loading:!0,error:null}));try{const e=yield so(qd.auth.getDomainRestrictionsConfig),t=(yield so(qd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield oo(si.setEmailDomainRestrictionsState({data:{restrictions:t,config:e},loading:!1}))}catch(e){yield oo(si.setEmailDomainRestrictionsState({error:e.message,loading:!1}))}}function*zm(e){let{payload:{callback:t}}=e,n=bi(e.payload,Mm);yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null}));const i=yield Km();try{var o;yield so(qd.auth.createDomainRestriction,n);const e=(yield so(qd.auth.getDomainRestrictions)).items.filter((e=>{var t;return e.type===(null==(t=i.data)?void 0:t.config.listType)}));yield oo(si.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 oo(si.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*qm(e){let{payload:{callback:t}}=e,n=bi(e.payload,Nm);yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null}));try{const e=yield so(qd.auth.updateDomainRestrictionConfig,n),i=(yield so(qd.auth.getDomainRestrictions)).items.filter((t=>t.type===e.listType));yield oo(si.setEmailDomainRestrictionsState({data:{config:e,restrictions:i},saving:!1})),null==t||t(!0)}catch(e){yield oo(si.setEmailDomainRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*Hm({payload:{id:e}}){yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null}));const t=yield Km();try{var n;yield so(qd.auth.deleteDomainRestriction,e);const i=(yield so(qd.auth.getDomainRestrictions)).items.filter((e=>{var n;return e.type===(null==(n=t.data)?void 0:n.config.listType)}));yield oo(si.setEmailDomainRestrictionsState({data:{config:(null==(n=t.data)?void 0:n.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:i},saving:!1}))}catch(e){yield oo(si.setEmailDomainRestrictionsState({saving:!1,error:e.message}))}}const Jm=e=>{var t,n,i;return{_filter:null!=(t=null==e?void 0:e._filter)?t:$n.ALLOW,_limit:null!=(n=null==e?void 0:e._limit)?n:10,_offset:null!=(i=null==e?void 0:e._offset)?i:0}};function*Ym(){yield oo(si.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Wm(),t=yield so(qd.auth.getIPRestrictionsConfig),n=Jm({_filter:t.strategy,_limit:e.pagination._limit,_offset:e.pagination._offset}),{items:i,_metadata:{totalPages:o}}=yield so(qd.auth.getIPRestrictions,n);yield oo(si.setIpRestrictionsState({data:{restrictions:i,config:t},totalPages:o,pagination:n,loading:!1}))}catch(e){yield oo(si.setIpRestrictionsState({error:e.message,loading:!1}))}}function*Qm(){try{const{valid:e}=yield so(qd.auth.testCurrentIpInAllowList);yield oo(si.setIpRestrictionsState({userIpValid:e}))}catch(e){yield oo(si.setIpRestrictionsState({error:e.message}))}}function*Xm({payload:{callback:e}}){yield oo(si.setIpRestrictionsState({saving:!0,error:null}));try{const t=yield uo((e=>e.auth.userIp));yield ao([so(qd.auth.createIPRestriction,{ip:t,isActive:!0,description:"My IP",strategy:$n.ALLOW}),so(qd.auth.updateIPRestrictionConfig,{isActive:!0})]);const n=yield Wm(),i=Jm(n.pagination),{items:o,_metadata:{totalPages:a}}=yield so(qd.auth.getIPRestrictions,i);yield oo(si.setIpRestrictionsState({data:{config:{isActive:!0,strategy:$n.ALLOW},restrictions:o},userIpValid:!0,pagination:i,totalPages:a,saving:!1})),null==e||e(!0)}catch(t){yield oo(si.setIpRestrictionsState({saving:!1,error:t})),null==e||e(!1,t)}}function*Zm(e){let{payload:{callback:t}}=e,n=bi(e.payload,Fm);yield oo(si.setIpRestrictionsState({saving:!0,error:null}));const i=yield Wm();try{var o,a;yield so(qd.auth.createIPRestriction,n);const e=yield Wm(),r=Jm(e.pagination),{items:s,_metadata:{totalPages:l}}=yield so(qd.auth.getIPRestrictions,r);yield Qm(),yield oo(si.setIpRestrictionsState({data:{config:null!=(o=null==(a=i.data)?void 0:a.config)?o:{isActive:!1,strategy:$n.ALLOW},restrictions:s},pagination:r,totalPages:l,saving:!1})),null==t||t(!0)}catch(e){yield oo(si.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*eb(e){let{payload:{callback:t}}=e,n=bi(e.payload,$m);yield oo(si.setIpRestrictionsState({saving:!0,error:null}));try{yield so(qd.auth.updateIPRestrictionConfig,n);const e=yield Wm(),i=yield so(qd.auth.getIPRestrictionsConfig),o=Jm(O({},e.pagination,{_filter:i.strategy})),{items:a,_metadata:{totalPages:r}}=yield so(qd.auth.getIPRestrictions,o);yield Qm(),yield oo(si.setIpRestrictionsState({data:{config:i,restrictions:a},pagination:o,totalPages:r,saving:!1})),null==t||t(!0)}catch(e){yield oo(si.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*tb({payload:{id:e,callback:t}}){yield oo(si.setIpRestrictionsState({saving:!0,error:null}));const n=yield Wm();try{var i;yield so(qd.auth.deleteIPRestriction,e);const o=yield Wm(),a=Jm(o.pagination),{items:r,_metadata:{totalPages:s}}=yield so(qd.auth.getIPRestrictions,a);yield Qm(),yield oo(si.setIpRestrictionsState({data:{config:(null==(i=n.data)?void 0:i.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:r},pagination:a,totalPages:s,saving:!1})),null==t||t(!0)}catch(e){yield oo(si.setIpRestrictionsState({saving:!1,error:e.message})),null==t||t(null,e)}}function*nb(){yield aa(si.loadIpRestrictions,Ym),yield aa(si.loadEmailDomainRestrictions,Bm),yield ia(si.saveIpRestriction,Zm),yield ia(si.saveIpRestrictionsConfig,eb),yield ia(si.deleteIpRestriction,tb),yield ia(si.checkIfUserIpValid,Qm),yield ia(si.addCurrentUserIpAndActivate,Xm),yield ia(si.saveEmailDomainRestriction,zm),yield ia(si.saveEmailDomainRestrictionsConfig,qm),yield ia(si.deleteEmailDomainRestriction,Hm)}function*ib(){yield oo(si.setIpRestrictionsState({loading:!0,error:null})),yield oo(si.setIpRestrictionsState({data:{restrictions:xy.filter((e=>e.strategy===Gy.strategy)),config:Gy},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},loading:!1}))}function*ob(){yield oo(si.setIpRestrictionsState({loading:!0,error:null}));try{const e=yield Wm(),t=xy[0].ip,n=!!e.data.restrictions.find((e=>e.isActive&&e.ip===t));yield oo(si.setIpRestrictionsState({userIpValid:n,loading:!1}))}catch(e){yield oo(si.setIpRestrictionsState({error:e.message,loading:!1}))}}function*ab(e){var t,n,i;let{payload:{callback:o}}=e,a=bi(e.payload,Gm);yield oo(si.setIpRestrictionsState({saving:!0,error:null}));const r=yield Wm(),s=r.data.restrictions.filter((e=>e.ip!==a.ip));yield oo(si.setIpRestrictionsState({data:{config:null!=(t=null==(n=r.data)?void 0:n.config)?t:{isActive:!1,strategy:$n.ALLOW},restrictions:[...s,O({},a,{createdAt:new Date,updatedAt:new Date,id:sv(),isActive:null==(i=a.isActive)||i,strategy:r.data.config.strategy})]},totalPages:1,pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},saving:!1})),null==o||o(!0)}function*rb(e){var t,n,i;let{payload:{callback:o}}=e,a=bi(e.payload,xm);const r=yield Wm();yield oo(si.setIpRestrictionsState({saving:!0,error:null})),yield oo(si.setIpRestrictionsState({data:{config:O({},null==(t=r.data)?void 0:t.config,a),restrictions:null!=(n=null==(i=r.data)?void 0:i.restrictions)?n:[]},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1})),yield oo(si.setIpRestrictionsState({saving:!1,error:null})),null==o||o(!0)}function*sb({payload:{id:e,callback:t}}){var n;yield oo(si.setIpRestrictionsState({saving:!0,error:null}));const i=yield Wm();yield oo(si.setIpRestrictionsState({data:{config:(null==(n=i.data)?void 0:n.config)||{isActive:!1,strategy:$n.ALLOW},restrictions:i.data.restrictions.filter((t=>t.id!==e))},pagination:{_filter:$n.ALLOW,_limit:50,_offset:0},totalPages:1,saving:!1,error:null})),null==t||t(!0)}function*lb(){yield oo(si.setEmailDomainRestrictionsState({loading:!0,error:null})),yield oo(si.setEmailDomainRestrictionsState({loading:!1,data:{restrictions:[{domain:"mock.com",id:"1",type:$n.ALLOW}],config:{active:!0,listType:$n.ALLOW,blockPublicDomains:!1}}}))}function*cb(e){var t,n;let{payload:{callback:i}}=e,o=bi(e.payload,Vm);const a=yield Km();yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==i||i(!0),yield oo(si.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)||[],O({},o,{id:Date.now().toString()})]},saving:!1}))}function*ub(e){var t;let{payload:{callback:n}}=e,i=bi(e.payload,jm);const o=yield Km();yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),null==n||n(!0),yield oo(si.setEmailDomainRestrictionsState({data:{config:{active:i.active,blockPublicDomains:i.blockPublicDomains||!1,listType:i.type||$n.ALLOW},restrictions:[...(null==(t=o.data)?void 0:t.restrictions)||[]]},saving:!1}))}function*db({payload:{id:e}}){var t,n;const i=yield Km();yield oo(si.setEmailDomainRestrictionsState({saving:!0,error:null})),yield vt(),yield oo(si.setEmailDomainRestrictionsState({data:{config:(null==(t=i.data)?void 0:t.config)||{active:!1,blockPublicDomains:!1,listType:$n.ALLOW},restrictions:((null==(n=i.data)?void 0:n.restrictions)||[]).filter((t=>t.id===e))},saving:!1}))}function*yb(){yield aa(si.loadIpRestrictions,ib),yield aa(si.loadEmailDomainRestrictions,lb),yield ia(si.saveIpRestriction,ab),yield ia(si.saveIpRestrictionsConfig,rb),yield ia(si.deleteIpRestriction,sb),yield ia(si.checkIfUserIpValid,ob),yield ia(si.saveEmailDomainRestriction,cb),yield ia(si.saveEmailDomainRestrictionsConfig,ub),yield ia(si.deleteEmailDomainRestriction,db)}const fb=["callback"],pb=["id"];function*gb(e){const{count:t}=yield so(qd.directory.countConfigurationUsers,e.id);return O({},e,{count:t})}function*Sb(){yield oo(si.setProvisioningState({loading:!0,error:null}));try{const e=yield so(qd.directory.getConfigs),t=yield ao(e.map((e=>gb(e))));yield oo(si.setProvisioningState({connections:t,loading:!1}))}catch(e){yield oo(si.setProvisioningState({error:e.message,loading:!1}))}}function*vb(e){let{payload:{callback:t}}=e,n=bi(e.payload,fb);yield oo(si.setProvisioningState({loading:!0,error:null}));try{const e=yield so(qd.directory.createConfiguration,n),i=yield so(qd.directory.getConfigs),o=yield ao(i.map((e=>gb(e))));yield oo(si.setProvisioningState({connections:o,loading:!1})),null==t||t(e)}catch(e){yield oo(si.setProvisioningState({error:e.message,loading:!1}))}}function*hb(e){let{payload:{id:t}}=e,n=bi(e.payload,pb);yield oo(si.setProvisioningState({loading:!0,error:null}));try{yield so(qd.directory.updateConfiguration,t,n);const e=yield so(qd.directory.getConfigs),i=yield ao(e.map((e=>gb(e))));yield oo(si.setProvisioningState({connections:i,loading:!1}))}catch(e){yield oo(si.setProvisioningState({error:e.message,loading:!1}))}}function*mb({payload:{id:e,callback:t}}){yield oo(si.setProvisioningState({loading:!0,error:null}));try{yield so(qd.directory.deleteConfiguration,e);const n=yield so(qd.directory.getConfigs),i=yield ao(n.map((e=>gb(e))));yield oo(si.setProvisioningState({connections:i,loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setProvisioningState({error:e.message,loading:!1})),null==t||t(!1,e)}}function*bb(){yield aa(si.loadProvisionConnections,Sb),yield ia(si.createProvisionConnection,vb),yield ia(si.deleteProvisionConnection,mb),yield ia(si.updateProvisionConnection,hb)}const Ab=["callback","events"];function*kb(e){let{payload:{callback:t}}=e,n=bi(e.payload,Ab);yield oo(si.setImpersonateState({loading:!0}));try{yield so(qd.impersonate.impersonate,n),yield oo(si.setImpersonateState({step:ti.success})),yield yo(1e3),yield ap(),yield oo(si.resetImpersonateState()),null==t||t(!0)}catch(e){yield oo(si.setImpersonateState({loading:!1,error:e.message}))}}function*Tb(){yield aa(si.impersonate,kb)}function*Pb({payload:e}){const{callback:t,deviceId:n}=e;yield oo(si.setPasskeysState({loading:!0}));try{yield so(qd.auth.deleteWebAuthnDevice,n);const{devices:e}=yield uo((e=>e.auth.passkeysState)),i=e.filter((e=>e.id!==n));yield oo(si.setPasskeysState({devices:i,loading:!1})),null==t||t(!0)}catch(e){yield oo(si.setPasskeysState({loading:!1,error:e.message||null})),null==t||t(null,e.message)}}function*Ib(){yield oo(si.setPasskeysState({loading:!0}));try{const{devices:e}=yield so(qd.auth.getWebAuthnDevices);yield oo(si.setPasskeysState({devices:e,loading:!1}))}catch(e){yield oo(si.setPasskeysState({loading:!1,error:e.message||null}))}}function*Lb(){yield ia(si.loadWebAuthnDevices,Ib),yield ia(si.deleteWebAuthnDevice,Pb)}const Eb=["roleIds","userIds"],Ob=()=>uo((e=>e.auth.groupsState));function*wb({payload:e}){const t=lv.GET_TEAM_USERS;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{const{items:n}=yield so(qd.teams.loadUsers,{filter:e.filter,pageOffset:e.pageOffset,pageSize:e.pageSize});yield oo(si.setGroupsState({teamUsers:n}))}catch(e){yield oo(si.setUsersGroupsError({key:t,value:e.message}))}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Db({payload:e}){const t=lv.GET_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{const n=yield so(qd.groups.getGroupById,{groupId:e.groupId},{_groupsRelations:cv.rolesAndUsers});yield oo(si.setGroupsState({selectedGroup:n}))}catch(e){yield oo(si.setUsersGroupsError({key:t,value:e.message}))}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Cb(){const e=lv.GET_GROUPS,t=yield Ob();yield oo(si.setUsersGroupsLoader({key:e,value:!0}));try{const{groups:n}=yield so(qd.groups.getGroups,{_groupsRelations:cv.rolesAndUsers});yield oo(si.setGroupsState(O({groups:n},t.selectedGroup&&{selectedGroup:n.find((e=>{var n;return e.id===(null==(n=t.selectedGroup)?void 0:n.id)}))})))}catch(t){yield oo(si.setUsersGroupsError({key:e,value:t.message}))}finally{yield oo(si.setUsersGroupsLoader({key:e,value:!1}))}}function*Rb({payload:e}){const t=lv.CREATE_GROUP,{roleIds:n,userIds:i}=e,o=bi(e,Eb);yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var a;const r=yield so(qd.groups.createGroup,O({name:o.name},!!o.description&&{description:o.description},{color:o.color}));null!=i&&i.length&&(yield oo(si.addUsersToGroup({groupId:r.id,userIds:i}))),null!=n&&n.length&&(yield oo(si.addRolesToGroup({groupId:r.id,roleIds:n}))),yield oo(si.loadGroups()),null==e||null==(a=e.callback)||a.call(e,!0)}catch(n){var r;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(r=e.callback)||r.call(e,!1)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Ub({payload:e}){const t=lv.UPDATE_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.updateGroup,e),yield oo(si.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*_b({payload:e}){const t=lv.DELETE_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.deleteGroup,e.groupId),yield oo(si.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1,n.message)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Mb({payload:e}){const t=lv.ADD_ROLES_TO_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.addRolesToGroup,e.groupId,{roleIds:e.roleIds}),yield oo(si.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Nb({payload:e}){const t=lv.DELETE_ROLES_FROM_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.deleteRolesFromGroup,e.groupId,{roleIds:e.roleIds}),yield oo(si.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Fb({payload:e}){const t=lv.ADD_USERS_TO_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.addUsersToGroup,e.groupId,{userIds:e.userIds}),yield oo(si.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 oo(si.setUsersGroupsError({key:t,value:n.message}))}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*$b({payload:e}){const t=lv.DELETE_USERS_FROM_GROUP;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{var n;yield so(qd.groups.deleteUsersFromGroup,e.groupId,{userIds:e.userIds}),yield oo(si.loadGroups()),null==e||null==(n=e.callback)||n.call(e,!0)}catch(n){var i;yield oo(si.setUsersGroupsError({key:t,value:n.message})),null==e||null==(i=e.callback)||i.call(e,!1)}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Gb(){const e=lv.GET_GROUP_CONFIGURATION;yield oo(si.setUsersGroupsLoader({key:e,value:!0}));try{const t=yield so(qd.groups.getGroupConfiguration);yield oo(si.setGroupsState({groupsConfiguration:t}))}catch(t){yield oo(si.setUsersGroupsError({key:e,value:t.message}))}finally{yield oo(si.setUsersGroupsLoader({key:e,value:!1}))}}function*xb({payload:e}){const t=lv.UPDATE_GROUP_CONFIGURATION;yield oo(si.setUsersGroupsLoader({key:t,value:!0}));try{yield so(qd.groups.updateGroupConfiguration,e),yield oo(si.getGroupConfiguration())}catch(e){yield oo(si.setUsersGroupsError({key:t,value:e.message}))}finally{yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}}function*Vb(){yield oa(si.loadGroups,Cb),yield oa(si.getGroupById,Db),yield oa(si.createGroup,Rb),yield oa(si.updateGroup,Ub),yield oa(si.deleteGroup,_b),yield oa(si.addRolesToGroup,Mb),yield oa(si.deleteRolesFromGroup,Nb),yield oa(si.addUsersToGroup,Fb),yield oa(si.deleteUsersFromGroup,$b),yield oa(si.getGroupConfiguration,Gb),yield oa(si.updateGroupConfiguration,xb),yield oa(si.getTeamUsers,wb)}function*jb(){const e=lv.GET_GROUPS;yield oo(si.setUsersGroupsLoader({key:e,value:!0}));const t=Wy;yield oo(si.setGroupsState({groups:t})),yield oo(si.setUsersGroupsLoader({key:e,value:!1}))}function*Wb({payload:e}){var t;const n=lv.CREATE_GROUP,{groups:i}=yield Ob();yield oo(si.setUsersGroupsLoader({key:n,value:!0})),yield oo(si.setGroupsState({groups:[O({},e,{id:`${e.name}ID`,managedBy:zd.FRONTEGG}),...null!=i?i:[]]})),yield yo(500),null==e||null==(t=e.callback)||t.call(e,!0),yield oo(si.setUsersGroupsLoader({key:n,value:!1}))}function*Kb({payload:e}){var t,n,i,o,a;const r=lv.UPDATE_GROUP,s=yield Ob();yield oo(si.setUsersGroupsLoader({key:r,value:!0})),yield oo(si.setGroupsState({groups:null==s||null==(t=s.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},e,{id:e.groupId,name:null!=(n=null==e?void 0:e.name)?n:"",managedBy:zd.FRONTEGG}):t})),selectedGroup:O({},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 yo(500),null==e||null==(a=e.callback)||a.call(e,!0),yield oo(si.setUsersGroupsLoader({key:r,value:!1}))}function*Bb({payload:e}){var t,n;const i=lv.DELETE_GROUP,o=yield Ob();yield oo(si.setUsersGroupsLoader({key:i,value:!0})),yield oo(si.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.filter((t=>t.id!==e.groupId))})),yield yo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield oo(si.setUsersGroupsLoader({key:i,value:!1}))}function*zb({payload:e}){var t,n;const i=lv.ADD_ROLES_TO_GROUP,o=yield Ob();yield oo(si.setUsersGroupsLoader({key:i,value:!0})),yield oo(si.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:[...null!=(n=null==t?void 0:t.roles)?n:[],...e.roleIds.map((e=>({id:e,name:e})))]}):t}))})),yield yo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield oo(si.setUsersGroupsLoader({key:i,value:!1}))}function*qb({payload:e}){var t,n;const i=lv.DELETE_ROLES_FROM_GROUP,o=yield Ob();yield oo(si.setUsersGroupsLoader({key:i,value:!0})),yield oo(si.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{roles:null==t||null==(n=t.roles)?void 0:n.filter((t=>!e.roleIds.includes(t.id)))}):t}))})),yield yo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield oo(si.setUsersGroupsLoader({key:i,value:!1}))}function*Hb({payload:e}){var t,n;const i=lv.ADD_USERS_TO_GROUP,o=yield Ob();yield oo(si.setUsersGroupsLoader({key:i,value:!0})),yield oo(si.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:[...null!=(n=null==t?void 0:t.users)?n:[],...e.userIds.map((e=>({id:e,name:e})))]}):t}))})),yield yo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield oo(si.setUsersGroupsLoader({key:i,value:!1}))}function*Jb({payload:e}){var t,n;const i=lv.DELETE_USERS_FROM_GROUP,o=yield Ob();yield oo(si.setUsersGroupsLoader({key:i,value:!0})),yield oo(si.setGroupsState({groups:null==o||null==(t=o.groups)?void 0:t.map((t=>{var n;return t.id===e.groupId?O({},t,{users:null==t||null==(n=t.users)?void 0:n.filter((t=>!e.userIds.includes(t.id)))}):t}))})),yield yo(500),null==e||null==(n=e.callback)||n.call(e,!0),yield oo(si.setUsersGroupsLoader({key:i,value:!1}))}function*Yb(){const e=lv.GET_GROUP_CONFIGURATION,{groupsConfiguration:t}=yield Ob();yield oo(si.setUsersGroupsLoader({key:e,value:!0})),t&&(yield oo(si.setGroupsState({groupsConfiguration:O({},t)}))),yield oo(si.setUsersGroupsLoader({key:e,value:!1}))}function*Qb({payload:e}){const t=lv.UPDATE_GROUP_CONFIGURATION,{groupsConfiguration:n}=yield Ob();yield oo(si.setUsersGroupsLoader({key:t,value:!0})),n&&(yield oo(si.setGroupsState({groupsConfiguration:O({},n,e)}))),yield oo(si.setUsersGroupsLoader({key:t,value:!1}))}function*Xb(){yield oa(si.loadGroups,jb),yield oa(si.createGroup,Wb),yield oa(si.updateGroup,Kb),yield oa(si.deleteGroup,Bb),yield oa(si.addRolesToGroup,zb),yield oa(si.deleteRolesFromGroup,qb),yield oa(si.addUsersToGroup,Hb),yield oa(si.deleteUsersFromGroup,Jb),yield oa(si.getGroupConfiguration,Yb),yield oa(si.updateGroupConfiguration,Qb)}var Zb={sagas:function*(){yield ao([so(tg),so(QS),so(ZS),so(jS),so(Sm),so(vg),so(Bg),so(Qg),so(OS),so(th),so(Vb),so(Ah),so(Qy),so(Dh),so(Lf),so(Gh),so(qh),so(sm),so(km),so(Cm),so(nb),so(bb),so(Tb),so(Lb)])},mockSagas:function*(){yield ao([so(og),so(Pg),so(tS),so(FS),so(ph),so(Nh),so(Gf),so(Lm),so(jh),so(Jh),so(_m),so(yb),so(cm),so(Xb)])},storeName:Et,initialState:ei,reducer:ai,actions:si};const eA=e=>({prepare:e=>({payload:e}),reducer:(t,{payload:n})=>O({},t,{[e]:O({},t[e],n)})}),tA={loading:!0,pageOffset:0,pageSize:20,logs:[],sort:[],filter:[],totalPages:0,isDownloadingCsv:!1},nA={setAuditLogsState:eA("auditLogsState"),resetAuditLogsState:e=>O({},e,{auditLogsState:tA})},iA={exportAuditsCsv:rt("auditLogs/exportAuditsCsv"),loadAuditLogs:rt("auditLogs/loadAuditLogs",(e=>({payload:e})))},oA={loading:!0},aA={setAuditsMetadataState:eA("auditsMetadataState"),resetAuditsMetadataState:e=>O({},e,{auditsMetadataState:oA})},rA={loadAuditsMetadata:rt("auditLogs/loadAuditsMetadata")},sA={auditLogsState:tA,auditsMetadataState:oA},{reducer:lA,actions:cA}=lt({name:wt,initialState:sA,reducers:O({resetState:e=>O({},e,sA),setState:(e,{payload:t})=>O({},e,t)},nA,aA)}),uA=O({},cA,iA,rA),dA=e=>"createdAt"!==e.id,yA={total:20,data:Array.from(Array(5).keys()).map((e=>O({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`})))},fA={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}]},pA=()=>uo((e=>e.auditLogs.auditLogsState)),gA=()=>uo((e=>e.auditLogs.auditsMetadataState));function*SA(){const e=yield pA(),{columns:t}=yield gA();try{const n=e.filter,i=e.sort.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),o=n.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});yield oo(uA.setAuditLogsState({isDownloadingCsv:!0}));const a="audits.csv";yield qd.audits.exportAudits(O({endpoint:"csv/v2",headerProps:t,offset:0,outputFileName:a},i,o))}catch(e){console.error("failed to export audits - ",e)}yield oo(uA.setAuditLogsState({isDownloadingCsv:!1}))}function*vA({payload:e}){yield oo(uA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield pA(),{columns:n}=yield gA();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 oo(uA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d}));const y=d.reduce(((e,t)=>O({},e,{sortBy:t.id,sortDirection:t.desc?"desc":"asc"})),{}),f=u.reduce(((e,t)=>O({},e,{[t.id]:t.value})),{});n||(yield oo(uA.loadAuditsMetadata()));const{data:p,total:g}=yield so(qd.audits.getAudits,O({offset:c,count:l},y,f));yield oo(uA.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 oo(uA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*hA(){yield ia(uA.exportAuditsCsv,SA),yield ia(uA.loadAuditLogs,vA)}function*mA({payload:e}){yield oo(uA.setAuditLogsState({loading:!(null!=e&&e.silentLoading),error:null}));const t=yield pA(),{columns:n}=yield gA();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 oo(uA.setAuditLogsState({pageSize:l,pageOffset:c,filter:u,sort:d})),n||(yield oo(uA.loadAuditsMetadata()));const{data:y,total:f}=((e,t)=>{const{data:n}=yA;let i=n.filter((e=>t=>e.filter(dA).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 oo(uA.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 oo(uA.setAuditLogsState({loading:!1,error:t.message})),null==e||null==(l=e.callback)||l.call(e,null,t)}}function*bA(){yield ia(uA.loadAuditLogs,mA)}function*AA(){yield oo(uA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=yield so(qd.metadata.getAuditsMetadata);yield oo(uA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield oo(uA.setAuditsMetadataState({error:e,loading:!1}))}}function*kA(){yield ia(uA.loadAuditsMetadata,AA)}function*TA(){yield oo(uA.setAuditsMetadataState({loading:!0,error:null}));try{const{properties:e}=fA;yield oo(uA.setAuditsMetadataState({columns:e,loading:!1}))}catch(e){yield oo(uA.setAuditsMetadataState({error:e,loading:!1}))}}function*PA(){yield ia(uA.loadAuditsMetadata,TA)}var IA={sagas:function*(){yield ao([so(hA),so(kA)])},mockSagas:function*(){yield ao([so(bA),so(PA)])},storeName:wt,initialState:sA,reducer:lA,actions:uA};const LA={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:EA,actions:OA,reducer:wA}=lt({name:"audits",initialState:LA,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=O({},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]})))}}}),DA=O({},OA,{initData:rt(`${EA}/initData`),loadAudits:rt(`${EA}/loadAudits`),removeFilter:rt(`${EA}/removeFilter`),filterData:rt(`${EA}/filterData`),exportCSV:rt(`${EA}/exportCSV`),deleteAudits:rt(`${EA}/deleteAudits`)}),CA=()=>uo((e=>e[EA]));function*RA(){const{sortBy:e,sortDirection:t}=yield CA();try{const n=yield so(qd.audits.getAuditsStats,{sortBy:e,sortDirection:t,count:20});yield oo(DA.loadStatsSuccess(n))}catch(e){const t={name:"stats",error:e};console.error("failed to load stats - ",e),yield oo(DA.loadItemFailedAction(t))}}function*UA(){try{const e=yield so(qd.metadata.getAuditsMetadata);yield oo(DA.loadMetadataSuccess(e))}catch(e){const t={name:"metadata",error:e};console.error("failed to load metadata - ",e),yield oo(DA.loadItemFailedAction(t))}}const _A=e=>e.reduce(((e,t)=>(e[t.key]=t.value,e)),{});function*MA({payload:e}){const{filters:t,sortBy:n,sortDirection:i,filter:o,offset:a,virtualScroll:r}=yield CA(),{appendMode:s=r,onlyOneLoad:l=!0,offset:c}=e||{},{rowsData:u}=s?yield CA():{rowsData:[]};try{const e=_A(t),{data:s,total:d}=yield so(qd.audits.getAudits,O({},r&&{paginationMode:"virtual"},{sortDirection:i,sortBy:n,filter:o},e,{offset:r?u.length+c||u.length+a:c||a,count:20}));yield oo(DA.loadAuditsSuccess({rowsData:[...u,...s],total:d})),l&&(yield oo(DA.finishLoading()))}catch(e){const t={name:"audits",error:e};console.error("failed to load audits - ",e),yield oo(DA.loadItemFailedAction(t))}}function*NA(){yield oo(DA.startLoading()),yield ao([RA(),UA(),MA({payload:{onlyOneLoad:!1},type:""})]),yield oo(DA.finishLoading())}function*FA({payload:e}){const{filters:t}=yield CA(),n=t.findIndex((t=>t.key===e.key));if(n<0)return;const i=[...t.slice(0,n),...t.slice(n+1)];yield oo(DA.setFilterData(i))}function*$A({payload:e}){const{filters:t}=yield CA();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 oo(DA.setFilterData(i))}function*GA(){const{filters:e,sortBy:t,sortDirection:n,filter:i,headerProps:o}=yield CA(),a=_A(e);yield oo(DA.startDownloadingCsv());try{yield qd.audits.exportAudits(O({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 oo(DA.stopDownloadingCsv())}}function*xA(){yield oa(DA.initData,NA),yield oa(DA.removeFilter,FA),yield oa(DA.filterData,$A),yield oa([DA.loadAudits,DA.textSearch,DA.onPageChange],MA),yield oa([DA.setFilterData,DA.setDataSorting,DA.startRefresh],(()=>MA({payload:{appendMode:!1},type:""}))),yield oa(DA.exportCSV,GA)}const VA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},jA={initData:()=>O({},VA),setConnectivityState:(e,{payload:t})=>O({},e,t),cleanWebhookTestData:e=>O({},e,{testResult:void 0}),cleanWebhookLogsData:e=>O({},e,{webhookLogs:void 0}),cleanWebhookTestMessage:e=>{var t;return O({},e,{testResult:{status:null==(t=e.testResult)?void 0:t.status,message:void 0}})},cleanError:e=>O({},e,{error:void 0}),cleanSlackData:e=>O({},e,{slackChannels:{isLoading:!1}}),postWebhookRetryAction:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,{[t]:{isProcess:!0,success:!1}})})},postWebhookRetryResult:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>O({},e,{retryResult:O({},e.retryResult,t)})}},WA={loadSlackActions:rt("connectivity/loadSlackActions"),loadDataAction:rt("connectivity/loadDataAction",(e=>({payload:e}))),postDataAction:rt("connectivity/postDataAction",(e=>({payload:e}))),postCodeAction:rt("connectivity/postCodeAction",(e=>({payload:e}))),loadScope:rt("connectivity/loadScope"),deleteWebhookConfigAction:rt("connectivity/deleteWebhookConfigAction",(e=>({payload:e}))),postWebhookTestAction:rt("connectivity/postWebhookTestAction",(e=>({payload:e}))),loadWebhookLogsAction:rt("connectivity/loadWebhookLogsAction",((e,t=0,n=10)=>({payload:{id:e,offset:t,limit:n}})))},KA={isLoading:!1,isSaving:!1,list:[],processIds:[],slackChannels:{isLoading:!1}},{reducer:BA,actions:zA}=lt({name:Ot,initialState:KA,reducers:O({},jA)}),qA=O({},zA,WA),HA={slack:qd.connectivity.getSlackConfiguration,email:qd.connectivity.getEmailConfiguration,sms:qd.connectivity.getSMSConfiguration,webhook:qd.connectivity.getWebhooksConfigurations,categories:qd.connectivity.getCategories,channelMap:qd.connectivity.getChannelMaps},JA={slack:qd.connectivity.postSlackConfiguration,email:qd.connectivity.postEmailConfiguration,sms:qd.connectivity.postSMSConfiguration,webhook:qd.connectivity.postWebhooksConfiguration},YA=["email","slack","sms","webhook"],QA={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"}},XA=["id"],ZA=["id","enabled"],ek=["categories","channelMap"];function*tk(e){return yield so(ik,{payload:{api:e},type:""})}function*nk({payload:e=YA}){yield oo(qA.setConnectivityState({isLoading:!0}));try{const t=yield ao([...e.map(tk),yield ik({payload:{api:"categories"},type:""}),yield function*(){return(yield ao(e.map((function*(e){return yield ik({payload:{api:"channelMap",params:e},type:""})})))).reduce(((t,n,i)=>O({},t,{[`${e[i]}`]:n})),{})}()]),n=yield ik({payload:{api:"webhook"},type:""}),i=t.reduce(((n,i,o)=>e[o]?t[t.length-1][e[o]].length?O({},n,{[`${e[o]}`]:i,list:[...n.list,{id:o,key:e[o],events:QA[e[o]].events(i),active:QA[e[o]].isActive(i),platform:QA[e[o]].title,image:QA[e[o]].image}]}):n:O({},n,{[`${ek[o-e.length]}`]:i})),{list:[],webhook:n});yield oo(qA.setConnectivityState(O({},i,{error:void 0,isSaving:!1,isLoading:!1})))}catch(e){yield oo(qA.setConnectivityState({isLoading:!1}))}}function*ik({payload:{api:e,params:t}}){try{return yield so(HA[e],t)}catch(e){return}}function*ok(){try{yield oo(qA.setConnectivityState({slackChannels:{isLoading:!0}}));const e=yield so(qd.connectivity.getSlackChannels);yield oo(qA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1,data:e}}))}catch(e){yield oo(qA.setConnectivityState({error:void 0,slackChannels:{isLoading:!1}}))}}function*ak(e,t){const{connectivity:{list:n}}=yield uo(),i=n.find((({key:t})=>t===e));if(!i)return;const o=QA[e].isActive(t);o!==i.active&&(yield oo(qA.setConnectivityState({list:n.map((t=>t.key===e?O({},t,{active:o}):t))})))}function*rk({payload:{platform:e,data:t,callback:n}}){const{processIds:i}=yield uo((e=>e.connectivity));try{if(yield oo(qA.setConnectivityState({isSaving:!0,processIds:"webhook"===e?[t._id,...i]:i})),"slack"===e?yield function*({payload:e}){const{connectivity:{slack:t}}=yield uo();if(!t)return;const{slackSubscriptions:n}=t,{slackSubscriptions:i}=e;yield ao([...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=bi(e,XA);return n===t.id&&JSON.stringify(O({id:n},i))!==JSON.stringify(t)})))&&t.slackEvents&&null!=(o=t.slackEvents[0].channelIds)&&o.length?[...e,t]:e}),[]).map((function*(e){return yield so(JA.slack,e)})),...i.reduce(((e,t)=>t.id&&!t.slackEvents[0].channelIds.length?[...e,t]:e),[]).map((function*(e){return yield so(qd.connectivity.deleteSlackConfiguration,e)}))])}({payload:t,type:""}):["sms","email"].includes(e)?yield function*({payload:e,type:t}){const{connectivity:n}=yield uo(),{processIds:i}=yield uo((e=>e.connectivity)),o=n[t];if(!o)return;let a=[];try{a=yield ao([...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 so("email"===t?qd.connectivity.postEmailConfiguration:qd.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=bi(o,ZA);return yield ao([yield so("email"===t?qd.connectivity.patchEmailConfiguration:qd.connectivity.patchSMSConfiguration,{eventKey:i,enabled:r}),yield so("email"===t?qd.connectivity.putEmailSubscriptions:qd.connectivity.putSMSSubscriptions,a,i,O({},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 so("email"===t?qd.connectivity.deleteEmailSubscriptions:qd.connectivity.deleteSMSSubscriptions,e,n[0].id||"")}))])}catch{}if(a.length){const e=yield ik({payload:{api:t},type:""});yield oo(qA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:e,processIds:e.id?i.filter((t=>t!==e.id)):i})),yield ak(t,e)}else yield oo(qA.setConnectivityState({error:void 0,isSaving:!1,[`${t}`]:o,processIds:i}))}({payload:t,type:e}):yield so(JA[e],t),!["sms","email"].includes(e)){const o=yield ik({payload:{api:e},type:""});"webhook"===e&&(o.id=t._id),yield oo(qA.setConnectivityState({error:void 0,isSaving:!1,[`${e}`]:o,processIds:o.id?i.filter((e=>e!==o.id)):i})),yield ak(e,o),null==n||n(!0)}}catch(e){var o;yield oo(qA.setConnectivityState({error:null!=(o=e.message)?o:e.toString(),isSaving:!1,isLoading:!1}))}}function*sk({payload:e}){try{yield qd.connectivity.postSlackCode(e)}catch{}yield oo(qA.setConnectivityState({error:void 0,isSaving:!1}))}function*lk(){const{slackChannels:e}=yield uo((e=>e.connectivity));try{yield oo(qA.setConnectivityState({slackChannels:O({},e,{isLoadingScope:!0})}));const{clientId:t}=yield so(qd.connectivity.getSlackScope);yield oo(qA.setConnectivityState({slackChannels:{error:void 0,clientId:t,isLoadingScope:!1,isLoading:!1}}))}catch{yield oo(qA.setConnectivityState({slackChannels:{error:void 0,isLoadingScope:!1,isLoading:!1}}))}}function*ck({payload:e}){const{callback:t,webhookId:n}=e,{processIds:i}=yield uo((e=>e.connectivity));try{yield oo(qA.setConnectivityState({isSaving:!0})),yield so(qd.connectivity.deleteWebhooksConfiguration,n)}catch(e){null==t||t(null,e.message)}const o=yield ik({payload:{api:"webhook"},type:""});o&&(yield oo(qA.setConnectivityState({error:void 0,isSaving:!1,webhook:o,processIds:o.id?i.filter((e=>e!==o.id)):i}))),null==t||t(!0)}function*uk({payload:e}){try{yield oo(qA.setConnectivityState({isTesting:!0}));const{statusCode:t,body:n}=yield so(qd.connectivity.postWebhookTest,e);if([201,200].includes(t)){const e=JSON.stringify(n,null,2);yield oo(qA.setConnectivityState({isTesting:!1,testResult:{status:"success",message:e}}))}else yield oo(qA.setConnectivityState({isTesting:!1,testResult:{status:"failed"}}))}catch(e){yield oo(qA.setConnectivityState({isTesting:!1,testResult:{status:"failed",message:e.toString()}}))}}function*dk({payload:e}){try{const{statusCode:t}=yield so(qd.connectivity.postWebhookRetry,e);yield oo(qA.postWebhookRetryResult({[e]:{isProcess:!1,success:202===t}}))}catch(t){yield oo(qA.postWebhookRetryResult({[e]:{isProcess:!1,success:!1}}))}}function*yk({payload:{id:e,limit:t,offset:n}}){const{webhookLogs:i}=yield uo((e=>e.connectivity));try{yield oo(qA.setConnectivityState({webhookLogs:O({},i,{isLoading:!0})}));const o=yield so(qd.connectivity.getWebhookLog,e,n,t);yield oo(qA.setConnectivityState({error:void 0,webhookLogs:O({isLoading:!1},o)}))}catch(e){yield oo(qA.setConnectivityState({error:void 0,webhookLogs:{isLoading:!1}}))}}var fk={sagas:function*(){yield ia(qA.loadDataAction,nk),yield oa(qA.loadSlackActions,ok),yield ia(qA.postDataAction,rk),yield ia(qA.postCodeAction,sk),yield ia(qA.loadScope,lk),yield ia(qA.deleteWebhookConfigAction,ck),yield ia(qA.postWebhookTestAction,uk),yield ia(qA.postWebhookRetryAction,dk),yield oa(qA.loadWebhookLogsAction,yk)},storeName:Ot,initialState:KA,reducer:BA,actions:qA};function pk(){return{setLoading:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{loading:t.payload},t.payload?{error:null}:{})},setError:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{error:t.payload,loading:!1,fetching:!1})},setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}}function gk(e,t){return{prepare:e=>({payload:e}),reducer:(n,i)=>O({},n,{[e]:t(n[e],i)})}}function Sk(e){return gk(e,((e,t)=>O({},e,{loading:t.payload})))}function vk(e){return gk(e,((e,t)=>O({},e,{error:t.payload,loading:!1})))}const hk={loading:!1,error:null,fetching:!0,plans:[]},{actions:mk,reducer:bk,name:Ak}=lt({name:"subscriptions/plans",initialState:hk,reducers:O({},pk())}),kk=O({loadPlans:rt(`${Ak}/loadPlans`)},mk),Tk={loading:!1,error:null,fetching:!0,config:null},Pk=O({},pk()),{actions:Ik,reducer:Lk,name:Ek}=lt({name:"subscriptions/config",initialState:Tk,reducers:Pk}),Ok=O({loadPaymentConfiguration:rt(`${Ek}/loadPaymentConfiguration`)},Ik),wk={loading:!1,error:null,fetching:!0,cancellation:{loading:!1,error:null},renewal:{loading:!1,error:null}},Dk=O({},pk(),{setCancellationLoading:Sk("cancellation"),setCancellationError:vk("cancellation"),setRenewalLoading:Sk("renewal"),setRenewalError:vk("renewal")}),{reducer:Ck,actions:Rk,name:Uk}=lt({name:"subscriptions/billing/subscription",initialState:wk,reducers:Dk}),_k=O({load:rt(`${Uk}/loadSubscription`),cancelSubscription:rt(`${Uk}/cancelSubscription`),renewSubscription:rt(`${Uk}/renewSubscription`)},Rk),Mk={loading:!1,error:null,fetching:!0},Nk=O({},pk()),{reducer:Fk,actions:$k,name:Gk}=lt({name:"subscriptions/billing/information",initialState:Mk,reducers:Nk}),xk=O({loadBillingInformation:rt(`${Gk}/loadBillingInformation`),cancelSubscription:_k.cancelSubscription,renewSubscription:_k.renewSubscription},$k),Vk={loading:!1,error:null,fetching:!0},jk=O({},pk(),{setState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,t.payload)}}),{reducer:Wk,actions:Kk,name:Bk}=lt({name:"subscriptions/billing/payment",initialState:Vk,reducers:jk}),zk=O({loadPaymentMethod:rt(`${Bk}/loadPaymentMethod`),submitPaymentMethod:rt(`${Bk}/submitPaymentMethod`),submitPaymentMethodError:rt(`${Bk}/submitPaymentMethodError`),submitPaymentMethodSuccess:rt(`${Bk}/submitPaymentMethodSuccess`),updatePaymentMethodBillingDetails:rt(`${Bk}/updateBillingDetails`,(e=>({payload:e})))},Kk),qk={loading:!1,error:null,fetching:!0,invoices:[],invoiceDownload:{loading:!1,error:null}},Hk=O({},pk(),{setInvoiceDownloadState:{prepare:e=>({payload:e}),reducer:(e,t)=>O({},e,{invoiceDownload:O({},e.invoiceDownload,t.payload)})}}),{reducer:Jk,actions:Yk,name:Qk}=lt({name:"subscriptions/billing/invoices",initialState:qk,reducers:Hk}),Xk=O({loadInvoices:rt(`${Qk}/loadInvoices`),downloadInvoice:rt(`${Qk}/downloadInvoice`,(e=>({payload:e})))},Yk),Zk={information:Mk,invoices:qk,paymentMethod:Vk,subscription:wk},eT={invoices:Xk,information:xk,paymentMethod:zk,subscription:_k},tT=xe({invoices:Jk,information:Fk,paymentMethod:Wk,subscription:Ck}),nT={fetching:!0,loading:!1,error:null,confirmed:!1},iT=O({},pk()),{actions:oT,reducer:aT,name:rT}=lt({name:"subscriptions/checkout",initialState:nT,reducers:iT}),sT=O({loadCheckout:rt(`${rT}/loadCheckout`),resetCheckout:rt(`${rT}/resetCheckout`),submitCheckout:rt(`${rT}/submitCheckout`),confirmCheckout:rt(`${rT}/confirmCheckout`,(e=>({payload:e}))),errorCheckout:rt(`${rT}/errorCheckout`,(e=>({payload:e})))},oT),lT={loading:!1,error:null,cardSetupIntentSecret:null},cT=O({},pk()),{reducer:uT,actions:dT,name:yT}=lt({name:"subscriptions/stripe",initialState:lT,reducers:cT}),fT=O({loadCustomer:rt(`${yT}/loadCustomer`),createCardSetupIntentSecret:rt(`${yT}/createCardSetupIntentSecret`)},dT),pT={loading:!1,fetching:!0,vendorPublicConfig:null},{actions:gT,reducer:ST,name:vT}=lt({name:"subscriptions/vendorPublicConfig",initialState:pT,reducers:O({},pk())}),hT=O({loadVendorPublicConfiguration:rt(`${vT}/loadVendorPublicConfiguration`)},gT),mT={config:Tk,plans:hk,checkout:nT,billing:Zk,stripe:lT,vendorPublicConfig:pT},bT={config:Ok,billing:eT,plans:kk,checkout:sT,stripe:fT,vendorPublicConfig:hT},AT=xe({config:Lk,billing:tT,plans:bk,checkout:aT,stripe:uT,vendorPublicConfig:ST});let kT,TT,PT;function IT({policy:e}){return{policy:PT.AT_PERIOD_END}}function LT(e){switch(e){case Zu.ACTIVE:return TT.ACTIVE;case Zu.INCOMPLETE:return TT.INCOMPLETE;case Zu.CANCELED:return TT.CANCELED;case Zu.EXPIRED:return TT.EXPIRED;case Zu.TRIALING:return TT.TRIALING;default:return TT.EXPIRED}}!function(e){e.STRIPE="Stripe"}(kT||(kT={})),function(e){e.ACTIVE="ACTIVE",e.CANCELED="CANCELED",e.INCOMPLETE="INCOMPLETE",e.EXPIRED="EXPIRED",e.TRIALING="TRIALING"}(TT||(TT={})),function(e){e.AT_PERIOD_END="atPeriodEnd"}(PT||(PT={}));const ET={id:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",externalId:"sub_1JbhYVEwsu4qiqnnfMhYAdY6",startDate:"2021-09-20T08:08:51.000Z",status:Zu.ACTIVE,externallyManaged:!1,cancellation:null,currentPeriodStart:"2021-09-20T08:08:51.000Z",currentPeriodEnd:"2021-10-20T08:08:51.000Z",plan:{slug:"test"}},OT=[{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"}],wT=[{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:""}],DT=[{id:"id",externalId:"externalId",type:ed.CARD,isDefault:!0,last4:"4242",expMonth:11,expYear:25,brand:"visa",billingDetails:{name:"Dummy",email:"dummy@email.com"}}],CT={allowPlanDowngrade:!0,allowPlanCancellation:!0};function*RT(){yield ia(_k.load,UT),yield ia(_k.cancelSubscription,MT),yield ia(_k.renewSubscription,NT)}function*UT(){const e=yield uo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));yield VT(e)}function*_T(){yield oo(_k.setLoading(!0));try{const[e]=yield so(qd.subscriptions.getManagedSubscriptions);yield oo(_k.setState({subscription:e,fetching:!1,loading:!1,error:null}))}catch(e){yield oo(_k.setError(e))}}function*MT(){const{subscription:e}=yield uo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield oo(_k.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield oo(_k.setCancellationError("Billing is externally managed.")));const{id:t,cancellation:n,status:i}=e||{};if(!n&&i===Zu.ACTIVE)try{yield oo(_k.setCancellationLoading(!0)),yield so(qd.subscriptions.cancelManagedSubscription,t),yield _T(),yield oo(_k.setCancellationLoading(!1))}catch(e){yield oo(_k.setCancellationError(e.message))}}function*NT(){const{subscription:e}=yield uo((e=>e.subscriptions.billing.subscription));if(!e)return void(yield oo(_k.setCancellationError("Subscription not found.")));if(null!=e&&e.externallyManaged)return void(yield oo(_k.setCancellationError("Billing is externally managed")));const{id:t,cancellation:n}=e||{};if((null==n?void 0:n.policy)===td.AT_PERIOD_END)try{yield oo(_k.setRenewalLoading(!0)),yield so(qd.subscriptions.renewManagedSubscription,t),yield _T(),yield oo(_k.setRenewalLoading(!1))}catch(e){yield oo(_k.setCancellationError(e.message))}}function*FT(){yield oo(_k.setLoading(!0)),yield yo(500),yield oo(_k.setState({subscription:ET,fetching:!1,loading:!1,error:null}))}function*$T(){yield ia(_k.load,FT)}function*GT(){yield ia(xk.loadBillingInformation,xT)}function*xT(){yield function*(e){const t=yield uo((e=>{var t;return null==(t=e.subscriptions.config.config)?void 0:t.paymentProvider})),n=yield uo((e=>{var t,n;return null==(t=e.auth)||null==(n=t.user)?void 0:n.tenantId}));t&&n?yield VT(n,!1):yield oo(xk.setError(t?"Not authorized":"Internal feature failure"))}()}function*VT(e,t){yield oo(xk.setLoading(!0));try{var n,i;const o=yield so(qd.subscriptions.getSubscriptionSummaries,e),{currentPlanId:a,externallyManaged:r}=o;let s,l=null;r?s=yield so(qd.subscriptions.getSubscriptionPlan,a):([,s]=yield ao([so(_T),so(qd.subscriptions.getSubscriptionPlan,a)]),l=yield uo((e=>e.subscriptions.billing.subscription.subscription||null))),yield oo(xk.setState(O({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?TT.ACTIVE:LT(l.status),cancellation:l.cancellation&&IT(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 oo(xk.setError(e.message))}}function*jT(){yield function*(){var e,t;yield oo(xk.setLoading(!0)),yield yo(500),yield oo(xk.setState({loading:!1,fetching:!1,summary:{subscriptionId:ET.id,paymentMethodId:"mockPaymentMethodId",tenantConfigurationId:"mockTenantConfigurationId",providerType:nd.Stripe,externallyManaged:!1,currentPlanId:OT[0].id,defaultPlanId:OT[0].id},plan:O({},OT[0],{price:null==(e=OT[0].price)?void 0:e.amount,currency:null==(t=OT[0].price)?void 0:t.currency,recurringInterval:"month"})}))}()}function*WT(){yield ia(xk.loadBillingInformation,jT)}function*KT(){yield ia(zk.loadPaymentMethod,BT),yield ia(zk.submitPaymentMethod,qT),yield ia(zk.submitPaymentMethodError,HT),yield ia(zk.submitPaymentMethodSuccess,JT),yield ia(zk.updatePaymentMethodBillingDetails,zT)}function*BT(){yield oo(zk.setLoading(!0));try{const e=(yield so(qd.subscriptions.getPaymentMethods))[0];yield oo(zk.setState({paymentMethod:e,loading:!1,fetching:!1}))}catch(e){yield oo(zk.setError(e.message))}}function*zT({payload:e}){yield oo(zk.setLoading(!0));const{id:t,email:n,address:i,callback:o}=e;try{yield so(qd.subscriptions.updatePaymentMethodBillingDetails,t,O({email:n},i)),yield so(BT),null==o||o(!0)}catch(e){yield oo(zk.setError(e.message)),null==o||o(!1)}yield oo(zk.setLoading(!1))}function*qT(){yield oo(zk.setLoading(!0))}function*HT({payload:e}){yield oo(zk.setError(e))}function*JT(){yield oo(zk.loadPaymentMethod())}function*YT(){yield oo(zk.setLoading(!0)),yield yo(500);const e=DT[0];yield oo(zk.setState({paymentMethod:e,loading:!1,fetching:!1}))}function*QT(){yield ia(zk.loadPaymentMethod,YT)}function*XT(){yield ia(Xk.loadInvoices,ZT),yield ia(Xk.downloadInvoice,eP)}function*ZT(){yield oo(Xk.setLoading(!0));try{const e=(yield so(qd.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 oo(Xk.setState({loading:!1,fetching:!1,invoices:e}))}catch(e){yield oo(Xk.setError(e.message))}}function*eP({payload:e}){yield oo(Xk.setInvoiceDownloadState({loading:!0,error:null}));try{yield so(qd.subscriptions.getSubscriptionInvoicePdf,e.invoiceId,e.filename),yield oo(Xk.setInvoiceDownloadState({loading:!1,error:null}))}catch(e){yield oo(Xk.setInvoiceDownloadState({loading:!1,error:e.message||null}))}}function*tP(){yield oo(Xk.setLoading(!0)),yield yo(500),yield oo(Xk.setState({loading:!1,fetching:!1,invoices:wT.map((e=>O({},e,{selectedPlan:"Premium",paymentDate:new Date(Date.parse(e.paymentDate)),totalAmount:+((e.totalAmount||0)/100).toFixed(2)})))})),yield oo(Xk.setLoading(!1))}function*nP(){yield ia(Xk.loadInvoices,tP)}function*iP(){yield ao([so(GT),so(KT),so(XT),so(RT)])}function*oP(){yield ao([so(WT),so(QT),so(nP),so($T)])}function*aP(){yield ia(sT.loadCheckout,rP),yield ia(sT.resetCheckout,sP),yield ia(sT.submitCheckout,lP),yield ia(sT.confirmCheckout,cP),yield ia(sT.errorCheckout,dP)}function*rP(){yield oo(sT.setState({fetching:!1,loading:!1,error:null,confirmed:!1}))}function*sP(){yield oo(sT.setState({loading:!1,error:null,confirmed:!1}))}function*lP(){yield oo(sT.setState({loading:!0,error:null}))}function*cP({payload:{paymentMethodId:e,planId:t}}){const n=yield uo((e=>e.subscriptions.billing.subscription.subscription)),i=yield uo((e=>e.subscriptions.billing.information.summary)),o=(null==n?void 0:n.status)===Zu.TRIALING,a=!(null==i||!i.paymentMethodId);if(n){if(yield oo(sT.setState({loading:!0,error:null})),o&&a)return yield uP(),void(yield oo(_k.setState({subscription:O({},n,{status:Zu.ACTIVE})})));try{yield so(qd.subscriptions.updateManagedSubscription,n.id,{paymentMethodId:e,planId:t}),yield ao([xT(),BT(),ZT()]),yield uP()}catch(e){yield oo(sT.setState({loading:!1,error:e.message}))}}else yield oo(sT.setState({loading:!1,error:"Subscription not found"}))}function*uP(){yield oo(sT.setState({loading:!1,error:null,confirmed:!0}))}function*dP({payload:e}){yield oo(sT.setState({loading:!1,error:e}))}function*yP(){yield ia(sT.resetCheckout,sP)}function*fP(){yield ia(kk.loadPlans,pP)}function*pP(){yield oo(kk.setLoading(!0));try{const e=(yield so(qd.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 oo(kk.setState({fetching:!1,loading:!1,plans:e}))}catch(e){yield oo(kk.setError(e.message))}}function*gP(){yield oo(kk.setLoading(!0)),yield yo(500),yield oo(kk.setState({fetching:!1,loading:!1,plans:OT.map((e=>{var t,n;return O({},e,{price:(null==(t=e.price)?void 0:t.amount)||0,currency:(null==(n=e.price)?void 0:n.currency)||"usd",recurringInterval:"month"})}))}))}function*SP(){yield ia(kk.loadPlans,gP)}function*vP(){yield ia(Ok.loadPaymentConfiguration,hP)}function*hP(){yield oo(Ok.setLoading(!0));try{(yield so(qd.subscriptions.getPaymentProviders)||[]).find((e=>"1"===e.status&&e.providerType===nd.Stripe))?yield function*(){yield oo(Ok.setLoading(!0));try{const e=yield so(qd.subscriptions.getStripePaymentProviderConfiguration);yield oo(Ok.setState({loading:!1,fetching:!1,config:{paymentProvider:kT.STRIPE,apiKey:e.publishableKey}}))}catch(e){yield oo(Ok.setError(e.message))}}():yield oo(Ok.setError("Payment provider not configured"))}catch(e){yield oo(Ok.setError(e.message))}}function*mP(){yield oo(Ok.setLoading(!0)),yield yo(500),yield oo(Ok.setState({loading:!1,fetching:!1,config:{paymentProvider:kT.STRIPE,apiKey:""}}))}function*bP(){yield ia(Ok.loadPaymentConfiguration,mP)}function*AP(){yield ia(fT.createCardSetupIntentSecret,kP)}function*kP({payload:e}){yield oo(fT.setState({loading:!0,error:null,cardSetupIntentSecret:null}));try{const t={};e&&(t.paymentMethodId=e);const{setupIntentSecret:n}=yield so(qd.subscriptions.createStripePaymentMethodSetupIntentSecret,t);yield oo(fT.setState({cardSetupIntentSecret:n,loading:!1}))}catch(e){yield oo(fT.setError(e.message))}}function*TP(){yield ia(hT.loadVendorPublicConfiguration,PP)}function*PP(){yield oo(hT.setLoading(!0));try{const e=yield so(qd.subscriptions.getVendorPublicConfigurations);yield oo(hT.setState({fetching:!1,loading:!1,vendorPublicConfig:e}))}catch(e){yield oo(hT.setError(e.message))}}function*IP(){yield oo(hT.setLoading(!0)),yield yo(500),yield oo(hT.setState({fetching:!1,loading:!1,vendorPublicConfig:CT}))}function*LP(){yield ia(hT.loadVendorPublicConfiguration,IP)}var EP={sagas:function*(){yield ao([so(iP),so(aP),so(fP),so(vP),so(AP),so(TP)])},mockSagas:function*(){yield ao([so(oP),so(yP),so(SP),so(bP),so(LP)])},reducer:AT,actions:bT,initialState:mT,storeName:"subscriptions"},OP={sagas:function*(){yield ia(of.loadVendorPublicInfo,af)},storeName:Dt,initialState:ef,reducer:tf,actions:of};const{reducer:wP}=lt({name:"root",initialState:{context:void 0,urlStrategy:"path",previewMode:!1,appName:"default"},reducers:{setContext:{prepare:e=>({payload:e}),reducer:(e,{payload:t})=>(ra.setContext(t),O({},e,{context:t}))}}}),DP=(e,t,n=!1,i,o,a=!1,r="path")=>{let s=t;if("undefined"==typeof window&&null==t)throw Error("createFronteggStore(initState, storeHolder) failed, storeHolder must not be null in Server-Side rendering");if(s||(s=window),!s.store){var l,c,u,d,y,f,p,g,S,v;n||a||ra.setContext(e.context);const t=Ho(),h=[...ot({thunk:!1,immutableCheck:!1,serializableCheck:!1}),t];s.store=at({middleware:h,preloadedState:{root:O({},e,{previewMode:n,urlStrategy:r}),[Zb.storeName]:O({},Zb.initialState,i,null!=(l=null==o?void 0:o.auth)?l:{},{routes:O({},Zb.initialState.routes,null!=(c=null==i?void 0:i.routes)?c:{},null!=(u=null==o||null==(d=o.auth)?void 0:d.routes)?u:{})}),[IA.storeName]:O({},IA.initialState,null!=(y=null==o?void 0:o.auditLogs)?y:{},{auditLogsState:O({},IA.initialState.auditLogsState,null!=(f=null==o||null==(p=o.auditLogs)?void 0:p.auditLogsState)?f:{}),auditsMetadataState:O({},IA.initialState.auditsMetadataState,null!=(g=null==o||null==(S=o.auditLogs)?void 0:S.auditsMetadataState)?g:{})}),[EA]:O({},LA,null!=(v=null==o?void 0:o.audits)?v:{}),[fk.storeName]:fk.initialState,[EP.storeName]:EP.initialState,[OP.storeName]:OP.initialState},reducer:xe({root:wP,[Zb.storeName]:Zb.reducer,[IA.storeName]:IA.reducer,[EA]:wA,[fk.storeName]:fk.reducer,[EP.storeName]:EP.reducer,[OP.storeName]:OP.reducer})});const m=function*(){yield ao([so(Zb.sagas),so(IA.sagas),so(xA),so(fk.sagas),so(EP.sagas),so(OP.sagas)])},b=function*(){yield ao([so(Zb.mockSagas),so(IA.mockSagas),so(EP.mockSagas)])};n?(s.store.destroy=t.run(b).cancel,s.store.dispatch(si.requestAuthorize(!0))):s.store.destroy=t.run(m).cancel}return s.store};var CP=n(714),RP=n.n(CP);function UP(e,t=0,n=1){return Math.min(Math.max(t,e),n)}function _P(e){if(e.type)return e;if("#"===e.charAt(0))return _P(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 MP(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 NP(e){if(0===e.indexOf("#"))return e;const{values:t}=_P(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 FP(e,t){return e=_P(e),t=UP(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,MP(e)}function $P(e,t){if(e=_P(e),t=UP(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 MP(e)}function GP(e,t){if(e=_P(e),t=UP(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 MP(e)}const xP=e=>{if(e)return{main:e,light:NP(GP(e,.4)),dark:NP($P(e,.15)),hover:NP($P(e,.15)),active:NP($P(e,.2))}},VP=e=>{if(e)return{main:e,light:GP(e,.7),dark:$P(e,.2)}},jP=(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)?O({},t,{palette:{primary:O({},xP(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:O({},xP(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:O({},xP(null==e||null==(c=e.palette)?void 0:c.error),{contrastText:"#FFF"}),success:O({},VP(null==e||null==(u=e.palette)?void 0:u.success),{contrastText:"#FFF"}),error:O({},VP(null==e||null==(d=e.palette)?void 0:d.error),{contrastText:"#FFF"}),warning:O({},VP(null==e||null==(y=e.palette)?void 0:y.warning),{contrastText:"#FFF"}),info:O({},VP(null==e||null==(f=e.palette)?void 0:f.info),{contrastText:"#FFF"})}}):{}},WP={},KP={},BP={},zP={usage:{visibility:"hidden",permissions:["fe.usage.read"],featureFlag:"fe-usage-page"},webhooks:{visibility:"hidden",permissions:["fe.connectivity.read.webhooks"]},roles:{visibility:"hidden",featureFlag:"fe-roles-page",permissions:["fe.secure.read.roles"]},users:{visibility:"always",permissions:["fe.secure.read.users"],inviteDialog:{phoneNumberField:"optional"}},personalApiTokens:{visibility:"hidden",permissions:["fe.secure.read.userApiTokens"]},apiTokens:{visibility:"hidden",permissions:["fe.secure.read.tenantApiTokens"]},profile:{visibility:"always"},privacy:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},account:{visibility:"always",permissions:["fe.secure.read.accountSettings"]},security:{visibility:"always",permissions:["fe.secure.read.securityPolicy"]},sso:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},multipleSSO:{visibility:"hidden",permissions:["fe.secure.read.samlConfiguration"]},audits:{visibility:"always",permissions:["fe.secure.read.audits"]},subscriptions:{visibility:"hidden",permissions:["fe.subscriptions.*"]}};class qP{constructor(){this._theme=WP,this._themeV2=KP,this._navigation=zP,this._localizations=BP}static getInstance(e="default"){return this._instances[e]}static set(e,t="default"){const n=new qP;return n.set(e),qP._instances[t]=n,n}get theme(){var e;return null!=(e=this._theme)?e:{}}get themeV2(){var e;return null!=(e=this._themeV2)?e:{}}get navigation(){var e;return null!=(e=this._navigation)?e:{}}get localizations(){var e;return null!=(e=this._localizations)?e:{}}set(e){try{var t,n,i,o,a,r,s;this._navigation=RP().all([null!=(t=zP)?t:{},null!=(n=null==e?void 0:e.navigation)?n:{}]),this._theme=RP().all([null!=(i=WP)?i:{},jP(null==e?void 0:e.theme,WP)]),this._themeV2=RP().all([null!=(o=KP)?o:{},null!=(a=null==e?void 0:e.themeV2)?a:{}]),this._localizations=RP().all([null!=(r=BP)?r:{},null!=(s=null==e?void 0:e.localizations)?s:{}])}catch(e){this._navigation=zP,this._theme=WP,this._themeV2=KP,this._localizations=BP}}}qP._instances={};var HP=function(e){return e.replace(/\W+/g," ").split(/ |\B(?=[A-Z])/).map((function(e){return e.toLowerCase()})).join("")},JP=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},YP=function(e){return new Promise((function(t,n){var i=4e3,o=setInterval((function(){return null!=e.themeSetter?(clearInterval(o),void t(!0)):i<0?(n("Failed to load Renderer with themeSetter"),void clearInterval(o)):void(i-=50)}),50)}))};let QP,XP,ZP,eI,tI,nI,iI,oI,aI,rI,sI;!function(e){e.Name="name",e.PhoneNumber="phoneNumber",e.Address="address",e.JobTitle="jobTitle"}(QP||(QP={})),function(e){e.LoginSessions="loginSessions",e.Mfa="mfa"}(XP||(XP={})),function(e){e.Name="name",e.PhoneNumber="phoneNumber"}(ZP||(ZP={})),function(e){e.CompanyName="companyName",e.Address="address",e.Website="website",e.Timezone="timezone",e.Currency="currency"}(eI||(eI={})),function(e){e.Invoices="invoices"}(tI||(tI={})),function(e){e.SessionManagement="sessionManagement",e.GeneralSettings="generalSettings",e.IpRestrictions="ipRestrictions",e.DomainRestrictions="domainRestrictions"}(nI||(nI={})),function(e){e.IdleSessionTimeout="idleSessionTimeout",e.ForceReLogin="forceReLogin",e.MaximumConcurrentSessions="maximumConcurrentSessions"}(iI||(iI={})),function(e){e.Mfa="mfa",e.UserLockout="userLockout",e.PasswordHistory="passwordHistory"}(oI||(oI={})),function(e){e.IpAddressRestrictions="ipAddressRestrictions"}(aI||(aI={})),function(e){e.RestrictSignupByEmailDomain="restrictSignupByEmailDomain"}(rI||(rI={})),function(e){e.SSO="SSO",e.Provisioning="Provisioning"}(sI||(sI={}));const lI={hidden:"hidden",viewOnly:"viewOnly",edit:"edit"},cI={hidden:"hidden",edit:"edit"};var uI="6.89.0-alpha.0",dI={admin_portal_ip_restrictions:"on",admin_portal_domain_restrictions:"on","new-mfa-pages":"on","show-passkeys-new":"on","groups-admin-box-new":"on","msp-all-accounts":"on"},yI=function(){function e(t,n){var i,o=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];k(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(uI),this.customElementName="",this.adminPortalEl=void 0,this.adminPortalRenderer=void 0,this.loginBoxEl=void 0,this.checkoutDialogEl=void 0,this.checkoutDialogRenderer=void 0,this.adminPortalContainer=void 0,this.loginBoxContainer=void 0,this.checkoutDialogContainer=void 0,this.loginBoxRenderer=void 0,this.store=void 0,this.loadingListeners=[],this.updateLocalizations=void 0,this.loadAdminBoxMetadata=D(R().mark((function e(){var t,n,i,a,r;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=da,o.options.metadata){e.next=12;break}return e.prev=2,e.next=5,t("/metadata",{entityName:"adminBox"});case 5:r=e.sent,o.options.metadata=null!=(n=null==r||null==(i=r.rows)||null==(a=i[0])?void 0:a.configuration)?n:{},e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),console.error("failed to get admin portal metadata",e.t0);case 12:qP.set(o.options.metadata,o.name);case 13:case"end":return e.stop()}}),e,null,[[2,9]])}))),this.requestAuthorize=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o.options.hostedLoginBox||o.options.builderMode||"nextjs"===o.options.framework||o.store.dispatch({type:"auth/requestAuthorize",payload:!0});case 1:case"end":return e.stop()}}),e)}))),this.loadFeatureFlags=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.options.previewMode&&!o.options.builderMode){e.next=4;break}fd.set(dI,o.name),e.next=15;break;case 4:return e.prev=4,e.next=7,pd();case 7:t=e.sent,o.options.overrideFeatureFlags&&Object.assign(t,o.options.overrideFeatureFlags),fd.set(t,o.name),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(4),console.error("failed to get admin portal feature flags",e.t0);case 15:case"end":return e.stop()}}),e,null,[[4,12]])}))),this.updateLocalizationsSetter=function(e){o.updateLocalizations=e};var s=HP(n),l="frontegg-app-".concat(s);this.iframeRendering=a,this.name=s,this.options=O({},t,{contextOptions:O({requestCredentials:"include"},t.contextOptions)}),this.options.cdnUrl&&(this.cdnUrl=this.options.cdnUrl),this.customElementName=l;var c,u,d=this.options.authOptions?O({},this.options.authOptions,{hostedLoginBox:this.options.hostedLoginBox}):{hostedLoginBox:this.options.hostedLoginBox};if(d.disableSilentRefresh=null==(i=this.options.authOptions)?void 0:i.disableSilentRefresh,this.options.store){if(this.store=this.options.store,!r&&this.options.store.getState().root.appName!==n)throw Error("Mismatch in store names")}else this.store=DP({context:this.options.contextOptions,appName:this.name},this,this.options.previewMode,d,{auth:null!=(c=this.options.authOptions)?c:{},audits:null!=(u=this.options.auditsOptions)?u:{}},!1,this.options.urlStrategy);E.setInstance(s,this)}var t,n,i,o;return L(e,[{key:"initContainers",value:(o=D(R().mark((function e(t){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.adminPortalEl=t.adminPortalEl,this.loginBoxEl=t.loginBoxEl,this.checkoutDialogEl=t.checkoutDialogEl,this.adminPortalContainer=t.adminPortalContainer,this.loginBoxContainer=t.loginBoxContainer,this.checkoutDialogContainer=t.checkoutDialogContainer;try{"nextjs"!==this.options.framework&&document.body.classList.add("frontegg-loading")}catch(e){console.error("Failed to add frontegg-loading to body classList")}return e.next=9,Promise.all([this.loadAdminBoxMetadata(),this.requestAuthorize(),this.loadFeatureFlags()]);case 9:this.options.previewMode||this.options.customLoginBox||this.loadLoginBox(),this.options.lazyLoadAdminPortal||this.loadScript("FronteggAdminPortal");case 11:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"updateMetadata",value:function(e){var t;qP.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:b,FronteggTypes:A})):n(window[e])},o.onerror=function(e){console.log("Profile page error",e),i(e)},document.body.append(o)}}))}},{key:"loadLoginBox",value:(i=D(R().mark((function e(){return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggLoginBox");case 2:e.sent.render(this.loginBoxEl,{injector:this,options:this.options}),this.loading=!1,this.loadingListeners.forEach((function(e){try{e()}catch(e){console.error("Failed to call loadLoginBoxListener",e)}})),this.loadingListeners=[];case 7:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"showAdminPortal",value:(n=D(R().mark((function e(){var t;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:t=e.sent,this.adminPortalRenderer=t.render(this.adminPortalEl,{injector:this,options:this.options});case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"hideAdminPortal",value:function(){try{var e;null==(e=this.adminPortalRenderer)||e.unmount()}catch(e){console.error("Failed to unmount admin portal",e)}}},{key:"showCheckoutDialog",value:(t=D(R().mark((function e(t){var n;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadScript("FronteggAdminPortal");case 2:n=e.sent,this.checkoutDialogRenderer=n.renderCheckoutDialog(this.checkoutDialogEl,O({injector:this},t,{options:this.options}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"hideCheckoutDialog",value:function(){try{var e;null==(e=this.checkoutDialogRenderer)||e.unmount()}catch(e){console.error("Failed to unmount checkout dialog",e)}}},{key:"close",value:function(){this.hideAdminPortal(),this.hideCheckoutDialog()}}]),e}(),fI=function(){function e(){k(this,e)}return L(e,null,[{key:"setAuthentication",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"default",o=E.getInstance(i);e&&t?(ra.setAccessToken(t),ra.setUser(O({},n,{accessToken:t})),o.store.dispatch(si.setState({isLoading:!1,isAuthenticated:e,user:n})),o.store.dispatch(si.loadTenants())):(ra.setAccessToken(null),ra.setUser(null),o.store.dispatch(si.setState({isLoading:!1,isAuthenticated:!1,user:null})))}}]),e}(),pI=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).showAdminPortal()}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideAdminPortal()}}]),e}(),gI=function(){function e(){k(this,e)}return L(e,null,[{key:"show",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";E.getInstance(t).showCheckoutDialog(e)}},{key:"hide",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";E.getInstance(e).hideCheckoutDialog()}}]),e}(),SI=function(e){var t;return null!=(t=window.FronteggAdminPortal.adminPortalStaticThemesDefaults[e])?t:void 0},vI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];k(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=DP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r},o),this.app=new yI(this.options,t,!0),qP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,i,o,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.adminPortalContainer=t,this.app.adminPortalEl=n,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,YP(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}(),hI="modern",mI=function(e){var t,n=window.FronteggAdminPortal.themes;return null!=(t=n[e])?t:n[hI]},bI=function(){function e(t,n,i,o){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];k(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=DP({context:r,appName:t},this,!0,void 0,void 0,!0);this.options=O({themeOptions:n,iframeRendering:!0,metadata:{},previewMode:!0,builderMode:!0,store:this.store,contextOptions:r,onRedirectTo:function(){console.debug("path")}},o),this.app=new yI(this.options,t,!0,a),qP.set({},t)}var t;return L(e,[{key:"render",value:(t=D(R().mark((function e(t){var n,i,o,a,r=this;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=t.querySelector("#root"))||((n=t.ownerDocument.createElement("div")).setAttribute("id","root"),t.appendChild(n)),this.app.loginBoxContainer=t,this.app.loginBoxEl=n,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,YP(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 AI(e,t){return AI=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},AI(e,t)}function kI(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&&AI(e,t)}function TI(e,t){if(t&&("object"===T(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 PI(e){return PI=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},PI(e)}function II(){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 LI(e,t,n){return LI=II()?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&&AI(o,n.prototype),o},LI.apply(null,arguments)}function EI(e){var t="function"==typeof Map?new Map:void 0;return EI=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 LI(e,arguments,PI(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),AI(n,e)},EI(e)}function OI(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=PI(e);if(t){var o=PI(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return TI(this,n)}}var wI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default",n=new yI(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){kI(n,e);var t=OI(n);function n(){var e;k(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 L(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=E.getInstance(t);if(null===n)throw Error("FronteggApp not found for appName: '".concat(t,"'"));this.setAttribute("id","frontegg-app-".concat(n.name));var i=JP(this,"div",{id:"frontegg-admin-portal-container-".concat(n.name)}),o=JP(this,"div",{id:"frontegg-login-box-container-".concat(n.name)}),a=JP(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=JP(r,"div",{id:"frontegg-admin-portal-".concat(n.name),class:"frontegg-root-content"}),u=JP(s,"div",{id:"frontegg-login-box-".concat(n.name),class:"frontegg-root-content"}),d=JP(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}(EI(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}()}));