(()=>{var e={21:function(e,t,n){var i;e.exports=(i=i||function(e){var t;if("undefined"!=typeof window&&window.crypto&&(t=window.crypto),"undefined"!=typeof self&&self.crypto&&(t=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(t=globalThis.crypto),!t&&"undefined"!=typeof window&&window.msCrypto&&(t=window.msCrypto),!t&&void 0!==n.g&&n.g.crypto&&(t=n.g.crypto),!t)try{t=n(477)}catch(e){}var i=function(){if(t){if("function"==typeof t.getRandomValues)try{return t.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof t.randomBytes)try{return t.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),o={},a=o.lib={},s=a.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=a.WordArray=s.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,r=e.sigBytes;if(this.clamp(),i%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[i+o>>>2]|=a<<24-(i+o)%4*8}else for(var s=0;s>>2]=n[s>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new c.init(n,t/2)}},d=u.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],r=0;r>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new c.init(n,t)}},h=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},f=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,i=this._data,r=i.words,o=i.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*u,o);if(u){for(var d=0;di&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),a=this._iKey=t.clone(),s=r.words,c=a.words,u=0;u{"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(e,t){(arguments.length?this.then.apply(this,arguments):this).then(null,(function(e){setTimeout((function(){throw e}),0)}))})},165:function(e,t,n){var i,r,o,a,s,c,u,l,d,h,f,p,m,v,g,y,w,b,S;e.exports=(i=n(21),n(506),void(i.lib.Cipher||(r=i,o=r.lib,a=o.Base,s=o.WordArray,c=o.BufferedBlockAlgorithm,u=r.enc,u.Utf8,l=u.Base64,d=r.algo.EvpKDF,h=o.Cipher=c.extend({cfg:a.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){c.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:w}return function(t){return{encrypt:function(n,i,r){return e(i).encrypt(t,n,i,r)},decrypt:function(n,i,r){return e(i).decrypt(t,n,i,r)}}}}()}),o.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),f=r.mode={},p=o.BlockCipherMode=a.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),m=f.CBC=function(){var e=p.extend();function t(e,t,n){var i,r=this._iv;r?(i=r,this._iv=void 0):i=this._prevBlock;for(var o=0;o>>2];e.sigBytes-=t}},o.BlockCipher=h.extend({cfg:h.cfg.extend({mode:m,padding:v}),reset:function(){var e;h.reset.call(this);var t=this.cfg,n=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(i,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),g=o.CipherParams=a.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?s.create([1398893684,1701076831]).concat(n).concat(t):t).toString(l)},parse:function(e){var t,n=l.parse(e),i=n.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),n.sigBytes-=16),g.create({ciphertext:n,salt:t})}},w=o.SerializableCipher=a.extend({cfg:a.extend({format:y}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var r=e.createEncryptor(n,i),o=r.finalize(t),a=r.cfg;return g.create({ciphertext:o,key:n,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),b=(r.kdf={}).OpenSSL={execute:function(e,t,n,i,r){if(i||(i=s.random(8)),r)o=d.create({keySize:t+n,hasher:r}).compute(e,i);else var o=d.create({keySize:t+n}).compute(e,i);var a=s.create(o.words.slice(t),4*n);return o.sigBytes=4*t,g.create({key:o,iv:a,salt:i})}},S=o.PasswordBasedCipher=w.extend({cfg:w.cfg.extend({kdf:b}),encrypt:function(e,t,n,i){var r=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=r.iv;var o=w.encrypt.call(this,e,t,r.key,i);return o.mixIn(r),o},decrypt:function(e,t,n,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var r=i.kdf.execute(n,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=r.iv,w.decrypt.call(this,e,t,r.key,i)}}))))},178:function(e,t,n){e.exports=n(21).enc.Utf8},236:(e,t,n)=>{"use strict";var i=n(795),r=[],o=[],a=i.makeRequestCallFromTimer((function(){if(o.length)throw o.shift()}));function s(e){var t;(t=r.length?r.pop():new c).task=e,i(t)}function c(){this.task=null}e.exports=s,c.prototype.call=function(){try{this.task.call()}catch(e){s.onerror?s.onerror(e):(o.push(e),a())}finally{this.task=null,r[r.length]=this}}},471:function(e,t,n){var i,r,o,a,s,c,u,l;e.exports=(r=(i=l=n(21)).lib,o=r.WordArray,a=r.Hasher,s=i.algo,c=[],u=s.SHA1=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],a=n[3],s=n[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var l=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=l<<1|l>>>31}var d=(i<<5|i>>>27)+s+c[u];d+=u<20?1518500249+(r&o|~r&a):u<40?1859775393+(r^o^a):u<60?(r&o|r&a|o&a)-1894007588:(r^o^a)-899497514,s=a,a=o,o=r<<30|r>>>2,r=i,i=d}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=a._createHelper(u),i.HmacSHA1=a._createHmacHelper(u),l.SHA1)},477:()=>{},506:function(e,t,n){var i,r,o,a,s,c,u,l;e.exports=(l=n(21),n(471),n(25),o=(r=(i=l).lib).Base,a=r.WordArray,c=(s=i.algo).MD5,u=s.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,i=this.cfg,r=i.hasher.create(),o=a.create(),s=o.words,c=i.keySize,u=i.iterations;s.length{"use strict";var i=n(795);function r(){}var o=null,a={};function s(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("Promise constructor's argument is not a function");this._x=0,this._y=0,this._z=null,this._A=null,e!==r&&f(e,this)}function c(e,t){for(;3===e._y;)e=e._z;if(s._B&&s._B(e),0===e._y)return 0===e._x?(e._x=1,void(e._A=t)):1===e._x?(e._x=2,void(e._A=[e._A,t])):void e._A.push(t);!function(e,t){i((function(){var n=1===e._y?t.onFulfilled:t.onRejected;if(null!==n){var i=function(e,t){try{return e(t)}catch(e){return o=e,a}}(n,e._z);i===a?l(t.promise,o):u(t.promise,i)}else 1===e._y?u(t.promise,e._z):l(t.promise,e._z)}))}(e,t)}function u(e,t){if(t===e)return l(e,new TypeError("A promise cannot be resolved with itself."));if(t&&("object"==typeof t||"function"==typeof t)){var n=function(e){try{return e.then}catch(e){return o=e,a}}(t);if(n===a)return l(e,o);if(n===e.then&&t instanceof s)return e._y=3,e._z=t,void d(e);if("function"==typeof n)return void f(n.bind(t),e)}e._y=1,e._z=t,d(e)}function l(e,t){e._y=2,e._z=t,s._C&&s._C(e,t),d(e)}function d(e){if(1===e._x&&(c(e,e._A),e._A=null),2===e._x){for(var t=0;t{"use strict";var i=n(551);e.exports=i;var r=l(!0),o=l(!1),a=l(null),s=l(void 0),c=l(0),u=l("");function l(e){var t=new i(i._D);return t._y=1,t._z=e,t}i.resolve=function(e){if(e instanceof i)return e;if(null===e)return a;if(void 0===e)return s;if(!0===e)return r;if(!1===e)return o;if(0===e)return c;if(""===e)return u;if("object"==typeof e||"function"==typeof e)try{var t=e.then;if("function"==typeof t)return new i(t.bind(e))}catch(e){return new i((function(t,n){n(e)}))}return l(e)};var d=function(e){return"function"==typeof Array.from?(d=Array.from,Array.from(e)):(d=function(e){return Array.prototype.slice.call(e)},Array.prototype.slice.call(e))};function h(e){return{status:"fulfilled",value:e}}function f(e){return{status:"rejected",reason:e}}function p(e){if(e&&("object"==typeof e||"function"==typeof e)){if(e instanceof i&&e.then===i.prototype.then)return e.then(h,f);var t=e.then;if("function"==typeof t)return new i(t.bind(e)).then(h,f)}return h(e)}function m(e){if("function"==typeof AggregateError)return new AggregateError(e,"All promises were rejected");var t=new Error("All promises were rejected");return t.name="AggregateError",t.errors=e,t}i.all=function(e){var t=d(e);return new i((function(e,n){if(0===t.length)return e([]);var r=t.length;function o(a,s){if(s&&("object"==typeof s||"function"==typeof s)){if(s instanceof i&&s.then===i.prototype.then){for(;3===s._y;)s=s._z;return 1===s._y?o(a,s._z):(2===s._y&&n(s._z),void s.then((function(e){o(a,e)}),n))}var c=s.then;if("function"==typeof c)return void new i(c.bind(s)).then((function(e){o(a,e)}),n)}t[a]=s,0==--r&&e(t)}for(var a=0;a>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],v=e[t+5],g=e[t+6],y=e[t+7],w=e[t+8],b=e[t+9],S=e[t+10],_=e[t+11],k=e[t+12],C=e[t+13],O=e[t+14],I=e[t+15],T=o[0],x=o[1],j=o[2],L=o[3];T=u(T,x,j,L,a,7,s[0]),L=u(L,T,x,j,c,12,s[1]),j=u(j,L,T,x,f,17,s[2]),x=u(x,j,L,T,p,22,s[3]),T=u(T,x,j,L,m,7,s[4]),L=u(L,T,x,j,v,12,s[5]),j=u(j,L,T,x,g,17,s[6]),x=u(x,j,L,T,y,22,s[7]),T=u(T,x,j,L,w,7,s[8]),L=u(L,T,x,j,b,12,s[9]),j=u(j,L,T,x,S,17,s[10]),x=u(x,j,L,T,_,22,s[11]),T=u(T,x,j,L,k,7,s[12]),L=u(L,T,x,j,C,12,s[13]),j=u(j,L,T,x,O,17,s[14]),T=l(T,x=u(x,j,L,T,I,22,s[15]),j,L,c,5,s[16]),L=l(L,T,x,j,g,9,s[17]),j=l(j,L,T,x,_,14,s[18]),x=l(x,j,L,T,a,20,s[19]),T=l(T,x,j,L,v,5,s[20]),L=l(L,T,x,j,S,9,s[21]),j=l(j,L,T,x,I,14,s[22]),x=l(x,j,L,T,m,20,s[23]),T=l(T,x,j,L,b,5,s[24]),L=l(L,T,x,j,O,9,s[25]),j=l(j,L,T,x,p,14,s[26]),x=l(x,j,L,T,w,20,s[27]),T=l(T,x,j,L,C,5,s[28]),L=l(L,T,x,j,f,9,s[29]),j=l(j,L,T,x,y,14,s[30]),T=d(T,x=l(x,j,L,T,k,20,s[31]),j,L,v,4,s[32]),L=d(L,T,x,j,w,11,s[33]),j=d(j,L,T,x,_,16,s[34]),x=d(x,j,L,T,O,23,s[35]),T=d(T,x,j,L,c,4,s[36]),L=d(L,T,x,j,m,11,s[37]),j=d(j,L,T,x,y,16,s[38]),x=d(x,j,L,T,S,23,s[39]),T=d(T,x,j,L,C,4,s[40]),L=d(L,T,x,j,a,11,s[41]),j=d(j,L,T,x,p,16,s[42]),x=d(x,j,L,T,g,23,s[43]),T=d(T,x,j,L,b,4,s[44]),L=d(L,T,x,j,k,11,s[45]),j=d(j,L,T,x,I,16,s[46]),T=h(T,x=d(x,j,L,T,f,23,s[47]),j,L,a,6,s[48]),L=h(L,T,x,j,y,10,s[49]),j=h(j,L,T,x,O,15,s[50]),x=h(x,j,L,T,v,21,s[51]),T=h(T,x,j,L,k,6,s[52]),L=h(L,T,x,j,p,10,s[53]),j=h(j,L,T,x,S,15,s[54]),x=h(x,j,L,T,c,21,s[55]),T=h(T,x,j,L,w,6,s[56]),L=h(L,T,x,j,I,10,s[57]),j=h(j,L,T,x,g,15,s[58]),x=h(x,j,L,T,C,21,s[59]),T=h(T,x,j,L,m,6,s[60]),L=h(L,T,x,j,_,10,s[61]),j=h(j,L,T,x,f,15,s[62]),x=h(x,j,L,T,b,21,s[63]),o[0]=o[0]+T|0,o[1]=o[1]+x|0,o[2]=o[2]+j|0,o[3]=o[3]+L|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(i/4294967296),a=i;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,i,r,o,a){var s=e+(t&n|~t&i)+r+a;return(s<>>32-o)+t}function l(e,t,n,i,r,o,a){var s=e+(t&i|n&~i)+r+a;return(s<>>32-o)+t}function d(e,t,n,i,r,o,a){var s=e+(t^n^i)+r+a;return(s<>>32-o)+t}function h(e,t,n,i,r,o,a){var s=e+(n^(t|~i))+r+a;return(s<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),i.MD5)},754:function(e,t,n){var i,r,o;e.exports=(i=n(21),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp();for(var r=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var r=0;r>>6-a%4*2;i[r>>>2]|=s<<24-r%4*8,r++}return o.create(i,r)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},795:(e,t,n)=>{"use strict";function i(e){o.length||r(),o[o.length]=e}e.exports=i;var r,o=[],a=0;function s(){for(;a1024){for(var t=0,n=o.length-a;t{n(236),"undefined"==typeof Promise&&(Promise=n(551),n(635)),n(112)},955:function(e,t,n){var i;e.exports=(i=n(21),n(754),n(636),n(506),n(165),function(){var e=i,t=e.lib.BlockCipher,n=e.algo,r=[],o=[],a=[],s=[],c=[],u=[],l=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,r[n]=p,o[p]=n;var m=e[n],v=e[m],g=e[v],y=257*e[p]^16843008*p;a[n]=y<<24|y>>>8,s[n]=y<<16|y>>>16,c[n]=y<<8|y>>>24,u[n]=y,y=16843009*g^65537*v^257*m^16843008*n,l[p]=y<<24|y>>>8,d[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,n?(n=m^e[e[e[g^m]]],i^=e[e[i]]):n=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,i=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],a=0;a6&&a%n==4&&(u=r[u>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u]):(u=r[(u=u<<8|u>>>24)>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u],u^=p[a/n|0]<<24),o[a]=o[a-n]^u);for(var s=this._invKeySchedule=[],c=0;c>>24]]^d[r[u>>>16&255]]^h[r[u>>>8&255]]^f[r[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,h,f,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,r,o,a,s){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],f=4,p=1;p>>24]^r[l>>>16&255]^o[d>>>8&255]^a[255&h]^n[f++],v=i[l>>>24]^r[d>>>16&255]^o[h>>>8&255]^a[255&u]^n[f++],g=i[d>>>24]^r[h>>>16&255]^o[u>>>8&255]^a[255&l]^n[f++],y=i[h>>>24]^r[u>>>16&255]^o[l>>>8&255]^a[255&d]^n[f++];u=m,l=v,d=g,h=y}m=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&h])^n[f++],v=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^n[f++],g=(s[d>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^n[f++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^n[f++],e[t]=m,e[t+1]=v,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),i.AES)},972:function(e){e.exports=(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{default:()=>d});const n=(...e)=>{},i=e=>null!==e&&"Object"===(null==e?void 0:e.constructor.name);let r,o;const a=()=>{if(!r){r=!0;try{o=u.storage||localStorage,o.getItem("")}catch{o=(()=>{const e={getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{t[e]=void 0},clear:()=>{t={__proto__:e}}};let t={__proto__:e};return t})()}l()}},s=String.fromCharCode(0),c=(e,t,n=!0)=>n?[...JSON.stringify(e)].map((e=>String.fromCharCode(e.charCodeAt(0)+t))).join(""):JSON.parse([...e].map((e=>String.fromCharCode(e.charCodeAt(0)-t))).join("")),u={ttl:null,encrypt:!1,encrypter:c,decrypter:(e,t)=>c(e,t,!1),secret:75,storage:void 0};Object.seal(u);const l=(e=!1)=>{a();for(const t of Object.keys(o)){const n=o.getItem(t);let r;try{r=JSON.parse(n||"")}catch{continue}i(r)&&s in r&&(Date.now()>r.ttl||e)&&o.removeItem(t)}},d={config:u,set:(e,t,i={})=>{a();const r={...u,...i,encrypt:!1!==i.encrypt&&(i.encrypt||u.encrypt),ttl:null===i.ttl?null:i.ttl||u.ttl};try{const i=r.ttl&&!isNaN(r.ttl)&&r.ttl>0;let a=i?{[s]:t,ttl:Date.now()+1e3*r.ttl}:t;r.encrypt&&(i?a[s]=(r.encrypter||n)(a[s],r.secret):a=(r.encrypter||n)(a,r.secret)),o.setItem(e,JSON.stringify(a))}catch{return!1}},get:(e,t={})=>{a();const r=o.getItem(e),c={...u,...t,encrypt:!1!==t.encrypt&&(t.encrypt||u.encrypt),ttl:null===t.ttl?null:t.ttl||u.ttl};let l,d;try{l=JSON.parse(r||""),d=i(l)&&s in l,(c.decrypt||c.encrypt)&&(d?l[s]=(c.decrypter||n)(l[s],c.secret):l=(c.decrypter||n)(l,c.secret))}catch{}return d?Date.now()>l.ttl?(o.removeItem(e),null):l[s]:void 0!==l?l:r},flush:l,clear:()=>{a(),o.clear()},remove:e=>{a(),o.removeItem(e)}};return t.default})()}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";function e(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0?setTimeout(n,t):n(null)}}window.addEventListener("storage",a),e.addToWaiting(a);var s=setTimeout(a,Math.max(0,t-Date.now()))}))];case 1:return n.sent(),[2]}}))}))},e.addToWaiting=function(t){this.removeFromWaiting(t),void 0!==e.waiters&&e.waiters.push(t)},e.removeFromWaiting=function(t){void 0!==e.waiters&&(e.waiters=e.waiters.filter((function(e){return e!==t})))},e.notifyWaiters=function(){void 0!==e.waiters&&e.waiters.slice().forEach((function(e){return e()}))},e.prototype.releaseLock=function(e){return i(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,this.releaseLock__private__(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.releaseLock__private__=function(t){return i(this,void 0,void 0,(function(){var n,i,a,u;return r(this,(function(r){switch(r.label){case 0:return n=void 0===this.storageHandler?c:this.storageHandler,i=s+"-"+t,null===(a=n.getItemSync(i))?[2]:(u=JSON.parse(a)).id!==this.id?[3,2]:[4,o.default().lock(u.iat)];case 1:r.sent(),this.acquiredIatSet.delete(u.iat),n.removeItemSync(i),o.default().unlock(u.iat),e.notifyWaiters(),r.label=2;case 2:return[2]}}))}))},e.lockCorrector=function(t){for(var n=Date.now()-5e3,i=t,r=[],o=0;;){var a=i.keySync(o);if(null===a)break;r.push(a),o++}for(var c=!1,u=0;uDate.now();class l extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,l.prototype)}static fromPayload({error:e,error_description:t}){return new l(e,t)}}class d extends l{constructor(e,t,n,i=null){super(e,t),this.state=n,this.appState=i,Object.setPrototypeOf(this,d.prototype)}}class h extends l{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,h.prototype)}}class f extends h{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,f.prototype)}}class p extends l{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,p.prototype)}}class m extends l{constructor(e,t,n){super(e,t),this.mfa_token=n,Object.setPrototypeOf(this,m.prototype)}}class v extends l{constructor(e,t){super("missing_refresh_token",`Missing Refresh Token (audience: '${g(e,["default"])}', scope: '${g(t)}')`),this.audience=e,this.scope=t,Object.setPrototypeOf(this,v.prototype)}}function g(e,t=[]){return e&&!t.includes(e)?e:""}const y=()=>window.crypto,w=()=>{let e="";return Array.from(y().getRandomValues(new Uint8Array(43))).forEach((t=>e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[t%66])),e},b=e=>btoa(e),S=t=>{var{clientId:n}=t,i=e(t,["clientId"]);return new URLSearchParams((e=>Object.keys(e).filter((t=>void 0!==e[t])).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:e[n]})),{}))(Object.assign({client_id:n},i))).toString()},_=e=>(e=>decodeURIComponent(atob(e).split("").map((e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2))).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),k=async(e,t)=>{const n=await fetch(e,t);return{ok:n.ok,json:await n.json()}},C=async(e,t,n,i,r,o,a=1e4)=>r?(async(e,t,n,i,r,o,a)=>{return s={auth:{audience:t,scope:n},timeout:r,fetchUrl:e,fetchOptions:i,useFormData:a},c=o,new Promise((function(e,t){const n=new MessageChannel;n.port1.onmessage=function(i){i.data.error?t(new Error(i.data.error)):e(i.data),n.port1.close()},c.postMessage(s,[n.port2])}));var s,c})(e,t,n,i,a,r,o):(async(e,t,n)=>{const i=new AbortController;let r;return t.signal=i.signal,Promise.race([k(e,t),new Promise(((e,t)=>{r=setTimeout((()=>{i.abort(),t(new Error("Timeout when executing 'fetch'"))}),n)}))]).finally((()=>{clearTimeout(r)}))})(e,i,a);async function O(t,n){var{baseUrl:i,timeout:r,audience:o,scope:a,auth0Client:s,useFormData:u}=t,d=e(t,["baseUrl","timeout","audience","scope","auth0Client","useFormData"]);const h=u?S(d):JSON.stringify(d);return await async function(t,n,i,r,o,a,s){let c,u=null;for(let e=0;e<3;e++)try{c=await C(t,i,r,o,a,s,n),u=null;break}catch(e){u=e}if(u)throw u;const d=c.json,{error:h,error_description:f}=d,p=e(d,["error","error_description"]),{ok:g}=c;if(!g){const e=f||`HTTP error. Unable to fetch ${t}`;if("mfa_required"===h)throw new m(h,e,p.mfa_token);if("missing_refresh_token"===h)throw new v(i,r);throw new l(h||"request_error",e)}return p}(`${i}/oauth/token`,r,o||"default",a,{method:"POST",body:h,headers:{"Content-Type":u?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(s||c))}},n,u)}const I=(...e)=>{return(t=e.filter(Boolean).join(" ").trim().split(/\s+/),Array.from(new Set(t))).join(" ");var t};class T{constructor(e,t="@@auth0spajs@@",n){this.prefix=t,this.suffix=n,this.clientId=e.clientId,this.scope=e.scope,this.audience=e.audience}toKey(){return[this.prefix,this.clientId,this.audience,this.scope,this.suffix].filter(Boolean).join("::")}static fromKey(e){const[t,n,i,r]=e.split("::");return new T({clientId:n,scope:r,audience:i},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:i}=e;return new T({scope:t,audience:n,clientId:i})}}class x{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith("@@auth0spajs@@")))}}class j{constructor(){this.enclosedCache=function(){let e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class L{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||u}async setIdToken(e,t,n){var i;const r=this.getIdTokenCacheKey(e);await this.cache.set(r,{id_token:t,decodedToken:n}),await(null===(i=this.keyManifest)||void 0===i?void 0:i.add(r))}async getIdToken(e){const t=await this.cache.get(this.getIdTokenCacheKey(e.clientId));if(!t&&e.scope&&e.audience){const t=await this.get(e);if(!t)return;if(!t.id_token||!t.decodedToken)return;return{id_token:t.id_token,decodedToken:t.decodedToken}}if(t)return{id_token:t.id_token,decodedToken:t.decodedToken}}async get(e,t=0){var n;let i=await this.cache.get(e.toKey());if(!i){const t=await this.getCacheKeys();if(!t)return;const n=this.matchExistingCacheKey(e,t);n&&(i=await this.cache.get(n))}if(!i)return;const r=await this.nowProvider(),o=Math.floor(r/1e3);return i.expiresAt-t!e||t.includes(e))).reduce((async(e,t)=>{await e,await this.cache.remove(t)}),Promise.resolve()),await(null===(t=this.keyManifest)||void 0===t?void 0:t.clear()))}async wrapCacheEntry(e){const t=await this.nowProvider();return{body:e,expiresAt:Math.floor(t/1e3)+e.expires_in}}async getCacheKeys(){var e;return this.keyManifest?null===(e=await this.keyManifest.get())||void 0===e?void 0:e.keys:this.cache.allKeys?this.cache.allKeys():void 0}getIdTokenCacheKey(e){return new T({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter((t=>{var n;const i=T.fromKey(t),r=new Set(i.scope&&i.scope.split(" ")),o=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=i.scope&&o.reduce(((e,t)=>e&&r.has(t)),!0);return"@@auth0spajs@@"===i.prefix&&i.clientId===e.clientId&&i.audience===e.audience&&a}))[0]}}class A{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey=`a0.spajs.txs.${this.clientId}`}create(e){this.storage.save(this.storageKey,e,{daysUntilExpire:1,cookieDomain:this.cookieDomain})}get(){return this.storage.get(this.storageKey)}remove(){this.storage.remove(this.storageKey,{cookieDomain:this.cookieDomain})}}const E=e=>"number"==typeof e,P=["iss","aud","exp","nbf","iat","jti","azp","nonce","auth_time","at_hash","c_hash","acr","amr","sub_jwk","cnf","sip_from_tag","sip_date","sip_callid","sip_cseq_num","sip_via_branch","orig","dest","mky","events","toe","txn","rph","sid","vot","vtm"];var W=r((function(e,n){var i=t&&t.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,i=arguments.length;nV.get(e)||V.get(`_legacy_${e}`),save(e,t,n){let i={};"https:"===window.location.protocol&&(i={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(i.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(i.domain=n.cookieDomain),z(`_legacy_${e}`,JSON.stringify(t),i),V.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Z(e,n),V.remove(e,t),V.remove(`_legacy_${e}`,t)}},U={get(e){if("undefined"==typeof sessionStorage)return;const t=sessionStorage.getItem(e);return null!=t?JSON.parse(t):void 0},save(e,t){sessionStorage.setItem(e,JSON.stringify(t))},remove(e){sessionStorage.removeItem(e)}};var M,N=function(e){return M=M||function(){var e=function(e){var t=atob(e);return t}("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9ImZ1bmN0aW9uIj09dHlwZW9mIFN1cHByZXNzZWRFcnJvciYmU3VwcHJlc3NlZEVycm9yO2NvbnN0IHM9ZT0+e3ZhcntjbGllbnRJZDp0fT1lLHI9ZnVuY3Rpb24oZSx0KXt2YXIgcj17fTtmb3IodmFyIHMgaW4gZSlPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoZSxzKSYmdC5pbmRleE9mKHMpPDAmJihyW3NdPWVbc10pO2lmKG51bGwhPWUmJiJmdW5jdGlvbiI9PXR5cGVvZiBPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgbz0wO2ZvcihzPU9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMoZSk7bzxzLmxlbmd0aDtvKyspdC5pbmRleE9mKHNbb10pPDAmJk9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChlLHNbb10pJiYocltzW29dXT1lW3Nbb11dKX1yZXR1cm4gcn0oZSxbImNsaWVudElkIl0pO3JldHVybiBuZXcgVVJMU2VhcmNoUGFyYW1zKChlPT5PYmplY3Qua2V5cyhlKS5maWx0ZXIoKHQ9PnZvaWQgMCE9PWVbdF0pKS5yZWR1Y2UoKCh0LHIpPT5PYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30sdCkse1tyXTplW3JdfSkpLHt9KSkoT2JqZWN0LmFzc2lnbih7Y2xpZW50X2lkOnR9LHIpKSkudG9TdHJpbmcoKX07bGV0IG89e307Y29uc3Qgbj0oZSx0KT0+YCR7ZX18JHt0fWA7YWRkRXZlbnRMaXN0ZW5lcigibWVzc2FnZSIsKGFzeW5jKHtkYXRhOnt0aW1lb3V0OmUsYXV0aDpyLGZldGNoVXJsOmksZmV0Y2hPcHRpb25zOmMsdXNlRm9ybURhdGE6YX0scG9ydHM6W3BdfSk9PntsZXQgZjtjb25zdHthdWRpZW5jZTp1LHNjb3BlOmx9PXJ8fHt9O3RyeXtjb25zdCByPWE/KGU9Pntjb25zdCB0PW5ldyBVUkxTZWFyY2hQYXJhbXMoZSkscj17fTtyZXR1cm4gdC5mb3JFYWNoKCgoZSx0KT0+e3JbdF09ZX0pKSxyfSkoYy5ib2R5KTpKU09OLnBhcnNlKGMuYm9keSk7aWYoIXIucmVmcmVzaF90b2tlbiYmInJlZnJlc2hfdG9rZW4iPT09ci5ncmFudF90eXBlKXtjb25zdCBlPSgoZSx0KT0+b1tuKGUsdCldKSh1LGwpO2lmKCFlKXRocm93IG5ldyB0KHUsbCk7Yy5ib2R5PWE/cyhPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKTpKU09OLnN0cmluZ2lmeShPYmplY3QuYXNzaWduKE9iamVjdC5hc3NpZ24oe30scikse3JlZnJlc2hfdG9rZW46ZX0pKX1sZXQgaCxnOyJmdW5jdGlvbiI9PXR5cGVvZiBBYm9ydENvbnRyb2xsZXImJihoPW5ldyBBYm9ydENvbnRyb2xsZXIsYy5zaWduYWw9aC5zaWduYWwpO3RyeXtnPWF3YWl0IFByb21pc2UucmFjZShbKGQ9ZSxuZXcgUHJvbWlzZSgoZT0+c2V0VGltZW91dChlLGQpKSkpLGZldGNoKGksT2JqZWN0LmFzc2lnbih7fSxjKSldKX1jYXRjaChlKXtyZXR1cm4gdm9pZCBwLnBvc3RNZXNzYWdlKHtlcnJvcjplLm1lc3NhZ2V9KX1pZighZylyZXR1cm4gaCYmaC5hYm9ydCgpLHZvaWQgcC5wb3N0TWVzc2FnZSh7ZXJyb3I6IlRpbWVvdXQgd2hlbiBleGVjdXRpbmcgJ2ZldGNoJyJ9KTtmPWF3YWl0IGcuanNvbigpLGYucmVmcmVzaF90b2tlbj8oKChlLHQscik9PntvW24odCxyKV09ZX0pKGYucmVmcmVzaF90b2tlbix1LGwpLGRlbGV0ZSBmLnJlZnJlc2hfdG9rZW4pOigoZSx0KT0+e2RlbGV0ZSBvW24oZSx0KV19KSh1LGwpLHAucG9zdE1lc3NhZ2Uoe29rOmcub2ssanNvbjpmfSl9Y2F0Y2goZSl7cC5wb3N0TWVzc2FnZSh7b2s6ITEsanNvbjp7ZXJyb3I6ZS5lcnJvcixlcnJvcl9kZXNjcmlwdGlvbjplLm1lc3NhZ2V9fSl9dmFyIGR9KSl9KCk7Cgo="),t=e.indexOf("\n",10)+1,n=e.substring(t)+"",i=new Blob([n],{type:"application/javascript"});return URL.createObjectURL(i)}(),new Worker(M,e)};const F={};class X{constructor(e,t){this.cache=e,this.clientId=t,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var t;const n=new Set((null===(t=await this.cache.get(this.manifestKey))||void 0===t?void 0:t.keys)||[]);n.add(e),await this.cache.set(this.manifestKey,{keys:[...n]})}async remove(e){const t=await this.cache.get(this.manifestKey);if(t){const n=new Set(t.keys);return n.delete(e),n.size>0?await this.cache.set(this.manifestKey,{keys:[...n]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}}const H={memory:()=>(new j).enclosedCache,localstorage:()=>new x},B=e=>H[e],G=t=>{const{openUrl:n,onRedirect:i}=t,r=e(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===n||n?n:i})},Y=new a;class J{constructor(e){let t,n;if(this.userCache=(new j).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await Y.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),"undefined"!=typeof window&&(()=>{if(!y())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===y().subtle)throw new Error("\n auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/main/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.\n ")})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||"memory",!B(t))throw new Error(`Invalid cache location "${t}"`);n=B(t)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?V:D,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(()=>`auth0.${this.options.clientId}.is.authenticated`)(),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const i=e.useCookiesForTransactions?this.cookieStorage:U;var r;this.scope=I("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new A(i,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||u,this.cacheManager=new L(n,n.allKeys?void 0:new X(n,this.options.clientId),this.nowProvider),this.domainUrl=(r=this.options.domain,/^https?:\/\//.test(r)?r:`https://${r}`),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:`https://${e}/`:`${t}/`)(this.options.issuer,this.domainUrl),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new N)}_url(e){const t=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||c)));return`${this.domainUrl}${e}&auth0Client=${t}`}_authorizeUrl(e){return this._url(`/authorize?${S(e)}`)}async _verifyIdToken(e,t,n){const i=await this.nowProvider();return(e=>{if(!e.id_token)throw new Error("ID token is required but missing");const t=(e=>{const t=e.split("."),[n,i,r]=t;if(3!==t.length||!n||!i||!r)throw new Error("ID token could not be decoded");const o=JSON.parse(_(i)),a={__raw:e},s={};return Object.keys(o).forEach((e=>{a[e]=o[e],P.includes(e)||(s[e]=o[e])})),{encoded:{header:n,payload:i,signature:r},header:JSON.parse(_(n)),claims:a,user:s}})(e.id_token);if(!t.claims.iss)throw new Error("Issuer (iss) claim must be a string present in the ID token");if(t.claims.iss!==e.iss)throw new Error(`Issuer (iss) claim mismatch in the ID token; expected "${e.iss}", found "${t.claims.iss}"`);if(!t.user.sub)throw new Error("Subject (sub) claim must be a string present in the ID token");if("RS256"!==t.header.alg)throw new Error(`Signature algorithm of "${t.header.alg}" is not supported. Expected the ID token to be signed with "RS256".`);if(!t.claims.aud||"string"!=typeof t.claims.aud&&!Array.isArray(t.claims.aud))throw new Error("Audience (aud) claim must be a string or array of strings present in the ID token");if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e.aud))throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but was not one of "${t.claims.aud.join(", ")}"`);if(t.claims.aud.length>1){if(!t.claims.azp)throw new Error("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values");if(t.claims.azp!==e.aud)throw new Error(`Authorized Party (azp) claim mismatch in the ID token; expected "${e.aud}", found "${t.claims.azp}"`)}}else if(t.claims.aud!==e.aud)throw new Error(`Audience (aud) claim mismatch in the ID token; expected "${e.aud}" but found "${t.claims.aud}"`);if(e.nonce){if(!t.claims.nonce)throw new Error("Nonce (nonce) claim must be a string present in the ID token");if(t.claims.nonce!==e.nonce)throw new Error(`Nonce (nonce) claim mismatch in the ID token; expected "${e.nonce}", found "${t.claims.nonce}"`)}if(e.max_age&&!E(t.claims.auth_time))throw new Error("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified");if(null==t.claims.exp||!E(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!E(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,i=new Date(e.now||Date.now()),r=new Date(0);if(r.setUTCSeconds(t.claims.exp+n),i>r)throw new Error(`Expiration Time (exp) claim error in the ID token; current time (${i}) is after expiration time (${r})`);if(null!=t.claims.nbf&&E(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ir)throw new Error(`Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time (${i}) is after last auth at ${r}`)}if(e.organization){const n=e.organization.trim();if(n.startsWith("org_")){const e=n;if(!t.claims.org_id)throw new Error("Organization ID (org_id) claim must be a string present in the ID token");if(e!==t.claims.org_id)throw new Error(`Organization ID (org_id) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_id}"`)}else{const e=n.toLowerCase();if(!t.claims.org_name)throw new Error("Organization Name (org_name) claim must be a string present in the ID token");if(e!==t.claims.org_name)throw new Error(`Organization Name (org_name) claim mismatch in the ID token; expected "${e}", found "${t.claims.org_name}"`)}}return t})({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:t,organization:n,leeway:this.options.leeway,max_age:(r=this.options.authorizationParams.max_age,"string"!=typeof r?r:parseInt(r,10)||void 0),now:i});var r}_processOrgHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,t,n){const i=b(w()),r=b(w()),o=w(),a=(e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,(e=>t[e]))})(window.btoa(String.fromCharCode(...Array.from(t))))})(await(async e=>{const t=y().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t})(o)),s=((e,t,n,i,r,o,a,s)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:I(t,n.scope),response_type:"code",response_mode:s||"query",state:i,nonce:r,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:o,code_challenge_method:"S256"}))(this.options,this.scope,e,i,r,a,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode),c=this._authorizeUrl(s);return{nonce:r,code_verifier:o,scope:s.scope,audience:s.audience||"default",redirect_uri:s.redirect_uri,state:i,url:c}}async loginWithPopup(e,t){var n;if(e=e||{},!(t=t||{}).popup&&(t.popup=(()=>{const e=window.screenX+(window.innerWidth-400)/2,t=window.screenY+(window.innerHeight-600)/2;return window.open("","auth0:authorize:popup",`left=${e},top=${t},width=400,height=600,resizable,scrollbars=yes,status=1`)})(),!t.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const i=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=i.url;const r=await(e=>new Promise(((t,n)=>{let i;const r=setInterval((()=>{e.popup&&e.popup.closed&&(clearInterval(r),clearTimeout(o),window.removeEventListener("message",i,!1),n(new p(e.popup)))}),1e3),o=setTimeout((()=>{clearInterval(r),n(new f(e.popup)),window.removeEventListener("message",i,!1)}),1e3*(e.timeoutInSeconds||60));i=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(o),clearInterval(r),window.removeEventListener("message",i,!1),e.popup.close(),a.data.response.error)return n(l.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",i)})))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(i.state!==r.state)throw new l("state_mismatch","Invalid state");const o=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:i.audience,scope:i.scope,code_verifier:i.code_verifier,grant_type:"authorization_code",code:r.code,redirect_uri:i.redirect_uri},{nonceIn:i.nonce,organization:o})}async getUser(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.user}async getIdTokenClaims(){var e;const t=await this._getIdTokenFromCache();return null===(e=null==t?void 0:t.decodedToken)||void 0===e?void 0:e.claims}async loginWithRedirect(t={}){var n;const i=G(t),{openUrl:r,fragment:o,appState:a}=i,s=e(i,["openUrl","fragment","appState"]),c=(null===(n=s.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(s.authorizationParams||{}),{url:l}=u,d=e(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},d),{appState:a}),c&&{organization:c}));const h=o?`${l}#${o}`:l;r?await r(h):window.location.assign(h)}async handleRedirectCallback(e=window.location.href){const t=e.split("?").slice(1);if(0===t.length)throw new Error("There are no query params available for parsing.");const{state:n,code:i,error:r,error_description:o}=(e=>{e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=new URLSearchParams(e);return{state:t.get("state"),code:t.get("code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(t.join("")),a=this.transactionManager.get();if(!a)throw new l("missing_transaction","Invalid state");if(this.transactionManager.remove(),r)throw new d(r,o||r,n,a.appState);if(!a.code_verifier||a.state&&a.state!==n)throw new l("state_mismatch","Invalid state");const s=a.organization,c=a.nonce,u=a.redirect_uri;return await this._requestToken(Object.assign({audience:a.audience,scope:a.scope,code_verifier:a.code_verifier,grant_type:"authorization_code",code:i},u?{redirect_uri:u}:{}),{nonceIn:c,organization:s}),{appState:a.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(e={}){var t;const n=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:I(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope)})}),i=await((e,t)=>{let n=F[t];return n||(n=e().finally((()=>{delete F[t],n=null})),F[t]=n),n})((()=>this._getTokenSilently(n)),`${this.options.clientId}::${n.authorizationParams.audience}::${n.authorizationParams.scope}`);return e.detailedResponse?i:null==i?void 0:i.access_token}async _getTokenSilently(t){const{cacheMode:n}=t,i=e(t,["cacheMode"]);if("off"!==n){const e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}if("cache-only"!==n){if(!await(async(e,t=3)=>{for(let n=0;nY.acquireLock("auth0.lock.getTokenSilently",5e3)),10))throw new h;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),"off"!==n){const e=await this._getEntryFromCache({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(i):await this._getTokenFromIFrame(i),{id_token:t,access_token:r,oauthTokenScope:o,expires_in:a}=e;return Object.assign(Object.assign({id_token:t,access_token:r},o?{scope:o}:null),{expires_in:a})}finally{await Y.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},t={}){var n;const i=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:I(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope)})});return t=Object.assign(Object.assign({},s),t),await this.loginWithPopup(i,t),(await this.cacheManager.get(new T({scope:i.authorizationParams.scope,audience:i.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(t){null!==t.clientId?t.clientId=t.clientId||this.options.clientId:delete t.clientId;const n=t.logoutParams||{},{federated:i}=n,r=e(n,["federated"]),o=i?"&federated":"";return this._url(`/v2/logout?${S(Object.assign({clientId:t.clientId},r))}`)+o}async logout(t={}){const n=G(t),{openUrl:i}=n,r=e(n,["openUrl"]);null===t.clientId?await this.cacheManager.clear():await this.cacheManager.clear(t.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const o=this._buildLogoutUrl(r);i?await i(o):!1!==i&&window.location.assign(o)}async _getTokenFromIFrame(e){const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:i,state:r,nonce:o,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new l("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const n=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,d=await((e,t,n=60)=>new Promise(((i,r)=>{const o=window.document.createElement("iframe");o.setAttribute("width","0"),o.setAttribute("height","0"),o.style.display="none";const a=()=>{window.document.body.contains(o)&&(window.document.body.removeChild(o),window.removeEventListener("message",s,!1))};let s;const c=setTimeout((()=>{r(new h),a()}),1e3*n);s=function(e){if(e.origin!=t)return;if(!e.data||"authorization_response"!==e.data.type)return;const n=e.source;n&&n.close(),e.data.response.error?r(l.fromPayload(e.data.response)):i(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(o),o.setAttribute("src",e)})))(i,this.domainUrl,n);if(r!==d.state)throw new l("state_mismatch","Invalid state");const f=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:d.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:o,organization:t.organization});return Object.assign(Object.assign({},f),{scope:c,oauthTokenScope:f.scope,audience:u})}catch(e){throw"login_required"===e.error&&this.logout({openUrl:!1}),e}}async _getTokenUsingRefreshToken(e){const t=await this.cacheManager.get(new T({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(t&&t.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new v(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const n=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null;try{const r=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:t&&t.refresh_token,redirect_uri:n}),i&&{timeout:i}));return Object.assign(Object.assign({},r),{scope:e.authorizationParams.scope,oauthTokenScope:r.scope,audience:e.authorizationParams.audience||"default"})}catch(t){if((t.message.indexOf("Missing Refresh Token")>-1||t.message&&t.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw t}}async _saveEntryInCache(t){const{id_token:n,decodedToken:i}=t,r=e(t,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:n,decodedToken:i}),await this.cacheManager.setIdToken(this.options.clientId,t.id_token,t.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",t=await this.cacheManager.getIdToken(new T({clientId:this.options.clientId,audience:e,scope:this.scope})),n=this.userCache.get("@@user@@");return t&&t.id_token===(null==n?void 0:n.id_token)?n:(this.userCache.set("@@user@@",t),t)}async _getEntryFromCache({scope:e,audience:t,clientId:n}){const i=await this.cacheManager.get(new T({scope:e,audience:t,clientId:n}),60);if(i&&i.access_token){const{access_token:e,oauthTokenScope:t,expires_in:n}=i,r=await this._getIdTokenFromCache();return r&&Object.assign(Object.assign({id_token:r.id_token,access_token:e},t?{scope:t}:null),{expires_in:n})}}async _requestToken(e,t){const{nonceIn:n,organization:i}=t||{},r=await O(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),o=await this._verifyIdToken(r.id_token,n,i);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},r),{decodedToken:o,scope:e.scope,audience:e.audience||"default"}),r.scope?{oauthTokenScope:r.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||o.claims.org_id),Object.assign(Object.assign({},r),{decodedToken:o})}}var K,$;!function(e){e.PROD="prod",e.SANDBOX="sandbox",e.VTEST="vtest",e.STEST="stest",e.PTEST="ptest",e.DEV="dev",e.PLAYPEN="playpen",e.LOCALHOST="localhost"}(K||(K={})),function(e){e.PROD="https://auspost.com.au",e.SANDBOX="https://ptest.npe.auspost.com.au",e.VTEST="https://vtest.npe.auspost.com.au",e.STEST="https://stest.npe.auspost.com.au",e.PTEST="https://ptest.npe.auspost.com.au",e.DEV="https://pdev.npe.auspost.com.au",e.PLAYPEN="https://ptest.npe.auspost.com.au",e.LOCALHOST="http://localhost:4000"}($||($={}));const q={[K.PROD]:$.PROD,[K.SANDBOX]:$.SANDBOX,[K.VTEST]:$.VTEST,[K.STEST]:$.STEST,[K.PTEST]:$.PTEST,[K.DEV]:$.DEV,[K.PLAYPEN]:$.PLAYPEN,[K.LOCALHOST]:$.LOCALHOST},Q="AUTH0",ee=["TRACK","CYCL","ONLINE_SHOP_AP","ONLINE_SHOP_ST","AEM_AUS_POST_WEBSITE","CONTEXTUAL_HELP"];const te=e=>function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}(void 0,void 0,void 0,(function*(){const t=document.createElement("iframe");t.style.display="none",t.src=e;const n=()=>document.body.contains(t)&&document.body.removeChild(t);return new Promise(((e,i)=>{t.onload=()=>{n(),e()},t.onerror=()=>{n(),i(new Error("Failed to load URL"))},document.body.appendChild(t)}))}));class ne{get nativeWindow(){const e=window;return e.__AUSPOST__=e.__AUSPOST__?e.__AUSPOST__:{},e}}var ie;class re extends Error{constructor(e,t){super(`${e.status}: ${e.statusText}`),this.url=e.url,this.message=`${e.status}: ${e.statusText}`,this.status=e.status,this.statusText=e.statusText,this.error=t,Object.setPrototypeOf(this,re.prototype)}static createHttpError(e){return function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const t=yield e.json().then((e=>e&&e instanceof Array?e[0]:e)).catch((()=>{}));return new re(e,t)}))}}!function(e){e.PROD="https://digitalapi.auspost.com.au",e.SANDBOX="https://digitalapi.auspost.com.au",e.VTEST="https://digitalapi-vtest.npe.auspost.com.au",e.STEST="https://digitalapi-stest.npe.auspost.com.au",e.PTEST="https://digitalapi-ptest.npe.auspost.com.au",e.DEV="https://digitalapi-ptest.npe.auspost.com.au",e.PLAYPEN="https://digitalapi-ptest.npe.auspost.com.au",e.LOCALHOST="http://localhost:4000"}(ie||(ie={}));const oe={[K.PROD]:ie.PROD,[K.SANDBOX]:ie.SANDBOX,[K.VTEST]:ie.VTEST,[K.STEST]:ie.STEST,[K.PTEST]:ie.PTEST,[K.DEV]:ie.DEV,[K.PLAYPEN]:ie.PLAYPEN,[K.LOCALHOST]:ie.LOCALHOST};var ae,se;!function(e){e.APP_JSON="application/json"}(ae||(ae={})),function(e){e.GET="GET",e.DELETE="DELETE"}(se||(se={}));const ce={"Content-Type":ae.APP_JSON,Accept:ae.APP_JSON,AP_APP_ID:"UIIM"};var ue,le;!function(e){e.PROD="welcome.auspost.com.au",e.SANDBOX="welcome.sandbox.auspost.com.au",e.VTEST="welcome.vtest.auspost.com.au",e.STEST="welcome.stest.auspost.com.au",e.PTEST="welcome.ptest.auspost.com.au",e.DEV="welcome.dev.auspost.com.au",e.PLAYPEN="welcome.playpen.auspost.com.au",e.LOCALHOST="localhost:8080"}(ue||(ue={})),function(e){e.NONE="none",e.CONSENT="consent",e.LOGIN="login",e.SELECT_ACCOUNT="select_account"}(le||(le={}));var de=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};class he extends J{constructor(e){super(e),this.auth0ClientOptions=e,this.windowRefService=new ne}createAuth0Client(){return de(this,void 0,void 0,(function*(){yield this._fetchMock("createAuth0Client")}))}isAuthenticated(){return de(this,void 0,void 0,(function*(){return this._fetchMock("isAuthenticated").then((e=>e.isAuthenticated))}))}getTokenSilently(){return de(this,arguments,void 0,(function*(e={}){return this._fetchMock("getTokenSilently").then((e=>e.accessToken))}))}loginWithRedirect(e){return de(this,void 0,void 0,(function*(){var t;yield this._fetchMock("loginWithRedirect"),(null===(t=null==e?void 0:e.authorizationParams)||void 0===t?void 0:t.prompt)!==le.LOGIN&&(yield this.isAuthenticated())||(this.windowRefService.nativeWindow.location.replace(`http://${this.auth0ClientOptions.domain}/auth0/login`),yield new Promise((e=>setTimeout(e,1e3))))}))}logout(e){return de(this,void 0,void 0,(function*(){var t;yield this._fetchMock("logout"),(null===(t=null==e?void 0:e.logoutParams)||void 0===t?void 0:t.returnTo)&&(this.windowRefService.nativeWindow.location.replace(e.logoutParams.returnTo),yield new Promise((e=>setTimeout(e,1e3))))}))}handleRedirectCallback(e){return de(this,void 0,void 0,(function*(){return yield this._fetchMock("handleRedirectCallback")}))}getUser(){return de(this,void 0,void 0,(function*(){return this._fetchMock("getUser").then((e=>e.user))}))}getIdTokenClaims(){return de(this,void 0,void 0,(function*(){return this._fetchMock("getIdTokenClaims").then((e=>e.claims))}))}_fetchMock(e){return de(this,void 0,void 0,(function*(){const t=yield fetch(`http://${this.auth0ClientOptions.domain}/auth0/${e}`,{method:se.GET});if(!t.ok)throw yield re.createHttpError(t);return t.json().catch((()=>({})))}))}}var fe=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};class pe{get auth0Client(){if(!this._auth0Client)throw new Error("auth0Client not defined");return this._auth0Client}set auth0Client(e){this._auth0Client=e}initialise(e){return fe(this,arguments,void 0,(function*(e,t=!1){try{!t&&e.domain.startsWith(K.LOCALHOST)?(console.info("running in LOCALHOST with MOCK"),this.auth0Client=new he(e),yield this.auth0Client.createAuth0Client()):this.auth0Client=yield async function(e){const t=new J(e);return await t.checkSession(),t}(Object.assign(Object.assign({},e),{useRefreshTokens:!0,useRefreshTokensFallback:!0,useCookiesForTransactions:!0}))}catch(e){throw console.warn("Error when initialising Auth0 Client",e.message),e}}))}isAuthenticated(){return this.auth0Client.isAuthenticated()}getAccessTokenSilently(e){return this.auth0Client.getTokenSilently(e)}login(e){return fe(this,void 0,void 0,(function*(){return yield this.auth0Client.loginWithRedirect(e),new Promise((e=>setTimeout(e,1e3)))}))}logout(e,t,n){return fe(this,void 0,void 0,(function*(){const i=t?{openUrl:te,logoutParams:{returnTo:e}}:{logoutParams:{returnTo:e}};(n||null===n)&&(i.clientId=n),yield this.auth0Client.logout(i)}))}handleRedirectCallback(){return fe(this,void 0,void 0,(function*(){yield this.auth0Client.handleRedirectCallback()}))}getUser(){return fe(this,void 0,void 0,(function*(){return yield this.auth0Client.getUser()}))}getIdTokenClaims(){return fe(this,void 0,void 0,(function*(){return this.auth0Client.getIdTokenClaims()}))}}var me=function(){return me=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]=r+n?(r=a,[4,be(0)]):[3,3]):[3,4];case 2:s.sent(),s.label=3;case 3:return++o,[3,1];case 4:return[2,i]}}))}))}function Ce(e){e.then(void 0,(function(){}))}function Oe(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]+t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]+t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]+t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]+t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function Ie(e,t){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]];var n=[0,0,0,0];return n[3]+=e[3]*t[3],n[2]+=n[3]>>>16,n[3]&=65535,n[2]+=e[2]*t[3],n[1]+=n[2]>>>16,n[2]&=65535,n[2]+=e[3]*t[2],n[1]+=n[2]>>>16,n[2]&=65535,n[1]+=e[1]*t[3],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[2]*t[2],n[0]+=n[1]>>>16,n[1]&=65535,n[1]+=e[3]*t[1],n[0]+=n[1]>>>16,n[1]&=65535,n[0]+=e[0]*t[3]+e[1]*t[2]+e[2]*t[1]+e[3]*t[0],n[0]&=65535,[n[0]<<16|n[1],n[2]<<16|n[3]]}function Te(e,t){return 32==(t%=64)?[e[1],e[0]]:t<32?[e[0]<>>32-t,e[1]<>>32-t]:(t-=32,[e[1]<>>32-t,e[0]<>>32-t])}function xe(e,t){return 0==(t%=64)?e:t<32?[e[0]<>>32-t,e[1]<>>1]),e=je(e=Ie(e,[4283543511,3981806797]),[0,e[0]>>>1]),je(e=Ie(e,[3301882366,444984403]),[0,e[0]>>>1])}function Ae(e){return parseInt(e)}function Ee(e){return parseFloat(e)}function Pe(e,t){return"number"==typeof e&&isNaN(e)?t:e}function We(e){return e.reduce((function(e,t){return e+(t?1:0)}),0)}function Re(e,t){if(void 0===t&&(t=1),Math.abs(t)>=1)return Math.round(e/t)*t;var n=1/t;return Math.round(e*n)/n}function ze(e){return e&&"object"==typeof e&&"message"in e?e:{message:e}}function Ze(e,t,n){var i=Object.keys(e).filter((function(e){return!function(e,t){for(var n=0,i=e.length;n=4}function De(){var e=window,t=navigator;return We(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,0===t.vendor.indexOf("Google"),"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function Ue(){var e=window,t=navigator;return We(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,0===t.vendor.indexOf("Apple"),"getStorageUpdates"in t,"WebKitMediaKeys"in e])>=4}function Me(){var e=window;return We(["safari"in e,!("DeviceMotionEvent"in e),!("ongestureend"in e),!("standalone"in navigator)])>=3}function Ne(){var e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Fe(){var e=De(),t=function(){var e,t,n=window;return We(["buildID"in navigator,"MozAppearance"in(null!==(t=null===(e=document.documentElement)||void 0===e?void 0:e.style)&&void 0!==t?t:{}),"onmozfullscreenchange"in n,"mozInnerScreenX"in n,"CSSMozDocumentRule"in n,"CanvasCaptureMediaStream"in n])>=4}();if(!e&&!t)return!1;var n=window;return We(["onorientationchange"in n,"orientation"in n,e&&!("SharedWorker"in n),t&&/android/i.test(navigator.appVersion)])>=2}function Xe(e){var t=new Error(e);return t.name=e,t}function He(e,t,n){var i,r,o;return void 0===n&&(n=50),ve(this,void 0,void 0,(function(){var a,s;return ge(this,(function(c){switch(c.label){case 0:a=document,c.label=1;case 1:return a.body?[3,3]:[4,be(n)];case 2:return c.sent(),[3,1];case 3:s=a.createElement("iframe"),c.label=4;case 4:return c.trys.push([4,,10,11]),[4,new Promise((function(e,n){var i=!1,r=function(){i=!0,e()};s.onload=r,s.onerror=function(e){i=!0,n(e)};var o=s.style;o.setProperty("display","block","important"),o.position="absolute",o.top="0",o.left="0",o.visibility="hidden",t&&"srcdoc"in s?s.srcdoc=t:s.src="about:blank",a.body.appendChild(s);var c=function(){var e,t;i||("complete"===(null===(t=null===(e=s.contentWindow)||void 0===e?void 0:e.document)||void 0===t?void 0:t.readyState)?r():setTimeout(c,10))};c()}))];case 5:c.sent(),c.label=6;case 6:return(null===(r=null===(i=s.contentWindow)||void 0===i?void 0:i.document)||void 0===r?void 0:r.body)?[3,8]:[4,be(n)];case 7:return c.sent(),[3,6];case 8:return[4,e(s,s.contentWindow)];case 9:return[2,c.sent()];case 10:return null===(o=s.parentNode)||void 0===o||o.removeChild(s),[7];case 11:return[2]}}))}))}function Be(e){for(var t=function(e){for(var t,n,i="Unexpected syntax '".concat(e,"'"),r=/^\s*([a-z-]*)(.*)$/i.exec(e),o=r[1]||void 0,a={},s=/([.:#][\w-]+|\[.+?\])/gi,c=function(e,t){a[e]=a[e]||[],a[e].push(t)};;){var u=s.exec(r[2]);if(!u)break;var l=u[0];switch(l[0]){case".":c("class",l.slice(1));break;case"#":c("id",l.slice(1));break;case"[":var d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(l);if(!d)throw new Error(i);c(d[1],null!==(n=null!==(t=d[4])&&void 0!==t?t:d[5])&&void 0!==n?n:"");break;default:throw new Error(i)}}return[o,a]}(e),n=t[0],i=t[1],r=document.createElement(null!=n?n:"div"),o=0,a=Object.keys(i);o.6*n.length}))).sort(),[2,r]}var s}))}))},fontPreferences:function(){return void 0===e&&(e=4e3),He((function(t,n){var i=n.document,r=i.body,o=r.style;o.width="".concat(e,"px"),o.webkitTextSizeAdjust=o.textSizeAdjust="none",De()?r.style.zoom="".concat(1/n.devicePixelRatio):Ue()&&(r.style.zoom="reset");var a=i.createElement("div");return a.textContent=ye([],Array(e/20|0),!0).map((function(){return"word"})).join(" "),r.appendChild(a),function(e,t){for(var n={},i={},r=0,o=Object.keys(lt);r');var e},audio:function(){var e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Ue()&&!Me()&&!function(){var e=window;return We(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}())return-1;var n=new t(1,5e3,44100),i=n.createOscillator();i.type="triangle",i.frequency.value=1e4;var r=n.createDynamicsCompressor();r.threshold.value=-50,r.knee.value=40,r.ratio.value=12,r.attack.value=0,r.release.value=.25,i.connect(r),r.connect(n.destination),i.start(0);var o=function(e){var t=function(){};return[new Promise((function(n,i){var r=!1,o=0,a=0;e.oncomplete=function(e){return n(e.renderedBuffer)};var s=function(){setTimeout((function(){return i(Xe("timeout"))}),Math.min(500,a+5e3-Date.now()))},c=function(){try{var t=e.startRendering();switch(Se(t)&&Ce(t),e.state){case"running":a=Date.now(),r&&s();break;case"suspended":document.hidden||o++,r&&o>=3?i(Xe("suspended")):setTimeout(c,500)}}catch(e){i(e)}};c(),t=function(){r||(r=!0,a>0&&s())}})),t]}(n),a=o[0],s=o[1],c=a.then((function(e){return function(e){for(var t=0,n=0;n=3}()||t.push(e.languages);else if("string"==typeof e.languages){var i=e.languages;i&&t.push(i.split(","))}return t},colorDepth:function(){return window.screen.colorDepth},deviceMemory:function(){return Pe(Ee(navigator.deviceMemory),void 0)},screenResolution:function(){var e=screen,t=function(e){return Pe(Ae(e),null)},n=[t(e.width),t(e.height)];return n.sort().reverse(),n},hardwareConcurrency:function(){return Pe(Ae(navigator.hardwareConcurrency),void 0)},timezone:function(){var e,t=null===(e=window.Intl)||void 0===e?void 0:e.DateTimeFormat;if(t){var n=(new t).resolvedOptions().timeZone;if(n)return n}var i,r=(i=(new Date).getFullYear(),-Math.max(Ee(new Date(i,0,1).getTimezoneOffset()),Ee(new Date(i,6,1).getTimezoneOffset())));return"UTC".concat(r>=0?"+":"").concat(Math.abs(r))},sessionStorage:function(){try{return!!window.sessionStorage}catch(e){return!0}},localStorage:function(){try{return!!window.localStorage}catch(e){return!0}},indexedDB:function(){if(!Ve()&&!function(){var e=window,t=navigator;return We(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!Ve()}())try{return!!window.indexedDB}catch(e){return!0}},openDatabase:function(){return!!window.openDatabase},cpuClass:function(){return navigator.cpuClass},platform:function(){var e=navigator.platform;return"MacIntel"===e&&Ue()&&!Me()?function(){if("iPad"===navigator.platform)return!0;var e=screen,t=e.width/e.height;return We(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}()?"iPad":"iPhone":e},plugins:function(){var e=navigator.plugins;if(e){for(var t=[],n=0;n>>0).toString(16)).slice(-8)+("00000000"+(o[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}(function(e){for(var t="",n=0,i=Object.keys(e).sort();n=.001))try{var e=new XMLHttpRequest;e.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(we,"/npm-monitoring"),!0),e.send()}catch(e){console.error(e)}}(),[4,pt(n)];case 1:return e.sent(),[2,mt(Ze(dt,{debug:i},[]),i)]}}))}))},hashComponents:ft,componentsToDebugString:ht},gt=n(955),yt=n.n(gt),wt=n(178),bt=n.n(wt),St=n(972),_t=n.n(St);const kt="appState";class Ct{initialise(){return function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){const e=yield vt.load(),t=yield e.get();_t().config.encrypt=!0,_t().config.secret=t.visitorId,_t().config.encrypter=(e,t)=>yt().encrypt(JSON.stringify(e),t).toString(),_t().config.decrypter=(e,t)=>JSON.parse(yt().decrypt(e,t).toString(bt()))}))}setAppState(e){e&&Object.keys(e).length>0?_t().set(kt,e,{ttl:3600}):this.removeAppState()}getAppState(){return _t().get(kt)||{}}removeAppState(){_t().remove(kt)}}class Ot{constructor(e){this.serviceFactory=e,this.auth0SdkService=e.getService(pe.name),this.windowRefService=e.getService(ne.name)}reauthenticate(e){return function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}(this,void 0,void 0,(function*(){if(null==e?void 0:e.stepUpOnReauth){const t=window.btoa(JSON.stringify(e)),n=encodeURIComponent(t);return this.windowRefService.nativeWindow.location.replace(`${q[e.env]}/customersetup/session/reauth?config=${n}`),Promise.resolve()}yield this.auth0SdkService.login({authorizationParams:Object.assign(Object.assign(Object.assign({max_age:0,prompt:"login"},!(!e||!e.caller)&&{"ext-caller":e.caller}),!(!e||!e.channel)&&{"ext-channel":e.channel}),!(!e||!e.product)&&{"ext-product":e.product})})}))}}const It=[/^https:\/\/(?:[^/]+?\.)?auspost(?:\.com\.au)?(?:\/?|\/.*)$/],Tt=/^(?:http(s)?:\/\/(?:www\.)?|www\.)[a-z0-9]+(?:[-.][a-z0-9]+)*\.[a-z]{2,5}(?::[0-9]{1,5})?(?:\/\S*)?$/,xt=/^http(s)?:\/\/localhost:[0-9]{4,5}(?:.*\/\S*)?$/,jt=/^localhost:[0-9]{4,5}(?:.*\/\S*)?$/,Lt=["<",">","%3e","%3c","javascript"],At=/^[a-zA-Z0-9_-]*$/;class Et{validateAuthWebConfig(e){this._validateClientId(e.clientId),this._validateEnv(e.env),this._validateRedirectUrl(e.redirectUrl,"authWebConfig.redirectUrl"),e.caller&&this._validateReportingProperty(e.caller,"authWebConfig.caller"),e.channel&&this._validateReportingProperty(e.channel,"authWebConfig.channel"),e.product&&this._validateReportingProperty(e.product,"authWebConfig.product"),e.audience&&this._validateInvalidChars(e.audience,"authWebConfig.audience"),e.scope&&this._validateInvalidChars(e.scope,"authWebConfig.scope"),e.stubDomain&&this._validateStubDomain(e.stubDomain),e.stubApiBaseUrl&&this._validateStubApiBaseUrl(e.stubApiBaseUrl)}validateLoginConfig(e){e.audience&&this._validateInvalidChars(e.audience,"loginConfig.audience"),e.scope&&this._validateInvalidChars(e.scope,"loginConfig.scope"),e.emailAddress&&this._validateInvalidChars(e.emailAddress,"loginConfig.emailAddress"),e.redirectUrl&&this._validateRedirectUrl(e.redirectUrl,"loginConfig.redirectUrl"),e.appState&&this._validateAppState(e.appState)}validateLogoutUrl(e){this._validateInvalidChars(e,"logoutUrl"),!this._isLocalhostUrl(e)&&this._validateUrlRegex(e,"logoutUrl")}validateGetTokenConfig(e){e.audience&&this._validateInvalidChars(e.audience,"getTokenConfig.audience"),e.scope&&this._validateInvalidChars(e.scope,"getTokenConfig.scope")}validateTargetUrl(e){this._validateUrl(e,"appState.targetUrl",!0)}_validateUrl(e,t,n=!1){this._isLocalhostUrl(e)||(this._validateUrlRegex(e,t),n&&this._validateUrlWhitelist(e,t)),this._validateTextLength(e,500,t),this._validateInvalidChars(e,t)}_validateClientId(e){if(!e)throw new Error("authWebConfig.clientId is required");this._validateLetterDigitsDashUnderScore(e,"authWebConfig.clientId")}_validateEnv(e){if(!e)throw new Error("authWebConfig.env is required");if(t=e,!(null===(n=Object.entries(K).find((([e,n])=>n===t)))||void 0===n?void 0:n[0]))throw new Error("authWebConfig.env is invalid");var t,n}_validateRedirectUrl(e,t){if(!e)throw new Error(`${t} is required`);this._validateInvalidChars(e,t),!this._isLocalhostUrl(e)&&this._validateUrlRegex(e,t)}_validateStubDomain(e){if(!jt.test(e))throw new Error("authWebConfig.stubDomain is invalid")}_validateStubApiBaseUrl(e){if(!this._isLocalhostUrl(e))throw new Error("authWebConfig.stubApiBaseUrl is invalid");this._validateInvalidChars(e,"authWebConfig.stubApiBaseUrl")}_validateAppState(e){e.caller&&this._validateReportingProperty(e.caller,"loginConfig.appState.caller"),e.channel&&this._validateReportingProperty(e.channel,"loginConfig.appState.channel"),e.product&&this._validateReportingProperty(e.product,"loginConfig.appState.product"),e.signupUrl&&this._validateUrl(e.signupUrl,"loginConfig.appState.signupUrl",!0),e.targetUrl&&this.validateTargetUrl(e.targetUrl)}_validateReportingProperty(e,t){this._validateTextLength(e,30,t),this._validateLetterDigitsDashUnderScore(e,t)}_validateUrlRegex(e,t){if(!Tt.test(e))throw new Error(`${t} is invalid`)}_validateUrlWhitelist(e,t){if(!It.some((t=>t.test(e))))throw new Error(`${t} domain not whitelisted`)}_validateInvalidChars(e,t){if(Lt.some((t=>e.toLowerCase().includes(t))))throw new Error(`${t} is invalid`)}_validateLetterDigitsDashUnderScore(e,t){if(!At.test(e))throw new Error(`${t} is invalid`)}_validateTextLength(e,t,n){if(e.length>t)throw new Error(`${n} length limit exceeded`)}_isLocalhostUrl(e){return xt.test(e)}}const Pt="login_required",Wt="reauth-required",Rt="invalid_grant";class zt extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,zt.prototype)}static createLoginRequiredError(){return new zt(Pt,"Login required")}static createReauthRequiredError(){return new zt(Wt,"Reauth required")}static createInvalidGrantError(){return new zt(Rt,"Invalid refresh token.")}isLoginRequiredError(){return this.error===Pt}isReauthRequiredError(){return this.error===Wt}isInvalidGrantError(){return this.error===Rt}}var Zt=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};class Vt{constructor(e){this.serviceFactory=e,this.auth0SdkService=e.getService(pe.name),this.localStorageService=e.getService(Ct.name),this.validatorService=e.getService(Et.name),this.windowRefService=e.getService(ne.name),this.reauthService=e.getService(Ot.name)}handleRedirectIfNeeded(e){return Zt(this,arguments,void 0,(function*(e,t=!0){let n={};const i={authorizationParams:Object.assign(Object.assign(Object.assign({max_age:0,prompt:"login"},!(!e||!e.caller)&&{"ext-caller":e.caller}),!(!e||!e.channel)&&{"ext-channel":e.channel}),!(!e||!e.product)&&{"ext-product":e.product})},[r,o]=this.windowRefService.nativeWindow.location.href.split("?");if(!o)return{appState:n};if(o.includes("error=")&&o.includes("error_description=")){const n=new URLSearchParams(o),r=n.get("error"),a=n.get("error_description");if(!t)throw new zt(r,a);if("reauth-required"===a)console.log("Auth0: reauth required error"),yield this.reauthService.reauthenticate(e);else if("invalid_grant"===r)console.log("Auth0: invalid refresh token error"),yield this.auth0SdkService.login(i);else if("stepup-error"===a)console.log("Auth0: error on reauth step up page. Skipping."),yield this.auth0SdkService.login(i);else{const e=`${this.windowRefService.nativeWindow.location.origin}/autherror?error=${r}`;this.windowRefService.nativeWindow.location.replace(e)}}return o.includes("code=")&&o.includes("state=")&&(yield this._parseAuth0Result(r),n=this.localStorageService.getAppState(),this.localStorageService.removeAppState(),yield this._redirectToTargetIfDefined(n)),{appState:n}}))}_parseAuth0Result(e){return Zt(this,void 0,void 0,(function*(){try{yield this.auth0SdkService.handleRedirectCallback()}catch(e){console.warn("Error when parsing redirect from Auth0:",e.message)}this.windowRefService.nativeWindow.history.replaceState({},document.title,e)}))}_redirectToTargetIfDefined(e){return Zt(this,void 0,void 0,(function*(){const{targetUrl:t}=e;t&&this.validatorService.validateTargetUrl(t),t&&!e.skipUrlReload&&this.windowRefService.nativeWindow.location.href!==t&&(this.windowRefService.nativeWindow.location.replace(t),yield new Promise((e=>setTimeout(e,2e3))))}))}}var Dt=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};class Ut{initialise(e,t){this.apiBaseUrl=t||oe[e]}get(e){return Dt(this,arguments,void 0,(function*(e,t={}){const n=this._buildHttpOptions(t);return yield this.fetch(`${this.apiBaseUrl}${e}`,n)}))}delete(e){return Dt(this,void 0,void 0,(function*(){const t=this._buildHttpOptions(void 0,se.DELETE);yield this.fetch(`${this.apiBaseUrl}${e}`,t)}))}_buildHttpOptions(e={},t=se.GET,n){return{method:t,headers:new Headers(Object.assign(Object.assign({},ce),e)),credentials:"include",body:n?JSON.stringify(n):void 0}}fetch(e,t){return Dt(this,void 0,void 0,(function*(){const n=yield fetch(e,t);if(!n.ok)throw yield re.createHttpError(n);return n.json().catch((()=>({})))}))}}const Mt="https://auspost/apcn",Nt="https://auspost/cnumber",Ft={[K.PROD]:ue.PROD,[K.SANDBOX]:ue.SANDBOX,[K.VTEST]:ue.VTEST,[K.STEST]:ue.STEST,[K.PTEST]:ue.PTEST,[K.DEV]:ue.DEV,[K.PLAYPEN]:ue.PLAYPEN,[K.LOCALHOST]:ue.LOCALHOST};class Xt{transformAuthWebConfig(e){const t=e.stubDomain?e.stubDomain:Ft[e.env],{clientId:n,audience:i,redirectUrl:r,scope:o,useLocalStorage:a,maxAge:s,screenHint:c}=e;return Object.assign(Object.assign({clientId:n,domain:t,authorizationParams:Object.assign(Object.assign(Object.assign(Object.assign({redirect_uri:r},!!i&&{audience:i}),!!o&&{scope:`${o} email profile`}),!!s&&{max_age:s}),!!c&&{screen_hint:c})},e.env===K.LOCALHOST&&{authorizeTimeoutInSeconds:1,httpTimeoutInSeconds:1}),a&&{cacheLocation:"localstorage"})}transformAppState(e,t){const{caller:n,channel:i,product:r,skipUrlReload:o,signupUrl:a,targetUrl:s,maxAge:c}=e.appState||{},u=e.redirectUrl||t.redirectUrl,l=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},!!n&&{caller:n}||!!t.caller&&{caller:t.caller}),!!i&&{channel:i}||!!t.channel&&{channel:t.channel}),!!r&&{product:r}||!!t.product&&{product:t.product}),!!a&&{signupUrl:a}),!!s&&{targetUrl:s}),!!o&&{skipUrlReload:o}),!!u&&{_redirectUrl:u}),!!c&&{maxAge:c}||!!t.maxAge&&{max_age:t.maxAge});return Object.keys(l).length>0?l:void 0}transformLoginConfig(e){const t=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},!!e.audience&&{audience:e.audience}),!!e.scope&&{scope:e.scope}),!!e.redirectUrl&&{redirect_uri:e.redirectUrl}),!!e.emailAddress&&{login_hint:e.emailAddress}),!!e.forceLogin&&{prompt:le.LOGIN,max_age:0}),!!e.maxAge&&{max_age:e.maxAge}),!!e.screenHint&&{screen_hint:e.screenHint}),!!e.prompt&&{prompt:le.LOGIN}),!!e.caller&&{"ext-caller":e.caller}),!!e.channel&&{"ext-channel":e.channel}),!!e.product&&{"ext-product":e.product}),this._transformUlpCustomQueryParam(e)),n=Object.assign({},Object.keys(t).length>0&&{authorizationParams:t});return Object.keys(n).length>0?n:void 0}transformLogoutConfig(e,t=!1){let n={};return"string"==typeof e||void 0===e?(console.warn("!!! WARNING: this method of calling logout with the [url], [skipRedirect] parameters is considered legacy and will be removed in future UIIM versions. Please refer to the UIIM docs and make the necessary to changes your application !!!"),n=Object.assign(Object.assign({logoutType:Q},e&&{url:e}),{skipRedirect:t})):e&&(n=Object.assign(Object.assign(Object.assign(Object.assign({},e.logoutType?{logoutType:e.logoutType}:{logoutType:Q}),e.url&&{url:e.url}),{skipRedirect:e.skipRedirect||!1}),(e.clientId||null===e.clientId)&&{clientId:e.clientId}),(e.clientId||null===e.clientId)&&(n.clientId=e.clientId)),n}transformGetTokenConfig(e){if(e){const t=Object.assign(Object.assign({},!!e.audience&&{audience:e.audience}),!!e.scope&&{scope:e.scope}),n=Object.assign(Object.assign({},Object.keys(t).length>0&&{authorizationParams:t}),!!e.cacheMode&&{cacheMode:e.cacheMode});return Object.keys(n).length>0?n:void 0}}transformIdToken(e){if(e)return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({__raw:e.__raw},!!e.updated_at&&{updated_at:e.updated_at}),!!e.iss&&{iss:e.iss}),!!e.aud&&{aud:e.aud}),!!e.iat&&{iat:e.iat}),!!e.sub&&{sub:e.sub}),!!e.exp&&{exp:e.exp}),!!e.auth_time&&{auth_time:e.auth_time}),!!e.sid&&{sid:e.sid}),!!e.nonce&&{nonce:e.nonce})}transformUser(e){if(e)return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({email:e.email},!!e.email_verified&&{emailVerified:e.email_verified}),!!e.family_name&&{surname:e.family_name}),!!e.given_name&&{firstName:e.given_name}),!!e[Mt]&&{apcn:e[Mt]}),!!e[Nt]&&{cNumber:e[Nt]})}transformAuth0Error(e){return e instanceof l&&"login_required"===e.error?zt.createLoginRequiredError():e instanceof l&&"reauth-required"===e.message?zt.createReauthRequiredError():e instanceof l&&"invalid_grant"===e.message?zt.createInvalidGrantError():e}_transformUlpCustomQueryParam(e){const t=e.appState||{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},!!e.hideSignup&&{"ext-hide_signup":"true"}),!!e.emailAlreadyRegistered&&{"ext-email_already_registered":"true"}),!!t.caller&&{"ext-caller":t.caller}),!!t.channel&&{"ext-channel":t.channel}),!!t.product&&{"ext-product":t.product})}}var Ht=function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))};class Bt{constructor(e){this.serviceFactory=e,this.auth0SdkService=e.getService(pe.name),this.auth0CallbackService=e.getService(Vt.name),this.httpService=e.getService(Ut.name),this.localStorageService=e.getService(Ct.name),this.optionsTransformerService=e.getService(Xt.name),this.validatorService=e.getService(Et.name),this.reauthService=e.getService(Ot.name),this.windowRefService=e.getService(ne.name)}initialise(e){return Ht(this,void 0,void 0,(function*(){void 0===e.redirectOnAnonymous&&(e.redirectOnAnonymous=!0),this.authWebConfig=e,this.validatorService.validateAuthWebConfig(e),this.httpService.initialise(e.env,e.stubApiBaseUrl),yield this.localStorageService.initialise(),yield this.auth0SdkService.initialise(this.optionsTransformerService.transformAuthWebConfig(e),e.skipAuth0SdkMock),this.authWebConfig.verifyAuthenticationOnFocus&&this._verifyAuthenticationOnFocus();const t=this._isRedirectRequired(e),n=yield this.auth0CallbackService.handleRedirectIfNeeded(e,t);return n.loginRequired&&(yield this.login(Object.assign(Object.assign(Object.assign({audience:e.audience,maxAge:0,prompt:"login",appState:n.appState},!(!e||!e.caller)&&{caller:e.caller}),!(!e||!e.channel)&&{channel:e.channel}),!(!e||!e.product)&&{product:e.product}))),n.appState}))}login(){return Ht(this,arguments,void 0,(function*(e={}){this.validatorService.validateLoginConfig(e),e.appState=this.optionsTransformerService.transformAppState(e,this.authWebConfig),this.localStorageService.setAppState(e.appState),yield this.auth0SdkService.login(this.optionsTransformerService.transformLoginConfig(e)).catch((e=>Ht(this,void 0,void 0,(function*(){const t=this.optionsTransformerService.transformAuth0Error(e),n={authorizationParams:Object.assign(Object.assign(Object.assign({max_age:0,prompt:"login"},!(!this.authWebConfig||!this.authWebConfig.caller)&&{"ext-caller":this.authWebConfig.caller}),!(!this.authWebConfig||!this.authWebConfig.channel)&&{"ext-channel":this.authWebConfig.channel}),!(!this.authWebConfig||!this.authWebConfig.product)&&{"ext-product":this.authWebConfig.product})};t instanceof zt&&t.isLoginRequiredError()?yield this._handleLogin(n):t instanceof zt&&t.isReauthRequiredError()&&(yield this.reauthService.reauthenticate(this.authWebConfig))}))))}))}logout(e,t){return Ht(this,void 0,void 0,(function*(){const n=this.optionsTransformerService.transformLogoutConfig(e,null!=t&&t);Object.keys(localStorage).filter((e=>e.includes("@@auth0spajs@@"))).forEach((e=>{localStorage.removeItem(e)})),(()=>{const e=document.cookie.split("; ").reduce(((e,t)=>{const[n,...i]=t.split("=");return e[n]=i.join("="),e}),{});Object.keys(e).filter((e=>e.includes("auth0"))).forEach((e=>{document.cookie=`${e}=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;`}))})(),"OIDC"===n.logoutType&&(yield this._logoutOidc(n.url)),n.logoutType===Q&&(yield this._logoutAuth0(n.url,n.skipRedirect,n.clientId))}))}_logoutAuth0(e,t,n){return Ht(this,void 0,void 0,(function*(){e&&this.validatorService.validateLogoutUrl(e),yield this.auth0SdkService.logout(e||void 0,t,n)}))}_logoutOidc(e){return Ht(this,void 0,void 0,(function*(){e&&this.validatorService.validateLogoutUrl(e);const t=this.optionsTransformerService.transformAuthWebConfig(this.authWebConfig),n=yield this.getIdToken().then((n=>{const i=Object.assign(Object.assign({client_id:t.clientId},!!n&&{id_token_hint:n.__raw}),e?{post_logout_redirect_uri:e}:{post_logout_redirect_uri:`${q[this.authWebConfig.env]}`});return((e,t)=>{const n=new URL(e);for(const[e,i]of Object.entries(t))n.searchParams.append(e,i);return n.href})(`https://${t.domain}/oidc/logout`,i)}));this.windowRefService.nativeWindow.location.assign(n)}))}signup(){return Ht(this,void 0,void 0,(function*(){yield this.login({screenHint:"signup"})}))}isAuthenticated(){return Ht(this,arguments,void 0,(function*(e=!1){return(yield this._isAuth0SessionValid(e))||!1}))}getAccessTokenSilently(e){return Ht(this,void 0,void 0,(function*(){return e&&this.validatorService.validateGetTokenConfig(e),(yield this.auth0SdkService.getAccessTokenSilently(this.optionsTransformerService.transformGetTokenConfig(e)).catch((e=>Ht(this,void 0,void 0,(function*(){var t;const n=this.optionsTransformerService.transformAuth0Error(e);if(this._isRedirectRequired(this.authWebConfig)){if(n instanceof zt&&(n.isReauthRequiredError()||n.isInvalidGrantError())){if(null===(t=this.authWebConfig)||void 0===t?void 0:t.preserveAppStateOnLogin){const e=this.localStorageService.getAppState()||{};e.targetUrl||(e.targetUrl=this.windowRefService.nativeWindow.location.href),this.localStorageService.setAppState(e)}return yield this.reauthService.reauthenticate(this.authWebConfig)}return n instanceof zt&&n.isLoginRequiredError(),this._handleGetTokenError(e)}throw n})))))||""}))}getIdToken(){return Ht(this,void 0,void 0,(function*(){return this.optionsTransformerService.transformIdToken(yield this.auth0SdkService.getIdTokenClaims())}))}getUser(){return Ht(this,void 0,void 0,(function*(){const e=yield this.auth0SdkService.getUser();if(e)return this.optionsTransformerService.transformUser(e);if(!(yield this.auth0SdkService.isAuthenticated()))throw zt.createLoginRequiredError()}))}getAppState(e=!1){const t=this.localStorageService.getAppState();return e&&this.localStorageService.removeAppState(),t}_isAuth0SessionValid(e){return Ht(this,void 0,void 0,(function*(){return(yield this.auth0SdkService.isAuthenticated())||!!(yield this.auth0SdkService.getAccessTokenSilently().catch((t=>Ht(this,void 0,void 0,(function*(){if(e)return!1;const n=this.optionsTransformerService.transformAuth0Error(t),i=this._isRedirectRequired(this.authWebConfig),r={authorizationParams:Object.assign(Object.assign(Object.assign({max_age:0,prompt:"login"},!(!this.authWebConfig||!this.authWebConfig.caller)&&{"ext-caller":this.authWebConfig.caller}),!(!this.authWebConfig||!this.authWebConfig.channel)&&{"ext-channel":this.authWebConfig.channel}),!(!this.authWebConfig||!this.authWebConfig.product)&&{"ext-product":this.authWebConfig.product})};return!!(i&&n instanceof zt)&&(n.isReauthRequiredError()?yield this.reauthService.reauthenticate(this.authWebConfig):(n.isLoginRequiredError()||n.isInvalidGrantError())&&(yield this.auth0SdkService.login(r)),!1)})))))}))}_handleGetTokenError(e){throw this.optionsTransformerService.transformAuth0Error(e)}_verifyAuthenticationOnFocus(){window.addEventListener("focus",(()=>{document.hidden||(()=>{Ht(this,void 0,void 0,(function*(){yield this.auth0SdkService.initialise(this.optionsTransformerService.transformAuthWebConfig(this.authWebConfig));const e={authorizationParams:Object.assign(Object.assign(Object.assign({max_age:0,prompt:"login"},!(!this.authWebConfig||!this.authWebConfig.caller)&&{"ext-caller":this.authWebConfig.caller}),!(!this.authWebConfig||!this.authWebConfig.channel)&&{"ext-channel":this.authWebConfig.channel}),!(!this.authWebConfig||!this.authWebConfig.product)&&{"ext-product":this.authWebConfig.product})};!(yield this.auth0SdkService.isAuthenticated())&&(yield this._handleLogin(e))}))})()}))}_isRedirectRequired(e){return!(ee.includes(e.caller)||!e.redirectOnAnonymous)}_handleLogin(e){return Ht(this,void 0,void 0,(function*(){var t;(null===(t=this.authWebConfig)||void 0===t?void 0:t.preserveAppStateOnLogin)?yield this._loginWithAppStatePreservation(e):yield this.auth0SdkService.login(e)}))}_loginWithAppStatePreservation(e){return Ht(this,void 0,void 0,(function*(){const t=this.localStorageService.getAppState()||{};t.targetUrl||(t.targetUrl=this.windowRefService.nativeWindow.location.href),e.appState||(e.appState=t),this.localStorageService.setAppState(e.appState),yield this.auth0SdkService.login(e)}))}}class Gt{getService(e){switch(e){case Bt.name:return this.authWebService||(this.authWebService=new Bt(this));case Vt.name:return this.auth0CallbackService||(this.auth0CallbackService=new Vt(this));case pe.name:return this.auth0SdkService||(this.auth0SdkService=new pe);case Ut.name:return this.httpService||(this.httpService=new Ut);case Ct.name:return this.localStorageService||(this.localStorageService=new Ct);case Xt.name:return this.optionsTransformerService||(this.optionsTransformerService=new Xt);case Et.name:return this.validatorService||(this.validatorService=new Et);case ne.name:return this.windowRefService||(this.windowRefService=new ne);case Ot.name:return this.reauthService||(this.reauthService=new Ot(this))}}}(new class{constructor(){this.windowRefService=new ne}initialise(){this.windowRefService.nativeWindow.__AUSPOST__.createAuthWebService=()=>(new Gt).getService(Bt.name)}}).initialise()})()})();