/*! For license information please see mng-digisubs.main.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){H(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function H(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function K(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=W(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=W(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(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},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>Gs,hasStandardBrowserEnv:()=>Hs,hasStandardBrowserWebWorkerEnv:()=>Ks,navigator:()=>Ws,origin:()=>Fs});var o=n(4756),i=n(3612);const a=function(){if(i.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function w(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);oDate.now(),A="default";class T extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,T.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new T(t,n)}}class _ extends T{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,_.prototype)}}class O extends T{constructor(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=o,Object.setPrototypeOf(this,O.prototype)}}class R extends T{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,R.prototype)}}class k extends R{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,k.prototype)}}class I extends T{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,I.prototype)}}class C extends T{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,C.prototype)}}class N extends T{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,N.prototype)}}class P extends T{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(U(e,["default"]),"', scope: '").concat(U(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,P.prototype)}}class L extends T{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(U(e,["default"]),"', missing scope: '").concat(U(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,L.prototype)}}class x extends T{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,x.prototype)}}function U(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const D=()=>window.crypto,M=()=>{let e="";for(;e.length<43;){const t=D().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},B=e=>btoa(e),j=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],G=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;const o=j.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},W=e=>{var{clientId:t}=e,n=w(e,["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:t},n))).toString()},H=async e=>{const t=D().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},K=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),F=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))};var X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},J={},V={};Object.defineProperty(V,"__esModule",{value:!0});var z=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();V.default=function(){return z.getInstance()};var Y=X&&X.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},Z=X&&X.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[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 Y(this,void 0,void 0,function(){return Z(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 Y(this,void 0,void 0,function(){var n,r,o,i;return Z(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?ee:this.storageHandler,r=$+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,Q.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),Q.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;cr.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:r.signal},async e=>{if(clearTimeout(o),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(o),"AbortError"===(null==e?void 0:e.name))throw new R;throw e}}}class ae{constructor(){this.activeLocks=new Set,this.lock=new oe,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let r=!1;for(let n=0;n<10&&!r;n++)r=await this.lock.acquireLock(e,t);if(!r)throw new R;this.activeLocks.add(e),1===this.activeLocks.size&&"undefined"!=typeof window&&window.addEventListener("pagehide",this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),0===this.activeLocks.size&&"undefined"!=typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}let se=null;const ce=new TextEncoder,ue=new TextDecoder;function le(e){return"string"==typeof e?ce.encode(e):ue.decode(e)}function de(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new me(`${e.name} modulusLength must be at least 2048 bits`)}let he;if(Uint8Array.prototype.toBase64)he=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;he=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),Te=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},_e=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:b;return o?(async(e,t,n,r,o,i,a,s)=>Ae({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0):(async(e,t,n)=>{const r=await Te(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var o})(e,r,a)};async function Oe(e,t,n,r,o,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let l,d=null;for(let c=0;c<3;c++)try{l=await _e(e,n,r,o,i,a,t,s),d=null;break}catch(e){d=e}if(d)throw d;const h=l.json,{error:p,error_description:f}=h,m=w(h,["error","error_description"]),{headers:y,ok:g}=l;let b;if(c&&(b=y[Ee],b&&await c.setNonce(b)),!g){const l=f||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===p)throw new N(p,l,m.mfa_token,m.mfa_requirements);if("missing_refresh_token"===p)throw new P(n,r);if("use_dpop_nonce"===p){if(!c||!b||u)throw new x(b);return Oe(e,t,n,r,o,i,a,s,c,!0)}throw new T(p||"request_error",l)}return m}async function Re(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=w(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const d="urn:ietf:params:oauth:grant-type:token-exchange"===l.grant_type,h="refresh_token"===l.grant_type&&c,p=Object.assign(Object.assign(Object.assign(Object.assign({},l),d&&o&&{audience:o}),d&&i&&{scope:i}),h&&{audience:o,scope:i}),f=s?W(p):JSON.stringify(p),m=(y=l.grant_type,Se.includes(y));var y;return await Oe("".concat(n,"/oauth/token"),r,o||A,i,{method:"POST",body:f,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(G(a||E)))}},t,s,c,m?u:void 0)}const ke=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[A]),ke(r,t)},Ce="@@auth0spajs@@",Ne="@@user@@";class Pe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ce,n=arguments.length>2?arguments[2]:void 0;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,r,o]=e.split("::");return new Pe({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new Pe({scope:t,audience:n,clientId:r})}}class Le{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(Ce))}}class xe{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 Ue{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||S}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=Pe.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/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 Pe({clientId:e},Ce,Ne).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Pe.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===Ce&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Pe.fromKey(r);if(t.prefix===Ce&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=Pe.fromKey(i);if(r.prefix===Ce&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class De{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(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 Me=e=>"number"==typeof e,Be=["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 je=X&&X.__assign||function(){return je=Object.assign||function(e){for(var t,n=1,r=arguments.length;nXe.get(e)||Xe.get("".concat(Je).concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),Ke("".concat(Je).concat(e),JSON.stringify(t),r),Xe.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Fe(e,n),Xe.remove(e,t),Xe.remove("".concat(Je).concat(e),t)}},ze={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 Ye;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Ye||(Ye={}));var Ze,qe=function(e){return Ze=Ze||function(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o0?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"".concat(Ce,"::").concat(e)}}const et="auth0.is.authenticated",tt={memory:()=>(new xe).enclosedCache,localstorage:()=>new Le},nt=e=>tt[e],rt=e=>{const{openUrl:t,onRedirect:n}=e,r=w(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},ot=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},it={NONCE:"nonce",KEYPAIR:"keypair"};class at{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(it).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(it.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(it.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(it.NONCE,this.buildKey(e))}findKeyPair(){return this.find(it.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(it.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(it.KEYPAIR,this.clientId)}}class st{constructor(e){this.storage=new at(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;return r={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(r,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}(0,{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){const t=await this.getOrGenerateKeyPair();return function(e){let{keyPair:t,url:n,method:r,nonce:o,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return be(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!ge(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ve(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new fe("unsupported JWK kty")}return pe(await crypto.subtle.digest({name:"SHA-256"},le(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var ct;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(ct||(ct={}));class ut{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ct.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let r,o;"string"==typeof n?(r=this.config.dpopNonceId?ct.DPoP:ct.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===ct.DPoP&&await this.setDpopProofHeader(e,o)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,Ee);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new x(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class lt{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new dt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new dt(t)}}class dt extends Error{constructor(e){let{type:t,status:n,title:r,detail:o,validation_errors:i}=e;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,dt.prototype)}}const ht={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function pt(e,t){this.v=e,this.k=t}function ft(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function mt(e){return new pt(e,0)}function yt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function wt(e,t){return e.get(ft(e,t))}function gt(e,t,n){yt(e,t),t.set(e,n)}function bt(e,t,n){return e.set(ft(e,t),n),n}function vt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Wt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Nt("The input to be decoded is not correctly encoded.",It,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw Nt("".concat(n," must be a non-negative number"),It,o);return}throw Nt("".concat(n," must be a positive number"),It,o)}catch(e){if(r)throw Jt(e.message,r,o);throw e}}function Qt(e,t,n,r){try{if("string"!=typeof e)throw Nt("".concat(t," must be a string"),Ct,r);if(0===e.length)throw Nt("".concat(t," must not be empty"),It,r)}catch(e){if(n)throw Jt(e.message,n,r);throw e}}function $t(e){!function(e,t){if(On(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return Jt(t,Vn,e)}(e,t)}(e,"application/json")}function en(){return Kt(crypto.getRandomValues(new Uint8Array(32)))}function tn(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Ft("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Ft("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Ft("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Ft("unsupported CryptoKey algorithm name",{cause:e})}}function nn(e){const t=null==e?void 0:e[Lt];return"number"==typeof t&&Number.isFinite(t)?t:0}function rn(e){const t=null==e?void 0:e[xt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function on(){return Math.floor(Date.now()/1e3)}function an(e){if("object"!=typeof e||null===e)throw Nt('"as" must be an object',Ct);Qt(e.issuer,'"as.issuer"')}function sn(e){if("object"!=typeof e||null===e)throw Nt('"client" must be an object',Ct);Qt(e.client_id,'"client.client_id"')}function cn(e){return Qt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function un(e,t){const{key:n,kid:r}=(o=e)instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&Qt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Nt("".concat(t," must be a CryptoKey"),Ct)}(e,t),"private"!==e.type)throw Nt("".concat(t," must be a private CryptoKey"),It)}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:tn(n),kid:r},u=function(e,t){const n=on()+nn(t);return{jti:en(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===(s=t[Dt])||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw Nt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',It);const r="".concat(Kt(Gt(JSON.stringify(e))),".").concat(Kt(Gt(JSON.stringify(t)))),o=Kt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:or(e)};case"RSA-PSS":switch(rr(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Ft("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return rr(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Ft("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Gt(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const ln=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function dn(e,t){if(t&&"https:"!==e.protocol)throw Jt("only requests to HTTPS are allowed",Yn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Jt("only HTTP and HTTPS requests are allowed",Zn,e)}function hn(e,t,n,r){let o;if("string"!=typeof e||!(o=ln(e)))throw Jt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?er:tr,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return dn(o,r),o}function pn(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?hn(e.mtls_endpoint_aliases[t],t,n,r):hn(e[t],t,n,r)}class fn extends Error{constructor(e,t){var n;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"error",void 0),vt(this,"status",void 0),vt(this,"error_description",void 0),vt(this,"response",void 0),this.name=this.constructor.name,this.code=Hn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class mn extends Error{constructor(e,t){var n,r;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"error",void 0),vt(this,"error_description",void 0),this.name=this.constructor.name,this.code=Fn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class yn extends Error{constructor(e,t){var n;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"response",void 0),vt(this,"status",void 0),this.name=this.constructor.name,this.code=Wn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const wn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",gn="("+wn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',bn="("+wn+")\\s*=\\s*("+wn+")",vn=new RegExp("^[,\\s]*("+wn+")"),En=new RegExp("^[,\\s]*"+gn+"[,\\s]*(.*)"),Sn=new RegExp("^[,\\s]*"+bn+"[,\\s]*(.*)"),An=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Tn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!kt(e,Response))throw Nt('"response" must be an instance of Response',Ct);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(vn);const i=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;r=s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(t=r.match(En)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(Sn))){if(t=r.match(An)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else r=a||void 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new yn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){nr(e),$t(e);try{const t=await e.clone().json();if(Vt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new fn("server responded with an error in the response body",{cause:t,response:e});throw Jt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),zn,e)}}function _n(e){if(!Un.has(e))throw Nt('"options.DPoP" is not a valid DPoPHandle',It)}function On(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function Rn(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Ut])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Yt(r,null==a?void 0:a.signal)})}async function kn(e,t,n,r,o,i){var a;const s=pn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Pt]));o.set("grant_type",r);const c=zt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(_n(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Rn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const In=new WeakMap,Cn=new WeakMap;function Nn(e){if(!e.id_token)return;const t=In.get(e);if(!t)throw Nt('"ref" was already garbage collected or did not resolve from the proper sources',It);return t}async function Pn(e,t,n,r,o,i){if(an(e),sn(t),!kt(n,Response))throw Nt('"response" must be an instance of Response',Ct);await Tn(n,200,"Token Endpoint"),nr(n);const a=await ur(n);if(Qt(a.access_token,'"response" body "access_token" property',Jn,{body:a}),Qt(a.token_type,'"response" body "token_type" property',Jn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;qt(e,!0,'"response" body "expires_in" property',Jn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Qt(a.refresh_token,'"response" body "refresh_token" property',Jn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Jt('"response" body "scope" property must be a string',Jn,{body:a});if(void 0!==a.id_token){Qt(a.id_token,'"response" body "id_token" property',Jn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(qt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new Ft("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Jt("Invalid JWT",Jn,e);try{i=JSON.parse(Gt(Kt(s)))}catch(e){throw Jt("failed to parse JWT Header body as base64url encoded JSON",Xn,e)}if(!Vt(i))throw Jt("JWT Header must be a top level object",Jn,e);if(t(i),void 0!==i.crit)throw new Ft('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Gt(Kt(c)))}catch(e){throw Jt("failed to parse JWT Payload body as base64url encoded JSON",Xn,e)}if(!Vt(a))throw Jt("JWT Payload must be a top level object",Jn,e);const l=on()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Jt('unexpected JWT "exp" (expiration time) claim type',Jn,{claims:a});if(a.exp<=l-r)throw Jt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',qn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Jt('unexpected JWT "iat" (issued at) claim type',Jn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Jt('unexpected JWT "iss" (issuer) claim type',Jn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Jt('unexpected JWT "nbf" (not before) claim type',Jn,{claims:a});if(a.nbf>l+r)throw Jt('unexpected JWT "nbf" (not before) claim value',qn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Jt('unexpected JWT "aud" (audience) claim type',Jn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,ir.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),nn(t),rn(t),o).then(Bn.bind(void 0,i)).then(xn.bind(void 0,e)).then(Ln.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Jt('ID Token "aud" (audience) claim includes additional untrusted audiences',Qn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Jt('unexpected ID Token "azp" (authorized party) claim value',Qn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&qt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Jn,{claims:s}),Cn.set(n,c),In.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Ft("unsupported `token_type` value",{cause:{body:a}});return a}function Ln(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Jt('unexpected JWT "aud" (audience) claim value',Qn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Jt('unexpected JWT "aud" (audience) claim value',Qn,{expected:e,claims:t.claims,claim:"aud"});return t}function xn(e,t){var n,r;const o=null!==(n=null===(r=e[dr])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Jt('unexpected JWT "iss" (issuer) claim value',Qn,{expected:o,claims:t.claims,claim:"iss"});return t}const Un=new WeakSet,Dn=Symbol(),Mn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Bn(e,t){for(const n of e)if(void 0===t.claims[n])throw Jt('JWT "'.concat(n,'" (').concat(Mn[n],") claim missing"),Jn,{claims:t.claims});return t}const jn=Symbol(),Gn=Symbol();const Wn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Hn="OAUTH_RESPONSE_BODY_ERROR",Kn="OAUTH_UNSUPPORTED_OPERATION",Fn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Xn="OAUTH_PARSE_ERROR",Jn="OAUTH_INVALID_RESPONSE",Vn="OAUTH_RESPONSE_IS_NOT_JSON",zn="OAUTH_RESPONSE_IS_NOT_CONFORM",Yn="OAUTH_HTTP_REQUEST_FORBIDDEN",Zn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",qn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Qn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",$n="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",er="OAUTH_MISSING_SERVER_METADATA",tr="OAUTH_INVALID_SERVER_METADATA";function nr(e){if(e.bodyUsed)throw Nt('"response" body has been used already',It)}function rr(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Ft("unsupported ".concat(t.name," modulusLength"),{cause:e})}function or(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Ft("unsupported ECDSA namedCurve",{cause:e})}}function ir(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Jt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:e,reason:"client configuration"})}function ar(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Jt('"'.concat(t,'" parameter must be provided only once'),Jn);return n}const sr=Symbol(),cr=Symbol();async function ur(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t;try{t=await e.json()}catch(t){throw n(e),Jt('failed to parse "response" body as JSON',Xn,t)}if(!Vt(t))throw Jt('"response" body must be a top level object',Jn,{body:t});return t}const lr=Symbol(),dr=Symbol(),hr=new TextEncoder,pr=new TextDecoder;function fr(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function mr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},gr=(e,t)=>e.name===t;function br(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw wr("SHA-".concat(t),"algorithm.hash")}function vr(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Er=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),vt(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),vt(this,"claim",void 0),vt(this,"reason",void 0),vt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}vt(Ar,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Tr extends Sr{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),vt(this,"code","ERR_JWT_EXPIRED"),vt(this,"claim",void 0),vt(this,"reason",void 0),vt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}vt(Tr,"code","ERR_JWT_EXPIRED");class _r extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}vt(_r,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Or extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JOSE_NOT_SUPPORTED")}}vt(Or,"code","ERR_JOSE_NOT_SUPPORTED"),vt(class extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),vt(class extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Rr extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWS_INVALID")}}vt(Rr,"code","ERR_JWS_INVALID");class kr extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWT_INVALID")}}vt(kr,"code","ERR_JWT_INVALID"),vt(class extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Ir extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWKS_INVALID")}}vt(Ir,"code","ERR_JWKS_INVALID");class Cr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}vt(Cr,"code","ERR_JWKS_NO_MATCHING_KEY");class Nr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),vt(this,Symbol.asyncIterator,void 0),vt(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}vt(Nr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Pr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWKS_TIMEOUT")}}vt(Pr,"code","ERR_JWKS_TIMEOUT");class Lr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}vt(Lr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const xr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Ur=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Dr=e=>xr(e)||Ur(e);function Mr(e,t,n){try{return yr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Br(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const jr=e=>Br(e)&&"string"==typeof e.kty;async function Gr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Fr||(Fr=new WeakMap);let o=Fr.get(e);if(null!=o&&o[n])return o[n];const i=await Hr(St(St({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Fr.set(e,{[n]:i}),i};const Jr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},Yr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Zr=(e,t,n)=>{var r;const o=(e=>mr(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){zr(e,48,"Invalid PKCS#8 structure"),Vr(e),zr(e,2,"Expected version field");const t=Vr(e);e.pos+=t,zr(e,48,"Expected algorithm identifier");Vr(e);e.pos}(t),(e=>{const t=(e=>{zr(e,6,"Expected algorithm OID");const t=Vr(e);return Yr(e,t)})(e);if(Jr(t,[43,101,110]))return"X25519";if(!Jr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");zr(e,6,"Expected curve OID");const n=Vr(e),r=Yr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(Jr(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Or("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Or('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)},qr=e=>null==e?void 0:e[Symbol.toStringTag],Qr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var $r,eo;let to,no;if("undefined"==typeof navigator||null===($r=navigator.userAgent)||void 0===$r||null===(eo=$r.startsWith)||void 0===eo||!eo.call($r,"Mozilla/5.0 ")){const e="v6.8.3";no="".concat("openid-client","/").concat(e),to={"user-agent":no}}const ro=e=>oo.get(e);let oo,io;function ao(e){return void 0!==e?cn(e):(io||(io=new WeakMap),(e,t,n,r)=>{let o;return(o=io.get(t))||(function(e,t){if("string"!=typeof e)throw lo("".concat(t," must be a string"),uo);if(0===e.length)throw lo("".concat(t," must not be empty"),co)}(t.client_secret,'"metadata.client_secret"'),o=cn(t.client_secret),io.set(t,o)),o(e,t,n,r)})}const so=Ut,co="ERR_INVALID_ARG_VALUE",uo="ERR_INVALID_ARG_TYPE";function lo(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class ho extends Error{constructor(e,t){var n;super(e,t),vt(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function po(e,t,n){return new ho(e,{cause:t,code:n})}function fo(e){if(e instanceof TypeError||e instanceof ho||e instanceof fn||e instanceof mn||e instanceof yn)throw e;if(e instanceof Xt)switch(e.code){case Yn:throw po("only requests to HTTPS are allowed",e,e.code);case Zn:throw po("only requests to HTTP or HTTPS are allowed",e,e.code);case zn:throw po("unexpected HTTP response status code",e.cause,e.code);case Vn:throw po("unexpected response content-type",e.cause,e.code);case Xn:throw po("parsing error occured",e,e.code);case Jn:throw po("invalid response encountered",e,e.code);case Qn:throw po("unexpected JWT claim value encountered",e,e.code);case $n:throw po("unexpected JSON attribute value encountered",e,e.code);case qn:throw po("JWT timestamp claim value failed validation",e,e.code);default:throw po(e.message,e,e.code)}if(e instanceof Ft)throw po("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw po("runtime operation error",e,Kn);case"NotSupportedError":throw po("runtime unsupported operation",e,Kn);case"TimeoutError":throw po("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw po("operation aborted",e,"OAUTH_ABORT")}throw new ho("something went wrong",{cause:e})}async function mo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw lo('"server" must be an instance of URL',uo);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw Nt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Ct);dn(e,!0!==(null==r?void 0:r[Pt]));const o=n(new URL(e.href)),i=zt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Ut])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Yt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Zt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Zt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Nt('"options.algorithm" must be "oidc" (default), or "oauth2"',It)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Ut]:null==t?void 0:t[so],[Pt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(Ao),signal:a,headers:new Headers(to)}):((null==t?void 0:t[so])||fetch)((dn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Ao)),e.href),{headers:Object.fromEntries(new Headers(St({accept:"application/json"},to)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==lr)throw Nt('"expectedIssuerIdentifier" must be an instance of URL',Ct);if(!kt(t,Response))throw Nt('"response" must be an instance of Response',Ct);if(200!==t.status)throw Jt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',zn,t);nr(t);const r=await ur(t);if(Qt(r.issuer,'"response" body "issuer" property',Jn,{body:r}),n!==lr&&new URL(r.issuer).href!==n.href)throw Jt('"response" body "issuer" property does not match the expected value',$n,{expected:n.href,body:r,attribute:"issuer"});return r}(lr,e)).catch(fo);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[yo]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new ho("discovered metadata issuer does not match the expected issuer",{code:$n,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new wo(i,t,n,r);let s=ro(a);if(null!=o&&o[so]&&(s.fetch=o[so]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const yo=Symbol();class wo{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw lo('"clientId" must be a non-empty string',uo);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw lo('"clientId" and "metadata.client_id" must be the same',co);const u=St(St({},structuredClone(n)),{},{client_id:t});let l;u[Lt]=null!==(i=null===(a=n)||void 0===a?void 0:a[Lt])&&void 0!==i?i:0,u[xt]=null!==(s=null===(c=n)||void 0===c?void 0:c[xt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?ao(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);yo in e&&(h[dr]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);oo||(oo=new WeakMap),oo.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(ro(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(ro(this).c)}get timeout(){return ro(this).timeout}set timeout(e){ro(this).timeout=e}get[so](){return ro(this).fetch}set[so](e){ro(this).fetch=e}}function go(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Nn(this)}catch(e){return}}}}}(e))}async function bo(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Xt("invalid Retry-After header value",{cause:e});a>t&&await vo(a-t,n)}function vo(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function Eo(e,t){Io(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=ro(e);return async function(e,t,n,r,o){an(e),sn(t);const i=pn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Pt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=zt(null==o?void 0:o.headers);return s.set("accept","application/json"),Rn(e,t,n,i,a,s,o)}(n,r,o,t,{[Ut]:i,[Pt]:!a,headers:new Headers(to),signal:Co(s)}).then(e=>async function(e,t,n){if(an(e),sn(t),!kt(n,Response))throw Nt('"response" must be an instance of Response',Ct);await Tn(n,200,"Backchannel Authentication Endpoint"),nr(n);const r=await ur(n);Qt(r.auth_req_id,'"response" body "auth_req_id" property',Jn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return qt(o,!0,'"response" body "expires_in" property',Jn,{body:r}),r.expires_in=o,void 0!==r.interval&&qt(r.interval,!1,'"response" body "interval" property',Jn,{body:r}),r}(n,r,e)).catch(fo)}async function So(e,t,n,r){var o,i;Io(e),n=new URLSearchParams(n);let a=null!==(o=t.interval)&&void 0!==o?o:5;const s=null!==(i=null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await vo(a,s)}catch(e){fo(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=ro(e),y=(o,i)=>So(e,St(St({},t),{},{interval:o}),n,St(St({},r),{},{signal:s,flag:i})),w=await async function(e,t,n,r,o){an(e),sn(t),Qt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),kn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[Ut]:d,[Pt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(to),signal:s.aborted?s:Co(f)}).catch(fo);var g;if(503===w.status&&w.headers.has("retry-after"))return await bo(w,a,s,!0),await(null===(g=w.body)||void 0===g?void 0:g.cancel()),y(a);const b=async function(e,t,n,r){return Pn(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(c,u,w,{[Mt]:m});let v;try{v=await b}catch(e){if(No(e,r))return y(a,Po);if(e instanceof fn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await bo(e.response,a,s),y(a)}fo(e)}return v.id_token&&await(null==p?void 0:p(w)),go(v),v}function Ao(e){ro(e).tlsOnly=!1}async function To(e,t,n,r,o){if(Io(e),!((null==o?void 0:o.flag)===Po||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw lo('"currentUrl" must be an instance of URL, or Request',uo);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:y,implicit:w}=ro(e);if((null==o?void 0:o.flag)===Po)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Nt("form_post responses are expected to use the POST method",It,{cause:e});if("application/x-www-form-urlencoded"!==On(e))throw Nt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",It,{cause:e});return async function(e){if(e.bodyUsed)throw Nt("form_post Request instances must contain a readable body",It,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw lo("unexpected Request HTTP method",co)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!h:i=await h(t,null==n?void 0:n.expectedState);break;case!!p:i=await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!w:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(an(e),sn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Nt('"parameters" must be an instance of URLSearchParams, or URL',Ct);if(ar(n,"response"))throw Jt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Jn,{parameters:n});const o=ar(n,"iss"),i=ar(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Jt('response parameter "iss" (issuer) missing',Jn,{parameters:n});if(o&&o!==e.issuer)throw Jt('unexpected "iss" (issuer) response parameter value',Jn,{expected:e.issuer,parameters:n});switch(r){case void 0:case cr:if(void 0!==i)throw Jt('unexpected "state" response parameter encountered',Jn,{expected:void 0,parameters:n});break;case sr:break;default:if(Qt(r,'"expectedState" argument'),i!==r)throw Jt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Jn,{expected:r,parameters:n})}if(ar(n,"error"))throw new mn("authorization response from the server is an error",{cause:n});const a=ar(n,"id_token"),s=ar(n,"token");if(void 0!==a||void 0!==s)throw new Ft("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Un.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){fo(e)}}}const g=await async function(e,t,n,r,o,i,a){if(an(e),sn(t),!Un.has(r))throw Nt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',It);Qt(o,'"redirectUri"');const s=ar(r,"code");if(!s)throw Jt('no authorization code in "callbackParameters"',Jn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Dn&&(Qt(i,'"codeVerifier"'),c.set("code_verifier",i)),kn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Dn,{additionalParameters:r,[Ut]:l,[Pt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(to),signal:Co(m)}).catch(fo);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=jn;break;case jn:break;default:Qt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Gn;break;case Gn:break;default:qt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Pn(e,t,n,s,i,a);Qt(c.id_token,'"response" body "id_token" property',Jn,{body:c});const u=Nn(c);if(o!==Gn){const e=on()+nn(t),n=rn(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,r){return Pn(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[Mt]:l,recognizedTokenTypes:n})}).catch(fo);return go(d),d}async function xo(e,t,n){if(!Br(e))throw new Rr("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Rr('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Rr("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Rr("JWS Payload missing");if("string"!=typeof e.signature)throw new Rr("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Br(e.header))throw new Rr("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=yr(e.protected);r=JSON.parse(pr.decode(t))}catch(e){throw new Rr("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Or('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(Rr,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(a=r.b64,"boolean"!=typeof a))throw new Rr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Rr('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new _r('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Rr("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Rr("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(r,e),u=!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(jr(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Qr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Dr(t))throw new TypeError(Er(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(qr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(jr(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&Qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Dr(t))throw new TypeError(Er(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(qr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?fr(e.protected):new Uint8Array,fr("."),"string"==typeof e.payload?a?fr(e.payload):hr.encode(e.payload):e.payload),d=Mr(e.signature,"signature",Rr),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(xr(e))return e;if(Ur(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Fr||(Fr=new WeakMap);let n=Fr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(Kr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(Kr)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(Kr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(Kr);return n?n[t]=i:Fr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Xr(e,n,t)}if(jr(e))return e.k?yr(e.k):Xr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Gr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Or("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new Lr;let p;p=a?Mr(e.payload,"payload",Rr):"string"==typeof e.payload?hr.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?St(St({},f),{},{key:h}):f}const Uo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Do(e){const t=Uo.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const Mo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function Bo(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(pr.decode(t))}catch(e){}if(!Br(n))throw new kr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||Mo(e.typ)!==Mo(o)))throw new Ar('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Ar('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Ar('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Ar('unexpected "sub" claim value',n,"sub","check_failed");if(c&&(h="string"==typeof c?[c]:c,!("string"==typeof(d=n.aud)?h.includes(d):Array.isArray(d)&&h.some(Set.prototype.has.bind(new Set(d))))))throw new Ar('unexpected "aud" claim value',n,"aud","check_failed");var d,h;let p;switch(typeof r.clockTolerance){case"string":p=Do(r.clockTolerance);break;case"number":p=r.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=r,m=(y=f||new Date,Math.floor(y.getTime()/1e3));var y;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Ar('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Ar('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new Ar('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Ar('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new Tr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=m-n.iat;if(e-p>("number"==typeof u?u:Do(u)))throw new Tr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new Ar('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function jo(e){return Br(e)}var Go,Wo,Ho=new WeakMap,Ko=new WeakMap;class Fo{constructor(e){if(gt(this,Ho,void 0),gt(this,Ko,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(jo)}(e))throw new Ir("JSON Web Key Set malformed");bt(Ho,this,structuredClone(e))}jwks(){return wt(Ho,this)}async getKey(e,t){const{alg:n,kid:r}=St(St({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Or('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=wt(Ho,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==o||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new Cr;if(1!==s){const e=new Nr,t=wt(Ko,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new Tt(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield mt(Xo(t,e,n))}catch(e){}}),e}return Xo(wt(Ko,this),a,n)}}async function Xo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!Br(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return yr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Or('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Hr(St(St({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Hr(St(St({},e),{},{ext:n}));case"EC":case"OKP":return Hr(St(St({},e),{},{alg:t,ext:n}));default:throw new Or('Unsupported "kty" (Key Type) Parameter value')}}(St(St({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Ir("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Jo(e){const t=new Fo(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let Vo;if("undefined"==typeof navigator||null===(Go=navigator.userAgent)||void 0===Go||null===(Wo=Go.startsWith)||void 0===Wo||!Wo.call(Go,"Mozilla/5.0 ")){const e="v6.2.2";Vo="".concat("jose","/").concat(e)}const zo=Symbol(),Yo=Symbol();var Zo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap,ii=new WeakMap;class ai{constructor(e,t){if(gt(this,Zo,void 0),gt(this,qo,void 0),gt(this,Qo,void 0),gt(this,$o,void 0),gt(this,ei,void 0),gt(this,ti,void 0),gt(this,ni,void 0),gt(this,ri,void 0),gt(this,oi,void 0),gt(this,ii,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;bt(Zo,this,new URL(e.href)),bt(qo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),bt(Qo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),bt($o,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),bt(ni,this,new Headers(null==t?void 0:t.headers)),Vo&&!wt(ni,this).has("User-Agent")&&wt(ni,this).set("User-Agent",Vo),wt(ni,this).has("accept")||(wt(ni,this).set("accept","application/json"),wt(ni,this).append("accept","application/jwk-set+json")),bt(ri,this,null==t?void 0:t[zo]),void 0!==(null==t?void 0:t[Yo])&&(bt(ii,this,null==t?void 0:t[Yo]),n=null==t?void 0:t[Yo],r=wt($o,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Br(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Br)&&(bt(ei,this,wt(ii,this).uat),bt(oi,this,Jo(wt(ii,this).jwks))))}pendingFetch(){return!!wt(ti,this)}coolingDown(){return"number"==typeof wt(ei,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Pr;throw e});if(200!==o.status)throw new Sr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Sr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(wt(Zo,this).href,wt(ni,this),AbortSignal.timeout(wt(qo,this)),wt(ri,this)).then(e=>{bt(oi,this,Jo(e)),wt(ii,this)&&(wt(ii,this).uat=Date.now(),wt(ii,this).jwks=e),bt(ei,this,Date.now()),bt(ti,this,void 0)}).catch(e=>{throw bt(ti,this,void 0),e})),await wt(ti,this)}}const si=["mfaToken"],ci=["mfaToken"];var ui,li,di,hi,pi,fi,mi,yi,wi,gi,bi,vi,Ei,Si,Ai,Ti,_i=class extends Error{constructor(e,t){super(t),vt(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Oi=class extends Error{constructor(e,t,n){super(t),vt(this,"cause",void 0),vt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ri=class extends Oi{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ki=class extends Oi{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Ii=class extends Oi{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Ci=class extends Oi{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ni=class extends Oi{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Pi=class extends Oi{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Li=class extends Error{constructor(e){super(e),vt(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},xi=class extends Oi{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),vt(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Ui=class extends Oi{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Di=class extends Oi{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Mi=class extends Oi{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Bi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),vt(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function ji(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>St(St({},e),{},{[t[0]]:t[1]}),{})}var Gi=class extends Error{constructor(e,t,n){super(t),vt(this,"cause",void 0),vt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Wi=class extends Gi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Hi=class extends Gi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Ki=class extends Gi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Fi=class extends Gi{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Xi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Ji=(ui=new WeakMap,li=new WeakMap,di=new WeakMap,class{constructor(e){var t;gt(this,ui,void 0),gt(this,li,void 0),gt(this,di,void 0),bt(ui,this,"https://".concat(e.domain)),bt(li,this,e.clientId),bt(di,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(wt(ui,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await wt(di,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Wi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Xi)}async enrollAuthenticator(e){const t="".concat(wt(ui,this),"/mfa/associate"),{mfaToken:n}=e,r=At(e,si),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await wt(di,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Hi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(wt(ui,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await wt(di,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new Ki(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(wt(ui,this),"/mfa/challenge"),{mfaToken:n}=e,r=At(e,ci),o={mfa_token:n,client_id:wt(li,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await wt(di,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Fi(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),Vi=class e{constructor(e,t,n,r,o,i,a){vt(this,"accessToken",void 0),vt(this,"idToken",void 0),vt(this,"refreshToken",void 0),vt(this,"expiresAt",void 0),vt(this,"scope",void 0),vt(this,"claims",void 0),vt(this,"authorizationDetails",void 0),vt(this,"tokenType",void 0),vt(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},zi=(hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,class{constructor(e,t){gt(this,hi,new Map),gt(this,pi,void 0),gt(this,fi,void 0),bt(fi,this,Math.max(1,Math.floor(e))),bt(pi,this,Math.max(0,Math.floor(t)))}get(e){const t=wt(hi,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return wt(hi,this).delete(e),wt(hi,this).set(e,t),t.value;wt(hi,this).delete(e)}}set(e,t){for(wt(hi,this).has(e)&&wt(hi,this).delete(e),wt(hi,this).set(e,{value:t,expiresAt:Date.now()+wt(pi,this)});wt(hi,this).size>wt(fi,this);){const e=wt(hi,this).keys().next().value;if(void 0===e)break;wt(hi,this).delete(e)}}}),Yi=new Map;function Zi(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var qi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Yi.get(i));var i;return o||(o=new zi(e.maxEntries,e.ttlMs),Yi.set(t,o)),o}static createJwksCache(){return{}}},Qi="openid profile email offline_access",$i=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function ea(e){if(null==e)throw new Pi("subject_token is required");if("string"!=typeof e)throw new Pi("subject_token must be a string");if(0===e.trim().length)throw new Pi("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Pi("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Pi("subject_token must not include the 'Bearer ' prefix")}function ta(e,t){if(t)for(const[n,r]of Object.entries(t))if(!$i.has(n))if(Array.isArray(r)){if(r.length>20)throw new Pi("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var na="urn:ietf:params:oauth:token-type:access_token",ra=(mi=new WeakMap,yi=new WeakMap,wi=new WeakMap,gi=new WeakMap,bi=new WeakMap,vi=new WeakMap,Ei=new WeakMap,Si=new WeakMap,Ai=new WeakMap,Ti=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){yt(e,t),t.add(e)}(this,Ti),gt(this,mi,void 0),gt(this,yi,void 0),gt(this,wi,void 0),gt(this,gi,void 0),gt(this,bi,void 0),gt(this,vi,void 0),gt(this,Ei,void 0),gt(this,Si,void 0),gt(this,Ai,void 0),vt(this,"mfa",void 0),bt(gi,this,e),e.useMtls&&!e.customFetch)throw new _i("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");bt(bi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,St(St({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=Zi(e.discoveryCache);bt(Ei,this,qi.createDiscoveryCache(i)),bt(Si,this,new Map),bt(Ai,this,qi.createJwksCache()),this.mfa=new Ji({domain:wt(gi,this).domain,clientId:wt(gi,this).clientId,customFetch:wt(bi,this)})}async getServerMetadata(){const{serverMetadata:e}=await ft(Ti,this,aa).call(this);return e}async buildAuthorizationUrl(e){const{serverMetadata:t}=await ft(Ti,this,aa).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new _i("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await ft(Ti,this,la).call(this,e)}catch(e){throw new Ui(e)}}async buildLinkUserUrl(e){try{const t=await ft(Ti,this,la).call(this,{authorizationParams:St(St({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Di(e)}}async buildUnlinkUserUrl(e){try{const t=await ft(Ti,this,la).call(this,{authorizationParams:St(St({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Mi(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ft(Ti,this,aa).call(this),r=ji(St(St({},wt(gi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(St(St({scope:Qi},r),{},{client_id:wt(gi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Eo(t,o),n=await So(t,e);return Vi.fromTokenEndpointResponse(n)}catch(e){throw new xi(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ft(Ti,this,aa).call(this),r=ji(St(St({},wt(gi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(St(St({scope:Qi},r),{},{client_id:wt(gi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Eo(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new xi(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await ft(Ti,this,aa).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await Lo(n,"urn:openid:params:grant-type:ciba",r);return Vi.fromTokenEndpointResponse(e)}catch(e){throw new xi(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Ni("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new Ni("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?na:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof Pi)throw new Ni(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?ft(Ti,this,sa).call(this,e):ft(Ti,this,ca).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await ft(Ti,this,aa).call(this);try{const r=await To(n,e,{pkceCodeVerifier:t.codeVerifier});return Vi.fromTokenEndpointResponse(r)}catch(e){throw new Ri("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await ft(Ti,this,aa).call(this),n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await _o(t,e.refreshToken,n);return Vi.fromTokenEndpointResponse(r)}catch(e){throw new Ii("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const{configuration:t}=await ft(Ti,this,aa).call(this),n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await ft(Ti,this,ua).call(this);r=new wo(t.serverMetadata(),wt(gi,this).clientId,wt(gi,this).clientSecret,n),r[so]=(t,n)=>wt(bi,this).call(this,t,St(St({},n),{},{headers:St(St({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Lo(r,"password",n);return Vi.fromTokenEndpointResponse(e)}catch(e){throw new Ci("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await ft(Ti,this,aa).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await Oo(t,n);return Vi.fromTokenEndpointResponse(r)}catch(e){throw new ki("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await ft(Ti,this,aa).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(wt(gi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",wt(gi,this).clientId),t}return function(e,t){Io(e);const{as:n,c:r,tlsOnly:o}=ro(e),i=pn(n,"end_session_endpoint",!1,o);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await ft(Ti,this,aa).call(this),n=Zi(wt(gi,this).discoveryCache),r=t.jwks_uri;wt(vi,this)||bt(vi,this,function(e,t){const n=new ai(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[zo]:wt(bi,this),[Yo]:wt(Ai,this)}));const{payload:o}=await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=pr.decode(e)),"string"!=typeof e)throw new Rr("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new Rr("Invalid Compact JWS");const s=await xo({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?St(St({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new kr("JWTs MUST NOT use unencoded payload");const i={payload:Bo(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?St(St({},i),{},{key:o.key}):i}(e.logoutToken,wt(vi,this),{issuer:t.issuer,audience:wt(gi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in o)&&!("sub"in o))throw new Li('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new Li('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new Li('"sub" claim must be a string');if("nonce"in o)throw new Li('"nonce" claim is prohibited');if(!("events"in o))throw new Li('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new Li('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new Li('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new Li('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function oa(){const e=wt(gi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(wt(gi,this).useMtls?"1":"0")}async function ia(e){const t=await ft(Ti,this,ua).call(this),n=new wo(e,wt(gi,this).clientId,wt(gi,this).clientSecret,t);return n[so]=wt(bi,this),n}async function aa(){if(wt(mi,this)&&wt(yi,this))return{configuration:wt(mi,this),serverMetadata:wt(yi,this)};const e=ft(Ti,this,oa).call(this),t=wt(Ei,this).get(e);if(t)return bt(yi,this,t.serverMetadata),bt(mi,this,await ft(Ti,this,ia).call(this,t.serverMetadata)),{configuration:wt(mi,this),serverMetadata:wt(yi,this)};const n=wt(Si,this).get(e);if(n){const e=await n;return bt(yi,this,e.serverMetadata),bt(mi,this,await ft(Ti,this,ia).call(this,e.serverMetadata)),{configuration:wt(mi,this),serverMetadata:wt(yi,this)}}const r=(async()=>{const t=await ft(Ti,this,ua).call(this),n=await mo(new URL("https://".concat(wt(gi,this).domain)),wt(gi,this).clientId,{use_mtls_endpoint_aliases:wt(gi,this).useMtls},t,{[so]:wt(bi,this)}),r=n.serverMetadata();return wt(Ei,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});o.catch(()=>{}),wt(Si,this).set(e,o);try{const{configuration:e,serverMetadata:t}=await r;bt(mi,this,e),bt(yi,this,t),wt(mi,this)[so]=wt(bi,this)}finally{wt(Si,this).delete(e)}return{configuration:wt(mi,this),serverMetadata:wt(yi,this)}}async function sa(e){var t,n;const{configuration:r}=await ft(Ti,this,aa).call(this);if("audience"in e||"resource"in e)throw new Pi("audience and resource parameters are not supported for Token Vault exchanges");ea(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:na,requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),ta(o,e.extra);try{const e=await Lo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return Vi.fromTokenEndpointResponse(e)}catch(t){throw new Pi("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function ca(e){const{configuration:t}=await ft(Ti,this,aa).call(this);ea(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),ta(n,e.extra);try{const e=await Lo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return Vi.fromTokenEndpointResponse(e)}catch(t){throw new Pi("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ua(){return wt(wi,this)||bt(wi,this,(async()=>{if(!wt(gi,this).clientSecret&&!wt(gi,this).clientAssertionSigningKey&&!wt(gi,this).useMtls)throw new Bi;if(wt(gi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=wt(gi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Zr(e,t,void 0)}(e,wt(gi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return un(e,void 0)}(e):ao(wt(gi,this).clientSecret)})().catch(e=>{throw bt(wi,this,void 0),e})),wt(wi,this)}async function la(e){const{configuration:t}=await ft(Ti,this,aa).call(this),n=en(),r=await function(e){return async function(e){return Qt(e,"codeVerifier"),Kt(await crypto.subtle.digest("SHA-256",Gt(e)))}(e)}(n),o=ji(St(St({},wt(gi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(St(St({scope:Qi},o),{},{client_id:wt(gi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await ko(t,i):await Ro(t,i),codeVerifier:n}}class da extends T{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new da(t,n)}}class ha extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,pa.prototype)}}class fa extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,fa.prototype)}}class ma extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ma.prototype)}}class ya extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ya.prototype)}}class wa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class ga{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new wa}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new ha("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof Wi)throw new ha(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=ht[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof Hi)throw new pa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof Fi)throw new fa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new ya("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new ma("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new ma("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof N)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof ma)throw new ma(e.error,e.error_description);throw e}}}class ba{constructor(e){let t,n;if(this.userCache=(new xe).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},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(!D())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===D().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 ")})(),this.lockManager=(se||(se=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new ie:new ae;var e}()),se),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||v,!nt(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=nt(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:b,this.cookieStorage=!1===e.legacySameSiteCookie?Xe:Ve,this.orgHintCookieName=(r=this.options.clientId,"auth0.".concat(r,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:ze;var i;this.scope=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{const o=e[n];i[n]=ke(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new De(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||S,this.cacheManager=new Ue(n,n.allKeys?void 0:new $e(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new st(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new lt(s,a),this.authJsClient=new ra({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new ga(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===v&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new qe,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||E,n=G(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(W(e)))}async _verifyIdToken(e,t,n){const r=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,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse(K(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Be.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(K(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 "'.concat(e.iss,'", found "').concat(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 "'.concat(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 "'.concat(e.aud,'" but was not one of "').concat(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 "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(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 "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Me(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||!Me(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Me(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(o,")"));if(null!=t.claims.nbf&&Me(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)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 (".concat(r,") is after last auth at ").concat(o))}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 "'.concat(e,'", found "').concat(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 "'.concat(e,'", found "').concat(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:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_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})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=B(M()),i=B(M()),a=M(),s=await H(a),c=F(s),u=await(null===(r=this.dpop)||void 0===r?void 0:r.calculateThumbprint()),l=((e,t,n,r,o,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:Ie(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:r,nonce:o,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||A,redirect_uri:l.redirect_uri,state:o,url:d}}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=".concat(e,",top=").concat(t,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(),!t.popup))throw new C;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new I(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new k(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(T.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new T("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}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(){var e;const t=rt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=w(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),{url:u}=c,l=w(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:Ye.Code}),a&&{organization:a}));const d=r?"".concat(u,"#").concat(r):u;n?await n(d):window.location.assign(d)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new T("missing_transaction","Invalid state");this.transactionManager.remove();const n=(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,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===Ye.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:r,error:o,error_description:i}=e;if(o)throw new _(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new T("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:Ye.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new O(o,i||o,t.connection,r,t.appState);if(!n)throw new T("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new T("state_mismatch","Invalid state");const a=await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},a),{appState:t.appState,response_type:Ye.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(et))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(et)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ie(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,(null===(n=e.authorizationParams)||void 0===n?void 0:n.audience)||this.options.authorizationParams.audience)})}),o=await((e,t)=>{let n=Qe[t];return n||(n=e().finally(()=>{delete Qe[t],n=null}),Qe[t]=n),n})(()=>this._getTokenSilently(r),"".concat(this.options.clientId,"::").concat(r.authorizationParams.audience,"::").concat(r.authorizationParams.scope));return e.detailedResponse?o:null==o?void 0:o.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=w(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||A,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const r=(o=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(o,".").concat(i));var o,i;try{return await this.lockManager.runWithLock(r,5e3,async()=>{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||A,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,token_type:o,access_token:i,oauthTokenScope:a,expires_in:s}=e;return Object.assign(Object.assign({id_token:r,token_type:o,access_token:i},a?{scope:a}:null),{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(n);throw e}}_isInteractiveError(e){return e instanceof N||e instanceof T&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&"Multifactor authentication required"===e.error_description}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||A,clientId:this.options.clientId});if(!t)throw new T("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ie(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(r=e.authorizationParams)||void 0===r?void 0:r.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},g),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new Pe({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||A,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=w(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(W(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||A,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let{baseUrl:n,timeout:r,auth0Client:o,useFormData:i,refreshTokens:a,audience:s,client_id:c,onRefreshTokenRevoked:u}=e;const l=r||b,d="refresh_token",h="".concat(n,"/oauth/revoke"),p={"Content-Type":i?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(G(o||E)))};if(t){const n={client_id:c,token_type_hint:d},r=i?W(n):JSON.stringify(n);try{return await Ae({type:"revoke",timeout:l,fetchUrl:h,fetchOptions:{method:"POST",body:r,headers:p},useFormData:i,auth:{audience:null!=s?s:A}},t)}catch(e){throw new T("revoke_error",e.message)}}for(const t of a){const n={client_id:c,token_type_hint:d,token:t},r=i?W(n):JSON.stringify(n),o=await Te(h,{method:"POST",body:r,headers:p},l);if(!o.ok){let t,n;try{({error:t,error_description:n}=JSON.parse(await o.text()))}catch(e){}throw new T(t||"revoke_error",n||"HTTP error ".concat(o.status))}await(null==u?void 0:u(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=rt(e),{openUrl:r}=n,o=w(n,["openUrl"]);if(null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.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(Ne),await(null===(t=this.dpop)||void 0===t?void 0:t.clear()),this.worker)try{await Ae({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new T("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const h=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{o(new R),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?o(T.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,d,l);if(o!==h.state)throw new T("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:h.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return Object.assign(Object.assign({},p),{scope:c,oauthTokenScope:p.scope,audience:u})})}catch(e){throw"login_required"===e.error&&(e instanceof T&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new Pe({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||A,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new P(e.authorizationParams.audience||A,e.authorizationParams.scope)}const o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,a=((e,t,n,r)=>{var o;if(e&&n&&r){if(t.audience!==n)return t.scope;const e=r.split(" "),i=(null===(o=t.scope)||void 0===o?void 0:o.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{const t=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:o}),i&&{timeout:i}),{scopesToRequest:a});if(t.refresh_token&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,t.refresh_token),this.options.useMrrt&&!(s=null==r?void 0:r.audience,c=null==r?void 0:r.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,s===u&&ot(l,c)||ot(a,t.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const n=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],r=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==r.indexOf(e)).join(",")})(a,t.scope);throw new L(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||A})}catch(r){if(r.message){if(r.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),r;if((r.message.includes("Missing Refresh Token")||r.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw r instanceof N&&this.mfa.setMFAAuthDetails(r.mfa_token,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.audience,r.mfa_requirements),r}var s,c,u,l}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,r=w(e,["id_token","decodedToken"]);this.userCache.set(Ne,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||A,t=this.scope[e],n=await this.cacheManager.getIdToken(new Pe({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(Ne);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(Ne,n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new Pe({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:r}=i,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}async _requestToken(e,t){var n,r;const{nonceIn:o,organization:i,scopesToRequest:a}=t||{},s=await Re(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:a||e.scope}),this.worker),c=await this._verifyIdToken(s.id_token,o,i);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(r=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===r?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ne))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||A}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:c})}async loginWithCustomTokenExchange(e){return this._requestToken(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:Ie(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new ut(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null===(t=null==e?void 0:e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:r,scopes:o,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!r)throw new Error("connection is required");const s=B(M()),c=M(),u=await H(c),l=F(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:r,response_type:Ye.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,r=w(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function va(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ea}=Object.prototype,{getPrototypeOf:Sa}=Object,{iterator:Aa,toStringTag:Ta}=Symbol,_a=(Oa=Object.create(null),e=>{const t=Ea.call(e);return Oa[t]||(Oa[t]=t.slice(8,-1).toLowerCase())});var Oa;const Ra=e=>(e=e.toLowerCase(),t=>_a(t)===e),ka=e=>t=>typeof t===e,{isArray:Ia}=Array,Ca=ka("undefined");function Na(e){return null!==e&&!Ca(e)&&null!==e.constructor&&!Ca(e.constructor)&&xa(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Pa=Ra("ArrayBuffer");const La=ka("string"),xa=ka("function"),Ua=ka("number"),Da=e=>null!==e&&"object"==typeof e,Ma=e=>{if("object"!==_a(e))return!1;const t=Sa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ta in e||Aa in e)},Ba=Ra("Date"),ja=Ra("File"),Ga=Ra("Blob"),Wa=Ra("FileList");const Ha="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Ka=void 0!==Ha.FormData?Ha.FormData:void 0,Fa=Ra("URLSearchParams"),[Xa,Ja,Va,za]=["ReadableStream","Request","Response","Headers"].map(Ra);function Ya(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Ia(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const qa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Qa=e=>!Ca(e)&&e!==qa;const $a=(es="undefined"!=typeof Uint8Array&&Sa(Uint8Array),e=>es&&e instanceof es);var es;const ts=Ra("HTMLFormElement"),ns=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),rs=Ra("RegExp"),os=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ya(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const is=Ra("AsyncFunction"),as=(ss="function"==typeof setImmediate,cs=xa(qa.postMessage),ss?setImmediate:cs?(us=`axios@${Math.random()}`,ls=[],qa.addEventListener("message",({source:e,data:t})=>{e===qa&&t===us&&ls.length&&ls.shift()()},!1),e=>{ls.push(e),qa.postMessage(us,"*")}):e=>setTimeout(e));var ss,cs,us,ls;const ds="undefined"!=typeof queueMicrotask?queueMicrotask.bind(qa):"undefined"!=typeof process&&process.nextTick||as,hs={isArray:Ia,isArrayBuffer:Pa,isBuffer:Na,isFormData:e=>{if(!e)return!1;if(Ka&&e instanceof Ka)return!0;const t=Sa(e);if(!t||t===Object.prototype)return!1;if(!xa(e.append))return!1;const n=_a(e);return"formdata"===n||"object"===n&&xa(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Pa(e.buffer),t},isString:La,isNumber:Ua,isBoolean:e=>!0===e||!1===e,isObject:Da,isPlainObject:Ma,isEmptyObject:e=>{if(!Da(e)||Na(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Xa,isRequest:Ja,isResponse:Va,isHeaders:za,isUndefined:Ca,isDate:Ba,isFile:ja,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ga,isRegExp:rs,isFunction:xa,isStream:e=>Da(e)&&xa(e.pipe),isURLSearchParams:Fa,isTypedArray:$a,isFileList:Wa,forEach:Ya,merge:function e(...t){const{caseless:n,skipUndefined:r}=Qa(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Za(o,i)||i,s=ns(o,a)?o[a]:void 0;Ma(s)&&Ma(t)?o[a]=e(s,t):Ma(t)?o[a]=e({},t):Ia(t)?o[a]=t.slice():r&&Ca(t)||(o[a]=t)};for(let e=0,n=t.length;e(Ya(t,(t,r)=>{n&&xa(t)?Object.defineProperty(e,r,{__proto__:null,value:va(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Sa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:_a,kindOfTest:Ra,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ia(e))return e;let t=e.length;if(!Ua(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Aa]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ts,hasOwnProperty:ns,hasOwnProp:ns,reduceDescriptors:os,freezeMethods:e=>{os(e,(t,n)=>{if(xa(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];xa(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Ia(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Za,global:qa,isContextDefined:Qa,isSpecCompliantForm:function(e){return!!(e&&xa(e.append)&&"FormData"===e[Ta]&&e[Aa])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Da(e)){if(t.indexOf(e)>=0)return;if(Na(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Ia(e)?[]:{};return Ya(e,(e,t)=>{const i=n(e,r+1);!Ca(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:is,isThenable:e=>e&&(Da(e)||xa(e))&&xa(e.then)&&xa(e.catch),setImmediate:as,asap:ds,isIterable:e=>null!=e&&xa(e[Aa])},ps=hs.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),fs=e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ps[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};(Object.getOwnPropertyDescriptor(fs,"name")||{}).writable||Object.defineProperty(fs,"name",{value:"default",configurable:!0});const ms=Symbol("internals"),ys=/[^\x09\x20-\x7E\x80-\xFF]/g;function ws(e){return e&&String(e).trim().toLowerCase()}function gs(e){return!1===e||null==e?e:hs.isArray(e)?e.map(gs):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(ys,""))}function bs(e,t,n,r,o){return hs.isFunction(r)?r.call(this,t,n):(o&&(t=n),hs.isString(t)?hs.isString(r)?-1!==t.indexOf(r):hs.isRegExp(r)?r.test(t):void 0:void 0)}class vs{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ws(t);if(!o)throw new Error("header name must be a non-empty string");const i=hs.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=gs(e))}const i=(e,t)=>hs.forEach(e,(e,n)=>o(e,n,t));if(hs.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(hs.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(fs(e),t);else if(hs.isObject(e)&&hs.isIterable(e)){let n,r,o={};for(const t of e){if(!hs.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?hs.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ws(e)){const n=hs.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(hs.isFunction(t))return t.call(this,e,n);if(hs.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ws(e)){const n=hs.findKey(this,e);return!(!n||void 0===this[n]||t&&!bs(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ws(e)){const o=hs.findKey(n,e);!o||t&&!bs(0,n[o],o,t)||(delete n[o],r=!0)}}return hs.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!bs(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return hs.forEach(this,(r,o)=>{const i=hs.findKey(n,o);if(i)return t[i]=gs(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=gs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return hs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&hs.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ms]=this[ms]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ws(e);t[r]||(!function(e,t){const n=hs.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return hs.isArray(e)?e.forEach(r):r(e),this}}vs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),hs.reduceDescriptors(vs.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),hs.freezeMethods(vs);const Es=vs;function Ss(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(hs.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof Es&&(e=e.toJSON()),r.push(e),hs.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);hs.isUndefined(r)||(t[n]=r)});else{if(!hs.isPlainObject(e)&&function(e){if(hs.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(hs.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);hs.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class As extends Error{static from(e,t,n,r,o,i){const a=new As(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&hs.hasOwnProp(e,"redact")?e.redact:void 0,n=hs.isArray(t)&&t.length>0?Ss(e,t):hs.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}As.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",As.ERR_BAD_OPTION="ERR_BAD_OPTION",As.ECONNABORTED="ECONNABORTED",As.ETIMEDOUT="ETIMEDOUT",As.ECONNREFUSED="ECONNREFUSED",As.ERR_NETWORK="ERR_NETWORK",As.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",As.ERR_DEPRECATED="ERR_DEPRECATED",As.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",As.ERR_BAD_REQUEST="ERR_BAD_REQUEST",As.ERR_CANCELED="ERR_CANCELED",As.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",As.ERR_INVALID_URL="ERR_INVALID_URL",As.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Ts=As;var _s=n(8287).hp;function Os(e){return hs.isPlainObject(e)||hs.isArray(e)}function Rs(e){return hs.endsWith(e,"[]")?e.slice(0,-2):e}function ks(e,t,n){return e?e.concat(t).map(function(e,t){return e=Rs(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Is=hs.toFlatObject(hs,{},null,function(e){return/^is[A-Z]/.test(e)});const Cs=function(e,t,n){if(!hs.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=hs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!hs.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&hs.isSpecCompliantForm(t);if(!hs.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(hs.isDate(e))return e.toISOString();if(hs.isBoolean(e))return e.toString();if(!u&&hs.isBlob(e))throw new Ts("Blob is not supported. Use a Buffer instead.");return hs.isArrayBuffer(e)||hs.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):_s.from(e):e}function d(e,n,o){let s=e;if(hs.isReactNative(t)&&hs.isReactNativeBlob(e))return t.append(ks(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(hs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(hs.isArray(e)&&function(e){return hs.isArray(e)&&!e.some(Os)}(e)||(hs.isFileList(e)||hs.endsWith(n,"[]"))&&(s=hs.toArray(e)))return n=Rs(n),s.forEach(function(e,r){!hs.isUndefined(e)&&null!==e&&t.append(!0===a?ks([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Os(e)||(t.append(ks(o,n,i),l(e)),!1)}const h=[],p=Object.assign(Is,{defaultVisitor:d,convertValue:l,isVisitable:Os});if(!hs.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!hs.isUndefined(n)){if(i>c)throw new Ts("Object is too deeply nested ("+i+" levels). Max depth: "+c,Ts.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),hs.forEach(n,function(n,a){!0===(!(hs.isUndefined(n)||null===n)&&o.call(t,n,hs.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function Ns(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ps(e,t){this._pairs=[],e&&Cs(e,this,t)}const Ls=Ps.prototype;Ls.append=function(e,t){this._pairs.push([e,t])},Ls.toString=function(e){const t=e?function(t){return e.call(this,t,Ns)}:Ns;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const xs=Ps;function Us(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ds(e,t,n){if(!t)return e;const r=n&&n.encode||Us,o=hs.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):hs.isURLSearchParams(t)?t.toString():new xs(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Ms=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){hs.forEach(this.handlers,function(t){null!==t&&e(t)})}},Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},js={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:xs,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Gs="undefined"!=typeof window&&"undefined"!=typeof document,Ws="object"==typeof navigator&&navigator||void 0,Hs=Gs&&(!Ws||["ReactNative","NativeScript","NS"].indexOf(Ws.product)<0),Ks="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Fs=Gs&&window.location.href||"http://localhost",Xs={...e,...js};const Js=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&hs.isArray(r)?r.length:i,s)return hs.hasOwnProp(r,i)?r[i]=hs.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;r[i]&&hs.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&hs.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return hs.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Vs=(e,t)=>null!=e&&hs.hasOwnProp(e,t)?e[t]:void 0;const zs={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=hs.isObject(e);o&&hs.isHTMLForm(e)&&(e=new FormData(e));if(hs.isFormData(e))return r?JSON.stringify(Js(e)):e;if(hs.isArrayBuffer(e)||hs.isBuffer(e)||hs.isStream(e)||hs.isFile(e)||hs.isBlob(e)||hs.isReadableStream(e))return e;if(hs.isArrayBufferView(e))return e.buffer;if(hs.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Vs(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cs(e,new Xs.classes.URLSearchParams,{visitor:function(e,t,n,r){return Xs.isNode&&hs.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=hs.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Vs(this,"env"),r=n&&n.FormData;return Cs(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(hs.isString(e))try{return(t||JSON.parse)(e),hs.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Vs(this,"transitional")||zs.transitional,n=t&&t.forcedJSONParsing,r=Vs(this,"responseType"),o="json"===r;if(hs.isResponse(e)||hs.isReadableStream(e))return e;if(e&&hs.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Vs(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Ts.from(e,Ts.ERR_BAD_RESPONSE,this,null,Vs(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xs.classes.FormData,Blob:Xs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};hs.forEach(["delete","get","head","post","put","patch","query"],e=>{zs.headers[e]={}});const Ys=zs;function Zs(e,t){const n=this||Ys,r=t||n,o=Es.from(r.headers);let i=r.data;return hs.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function qs(e){return!(!e||!e.__CANCEL__)}const Qs=class extends Ts{constructor(e,t,n){super(e??"canceled",Ts.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $s(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Ts("Request failed with status code "+n.status,n.status>=400&&n.status<500?Ts.ERR_BAD_REQUEST:Ts.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ec=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},nc=(e,t,n=3)=>{let r=0;const o=ec(50,250);return tc(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},rc=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},oc=e=>(...t)=>hs.asap(()=>e(...t)),ic=Xs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Xs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Xs.origin),Xs.navigator&&/(msie|trident)/i.test(Xs.navigator.userAgent)):()=>!0,ac=Xs.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];hs.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),hs.isString(r)&&s.push(`path=${r}`),hs.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),hs.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function sc(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const cc=e=>e instanceof Es?{...e}:e;function uc(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return hs.isPlainObject(e)&&hs.isPlainObject(t)?hs.merge.call({caseless:r},e,t):hs.isPlainObject(t)?hs.merge({},t):hs.isArray(t)?t.slice():t}function o(e,t,n,o){return hs.isUndefined(t)?hs.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!hs.isUndefined(t))return r(void 0,t)}function a(e,t){return hs.isUndefined(t)?hs.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return hs.hasOwnProp(t,i)?r(n,o):hs.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(cc(e),cc(t),0,!0)};return hs.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=hs.hasOwnProp(c,r)?c[r]:o,a=i(hs.hasOwnProp(e,r)?e[r]:void 0,hs.hasOwnProp(t,r)?t[r]:void 0,r);hs.isUndefined(a)&&i!==s||(n[r]=a)}),n}const lc=["content-type","content-length"];const dc=e=>{const t=uc({},e),n=e=>hs.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=Es.from(s),t.url=Ds(sc(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),hs.isFormData(r)&&(Xs.hasStandardBrowserEnv||Xs.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):hs.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{lc.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Xs.hasStandardBrowserEnv){hs.isFunction(o)&&(o=o(t));if(!0===o||null==o&&ic(t.url)){const e=i&&a&&ac.read(a);e&&s.set(i,e)}}return t};(Object.getOwnPropertyDescriptor(dc,"name")||{}).writable||Object.defineProperty(dc,"name",{value:"default",configurable:!0});const hc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=dc(e);let o=r.data;const i=Es.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=Es.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());$s(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new Ts("Request aborted",Ts.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Ts(r,Ts.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Bs;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Ts(t,o.clarifyTimeoutError?Ts.ETIMEDOUT:Ts.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&hs.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),hs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=nc(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=nc(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new Qs(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const w=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!w||Xs.protocols.includes(w)?m.send(o||null):n(new Ts("Unsupported protocol "+w+":",Ts.ERR_BAD_REQUEST,e))})},pc=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Ts?t:new Qs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Ts(`timeout of ${t}ms exceeded`,Ts.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>hs.asap(a),s}},fc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of mc(e))yield*fc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var wc=n(8287).hp;const gc="1.16.0",{isFunction:bc}=hs,vc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ec=e=>{const t=hs.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=hs.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?bc(o):"function"==typeof fetch,c=bc(i),u=bc(a);if(!s)return!1;const l=s&&bc(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&vc(()=>{let e=!1;const t=new i(Xs.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&vc(()=>hs.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Ts(`Response type '${e}' is not supported`,Ts.ERR_NOT_SUPPORT,n)})});const y=async(e,t)=>{const n=hs.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(hs.isBlob(e))return e.size;if(hs.isSpecCompliantForm(e)){const t=new i(Xs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return hs.isArrayBufferView(e)||hs.isArrayBuffer(e)?e.byteLength:(hs.isURLSearchParams(e)&&(e+=""),hs.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:w,responseType:g,headers:b,withCredentials:v="same-origin",fetchOptions:E,maxContentLength:S,maxBodyLength:A}=dc(e);const T=hs.isNumber(S)&&S>-1,_=hs.isNumber(A)&&A>-1;let O=o||fetch;g=g?(g+"").toLowerCase():"text";let R=pc([u,l&&l.toAbortSignal()],d),k=null;const I=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==wc&&"function"==typeof wc.byteLength)return wc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>S)throw new Ts("maxContentLength size of "+S+" exceeded",Ts.ERR_BAD_RESPONSE,e,k)}if(_&&"get"!==n&&"head"!==n){const t=await y(b,s);if("number"==typeof t&&isFinite(t)&&t>A)throw new Ts("Request body larger than maxBodyLength limit",Ts.ERR_BAD_REQUEST,e,k)}if(w&&p&&"get"!==n&&"head"!==n&&0!==(C=await y(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(hs.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=rc(C,nc(oc(w)));s=yc(n.body,65536,e,t)}}hs.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(hs.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+gc,!1);const u={...E,signal:R,method:n.toUpperCase(),headers:b.normalize().toJSON(),body:s,duplex:"half",credentials:o?v:void 0};k=c&&new i(t,u);let l=await(c?O(k,E):O(t,u));if(T){const t=hs.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>S)throw new Ts("maxContentLength size of "+S+" exceeded",Ts.ERR_BAD_RESPONSE,e,k)}const d=f&&("stream"===g||"response"===g);if(f&&l.body&&(h||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=hs.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&rc(n,nc(oc(h),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>S))throw new Ts("maxContentLength size of "+S+" exceeded",Ts.ERR_BAD_RESPONSE,e,k);r&&r(t)};l=new a(yc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}g=g||"text";let N=await m[hs.findKey(m,g)||"text"](l,e);if(T&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>S)throw new Ts("maxContentLength size of "+S+" exceeded",Ts.ERR_BAD_RESPONSE,e,k)}return!d&&I&&I(),await new Promise((t,n)=>{$s(t,n,{data:N,headers:Es.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(I&&I(),R&&R.aborted&&R.reason instanceof Ts){const n=R.reason;throw n.config=e,k&&(n.request=k),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ts("Network Error",Ts.ERR_NETWORK,e,k,t&&t.response),{cause:t.cause||t});throw Ts.from(t,t&&t.code,e,k,t&&t.response)}}},Sc=new Map,Ac=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=Sc;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Ec(t)),u=s;return s},Tc=(Ac(),{http:null,xhr:hc,fetch:{get:Ac}});hs.forEach(Tc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const _c=e=>`- ${e}`,Oc=e=>hs.isFunction(e)||null===e||!1===e;const Rc={getAdapter:function(e,t){e=hs.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(_c).join("\n"):" "+_c(e[0]):"as no adapter specified";throw new Ts("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Tc};function kc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qs(null,e)}function Ic(e){kc(e),e.headers=Es.from(e.headers),e.data=Zs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Rc.getAdapter(e.adapter||Ys.adapter,e)(e).then(function(t){kc(e),e.response=t;try{t.data=Zs.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Es.from(t.headers),t},function(t){if(!qs(t)&&(kc(e),t&&t.response)){e.response=t.response;try{t.response.data=Zs.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Es.from(t.response.headers)}return Promise.reject(t)})}const Cc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Nc={};Cc.transitional=function(e,t,n){function r(e,t){return"[Axios v"+gc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Ts(r(o," has been removed"+(t?" in "+t:"")),Ts.ERR_DEPRECATED);return t&&!Nc[o]&&(Nc[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Cc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Pc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ts("options must be an object",Ts.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Ts("option "+i+" must be "+n,Ts.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ts("Unknown option "+i,Ts.ERR_BAD_OPTION)}},validators:Cc},Lc=Pc.validators;class xc{constructor(e){this.defaults=e||{},this.interceptors={request:new Ms,response:new Ms}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=uc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Pc.assertOptions(n,{silentJSONParsing:Lc.transitional(Lc.boolean),forcedJSONParsing:Lc.transitional(Lc.boolean),clarifyTimeoutError:Lc.transitional(Lc.boolean),legacyInterceptorReqResOrdering:Lc.transitional(Lc.boolean)},!1),null!=r&&(hs.isFunction(r)?t.paramsSerializer={serialize:r}:Pc.assertOptions(r,{encode:Lc.function,serialize:Lc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Pc.assertOptions(t,{baseUrl:Lc.spelling("baseURL"),withXsrfToken:Lc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&hs.merge(o.common,o[t.method]);o&&hs.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=Es.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;s=s&&e.synchronous;const n=t.transitional||Bs;n&&n.legacyInterceptorReqResOrdering?a.unshift(e.fulfilled,e.rejected):a.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[Ic.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Qs(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Dc(function(t){e=t});return{token:t,cancel:e}}}const Mc=Dc;const Bc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Bc).forEach(([e,t])=>{Bc[t]=e});const jc=Bc;const Gc=function e(t){const n=new Uc(t),r=va(Uc.prototype.request,n);return hs.extend(r,Uc.prototype,n,{allOwnKeys:!0}),hs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(uc(t,n))},r}(Ys);Gc.Axios=Uc,Gc.CanceledError=Qs,Gc.CancelToken=Mc,Gc.isCancel=qs,Gc.VERSION=gc,Gc.toFormData=Cs,Gc.AxiosError=Ts,Gc.Cancel=Gc.CanceledError,Gc.all=function(e){return Promise.all(e)},Gc.spread=function(e){return function(t){return e.apply(null,t)}},Gc.isAxiosError=function(e){return hs.isObject(e)&&!0===e.isAxiosError},Gc.mergeConfig=uc,Gc.AxiosHeaders=Es,Gc.formToJSON=e=>Js(hs.isHTMLForm(e)?new FormData(e):e),Gc.getAdapter=Rc.getAdapter,Gc.HttpStatusCode=jc,Gc.default=Gc;const Wc=Gc,Hc={AUTH0_SUB_COOKIE_KEY:"auth0_sub",ENTITLEMENT_COOKIE_KEY:"mng-entitlements",LOCAL_STORAGE_SESSION_KEY:"__MNG_Session",REGWALL_USER_IS_SUBSCRIBED:"regwallUserIsSubscribed",USER_IS_LOWA:"entitled",SLO_FLAG:"slo_flag",AB_TESTING_COOKIE:"_matheriSegs",ARTICLES_REMAINING_KEY:"articlesRemaining",USER_PROFILE_HASH:"user-profile"};function Kc(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return a("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return a("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return a("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(a("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return a("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var s=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){a("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),a("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(a("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();p(Fc,"DEFAULT_TIMEOUT",3e3);const Xc=new Fc;var Jc,Vc;function zc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Zc().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},$c=function(){var e=Qc();return".".concat(e)},eu=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(a("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},tu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=Qc(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},nu=function(){return Zc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},ru=function(e){return function(e,t){if("string"!=typeof e)throw new m("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new m(`Invalid token specified: missing part #${n+1}`);let o;try{o=y(r)}catch(e){throw new m(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new m(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},ou=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Qc().split(".")[0],e.prev=1,e.next=2,Wc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return a("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,s=e.catch(1),a("Apple Sub Check: Request Failure: ",s),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),iu=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Wc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(nu())),headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),au=function(){return"complete"===document.readyState},su=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(au())t();else{a("UIHandler: ","Waiting for the body to load...");var i=setInterval(r(o.mark(function r(){return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&(n=au()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},cu=function(){return new Promise(function(e){if(("interactive"===document.readyState||au())&&window.dataLayer)a("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{a("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},uu=function(){return new Promise(function(e){if("interactive"!==document.readyState&&"complete"!==document.readyState||!window.MG2DL){a("Utils mg2DataLayerLoaded:","Waiting for MG2DL to load...");var t=setInterval(function(){window.MG2DL&&window.MG2DL.length>0&&(clearInterval(t),e(!0))},50)}else a("Utils mg2DataLayerLoaded:","Document is in interactive state, resolving."),e()})},lu=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,cu();case 1:return a("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",a("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return a("Utils dataLayerLoop: look for this element ",e),e[t]?(a("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(a("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),du=function(){var e=r(o.mark(function e(){var t,n,r,i=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:[],e.next=1,cu();case 1:if(a("Utils getMultipleDataLayerObjects: looking for these keys ",t),window.dataLayer=window.dataLayer||[],n={},a("Utils getDataLayerObjects: dataLayer length",window.dataLayer.length),r=function(e){a("Utils dataLayerLoop: look for this element ",e);var r=!1;return t.forEach(function(t){void 0!==e[t]?(a("Utils dataLayerLoop: found ".concat(t,":"),e[t]),n[t]=e[t],r=!0):a("Utils dataLayerLoop: ".concat(t," not found in this element"))}),t.every(function(e){return void 0!==n[e]})?(a("Utils dataLayerLoop: all requested keys found, stopping search"),!0):r},!(window.dataLayer.some(r)&&Object.keys(n).length>0)){e.next=2;break}return a("Utils getDataLayerObjects: final result",n),e.abrupt("return",n);case 2:return a("Utils getDataLayerObjects: none of the keys were found"),e.abrupt("return",!1);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),hu=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,lu(t);case 1:return n=e.sent,a("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),pu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return a("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){a("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),a("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),fu=function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Xc.blueConicReady();case 1:if(t=e.sent,a("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,pu();case 2:if(n=e.sent,a("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return r=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){r.loadValues(["auth0_id"],null,function(){e()})});case 4:return i=r.getValue("auth0_id"),a("bcGetAuth0Id | auth0_id:",i),e.abrupt("return",i);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),mu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]&&h[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Xc.blueConicReady();case 1:if(s=e.sent,a("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(c=window.blueConicClient.getSegments(),a("bcLowaCheck | BC segments for users: ",c),u=c.filter(function(e){return i.includes(e.name)}),a("bcLowaCheck | BC userSubSegments: ",u),!(u.length>0)){e.next=3;break}return e.next=2,fu();case 2:(l=e.sent)&&(n=!0,r=l);case 3:return t&&n&&yu(),d={isSub:n},r&&(d.uuid=r),e.abrupt("return",d);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yu=function(){eu("bc_lowa_status",1,{path:"/",domain:$c(),expires:7,secure:!0})},wu=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(a("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(a("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};a("utils | Event: authentication ready: ",r),e(r)}catch(e){a(e),t(e)}},!1))})},gu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return i.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(a("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,a("Received entitlementsReady event:",r),e(r)}catch(e){s("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(a("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bu=function(){tu(Hc.AUTH0_SUB_COOKIE_KEY),tu("mng-jwt-decoded"),localStorage.removeItem(Hc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){a("Clearing entitlements...");try{tu(Hc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){a("Failed to delete legacy cookie: ",e)}try{tu(Hc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:Qc(),expires:365,secure:!0})}catch(e){a("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Hc.LOCAL_STORAGE_SESSION_KEY)}catch(e){a("Failed to remove local storage: ",e)}}()},vu=function(){var e=Zc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},Eu=function(e){a("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),a("Storage Object removed : ",e))},Su=function(e){a("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return a("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Su;var Au;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Tu=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Au){e.next=1;break}return e.abrupt("return",Au);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Au=new ba({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",Au);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),_u=function(e){a("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,a("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),a("utils | Dispatched authenticationReady event"),Vc=new CustomEvent("mng-auth-check-complete",{detail:e}),Jc?(a("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(Vc)):a("Islands not ready")},Ou=function(e){if(void 0!==window.authentication_config){var t=window.authentication_config,n=Object.keys(t).filter(function(n){return n.includes(e)&&"1"===t[n]});return a("checkOneTapOptions: enabled options",n),n.length>0}return!1},Ru=function(e){return Number.isInteger(Number(e))};var ku=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Iu=function(){var e=r(o.mark(function e(t){var n,r,s,u,l,d;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a("deleteUserCache","Setting up cache deletion for ".concat(t)),n=nu(),a("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,Wc({method:"DELETE",url:"".concat(i.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:if(s=e.sent,u=s.data,l=/Succesfully deleted/i,!("object"===c(u)&&Object.prototype.hasOwnProperty.call(u,"message"))||!l.test(u.message)){e.next=2;break}return a("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return a("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),a("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(d)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),Cu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=r(o.mark(function r(){var s,c,u,l,d,h,p,f,m,y,w;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(s=window.sophi_config)||void 0===s?void 0:s.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:Yc({},i)}));case 1:return r.next=2,hu();case 2:return u=r.sent,r.next=3,lu("Paywall_Level");case 3:if(l=r.sent,"article"===u&&"free"!==l){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return r.next=5,gu();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,a("checkPaywallStatus - Sophi is running: ",h),!h){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:Yc({},i)})},{once:!0}),r.next=12;break;case 8:if(h){r.next=12;break}return p=window.ConnextUtils.connextReady("onPaywallShown",!1),f=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([p,f]);case 10:!0===(m=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m)),r.next=12;break;case 11:r.prev=11,y=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(y);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:Yc({},i)}));case 13:r.prev=13,w=r.catch(0),n(w);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Cu);var Nu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Xc.blueConicReady();case 1:return e.next=2,wu();case 2:return e.abrupt("return",new Promise(function(e){a("ANALYTICS: inside BCregwall events");var t=Zc();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Pu=function(){var e=r(o.mark(function e(t){var n,r,i,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{void 0!==(n=ru(t))&&n&&(a("ANALYTICS: Partner Access: JWT found"),r=n.entitlement_entitled,i=n.entitlement_source,s=n.entitlement_organizationTrackingId,c=n.entitlement_organizationType,a("ANALYTICS: Partner Access Event: Entitled: ".concat(r," and source: ").concat(i)),r&&"partner-access"===i&&(a("ANALYTICS: GA event for partner access"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"partnerAccess",partner:"".concat(s,"|").concat(c)})))}catch(e){a("ANALYTICS: Failed to send Partner Access event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Lu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{"yes"===localStorage.getItem("regwallEvent")&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"regwall_success"}),a("ANALYTICS: GA/ datalayer ",window.dataLayer),localStorage.removeItem("regwallEvent"))}catch(e){a("ANALYTICS: Failed to send Regwall Succuss Event: ",e)}case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),xu=function(){var e=r(o.mark(function e(t,n){var r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n.entitlements&&(r=ru(n.entitlements.token)),a("ANALYTICS: user state variables are: ",t,n.userState),i="known"===t&&n.userState?r&&r.entitlement_entitled?"comp"===r.entitlement_level||"freeTrial"===r.entitlement_level?"subscriber-".concat(r.entitlement_level):"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"known"!==t||n.userState?"unknown"===t||"unknown-default"===t||"unknown-fail"===t&&"noEntitlements"===n.userState?t:t&&n.userState?r&&r.entitlement_entitled?"".concat(n.userState).concat(r.entitlement_serviceCode?"-".concat(r.entitlement_serviceCode):""):n.userState:"noState":"known-entitlements-failed",a("ANALYTICS: user state is ",i),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Auth0State_event",Auth0State:i});case 1:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}(),Uu=function(){var e=r(o.mark(function e(){var t,n,r,i,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,wu();case 1:n=e.sent,r=n.isAuthenticated,i=r,e.next=!0===i?2:!1===i?3:i===Hc.USER_IS_LOWA?4:5;break;case 2:return t="known",e.abrupt("continue",6);case 3:return t="unknown",e.abrupt("continue",6);case 4:return t=Hc.USER_IS_LOWA,e.abrupt("continue",6);case 5:return t="unknown-default",e.abrupt("continue",6);case 6:return e.abrupt("return",t);case 7:return e.prev=7,s=e.catch(0),a("ANALYTICS: Error during onAuthReadyAnalytics: ",s),e.abrupt("return","unknown-fail");case 8:case"end":return e.stop()}},e,null,[[0,7]])}));return function(){return e.apply(this,arguments)}}(),Du=function(e){try{window.dataLayer.push({event:e}),a("ANALYTICS: ".concat(e," event")),a("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){a("ANALYTICS: Failed to send ".concat(e," event: "),t)}},Mu=function(e){try{var t={};Object.keys(e).forEach(function(n){t[n]=e[n]}),0!==Object.keys(t).length&&window.dataLayer.push(t),a("ANALYTICS: ".concat(e.event," event")),a("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){a("ANALYTICS: Failed to send ".concat(e.event," event: "),t)}},Bu=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={event:"one_tap_login",gotGroup:t,gotExperiment:e};switch(e){case"placement":n.gotDisplayPosition=window.authentication_config["got".concat(t,"ModalPosition")];break;case"scrolling":n.gotScrollDepthPercentage=window.authentication_config["got".concat(t,"GroupDepth")],n.gotDisplayPosition=window.authentication_config["got".concat(t,"GroupDelayPosition")];break;case"delayTime":n.gotTimeUntilDisplay=Math.floor(Ru(window.authentication_config["got".concat(t,"GroupTime")])?parseInt(window.authentication_config["got".concat(t,"GroupTime")],10):1);break;default:return n.event}return n},ju=function(e){try{var t={googleonetap:"one_tap_login",viafoura_signup:"viafoura_signup_success",viafoura_login:"viafoura_login_success"}[e];"one_tap_login"===t?(n=localStorage.getItem("abcdLocal"),r=localStorage.getItem("abcdeLocal"),o=Ou("GroupEnabled"),i=Ou("GroupDelayEnabled"),s=Ou("GroupTimeDelayEnabled"),c=Ou("got".concat(n,"GroupEnabled")),u=Ou("got".concat(r,"GroupDelayEnabled")),l=Ou("got".concat(n,"GroupTimeDelayEnabled")),d=/Windows|Macintosh|Mac OS X|Linux/.test(navigator.userAgent),n&&o&&c&&!i&&d&&!s?(a("ANALYTICS: Position event enabled"),Mu(Bu("placement",n))):r&&!o&&i&&u&&!s?(a("ANALYTICS: Scroll delay enabled"),Mu(Bu("scrolling",r))):n&&!o&&!i&&s&&l?(a("ANALYTICS: Time delay enabled"),Mu(Bu("delayTime",n))):(a("ANALYTICS: No custom event detected"),Du(Bu("default")))):Du(t)}catch(e){a("ANALYTICS: Event not setup",e)}var n,r,o,i,s,c,u,l,d},Gu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=!1,e.next=1,gu();case 1:if(!(n=e.sent)||!n.token){e.next=2;break}return r=n.token,i=n.isEntitled,s=n.adfree,a("ANALYTICS: entitlements options: ",i,s),!0===s&&a("ANALYTICS: user state: found ad free",s),!0===i?(a("ANALYTICS: user state: found subscriber"),t="subscriber"):(a("ANALYTICS: user state: LINA"),t="lina"),Pu(r),e.abrupt("return",{userState:t,entitlements:n});case 2:return e.abrupt("return","noEntitlements");case 3:return e.prev=3,c=e.catch(0),a("ANALYTICS:",c),e.abrupt("return","entitlementError");case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),Wu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Xc.blueConicReady();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Hu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("sspwG2iMeterEvent: initializing sspwG2iMeterEvent function"),e.next=1,hu();case 1:if("article"===e.sent){e.next=2;break}return a("sspwG2iMeterEvent: not an article page"),e.abrupt("return");case 2:return e.next=3,du(["Byline","Page Title","Section","Paywall_Level"]);case 3:if(!("free"!==(t=e.sent).Paywall_Level&&"1"===window.sophi_config.enableSophiSSPW||"premium"===t.Paywall_Level&&"1"===window.authentication_config.serverEntitlements)){e.next=5;break}return n="NOWALL",(r=document.querySelector("#server-paywall, #server-regwall, #nav-api-sspw, #nav-api-ssrw"))&&(a("sspwG2iMeterEvent: paywall element found: ",r.id),"server-paywall"===r.id||"nav-api-sspw"===r.id?n="SSPW":"server-regwall"!==r.id&&"nav-api-ssrw"!==r.id||(n="SSRW")),i="1"===window.sophi_config.enableSophiSSPW?"sophi":"sspw",s="SSPWV1","sophi"===i&&(s="nav-api-sspw"===r.id||"nav-api-ssrw"===r.id?"Sophi/Naviga_SSPW":"Sophi_SSPW"),c={event:"meterStop",author:t.Byline||"",title:t["Page Title"]||"",section:t.Section||"",actionType:s,actionName:n},a("sspwG2iMeterEvent: article data found on dataLayer: ",t),e.next=4,uu();case 4:window.MG2DL=window.MG2DL||[],window.MG2DL.push(c),a("sspwG2iMeterEvent: event pushed to MG2DL: ",window.MG2DL),e.next=6;break;case 5:a("sspwG2iMeterEvent: event not pushed, criteria not met");case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const Ku={onLoadAnalytics:function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("ANALYTICS: Start Analytics"),Lu(),window.MNGAuthentication.postAuthEvents=[],window.MNGAuthentication.preAuthGTMEvents=[],window.MNGAuthentication.postAuthEvents.push(ju),!((n=Zc()).pathname.startsWith("/logout")||n.pathname.startsWith("/login")||n.pathname.startsWith("/callback"))){e.next=1;break}return e.abrupt("return");case 1:return Wu(),e.next=2,Uu();case 2:return r=e.sent,e.next=3,Gu();case 3:i=e.sent,xu(r,i),"1"!==window.authentication_config.serverEntitlements&&"1"!==(null===(t=window.sophi_config)||void 0===t?void 0:t.enableSophiSSPW)||(a("ANALYTICS: SSPW is active, setting up analytics events."),Hu());case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),blueConicRegwallEvents:Nu,callPreparedGTMEvent:Du,callCustomGTMEvent:Mu};var Fu=function(){try{var e=localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){a("Unable to get session from local storage: ",e)}return"{}"},Xu=function(e){try{a("Setting local storage session",e),localStorage.setItem(Hc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){a("Unable to save session from local storage: ",e)}},Ju=function(e){try{eu(Hc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:$c(),expires:365,secure:!0})}catch(e){a("Unable to save session to cookie storage: ",e)}},Vu=function(){var e=r(o.mark(function e(){var t,n,r,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Checking server session: ",n),e.next=1,Wc.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return h=r.data.entitlementTokenDecoded,p=r.data,f=p.accessToken,m=p.idToken,y=p.entitlementToken,w=null!==(s=null==h?void 0:h.entitlement_expiry)&&void 0!==s?s:null,g=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,b=null!==(u=null==h?void 0:h.entitlement_entitled)&&void 0!==u?u:null,v=null!==(l=null==h?void 0:h.entitlement_extras_adfree)&&void 0!==l?l:null,E=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,Xu(JSON.stringify({accessToken:f,idToken:m,entitlementToken:y,expiration:w,entitlementSource:g,isEntitled:b,adFree:v,entitlementLevel:E})),""!==y&&"string"==typeof y&&Ju(y),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:y,expiration:w,entitlementSource:g,isEntitled:b,adFree:v,entitlementLevel:E});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),zu=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=i.A.sessionServer,r="".concat(n,"/api/session"),a("Updating server session: ",r),e.next=1,Wc.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),a("Failed to update session server: ",s);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Yu=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Deleting server session: ",n),e.next=1,Wc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),a("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),Zu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T,_,O,R,k,I,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Inside getSession"),e.prev=1,d=Fu(),a("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,y=h.expiration,w=h.entitlementSource,g=h.isEntitled,b=h.adFree,v=h.entitlementLevel,n=p,i=y,s=w,c=g,u=b,l=v,a("Session: check both tokens: ",t=f,r=m),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return a("Session: missing id or entitlements, try session server"),e.next=2,Vu();case 2:E=e.sent,S=E.accessToken,A=E.idToken,T=E.entitlementToken,_=E.expiration,O=E.entitlementSource,R=E.isEntitled,k=E.adFree,I=E.entitlementLevel,n=S,t=A,r=T,i=_,s=O,c=R,u=k,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),a("Failed to get session: ",C);case 5:return a("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:s,isEntitled:c,adFree:u,entitlementLevel:l});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),qu=function(){var e=r(o.mark(function e(t){var n,r,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T,_,O,R,k,I,C,N,P;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Fu(),r=JSON.parse(n),i=r.accessToken,s=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,h=r.expiration,p=void 0===h?null:h,f=r.entitlementSource,m=void 0===f?null:f,y=r.isEntitled,w=void 0===y?null:y,g=r.adFree,b=void 0===g?null:g,v=r.entitlementLevel,E=void 0===v?null:v,S=t.accessToken,A=t.idToken,T=t.entitlementToken,_=t.expiration,O=t.entitlementSource,R=t.isEntitled,k=t.adFree,I=t.entitlementLevel,C={accessToken:S??s,idToken:A??u,entitlementToken:T??d,expiration:_??p,entitlementSource:O??m,isEntitled:R??w,adFree:k??b,entitlementLevel:I??E},a("Current session data: ",r),a("New session data: ",t),a("Updated session data:",C),N=JSON.stringify(C),Xu(N),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&Ju(C.entitlementToken),n===N){e.next=1;break}return e.next=1,zu(C);case 1:e.next=3;break;case 2:e.prev=2,P=e.catch(0),a("Unable to save session: ",P);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Qu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Ending session..."),bu(),e.next=1,Yu();case 1:localStorage.removeItem(Hc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),$u="1"===window.authentication_config.isEmbedLoginEnabled,el=function(){return"logout"===(Zc().searchParams.get("state")||"").toLowerCase()};$u||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var tl=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Tu();case 1:n=e.sent,a("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),nl=function(){return"undefined"==typeof CnnXt?(a("Connext was not loaded."),!1):Connext.Storage.GetUserState()},rl=function(){a("Check for SS paywall Cookie");var e=window.location.hostname,t=document.cookie.split(";").find(function(e){return e.trim().startsWith("vip-go-seg=vc-v1__has_access")});if(/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.?)+[a-zA-Z]{2,6}$/.test(e)&&t){a("SS paywall Cookie found, removing it");var n=t.split("=")[0].trim();document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=").concat(e),document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}},ol=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Attempting to logout..."),rl(),a("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?ru(n):"")){e.next=2;break}return s=i.auth0Id,e.next=1,Iu(s);case 1:e.sent.success?a("User cache cleared."):a("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,Qu();case 3:e.next=5;break;case 4:bu();case 5:return e.prev=5,a("Cycling through logout callbacks..."),c=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(c);case 6:a("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,p=e.catch(5),a("Failed to cycle through logout callbacks: ",p);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),a("Removed Auth0 storage object...")}),Eu("hhsl"),Eu("userNewsLetterData"),Eu(Hc.REGWALL_USER_IS_SUBSCRIBED),Eu(Hc.USER_PROFILE_HASH),u=Zc(),l=window.location.origin;try{u.searchParams.get("returnURL")&&(d=decodeURIComponent(u.searchParams.get("returnURL")),l=d)}catch(e){a(e),l=window.location.origin}return l=new URL(l),e.next=9,window.ConnextUtils.connextReady("onInit",!1);case 9:if(!e.sent){e.next=16;break}if(a("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),a("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),h=l,l.origin!==window.location.origin&&(h=new URL(window.location.origin)).searchParams.append("returnAfterLogout",l),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",h),!vu()){e.next=10;break}a("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==nl()){e.next=14;break}if(a("Connext user state is logged in, setting timeout..."),setTimeout(r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Connext took too long to logout, calling auth0 logout..."),e.next=1,tl(l);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return a("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return a("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return a("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,tl(l);case 15:e.next=17;break;case 16:return a("Connext Logout was NOT called"),e.next=17,tl(l);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),il=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},al=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Du(e)}),a("Cycled through preauth GTM events.")},sl=function(){var e=r(o.mark(function e(t,n,r,i,s){var c,u,l,h,p,f,m,y,w,g,b,v,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Attempting to login..."),il()>4.5&&window.localStorage.clear(),al(),i&&(c=[],u=window.localStorage.getItem("callbackEvents"),l=JSON.parse(u),c=l&&l.length>0?d(new Set([].concat(d(i),d(l)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),h=null,e.next=1,Tu();case 1:if(p=e.sent,f=Zc(),m=f.origin,y=new URL("".concat(m,"/callback")),w={},f.searchParams.get("regwall")&&(f.searchParams.get("returnUrl")&&(g=f.searchParams.get("returnUrl")),f.searchParams.get("auth_redirect")&&(g=f.searchParams.get("auth_redirect"))),f.pathname.startsWith("/login")||f.pathname.startsWith("/callback")?f.searchParams.get("returnUrl")?y.searchParams.set("auth_redirect",f.searchParams.get("returnUrl")):s&&y.searchParams.set("auth_redirect",s):y.searchParams.set("auth_redirect",f.toString()),g&&"regwall"!==t&&y.searchParams.set("auth_redirect",g),"true"===f.searchParams.get("close-after-finish")&&y.searchParams.set("close-after-finish","true"),"true"!==f.searchParams.get("ssl")){e.next=4;break}if(!window.authentication_config.sessionManagementEnabled){e.next=3;break}return e.next=2,Qu();case 2:e.next=4;break;case 3:bu();case 4:return null!==(h=f.searchParams.get("login-with"))?w.connection=h:n&&(w.connection=n),b="none",t&&"regwall"===t&&(y.searchParams.set("regwall","true"),b="signUp",a("Logging in with regwall")),t&&(y.searchParams.set("loginsource",t),a("Logging in with ".concat(t))),r&&(w.login_hint=r),w.redirect_uri=y.toString(),w.initialScreen=b,"googleonetap"!==t&&(w.prompt="select_account"),null!==(v=f.searchParams.get("ampRegiWall"))&&(E=window.location.hostname,w.ampRegiWall=v,w.sourceDomain=E.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),w.initialScreen="signUp",w.preferenceId=f.searchParams.get("prefId")),e.next=5,p.loginWithRedirect({authorizationParams:w});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),cl=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),r=JSON.parse(n);if(!r||0===r.length)return void e();a("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){a("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};a("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){a(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){a("Failed to wait for callback events",t),e()}})},ul=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T,_;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(rl(),t=Zc(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=t.searchParams.get("redirect_uri")||"",s.includes("applenews")?(a("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),a("Post callback Apple redirect URL is ".concat(c)),sl(!1,!1,!1,[],c)):sl()):i.includes("post-apple-login")&&(a("This is Apple Callback flow."),n=!0,(u=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=u),a("Handling post login callback..."),!(l=t.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==l){e.next=1;break}return e.abrupt("return",sl(!1,!1,!1,!1,i));case 1:n&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Tu();case 3:return d=e.sent,e.next=4,d.handleRedirectCallback();case 4:return e.next=5,d.getIdTokenClaims();case 5:return h=e.sent,e.next=6,d.getUser();case 6:return p=e.sent,a("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,a("Cycling through login callbacks..."),e.next=9,cl();case 9:return y=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(f));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(y);case 10:a("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,A=e.catch(8),a("Failed to cycle through login callbacks: ",A);case 12:if(w={accessToken:m,userId:p.sub,email:p.email,picture:p.picture},g=!1,b="",!n){e.next=17;break}return e.prev=13,e.next=14,iu(w.userId);case 14:return b=e.sent,a("Encrypted apple uuid is: ".concat(b)),e.next=15,ou(b);case 15:g=e.sent,a("Apple sub status is: ".concat(g)),e.next=17;break;case 16:e.prev=16,T=e.catch(13),a("Apple sub check error: ".concat(T)),alert("There was an error in logging you in, please try again.");case 17:if(Eu(Hc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return a("Saving idToken to session server"),e.next=18,qu({idToken:f,accessToken:m});case 18:if(!t.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!t.search.includes("loginsource")){e.next=20;break}return v=t.searchParams.get("loginsource"),E=window.MNGAuthentication.postAuthEvents.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(v));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(E);case 20:return e.prev=20,S=new URL(i),n&&g&&S.searchParams.append("access_token",b),a("Apple redirect URL:",S),e.abrupt("return",window.location.assign(S));case 21:return e.prev=21,_=e.catch(20),a("Failed to redirect after authentication: ",_),window.location.assign(new URL(window.location.origin)),e.abrupt("return","Finished execution, please await result...");case 22:case"end":return e.stop()}},e,null,[[8,11],[13,16],[20,21]])}));return function(){return e.apply(this,arguments)}}(),ll=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("ANALYTICS: fireBC events"),e.next=1,Nu();case 1:a("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),dl=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,wu();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=ru(n),c=s.email,u=s.picture,l=s.sub,d=s.name,h=s.nickname,p=s.connection_source,f=null===(i=s.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,l.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:f||h||d,email:c,picture:u,userId:l,connectionSource:p});case 3:e.prev=3,m=e.catch(2),a("Unable to parse idToken: ",n," Error: ",m);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();$u||(window.MNGAuthentication.login=sl,window.MNGAuthentication.logout=ol,window.MNGAuthentication.getUserInfo=dl);var hl=function(){var e=r(o.mark(function e(){var t,n,s,u,l,d,h,p,f,m,y,w,g;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!$u){e.next=1;break}return a("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(t=Zc(),n=!1,s="",u=!1,l={},el()&&window.ConnextUtils.rerunConnextEntitlements(!0),t.searchParams.get("returnAfterLogout")&&(d=decodeURIComponent(t.searchParams.get("returnAfterLogout")),window.location.assign(d)),t.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),h=function(){var e=r(o.mark(function e(){var t,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Tu();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return l=e.sent,e.next=3,t.isAuthenticated();case 3:if(n=e.sent,s="object"===c(l)?l.__raw:"",r=qc(Hc.ENTITLEMENT_COOKIE_KEY),n||!r){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:u=e.sent;case 5:e.next=7;break;case 6:e.prev=6,i=e.catch(0),a("Unable to verify user has active auth0 session: ",i);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!t.pathname.startsWith("/logout")){e.next=3;break}return a("Page is logout. Routing to logout function..."),e.next=2,ol();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,h();case 4:if(""===s){e.next=6;break}if(p=null,f=JSON.parse(window.localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Fu()){e.next=5;break}return f&&(p=f.jwt),e.next=5,qu({idToken:s,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,Zu();case 7:m=e.sent,s=m.idToken,(n="string"==typeof s)&&(l=ru(s)),e.next=9;break;case 8:e.prev=8,g=e.catch(6),a("Unable to initialize session: ",g);case 9:e.next=11;break;case 10:return e.next=11,h();case 11:if(a("Authentication Init | isAuthenticated:",n),a("Authentication Init | accessToken:",u),n||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=13;break}return a("BlueConic LOWA | entering bcLowaCheck"),e.next=12,mu(!0);case 12:y=e.sent,a("BlueConic LOWA | bcLowaCheck result:",y),y.isSub?(a("BlueConic LOWA | authenticated as LOWA"),n=Hc.USER_IS_LOWA,l={sub:y.uuid}):a("BlueConic LOWA | NOT a subscriber");case 13:if(_u({isAuthenticated:n,idToken:s,accessToken:u,claims:l}),ku("authenticationReady"),!0===n?(a("User is authenticated."),t.searchParams.get("auth_redirect")&&(a("Auth Redirect is present, sending user to auth redirect..."),(w=t.searchParams.get("auth_redirect")).endsWith("#")&&(w=w.slice(0,w.length)),window.location.assign(w)),t.pathname.startsWith("/login")&&!el()&&(a("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):a("User is not authenticated."),t.pathname.startsWith("/login")&&!el()?(a("Page is login. Attempting to log user in..."),sl()):a("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=15;break}return a("Page is callback with regwall param. Routing to regwall receiver..."),e.next=14,ll();case 14:a("Now login from regwall"),sl(),e.next=16;break;case 15:if(!t.pathname.startsWith("/callback")){e.next=16;break}return a("Page is callback without regwall param. Routing to callback receiver..."),e.next=16,ul();case 16:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=hl;const pl={init:hl};var fl=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(a("Connext was not loaded."),n(!1)),a("connext subscribeToNewsletter","about to call Cnnxt NewsletterSubscribe with pref id ".concat(t," and email ").concat(e)),CnnXt.API.NewsletterSubscribe({email:e,id:t,onSuccess:function(){a("Signed user up to newsletter: ",t),n(!0)},onError:function(e){a("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){a("subscribeToNewsletter Error:",e),n(!1)}})};var ml=function(){var e=r(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Google token ",t),n=ru(t.credential),e.prev=1,Du("one_tap_click"),localStorage.setItem("regwallSuccess","yes"),!i.A.newsletterId){e.next=2;break}return a("About to call Connext's subscribeToNewsletter function"),e.next=2,fl(n.email,i.A.newsletterId);case 2:e.next=4;break;case 3:e.prev=3,r=e.catch(1),a("Error: ",r);case 4:return a("About to login with onetap flow..."),e.next=5,window.MNGAuthentication.login("googleonetap",i.A.useTribMainGoogle?"Trib-Google":"google-oauth2",n.email);case 5:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),yl=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:google.accounts.id.initialize({client_id:i.A.googleClientId,callback:ml,auto_select:!1,cancel_on_tap_outside:!1}),a("Showing the onetap modal..."),google.accounts.id.prompt(function(e){var t;e.isDisplayed()?t="one_tap_displayed":e.isSkippedMoment()?t="one_tap_cancel":e.isNotDisplayed()&&"suppressed_by_user"===e.j&&(t="one_tap_auto_hide"),Du(t)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const wl={init:function(){var e=r(o.mark(function e(){var t,n,r,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.A.oneTapEnabled){e.next=1;break}return e.abrupt("return");case 1:return e.next=2,wu();case 2:if(t=e.sent,n=t.isAuthenticated,r=Zc(),n!==Hc.USER_IS_LOWA){e.next=5;break}return e.next=3,fu();case 3:if(!(s=e.sent)||s.includes("google")){e.next=4;break}return e.abrupt("return");case 4:e.next=6;break;case 5:if(!(n||r.pathname.startsWith("/login")||r.pathname.startsWith("/logout")||r.pathname.startsWith("/callback"))){e.next=6;break}return e.abrupt("return");case 6:return e.next=7,su();case 7:return a("onetap loading..."),c=new Date,e.next=8,yl(c);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Settings: ",i.A),pl.init(),Ku.onLoadAnalytics(),e.next=1,wl.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.main.bundle.js.map; /*! For license information please see mng-digisubs.connext.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return k(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function _(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const R=4096;function k(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){G(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function W(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){G(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function G(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw G(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}K("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),K("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),K("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=H(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=H(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(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},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>Ds,hasStandardBrowserEnv:()=>Bs,hasStandardBrowserWebWorkerEnv:()=>js,navigator:()=>Ms,origin:()=>Ks});var o=n(4756);function i(e){return i="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},i(e)}function a(e){var t=function(e,t){if("object"!=i(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==i(t)?t:t+""}function s(e,t,n){return(t=a(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function p(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);oDate.now(),b="default";class v extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,v.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new v(t,n)}}class E extends v{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,E.prototype)}}class S extends v{constructor(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=o,Object.setPrototypeOf(this,S.prototype)}}class A extends v{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,A.prototype)}}class T extends A{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,T.prototype)}}class _ extends v{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,_.prototype)}}class O extends v{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,O.prototype)}}class R extends v{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,R.prototype)}}class k extends v{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(N(e,["default"]),"', scope: '").concat(N(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,k.prototype)}}class I extends v{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(N(e,["default"]),"', missing scope: '").concat(N(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,I.prototype)}}class C extends v{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,C.prototype)}}function N(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const P=()=>window.crypto,L=()=>{let e="";for(;e.length<43;){const t=P().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},x=e=>btoa(e),U=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],D=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;const o=U.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},M=e=>{var{clientId:t}=e,n=p(e,["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:t},n))).toString()},B=async e=>{const t=P().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},j=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),K=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))};var H="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},W={},G={};Object.defineProperty(G,"__esModule",{value:!0});var F=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();G.default=function(){return F.getInstance()};var X=H&&H.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},J=H&&H.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[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 X(this,void 0,void 0,function(){return J(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 X(this,void 0,void 0,function(){var n,r,o,i;return J(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?Z:this.storageHandler,r=Y+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,z.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),z.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;cr.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:r.signal},async e=>{if(clearTimeout(o),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(o),"AbortError"===(null==e?void 0:e.name))throw new A;throw e}}}class ne{constructor(){this.activeLocks=new Set,this.lock=new ee,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let r=!1;for(let n=0;n<10&&!r;n++)r=await this.lock.acquireLock(e,t);if(!r)throw new A;this.activeLocks.add(e),1===this.activeLocks.size&&"undefined"!=typeof window&&window.addEventListener("pagehide",this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),0===this.activeLocks.size&&"undefined"!=typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}let re=null;const oe=new TextEncoder,ie=new TextDecoder;function ae(e){return"string"==typeof e?oe.encode(e):ie.decode(e)}function se(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new de(`${e.name} modulusLength must be at least 2048 bits`)}let ce;if(Uint8Array.prototype.toBase64)ce=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ce=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),ve=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},Ee=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:m;return o?(async(e,t,n,r,o,i,a,s)=>be({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0):(async(e,t,n)=>{const r=await ve(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var o})(e,r,a)};async function Se(e,t,n,r,o,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let l,d=null;for(let c=0;c<3;c++)try{l=await Ee(e,n,r,o,i,a,t,s),d=null;break}catch(e){d=e}if(d)throw d;const h=l.json,{error:f,error_description:m}=h,y=p(h,["error","error_description"]),{headers:w,ok:g}=l;let b;if(c&&(b=w[we],b&&await c.setNonce(b)),!g){const l=m||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===f)throw new R(f,l,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===f)throw new k(n,r);if("use_dpop_nonce"===f){if(!c||!b||u)throw new C(b);return Se(e,t,n,r,o,i,a,s,c,!0)}throw new v(f||"request_error",l)}return y}async function Ae(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=p(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const d="urn:ietf:params:oauth:grant-type:token-exchange"===l.grant_type,h="refresh_token"===l.grant_type&&c,f=Object.assign(Object.assign(Object.assign(Object.assign({},l),d&&o&&{audience:o}),d&&i&&{scope:i}),h&&{audience:o,scope:i}),m=s?M(f):JSON.stringify(f),y=(g=l.grant_type,ge.includes(g));var g;return await Se("".concat(n,"/oauth/token"),r,o||b,i,{method:"POST",body:m,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(D(a||w)))}},t,s,c,y?u:void 0)}const Te=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[b]),Te(r,t)},Oe="@@auth0spajs@@",Re="@@user@@";class ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Oe,n=arguments.length>2?arguments[2]:void 0;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,r,o]=e.split("::");return new ke({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new ke({scope:t,audience:n,clientId:r})}}class Ie{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(Oe))}}class Ce{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 Ne{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||g}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=ke.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/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 ke({clientId:e},Oe,Re).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=ke.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===Oe&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=ke.fromKey(r);if(t.prefix===Oe&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=ke.fromKey(i);if(r.prefix===Oe&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class Pe{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(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 Le=e=>"number"==typeof e,xe=["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 Ue=H&&H.__assign||function(){return Ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;nHe.get(e)||He.get("".concat(We).concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),je("".concat(We).concat(e),JSON.stringify(t),r),He.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Ke(e,n),He.remove(e,t),He.remove("".concat(We).concat(e),t)}},Fe={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 Xe;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Xe||(Xe={}));var Je,Ve=function(e){return Je=Je||function(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o0?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"".concat(Oe,"::").concat(e)}}const Ze="auth0.is.authenticated",qe={memory:()=>(new Ce).enclosedCache,localstorage:()=>new Ie},Qe=e=>qe[e],$e=e=>{const{openUrl:t,onRedirect:n}=e,r=p(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},et=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},tt={NONCE:"nonce",KEYPAIR:"keypair"};class nt{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(tt).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(tt.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(tt.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(tt.NONCE,this.buildKey(e))}findKeyPair(){return this.find(tt.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(tt.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(tt.KEYPAIR,this.clientId)}}class rt{constructor(e){this.storage=new nt(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;return r={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(r,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}(0,{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){const t=await this.getOrGenerateKeyPair();return function(e){let{keyPair:t,url:n,method:r,nonce:o,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return me(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!fe(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ye(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new le("unsupported JWK kty")}return ue(await crypto.subtle.digest({name:"SHA-256"},ae(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var ot;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(ot||(ot={}));class it{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ot.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let r,o;"string"==typeof n?(r=this.config.dpopNonceId?ot.DPoP:ot.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===ot.DPoP&&await this.setDpopProofHeader(e,o)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,we);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new C(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class at{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new st({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new st(t)}}class st extends Error{constructor(e){let{type:t,status:n,title:r,detail:o,validation_errors:i}=e;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,st.prototype)}}const ct={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function ut(e,t){this.v=e,this.k=t}function lt(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function dt(e){return new ut(e,0)}function ht(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function pt(e,t){return e.get(lt(e,t))}function ft(e,t,n){ht(e,t),t.set(e,n)}function mt(e,t,n){return e.set(lt(e,t),n),n}function yt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Mt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Rt("The input to be decoded is not correctly encoded.",_t,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw Rt("".concat(n," must be a non-negative number"),_t,o);return}throw Rt("".concat(n," must be a positive number"),_t,o)}catch(e){if(r)throw Wt(e.message,r,o);throw e}}function zt(e,t,n,r){try{if("string"!=typeof e)throw Rt("".concat(t," must be a string"),Ot,r);if(0===e.length)throw Rt("".concat(t," must not be empty"),_t,r)}catch(e){if(n)throw Wt(e.message,n,r);throw e}}function Yt(e){!function(e,t){if(Sn(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return Wt(t,Gn,e)}(e,t)}(e,"application/json")}function Zt(){return jt(crypto.getRandomValues(new Uint8Array(32)))}function qt(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Kt("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Kt("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}}function Qt(e){const t=null==e?void 0:e[It];return"number"==typeof t&&Number.isFinite(t)?t:0}function $t(e){const t=null==e?void 0:e[Ct];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function en(){return Math.floor(Date.now()/1e3)}function tn(e){if("object"!=typeof e||null===e)throw Rt('"as" must be an object',Ot);zt(e.issuer,'"as.issuer"')}function nn(e){if("object"!=typeof e||null===e)throw Rt('"client" must be an object',Ot);zt(e.client_id,'"client.client_id"')}function rn(e){return zt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function on(e,t){const{key:n,kid:r}=(o=e)instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&zt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Rt("".concat(t," must be a CryptoKey"),Ot)}(e,t),"private"!==e.type)throw Rt("".concat(t," must be a private CryptoKey"),_t)}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:qt(n),kid:r},u=function(e,t){const n=en()+Qt(t);return{jti:Zt(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===(s=t[Pt])||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw Rt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',_t);const r="".concat(jt(Dt(JSON.stringify(e))),".").concat(jt(Dt(JSON.stringify(t)))),o=jt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:er(e)};case"RSA-PSS":switch($n(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Kt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return $n(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Kt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Dt(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const an=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function sn(e,t){if(t&&"https:"!==e.protocol)throw Wt("only requests to HTTPS are allowed",Xn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Wt("only HTTP and HTTPS requests are allowed",Jn,e)}function cn(e,t,n,r){let o;if("string"!=typeof e||!(o=an(e)))throw Wt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Zn:qn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return sn(o,r),o}function un(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?cn(e.mtls_endpoint_aliases[t],t,n,r):cn(e[t],t,n,r)}class ln extends Error{constructor(e,t){var n;super(e,t),yt(this,"cause",void 0),yt(this,"code",void 0),yt(this,"error",void 0),yt(this,"status",void 0),yt(this,"error_description",void 0),yt(this,"response",void 0),this.name=this.constructor.name,this.code=Bn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class dn extends Error{constructor(e,t){var n,r;super(e,t),yt(this,"cause",void 0),yt(this,"code",void 0),yt(this,"error",void 0),yt(this,"error_description",void 0),this.name=this.constructor.name,this.code=Kn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class hn extends Error{constructor(e,t){var n;super(e,t),yt(this,"cause",void 0),yt(this,"code",void 0),yt(this,"response",void 0),yt(this,"status",void 0),this.name=this.constructor.name,this.code=Mn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const pn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",fn="("+pn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',mn="("+pn+")\\s*=\\s*("+pn+")",yn=new RegExp("^[,\\s]*("+pn+")"),wn=new RegExp("^[,\\s]*"+fn+"[,\\s]*(.*)"),gn=new RegExp("^[,\\s]*"+mn+"[,\\s]*(.*)"),bn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function vn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!Tt(e,Response))throw Rt('"response" must be an instance of Response',Ot);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(yn);const i=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;r=s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(t=r.match(wn)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(gn))){if(t=r.match(bn)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else r=a||void 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new hn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){Qn(e),Yt(e);try{const t=await e.clone().json();if(Gt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new ln("server responded with an error in the response body",{cause:t,response:e});throw Wt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Fn,e)}}function En(e){if(!Nn.has(e))throw Rt('"options.DPoP" is not a valid DPoPHandle',_t)}function Sn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function An(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Nt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Xt(r,null==a?void 0:a.signal)})}async function Tn(e,t,n,r,o,i){var a;const s=un(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[kt]));o.set("grant_type",r);const c=Ft(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(En(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await An(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const _n=new WeakMap,On=new WeakMap;function Rn(e){if(!e.id_token)return;const t=_n.get(e);if(!t)throw Rt('"ref" was already garbage collected or did not resolve from the proper sources',_t);return t}async function kn(e,t,n,r,o,i){if(tn(e),nn(t),!Tt(n,Response))throw Rt('"response" must be an instance of Response',Ot);await vn(n,200,"Token Endpoint"),Qn(n);const a=await ir(n);if(zt(a.access_token,'"response" body "access_token" property',Wn,{body:a}),zt(a.token_type,'"response" body "token_type" property',Wn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;Vt(e,!0,'"response" body "expires_in" property',Wn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&zt(a.refresh_token,'"response" body "refresh_token" property',Wn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Wt('"response" body "scope" property must be a string',Wn,{body:a});if(void 0!==a.id_token){zt(a.id_token,'"response" body "id_token" property',Wn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Vt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new Kt("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Wt("Invalid JWT",Wn,e);try{i=JSON.parse(Dt(jt(s)))}catch(e){throw Wt("failed to parse JWT Header body as base64url encoded JSON",Hn,e)}if(!Gt(i))throw Wt("JWT Header must be a top level object",Wn,e);if(t(i),void 0!==i.crit)throw new Kt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Dt(jt(c)))}catch(e){throw Wt("failed to parse JWT Payload body as base64url encoded JSON",Hn,e)}if(!Gt(a))throw Wt("JWT Payload must be a top level object",Wn,e);const l=en()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Wt('unexpected JWT "exp" (expiration time) claim type',Wn,{claims:a});if(a.exp<=l-r)throw Wt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Vn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Wt('unexpected JWT "iat" (issued at) claim type',Wn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Wt('unexpected JWT "iss" (issuer) claim type',Wn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Wt('unexpected JWT "nbf" (not before) claim type',Wn,{claims:a});if(a.nbf>l+r)throw Wt('unexpected JWT "nbf" (not before) claim value',Vn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Wt('unexpected JWT "aud" (audience) claim type',Wn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,tr.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Qt(t),$t(t),o).then(xn.bind(void 0,i)).then(Cn.bind(void 0,e)).then(In.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Wt('ID Token "aud" (audience) claim includes additional untrusted audiences',zn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Wt('unexpected ID Token "azp" (authorized party) claim value',zn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&Vt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Wn,{claims:s}),On.set(n,c),_n.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Kt("unsupported `token_type` value",{cause:{body:a}});return a}function In(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Wt('unexpected JWT "aud" (audience) claim value',zn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Wt('unexpected JWT "aud" (audience) claim value',zn,{expected:e,claims:t.claims,claim:"aud"});return t}function Cn(e,t){var n,r;const o=null!==(n=null===(r=e[sr])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Wt('unexpected JWT "iss" (issuer) claim value',zn,{expected:o,claims:t.claims,claim:"iss"});return t}const Nn=new WeakSet,Pn=Symbol(),Ln={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function xn(e,t){for(const n of e)if(void 0===t.claims[n])throw Wt('JWT "'.concat(n,'" (').concat(Ln[n],") claim missing"),Wn,{claims:t.claims});return t}const Un=Symbol(),Dn=Symbol();const Mn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Bn="OAUTH_RESPONSE_BODY_ERROR",jn="OAUTH_UNSUPPORTED_OPERATION",Kn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Hn="OAUTH_PARSE_ERROR",Wn="OAUTH_INVALID_RESPONSE",Gn="OAUTH_RESPONSE_IS_NOT_JSON",Fn="OAUTH_RESPONSE_IS_NOT_CONFORM",Xn="OAUTH_HTTP_REQUEST_FORBIDDEN",Jn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Vn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",zn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Yn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Zn="OAUTH_MISSING_SERVER_METADATA",qn="OAUTH_INVALID_SERVER_METADATA";function Qn(e){if(e.bodyUsed)throw Rt('"response" body has been used already',_t)}function $n(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Kt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function er(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Kt("unsupported ECDSA namedCurve",{cause:e})}}function tr(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Wt('unexpected JWT "alg" header parameter',Wn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Wt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw Wt('unexpected JWT "alg" header parameter',Wn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Wt('unexpected JWT "alg" header parameter',Wn,{header:r,expected:e,reason:"client configuration"})}function nr(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Wt('"'.concat(t,'" parameter must be provided only once'),Wn);return n}const rr=Symbol(),or=Symbol();async function ir(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yt;try{t=await e.json()}catch(t){throw n(e),Wt('failed to parse "response" body as JSON',Hn,t)}if(!Gt(t))throw Wt('"response" body must be a top level object',Wn,{body:t});return t}const ar=Symbol(),sr=Symbol(),cr=new TextEncoder,ur=new TextDecoder;function lr(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function dr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},fr=(e,t)=>e.name===t;function mr(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw pr("SHA-".concat(t),"algorithm.hash")}function yr(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const wr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),yt(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),yt(this,"claim",void 0),yt(this,"reason",void 0),yt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}yt(br,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class vr extends gr{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),yt(this,"code","ERR_JWT_EXPIRED"),yt(this,"claim",void 0),yt(this,"reason",void 0),yt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}yt(vr,"code","ERR_JWT_EXPIRED");class Er extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}yt(Er,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Sr extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JOSE_NOT_SUPPORTED")}}yt(Sr,"code","ERR_JOSE_NOT_SUPPORTED"),yt(class extends gr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),yt(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),yt(class extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Ar extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JWS_INVALID")}}yt(Ar,"code","ERR_JWS_INVALID");class Tr extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JWT_INVALID")}}yt(Tr,"code","ERR_JWT_INVALID"),yt(class extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class _r extends gr{constructor(){super(...arguments),yt(this,"code","ERR_JWKS_INVALID")}}yt(_r,"code","ERR_JWKS_INVALID");class Or extends gr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),yt(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}yt(Or,"code","ERR_JWKS_NO_MATCHING_KEY");class Rr extends gr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),yt(this,Symbol.asyncIterator,void 0),yt(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}yt(Rr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class kr extends gr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),yt(this,"code","ERR_JWKS_TIMEOUT")}}yt(kr,"code","ERR_JWKS_TIMEOUT");class Ir extends gr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),yt(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}yt(Ir,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Cr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Nr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Pr=e=>Cr(e)||Nr(e);function Lr(e,t,n){try{return hr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function xr(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const Ur=e=>xr(e)&&"string"==typeof e.kty;async function Dr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Kr||(Kr=new WeakMap);let o=Kr.get(e);if(null!=o&&o[n])return o[n];const i=await Br(gt(gt({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Kr.set(e,{[n]:i}),i};const Wr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},Xr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Jr=(e,t,n)=>{var r;const o=(e=>dr(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){Fr(e,48,"Invalid PKCS#8 structure"),Gr(e),Fr(e,2,"Expected version field");const t=Gr(e);e.pos+=t,Fr(e,48,"Expected algorithm identifier");Gr(e);e.pos}(t),(e=>{const t=(e=>{Fr(e,6,"Expected algorithm OID");const t=Gr(e);return Xr(e,t)})(e);if(Wr(t,[43,101,110]))return"X25519";if(!Wr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Fr(e,6,"Expected curve OID");const n=Gr(e),r=Xr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(Wr(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Sr("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Sr('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)},Vr=e=>null==e?void 0:e[Symbol.toStringTag],zr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var Yr,Zr;let qr,Qr;if("undefined"==typeof navigator||null===(Yr=navigator.userAgent)||void 0===Yr||null===(Zr=Yr.startsWith)||void 0===Zr||!Zr.call(Yr,"Mozilla/5.0 ")){const e="v6.8.3";Qr="".concat("openid-client","/").concat(e),qr={"user-agent":Qr}}const $r=e=>eo.get(e);let eo,to;function no(e){return void 0!==e?rn(e):(to||(to=new WeakMap),(e,t,n,r)=>{let o;return(o=to.get(t))||(function(e,t){if("string"!=typeof e)throw ao("".concat(t," must be a string"),io);if(0===e.length)throw ao("".concat(t," must not be empty"),oo)}(t.client_secret,'"metadata.client_secret"'),o=rn(t.client_secret),to.set(t,o)),o(e,t,n,r)})}const ro=Nt,oo="ERR_INVALID_ARG_VALUE",io="ERR_INVALID_ARG_TYPE";function ao(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class so extends Error{constructor(e,t){var n;super(e,t),yt(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function co(e,t,n){return new so(e,{cause:t,code:n})}function uo(e){if(e instanceof TypeError||e instanceof so||e instanceof ln||e instanceof dn||e instanceof hn)throw e;if(e instanceof Ht)switch(e.code){case Xn:throw co("only requests to HTTPS are allowed",e,e.code);case Jn:throw co("only requests to HTTP or HTTPS are allowed",e,e.code);case Fn:throw co("unexpected HTTP response status code",e.cause,e.code);case Gn:throw co("unexpected response content-type",e.cause,e.code);case Hn:throw co("parsing error occured",e,e.code);case Wn:throw co("invalid response encountered",e,e.code);case zn:throw co("unexpected JWT claim value encountered",e,e.code);case Yn:throw co("unexpected JSON attribute value encountered",e,e.code);case Vn:throw co("JWT timestamp claim value failed validation",e,e.code);default:throw co(e.message,e,e.code)}if(e instanceof Kt)throw co("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw co("runtime operation error",e,jn);case"NotSupportedError":throw co("runtime unsupported operation",e,jn);case"TimeoutError":throw co("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw co("operation aborted",e,"OAUTH_ABORT")}throw new so("something went wrong",{cause:e})}async function lo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw ao('"server" must be an instance of URL',io);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw Rt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Ot);sn(e,!0!==(null==r?void 0:r[kt]));const o=n(new URL(e.href)),i=Ft(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Nt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Xt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Jt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Jt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Rt('"options.algorithm" must be "oidc" (default), or "oauth2"',_t)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Nt]:null==t?void 0:t[ro],[kt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(bo),signal:a,headers:new Headers(qr)}):((null==t?void 0:t[ro])||fetch)((sn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(bo)),e.href),{headers:Object.fromEntries(new Headers(gt({accept:"application/json"},qr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==ar)throw Rt('"expectedIssuerIdentifier" must be an instance of URL',Ot);if(!Tt(t,Response))throw Rt('"response" must be an instance of Response',Ot);if(200!==t.status)throw Wt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Fn,t);Qn(t);const r=await ir(t);if(zt(r.issuer,'"response" body "issuer" property',Wn,{body:r}),n!==ar&&new URL(r.issuer).href!==n.href)throw Wt('"response" body "issuer" property does not match the expected value',Yn,{expected:n.href,body:r,attribute:"issuer"});return r}(ar,e)).catch(uo);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[ho]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new so("discovered metadata issuer does not match the expected issuer",{code:Yn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new po(i,t,n,r);let s=$r(a);if(null!=o&&o[ro]&&(s.fetch=o[ro]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const ho=Symbol();class po{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw ao('"clientId" must be a non-empty string',io);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw ao('"clientId" and "metadata.client_id" must be the same',oo);const u=gt(gt({},structuredClone(n)),{},{client_id:t});let l;u[It]=null!==(i=null===(a=n)||void 0===a?void 0:a[It])&&void 0!==i?i:0,u[Ct]=null!==(s=null===(c=n)||void 0===c?void 0:c[Ct])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?no(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);ho in e&&(h[sr]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);eo||(eo=new WeakMap),eo.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone($r(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone($r(this).c)}get timeout(){return $r(this).timeout}set timeout(e){$r(this).timeout=e}get[ro](){return $r(this).fetch}set[ro](e){$r(this).fetch=e}}function fo(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Rn(this)}catch(e){return}}}}}(e))}async function mo(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Ht("invalid Retry-After header value",{cause:e});a>t&&await yo(a-t,n)}function yo(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function wo(e,t){_o(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=$r(e);return async function(e,t,n,r,o){tn(e),nn(t);const i=un(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[kt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Ft(null==o?void 0:o.headers);return s.set("accept","application/json"),An(e,t,n,i,a,s,o)}(n,r,o,t,{[Nt]:i,[kt]:!a,headers:new Headers(qr),signal:Oo(s)}).then(e=>async function(e,t,n){if(tn(e),nn(t),!Tt(n,Response))throw Rt('"response" must be an instance of Response',Ot);await vn(n,200,"Backchannel Authentication Endpoint"),Qn(n);const r=await ir(n);zt(r.auth_req_id,'"response" body "auth_req_id" property',Wn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Vt(o,!0,'"response" body "expires_in" property',Wn,{body:r}),r.expires_in=o,void 0!==r.interval&&Vt(r.interval,!1,'"response" body "interval" property',Wn,{body:r}),r}(n,r,e)).catch(uo)}async function go(e,t,n,r){var o,i;_o(e),n=new URLSearchParams(n);let a=null!==(o=t.interval)&&void 0!==o?o:5;const s=null!==(i=null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await yo(a,s)}catch(e){uo(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=$r(e),y=(o,i)=>go(e,gt(gt({},t),{},{interval:o}),n,gt(gt({},r),{},{signal:s,flag:i})),w=await async function(e,t,n,r,o){tn(e),nn(t),zt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Tn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[Nt]:d,[kt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(qr),signal:s.aborted?s:Oo(f)}).catch(uo);var g;if(503===w.status&&w.headers.has("retry-after"))return await mo(w,a,s,!0),await(null===(g=w.body)||void 0===g?void 0:g.cancel()),y(a);const b=async function(e,t,n,r){return kn(e,t,n,void 0,null==r?void 0:r[Lt],null==r?void 0:r.recognizedTokenTypes)}(c,u,w,{[Lt]:m});let v;try{v=await b}catch(e){if(Ro(e,r))return y(a,ko);if(e instanceof ln)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await mo(e.response,a,s),y(a)}uo(e)}return v.id_token&&await(null==p?void 0:p(w)),fo(v),v}function bo(e){$r(e).tlsOnly=!1}async function vo(e,t,n,r,o){if(_o(e),!((null==o?void 0:o.flag)===ko||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw ao('"currentUrl" must be an instance of URL, or Request',io);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:y,implicit:w}=$r(e);if((null==o?void 0:o.flag)===ko)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Rt("form_post responses are expected to use the POST method",_t,{cause:e});if("application/x-www-form-urlencoded"!==Sn(e))throw Rt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",_t,{cause:e});return async function(e){if(e.bodyUsed)throw Rt("form_post Request instances must contain a readable body",_t,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw ao("unexpected Request HTTP method",oo)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!h:i=await h(t,null==n?void 0:n.expectedState);break;case!!p:i=await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!w:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(tn(e),nn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Rt('"parameters" must be an instance of URLSearchParams, or URL',Ot);if(nr(n,"response"))throw Wt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Wn,{parameters:n});const o=nr(n,"iss"),i=nr(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Wt('response parameter "iss" (issuer) missing',Wn,{parameters:n});if(o&&o!==e.issuer)throw Wt('unexpected "iss" (issuer) response parameter value',Wn,{expected:e.issuer,parameters:n});switch(r){case void 0:case or:if(void 0!==i)throw Wt('unexpected "state" response parameter encountered',Wn,{expected:void 0,parameters:n});break;case rr:break;default:if(zt(r,'"expectedState" argument'),i!==r)throw Wt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Wn,{expected:r,parameters:n})}if(nr(n,"error"))throw new dn("authorization response from the server is an error",{cause:n});const a=nr(n,"id_token"),s=nr(n,"token");if(void 0!==a||void 0!==s)throw new Kt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Nn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){uo(e)}}}const g=await async function(e,t,n,r,o,i,a){if(tn(e),nn(t),!Nn.has(r))throw Rt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',_t);zt(o,'"redirectUri"');const s=nr(r,"code");if(!s)throw Wt('no authorization code in "callbackParameters"',Wn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Pn&&(zt(i,'"codeVerifier"'),c.set("code_verifier",i)),Tn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Pn,{additionalParameters:r,[Nt]:l,[kt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(qr),signal:Oo(m)}).catch(uo);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=Un;break;case Un:break;default:zt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Dn;break;case Dn:break;default:Vt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await kn(e,t,n,s,i,a);zt(c.id_token,'"response" body "id_token" property',Wn,{body:c});const u=Rn(c);if(o!==Dn){const e=en()+Qt(t),n=$t(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,r){return kn(e,t,n,void 0,null==r?void 0:r[Lt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[Lt]:l,recognizedTokenTypes:n})}).catch(uo);return fo(d),d}async function Co(e,t,n){if(!xr(e))throw new Ar("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Ar('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Ar("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Ar("JWS Payload missing");if("string"!=typeof e.signature)throw new Ar("JWS Signature missing or incorrect type");if(void 0!==e.header&&!xr(e.header))throw new Ar("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=hr(e.protected);r=JSON.parse(ur.decode(t))}catch(e){throw new Ar("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Sr('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(Ar,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(a=r.b64,"boolean"!=typeof a))throw new Ar('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Ar('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new Er('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Ar("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Ar("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(r,e),u=!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(Ur(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&zr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Pr(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Vr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Ur(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&zr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&zr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Pr(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Vr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Vr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Vr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Vr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Vr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?lr(e.protected):new Uint8Array,lr("."),"string"==typeof e.payload?a?lr(e.payload):cr.encode(e.payload):e.payload),d=Lr(e.signature,"signature",Ar),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(Cr(e))return e;if(Nr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Kr||(Kr=new WeakMap);let n=Kr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(jr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(jr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(jr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(jr)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(jr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(jr);return n?n[t]=i:Kr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Hr(e,n,t)}if(Ur(e))return e.k?hr(e.k):Hr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Dr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Sr("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new Ir;let p;p=a?Lr(e.payload,"payload",Ar):"string"==typeof e.payload?cr.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?gt(gt({},f),{},{key:h}):f}const No=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Po(e){const t=No.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const Lo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function xo(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(ur.decode(t))}catch(e){}if(!xr(n))throw new Tr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||Lo(e.typ)!==Lo(o)))throw new br('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new br('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new br('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new br('unexpected "sub" claim value',n,"sub","check_failed");if(c&&(h="string"==typeof c?[c]:c,!("string"==typeof(d=n.aud)?h.includes(d):Array.isArray(d)&&h.some(Set.prototype.has.bind(new Set(d))))))throw new br('unexpected "aud" claim value',n,"aud","check_failed");var d,h;let p;switch(typeof r.clockTolerance){case"string":p=Po(r.clockTolerance);break;case"number":p=r.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=r,m=(y=f||new Date,Math.floor(y.getTime()/1e3));var y;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new br('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new br('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new br('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new br('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new vr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=m-n.iat;if(e-p>("number"==typeof u?u:Po(u)))throw new vr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new br('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function Uo(e){return xr(e)}var Do,Mo,Bo=new WeakMap,jo=new WeakMap;class Ko{constructor(e){if(ft(this,Bo,void 0),ft(this,jo,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Uo)}(e))throw new _r("JSON Web Key Set malformed");mt(Bo,this,structuredClone(e))}jwks(){return pt(Bo,this)}async getKey(e,t){const{alg:n,kid:r}=gt(gt({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Sr('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=pt(Bo,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==o||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new Or;if(1!==s){const e=new Rr,t=pt(jo,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new vt(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield dt(Ho(t,e,n))}catch(e){}}),e}return Ho(pt(jo,this),a,n)}}async function Ho(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!xr(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return hr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Sr('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Br(gt(gt({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Br(gt(gt({},e),{},{ext:n}));case"EC":case"OKP":return Br(gt(gt({},e),{},{alg:t,ext:n}));default:throw new Sr('Unsupported "kty" (Key Type) Parameter value')}}(gt(gt({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new _r("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Wo(e){const t=new Ko(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let Go;if("undefined"==typeof navigator||null===(Do=navigator.userAgent)||void 0===Do||null===(Mo=Do.startsWith)||void 0===Mo||!Mo.call(Do,"Mozilla/5.0 ")){const e="v6.2.2";Go="".concat("jose","/").concat(e)}const Fo=Symbol(),Xo=Symbol();var Jo=new WeakMap,Vo=new WeakMap,zo=new WeakMap,Yo=new WeakMap,Zo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap;class ni{constructor(e,t){if(ft(this,Jo,void 0),ft(this,Vo,void 0),ft(this,zo,void 0),ft(this,Yo,void 0),ft(this,Zo,void 0),ft(this,qo,void 0),ft(this,Qo,void 0),ft(this,$o,void 0),ft(this,ei,void 0),ft(this,ti,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;mt(Jo,this,new URL(e.href)),mt(Vo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),mt(zo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),mt(Yo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),mt(Qo,this,new Headers(null==t?void 0:t.headers)),Go&&!pt(Qo,this).has("User-Agent")&&pt(Qo,this).set("User-Agent",Go),pt(Qo,this).has("accept")||(pt(Qo,this).set("accept","application/json"),pt(Qo,this).append("accept","application/jwk-set+json")),mt($o,this,null==t?void 0:t[Fo]),void 0!==(null==t?void 0:t[Xo])&&(mt(ti,this,null==t?void 0:t[Xo]),n=null==t?void 0:t[Xo],r=pt(Yo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&xr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,xr)&&(mt(Zo,this,pt(ti,this).uat),mt(ei,this,Wo(pt(ti,this).jwks))))}pendingFetch(){return!!pt(qo,this)}coolingDown(){return"number"==typeof pt(Zo,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new kr;throw e});if(200!==o.status)throw new gr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new gr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(pt(Jo,this).href,pt(Qo,this),AbortSignal.timeout(pt(Vo,this)),pt($o,this)).then(e=>{mt(ei,this,Wo(e)),pt(ti,this)&&(pt(ti,this).uat=Date.now(),pt(ti,this).jwks=e),mt(Zo,this,Date.now()),mt(qo,this,void 0)}).catch(e=>{throw mt(qo,this,void 0),e})),await pt(qo,this)}}const ri=["mfaToken"],oi=["mfaToken"];var ii,ai,si,ci,ui,li,di,hi,pi,fi,mi,yi,wi,gi,bi,vi,Ei=class extends Error{constructor(e,t){super(t),yt(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Si=class extends Error{constructor(e,t,n){super(t),yt(this,"cause",void 0),yt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Ai=class extends Si{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Ti=class extends Si{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},_i=class extends Si{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Oi=class extends Si{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ri=class extends Si{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ki=class extends Si{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Ii=class extends Error{constructor(e){super(e),yt(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Ci=class extends Si{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),yt(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Ni=class extends Si{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Pi=class extends Si{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Li=class extends Si{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},xi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),yt(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Ui(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>gt(gt({},e),{},{[t[0]]:t[1]}),{})}var Di=class extends Error{constructor(e,t,n){super(t),yt(this,"cause",void 0),yt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Mi=class extends Di{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Bi=class extends Di{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},ji=class extends Di{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Ki=class extends Di{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Hi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Wi=(ii=new WeakMap,ai=new WeakMap,si=new WeakMap,class{constructor(e){var t;ft(this,ii,void 0),ft(this,ai,void 0),ft(this,si,void 0),mt(ii,this,"https://".concat(e.domain)),mt(ai,this,e.clientId),mt(si,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(pt(ii,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await pt(si,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Mi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Hi)}async enrollAuthenticator(e){const t="".concat(pt(ii,this),"/mfa/associate"),{mfaToken:n}=e,r=bt(e,ri),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await pt(si,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Bi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(pt(ii,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await pt(si,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new ji(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(pt(ii,this),"/mfa/challenge"),{mfaToken:n}=e,r=bt(e,oi),o={mfa_token:n,client_id:pt(ai,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await pt(si,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Ki(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),Gi=class e{constructor(e,t,n,r,o,i,a){yt(this,"accessToken",void 0),yt(this,"idToken",void 0),yt(this,"refreshToken",void 0),yt(this,"expiresAt",void 0),yt(this,"scope",void 0),yt(this,"claims",void 0),yt(this,"authorizationDetails",void 0),yt(this,"tokenType",void 0),yt(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},Fi=(ci=new WeakMap,ui=new WeakMap,li=new WeakMap,class{constructor(e,t){ft(this,ci,new Map),ft(this,ui,void 0),ft(this,li,void 0),mt(li,this,Math.max(1,Math.floor(e))),mt(ui,this,Math.max(0,Math.floor(t)))}get(e){const t=pt(ci,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return pt(ci,this).delete(e),pt(ci,this).set(e,t),t.value;pt(ci,this).delete(e)}}set(e,t){for(pt(ci,this).has(e)&&pt(ci,this).delete(e),pt(ci,this).set(e,{value:t,expiresAt:Date.now()+pt(ui,this)});pt(ci,this).size>pt(li,this);){const e=pt(ci,this).keys().next().value;if(void 0===e)break;pt(ci,this).delete(e)}}}),Xi=new Map;function Ji(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var Vi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Xi.get(i));var i;return o||(o=new Fi(e.maxEntries,e.ttlMs),Xi.set(t,o)),o}static createJwksCache(){return{}}},zi="openid profile email offline_access",Yi=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function Zi(e){if(null==e)throw new ki("subject_token is required");if("string"!=typeof e)throw new ki("subject_token must be a string");if(0===e.trim().length)throw new ki("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ki("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ki("subject_token must not include the 'Bearer ' prefix")}function qi(e,t){if(t)for(const[n,r]of Object.entries(t))if(!Yi.has(n))if(Array.isArray(r)){if(r.length>20)throw new ki("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var Qi="urn:ietf:params:oauth:token-type:access_token",$i=(di=new WeakMap,hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,mi=new WeakMap,yi=new WeakMap,wi=new WeakMap,gi=new WeakMap,bi=new WeakMap,vi=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){ht(e,t),t.add(e)}(this,vi),ft(this,di,void 0),ft(this,hi,void 0),ft(this,pi,void 0),ft(this,fi,void 0),ft(this,mi,void 0),ft(this,yi,void 0),ft(this,wi,void 0),ft(this,gi,void 0),ft(this,bi,void 0),yt(this,"mfa",void 0),mt(fi,this,e),e.useMtls&&!e.customFetch)throw new Ei("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");mt(mi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,gt(gt({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=Ji(e.discoveryCache);mt(wi,this,Vi.createDiscoveryCache(i)),mt(gi,this,new Map),mt(bi,this,Vi.createJwksCache()),this.mfa=new Wi({domain:pt(fi,this).domain,clientId:pt(fi,this).clientId,customFetch:pt(mi,this)})}async getServerMetadata(){const{serverMetadata:e}=await lt(vi,this,na).call(this);return e}async buildAuthorizationUrl(e){const{serverMetadata:t}=await lt(vi,this,na).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ei("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await lt(vi,this,aa).call(this,e)}catch(e){throw new Ni(e)}}async buildLinkUserUrl(e){try{const t=await lt(vi,this,aa).call(this,{authorizationParams:gt(gt({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Pi(e)}}async buildUnlinkUserUrl(e){try{const t=await lt(vi,this,aa).call(this,{authorizationParams:gt(gt({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Li(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await lt(vi,this,na).call(this),r=Ui(gt(gt({},pt(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(gt(gt({scope:zi},r),{},{client_id:pt(fi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await wo(t,o),n=await go(t,e);return Gi.fromTokenEndpointResponse(n)}catch(e){throw new Ci(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await lt(vi,this,na).call(this),r=Ui(gt(gt({},pt(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(gt(gt({scope:zi},r),{},{client_id:pt(fi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await wo(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Ci(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await lt(vi,this,na).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await Io(n,"urn:openid:params:grant-type:ciba",r);return Gi.fromTokenEndpointResponse(e)}catch(e){throw new Ci(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Ri("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new Ri("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?Qi:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ki)throw new Ri(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?lt(vi,this,ra).call(this,e):lt(vi,this,oa).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await lt(vi,this,na).call(this);try{const r=await vo(n,e,{pkceCodeVerifier:t.codeVerifier});return Gi.fromTokenEndpointResponse(r)}catch(e){throw new Ai("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await lt(vi,this,na).call(this),n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await Eo(t,e.refreshToken,n);return Gi.fromTokenEndpointResponse(r)}catch(e){throw new _i("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const{configuration:t}=await lt(vi,this,na).call(this),n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await lt(vi,this,ia).call(this);r=new po(t.serverMetadata(),pt(fi,this).clientId,pt(fi,this).clientSecret,n),r[ro]=(t,n)=>pt(mi,this).call(this,t,gt(gt({},n),{},{headers:gt(gt({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await Io(r,"password",n);return Gi.fromTokenEndpointResponse(e)}catch(e){throw new Oi("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await lt(vi,this,na).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await So(t,n);return Gi.fromTokenEndpointResponse(r)}catch(e){throw new Ti("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await lt(vi,this,na).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(pt(fi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",pt(fi,this).clientId),t}return function(e,t){_o(e);const{as:n,c:r,tlsOnly:o}=$r(e),i=un(n,"end_session_endpoint",!1,o);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await lt(vi,this,na).call(this),n=Ji(pt(fi,this).discoveryCache),r=t.jwks_uri;pt(yi,this)||mt(yi,this,function(e,t){const n=new ni(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[Fo]:pt(mi,this),[Xo]:pt(bi,this)}));const{payload:o}=await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=ur.decode(e)),"string"!=typeof e)throw new Ar("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new Ar("Invalid Compact JWS");const s=await Co({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?gt(gt({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Tr("JWTs MUST NOT use unencoded payload");const i={payload:xo(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?gt(gt({},i),{},{key:o.key}):i}(e.logoutToken,pt(yi,this),{issuer:t.issuer,audience:pt(fi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in o)&&!("sub"in o))throw new Ii('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new Ii('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new Ii('"sub" claim must be a string');if("nonce"in o)throw new Ii('"nonce" claim is prohibited');if(!("events"in o))throw new Ii('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new Ii('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new Ii('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new Ii('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function ea(){const e=pt(fi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(pt(fi,this).useMtls?"1":"0")}async function ta(e){const t=await lt(vi,this,ia).call(this),n=new po(e,pt(fi,this).clientId,pt(fi,this).clientSecret,t);return n[ro]=pt(mi,this),n}async function na(){if(pt(di,this)&&pt(hi,this))return{configuration:pt(di,this),serverMetadata:pt(hi,this)};const e=lt(vi,this,ea).call(this),t=pt(wi,this).get(e);if(t)return mt(hi,this,t.serverMetadata),mt(di,this,await lt(vi,this,ta).call(this,t.serverMetadata)),{configuration:pt(di,this),serverMetadata:pt(hi,this)};const n=pt(gi,this).get(e);if(n){const e=await n;return mt(hi,this,e.serverMetadata),mt(di,this,await lt(vi,this,ta).call(this,e.serverMetadata)),{configuration:pt(di,this),serverMetadata:pt(hi,this)}}const r=(async()=>{const t=await lt(vi,this,ia).call(this),n=await lo(new URL("https://".concat(pt(fi,this).domain)),pt(fi,this).clientId,{use_mtls_endpoint_aliases:pt(fi,this).useMtls},t,{[ro]:pt(mi,this)}),r=n.serverMetadata();return pt(wi,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});o.catch(()=>{}),pt(gi,this).set(e,o);try{const{configuration:e,serverMetadata:t}=await r;mt(di,this,e),mt(hi,this,t),pt(di,this)[ro]=pt(mi,this)}finally{pt(gi,this).delete(e)}return{configuration:pt(di,this),serverMetadata:pt(hi,this)}}async function ra(e){var t,n;const{configuration:r}=await lt(vi,this,na).call(this);if("audience"in e||"resource"in e)throw new ki("audience and resource parameters are not supported for Token Vault exchanges");Zi(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:Qi,requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),qi(o,e.extra);try{const e=await Io(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return Gi.fromTokenEndpointResponse(e)}catch(t){throw new ki("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function oa(e){const{configuration:t}=await lt(vi,this,na).call(this);Zi(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),qi(n,e.extra);try{const e=await Io(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return Gi.fromTokenEndpointResponse(e)}catch(t){throw new ki("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ia(){return pt(pi,this)||mt(pi,this,(async()=>{if(!pt(fi,this).clientSecret&&!pt(fi,this).clientAssertionSigningKey&&!pt(fi,this).useMtls)throw new xi;if(pt(fi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=pt(fi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Jr(e,t,void 0)}(e,pt(fi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return on(e,void 0)}(e):no(pt(fi,this).clientSecret)})().catch(e=>{throw mt(pi,this,void 0),e})),pt(pi,this)}async function aa(e){const{configuration:t}=await lt(vi,this,na).call(this),n=Zt(),r=await function(e){return async function(e){return zt(e,"codeVerifier"),jt(await crypto.subtle.digest("SHA-256",Dt(e)))}(e)}(n),o=Ui(gt(gt({},pt(fi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(gt(gt({scope:zi},o),{},{client_id:pt(fi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await To(t,i):await Ao(t,i),codeVerifier:n}}class sa extends v{constructor(e,t){super(e,t),Object.setPrototypeOf(this,sa.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new sa(t,n)}}class ca extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ca.prototype)}}class ua extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ua.prototype)}}class la extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,la.prototype)}}class da extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}}class ha extends sa{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class fa{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new pa}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new ca("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof Mi)throw new ca(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=ct[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof Bi)throw new ua(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof Ki)throw new la(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new ha("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new da("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new da("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof R)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof da)throw new da(e.error,e.error_description);throw e}}}class ma{constructor(e){let t,n;if(this.userCache=(new Ce).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},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(!P())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===P().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 ")})(),this.lockManager=(re||(re=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new te:new ne;var e}()),re),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||y,!Qe(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=Qe(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:m,this.cookieStorage=!1===e.legacySameSiteCookie?He:Ge,this.orgHintCookieName=(r=this.options.clientId,"auth0.".concat(r,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:Fe;var i;this.scope=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{const o=e[n];i[n]=Te(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Pe(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||g,this.cacheManager=new Ne(n,n.allKeys?void 0:new Ye(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new rt(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new at(s,a),this.authJsClient=new $i({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new fa(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===y&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Ve,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||w,n=D(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(M(e)))}async _verifyIdToken(e,t,n){const r=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,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse(j(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],xe.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(j(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 "'.concat(e.iss,'", found "').concat(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 "'.concat(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 "'.concat(e.aud,'" but was not one of "').concat(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 "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(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 "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Le(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||!Le(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Le(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(o,")"));if(null!=t.claims.nbf&&Le(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)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 (".concat(r,") is after last auth at ").concat(o))}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 "'.concat(e,'", found "').concat(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 "'.concat(e,'", found "').concat(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:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_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})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=x(L()),i=x(L()),a=L(),s=await B(a),c=K(s),u=await(null===(r=this.dpop)||void 0===r?void 0:r.calculateThumbprint()),l=((e,t,n,r,o,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:_e(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:r,nonce:o,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||b,redirect_uri:l.redirect_uri,state:o,url:d}}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=".concat(e,",top=").concat(t,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(),!t.popup))throw new O;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new _(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new T(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(v.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new v("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}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(){var e;const t=$e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=p(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),{url:u}=c,l=p(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:Xe.Code}),a&&{organization:a}));const d=r?"".concat(u,"#").concat(r):u;n?await n(d):window.location.assign(d)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new v("missing_transaction","Invalid state");this.transactionManager.remove();const n=(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,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===Xe.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:r,error:o,error_description:i}=e;if(o)throw new E(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new v("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:Xe.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new S(o,i||o,t.connection,r,t.appState);if(!n)throw new v("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new v("state_mismatch","Invalid state");const a=await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},a),{appState:t.appState,response_type:Xe.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(Ze))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(Ze)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:_e(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,(null===(n=e.authorizationParams)||void 0===n?void 0:n.audience)||this.options.authorizationParams.audience)})}),o=await((e,t)=>{let n=ze[t];return n||(n=e().finally(()=>{delete ze[t],n=null}),ze[t]=n),n})(()=>this._getTokenSilently(r),"".concat(this.options.clientId,"::").concat(r.authorizationParams.audience,"::").concat(r.authorizationParams.scope));return e.detailedResponse?o:null==o?void 0:o.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=p(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||b,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const r=(o=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(o,".").concat(i));var o,i;try{return await this.lockManager.runWithLock(r,5e3,async()=>{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||b,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,token_type:o,access_token:i,oauthTokenScope:a,expires_in:s}=e;return Object.assign(Object.assign({id_token:r,token_type:o,access_token:i},a?{scope:a}:null),{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(n);throw e}}_isInteractiveError(e){return e instanceof R||e instanceof v&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&"Multifactor authentication required"===e.error_description}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||b,clientId:this.options.clientId});if(!t)throw new v("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:_e(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(r=e.authorizationParams)||void 0===r?void 0:r.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},f),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new ke({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||b,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=p(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(M(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||b,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let{baseUrl:n,timeout:r,auth0Client:o,useFormData:i,refreshTokens:a,audience:s,client_id:c,onRefreshTokenRevoked:u}=e;const l=r||m,d="refresh_token",h="".concat(n,"/oauth/revoke"),p={"Content-Type":i?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(D(o||w)))};if(t){const n={client_id:c,token_type_hint:d},r=i?M(n):JSON.stringify(n);try{return await be({type:"revoke",timeout:l,fetchUrl:h,fetchOptions:{method:"POST",body:r,headers:p},useFormData:i,auth:{audience:null!=s?s:b}},t)}catch(e){throw new v("revoke_error",e.message)}}for(const t of a){const n={client_id:c,token_type_hint:d,token:t},r=i?M(n):JSON.stringify(n),o=await ve(h,{method:"POST",body:r,headers:p},l);if(!o.ok){let t,n;try{({error:t,error_description:n}=JSON.parse(await o.text()))}catch(e){}throw new v(t||"revoke_error",n||"HTTP error ".concat(o.status))}await(null==u?void 0:u(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=$e(e),{openUrl:r}=n,o=p(n,["openUrl"]);if(null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.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(Re),await(null===(t=this.dpop)||void 0===t?void 0:t.clear()),this.worker)try{await be({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new v("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const h=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{o(new A),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?o(v.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,d,l);if(o!==h.state)throw new v("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:h.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return Object.assign(Object.assign({},p),{scope:c,oauthTokenScope:p.scope,audience:u})})}catch(e){throw"login_required"===e.error&&(e instanceof v&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new ke({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||b,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new k(e.authorizationParams.audience||b,e.authorizationParams.scope)}const o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,a=((e,t,n,r)=>{var o;if(e&&n&&r){if(t.audience!==n)return t.scope;const e=r.split(" "),i=(null===(o=t.scope)||void 0===o?void 0:o.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{const t=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:o}),i&&{timeout:i}),{scopesToRequest:a});if(t.refresh_token&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,t.refresh_token),this.options.useMrrt&&!(s=null==r?void 0:r.audience,c=null==r?void 0:r.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,s===u&&et(l,c)||et(a,t.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const n=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],r=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==r.indexOf(e)).join(",")})(a,t.scope);throw new I(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||b})}catch(r){if(r.message){if(r.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),r;if((r.message.includes("Missing Refresh Token")||r.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw r instanceof R&&this.mfa.setMFAAuthDetails(r.mfa_token,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.audience,r.mfa_requirements),r}var s,c,u,l}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,r=p(e,["id_token","decodedToken"]);this.userCache.set(Re,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||b,t=this.scope[e],n=await this.cacheManager.getIdToken(new ke({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(Re);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(Re,n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new ke({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:r}=i,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}async _requestToken(e,t){var n,r;const{nonceIn:o,organization:i,scopesToRequest:a}=t||{},s=await Ae(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:a||e.scope}),this.worker),c=await this._verifyIdToken(s.id_token,o,i);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(r=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===r?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Re))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||b}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:c})}async loginWithCustomTokenExchange(e){return this._requestToken(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:_e(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new it(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null===(t=null==e?void 0:e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:r,scopes:o,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!r)throw new Error("connection is required");const s=x(L()),c=L(),u=await B(c),l=K(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:r,response_type:Xe.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,r=p(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function ya(e,t){return function(){return e.apply(t,arguments)}}const{toString:wa}=Object.prototype,{getPrototypeOf:ga}=Object,{iterator:ba,toStringTag:va}=Symbol,Ea=(Sa=Object.create(null),e=>{const t=wa.call(e);return Sa[t]||(Sa[t]=t.slice(8,-1).toLowerCase())});var Sa;const Aa=e=>(e=e.toLowerCase(),t=>Ea(t)===e),Ta=e=>t=>typeof t===e,{isArray:_a}=Array,Oa=Ta("undefined");function Ra(e){return null!==e&&!Oa(e)&&null!==e.constructor&&!Oa(e.constructor)&&Ca(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ka=Aa("ArrayBuffer");const Ia=Ta("string"),Ca=Ta("function"),Na=Ta("number"),Pa=e=>null!==e&&"object"==typeof e,La=e=>{if("object"!==Ea(e))return!1;const t=ga(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||va in e||ba in e)},xa=Aa("Date"),Ua=Aa("File"),Da=Aa("Blob"),Ma=Aa("FileList");const Ba="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ja=void 0!==Ba.FormData?Ba.FormData:void 0,Ka=Aa("URLSearchParams"),[Ha,Wa,Ga,Fa]=["ReadableStream","Request","Response","Headers"].map(Aa);function Xa(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),_a(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Va="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,za=e=>!Oa(e)&&e!==Va;const Ya=(Za="undefined"!=typeof Uint8Array&&ga(Uint8Array),e=>Za&&e instanceof Za);var Za;const qa=Aa("HTMLFormElement"),Qa=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),$a=Aa("RegExp"),es=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Xa(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const ts=Aa("AsyncFunction"),ns=(rs="function"==typeof setImmediate,os=Ca(Va.postMessage),rs?setImmediate:os?(is=`axios@${Math.random()}`,as=[],Va.addEventListener("message",({source:e,data:t})=>{e===Va&&t===is&&as.length&&as.shift()()},!1),e=>{as.push(e),Va.postMessage(is,"*")}):e=>setTimeout(e));var rs,os,is,as;const ss="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Va):"undefined"!=typeof process&&process.nextTick||ns,cs={isArray:_a,isArrayBuffer:ka,isBuffer:Ra,isFormData:e=>{if(!e)return!1;if(ja&&e instanceof ja)return!0;const t=ga(e);if(!t||t===Object.prototype)return!1;if(!Ca(e.append))return!1;const n=Ea(e);return"formdata"===n||"object"===n&&Ca(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ka(e.buffer),t},isString:Ia,isNumber:Na,isBoolean:e=>!0===e||!1===e,isObject:Pa,isPlainObject:La,isEmptyObject:e=>{if(!Pa(e)||Ra(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ha,isRequest:Wa,isResponse:Ga,isHeaders:Fa,isUndefined:Oa,isDate:xa,isFile:Ua,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Da,isRegExp:$a,isFunction:Ca,isStream:e=>Pa(e)&&Ca(e.pipe),isURLSearchParams:Ka,isTypedArray:Ya,isFileList:Ma,forEach:Xa,merge:function e(...t){const{caseless:n,skipUndefined:r}=za(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Ja(o,i)||i,s=Qa(o,a)?o[a]:void 0;La(s)&&La(t)?o[a]=e(s,t):La(t)?o[a]=e({},t):_a(t)?o[a]=t.slice():r&&Oa(t)||(o[a]=t)};for(let e=0,n=t.length;e(Xa(t,(t,r)=>{n&&Ca(t)?Object.defineProperty(e,r,{__proto__:null,value:ya(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&ga(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ea,kindOfTest:Aa,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(_a(e))return e;let t=e.length;if(!Na(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[ba]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:qa,hasOwnProperty:Qa,hasOwnProp:Qa,reduceDescriptors:es,freezeMethods:e=>{es(e,(t,n)=>{if(Ca(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];Ca(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return _a(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ja,global:Va,isContextDefined:za,isSpecCompliantForm:function(e){return!!(e&&Ca(e.append)&&"FormData"===e[va]&&e[ba])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Pa(e)){if(t.indexOf(e)>=0)return;if(Ra(e))return e;if(!("toJSON"in e)){t[r]=e;const o=_a(e)?[]:{};return Xa(e,(e,t)=>{const i=n(e,r+1);!Oa(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:ts,isThenable:e=>e&&(Pa(e)||Ca(e))&&Ca(e.then)&&Ca(e.catch),setImmediate:ns,asap:ss,isIterable:e=>null!=e&&Ca(e[ba])},us=cs.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ls=e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&us[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};(Object.getOwnPropertyDescriptor(ls,"name")||{}).writable||Object.defineProperty(ls,"name",{value:"default",configurable:!0});const ds=Symbol("internals"),hs=/[^\x09\x20-\x7E\x80-\xFF]/g;function ps(e){return e&&String(e).trim().toLowerCase()}function fs(e){return!1===e||null==e?e:cs.isArray(e)?e.map(fs):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(hs,""))}function ms(e,t,n,r,o){return cs.isFunction(r)?r.call(this,t,n):(o&&(t=n),cs.isString(t)?cs.isString(r)?-1!==t.indexOf(r):cs.isRegExp(r)?r.test(t):void 0:void 0)}class ys{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ps(t);if(!o)throw new Error("header name must be a non-empty string");const i=cs.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=fs(e))}const i=(e,t)=>cs.forEach(e,(e,n)=>o(e,n,t));if(cs.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(cs.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(ls(e),t);else if(cs.isObject(e)&&cs.isIterable(e)){let n,r,o={};for(const t of e){if(!cs.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?cs.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ps(e)){const n=cs.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(cs.isFunction(t))return t.call(this,e,n);if(cs.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ps(e)){const n=cs.findKey(this,e);return!(!n||void 0===this[n]||t&&!ms(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ps(e)){const o=cs.findKey(n,e);!o||t&&!ms(0,n[o],o,t)||(delete n[o],r=!0)}}return cs.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!ms(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return cs.forEach(this,(r,o)=>{const i=cs.findKey(n,o);if(i)return t[i]=fs(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=fs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return cs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&cs.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ds]=this[ds]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ps(e);t[r]||(!function(e,t){const n=cs.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return cs.isArray(e)?e.forEach(r):r(e),this}}ys.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),cs.reduceDescriptors(ys.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),cs.freezeMethods(ys);const ws=ys;function gs(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(cs.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof ws&&(e=e.toJSON()),r.push(e),cs.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);cs.isUndefined(r)||(t[n]=r)});else{if(!cs.isPlainObject(e)&&function(e){if(cs.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(cs.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);cs.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class bs extends Error{static from(e,t,n,r,o,i){const a=new bs(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&cs.hasOwnProp(e,"redact")?e.redact:void 0,n=cs.isArray(t)&&t.length>0?gs(e,t):cs.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}bs.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",bs.ERR_BAD_OPTION="ERR_BAD_OPTION",bs.ECONNABORTED="ECONNABORTED",bs.ETIMEDOUT="ETIMEDOUT",bs.ECONNREFUSED="ECONNREFUSED",bs.ERR_NETWORK="ERR_NETWORK",bs.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",bs.ERR_DEPRECATED="ERR_DEPRECATED",bs.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",bs.ERR_BAD_REQUEST="ERR_BAD_REQUEST",bs.ERR_CANCELED="ERR_CANCELED",bs.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",bs.ERR_INVALID_URL="ERR_INVALID_URL",bs.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const vs=bs;var Es=n(8287).hp;function Ss(e){return cs.isPlainObject(e)||cs.isArray(e)}function As(e){return cs.endsWith(e,"[]")?e.slice(0,-2):e}function Ts(e,t,n){return e?e.concat(t).map(function(e,t){return e=As(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const _s=cs.toFlatObject(cs,{},null,function(e){return/^is[A-Z]/.test(e)});const Os=function(e,t,n){if(!cs.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=cs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!cs.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&cs.isSpecCompliantForm(t);if(!cs.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(cs.isDate(e))return e.toISOString();if(cs.isBoolean(e))return e.toString();if(!u&&cs.isBlob(e))throw new vs("Blob is not supported. Use a Buffer instead.");return cs.isArrayBuffer(e)||cs.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Es.from(e):e}function d(e,n,o){let s=e;if(cs.isReactNative(t)&&cs.isReactNativeBlob(e))return t.append(Ts(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(cs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(cs.isArray(e)&&function(e){return cs.isArray(e)&&!e.some(Ss)}(e)||(cs.isFileList(e)||cs.endsWith(n,"[]"))&&(s=cs.toArray(e)))return n=As(n),s.forEach(function(e,r){!cs.isUndefined(e)&&null!==e&&t.append(!0===a?Ts([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Ss(e)||(t.append(Ts(o,n,i),l(e)),!1)}const h=[],p=Object.assign(_s,{defaultVisitor:d,convertValue:l,isVisitable:Ss});if(!cs.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!cs.isUndefined(n)){if(i>c)throw new vs("Object is too deeply nested ("+i+" levels). Max depth: "+c,vs.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),cs.forEach(n,function(n,a){!0===(!(cs.isUndefined(n)||null===n)&&o.call(t,n,cs.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function Rs(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function ks(e,t){this._pairs=[],e&&Os(e,this,t)}const Is=ks.prototype;Is.append=function(e,t){this._pairs.push([e,t])},Is.toString=function(e){const t=e?function(t){return e.call(this,t,Rs)}:Rs;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Cs=ks;function Ns(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ps(e,t,n){if(!t)return e;const r=n&&n.encode||Ns,o=cs.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):cs.isURLSearchParams(t)?t.toString():new Cs(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Ls=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){cs.forEach(this.handlers,function(t){null!==t&&e(t)})}},xs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Us={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Cs,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Ds="undefined"!=typeof window&&"undefined"!=typeof document,Ms="object"==typeof navigator&&navigator||void 0,Bs=Ds&&(!Ms||["ReactNative","NativeScript","NS"].indexOf(Ms.product)<0),js="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ks=Ds&&window.location.href||"http://localhost",Hs={...e,...Us};const Ws=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&cs.isArray(r)?r.length:i,s)return cs.hasOwnProp(r,i)?r[i]=cs.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;r[i]&&cs.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&cs.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return cs.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},Gs=(e,t)=>null!=e&&cs.hasOwnProp(e,t)?e[t]:void 0;const Fs={transitional:xs,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=cs.isObject(e);o&&cs.isHTMLForm(e)&&(e=new FormData(e));if(cs.isFormData(e))return r?JSON.stringify(Ws(e)):e;if(cs.isArrayBuffer(e)||cs.isBuffer(e)||cs.isStream(e)||cs.isFile(e)||cs.isBlob(e)||cs.isReadableStream(e))return e;if(cs.isArrayBufferView(e))return e.buffer;if(cs.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=Gs(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Os(e,new Hs.classes.URLSearchParams,{visitor:function(e,t,n,r){return Hs.isNode&&cs.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=cs.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=Gs(this,"env"),r=n&&n.FormData;return Os(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(cs.isString(e))try{return(t||JSON.parse)(e),cs.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Gs(this,"transitional")||Fs.transitional,n=t&&t.forcedJSONParsing,r=Gs(this,"responseType"),o="json"===r;if(cs.isResponse(e)||cs.isReadableStream(e))return e;if(e&&cs.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,Gs(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw vs.from(e,vs.ERR_BAD_RESPONSE,this,null,Gs(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Hs.classes.FormData,Blob:Hs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};cs.forEach(["delete","get","head","post","put","patch","query"],e=>{Fs.headers[e]={}});const Xs=Fs;function Js(e,t){const n=this||Xs,r=t||n,o=ws.from(r.headers);let i=r.data;return cs.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Vs(e){return!(!e||!e.__CANCEL__)}const zs=class extends vs{constructor(e,t,n){super(e??"canceled",vs.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function Ys(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new vs("Request failed with status code "+n.status,n.status>=400&&n.status<500?vs.ERR_BAD_REQUEST:vs.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const Zs=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},Qs=(e,t,n=3)=>{let r=0;const o=Zs(50,250);return qs(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},$s=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ec=e=>(...t)=>cs.asap(()=>e(...t)),tc=Hs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Hs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Hs.origin),Hs.navigator&&/(msie|trident)/i.test(Hs.navigator.userAgent)):()=>!0,nc=Hs.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];cs.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),cs.isString(r)&&s.push(`path=${r}`),cs.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),cs.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function rc(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const oc=e=>e instanceof ws?{...e}:e;function ic(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return cs.isPlainObject(e)&&cs.isPlainObject(t)?cs.merge.call({caseless:r},e,t):cs.isPlainObject(t)?cs.merge({},t):cs.isArray(t)?t.slice():t}function o(e,t,n,o){return cs.isUndefined(t)?cs.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!cs.isUndefined(t))return r(void 0,t)}function a(e,t){return cs.isUndefined(t)?cs.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return cs.hasOwnProp(t,i)?r(n,o):cs.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(oc(e),oc(t),0,!0)};return cs.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=cs.hasOwnProp(c,r)?c[r]:o,a=i(cs.hasOwnProp(e,r)?e[r]:void 0,cs.hasOwnProp(t,r)?t[r]:void 0,r);cs.isUndefined(a)&&i!==s||(n[r]=a)}),n}const ac=["content-type","content-length"];const sc=e=>{const t=ic({},e),n=e=>cs.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=ws.from(s),t.url=Ps(rc(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),cs.isFormData(r)&&(Hs.hasStandardBrowserEnv||Hs.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):cs.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{ac.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Hs.hasStandardBrowserEnv){cs.isFunction(o)&&(o=o(t));if(!0===o||null==o&&tc(t.url)){const e=i&&a&&nc.read(a);e&&s.set(i,e)}}return t};(Object.getOwnPropertyDescriptor(sc,"name")||{}).writable||Object.defineProperty(sc,"name",{value:"default",configurable:!0});const cc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=sc(e);let o=r.data;const i=ws.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function y(){if(!m)return;const r=ws.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Ys(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=y:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new vs("Request aborted",vs.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new vs(r,vs.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||xs;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new vs(t,o.clarifyTimeoutError?vs.ETIMEDOUT:vs.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&cs.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),cs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=Qs(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=Qs(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new zs(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const w=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!w||Hs.protocols.includes(w)?m.send(o||null):n(new vs("Unsupported protocol "+w+":",vs.ERR_BAD_REQUEST,e))})},uc=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof vs?t:new zs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new vs(`timeout of ${t}ms exceeded`,vs.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>cs.asap(a),s}},lc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of dc(e))yield*lc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var pc=n(8287).hp;const fc="1.16.0",{isFunction:mc}=cs,yc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},wc=e=>{const t=cs.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=cs.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?mc(o):"function"==typeof fetch,c=mc(i),u=mc(a);if(!s)return!1;const l=s&&mc(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&yc(()=>{let e=!1;const t=new i(Hs.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&yc(()=>cs.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new vs(`Response type '${e}' is not supported`,vs.ERR_NOT_SUPPORT,n)})});const y=async(e,t)=>{const n=cs.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(cs.isBlob(e))return e.size;if(cs.isSpecCompliantForm(e)){const t=new i(Hs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return cs.isArrayBufferView(e)||cs.isArrayBuffer(e)?e.byteLength:(cs.isURLSearchParams(e)&&(e+=""),cs.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:w,responseType:g,headers:b,withCredentials:v="same-origin",fetchOptions:E,maxContentLength:S,maxBodyLength:A}=sc(e);const T=cs.isNumber(S)&&S>-1,_=cs.isNumber(A)&&A>-1;let O=o||fetch;g=g?(g+"").toLowerCase():"text";let R=uc([u,l&&l.toAbortSignal()],d),k=null;const I=R&&R.unsubscribe&&(()=>{R.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==pc&&"function"==typeof pc.byteLength)return pc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>S)throw new vs("maxContentLength size of "+S+" exceeded",vs.ERR_BAD_RESPONSE,e,k)}if(_&&"get"!==n&&"head"!==n){const t=await y(b,s);if("number"==typeof t&&isFinite(t)&&t>A)throw new vs("Request body larger than maxBodyLength limit",vs.ERR_BAD_REQUEST,e,k)}if(w&&p&&"get"!==n&&"head"!==n&&0!==(C=await y(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(cs.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=$s(C,Qs(ec(w)));s=hc(n.body,65536,e,t)}}cs.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(cs.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+fc,!1);const u={...E,signal:R,method:n.toUpperCase(),headers:b.normalize().toJSON(),body:s,duplex:"half",credentials:o?v:void 0};k=c&&new i(t,u);let l=await(c?O(k,E):O(t,u));if(T){const t=cs.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>S)throw new vs("maxContentLength size of "+S+" exceeded",vs.ERR_BAD_RESPONSE,e,k)}const d=f&&("stream"===g||"response"===g);if(f&&l.body&&(h||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=cs.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&$s(n,Qs(ec(h),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>S))throw new vs("maxContentLength size of "+S+" exceeded",vs.ERR_BAD_RESPONSE,e,k);r&&r(t)};l=new a(hc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}g=g||"text";let N=await m[cs.findKey(m,g)||"text"](l,e);if(T&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>S)throw new vs("maxContentLength size of "+S+" exceeded",vs.ERR_BAD_RESPONSE,e,k)}return!d&&I&&I(),await new Promise((t,n)=>{Ys(t,n,{data:N,headers:ws.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:k})})}catch(t){if(I&&I(),R&&R.aborted&&R.reason instanceof vs){const n=R.reason;throw n.config=e,k&&(n.request=k),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new vs("Network Error",vs.ERR_NETWORK,e,k,t&&t.response),{cause:t.cause||t});throw vs.from(t,t&&t.code,e,k,t&&t.response)}}},gc=new Map,bc=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=gc;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:wc(t)),u=s;return s},vc=(bc(),{http:null,xhr:cc,fetch:{get:bc}});cs.forEach(vc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Ec=e=>`- ${e}`,Sc=e=>cs.isFunction(e)||null===e||!1===e;const Ac={getAdapter:function(e,t){e=cs.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Ec).join("\n"):" "+Ec(e[0]):"as no adapter specified";throw new vs("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:vc};function Tc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new zs(null,e)}function _c(e){Tc(e),e.headers=ws.from(e.headers),e.data=Js.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ac.getAdapter(e.adapter||Xs.adapter,e)(e).then(function(t){Tc(e),e.response=t;try{t.data=Js.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=ws.from(t.headers),t},function(t){if(!Vs(t)&&(Tc(e),t&&t.response)){e.response=t.response;try{t.response.data=Js.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=ws.from(t.response.headers)}return Promise.reject(t)})}const Oc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Oc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Rc={};Oc.transitional=function(e,t,n){function r(e,t){return"[Axios v"+fc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new vs(r(o," has been removed"+(t?" in "+t:"")),vs.ERR_DEPRECATED);return t&&!Rc[o]&&(Rc[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Oc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const kc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new vs("options must be an object",vs.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new vs("option "+i+" must be "+n,vs.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new vs("Unknown option "+i,vs.ERR_BAD_OPTION)}},validators:Oc},Ic=kc.validators;class Cc{constructor(e){this.defaults=e||{},this.interceptors={request:new Ls,response:new Ls}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ic(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&kc.assertOptions(n,{silentJSONParsing:Ic.transitional(Ic.boolean),forcedJSONParsing:Ic.transitional(Ic.boolean),clarifyTimeoutError:Ic.transitional(Ic.boolean),legacyInterceptorReqResOrdering:Ic.transitional(Ic.boolean)},!1),null!=r&&(cs.isFunction(r)?t.paramsSerializer={serialize:r}:kc.assertOptions(r,{encode:Ic.function,serialize:Ic.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),kc.assertOptions(t,{baseUrl:Ic.spelling("baseURL"),withXsrfToken:Ic.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&cs.merge(o.common,o[t.method]);o&&cs.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=ws.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;s=s&&e.synchronous;const n=t.transitional||xs;n&&n.legacyInterceptorReqResOrdering?a.unshift(e.fulfilled,e.rejected):a.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[_c.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new zs(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Pc(function(t){e=t});return{token:t,cancel:e}}}const Lc=Pc;const xc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(xc).forEach(([e,t])=>{xc[t]=e});const Uc=xc;const Dc=function e(t){const n=new Nc(t),r=ya(Nc.prototype.request,n);return cs.extend(r,Nc.prototype,n,{allOwnKeys:!0}),cs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ic(t,n))},r}(Xs);Dc.Axios=Nc,Dc.CanceledError=zs,Dc.CancelToken=Lc,Dc.isCancel=Vs,Dc.VERSION=fc,Dc.toFormData=Os,Dc.AxiosError=vs,Dc.Cancel=Dc.CanceledError,Dc.all=function(e){return Promise.all(e)},Dc.spread=function(e){return function(t){return e.apply(null,t)}},Dc.isAxiosError=function(e){return cs.isObject(e)&&!0===e.isAxiosError},Dc.mergeConfig=ic,Dc.AxiosHeaders=ws,Dc.formToJSON=e=>Ws(cs.isHTMLForm(e)?new FormData(e):e),Dc.getAdapter=Ac.getAdapter,Dc.HttpStatusCode=Uc,Dc.default=Dc;const Mc=Dc;var Bc=n(3612);const jc=function(){if(Bc.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return jc("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return jc("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return jc("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(jc("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return jc("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){jc("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),jc("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(jc("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();s(Gc,"DEFAULT_TIMEOUT",3e3);const Fc=new Gc;var Xc,Jc;function Vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Yc().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},Qc=function(){var e=qc();return".".concat(e)},$c=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(jc("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=l(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},eu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=qc(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=l(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},tu=function(){return Yc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},nu=function(e){return function(e,t){if("string"!=typeof e)throw new d("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new d(`Invalid token specified: missing part #${n+1}`);let o;try{o=h(r)}catch(e){throw new d(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new d(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},ru=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=qc().split(".")[0],e.prev=1,e.next=2,Mc({method:"get",url:"".concat(Bc.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return jc("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,i=e.catch(1),jc("Apple Sub Check: Request Failure: ",i),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),ou=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Mc({method:"get",url:"".concat(Bc.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(tu())),headers:{"X-Api-Key":Bc.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),iu=function(){return"complete"===document.readyState},au=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(iu())t();else{jc("UIHandler: ","Waiting for the body to load...");var i=setInterval(r(o.mark(function r(){return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&(n=iu()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},su=function(){return new Promise(function(e){if(("interactive"===document.readyState||iu())&&window.dataLayer)jc("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{jc("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},cu=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,su();case 1:return jc("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",jc("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return jc("Utils dataLayerLoop: look for this element ",e),e[t]?(jc("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(jc("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),uu=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,cu(t);case 1:return n=e.sent,jc("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),lu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(jc("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return jc("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){jc("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),jc("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),du=function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Fc.blueConicReady();case 1:if(t=e.sent,jc("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,lu();case 2:if(n=e.sent,jc("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return r=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){r.loadValues(["auth0_id"],null,function(){e()})});case 4:return i=r.getValue("auth0_id"),jc("bcGetAuth0Id | auth0_id:",i),e.abrupt("return",i);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),hu=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,Fc.blueConicReady();case 1:if(a=e.sent,jc("bcLowaCheck | BC load status: ",a),!a){e.next=3;break}if(s=window.blueConicClient.getSegments(),jc("bcLowaCheck | BC segments for users: ",s),c=s.filter(function(e){return i.includes(e.name)}),jc("bcLowaCheck | BC userSubSegments: ",c),!(c.length>0)){e.next=3;break}return e.next=2,du();case 2:(u=e.sent)&&(n=!0,r=u);case 3:return t&&n&&pu(),l={isSub:n},r&&(l.uuid=r),e.abrupt("return",l);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),pu=function(){$c("bc_lowa_status",1,{path:"/",domain:Qc(),expires:7,secure:!0})},fu=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(jc("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(jc("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};jc("utils | Event: authentication ready: ",r),e(r)}catch(e){jc(e),t(e)}},!1))})},mu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return Bc.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(jc("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,jc("Received entitlementsReady event:",r),e(r)}catch(e){Kc("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(jc("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yu=function(){eu(Hc.AUTH0_SUB_COOKIE_KEY),eu("mng-jwt-decoded"),localStorage.removeItem(Hc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){jc("Clearing entitlements...");try{eu(Hc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){jc("Failed to delete legacy cookie: ",e)}try{eu(Hc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:qc(),expires:365,secure:!0})}catch(e){jc("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Hc.LOCAL_STORAGE_SESSION_KEY)}catch(e){jc("Failed to remove local storage: ",e)}}()},wu=function(){var e=Yc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},gu=function(e){jc("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),jc("Storage Object removed : ",e))},bu=function(e){jc("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return jc("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=bu;var vu;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Eu=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===vu){e.next=1;break}return e.abrupt("return",vu);case 1:return t=Bc.A.auth0Domain,n=Bc.A.auth0ClientId,vu=new ma({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",vu);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Su=function(e){jc("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,jc("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),jc("utils | Dispatched authenticationReady event"),Jc=new CustomEvent("mng-auth-check-complete",{detail:e}),Xc?(jc("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(Jc)):jc("Islands not ready")};var Au=function(e){Bc.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Tu=function(){var e=r(o.mark(function e(t){var n,r,a,s,c,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,jc("deleteUserCache","Setting up cache deletion for ".concat(t)),n=tu(),jc("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,Mc({method:"DELETE",url:"".concat(Bc.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":Bc.A.entitlementsApiKey}});case 1:if(a=e.sent,s=a.data,c=/Succesfully deleted/i,!("object"===i(s)&&Object.prototype.hasOwnProperty.call(s,"message"))||!c.test(s.message)){e.next=2;break}return jc("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return jc("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(s)),e.abrupt("return",{success:!1});case 3:return e.prev=3,u=e.catch(0),jc("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),_u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=r(o.mark(function r(){var a,s,c,u,l,d,h,p,f,m,y;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:zc({},i)}));case 1:return r.next=2,uu();case 2:return c=r.sent,r.next=3,cu("Paywall_Level");case 3:if(u=r.sent,"article"===c&&"free"!==u){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==c?"Page type is not an article":"Free article"}));case 4:return r.next=5,mu();case 5:if(!(l=r.sent)||!l.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==u){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(d=null===(s=window.ConnextUtils)||void 0===s?void 0:s.runningSophi,jc("checkPaywallStatus - Sophi is running: ",d),!d){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:zc({},i)})},{once:!0}),r.next=12;break;case 8:if(d){r.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown",!1),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([h,p]);case 10:!0===(f=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(f)),r.next=12;break;case 11:r.prev=11,m=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:zc({},i)}));case 13:r.prev=13,y=r.catch(0),n(y);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=_u);function Ou(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Ru=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Fc.blueConicReady();case 1:return e.next=2,fu();case 2:return e.abrupt("return",new Promise(function(e){jc("ANALYTICS: inside BCregwall events");var t=Yc();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ku=function(e){try{window.dataLayer.push({event:e}),jc("ANALYTICS: ".concat(e," event")),jc("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){jc("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Iu=function(){try{var e=localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){jc("Unable to get session from local storage: ",e)}return"{}"},Cu=function(e){try{jc("Setting local storage session",e),localStorage.setItem(Hc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){jc("Unable to save session from local storage: ",e)}},Nu=function(e){try{$c(Hc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:Qc(),expires:365,secure:!0})}catch(e){jc("Unable to save session to cookie storage: ",e)}},Pu=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Bc.A.sessionServer,n="".concat(t,"/api/session"),jc("Checking server session: ",n),e.next=1,Mc.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return l=r.data.entitlementTokenDecoded,d=r.data,h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=null!==(i=null==l?void 0:l.entitlement_expiry)&&void 0!==i?i:null,y=null!==(a=null==l?void 0:l.entitlement_source)&&void 0!==a?a:null,w=null!==(s=null==l?void 0:l.entitlement_entitled)&&void 0!==s?s:null,g=null!==(c=null==l?void 0:l.entitlement_extras_adfree)&&void 0!==c?c:null,b=null!==(u=null==l?void 0:l.entitlement_level)&&void 0!==u?u:null,Cu(JSON.stringify({accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:y,isEntitled:w,adFree:g,entitlementLevel:b})),""!==f&&"string"==typeof f&&Nu(f),e.abrupt("return",{accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:y,isEntitled:w,adFree:g,entitlementLevel:b});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Lu=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=Bc.A.sessionServer,r="".concat(n,"/api/session"),jc("Updating server session: ",r),e.next=1,Mc.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),jc("Failed to update session server: ",i);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),xu=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=Bc.A.sessionServer,n="".concat(t,"/api/session"),jc("Deleting server session: ",n),e.next=1,Mc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),jc("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),Uu=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T,_,O,R,k,I;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(jc("Inside getSession"),e.prev=1,l=Iu(),jc("Session: __MNG_Session = ",l),d=JSON.parse(l),h=d.accessToken,p=d.idToken,f=d.entitlementToken,m=d.expiration,y=d.entitlementSource,w=d.isEntitled,g=d.adFree,b=d.entitlementLevel,n=h,i=m,a=y,s=w,c=g,u=b,jc("Session: check both tokens: ",t=p,r=f),void 0!==p&&void 0!==f&&null!==p&&null!==f){e.next=3;break}return jc("Session: missing id or entitlements, try session server"),e.next=2,Pu();case 2:v=e.sent,E=v.accessToken,S=v.idToken,A=v.entitlementToken,T=v.expiration,_=v.entitlementSource,O=v.isEntitled,R=v.adFree,k=v.entitlementLevel,n=E,t=S,r=A,i=T,a=_,s=O,c=R,u=k;case 3:e.next=5;break;case 4:e.prev=4,I=e.catch(1),jc("Failed to get session: ",I);case 5:return jc("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:a,isEntitled:s,adFree:c,entitlementLevel:u});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),Du=function(){var e=r(o.mark(function e(t){var n,r,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T,_,O,R,k,I,C,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Iu(),r=JSON.parse(n),i=r.accessToken,a=void 0===i?null:i,s=r.idToken,c=void 0===s?null:s,u=r.entitlementToken,l=void 0===u?null:u,d=r.expiration,h=void 0===d?null:d,p=r.entitlementSource,f=void 0===p?null:p,m=r.isEntitled,y=void 0===m?null:m,w=r.adFree,g=void 0===w?null:w,b=r.entitlementLevel,v=void 0===b?null:b,E=t.accessToken,S=t.idToken,A=t.entitlementToken,T=t.expiration,_=t.entitlementSource,O=t.isEntitled,R=t.adFree,k=t.entitlementLevel,I={accessToken:E??a,idToken:S??c,entitlementToken:A??l,expiration:T??h,entitlementSource:_??f,isEntitled:O??y,adFree:R??g,entitlementLevel:k??v},jc("Current session data: ",r),jc("New session data: ",t),jc("Updated session data:",I),C=JSON.stringify(I),Cu(C),""!==I.entitlementToken&&"string"==typeof I.entitlementToken&&Nu(I.entitlementToken),n===C){e.next=1;break}return e.next=1,Lu(I);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),jc("Unable to save session: ",N);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Mu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return jc("Ending session..."),yu(),e.next=1,xu();case 1:localStorage.removeItem(Hc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Bu="1"===window.authentication_config.isEmbedLoginEnabled,ju=function(){return"logout"===(Yc().searchParams.get("state")||"").toLowerCase()};Bu||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var Ku=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Eu();case 1:n=e.sent,jc("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Hu=function(){return"undefined"==typeof CnnXt?(jc("Connext was not loaded."),!1):Connext.Storage.GetUserState()},Wu=function(){jc("Check for SS paywall Cookie");var e=window.location.hostname,t=document.cookie.split(";").find(function(e){return e.trim().startsWith("vip-go-seg=vc-v1__has_access")});if(/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.?)+[a-zA-Z]{2,6}$/.test(e)&&t){jc("SS paywall Cookie found, removing it");var n=t.split("=")[0].trim();document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=").concat(e),document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}},Gu=function(){var e=r(o.mark(function e(){var t,n,i,a,s,c,u,l,d,h;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(jc("Attempting to logout..."),Wu(),jc("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?nu(n):"")){e.next=2;break}return a=i.auth0Id,e.next=1,Tu(a);case 1:e.sent.success?jc("User cache cleared."):jc("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,Mu();case 3:e.next=5;break;case 4:yu();case 5:return e.prev=5,jc("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:jc("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),jc("Failed to cycle through logout callbacks: ",h);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),jc("Removed Auth0 storage object...")}),gu("hhsl"),gu("userNewsLetterData"),gu(Hc.REGWALL_USER_IS_SUBSCRIBED),gu(Hc.USER_PROFILE_HASH),c=Yc(),u=window.location.origin;try{c.searchParams.get("returnURL")&&(l=decodeURIComponent(c.searchParams.get("returnURL")),u=l)}catch(e){jc(e),u=window.location.origin}return u=new URL(u),e.next=9,window.ConnextUtils.connextReady("onInit",!1);case 9:if(!e.sent){e.next=16;break}if(jc("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),jc("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),d=u,u.origin!==window.location.origin&&(d=new URL(window.location.origin)).searchParams.append("returnAfterLogout",u),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",d),!wu()){e.next=10;break}jc("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==Hu()){e.next=14;break}if(jc("Connext user state is logged in, setting timeout..."),setTimeout(r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return jc("Connext took too long to logout, calling auth0 logout..."),e.next=1,Ku(u);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return jc("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return jc("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return jc("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,Ku(u);case 15:e.next=17;break;case 16:return jc("Connext Logout was NOT called"),e.next=17,Ku(u);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Fu=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},Xu=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return ku(e)}),jc("Cycled through preauth GTM events.")},Ju=function(){var e=r(o.mark(function e(t,n,r,i,a){var s,c,u,l,d,h,p,f,m,y,w,g,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return jc("Attempting to login..."),Fu()>4.5&&window.localStorage.clear(),Xu(),i&&(s=[],c=window.localStorage.getItem("callbackEvents"),u=JSON.parse(c),s=u&&u.length>0?Ou(new Set([].concat(Ou(i),Ou(u)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(s))),l=null,e.next=1,Eu();case 1:if(d=e.sent,h=Yc(),p=h.origin,f=new URL("".concat(p,"/callback")),m={},h.searchParams.get("regwall")&&(h.searchParams.get("returnUrl")&&(y=h.searchParams.get("returnUrl")),h.searchParams.get("auth_redirect")&&(y=h.searchParams.get("auth_redirect"))),h.pathname.startsWith("/login")||h.pathname.startsWith("/callback")?h.searchParams.get("returnUrl")?f.searchParams.set("auth_redirect",h.searchParams.get("returnUrl")):a&&f.searchParams.set("auth_redirect",a):f.searchParams.set("auth_redirect",h.toString()),y&&"regwall"!==t&&f.searchParams.set("auth_redirect",y),"true"===h.searchParams.get("close-after-finish")&&f.searchParams.set("close-after-finish","true"),"true"!==h.searchParams.get("ssl")){e.next=4;break}if(!window.authentication_config.sessionManagementEnabled){e.next=3;break}return e.next=2,Mu();case 2:e.next=4;break;case 3:yu();case 4:return null!==(l=h.searchParams.get("login-with"))?m.connection=l:n&&(m.connection=n),w="none",t&&"regwall"===t&&(f.searchParams.set("regwall","true"),w="signUp",jc("Logging in with regwall")),t&&(f.searchParams.set("loginsource",t),jc("Logging in with ".concat(t))),r&&(m.login_hint=r),m.redirect_uri=f.toString(),m.initialScreen=w,"googleonetap"!==t&&(m.prompt="select_account"),null!==(g=h.searchParams.get("ampRegiWall"))&&(b=window.location.hostname,m.ampRegiWall=g,m.sourceDomain=b.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),m.initialScreen="signUp",m.preferenceId=h.searchParams.get("prefId")),e.next=5,d.loginWithRedirect({authorizationParams:m});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),Vu=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),r=JSON.parse(n);if(!r||0===r.length)return void e();jc("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){jc("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};jc("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){jc(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){jc("Failed to wait for callback events",t),e()}})},zu=function(){var e=r(o.mark(function e(){var t,n,i,a,s,c,u,l,d,h,p,f,m,y,w,g,b,v,E,S,A,T;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Wu(),t=Yc(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),a=t.searchParams.get("redirect_uri")||"",a.includes("applenews")?(jc("This is Apple prelogin flow."),(s=new URL(a))?(s.searchParams.append("post-apple-login","true"),jc("Post callback Apple redirect URL is ".concat(s)),Ju(!1,!1,!1,[],s)):Ju()):i.includes("post-apple-login")&&(jc("This is Apple Callback flow."),n=!0,(c=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=c),jc("Handling post login callback..."),!(u=t.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==u){e.next=1;break}return e.abrupt("return",Ju(!1,!1,!1,!1,i));case 1:n&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Eu();case 3:return l=e.sent,e.next=4,l.handleRedirectCallback();case 4:return e.next=5,l.getIdTokenClaims();case 5:return d=e.sent,e.next=6,l.getUser();case 6:return h=e.sent,jc("Auth0 user profile: ",h),p=d.__raw,e.next=7,l.getTokenSilently();case 7:return f=e.sent,e.prev=8,jc("Cycling through login callbacks..."),e.next=9,Vu();case 9:return m=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(p));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(m);case 10:jc("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),jc("Failed to cycle through login callbacks: ",S);case 12:if(y={accessToken:f,userId:h.sub,email:h.email,picture:h.picture},w=!1,g="",!n){e.next=17;break}return e.prev=13,e.next=14,ou(y.userId);case 14:return g=e.sent,jc("Encrypted apple uuid is: ".concat(g)),e.next=15,ru(g);case 15:w=e.sent,jc("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,A=e.catch(13),jc("Apple sub check error: ".concat(A)),alert("There was an error in logging you in, please try again.");case 17:if(gu(Hc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return jc("Saving idToken to session server"),e.next=18,Du({idToken:p,accessToken:f});case 18:if(!t.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!t.search.includes("loginsource")){e.next=20;break}return b=t.searchParams.get("loginsource"),v=window.MNGAuthentication.postAuthEvents.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(b));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(v);case 20:return e.prev=20,E=new URL(i),n&&w&&E.searchParams.append("access_token",g),jc("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,T=e.catch(20),jc("Failed to redirect after authentication: ",T),window.location.assign(new URL(window.location.origin)),e.abrupt("return","Finished execution, please await result...");case 22:case"end":return e.stop()}},e,null,[[8,11],[13,16],[20,21]])}));return function(){return e.apply(this,arguments)}}(),Yu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return jc("ANALYTICS: fireBC events"),e.next=1,Ru();case 1:jc("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Zu=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u,l,d,h,p,f;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,fu();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,a=nu(n),s=a.email,c=a.picture,u=a.sub,l=a.name,d=a.nickname,h=a.connection_source,p=null===(i=a.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,u.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:p||d||l,email:s,picture:c,userId:u,connectionSource:h});case 3:e.prev=3,f=e.catch(2),jc("Unable to parse idToken: ",n," Error: ",f);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();Bu||(window.MNGAuthentication.login=Ju,window.MNGAuthentication.logout=Gu,window.MNGAuthentication.getUserInfo=Zu);var qu=function(){var e=r(o.mark(function e(){var t,n,a,s,c,u,l,d,h,p,f,m,y;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Bu){e.next=1;break}return jc("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(t=Yc(),n=!1,a="",s=!1,c={},ju()&&window.ConnextUtils.rerunConnextEntitlements(!0),t.searchParams.get("returnAfterLogout")&&(u=decodeURIComponent(t.searchParams.get("returnAfterLogout")),window.location.assign(u)),t.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),l=function(){var e=r(o.mark(function e(){var t,r,u;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Eu();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return c=e.sent,e.next=3,t.isAuthenticated();case 3:if(n=e.sent,a="object"===i(c)?c.__raw:"",r=Zc(Hc.ENTITLEMENT_COOKIE_KEY),n||!r){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:s=e.sent;case 5:e.next=7;break;case 6:e.prev=6,u=e.catch(0),jc("Unable to verify user has active auth0 session: ",u);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!t.pathname.startsWith("/logout")){e.next=3;break}return jc("Page is logout. Routing to logout function..."),e.next=2,Gu();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,l();case 4:if(""===a){e.next=6;break}if(d=null,h=JSON.parse(window.localStorage.getItem(Hc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Iu()){e.next=5;break}return h&&(d=h.jwt),e.next=5,Du({idToken:a,entitlementToken:d});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,Uu();case 7:p=e.sent,a=p.idToken,(n="string"==typeof a)&&(c=nu(a)),e.next=9;break;case 8:e.prev=8,y=e.catch(6),jc("Unable to initialize session: ",y);case 9:e.next=11;break;case 10:return e.next=11,l();case 11:if(jc("Authentication Init | isAuthenticated:",n),jc("Authentication Init | accessToken:",s),n||s||!Bc.A.blueconicEnabled||!Bc.A.bcLowaSegements){e.next=13;break}return jc("BlueConic LOWA | entering bcLowaCheck"),e.next=12,hu(!0);case 12:f=e.sent,jc("BlueConic LOWA | bcLowaCheck result:",f),f.isSub?(jc("BlueConic LOWA | authenticated as LOWA"),n=Hc.USER_IS_LOWA,c={sub:f.uuid}):jc("BlueConic LOWA | NOT a subscriber");case 13:if(Su({isAuthenticated:n,idToken:a,accessToken:s,claims:c}),Au("authenticationReady"),!0===n?(jc("User is authenticated."),t.searchParams.get("auth_redirect")&&(jc("Auth Redirect is present, sending user to auth redirect..."),(m=t.searchParams.get("auth_redirect")).endsWith("#")&&(m=m.slice(0,m.length)),window.location.assign(m)),t.pathname.startsWith("/login")&&!ju()&&(jc("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):jc("User is not authenticated."),t.pathname.startsWith("/login")&&!ju()?(jc("Page is login. Attempting to log user in..."),Ju()):jc("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=15;break}return jc("Page is callback with regwall param. Routing to regwall receiver..."),e.next=14,Yu();case 14:jc("Now login from regwall"),Ju(),e.next=16;break;case 15:if(!t.pathname.startsWith("/callback")){e.next=16;break}return jc("Page is callback without regwall param. Routing to callback receiver..."),e.next=16,zu();case 16:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=qu;var Qu=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(jc("Connext was not loaded."),n(!1)),jc("connext subscribeToNewsletter","about to call Cnnxt NewsletterSubscribe with pref id ".concat(t," and email ").concat(e)),CnnXt.API.NewsletterSubscribe({email:e,id:t,onSuccess:function(){jc("Signed user up to newsletter: ",t),n(!0)},onError:function(e){jc("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){jc("subscribeToNewsletter Error:",e),n(!1)}})},$u=function(){document.addEventListener("click",function(e){if(e.target.classList.contains("connext-login")){var t=window.location.href,n=new URL(t),r=n.origin,o=new URL("".concat(r,"/login"));o.searchParams.set("returnUrl",n.toString()),window.location.assign(o)}})},el=function(){wu()||document.addEventListener("onInit",function(){if("undefined"!=typeof Connext){var e,t,n,r=Connext;t="Logout",n=function(){return function(){alert("Warning! You called Connext.Logout() directly! Calling MNGAuthentication.logout() next."),window.MNGAuthentication.logout()}},(e=r)._logout=Connext.Logout,e[t]=n(e[t])}})},tl=function(e){try{"string"==typeof e&&$c(Hc.AUTH0_SUB_COOKIE_KEY,e,{domain:Qc(),path:"/",expires:365,secure:!0})}catch(e){jc("Failed to set auth0_sub cookie: ",e)}},nl=function(e){if(!Zc(Hc.AUTH0_SUB_COOKIE_KEY))try{var t=e.claims;if(null==t||"object"!==i(t)&&!Object.keys(t).includes("sub"))return;var n=t.sub;tl(n)}catch(e){jc("Failed to set auth0_sub: ",e)}},rl=function(e){try{if("string"==typeof e){var t=nu(e).sub;tl(t)}else jc("Could not set auth0_sub on login, idToken was not available.")}catch(e){jc("Failed to set auth0_sub on login: ",e)}},ol=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=window.localStorage.getItem("newsletter_to_subscribe"))){e.next=4;break}return e.next=1,window.ConnextUtils.connextReady("onFinish");case 1:return e.next=2,Zu();case 2:return n=e.sent,r=n.email,jc("CONNEXT: about to sign up ".concat(r," to ").concat(t)),e.next=3,Qu(r,t);case 3:window.localStorage.removeItem("newsletter_to_subscribe"),jc("CONNEXT: newsletter_to_subscribe value removed from local storage.");case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const il={init:function(){var e=r(o.mark(function e(){var t;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return $u(),el(),ol(),MNGAuthentication.oidcLoginCallbacks.push(rl),window.ConnextUtils.runConnextIfSilent(),e.next=1,fu();case 1:t=e.sent,nl(t);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return il.init(),e.next=1,au(!0);case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.connext.bundle.js.map; /*! For license information please see mng-digisubs.entitlements.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|y(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(q(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(q(e,ArrayBuffer)||e&&q(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(q(e,SharedArrayBuffer)||e&&q(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?s(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||q(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function w(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:E(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function R(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return A(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":case"latin1":case"binary":return v(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function _(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function L(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function x(e,t,n,r,o){j(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){j(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||P(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Z(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||P(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||P(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||P(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Z(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||P(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||P(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||P(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){L(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Z(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Z(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);L(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||L(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Z(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Z(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function j(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function K(e,t){if("number"!=typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new H.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=F(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=F(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function V(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Y(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}const $=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Z(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=f,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,r),i-=u}return(h?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+h]=255&s,h+=p,s/=256,o-=8);for(a=a<0;e[n+h]=255&a,h+=p,a/=256,u-=8);e[n+h-p]|=128*y}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,f={p:0,n:0,v:t,a:h,f:h.bind(t,4),d:function(e,n){return i=e,a=0,s=t,f.n=n,u}};function h(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=p===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=h&&((o=e<2&&hr||r>p)&&(i[4]=e,i[5]=r,f.n=p,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,p){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&h(l,p),a=l,s=p;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(f.n=-1),h(a,s)):f.n=s:f.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=f.n<0)?s:e.call(r,f))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function f(){}n=Object.getPrototypeOf;var h=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),p=f.prototype=l.prototype=Object.create(h);function y(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,r(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return d.prototype=f,r(p,"constructor",f),r(f,"constructor",d),d.displayName="GeneratorFunction",r(f,s,"GeneratorFunction"),r(p),r(p,s,"Generator"),r(p,a,function(){return this}),r(p,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m:y}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function f(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var h={throw:1,return:2,break:3,continue:3};function p(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,h[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(p(e),n,r,o&&o.reverse())},isGeneratorFunction:f,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(f(t)?a:i)(p(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(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},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>$i,hasStandardBrowserEnv:()=>Qi,hasStandardBrowserWebWorkerEnv:()=>ea,navigator:()=>Zi,origin:()=>ta});var o=n(4756);function i(e){return i="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},i(e)}var a=n(3612);const s=function(){if(a.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}h.prototype.name="InvalidTokenError","function"==typeof SuppressedError&&SuppressedError;Error;var y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},w={},m={};Object.defineProperty(m,"__esModule",{value:!0});var g=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();m.default=function(){return g.getInstance()};var E=y&&y.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},A=y&&y.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[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 E(this,void 0,void 0,function(){return A(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 E(this,void 0,void 0,function(){var n,r,o,i;return A(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?T:this.storageHandler,r=S+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,v.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),v.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;c(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;_=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;ce=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Z("The input to be decoded is not correctly encoded.",q,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw Z("".concat(n," must be a non-negative number"),q,o);return}throw Z("".concat(n," must be a positive number"),q,o)}catch(e){if(r)throw he(e.message,r,o);throw e}}function Ee(e,t,n,r){try{if("string"!=typeof e)throw Z("".concat(t," must be a string"),z,r);if(0===e.length)throw Z("".concat(t," must not be empty"),q,r)}catch(e){if(n)throw he(e.message,n,r);throw e}}function Ae(e){!function(e,t){if(Je(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();"".concat(r.join(", "),", or ").concat(e)}else 2===r.length?"".concat(r[0]," or ").concat(r[1]):r[0];return he(t,ht,e)}(e,t)}(e,"application/json")}function be(){return le(crypto.getRandomValues(new Uint8Array(32)))}function ve(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new de("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new de("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new de("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new de("unsupported CryptoKey algorithm name",{cause:e})}}function Se(e){const t=null==e?void 0:e[ee];return"number"==typeof t&&Number.isFinite(t)?t:0}function Te(e){const t=null==e?void 0:e[te];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Re(){return Math.floor(Date.now()/1e3)}function Oe(e){if("object"!=typeof e||null===e)throw Z('"as" must be an object',z);Ee(e.issuer,'"as.issuer"')}function Ne(e){if("object"!=typeof e||null===e)throw Z('"client" must be an object',z);Ee(e.client_id,'"client.client_id"')}function _e(e){return Ee(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Ie(e,t){const{key:n,kid:r}=e instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&Ee(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Z("".concat(t," must be a CryptoKey"),z)}(e,t),"private"!==e.type)throw Z("".concat(t," must be a private CryptoKey"),q)}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:ve(n),kid:r},u=function(e,t){const n=Re()+Se(t);return{jti:be(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===t[re]||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw Z('CryptoKey instances used for signing assertions must include "sign" in their "usages"',q);const r="".concat(le(se(JSON.stringify(e))),".").concat(le(se(JSON.stringify(t)))),o=le(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Tt(e)};case"RSA-PSS":switch(St(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new de("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return St(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new de("unsupported CryptoKey algorithm name",{cause:e})}(n),n,se(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const Ce=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function ke(e,t){if(t&&"https:"!==e.protocol)throw he("only requests to HTTPS are allowed",yt,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw he("only HTTP and HTTPS requests are allowed",wt,e)}function Pe(e,t,n,r){let o;if("string"!=typeof e||!Ce(e))throw he("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?At:bt,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return ke(o,r),o}function Le(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Pe(e.mtls_endpoint_aliases[t],t,n,r):Pe(e[t],t,n,r)}class xe extends Error{constructor(e,t){var n;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"error",void 0),G(this,"status",void 0),G(this,"error_description",void 0),G(this,"response",void 0),this.name=this.constructor.name,this.code=ct,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}class Ue extends Error{constructor(e,t){var n,r;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"error",void 0),G(this,"error_description",void 0),this.name=this.constructor.name,this.code=lt,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==t.cause.get("error_description")&&void 0!==n?n:void 0,null===Error.captureStackTrace||void 0===r||r.call(Error,this,this.constructor)}}class De extends Error{constructor(e,t){var n;super(e,t),G(this,"cause",void 0),G(this,"code",void 0),G(this,"response",void 0),G(this,"status",void 0),this.name=this.constructor.name,this.code=st,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}const Me="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",Be="("+Me+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',He="("+Me+")\\s*=\\s*("+Me+")",Ge=new RegExp("^[,\\s]*("+Me+")"),Fe=new RegExp("^[,\\s]*"+Be+"[,\\s]*(.*)"),je=new RegExp("^[,\\s]*"+He+"[,\\s]*(.*)"),Ke=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function We(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(function(e){if(!Y(e,Response))throw Z('"response" must be an instance of Response',z);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(Ge);const i=null===t||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(r.match(Fe)){if([,n,o,r]=t,o.includes("\\"))try{JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!r.match(je)){if(r.match(Ke)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new De("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),await async function(e){if(e.status>399&&e.status<500){vt(e),Ae(e);try{const t=await e.clone().json();if(pe(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===e.body||void 0===r?void 0:r.cancel()),new xe("server responded with an error in the response body",{cause:t,response:e});throw he('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),pt,e)}}function Xe(e){if(!tt.has(e))throw Z('"options.DPoP" is not a valid DPoPHandle',q)}function Je(e){var t;return null===e.headers.get("content-type")||void 0===t?void 0:t.split(";")[0]}async function Ve(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[ne])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:we(r,null==a?void 0:a.signal)})}async function Ye(e,t,n,r,o,i){var a;const s=Le(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Q]));o.set("grant_type",r);const c=ye(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Xe(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Ve(e,t,n,s,o,c,i);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(u,s),u}const qe=new WeakMap,ze=new WeakMap;function $e(e){if(!e.id_token)return;const t=qe.get(e);if(!t)throw Z('"ref" was already garbage collected or did not resolve from the proper sources',q);return t}async function Ze(e,t,n,r,o,i){if(Oe(e),Ne(t),!Y(n,Response))throw Z('"response" must be an instance of Response',z);await We(n,200,"Token Endpoint"),vt(n);const a=await It(n);if(Ee(a.access_token,'"response" body "access_token" property',ft,{body:a}),Ee(a.token_type,'"response" body "token_type" property',ft,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;ge(e,!0,'"response" body "expires_in" property',ft,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Ee(a.refresh_token,'"response" body "refresh_token" property',ft,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw he('"response" body "scope" property must be a string',ft,{body:a});if(void 0!==a.id_token){Ee(a.id_token,'"response" body "id_token" property',ft,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(ge(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new de("JWE decryption is not configured",{cause:e});await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw he("Invalid JWT",ft,e);try{JSON.parse(se(le(s)))}catch(e){throw he("failed to parse JWT Header body as base64url encoded JSON",dt,e)}if(!pe(i))throw he("JWT Header must be a top level object",ft,e);if(t(i),void 0!==i.crit)throw new de('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{JSON.parse(se(le(c)))}catch(e){throw he("failed to parse JWT Payload body as base64url encoded JSON",dt,e)}if(!pe(a))throw he("JWT Payload must be a top level object",ft,e);const l=Re()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw he('unexpected JWT "exp" (expiration time) claim type',ft,{claims:a});if(a.exp<=l-r)throw he('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',mt,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw he('unexpected JWT "iat" (issued at) claim type',ft,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw he('unexpected JWT "iss" (issuer) claim type',ft,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw he('unexpected JWT "nbf" (not before) claim type',ft,{claims:a});if(a.nbf>l+r)throw he('unexpected JWT "nbf" (not before) claim value',mt,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw he('unexpected JWT "aud" (audience) claim type',ft,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Rt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Se(t),Te(t),o).then(ot.bind(void 0,i)).then(et.bind(void 0,e)).then(Qe.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw he('ID Token "aud" (audience) claim includes additional untrusted audiences',gt,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw he('unexpected ID Token "azp" (authorized party) claim value',gt,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&ge(s.auth_time,!0,'ID Token "auth_time" (authentication time)',ft,{claims:s}),ze.set(n,c),qe.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new de("unsupported `token_type` value",{cause:{body:a}});return a}function Qe(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw he('unexpected JWT "aud" (audience) claim value',gt,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw he('unexpected JWT "aud" (audience) claim value',gt,{expected:e,claims:t.claims,claim:"aud"});return t}function et(e,t){var n,r;const o=null!==(null===e[kt]||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw he('unexpected JWT "iss" (issuer) claim value',gt,{expected:o,claims:t.claims,claim:"iss"});return t}const tt=new WeakSet,nt=Symbol(),rt={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function ot(e,t){for(const n of e)if(void 0===t.claims[n])throw he('JWT "'.concat(n,'" (').concat(rt[n],") claim missing"),ft,{claims:t.claims});return t}const it=Symbol(),at=Symbol();const st="OAUTH_WWW_AUTHENTICATE_CHALLENGE",ct="OAUTH_RESPONSE_BODY_ERROR",ut="OAUTH_UNSUPPORTED_OPERATION",lt="OAUTH_AUTHORIZATION_RESPONSE_ERROR",dt="OAUTH_PARSE_ERROR",ft="OAUTH_INVALID_RESPONSE",ht="OAUTH_RESPONSE_IS_NOT_JSON",pt="OAUTH_RESPONSE_IS_NOT_CONFORM",yt="OAUTH_HTTP_REQUEST_FORBIDDEN",wt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",mt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",gt="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Et="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",At="OAUTH_MISSING_SERVER_METADATA",bt="OAUTH_INVALID_SERVER_METADATA";function vt(e){if(e.bodyUsed)throw Z('"response" body has been used already',q)}function St(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new de("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Tt(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new de("unsupported ECDSA namedCurve",{cause:e})}}function Rt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw he('unexpected JWT "alg" header parameter',ft,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw he('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw he('unexpected JWT "alg" header parameter',ft,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw he('unexpected JWT "alg" header parameter',ft,{header:r,expected:e,reason:"client configuration"})}function Ot(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw he('"'.concat(t,'" parameter must be provided only once'),ft);return n}const Nt=Symbol(),_t=Symbol();async function It(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ae;try{await e.json()}catch(t){throw n(e),he('failed to parse "response" body as JSON',dt,t)}if(!pe(t))throw he('"response" body must be a top level object',ft,{body:t});return t}const Ct=Symbol(),kt=Symbol(),Pt=new TextEncoder,Lt=new TextDecoder;function xt(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function Ut(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},Bt=(e,t)=>e.name===t;function Ht(e,t){var n;if(e.hash,parseInt(n.name.slice(4),10)!==t)throw Mt("SHA-".concat(t),"algorithm.hash")}function Gt(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Ft=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),G(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),G(this,"claim",void 0),G(this,"reason",void 0),G(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}G(Kt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Wt extends jt{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),G(this,"code","ERR_JWT_EXPIRED"),G(this,"claim",void 0),G(this,"reason",void 0),G(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}G(Wt,"code","ERR_JWT_EXPIRED");class Xt extends jt{constructor(){super(...arguments),G(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}G(Xt,"code","ERR_JOSE_ALG_NOT_ALLOWED");class Jt extends jt{constructor(){super(...arguments),G(this,"code","ERR_JOSE_NOT_SUPPORTED")}}G(Jt,"code","ERR_JOSE_NOT_SUPPORTED"),G(class extends jt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),G(class extends jt{constructor(){super(...arguments),G(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Vt extends jt{constructor(){super(...arguments),G(this,"code","ERR_JWS_INVALID")}}G(Vt,"code","ERR_JWS_INVALID");class Yt extends jt{constructor(){super(...arguments),G(this,"code","ERR_JWT_INVALID")}}G(Yt,"code","ERR_JWT_INVALID"),G(class extends jt{constructor(){super(...arguments),G(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class qt extends jt{constructor(){super(...arguments),G(this,"code","ERR_JWKS_INVALID")}}G(qt,"code","ERR_JWKS_INVALID");class zt extends jt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}G(zt,"code","ERR_JWKS_NO_MATCHING_KEY");class $t extends jt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),G(this,Symbol.asyncIterator,void 0),G(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}G($t,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Zt extends jt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWKS_TIMEOUT")}}G(Zt,"code","ERR_JWKS_TIMEOUT");class Qt extends jt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),G(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}G(Qt,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const en=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},tn=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),nn=e=>en(e)||tn(e);function rn(e,t,n){try{return Dt(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function on(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const an=e=>on(e)&&"string"==typeof e.kty;async function sn(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];dn||(dn=new WeakMap);let o=dn.get(e);if(null!=o&&o[n])return o[n];const i=await un(j(j({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:dn.set(e,{[n]:i}),i};const hn=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},wn=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},mn=(e,t,n)=>{var r;const o=(e=>Ut(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){yn(e,48,"Invalid PKCS#8 structure"),pn(e),yn(e,2,"Expected version field");const t=pn(e);e.pos+=t,yn(e,48,"Expected algorithm identifier");pn(e);e.pos}(t),(e=>{const t=(e=>{yn(e,6,"Expected algorithm OID");const t=pn(e);return wn(e,t)})(e);if(hn(t,[43,101,110]))return"X25519";if(!hn(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");yn(e,6,"Expected curve OID");const n=pn(e),r=wn(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(hn(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new Jt("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new Jt('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)},gn=e=>null==e?void 0:e[Symbol.toStringTag],En=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var An,bn;let vn,Sn;if("undefined"==typeof navigator||null===(An=navigator.userAgent)||void 0===An||null===(bn=An.startsWith)||void 0===bn||!bn.call(An,"Mozilla/5.0 ")){const e="v6.8.3";Sn="".concat("openid-client","/").concat(e),vn={"user-agent":Sn}}const Tn=e=>Rn.get(e);let Rn,On;function Nn(e){return void 0!==e?_e(e):(On||(On=new WeakMap),(e,t,n,r)=>{let o;return(o=On.get(t))||(function(e,t){if("string"!=typeof e)throw kn("".concat(t," must be a string"),Cn);if(0===e.length)throw kn("".concat(t," must not be empty"),In)}(t.client_secret,'"metadata.client_secret"'),o=_e(t.client_secret),On.set(t,o)),o(e,t,n,r)})}const _n=ne,In="ERR_INVALID_ARG_VALUE",Cn="ERR_INVALID_ARG_TYPE";function kn(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Pn extends Error{constructor(e,t){var n;super(e,t),G(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===Error.captureStackTrace||void 0===n||n.call(Error,this,this.constructor)}}function Ln(e,t,n){return new Pn(e,{cause:t,code:n})}function xn(e){if(e instanceof TypeError||e instanceof Pn||e instanceof xe||e instanceof Ue||e instanceof De)throw e;if(e instanceof fe)switch(e.code){case yt:throw Ln("only requests to HTTPS are allowed",e,e.code);case wt:throw Ln("only requests to HTTP or HTTPS are allowed",e,e.code);case pt:throw Ln("unexpected HTTP response status code",e.cause,e.code);case ht:throw Ln("unexpected response content-type",e.cause,e.code);case dt:throw Ln("parsing error occured",e,e.code);case ft:throw Ln("invalid response encountered",e,e.code);case gt:throw Ln("unexpected JWT claim value encountered",e,e.code);case Et:throw Ln("unexpected JSON attribute value encountered",e,e.code);case mt:throw Ln("JWT timestamp claim value failed validation",e,e.code);default:throw Ln(e.message,e,e.code)}if(e instanceof de)throw Ln("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Ln("runtime operation error",e,ut);case"NotSupportedError":throw Ln("runtime unsupported operation",e,ut);case"TimeoutError":throw Ln("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Ln("operation aborted",e,"OAUTH_ABORT")}throw new Pn("something went wrong",{cause:e})}async function Un(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw kn('"server" must be an instance of URL',Cn);const o=!e.href.includes("/.well-known/"),i=null!==(null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw Z('"'.concat("issuerIdentifier",'" must be an instance of URL'),z);ke(e,!0!==(null==r?void 0:r[Q]));const o=n(new URL(e.href)),i=ye(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[ne])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:we(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=me("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=me("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Z('"options.algorithm" must be "oidc" (default), or "oauth2"',q)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[ne]:null==t?void 0:t[_n],[Q]:null==t||null===t.execute||void 0===r?void 0:r.includes(Kn),signal:a,headers:new Headers(vn)}):((null==t?void 0:t[_n])||fetch)((ke(e,null==t||null===t.execute||void 0===c||!c.includes(Kn)),e.href),{headers:Object.fromEntries(new Headers(j({accept:"application/json"},vn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Ct)throw Z('"expectedIssuerIdentifier" must be an instance of URL',z);if(!Y(t,Response))throw Z('"response" must be an instance of Response',z);if(200!==t.status)throw he('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',pt,t);vt(t);const r=await It(t);if(Ee(r.issuer,'"response" body "issuer" property',ft,{body:r}),n!==Ct&&new URL(r.issuer).href!==n.href)throw he('"response" body "issuer" property does not match the expected value',Et,{expected:n.href,body:r,attribute:"issuer"});return r}(Ct,e)).catch(xn);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[Dn]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new Pn("discovered metadata issuer does not match the expected issuer",{code:Et,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Mn(i,t,n,r);let s=Tn(a);if(null!=o&&o[_n]&&(s.fetch=o[_n]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const Dn=Symbol();class Mn{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw kn('"clientId" must be a non-empty string',Cn);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw kn('"clientId" and "metadata.client_id" must be the same',In);const u=j(j({},structuredClone(n)),{},{client_id:t});let l;u[ee]=null!==(i=null===(a=n)||void 0===a?void 0:a[ee])&&void 0!==i?i:0,u[te]=null!==(s=null===(c=n)||void 0===c?void 0:c[te])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?Nn(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const f=structuredClone(e);Dn in e&&(f[kt]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let h=Object.freeze(f);Rn||(Rn=new WeakMap),Rn.set(this,{__proto__:null,as:h,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Tn(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(Tn(this).c)}get timeout(){return Tn(this).timeout}set timeout(e){Tn(this).timeout=e}get[_n](){return Tn(this).fetch}set[_n](e){Tn(this).fetch=e}}function Bn(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const t=new Date;t.setSeconds(t.getSeconds()+e.expires_in),t.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return $e(this)}catch(e){return}}}}}(e))}async function Hn(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===e.headers.get("retry-after")||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&Math.ceil(n/1e3)}}if(o&&!Number.isFinite(a))throw new fe("invalid Retry-After header value",{cause:e});a>t&&await Gn(a-t,n)}function Gn(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function Fn(e,t){qn(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=Tn(e);return async function(e,t,n,r,o){Oe(e),Ne(t);const i=Le(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Q])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=ye(null==o?void 0:o.headers);return s.set("accept","application/json"),Ve(e,t,n,i,a,s,o)}(n,r,o,t,{[ne]:i,[Q]:!a,headers:new Headers(vn),signal:zn(s)}).then(e=>async function(e,t,n){if(Oe(e),Ne(t),!Y(n,Response))throw Z('"response" must be an instance of Response',z);await We(n,200,"Backchannel Authentication Endpoint"),vt(n);const r=await It(n);Ee(r.auth_req_id,'"response" body "auth_req_id" property',ft,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ge(o,!0,'"response" body "expires_in" property',ft,{body:r}),r.expires_in=o,void 0!==r.interval&&ge(r.interval,!1,'"response" body "interval" property',ft,{body:r}),r}(n,r,e)).catch(xn)}async function jn(e,t,n,r){var o,i;qn(e),new URLSearchParams(n);let a=null!==t.interval&&void 0!==o?o:5;const s=null!==(null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await Gn(a,s)}catch(e){xn(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:f,nonRepudiation:h,timeout:p,decrypt:y}=Tn(e),w=(o,i)=>jn(e,j(j({},t),{},{interval:o}),n,j(j({},r),{},{signal:s,flag:i})),m=await async function(e,t,n,r,o){Oe(e),Ne(t),Ee(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Ye(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[ne]:d,[Q]:!f,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(vn),signal:s.aborted?s:zn(p)}).catch(xn);var g;if(503===m.status&&m.headers.has("retry-after"))return await Hn(m,a,s,!0),await(null===m.body||void 0===g?void 0:g.cancel()),w(a);const E=async function(e,t,n,r){return Ze(e,t,n,void 0,null==r?void 0:r[oe],null==r?void 0:r.recognizedTokenTypes)}(c,u,m,{[oe]:y});let A;try{await E}catch(e){if($n(e,r))return w(a,Zn);if(e instanceof xe)switch(e.error){case"slow_down":0;case"authorization_pending":return await Hn(e.response,a,s),w(a)}xn(e)}return A.id_token&&await(null==h?void 0:h(m)),Bn(A),A}function Kn(e){Tn(e).tlsOnly=!1}async function Wn(e,t,n,r,o){if(qn(e),!((null==o?void 0:o.flag)===Zn||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw kn('"currentUrl" must be an instance of URL, or Request',Cn);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:f,hybrid:h,nonRepudiation:p,timeout:y,decrypt:w,implicit:m}=Tn(e);if((null==o?void 0:o.flag)===Zn)o.authResponse,o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Z("form_post responses are expected to use the POST method",q,{cause:e});if("application/x-www-form-urlencoded"!==Je(e))throw Z("form_post responses are expected to use the application/x-www-form-urlencoded content-type",q,{cause:e});return async function(e){if(e.bodyUsed)throw Z("form_post Request instances must contain a readable body",q,{cause:e});return e.text()}(e)}(e));if(h)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw kn("unexpected Request HTTP method",In)}}switch(function(e){return new URL(e).search="",e.hash="",e.href}(t),!0){case!!f:await f(t,null==n?void 0:n.expectedState);break;case!!h:await h(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!m:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{(function(e,t,n,r){if(Oe(e),Ne(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw Z('"parameters" must be an instance of URLSearchParams, or URL',z);if(Ot(n,"response"))throw he('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',ft,{parameters:n});const o=Ot(n,"iss"),i=Ot(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw he('response parameter "iss" (issuer) missing',ft,{parameters:n});if(o&&o!==e.issuer)throw he('unexpected "iss" (issuer) response parameter value',ft,{expected:e.issuer,parameters:n});switch(r){case void 0:case _t:if(void 0!==i)throw he('unexpected "state" response parameter encountered',ft,{expected:void 0,parameters:n});break;case Nt:break;default:if(Ee(r,'"expectedState" argument'),i!==r)throw he(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',ft,{expected:r,parameters:n})}if(Ot(n,"error"))throw new Ue("authorization response from the server is an error",{cause:n});const a=Ot(n,"id_token"),s=Ot(n,"token");if(void 0!==a||void 0!==s)throw new de("implicit and hybrid flows are not supported");return new URLSearchParams(n),tt.add(c),c;var c})(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){xn(e)}}}const g=await async function(e,t,n,r,o,i,a){if(Oe(e),Ne(t),!tt.has(r))throw Z('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',q);Ee(o,'"redirectUri"');const s=Ot(r,"code");if(!s)throw he('no authorization code in "callbackParameters"',ft);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==nt&&(Ee(i,'"codeVerifier"'),c.set("code_verifier",i)),Ye(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||nt,{additionalParameters:r,[ne]:l,[Q]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(vn),signal:zn(y)}).catch(xn);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const E=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:0;break;case it:break;default:Ee(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case at:break;default:ge(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Ze(e,t,n,s,i,a);Ee(c.id_token,'"response" body "id_token" property',ft,{body:c});const u=$e(c);if(o!==at){const e=Re()+Se(t),n=Te(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&{n_a:()=>{}},async function(e,t,n,r){return Ze(e,t,n,void 0,null==r?void 0:r[oe],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[oe]:l,recognizedTokenTypes:n})}).catch(xn);return Bn(d),d}async function er(e,t,n){if(!on(e))throw new Vt("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Vt('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Vt("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Vt("JWS Payload missing");if("string"!=typeof e.signature)throw new Vt("JWS Signature missing or incorrect type");if(void 0!==e.header&&!on(e.header))throw new Vt("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=Dt(e.protected);JSON.parse(Lt.decode(t))}catch(e){throw new Vt("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new Jt('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(Vt,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(r.b64,"boolean"!=typeof a))throw new Vt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Vt('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new Xt('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Vt("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Vt("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(await t(r,e),!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(an(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&En(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!nn(t))throw new TypeError(Ft(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(gn(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(an(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&En(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&En(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!nn(t))throw new TypeError(Ft(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(gn(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(gn(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(gn(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(gn(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(gn(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),e.length;return o}(void 0!==e.protected?xt(e.protected):new Uint8Array,xt("."),"string"==typeof e.payload?a?xt(e.payload):Pt.encode(e.payload):e.payload),d=rn(e.signature,"signature",Vt),f=await async function(e,t){if(e instanceof Uint8Array)return e;if(en(e))return e;if(tn(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{dn||(dn=new WeakMap);let n=dn.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(ln)}e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(ln);e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(ln);e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":0;break;case"RS256":case"PS256":case"RSA-OAEP-256":0;break;case"RS384":case"PS384":case"RSA-OAEP-384":0;break;case"RS512":case"PS512":case"RSA-OAEP-512":0;break;default:throw new TypeError(ln)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===e.asymmetricKeyDetails||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(ln);const i={ES256:"P-256",ES384:"P-384",ES512:"P-521"};i[t]&&n===i[t]&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),t.startsWith("ECDH-ES")&&e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"])}if(!i)throw new TypeError(ln);return n?n[t]=i:dn.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return fn(e,n,t)}if(an(e))return e.k?Dt(e.k):fn(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await sn(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new Jt("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,f,d,l))throw new Qt;let h;a?rn(e.payload,"payload",Vt):"string"==typeof e.payload?Pt.encode(e.payload):e.payload;const p={payload:h};return void 0!==e.protected&&(p.protectedHeader=r),void 0!==e.header&&(p.unprotectedHeader=e.header),u?j(j({},p),{},{key:f}):p}const tr=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function nr(e){const t=tr.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":Math.round(3600*n);break;case"day":case"days":case"d":Math.round(86400*n);break;case"week":case"weeks":case"w":Math.round(604800*n);break;default:Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const rr=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function or(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Lt.decode(t))}catch(e){}if(!on(n))throw new Yt("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||rr(e.typ)!==rr(o)))throw new Kt('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Kt('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Kt('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Kt('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!("string"==typeof n.aud?f.includes(d):Array.isArray(d)&&f.some(Set.prototype.has.bind(new Set(d)))))throw new Kt('unexpected "aud" claim value',n,"aud","check_failed");var d,f;let h;switch(typeof r.clockTolerance){case"string":nr(r.clockTolerance);break;case"number":r.clockTolerance;break;case"undefined":0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:p}=r,y=(p||new Date,Math.floor(w.getTime()/1e3));var w;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Kt('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Kt('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>y+h)throw new Kt('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Kt('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=y-h)throw new Wt('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=y-n.iat;if(e-h>("number"==typeof u?u:nr(u)))throw new Wt('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-h)throw new Kt('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function ir(e){return on(e)}var ar,sr,cr=new WeakMap,ur=new WeakMap;class lr{constructor(e){if(B(this,cr,void 0),B(this,ur,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(ir)}(e))throw new qt("JSON Web Key Set malformed");H(cr,this,structuredClone(e))}jwks(){return M(cr,this)}async getKey(e,t){const{alg:n,kid:r}=j(j({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new Jt('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=M(cr,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&r===e.kid,!t||"string"!=typeof e.alg&&"AKP"!==o||n===e.alg,t&&"string"==typeof e.use&&"sig"===e.use,t&&Array.isArray(e.key_ops)&&e.key_ops.includes("verify"),t)switch(n){case"ES256":"P-256"===e.crv;break;case"ES384":"P-384"===e.crv;break;case"ES512":"P-521"===e.crv;break;case"Ed25519":case"EdDSA":"Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new zt;if(1!==s){const e=new $t,t=M(ur,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new W(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield U(dr(t,e,n))}catch(e){}}),e}return dr(M(ur,this),a,n)}}async function dr(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!on(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||e.alg,null!=n||e.ext,e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return Dt(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new Jt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return un(j(j({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return un(j(j({},e),{},{ext:n}));case"EC":case"OKP":return un(j(j({},e),{},{alg:t,ext:n}));default:throw new Jt('Unsupported "kty" (Key Type) Parameter value')}}(j(j({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new qt("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function fr(e){const t=new lr(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let hr;if("undefined"==typeof navigator||null===(ar=navigator.userAgent)||void 0===ar||null===(sr=ar.startsWith)||void 0===sr||!sr.call(ar,"Mozilla/5.0 ")){const e="v6.2.2";hr="".concat("jose","/").concat(e)}const pr=Symbol(),yr=Symbol();var wr=new WeakMap,mr=new WeakMap,gr=new WeakMap,Er=new WeakMap,Ar=new WeakMap,br=new WeakMap,vr=new WeakMap,Sr=new WeakMap,Tr=new WeakMap,Rr=new WeakMap;class Or{constructor(e,t){if(B(this,wr,void 0),B(this,mr,void 0),B(this,gr,void 0),B(this,Er,void 0),B(this,Ar,void 0),B(this,br,void 0),B(this,vr,void 0),B(this,Sr,void 0),B(this,Tr,void 0),B(this,Rr,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;H(wr,this,new URL(e.href)),H(mr,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),H(gr,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),H(Er,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),H(vr,this,new Headers(null==t?void 0:t.headers)),hr&&!M(vr,this).has("User-Agent")&&M(vr,this).set("User-Agent",hr),M(vr,this).has("accept")||(M(vr,this).set("accept","application/json"),M(vr,this).append("accept","application/jwk-set+json")),H(Sr,this,null==t?void 0:t[pr]),void 0!==(null==t?void 0:t[yr])&&(H(Rr,this,null==t?void 0:t[yr]),null==t?void 0:t[yr],M(Er,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&on(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,on)&&(H(Ar,this,M(Rr,this).uat),H(Tr,this,fr(M(Rr,this).jwks))))}pendingFetch(){return!!M(br,this)}coolingDown(){return"number"==typeof M(Ar,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Zt;throw e});if(200!==o.status)throw new jt("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new jt("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(M(wr,this).href,M(vr,this),AbortSignal.timeout(M(mr,this)),M(Sr,this)).then(e=>{H(Tr,this,fr(e)),M(Rr,this)&&(M(Rr,this).uat=Date.now(),M(Rr,this).jwks=e),H(Ar,this,Date.now()),H(br,this,void 0)}).catch(e=>{throw H(br,this,void 0),e})),await M(br,this)}}const Nr=["mfaToken"],_r=["mfaToken"];var Ir,Cr,kr,Pr,Lr,xr,Ur,Dr,Mr,Br,Hr,Gr,Fr,jr,Kr,Wr,Xr=class extends Error{constructor(e,t){super(t),G(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Jr=class extends Error{constructor(e,t,n){super(t),G(this,"cause",void 0),G(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Vr=class extends Jr{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Yr=class extends Jr{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},qr=class extends Jr{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},zr=class extends Jr{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},$r=class extends Jr{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Zr=class extends Jr{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},Qr=class extends Error{constructor(e){super(e),G(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},eo=class extends Jr{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),G(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},to=class extends Jr{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},no=class extends Jr{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ro=class extends Jr{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},oo=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),G(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function io(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>j(j({},e),{},{[t[0]]:t[1]}),{})}var ao=class extends Error{constructor(e,t,n){super(t),G(this,"cause",void 0),G(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},so=class extends ao{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},co=class extends ao{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},uo=class extends ao{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},lo=class extends ao{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function fo(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var ho=(Ir=new WeakMap,Cr=new WeakMap,kr=new WeakMap,class{constructor(e){var t;B(this,Ir,void 0),B(this,Cr,void 0),B(this,kr,void 0),H(Ir,this,"https://".concat(e.domain)),H(Cr,this,e.clientId),H(kr,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(M(Ir,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await M(kr,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new so(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(fo)}async enrollAuthenticator(e){const t="".concat(M(Ir,this),"/mfa/associate"),{mfaToken:n}=e,r=K(e,Nr),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await M(kr,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new co(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(M(Ir,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await M(kr,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new uo(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(M(Ir,this),"/mfa/challenge"),{mfaToken:n}=e,r=K(e,_r),o={mfa_token:n,client_id:M(Cr,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await M(kr,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new lo(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),po=class e{constructor(e,t,n,r,o,i,a){G(this,"accessToken",void 0),G(this,"idToken",void 0),G(this,"refreshToken",void 0),G(this,"expiresAt",void 0),G(this,"scope",void 0),G(this,"claims",void 0),G(this,"authorizationDetails",void 0),G(this,"tokenType",void 0),G(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},yo=(Pr=new WeakMap,Lr=new WeakMap,xr=new WeakMap,class{constructor(e,t){B(this,Pr,new Map),B(this,Lr,void 0),B(this,xr,void 0),H(xr,this,Math.max(1,Math.floor(e))),H(Lr,this,Math.max(0,Math.floor(t)))}get(e){const t=M(Pr,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return M(Pr,this).delete(e),M(Pr,this).set(e,t),t.value;M(Pr,this).delete(e)}}set(e,t){for(M(Pr,this).has(e)&&M(Pr,this).delete(e),M(Pr,this).set(e,{value:t,expiresAt:Date.now()+M(Lr,this)});M(Pr,this).size>M(xr,this);){const e=M(Pr,this).keys().next().value;if(void 0===e)break;M(Pr,this).delete(e)}}}),wo=new Map;function mo(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var go=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,wo.get(i));var i;return o||(o=new yo(e.maxEntries,e.ttlMs),wo.set(t,o)),o}static createJwksCache(){return{}}},Eo="openid profile email offline_access",Ao=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function bo(e){if(null==e)throw new Zr("subject_token is required");if("string"!=typeof e)throw new Zr("subject_token must be a string");if(0===e.trim().length)throw new Zr("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Zr("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Zr("subject_token must not include the 'Bearer ' prefix")}function vo(e,t){if(t)for(const[n,r]of Object.entries(t))if(!Ao.has(n))if(Array.isArray(r)){if(r.length>20)throw new Zr("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var So="urn:ietf:params:oauth:token-type:access_token";Ur=new WeakMap,Dr=new WeakMap,Mr=new WeakMap,Br=new WeakMap,Hr=new WeakMap,Gr=new WeakMap,Fr=new WeakMap,jr=new WeakMap,Kr=new WeakMap,Wr=new WeakSet;function To(){const e=M(Br,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(M(Br,this).useMtls?"1":"0")}async function Ro(e){const t=await x(Wr,this,Io).call(this),n=new Mn(e,M(Br,this).clientId,M(Br,this).clientSecret,t);return n[_n]=M(Hr,this),n}async function Oo(){if(M(Ur,this)&&M(Dr,this))return{configuration:M(Ur,this),serverMetadata:M(Dr,this)};const e=x(Wr,this,To).call(this),t=M(Fr,this).get(e);if(t)return H(Dr,this,t.serverMetadata),H(Ur,this,await x(Wr,this,Ro).call(this,t.serverMetadata)),{configuration:M(Ur,this),serverMetadata:M(Dr,this)};const n=M(jr,this).get(e);if(n){const e=await n;return H(Dr,this,e.serverMetadata),H(Ur,this,await x(Wr,this,Ro).call(this,e.serverMetadata)),{configuration:M(Ur,this),serverMetadata:M(Dr,this)}}const r=(async()=>{const t=await x(Wr,this,Io).call(this),n=await Un(new URL("https://".concat(M(Br,this).domain)),M(Br,this).clientId,{use_mtls_endpoint_aliases:M(Br,this).useMtls},t,{[_n]:M(Hr,this)}),r=n.serverMetadata();return M(Fr,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});o.catch(()=>{}),M(jr,this).set(e,o);try{const{configuration:e,serverMetadata:t}=await r;H(Ur,this,e),H(Dr,this,t),M(Ur,this)[_n]=M(Hr,this)}finally{M(jr,this).delete(e)}return{configuration:M(Ur,this),serverMetadata:M(Dr,this)}}async function No(e){var t,n;const{configuration:r}=await x(Wr,this,Oo).call(this);if("audience"in e||"resource"in e)throw new Zr("audience and resource parameters are not supported for Token Vault exchanges");bo(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==t?t:So,requested_token_type:null!==e.requestedTokenType&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),vo(o,e.extra);try{const e=await Qn(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return po.fromTokenEndpointResponse(e)}catch(t){throw new Zr("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function _o(e){const{configuration:t}=await x(Wr,this,Oo).call(this);bo(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),vo(n,e.extra);try{const e=await Qn(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return po.fromTokenEndpointResponse(e)}catch(t){throw new Zr("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Io(){return M(Mr,this)||H(Mr,this,(async()=>{if(!M(Br,this).clientSecret&&!M(Br,this).clientAssertionSigningKey&&!M(Br,this).useMtls)throw new oo;if(M(Br,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=M(Br,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return mn(e,t,void 0)}(e,M(Br,this).clientAssertionSigningAlg||"RS256"),e?function(e){return Ie(e,void 0)}(e):Nn(M(Br,this).clientSecret)})().catch(e=>{throw H(Mr,this,void 0),e})),M(Mr,this)}async function Co(e){const{configuration:t}=await x(Wr,this,Oo).call(this),n=be(),r=await function(e){return async function(e){return Ee(e,"codeVerifier"),le(await crypto.subtle.digest("SHA-256",se(e)))}(e)}(n),o=io(j(j({},M(Br,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(j(j({scope:Eo},o),{},{client_id:M(Br,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Yn(t,i):await Vn(t,i),codeVerifier:n}}function ko(e,t){return function(){return e.apply(t,arguments)}}const{toString:Po}=Object.prototype,{getPrototypeOf:Lo}=Object,{iterator:xo,toStringTag:Uo}=Symbol,Do=(Mo=Object.create(null),e=>{const t=Po.call(e);return Mo[t]||(Mo[t]=t.slice(8,-1).toLowerCase())});var Mo;const Bo=e=>(e=e.toLowerCase(),t=>Do(t)===e),Ho=e=>t=>typeof t===e,{isArray:Go}=Array,Fo=Ho("undefined");function jo(e){return null!==e&&!Fo(e)&&null!==e.constructor&&!Fo(e.constructor)&&Xo(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ko=Bo("ArrayBuffer");const Wo=Ho("string"),Xo=Ho("function"),Jo=Ho("number"),Vo=e=>null!==e&&"object"==typeof e,Yo=e=>{if("object"!==Do(e))return!1;const t=Lo(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Uo in e||xo in e)},qo=Bo("Date"),zo=Bo("File"),$o=Bo("Blob"),Zo=Bo("FileList");const Qo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ei=void 0!==Qo.FormData?Qo.FormData:void 0,ti=Bo("URLSearchParams"),[ni,ri,oi,ii]=["ReadableStream","Request","Response","Headers"].map(Bo);function ai(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Go(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const ci="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,ui=e=>!Fo(e)&&e!==ci;const li=(di="undefined"!=typeof Uint8Array&&Lo(Uint8Array),e=>di&&e instanceof di);var di;const fi=Bo("HTMLFormElement"),hi=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),pi=Bo("RegExp"),yi=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ai(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const wi=Bo("AsyncFunction"),mi=(gi="function"==typeof setImmediate,Ei=Xo(ci.postMessage),gi?setImmediate:Ei?(Ai=`axios@${Math.random()}`,bi=[],ci.addEventListener("message",({source:e,data:t})=>{e===ci&&t===Ai&&bi.length&&bi.shift()()},!1),e=>{bi.push(e),ci.postMessage(Ai,"*")}):e=>setTimeout(e));var gi,Ei,Ai,bi;const vi="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ci):"undefined"!=typeof process&&process.nextTick||mi,Si={isArray:Go,isArrayBuffer:Ko,isBuffer:jo,isFormData:e=>{if(!e)return!1;if(ei&&e instanceof ei)return!0;const t=Lo(e);if(!t||t===Object.prototype)return!1;if(!Xo(e.append))return!1;const n=Do(e);return"formdata"===n||"object"===n&&Xo(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ko(e.buffer),t},isString:Wo,isNumber:Jo,isBoolean:e=>!0===e||!1===e,isObject:Vo,isPlainObject:Yo,isEmptyObject:e=>{if(!Vo(e)||jo(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ni,isRequest:ri,isResponse:oi,isHeaders:ii,isUndefined:Fo,isDate:qo,isFile:zo,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:$o,isRegExp:pi,isFunction:Xo,isStream:e=>Vo(e)&&Xo(e.pipe),isURLSearchParams:ti,isTypedArray:li,isFileList:Zo,forEach:ai,merge:function e(...t){const{caseless:n,skipUndefined:r}=ui(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&si(o,i)||i,s=hi(o,a)?o[a]:void 0;Yo(s)&&Yo(t)?o[a]=e(s,t):Yo(t)?o[a]=e({},t):Go(t)?o[a]=t.slice():r&&Fo(t)||(o[a]=t)};for(let e=0,n=t.length;e(ai(t,(t,r)=>{n&&Xo(t)?Object.defineProperty(e,r,{__proto__:null,value:ko(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Lo(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Do,kindOfTest:Bo,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Go(e))return e;let t=e.length;if(!Jo(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[xo]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:fi,hasOwnProperty:hi,hasOwnProp:hi,reduceDescriptors:yi,freezeMethods:e=>{yi(e,(t,n)=>{if(Xo(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];Xo(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Go(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:si,global:ci,isContextDefined:ui,isSpecCompliantForm:function(e){return!!(e&&Xo(e.append)&&"FormData"===e[Uo]&&e[xo])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Vo(e)){if(t.indexOf(e)>=0)return;if(jo(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Go(e)?[]:{};return ai(e,(e,t)=>{const i=n(e,r+1);!Fo(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:wi,isThenable:e=>e&&(Vo(e)||Xo(e))&&Xo(e.then)&&Xo(e.catch),setImmediate:mi,asap:vi,isIterable:e=>null!=e&&Xo(e[xo])},Ti=Si.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ri=e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&Ti[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};(Object.getOwnPropertyDescriptor(Ri,"name")||{}).writable||Object.defineProperty(Ri,"name",{value:"default",configurable:!0});const Oi=Symbol("internals"),Ni=/[^\x09\x20-\x7E\x80-\xFF]/g;function _i(e){return e&&String(e).trim().toLowerCase()}function Ii(e){return!1===e||null==e?e:Si.isArray(e)?e.map(Ii):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(Ni,""))}function Ci(e,t,n,r,o){return Si.isFunction(r)?r.call(this,t,n):(o&&(t=n),Si.isString(t)?Si.isString(r)?-1!==t.indexOf(r):Si.isRegExp(r)?r.test(t):void 0:void 0)}class ki{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=_i(t);if(!o)throw new Error("header name must be a non-empty string");const i=Si.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=Ii(e))}const i=(e,t)=>Si.forEach(e,(e,n)=>o(e,n,t));if(Si.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Si.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(Ri(e),t);else if(Si.isObject(e)&&Si.isIterable(e)){let n,r,o={};for(const t of e){if(!Si.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Si.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=_i(e)){const n=Si.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(Si.isFunction(t))return t.call(this,e,n);if(Si.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_i(e)){const n=Si.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ci(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=_i(e)){const o=Si.findKey(n,e);!o||t&&!Ci(0,n[o],o,t)||(delete n[o],r=!0)}}return Si.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!Ci(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Si.forEach(this,(r,o)=>{const i=Si.findKey(n,o);if(i)return t[i]=Ii(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=Ii(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Si.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Si.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[Oi]=this[Oi]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=_i(e);t[r]||(!function(e,t){const n=Si.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Si.isArray(e)?e.forEach(r):r(e),this}}ki.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Si.reduceDescriptors(ki.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Si.freezeMethods(ki);const Pi=ki;function Li(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(Si.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof Pi&&(e=e.toJSON()),r.push(e),Si.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);Si.isUndefined(r)||(t[n]=r)});else{if(!Si.isPlainObject(e)&&function(e){if(Si.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(Si.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);Si.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class xi extends Error{static from(e,t,n,r,o,i){const a=new xi(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&Si.hasOwnProp(e,"redact")?e.redact:void 0,n=Si.isArray(t)&&t.length>0?Li(e,t):Si.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}xi.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",xi.ERR_BAD_OPTION="ERR_BAD_OPTION",xi.ECONNABORTED="ECONNABORTED",xi.ETIMEDOUT="ETIMEDOUT",xi.ECONNREFUSED="ECONNREFUSED",xi.ERR_NETWORK="ERR_NETWORK",xi.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",xi.ERR_DEPRECATED="ERR_DEPRECATED",xi.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",xi.ERR_BAD_REQUEST="ERR_BAD_REQUEST",xi.ERR_CANCELED="ERR_CANCELED",xi.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",xi.ERR_INVALID_URL="ERR_INVALID_URL",xi.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const Ui=xi;var Di=n(8287).hp;function Mi(e){return Si.isPlainObject(e)||Si.isArray(e)}function Bi(e){return Si.endsWith(e,"[]")?e.slice(0,-2):e}function Hi(e,t,n){return e?e.concat(t).map(function(e,t){return e=Bi(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Gi=Si.toFlatObject(Si,{},null,function(e){return/^is[A-Z]/.test(e)});const Fi=function(e,t,n){if(!Si.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Si.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Si.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&Si.isSpecCompliantForm(t);if(!Si.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(Si.isDate(e))return e.toISOString();if(Si.isBoolean(e))return e.toString();if(!u&&Si.isBlob(e))throw new Ui("Blob is not supported. Use a Buffer instead.");return Si.isArrayBuffer(e)||Si.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Di.from(e):e}function d(e,n,o){let s=e;if(Si.isReactNative(t)&&Si.isReactNativeBlob(e))return t.append(Hi(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(Si.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Si.isArray(e)&&function(e){return Si.isArray(e)&&!e.some(Mi)}(e)||(Si.isFileList(e)||Si.endsWith(n,"[]"))&&(s=Si.toArray(e)))return n=Bi(n),s.forEach(function(e,r){!Si.isUndefined(e)&&null!==e&&t.append(!0===a?Hi([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!Mi(e)||(t.append(Hi(o,n,i),l(e)),!1)}const f=[],h=Object.assign(Gi,{defaultVisitor:d,convertValue:l,isVisitable:Mi});if(!Si.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!Si.isUndefined(n)){if(i>c)throw new Ui("Object is too deeply nested ("+i+" levels). Max depth: "+c,Ui.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==f.indexOf(n))throw Error("Circular reference detected in "+r.join("."));f.push(n),Si.forEach(n,function(n,a){!0===(!(Si.isUndefined(n)||null===n)&&o.call(t,n,Si.isString(a)?a.trim():a,r,h))&&e(n,r?r.concat(a):[a],i+1)}),f.pop()}}(e),t};function ji(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ki(e,t){this._pairs=[],e&&Fi(e,this,t)}const Wi=Ki.prototype;Wi.append=function(e,t){this._pairs.push([e,t])},Wi.toString=function(e){const t=e?function(t){return e.call(this,t,ji)}:ji;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Xi=Ki;function Ji(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Vi(e,t,n){if(!t)return e;const r=n&&n.encode||Ji,o=Si.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):Si.isURLSearchParams(t)?t.toString():new Xi(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Yi=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Si.forEach(this.handlers,function(t){null!==t&&e(t)})}},qi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},zi={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Xi,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},$i="undefined"!=typeof window&&"undefined"!=typeof document,Zi="object"==typeof navigator&&navigator||void 0,Qi=$i&&(!Zi||["ReactNative","NativeScript","NS"].indexOf(Zi.product)<0),ea="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ta=$i&&window.location.href||"http://localhost",na={...e,...zi};const ra=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&Si.isArray(r)?r.length:i,s)return Si.hasOwnProp(r,i)?r[i]=Si.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;r[i]&&Si.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Si.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return Si.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},oa=(e,t)=>null!=e&&Si.hasOwnProp(e,t)?e[t]:void 0;const ia={transitional:qi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Si.isObject(e);o&&Si.isHTMLForm(e)&&(e=new FormData(e));if(Si.isFormData(e))return r?JSON.stringify(ra(e)):e;if(Si.isArrayBuffer(e)||Si.isBuffer(e)||Si.isStream(e)||Si.isFile(e)||Si.isBlob(e)||Si.isReadableStream(e))return e;if(Si.isArrayBufferView(e))return e.buffer;if(Si.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=oa(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Fi(e,new na.classes.URLSearchParams,{visitor:function(e,t,n,r){return na.isNode&&Si.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=Si.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=oa(this,"env"),r=n&&n.FormData;return Fi(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Si.isString(e))try{return(t||JSON.parse)(e),Si.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=oa(this,"transitional")||ia.transitional,n=t&&t.forcedJSONParsing,r=oa(this,"responseType"),o="json"===r;if(Si.isResponse(e)||Si.isReadableStream(e))return e;if(e&&Si.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,oa(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw Ui.from(e,Ui.ERR_BAD_RESPONSE,this,null,oa(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:na.classes.FormData,Blob:na.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Si.forEach(["delete","get","head","post","put","patch","query"],e=>{ia.headers[e]={}});const aa=ia;function sa(e,t){const n=this||aa,r=t||n,o=Pi.from(r.headers);let i=r.data;return Si.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ca(e){return!(!e||!e.__CANCEL__)}const ua=class extends Ui{constructor(e,t,n){super(e??"canceled",Ui.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function la(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Ui("Request failed with status code "+n.status,n.status>=400&&n.status<500?Ui.ERR_BAD_REQUEST:Ui.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const da=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},ha=(e,t,n=3)=>{let r=0;const o=da(50,250);return fa(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},pa=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ya=e=>(...t)=>Si.asap(()=>e(...t)),wa=na.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,na.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(na.origin),na.navigator&&/(msie|trident)/i.test(na.navigator.userAgent)):()=>!0,ma=na.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Si.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Si.isString(r)&&s.push(`path=${r}`),Si.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),Si.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function ga(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ea=e=>e instanceof Pi?{...e}:e;function Aa(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return Si.isPlainObject(e)&&Si.isPlainObject(t)?Si.merge.call({caseless:r},e,t):Si.isPlainObject(t)?Si.merge({},t):Si.isArray(t)?t.slice():t}function o(e,t,n,o){return Si.isUndefined(t)?Si.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Si.isUndefined(t))return r(void 0,t)}function a(e,t){return Si.isUndefined(t)?Si.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return Si.hasOwnProp(t,i)?r(n,o):Si.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(Ea(e),Ea(t),0,!0)};return Si.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Si.hasOwnProp(c,r)?c[r]:o,a=i(Si.hasOwnProp(e,r)?e[r]:void 0,Si.hasOwnProp(t,r)?t[r]:void 0,r);Si.isUndefined(a)&&i!==s||(n[r]=a)}),n}const ba=["content-type","content-length"];const va=e=>{const t=Aa({},e),n=e=>Si.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var f;if(t.headers=s=Pi.from(s),t.url=Vi(ga(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(f=c.password,encodeURIComponent(f).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),Si.isFormData(r)&&(na.hasStandardBrowserEnv||na.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):Si.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{ba.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),na.hasStandardBrowserEnv){Si.isFunction(o)&&(o=o(t));if(!0===o||null==o&&wa(t.url)){const e=i&&a&&ma.read(a);e&&s.set(i,e)}}return t};(Object.getOwnPropertyDescriptor(va,"name")||{}).writable||Object.defineProperty(va,"name",{value:"default",configurable:!0});const Sa="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=va(e);let o=r.data;const i=Pi.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:f,onDownloadProgress:h}=r;function p(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let y=new XMLHttpRequest;function w(){if(!y)return;const r=Pi.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());la(function(e){t(e),p()},function(e){n(e),p()},{data:d&&"text"!==d&&"json"!==d?y.response:y.responseText,status:y.status,statusText:y.statusText,headers:r,config:e,request:y}),y=null}y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout,"onloadend"in y?y.onloadend=w:y.onreadystatechange=function(){y&&4===y.readyState&&(0!==y.status||y.responseURL&&y.responseURL.startsWith("file:"))&&setTimeout(w)},y.onabort=function(){y&&(n(new Ui("Request aborted",Ui.ECONNABORTED,e,y)),p(),y=null)},y.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Ui(r,Ui.ERR_NETWORK,e,y);o.event=t||null,n(o),p(),y=null},y.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||qi;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Ui(t,o.clarifyTimeoutError?Ui.ETIMEDOUT:Ui.ECONNABORTED,e,y)),p(),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&Si.forEach(i.toJSON(),function(e,t){y.setRequestHeader(t,e)}),Si.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),d&&"json"!==d&&(y.responseType=r.responseType),h&&([c,l]=ha(h,!0),y.addEventListener("progress",c)),f&&y.upload&&([s,u]=ha(f),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{y&&(n(!t||t.type?new ua(null,e,y):t),y.abort(),p(),y=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const m=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!m||na.protocols.includes(m)?y.send(o||null):n(new Ui("Unsupported protocol "+m+":",Ui.ERR_BAD_REQUEST,e))})},Ta=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Ui?t:new ua(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Ui(`timeout of ${t}ms exceeded`,Ui.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>Si.asap(a),s}},Ra=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Oa(e))yield*Ra(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var _a=n(8287).hp;const Ia="1.16.0",{isFunction:Ca}=Si,ka=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Pa=e=>{const t=Si.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=Si.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?Ca(o):"function"==typeof fetch,c=Ca(i),u=Ca(a);if(!s)return!1;const l=s&&Ca(n),d=s&&("function"==typeof r?(f=new r,e=>f.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var f;const h=c&&l&&ka(()=>{let e=!1;const t=new i(na.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),p=u&&l&&ka(()=>Si.isReadableStream(new a("").body)),y={stream:p&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!y[e]&&(y[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Ui(`Response type '${e}' is not supported`,Ui.ERR_NOT_SUPPORT,n)})});const w=async(e,t)=>{const n=Si.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(Si.isBlob(e))return e.size;if(Si.isSpecCompliantForm(e)){const t=new i(na.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Si.isArrayBufferView(e)||Si.isArrayBuffer(e)?e.byteLength:(Si.isURLSearchParams(e)&&(e+=""),Si.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:f,onUploadProgress:m,responseType:g,headers:E,withCredentials:A="same-origin",fetchOptions:b,maxContentLength:v,maxBodyLength:S}=va(e);const T=Si.isNumber(v)&&v>-1,R=Si.isNumber(S)&&S>-1;let O=o||fetch;g=g?(g+"").toLowerCase():"text";let N=Ta([u,l&&l.toAbortSignal()],d),_=null;const I=N&&N.unsubscribe&&(()=>{N.unsubscribe()});let C;try{if(T&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==_a&&"function"==typeof _a.byteLength)return _a.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>v)throw new Ui("maxContentLength size of "+v+" exceeded",Ui.ERR_BAD_RESPONSE,e,_)}if(R&&"get"!==n&&"head"!==n){const t=await w(E,s);if("number"==typeof t&&isFinite(t)&&t>S)throw new Ui("Request body larger than maxBodyLength limit",Ui.ERR_BAD_REQUEST,e,_)}if(m&&h&&"get"!==n&&"head"!==n&&0!==(C=await w(E,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(Si.isFormData(s)&&(e=n.headers.get("content-type"))&&E.setContentType(e),n.body){const[e,t]=pa(C,ha(ya(m)));s=Na(n.body,65536,e,t)}}Si.isString(A)||(A=A?"include":"omit");const o=c&&"credentials"in i.prototype;if(Si.isFormData(s)){const e=E.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&E.delete("content-type")}E.set("User-Agent","axios/"+Ia,!1);const u={...b,signal:N,method:n.toUpperCase(),headers:E.normalize().toJSON(),body:s,duplex:"half",credentials:o?A:void 0};_=c&&new i(t,u);let l=await(c?O(_,b):O(t,u));if(T){const t=Si.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>v)throw new Ui("maxContentLength size of "+v+" exceeded",Ui.ERR_BAD_RESPONSE,e,_)}const d=p&&("stream"===g||"response"===g);if(p&&l.body&&(f||T||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=Si.toFiniteNumber(l.headers.get("content-length")),[r,o]=f&&pa(n,ha(ya(f),!0))||[];let i=0;const s=t=>{if(T&&(i=t,i>v))throw new Ui("maxContentLength size of "+v+" exceeded",Ui.ERR_BAD_RESPONSE,e,_);r&&r(t)};l=new a(Na(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}g=g||"text";let k=await y[Si.findKey(y,g)||"text"](l,e);if(T&&!p&&!d){let t;if(null!=k&&("number"==typeof k.byteLength?t=k.byteLength:"number"==typeof k.size?t=k.size:"string"==typeof k&&(t="function"==typeof r?(new r).encode(k).byteLength:k.length)),"number"==typeof t&&t>v)throw new Ui("maxContentLength size of "+v+" exceeded",Ui.ERR_BAD_RESPONSE,e,_)}return!d&&I&&I(),await new Promise((t,n)=>{la(t,n,{data:k,headers:Pi.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:_})})}catch(t){if(I&&I(),N&&N.aborted&&N.reason instanceof Ui){const n=N.reason;throw n.config=e,_&&(n.request=_),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ui("Network Error",Ui.ERR_NETWORK,e,_,t&&t.response),{cause:t.cause||t});throw Ui.from(t,t&&t.code,e,_,t&&t.response)}}},La=new Map,xa=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=La;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Pa(t)),u=s;return s},Ua=(xa(),{http:null,xhr:Sa,fetch:{get:xa}});Si.forEach(Ua,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Da=e=>`- ${e}`,Ma=e=>Si.isFunction(e)||null===e||!1===e;const Ba={getAdapter:function(e,t){e=Si.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Da).join("\n"):" "+Da(e[0]):"as no adapter specified";throw new Ui("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Ua};function Ha(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ua(null,e)}function Ga(e){Ha(e),e.headers=Pi.from(e.headers),e.data=sa.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ba.getAdapter(e.adapter||aa.adapter,e)(e).then(function(t){Ha(e),e.response=t;try{t.data=sa.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Pi.from(t.headers),t},function(t){if(!ca(t)&&(Ha(e),t&&t.response)){e.response=t.response;try{t.response.data=sa.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Pi.from(t.response.headers)}return Promise.reject(t)})}const Fa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Fa[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const ja={};Fa.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Ia+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Ui(r(o," has been removed"+(t?" in "+t:"")),Ui.ERR_DEPRECATED);return t&&!ja[o]&&(ja[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Fa.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Ka={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ui("options must be an object",Ui.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Ui("option "+i+" must be "+n,Ui.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ui("Unknown option "+i,Ui.ERR_BAD_OPTION)}},validators:Fa},Wa=Ka.validators;class Xa{constructor(e){this.defaults=e||{},this.interceptors={request:new Yi,response:new Yi}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Aa(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ka.assertOptions(n,{silentJSONParsing:Wa.transitional(Wa.boolean),forcedJSONParsing:Wa.transitional(Wa.boolean),clarifyTimeoutError:Wa.transitional(Wa.boolean),legacyInterceptorReqResOrdering:Wa.transitional(Wa.boolean)},!1),null!=r&&(Si.isFunction(r)?t.paramsSerializer={serialize:r}:Ka.assertOptions(r,{encode:Wa.function,serialize:Wa.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ka.assertOptions(t,{baseUrl:Wa.spelling("baseURL"),withXsrfToken:Wa.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Si.merge(o.common,o[t.method]);o&&Si.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=Pi.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;s=s&&e.synchronous;const n=t.transitional||qi;n&&n.legacyInterceptorReqResOrdering?a.unshift(e.fulfilled,e.rejected):a.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[Ga.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new ua(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Va(function(t){e=t});return{token:t,cancel:e}}}const Ya=Va;const qa={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qa).forEach(([e,t])=>{qa[t]=e});const za=qa;const $a=function e(t){const n=new Ja(t),r=ko(Ja.prototype.request,n);return Si.extend(r,Ja.prototype,n,{allOwnKeys:!0}),Si.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Aa(t,n))},r}(aa);$a.Axios=Ja,$a.CanceledError=ua,$a.CancelToken=Ya,$a.isCancel=ca,$a.VERSION=Ia,$a.toFormData=Fi,$a.AxiosError=Ui,$a.Cancel=$a.CanceledError,$a.all=function(e){return Promise.all(e)},$a.spread=function(e){return function(t){return e.apply(null,t)}},$a.isAxiosError=function(e){return Si.isObject(e)&&!0===e.isAxiosError},$a.mergeConfig=Aa,$a.AxiosHeaders=Pi,$a.formToJSON=e=>ra(Si.isHTMLForm(e)?new FormData(e):e),$a.getAdapter=Ba.getAdapter,$a.HttpStatusCode=za,$a.default=$a;const Za=$a,Qa="auth0_sub",es="mng-entitlements",ts="__MNG_Session",ns="regwallUserIsSubscribed";function rs(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return s("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return s("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return s("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(s("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return s("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var a=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){s("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),s("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(a,500)};a()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(s("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();l(os,"DEFAULT_TIMEOUT",3e3);new os;var is,as;function ss(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function cs(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=us().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},fs=function(){var e=ds();return".".concat(e)},hs=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(s("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},ps=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=ds(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=f(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},ys=function(){return us().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},ws=function(e){return function(e,t){if("string"!=typeof e)throw new h("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new h(`Invalid token specified: missing part #${n+1}`);let o;try{o=p(r)}catch(e){throw new h(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new h(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},ms=function(){return"complete"===document.readyState},gs=function(){return new Promise(function(e){if(("interactive"===document.readyState||ms())&&window.dataLayer)s("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{s("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},Es=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,gs();case 1:return s("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",s("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return s("Utils dataLayerLoop: look for this element ",e),e[t]?(s("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(s("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),As=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,Es(t);case 1:return n=e.sent,s("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bs=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(s("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(s("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};s("utils | Event: authentication ready: ",r),e(r)}catch(e){s(e),t(e)}},!1))})},vs=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return a.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(s("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,s("Received entitlementsReady event:",r),e(r)}catch(e){c("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(s("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ss=function(){s("Clearing entitlements...");try{ps(es,{path:"/"})}catch(e){s("Failed to delete legacy cookie: ",e)}try{ps(es,{path:"/",domain:ds(),expires:365,secure:!0})}catch(e){s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(ts)}catch(e){s("Failed to remove local storage: ",e)}},Ts=function(e){s("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return s("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=Ts;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Rs=function(e){a.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Os=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},a=function(){var a=r(o.mark(function r(){var a,c,u,l,d,f,h,p,y,w,m;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(a=window.sophi_config)||void 0===a?void 0:a.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:cs({},i)}));case 1:return r.next=2,As();case 2:return u=r.sent,r.next=3,Es("Paywall_Level");case 3:if(l=r.sent,"article"===u&&"free"!==l){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return r.next=5,vs();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(f=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,s("checkPaywallStatus - Sophi is running: ",f),!f){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:cs({},i)})},{once:!0}),r.next=12;break;case 8:if(f){r.next=12;break}return h=window.ConnextUtils.connextReady("onPaywallShown",!1),p=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([h,p]);case 10:!0===(y=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(y)),r.next=12;break;case 11:r.prev=11,w=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(w);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:cs({},i)}));case 13:r.prev=13,m=r.catch(0),n(m);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return a.apply(this,arguments)}}();a()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Os);var Ns,_s,Is=function(){try{var e=localStorage.getItem(ts);return"string"==typeof e?e:"{}"}catch(e){s("Unable to get session from local storage: ",e)}return"{}"},Cs=function(e){try{s("Setting local storage session",e),localStorage.setItem(ts,e)}catch(e){s("Unable to save session from local storage: ",e)}},ks=function(e){try{hs(es,e,{path:"/",domain:fs(),expires:365,secure:!0})}catch(e){s("Unable to save session to cookie storage: ",e)}},Ps=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.A.sessionServer,n="".concat(t,"/api/session"),s("Checking server session: ",n),e.next=1,Za.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return f=r.data.entitlementTokenDecoded,h=r.data,p=h.accessToken,y=h.idToken,w=h.entitlementToken,m=null!==(i=null==f?void 0:f.entitlement_expiry)&&void 0!==i?i:null,g=null!==(c=null==f?void 0:f.entitlement_source)&&void 0!==c?c:null,E=null!==(u=null==f?void 0:f.entitlement_entitled)&&void 0!==u?u:null,A=null!==(l=null==f?void 0:f.entitlement_extras_adfree)&&void 0!==l?l:null,b=null!==(d=null==f?void 0:f.entitlement_level)&&void 0!==d?d:null,Cs(JSON.stringify({accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:g,isEntitled:E,adFree:A,entitlementLevel:b})),""!==w&&"string"==typeof w&&ks(w),e.abrupt("return",{accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:g,isEntitled:E,adFree:A,entitlementLevel:b});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ls=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=a.A.sessionServer,r="".concat(n,"/api/session"),s("Updating server session: ",r),e.next=1,Za.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),s("Failed to update session server: ",i);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),xs=function(){var e=r(o.mark(function e(){var t,n,r,i,a,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S,T,R,O,N,_,I,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Inside getSession"),e.prev=1,d=Is(),s("Session: __MNG_Session = ",d),f=JSON.parse(d),h=f.accessToken,p=f.idToken,y=f.entitlementToken,w=f.expiration,m=f.entitlementSource,g=f.isEntitled,E=f.adFree,A=f.entitlementLevel,n=h,i=w,a=m,c=g,u=E,l=A,s("Session: check both tokens: ",t=p,r=y),void 0!==p&&void 0!==y&&null!==p&&null!==y){e.next=3;break}return s("Session: missing id or entitlements, try session server"),e.next=2,Ps();case 2:b=e.sent,v=b.accessToken,S=b.idToken,T=b.entitlementToken,R=b.expiration,O=b.entitlementSource,N=b.isEntitled,_=b.adFree,I=b.entitlementLevel,n=v,t=S,r=T,i=R,a=O,c=N,u=_,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),s("Failed to get session: ",C);case 5:return s("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:a,isEntitled:c,adFree:u,entitlementLevel:l});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),Us=function(){var e=r(o.mark(function e(t){var n,r,i,a,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S,T,R,O,N,_,I,C,k,P;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Is(),r=JSON.parse(n),i=r.accessToken,a=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,f=r.expiration,h=void 0===f?null:f,p=r.entitlementSource,y=void 0===p?null:p,w=r.isEntitled,m=void 0===w?null:w,g=r.adFree,E=void 0===g?null:g,A=r.entitlementLevel,b=void 0===A?null:A,v=t.accessToken,S=t.idToken,T=t.entitlementToken,R=t.expiration,O=t.entitlementSource,N=t.isEntitled,_=t.adFree,I=t.entitlementLevel,C={accessToken:v??a,idToken:S??u,entitlementToken:T??d,expiration:R??h,entitlementSource:O??y,isEntitled:N??m,adFree:_??E,entitlementLevel:I??b},s("Current session data: ",r),s("New session data: ",t),s("Updated session data:",C),k=JSON.stringify(C),Cs(k),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&ks(C.entitlementToken),n===k){e.next=1;break}return e.next=1,Ls(C);case 1:e.next=3;break;case 2:e.prev=2,P=e.catch(0),s("Unable to save session: ",P);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Ds="1"===window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){Ns||(Ns=e,_s&&(s("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",_s),window.dispatchEvent(_s)))});var Ms=function(){var e=window.localStorage.getItem(ts);return JSON.parse(e)},Bs=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,xs();case 1:return t=e.sent,e.abrupt("return",t);case 2:return n=Ms(),e.abrupt("return",n);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Hs=function(e){hs(es,e,{path:"/",domain:fs(),expires:365,secure:!0})},Gs=function(){var e=r(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,Hs(t),s("About to decode token before saving: ",t),n=ws(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,Us({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level});case 1:e.next=3;break;case 2:window.localStorage.setItem(ts,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}));case 3:e.next=5;break;case 4:e.prev=4,r=e.catch(0),s("Entitlements: Failed to save token: ",r);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),Fs=function(){var e=r(o.mark(function e(t){var n,r,i,u,l,d,f,h,p,y,w,m,g,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,xs();case 1:"string"==typeof(r=e.sent).idToken&&""!==r.idToken&&(i=ws(r.idToken),n=void 0!==i&&i.email_verified),e.next=4;break;case 2:return e.next=3,bs();case 3:u=e.sent,(l=u.idToken)&&""!==l&&(n=ws(l).email_verified);case 4:if(s("Entitlements: refresh JWT start..."),t){e.next=5;break}return e.abrupt("return",new Error("No token to refresh"));case 5:return s("Entitlements refresh: entitlement token: ",t),s("Entitlements refresh: auth0 verified: ",n),d={jwt:t,verified:n},f="".concat(a.A.entitlementsEndpoint,"session/refresh"),e.prev=6,e.next=7,$.ajax({type:"POST",url:f,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 7:if("boolean"!=typeof(h=e.sent).success){e.next=10;break}if(!h.success){e.next=8;break}p=null===(y=h.data)||void 0===y?void 0:y.jwt,e.next=9;break;case 8:throw w=h.error||{},m=w.message||w.error||"Entitlements API returned an unknown error",new Error("API error: ".concat(m));case 9:e.next=11;break;case 10:p=h.jwt;case 11:return s("Entitlements: Request successful: ",p),e.next=12,Gs(p);case 12:return e.abrupt("return",p);case 13:if(e.prev=13,g=e.catch(6),c("Entitlements: Create Token Failure: ",g),Ss(),!window.authentication_config.sessionManagementEnabled){e.next=17;break}return e.prev=14,e.next=15,Us({entitlementToken:null});case 15:e.next=17;break;case 16:e.prev=16,E=e.catch(14),c("Entitlements: Save Session Failure during error handling: ",E);case 17:throw new Error("Entitlements Refresh failure");case 18:case"end":return e.stop()}},e,null,[[6,13],[14,16]])}));return function(t){return e.apply(this,arguments)}}(),js=function(){var e=r(o.mark(function e(t){var n,r,u,l,d,f,h,p,y,w;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s("Entitlements: create token start..."),s("Entitlements: createToken payload with ",t),"object"===i(t)||"string"==typeof t.sub){e.next=1;break}throw new Error("No user info to create token");case 1:if(n=window.location.hostname,r=ds(n),t.sub&&(u=t.sub),t.idToken&&(l=t.idToken),l||u){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return d={publication:r.replace("vipdev.lndo.site","com"),requestSource:"website"},l?d.idToken=l:u&&(d.uuid=u),f="".concat(a.A.entitlementsEndpoint,"session/create"),s("Entitlements: create payload",d),e.prev=3,e.next=4,$.ajax({type:"POST",url:f,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 4:if("boolean"!=typeof(h=e.sent).success){e.next=6;break}if(h.success){e.next=5;break}return e.abrupt("return",new Error("Entitlements | API returned no JWT"));case 5:p=h.data.jwt,s("Entitlements: Token Created: ",p),e.next=7;break;case 6:p=h.jwt;case 7:return e.next=8,Gs(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,y=e.catch(3),s("Entitlements: Create Token Failure: ",y),Ss(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,Us({entitlementToken:null});case 11:e.next=13;break;case 12:e.prev=12,w=e.catch(10),c("Entitlements: Save Session Failure during error handling: ",w);case 13:throw new Error("Entitlements Refresh failure");case 14:case"end":return e.stop()}},e,null,[[3,9],[10,12]])}));return function(t){return e.apply(this,arguments)}}(),Ks=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Bs();case 1:if((t=e.sent)&&t.entitlementToken){e.next=2;break}return e.abrupt("return",!1);case 2:if(!((n=Date.now()/1e3) ").concat(t.expiration)),e.abrupt("return",Fs(t.entitlementToken));case 4:return e.prev=4,r=e.catch(0),s("Entitlements: Local Storage: Error processing token: ",r.message),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(){return e.apply(this,arguments)}}(),Ws=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=ls(es)){e.next=1;break}return e.abrupt("return",!1);case 1:return s("checkCookiesForToken, Refreshing token, ".concat(t)),e.next=2,Fs(t);case 2:return e.abrupt("return",e.sent);case 3:return e.prev=3,n=e.catch(0),s("Entitlements: Cookie: Error processing token: ",n.message),e.abrupt("return",!1);case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(){return e.apply(this,arguments)}}(),Xs=function(e){s("Attempting to broadcast entitlements ready...",e);try{var t={token:e};if(e){s("About to decode token before broadcasting: ",e);var n=ws(e);!function(e){var t=ls("mng-jwt-decoded");t&&t===e||hs("mng-jwt-decoded",JSON.stringify(e),{path:"/",domain:fs(),expires:365,secure:!0})}(n),t=Object.assign(t,{isEntitled:n.entitlement_entitled,adfree:n.entitlement_extras_adfree||!1,subscriptionLevel:n.entitlement_level})}var r=new CustomEvent("entitlementsReady",{detail:t});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=t,s("Dispatching entitlementsReady Event: ",r),window.dispatchEvent(r),s("Dispatched entitlementsReady event"),Rs("entitlementsReady"),_s=new CustomEvent("mng-entitlement-check-complete",{detail:t}),Ns?(s("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",r),window.dispatchEvent(_s)):s("Islands not ready")}catch(e){var o={token:""};o=Object.assign(o,{isEntitled:"unknown",adfree:"unknown",subscriptionLevel:"unknown"});var i=new CustomEvent("entitlementsReady",{detail:o});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=o,s("Dispatching entitlementsReady EMPTY Event: ",i),window.dispatchEvent(i),s("Dispatched entitlementsReady EMPTY event"),s("Error: ",e)}},Js=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,js({idToken:t});case 1:e.next=3;break;case 2:e.prev=2,n=e.catch(0),s("Entitlements error during oidc login callback: ",n);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),Vs=function(){void 0!==window.MNGAuthentication&&Array.isArray(window.MNGAuthentication.oidcLoginCallbacks)&&window.MNGAuthentication.oidcLoginCallbacks.push(Js)},Ys=function(e){var t=e.searchParams.get("entitlement_jwt");s("Webview JWT param provided: ",t),Hs(t);var n=ws(t);window.localStorage.setItem(ts,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}))},qs=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(b.length>0&&void 0!==b[0]?b[0]:{}).forceRecheck,n=void 0!==t&&t,e.prev=1,r=window.localStorage.getItem(ns),i=ls(Qa),c=us(),u=ys(),l=ls("clearEntCache"),!(n||l||c.searchParams.has("newUser"))){e.next=7;break}return d="".concat(a.A.entitlementsEndpoint,"session/create"),e.next=2,bs();case 2:return f=e.sent,h={uuid:f.claims.auth0Id,publication:u},e.prev=3,e.next=4,$.ajax({type:"DELETE",url:d,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(h)});case 4:e.sent&&(s("loggedOutNewSubscriberActions","Entitlements: Cache cleared"),ps("clearEntCache")),e.next=6;break;case 5:e.prev=5,E=e.catch(3),s("loggedOutNewSubscriberActions","Entitlements: Cache clear Failure - ".concat(E.message));case 6:e.next=8;break;case 7:s("loggedOutNewSubscriberActions","There is no clearEntCache cookie");case 8:if(s("loggedOutNewSubscriberActions","Checking if this is a new regwall subscriber"),!(n||l||"false"===r&&c.searchParams.has("newUser")&&i)){e.next=11;break}return p=!1,y={sub:i,email_verified:!0},e.next=9,js(y);case 9:if((w=e.sent)&&""!==w&&(m=ws(w),g=m.entitlement_entitled,p=g),s("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(p)),!p){e.next=10;break}return window.localStorage.setItem(ns,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 10:case 11:return e.abrupt("return",!1);case 12:return e.prev=12,A=e.catch(1),s("loggedOutNewSubscriberActions error",A),e.abrupt("return",!1);case 13:case"end":return e.stop()}},e,null,[[1,12],[3,5]])}));return function(){return e.apply(this,arguments)}}();Ds||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(ts));return null!=t?(s("Ad Free Check: : ",t.adFree),(t.idToken||null!==(e=window.MNGAuthentication)&&void 0!==e&&null!==(e=e.authenticationReady)&&void 0!==e&&e.idToken)&&t.adFree||a.A.isAdfreeArticle):a.A.isAdfreeArticle},window.MNGAuthentication.isUserSubscriber=function(){var e=JSON.parse(window.localStorage.getItem(ts));return null!=e&&(s("Subscriber Check: : ",e.isEntitled),e.isEntitled)});var zs=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,g,E,A,b,v,S;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ds){e.next=1;break}return s("Embed login is enabled, skipping entitlements.js init"),e.abrupt("return",!1);case 1:if(!a.A.entitlementsEnabled){e.next=40;break}return e.next=2,qs();case 2:if(!e.sent){e.next=3;break}return e.abrupt("return",Xs(!1));case 3:return t=window.location,n=new URL(t.href),e.next=4,bs();case 4:if(r=e.sent,i=r.idToken,c=r.accessToken,u=r.isAuthenticated,l=r.claims,Vs(),e.prev=5,!n.searchParams.has("newUser")){e.next=9;break}if("string"!=typeof i||""===i){e.next=8;break}return e.next=6,js({idToken:i});case 6:if(!(d=e.sent)){e.next=7;break}return s("Entitlements Init: Created new token for new subscriber"),e.abrupt("return",Xs(d));case 7:e.next=9;break;case 8:s("New subscription, no idToken.");case 9:e.next=11;break;case 10:e.prev=10,e.catch(5),s("Not a new subscriber.");case 11:try{n.searchParams.has("entitlement_jwt")&&Ys(n)}catch(e){s("Error during webview JWT retrieval: ",e)}return e.prev=12,e.next=13,Ks();case 13:if(!((f=e.sent)instanceof Error)){e.next=14;break}throw f;case 14:f&&(d=f,s("Entitlements Init: Local Storage Token exists")),e.next=16;break;case 15:e.prev=15,E=e.catch(12),s("Error during Local Storage Token check: ",E);case 16:if(e.prev=16,d){e.next=19;break}return e.next=17,Ws();case 17:if(!((h=e.sent)instanceof Error)){e.next=18;break}throw h;case 18:h&&(d=h,s("Entitlements Init: Cookie Token exists"));case 19:e.next=21;break;case 20:e.prev=20,A=e.catch(16),s("Error during Cookie Token check: ",A);case 21:if(!u&&d&&(s("Entitled-only flow: User is not authenticated but entitlement token exists."),ws(d).entitlement_entitled?(s("PageSuite flow: User is not authenticated but is subscriber. Access token is ".concat(c)),c?MNGAuthentication.login():s("PageSuite flow: No Access token.")):s("Entitled-only flow: User is not entitled.")),u){e.next=22;break}return s("User is not logged in, skipping entitlement flow."),e.abrupt("return",Xs(!1));case 22:if(!a.A.bcLowaSegements||u!==a.A.USER_IS_LOWA||d){e.next=26;break}return e.prev=23,s("About to check entitlements based on BC"),p={sub:l.sub},e.next=24,js(p);case 24:d=e.sent,!window.authentication_config.sessionManagementEnabled&&a.A.serverEntitlements&&d&&(s("Entitlements fetched, about to reload to refresh entitlement cookie for server."),window.location.reload()),e.next=26;break;case 25:e.prev=25,b=e.catch(23),s("BC sub segment check failed: ",b);case 26:if(e.prev=26,!d){e.next=32;break}if(!a.A.linaCheckOnArticles){e.next=31;break}if(y=ws(d),w=y.entitlement_entitled,m=y.iat,s("LINA check: isEntitled: ".concat(w,", token created at: ").concat(m)),!(a.A.linaCheckOnArticles&&!w&&Date.now()/1e3-new Date(m)>45)){e.next=31;break}if(s("Checking entitlements again for LINA user."),""===i){e.next=30;break}return e.next=27,js({idToken:i});case 27:if(!(g=e.sent)){e.next=29;break}return s("Entitlements Init: Created new token for LINA user"),e.next=28,As();case 28:return"article"===e.sent&&window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",Xs(g));case 29:e.next=31;break;case 30:s("LINA check, no idToken.");case 31:return e.abrupt("return",Xs(d));case 32:e.next=34;break;case 33:e.prev=33,v=e.catch(26),s("LINA check error: ",v);case 34:if(e.prev=34,"string"!=typeof i||""===i){e.next=37;break}return e.next=35,js({idToken:i});case 35:if(!(d=e.sent)){e.next=36;break}return s("Entitlements Init: Created new token"),e.abrupt("return",Xs(d));case 36:e.next=38;break;case 37:s("No OIDC ID Token. Not creating a new entitlements token.");case 38:e.next=40;break;case 39:e.prev=39,S=e.catch(34),s("Unable to create token during initialize: ",S);case 40:return e.abrupt("return",Xs(!1));case 41:case"end":return e.stop()}},e,null,[[5,10],[12,15],[16,20],[23,25],[26,33],[34,39]])}));return function(){return e.apply(this,arguments)}}();const $s={init:zs};(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,$s.init();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.entitlements.bundle.js.map; /*! For license information please see mng-digisubs.uiHandler.bundle.js.LICENSE.txt */ (()=>{var e={7526(e,t){"use strict";t.byteLength=function(e){var t=s(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,i=s(e),a=i[0],c=i[1],u=new o(function(e,t,n){return 3*(t+n)/4-n}(0,a,c)),l=0,d=c>0?a-4:a;for(n=0;n>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,c=r-o;sc?c:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)n[a]=i[a],r[i.charCodeAt(a)]=a;function s(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function u(e,t,n){for(var r,o=[],i=t;ia)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,n)}function u(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|m(e,t);let r=s(n);const o=r.write(e,t);o!==n&&(r=r.slice(0,o));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const o=function(e){if(c.isBuffer(e)){const t=0|f(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Z(e.length)?s(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return l(e),s(e<0?0:0|f(e))}function h(e){const t=e.length<0?0:0|f(e.length),n=s(t);for(let r=0;r=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|e}function m(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(o)return r?-1:J(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return R(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function w(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Z(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,o){let i,a=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,n/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){let r=-1;for(i=n;is&&(n=s-c),i=n;i>=0;i--){let n=!0;for(let r=0;ro&&(r=o):r=o;const i=t.length;let a;for(r>i/2&&(r=i/2),a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function _(e,t,n){n=Math.min(e.length,n);const r=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+a<=n){let n,r,s,c;switch(a){case 1:t<128&&(i=t);break;case 2:n=e[o+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(i=c));break;case 3:n=e[o+1],r=e[o+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(i=c));break;case 4:n=e[o+1],r=e[o+2],s=e[o+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(i=c))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=a}return function(e){const t=e.length;if(t<=O)return String.fromCharCode.apply(String,e);let n="",r=0;for(;rr.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,o)):Uint8Array.prototype.set.call(r,t,o);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,o)}o+=t.length}return r},c.byteLength=m,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tn&&(e+=" ... "),""},i&&(c.prototype[i]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,o){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;let i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0);const s=Math.min(i,a),u=this.slice(r,o),l=e.slice(t,n);for(let e=0;e>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let i=!1;for(;;)switch(r){case"hex":return v(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function R(e,t,n){let r="";n=Math.min(e.length,n);for(let o=t;or)&&(n=r);let o="";for(let r=t;rn)throw new RangeError("Trying to access beyond buffer length")}function x(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function P(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i,i>>=8,e[n++]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function U(e,t,n,r,o){W(t,r,o,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i>>=8,e[n+6]=i,i>>=8,e[n+5]=i,i>>=8,e[n+4]=i;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],o=1;for(;t>0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(o)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],o=1,i=0;for(;++i=o&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,o=1,i=this[e+--r];for(;r>0&&(o*=256);)i+=this[e+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=Q(function(e){K(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||F(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<>>=0,t||L(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){x(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=1,i=0;for(this[t]=255&e;++i>>=0,n>>>=0,!r){x(this,e,t,n,Math.pow(2,8*n)-1,0)}let o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=Q(function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Q(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);x(this,e,t,n,r-1,-r)}let o=0,i=1,a=0;for(this[t]=255&e;++o>>=0,!r){const r=Math.pow(2,8*n-1);x(this,e,t,n,r-1,-r)}let o=n-1,i=1,a=0;for(this[t+o]=255&e;--o>=0&&(i*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/i|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||x(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=Q(function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Q(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return M(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function W(e,t,n,r,o,i){if(e>n||e3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(i+1)}${r}`:`>= -(2${r} ** ${8*(i+1)-1}${r}) and < 2 ** ${8*(i+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,n){K(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function K(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function F(e,t,n){if(Math.floor(e)!==e)throw K(e,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}H("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),H("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,o=n;return Number.isInteger(n)&&Math.abs(n)>2**32?o=G(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=G(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function J(e,t){let n;t=t||1/0;const r=e.length;let o=null;const i=[];for(let a=0;a55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(X,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Z(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let o=0;o<16;++o)t[r+o]=e[n]+e[o]}return t}();function Q(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},251(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,c=(1<>1,l=-7,d=n?o-1:0,h=n?-1:1,p=e[t+d];for(d+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+d],d+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=u}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*c-1)*Math.pow(2,o),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=f,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,u-=8);e[n+p-f]|=128*m}},5172(e){e.exports=function(e,t){this.v=e,this.k=t},e.exports.__esModule=!0,e.exports.default=e.exports},6993(e,t,n){var r=n(5546);function o(){var t,n,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.toStringTag||"@@toStringTag";function c(e,o,i,a){var s=o&&o.prototype instanceof l?o:l,c=Object.create(s.prototype);return r(c,"_invoke",function(e,r,o){var i,a,s,c=0,l=o||[],d=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,a=0,s=t,h.n=n,u}};function p(e,r){for(a=e,s=r,n=0;!d&&c&&!o&&n3?(o=f===r)&&(s=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=e<2&&pr||r>f)&&(i[4]=e,i[5]=r,h.n=f,a=0))}if(o||e>1)return u;throw d=!0,r}return function(o,l,f){if(c>1)throw TypeError("Generator is already running");for(d&&1===l&&p(l,f),a=l,s=f;(n=a<2?t:s)||!d;){i||(a?a<3?(a>1&&(h.n=-1),p(a,s)):h.n=s:h.v=s);try{if(c=2,i){if(a||(o="next"),n=i[o]){if(!(n=n.call(i,s)))throw TypeError("iterator result is not an object");if(!n.done)return n;s=n.value,a<2&&(a=0)}else 1===a&&(n=i.return)&&n.call(i),a<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((n=(d=h.n<0)?s:e.call(r,h))!==u)break}catch(e){i=t,a=1,s=e}finally{c=1}}return{value:n,done:d}}}(e,i,a),!0),c}var u={};function l(){}function d(){}function h(){}n=Object.getPrototypeOf;var p=[][a]?n(n([][a]())):(r(n={},a,function(){return this}),n),f=h.prototype=l.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,r(e,s,"GeneratorFunction")),e.prototype=Object.create(f),e}return d.prototype=h,r(f,"constructor",h),r(h,"constructor",d),d.displayName="GeneratorFunction",r(h,s,"GeneratorFunction"),r(f),r(f,s,"Generator"),r(f,a,function(){return this}),r(f,"toString",function(){return"[object Generator]"}),(e.exports=o=function(){return{w:c,m}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},5869(e,t,n){var r=n(887);e.exports=function(e,t,n,o,i){var a=r(e,t,n,o,i);return a.next().then(function(e){return e.done?e.value:a.next()})},e.exports.__esModule=!0,e.exports.default=e.exports},887(e,t,n){var r=n(6993),o=n(1791);e.exports=function(e,t,n,i,a){return new o(r().w(e,t,n,i),a||Promise)},e.exports.__esModule=!0,e.exports.default=e.exports},1791(e,t,n){var r=n(5172),o=n(5546);e.exports=function e(t,n){function i(e,o,a,s){try{var c=t[e](o),u=c.value;return u instanceof r?n.resolve(u.v).then(function(e){i("next",e,a,s)},function(e){i("throw",e,a,s)}):n.resolve(u).then(function(e){c.value=e,a(c)},function(e){return i("throw",e,a,s)})}catch(e){s(e)}}var a;this.next||(o(e.prototype),o(e.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),o(this,"_invoke",function(e,t,r){function o(){return new n(function(t,n){i(e,r,t,n)})}return a=a?a.then(o,o):o()},!0)},e.exports.__esModule=!0,e.exports.default=e.exports},5546(e){function t(n,r,o,i){var a=Object.defineProperty;try{a({},"",{})}catch(n){a=0}e.exports=t=function(e,n,r,o){function i(n,r){t(e,n,function(e){return this._invoke(n,r,e)})}n?a?a(e,n,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[n]=r:(i("next",0),i("throw",1),i("return",2))},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r,o,i)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4373(e){e.exports=function(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}},e.exports.__esModule=!0,e.exports.default=e.exports},4633(e,t,n){var r=n(5172),o=n(6993),i=n(5869),a=n(887),s=n(1791),c=n(4373),u=n(579);function l(){"use strict";var t=o(),n=t.m(l),d=(Object.getPrototypeOf?Object.getPrototypeOf(n):n.__proto__).constructor;function h(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))}var p={throw:1,return:2,break:3,continue:3};function f(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,p[e],t)},delegateYield:function(e,o,i){return t.resultName=o,n(r.d,u(e),i)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(e.exports=l=function(){return{wrap:function(e,n,r,o){return t.w(f(e),n,r,o&&o.reverse())},isGeneratorFunction:h,mark:t.m,awrap:function(e,t){return new r(e,t)},AsyncIterator:s,async:function(e,t,n,r,o){return(h(t)?a:i)(f(e),t,n,r,o)},keys:c,values:u}},e.exports.__esModule=!0,e.exports.default=e.exports)()}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports},579(e,t,n){var r=n(3738).default;e.exports=function(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(r(e)+" is not iterable")},e.exports.__esModule=!0,e.exports.default=e.exports},3738(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},4756(e,t,n){var r=n(4633)();e.exports=r;try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},3612(e,t,n){"use strict";var r,o,i,a,s;n.d(t,{A:()=>c}),window.authentication_config.sessionManagementEnabled="1"===window.authentication_config.sessionManagement;const c={debug:!!window.authentication_config.debug,sessionServer:window.authentication_config?window.authentication_config.sessionServer:"",entitlementsEnabled:!!window.authentication_config&&"1"===window.authentication_config.entitlementsEnabled,dropdownEnabled:!!window.authentication_config&&"1"===window.authentication_config.dropdownEnabled,enableReaderDashboardLink:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardLink,enableReaderDashboardv2:!!window.authentication_config&&"1"===window.authentication_config.enableReaderDashboardv2,enableDashboardCancel:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardCancel,enableDashboardBenefitHub:!!window.authentication_config&&"1"===window.authentication_config.enableDashboardBenefitHub,enableEngageArticleGifting:"1"===(null===(r=window.authentication_config)||void 0===r?void 0:r.articleSharingEnabled)&&"1"===(null===(o=window.authentication_config)||void 0===o?void 0:o.isEngageArticleSharing),enableGiftedArticlesLink:"1"===(null===(i=window.authentication_config)||void 0===i?void 0:i.articleSharingEnabled)&&"1"!==(null===(a=window.authentication_config)||void 0===a?void 0:a.isEngageArticleSharing),enableSavedArticlesLink:"1"===(null===(s=window.authentication_config)||void 0===s?void 0:s.articleSavingEnabled),prosperstackClientid:window.authentication_config?window.authentication_config.prosperstackClientid:"",enableUpgradeSubscription:!!window.authentication_config&&"1"===window.authentication_config.enableUpgradeSubscription,oneTapEnabled:!!window.authentication_config&&"1"===window.authentication_config.oneTapEnabled,useTribMainGoogle:!!window.authentication_config&&"1"===window.authentication_config.useTribMainGoogle,isAdfreeArticle:!!window.authentication_config&&"1"===window.authentication_config.isAdfreeArticle,auth0Domain:window.authentication_config?window.authentication_config.auth0Domain:"",auth0ClientId:window.authentication_config?window.authentication_config.auth0ClientId:"",entitlementsEndpoint:window.authentication_config?window.authentication_config.entitlementsEndpoint:"",entitlementsApiKey:window.authentication_config?window.authentication_config.entitlementsAPIKey:"",linaCheckOnArticles:!!window.authentication_config&&window.authentication_config.linaCheckOnArticles,serverEntitlements:!!window.authentication_config&&window.authentication_config.serverEntitlements,googleClientId:window.authentication_config?window.authentication_config.googleClientId:"",newsletterId:window.authentication_config?window.authentication_config.newsletterId:0,connextStorageKey:"",auth0SubKey:"auth0_sub",auth0Authenticated:"auth0.is.authenticated",secret:window.authentication_config?window.authentication_config.pluginSecret:"",newslettersEnabled:!!window.authentication_config&&"1"===window.authentication_config.newslettersEnabled,bcLowaSegements:!!window.authentication_config.bcLowaSegements&&"1"===window.authentication_config.bcLowaSegements,blueconicEnabled:!!window.authentication_config.blueconicEnabled&&"1"===window.authentication_config.blueconicEnabled,datadogEnabled:!!window.authentication_config.enableDatadog&&"1"===window.authentication_config.enableDatadog,updatePaymentEnabled:!!window.authentication_config&&"1"===window.authentication_config.enableUpdatePayment}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},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),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{"use strict";var e={};function t(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var a=e.apply(n,r);function s(e){t(a,o,i,s,c,"next",e)}function c(e){t(a,o,i,s,c,"throw",e)}s(void 0)})}}n.r(e),n.d(e,{hasBrowserEnv:()=>Hs,hasStandardBrowserEnv:()=>Ws,hasStandardBrowserWebWorkerEnv:()=>Ks,navigator:()=>Gs,origin:()=>Fs});var o=n(4756),i=n(3612);const a=function(){if(i.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;re.length)&&(t=e.length);for(var n=0,r=Array(t);n{let n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}(t)}catch(e){return atob(t)}}function g(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);oDate.now(),S="default";class A extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,A.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new A(t,n)}}class k extends A{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;super(e,t),this.state=n,this.appState=r,Object.setPrototypeOf(this,k.prototype)}}class T extends A{constructor(e,t,n,r){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(e,t),this.connection=n,this.state=r,this.appState=o,Object.setPrototypeOf(this,T.prototype)}}class _ extends A{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,_.prototype)}}class O extends _{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,O.prototype)}}class R extends A{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,R.prototype)}}class I extends A{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,I.prototype)}}class C extends A{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,C.prototype)}}class N extends A{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(P(e,["default"]),"', scope: '").concat(P(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,N.prototype)}}class L extends A{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(P(e,["default"]),"', missing scope: '").concat(P(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,L.prototype)}}class x extends A{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,x.prototype)}}function P(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const U=()=>window.crypto,D=()=>{let e="";for(;e.length<43;){const t=U().getRandomValues(new Uint8Array(43-e.length));for(const n of t)e.length<43&&n<198&&(e+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~."[n%66])}return e},M=e=>btoa(e),B=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],j=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object.keys(e).reduce((n,r)=>{if(t&&"env"===r)return n;const o=B.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},H=e=>{var{clientId:t}=e,n=g(e,["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:t},n))).toString()},G=async e=>{const t=U().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},W=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),K=e=>{const t=new Uint8Array(e);return(e=>{const t={"+":"-","/":"_","=":""};return e.replace(/[+/=]/g,e=>t[e])})(window.btoa(String.fromCharCode(...Array.from(t))))};var F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},X={},J={};Object.defineProperty(J,"__esModule",{value:!0});var z=function(){function e(){var e=this;this.locked=new Map,this.addToLocked=function(t,n){var r=e.locked.get(t);void 0===r?void 0===n?e.locked.set(t,[]):e.locked.set(t,[n]):void 0!==n&&(r.unshift(n),e.locked.set(t,r))},this.isLocked=function(t){return e.locked.has(t)},this.lock=function(t){return new Promise(function(n,r){e.isLocked(t)?e.addToLocked(t,n):(e.addToLocked(t),n())})},this.unlock=function(t){var n=e.locked.get(t);if(void 0!==n&&0!==n.length){var r=n.pop();e.locked.set(t,n),void 0!==r&&setTimeout(r,0)}else e.locked.delete(t)}}return e.getInstance=function(){return void 0===e.instance&&(e.instance=new e),e.instance},e}();J.default=function(){return z.getInstance()};var V=F&&F.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}c((r=r.apply(e,t||[])).next())})},Y=F&&F.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[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 V(this,void 0,void 0,function(){return Y(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 V(this,void 0,void 0,function(){var n,r,o,i;return Y(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?ee:this.storageHandler,r=Q+"-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,q.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),q.default().unlock(i.iat),e.notifyWaiters(),a.label=2;case 2:return[2]}})})},e.lockCorrector=function(t){for(var n=Date.now()-5e3,r=t,o=[],i=0;;){var a=r.keySync(i);if(null===a)break;o.push(a),i++}for(var s=!1,c=0;cr.abort(),t);try{return await navigator.locks.request(e,{mode:"exclusive",signal:r.signal},async e=>{if(clearTimeout(o),!e)throw new Error("Lock not available");return await n()})}catch(e){if(clearTimeout(o),"AbortError"===(null==e?void 0:e.name))throw new _;throw e}}}class ae{constructor(){this.activeLocks=new Set,this.lock=new oe,this.pagehideHandler=()=>{this.activeLocks.forEach(e=>this.lock.releaseLock(e)),this.activeLocks.clear()}}async runWithLock(e,t,n){let r=!1;for(let n=0;n<10&&!r;n++)r=await this.lock.acquireLock(e,t);if(!r)throw new _;this.activeLocks.add(e),1===this.activeLocks.size&&"undefined"!=typeof window&&window.addEventListener("pagehide",this.pagehideHandler);try{return await n()}finally{this.activeLocks.delete(e),await this.lock.releaseLock(e),0===this.activeLocks.size&&"undefined"!=typeof window&&window.removeEventListener("pagehide",this.pagehideHandler)}}}let se=null;const ce=new TextEncoder,ue=new TextDecoder;function le(e){return"string"==typeof e?ce.encode(e):ue.decode(e)}function de(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new me(`${e.name} modulusLength must be at least 2048 bits`)}let he;if(Uint8Array.prototype.toBase64)he=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;he=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;rnew Promise(function(n,r){const o=new MessageChannel;o.port1.onmessage=function(e){e.data.error?r(new Error(e.data.error)):n(e.data),o.port1.close()},t.postMessage(e,[o.port2])}),ke=(e,t,n)=>{const r=new AbortController;let o;return t.signal=r.signal,Promise.race([fetch(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})},Te=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:w;return o?(async(e,t,n,r,o,i,a,s)=>Ae({type:"refresh",auth:{audience:t,scope:n},timeout:o,fetchUrl:e,fetchOptions:r,useFormData:a,useMrrt:s},i))(e,t,n,r,a,o,i,arguments.length>7?arguments[7]:void 0):(async(e,t,n)=>{const r=await ke(e,t,n);return{ok:r.ok,json:await r.json(),headers:(o=r.headers,[...o].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var o})(e,r,a)};async function _e(e,t,n,r,o,i,a,s,c,u){if(c){const t=await c.generateProof({url:e,method:o.method||"GET",nonce:await c.getNonce()});o.headers=Object.assign(Object.assign({},o.headers),{dpop:t})}let l,d=null;for(let c=0;c<3;c++)try{l=await Te(e,n,r,o,i,a,t,s),d=null;break}catch(e){d=e}if(d)throw d;const h=l.json,{error:p,error_description:f}=h,m=g(h,["error","error_description"]),{headers:y,ok:w}=l;let b;if(c&&(b=y[Ee],b&&await c.setNonce(b)),!w){const l=f||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===p)throw new C(p,l,m.mfa_token,m.mfa_requirements);if("missing_refresh_token"===p)throw new N(n,r);if("use_dpop_nonce"===p){if(!c||!b||u)throw new x(b);return _e(e,t,n,r,o,i,a,s,c,!0)}throw new A(p||"request_error",l)}return m}async function Oe(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=g(e,["baseUrl","timeout","audience","scope","auth0Client","useFormData","useMrrt","dpop"]);const d="urn:ietf:params:oauth:grant-type:token-exchange"===l.grant_type,h="refresh_token"===l.grant_type&&c,p=Object.assign(Object.assign(Object.assign(Object.assign({},l),d&&o&&{audience:o}),d&&i&&{scope:i}),h&&{audience:o,scope:i}),f=s?H(p):JSON.stringify(p),m=(y=l.grant_type,Se.includes(y));var y;return await _e("".concat(n,"/oauth/token"),r,o||S,i,{method:"POST",body:f,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(j(a||v)))}},t,s,c,m?u:void 0)}const Re=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let r;return n&&(r=e[n]),r||(r=e[S]),Re(r,t)},Ce="@@auth0spajs@@",Ne="@@user@@";class Le{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ce,n=arguments.length>2?arguments[2]:void 0;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,r,o]=e.split("::");return new Le({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new Le({scope:t,audience:n,clientId:r})}}class xe{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(Ce))}}class Pe{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 Ue{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||E}async setIdToken(e,t,n){var r;const o=this.getIdTokenCacheKey(e);await this.cache.set(o,{id_token:t,decodedToken:n}),await(null===(r=this.keyManifest)||void 0===r?void 0:r.add(o))}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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;var o;let i=await this.cache.get(e.toKey()),a=e;if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o),a=Le.fromKey(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const s=await this.nowProvider(),c=Math.floor(s/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 Le({clientId:e},Ce,Ne).toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Le.fromKey(t),o=new Set(r.scope&&r.scope.split(" ")),i=(null===(n=e.scope)||void 0===n?void 0:n.split(" "))||[],a=r.scope&&i.reduce((e,t)=>e&&o.has(t),!0);return r.prefix===Ce&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Le.fromKey(r);if(t.prefix===Ce&&t.clientId===e.clientId){const e=await this.cache.get(r);if(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)return{refresh_token:e.body.refresh_token,audience:e.body.audience,scope:e.body.scope}}}}async getRefreshTokensByAudience(e,t){var n;const r=await this.getCacheKeys();if(!r)return[];const o=new Set;for(const i of r){const r=Le.fromKey(i);if(r.prefix===Ce&&r.clientId===t&&r.audience===e){const e=await this.cache.get(i);(null===(n=null==e?void 0:e.body)||void 0===n?void 0:n.refresh_token)&&o.add(e.body.refresh_token)}}return Array.from(o)}async updateEntry(e,t){var n;const r=await this.getCacheKeys();if(r)for(const o of r){const r=await this.cache.get(o);(null===(n=null==r?void 0:r.body)||void 0===n?void 0:n.refresh_token)===e&&(r.body.refresh_token=t,await this.cache.set(o,r))}}}class De{constructor(e,t,n){this.storage=e,this.clientId=t,this.cookieDomain=n,this.storageKey="".concat("a0.spajs.txs",".").concat(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 Me=e=>"number"==typeof e,Be=["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 je=F&&F.__assign||function(){return je=Object.assign||function(e){for(var t,n=1,r=arguments.length;nXe.get(e)||Xe.get("".concat(Je).concat(e)),save(e,t,n){let r={};"https:"===window.location.protocol&&(r={secure:!0}),(null==n?void 0:n.daysUntilExpire)&&(r.expires=n.daysUntilExpire),(null==n?void 0:n.cookieDomain)&&(r.domain=n.cookieDomain),Ke("".concat(Je).concat(e),JSON.stringify(t),r),Xe.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Fe(e,n),Xe.remove(e,t),Xe.remove("".concat(Je).concat(e),t)}},Ve={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 Ye;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Ye||(Ye={}));var Ze,qe=function(e){return Ze=Ze||function(e,t,n){var r=void 0===t?null:t,o=function(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),o=0,i=n.length;o0?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"".concat(Ce,"::").concat(e)}}const et="auth0.is.authenticated",tt={memory:()=>(new Pe).enclosedCache,localstorage:()=>new xe},nt=e=>tt[e],rt=e=>{const{openUrl:t,onRedirect:n}=e,r=g(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},ot=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},it={NONCE:"nonce",KEYPAIR:"keypair"};class at{constructor(e){this.clientId=e}getVersion(){return 1}createDbHandle(){const e=window.indexedDB.open("auth0-spa-js",this.getVersion());return new Promise((t,n)=>{e.onupgradeneeded=()=>Object.values(it).forEach(t=>e.result.createObjectStore(t)),e.onerror=()=>n(e.error),e.onsuccess=()=>t(e.result)})}async getDbHandle(){return this.dbHandle||(this.dbHandle=await this.createDbHandle()),this.dbHandle}async executeDbRequest(e,t,n){const r=n((await this.getDbHandle()).transaction(e,t).objectStore(e));return new Promise((e,t)=>{r.onsuccess=()=>e(r.result),r.onerror=()=>t(r.error)})}buildKey(e){const t=e?"_".concat(e):"auth0";return"".concat(this.clientId,"::").concat(t)}setNonce(e,t){return this.save(it.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(it.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(it.NONCE,this.buildKey(e))}findKeyPair(){return this.find(it.KEYPAIR,this.buildKey())}find(e,t){return this.executeDbRequest(e,"readonly",e=>e.get(t))}async deleteBy(e,t){const n=await this.executeDbRequest(e,"readonly",e=>e.getAllKeys());null==n||n.filter(t).map(t=>this.executeDbRequest(e,"readwrite",e=>e.delete(t)))}deleteByClientId(e,t){return this.deleteBy(e,e=>"string"==typeof e&&e.startsWith("".concat(t,"::")))}clearNonces(){return this.deleteByClientId(it.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(it.KEYPAIR,this.clientId)}}class st{constructor(e){this.storage=new at(e)}getNonce(e){return this.storage.findNonce(e)}setNonce(e,t){return this.storage.setNonce(e,t)}async getOrGenerateKeyPair(){let e=await this.storage.findKeyPair();return e||(e=await async function(e,t){var n;let r;return r={name:"ECDSA",namedCurve:"P-256"},crypto.subtle.generateKey(r,null!==(n=null==t?void 0:t.extractable)&&void 0!==n&&n,["sign","verify"])}(0,{extractable:!1}),await this.storage.setKeyPair(e)),e}async generateProof(e){const t=await this.getOrGenerateKeyPair();return function(e){let{keyPair:t,url:n,method:r,nonce:o,accessToken:i}=e;const a=function(e){const t=new URL(e);return t.search="",t.hash="",t.href}(n);return be(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!we(e))throw new TypeError('"publicKey" must be a public CryptoKey');if(!0!==e.extractable)throw new TypeError('"publicKey.extractable" must be true');const t=await ve(e);let n;switch(t.kty){case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;default:throw new fe("unsupported JWK kty")}return pe(await crypto.subtle.digest({name:"SHA-256"},le(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var ct;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(ct||(ct={}));class ut{constructor(e,t){this.hooks=t,this.config=Object.assign(Object.assign({},e),{fetch:e.fetch||("undefined"==typeof window?fetch:window.fetch.bind(window))})}isAbsoluteUrl(e){return/^(https?:)?\/\//i.test(e)}buildUrl(e,t){if(t){if(this.isAbsoluteUrl(t))return t;if(e)return"".concat(e.replace(/\/?\/$/,""),"/").concat(t.replace(/^\/+/,""))}throw new TypeError("`url` must be absolute or `baseUrl` non-empty.")}getAccessToken(e){return this.config.getAccessToken?this.config.getAccessToken(e):this.hooks.getAccessToken(e)}extractUrl(e){return"string"==typeof e?e:e instanceof URL?e.href:e.url}buildBaseRequest(e,t){if(!this.config.baseUrl)return new Request(e,t);const n=this.buildUrl(this.config.baseUrl,this.extractUrl(e)),r=e instanceof Request?new Request(n,e):n;return new Request(r,t)}setAuthorizationHeader(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ct.Bearer;e.headers.set("authorization","".concat(n," ").concat(t))}async setDpopProofHeader(e,t){if(!this.config.dpopNonceId)return;const n=await this.hooks.getDpopNonce(),r=await this.hooks.generateDpopProof({accessToken:t,method:e.method,nonce:n,url:e.url});e.headers.set("dpop",r)}async prepareRequest(e,t){const n=await this.getAccessToken(t);let r,o;"string"==typeof n?(r=this.config.dpopNonceId?ct.DPoP:ct.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===ct.DPoP&&await this.setDpopProofHeader(e,o)}getHeader(e,t){return Array.isArray(e)?new Headers(e).get(t)||"":"function"==typeof e.get?e.get(t)||"":e[t]||""}hasUseDpopNonceError(e){if(401!==e.status)return!1;const t=this.getHeader(e.headers,"www-authenticate");return t.includes("invalid_dpop_nonce")||t.includes("use_dpop_nonce")}async handleResponse(e,t){const n=this.getHeader(e.headers,Ee);if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new x(n);return t.onUseDpopNonceError()}async internalFetchWithAuth(e,t,n,r){const o=this.buildBaseRequest(e,t);await this.prepareRequest(o,r);const i=await this.config.fetch(o);return this.handleResponse(i,n)}fetchWithAuth(e,t,n){const r={onUseDpopNonceError:()=>this.internalFetchWithAuth(e,t,Object.assign(Object.assign({},r),{onUseDpopNonceError:void 0}),n)};return this.internalFetchWithAuth(e,t,r,n)}}class lt{constructor(e,t){this.myAccountFetcher=e,this.apiBase=t}async connectAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/connect"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async completeAccount(e){const t=await this.myAccountFetcher.fetchWithAuth("".concat(this.apiBase,"v1/connected-accounts/complete"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});return this._handleResponse(t)}async _handleResponse(e){let t;try{t=await e.text(),t=JSON.parse(t)}catch(n){throw new dt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new dt(t)}}class dt extends Error{constructor(e){let{type:t,status:n,title:r,detail:o,validation_errors:i}=e;super(o),this.name="MyAccountApiError",this.type=t,this.status=n,this.title=r,this.detail=o,this.validation_errors=i,Object.setPrototypeOf(this,dt.prototype)}}const ht={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function pt(e,t){this.v=e,this.k=t}function ft(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function mt(e){return new pt(e,0)}function gt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function yt(e,t){return e.get(ft(e,t))}function wt(e,t,n){gt(e,t),t.set(e,n)}function bt(e,t,n){return e.set(ft(e,t),n),n}function vt(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Gt=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{try{return Uint8Array.fromBase64(e,{alphabet:"base64url"})}catch(e){throw Nt("The input to be decoded is not correctly encoded.",It,e)}}:e=>{try{const t=atob(e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"")),n=new Uint8Array(t.length);for(let e=0;e0)return;if(t){if(0!==e)throw Nt("".concat(n," must be a non-negative number"),It,o);return}throw Nt("".concat(n," must be a positive number"),It,o)}catch(e){if(r)throw Jt(e.message,r,o);throw e}}function Qt(e,t,n,r){try{if("string"!=typeof e)throw Nt("".concat(t," must be a string"),Ct,r);if(0===e.length)throw Nt("".concat(t," must not be empty"),It,r)}catch(e){if(n)throw Jt(e.message,n,r);throw e}}function $t(e){!function(e,t){if(_n(e)!==t)throw function(e){let t='"response" content-type must be ';for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o2){const e=r.pop();t+="".concat(r.join(", "),", or ").concat(e)}else 2===r.length?t+="".concat(r[0]," or ").concat(r[1]):t+=r[0];return Jt(t,zn,e)}(e,t)}(e,"application/json")}function en(){return Kt(crypto.getRandomValues(new Uint8Array(32)))}function tn(e){switch(e.algorithm.name){case"RSA-PSS":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"PS256";case"SHA-384":return"PS384";case"SHA-512":return"PS512";default:throw new Ft("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"RSASSA-PKCS1-v1_5":return function(e){switch(e.algorithm.hash.name){case"SHA-256":return"RS256";case"SHA-384":return"RS384";case"SHA-512":return"RS512";default:throw new Ft("unsupported RsaHashedKeyAlgorithm hash name",{cause:e})}}(e);case"ECDSA":return function(e){switch(e.algorithm.namedCurve){case"P-256":return"ES256";case"P-384":return"ES384";case"P-521":return"ES512";default:throw new Ft("unsupported EcKeyAlgorithm namedCurve",{cause:e})}}(e);case"Ed25519":case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return e.algorithm.name;case"EdDSA":return"Ed25519";default:throw new Ft("unsupported CryptoKey algorithm name",{cause:e})}}function nn(e){const t=null==e?void 0:e[xt];return"number"==typeof t&&Number.isFinite(t)?t:0}function rn(e){const t=null==e?void 0:e[Pt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function on(){return Math.floor(Date.now()/1e3)}function an(e){if("object"!=typeof e||null===e)throw Nt('"as" must be an object',Ct);Qt(e.issuer,'"as.issuer"')}function sn(e){if("object"!=typeof e||null===e)throw Nt('"client" must be an object',Ct);Qt(e.client_id,'"client.client_id"')}function cn(e){return Qt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function un(e,t){const{key:n,kid:r}=(o=e)instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&Qt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Nt("".concat(t," must be a CryptoKey"),Ct)}(e,t),"private"!==e.type)throw Nt("".concat(t," must be a private CryptoKey"),It)}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:tn(n),kid:r},u=function(e,t){const n=on()+nn(t);return{jti:en(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===(s=t[Dt])||void 0===s||s.call(t,c,u),i.set("client_id",o.client_id),i.set("client_assertion_type","urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),i.set("client_assertion",await async function(e,t,n){if(!n.usages.includes("sign"))throw Nt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',It);const r="".concat(Kt(Ht(JSON.stringify(e))),".").concat(Kt(Ht(JSON.stringify(t)))),o=Kt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:or(e)};case"RSA-PSS":switch(rr(e),e.algorithm.hash.name){case"SHA-256":case"SHA-384":case"SHA-512":return{name:e.algorithm.name,saltLength:parseInt(e.algorithm.hash.name.slice(-3),10)>>3};default:throw new Ft("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return rr(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Ft("unsupported CryptoKey algorithm name",{cause:e})}(n),n,Ht(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const ln=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function dn(e,t){if(t&&"https:"!==e.protocol)throw Jt("only requests to HTTPS are allowed",Yn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Jt("only HTTP and HTTPS requests are allowed",Zn,e)}function hn(e,t,n,r){let o;if("string"!=typeof e||!(o=ln(e)))throw Jt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?er:tr,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return dn(o,r),o}function pn(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?hn(e.mtls_endpoint_aliases[t],t,n,r):hn(e[t],t,n,r)}class fn extends Error{constructor(e,t){var n;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"error",void 0),vt(this,"status",void 0),vt(this,"error_description",void 0),vt(this,"response",void 0),this.name=this.constructor.name,this.code=Wn,this.cause=t.cause,this.error=t.cause.error,this.status=t.response.status,this.error_description=t.cause.error_description,Object.defineProperty(this,"response",{enumerable:!1,value:t.response}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}class mn extends Error{constructor(e,t){var n,r;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"error",void 0),vt(this,"error_description",void 0),this.name=this.constructor.name,this.code=Fn,this.cause=t.cause,this.error=t.cause.get("error"),this.error_description=null!==(n=t.cause.get("error_description"))&&void 0!==n?n:void 0,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}class gn extends Error{constructor(e,t){var n;super(e,t),vt(this,"cause",void 0),vt(this,"code",void 0),vt(this,"response",void 0),vt(this,"status",void 0),this.name=this.constructor.name,this.code=Gn,this.cause=t.cause,this.status=t.response.status,this.response=t.response,Object.defineProperty(this,"response",{enumerable:!1}),null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}const yn="[a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+",wn="("+yn+')\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"',bn="("+yn+")\\s*=\\s*("+yn+")",vn=new RegExp("^[,\\s]*("+yn+")"),En=new RegExp("^[,\\s]*"+wn+"[,\\s]*(.*)"),Sn=new RegExp("^[,\\s]*"+bn+"[,\\s]*(.*)"),An=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function kn(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!Rt(e,Response))throw Nt('"response" must be an instance of Response',Ct);const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(vn);const i=null===(o=t)||void 0===o?void 0:o[1].toLowerCase();if(!i)return;const a=r.substring(t[0].length);if(a&&!a.match(/^[\s,]/))return;const s=a.match(/^\s+(.*)$/),c=!!s;r=s?s[1]:void 0;const u={};let l;if(c)for(;r;){let n,o;if(t=r.match(En)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(Sn))){if(t=r.match(An)){if(Object.keys(u).length)break;[,l,r]=t;break}return}[,n,o,r]=t,u[n.toLowerCase()]=o}}else r=a||void 0;const d={scheme:i,parameters:u};l&&(d.token68=l),n.push(d)}return n.length?n:void 0}(e))throw new gn("server responded with a challenge in the WWW-Authenticate HTTP Header",{cause:t,response:e})}(e),t=await async function(e){if(e.status>399&&e.status<500){nr(e),$t(e);try{const t=await e.clone().json();if(zt(t)&&"string"==typeof t.error&&t.error.length)return t}catch(e){}}}(e))throw await(null===(r=e.body)||void 0===r?void 0:r.cancel()),new fn("server responded with an error in the response body",{cause:t,response:e});throw Jt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Vn,e)}}function Tn(e){if(!Un.has(e))throw Nt('"options.DPoP" is not a valid DPoPHandle',It)}function _n(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function On(e,t,n,r,o,i,a){return await n(e,t,o,i),i.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"),((null==a?void 0:a[Ut])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Yt(r,null==a?void 0:a.signal)})}async function Rn(e,t,n,r,o,i){var a;const s=pn(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[Lt]));o.set("grant_type",r);const c=Vt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(Tn(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await On(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const In=new WeakMap,Cn=new WeakMap;function Nn(e){if(!e.id_token)return;const t=In.get(e);if(!t)throw Nt('"ref" was already garbage collected or did not resolve from the proper sources',It);return t}async function Ln(e,t,n,r,o,i){if(an(e),sn(t),!Rt(n,Response))throw Nt('"response" must be an instance of Response',Ct);await kn(n,200,"Token Endpoint"),nr(n);const a=await ur(n);if(Qt(a.access_token,'"response" body "access_token" property',Jn,{body:a}),Qt(a.token_type,'"response" body "token_type" property',Jn,{body:a}),a.token_type=a.token_type.toLowerCase(),void 0!==a.expires_in){let e="number"!=typeof a.expires_in?parseFloat(a.expires_in):a.expires_in;qt(e,!0,'"response" body "expires_in" property',Jn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Qt(a.refresh_token,'"response" body "refresh_token" property',Jn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Jt('"response" body "scope" property must be a string',Jn,{body:a});if(void 0!==a.id_token){Qt(a.id_token,'"response" body "id_token" property',Jn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(qt(t.default_max_age,!0,'"client.default_max_age"'),i.push("auth_time")),null!=r&&r.length&&i.push(...r);const{claims:s,jwt:c}=await async function(e,t,n,r,o){let i,a,{0:s,1:c,length:u}=e.split(".");if(5===u){if(void 0===o)throw new Ft("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Jt("Invalid JWT",Jn,e);try{i=JSON.parse(Ht(Kt(s)))}catch(e){throw Jt("failed to parse JWT Header body as base64url encoded JSON",Xn,e)}if(!zt(i))throw Jt("JWT Header must be a top level object",Jn,e);if(t(i),void 0!==i.crit)throw new Ft('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(Ht(Kt(c)))}catch(e){throw Jt("failed to parse JWT Payload body as base64url encoded JSON",Xn,e)}if(!zt(a))throw Jt("JWT Payload must be a top level object",Jn,e);const l=on()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Jt('unexpected JWT "exp" (expiration time) claim type',Jn,{claims:a});if(a.exp<=l-r)throw Jt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',qn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Jt('unexpected JWT "iat" (issued at) claim type',Jn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Jt('unexpected JWT "iss" (issuer) claim type',Jn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Jt('unexpected JWT "nbf" (not before) claim type',Jn,{claims:a});if(a.nbf>l+r)throw Jt('unexpected JWT "nbf" (not before) claim value',qn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Jt('unexpected JWT "aud" (audience) claim type',Jn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,ir.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),nn(t),rn(t),o).then(Bn.bind(void 0,i)).then(Pn.bind(void 0,e)).then(xn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Jt('ID Token "aud" (audience) claim includes additional untrusted audiences',Qn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Jt('unexpected ID Token "azp" (authorized party) claim value',Qn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&qt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Jn,{claims:s}),Cn.set(n,c),In.set(a,s)}if(void 0!==(null==i?void 0:i[a.token_type]))i[a.token_type](n,a);else if("dpop"!==a.token_type&&"bearer"!==a.token_type)throw new Ft("unsupported `token_type` value",{cause:{body:a}});return a}function xn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Jt('unexpected JWT "aud" (audience) claim value',Qn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Jt('unexpected JWT "aud" (audience) claim value',Qn,{expected:e,claims:t.claims,claim:"aud"});return t}function Pn(e,t){var n,r;const o=null!==(n=null===(r=e[dr])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Jt('unexpected JWT "iss" (issuer) claim value',Qn,{expected:o,claims:t.claims,claim:"iss"});return t}const Un=new WeakSet,Dn=Symbol(),Mn={aud:"audience",c_hash:"code hash",client_id:"client id",exp:"expiration time",iat:"issued at",iss:"issuer",jti:"jwt id",nonce:"nonce",s_hash:"state hash",sub:"subject",ath:"access token hash",htm:"http method",htu:"http uri",cnf:"confirmation",auth_time:"authentication time"};function Bn(e,t){for(const n of e)if(void 0===t.claims[n])throw Jt('JWT "'.concat(n,'" (').concat(Mn[n],") claim missing"),Jn,{claims:t.claims});return t}const jn=Symbol(),Hn=Symbol();const Gn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Wn="OAUTH_RESPONSE_BODY_ERROR",Kn="OAUTH_UNSUPPORTED_OPERATION",Fn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Xn="OAUTH_PARSE_ERROR",Jn="OAUTH_INVALID_RESPONSE",zn="OAUTH_RESPONSE_IS_NOT_JSON",Vn="OAUTH_RESPONSE_IS_NOT_CONFORM",Yn="OAUTH_HTTP_REQUEST_FORBIDDEN",Zn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",qn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Qn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",$n="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",er="OAUTH_MISSING_SERVER_METADATA",tr="OAUTH_INVALID_SERVER_METADATA";function nr(e){if(e.bodyUsed)throw Nt('"response" body has been used already',It)}function rr(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Ft("unsupported ".concat(t.name," modulusLength"),{cause:e})}function or(e){const{algorithm:t}=e;switch(t.namedCurve){case"P-256":return"SHA-256";case"P-384":return"SHA-384";case"P-521":return"SHA-512";default:throw new Ft("unsupported ECDSA namedCurve",{cause:e})}}function ir(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Jt('missing client or server configuration to verify used JWT "alg" header parameter',void 0,{client:e,issuer:t,fallback:n});if("string"==typeof n?r.alg!==n:"function"==typeof n?!n(r.alg):!n.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Jt('unexpected JWT "alg" header parameter',Jn,{header:r,expected:e,reason:"client configuration"})}function ar(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Jt('"'.concat(t,'" parameter must be provided only once'),Jn);return n}const sr=Symbol(),cr=Symbol();async function ur(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t;try{t=await e.json()}catch(t){throw n(e),Jt('failed to parse "response" body as JSON',Xn,t)}if(!zt(t))throw Jt('"response" body must be a top level object',Jn,{body:t});return t}const lr=Symbol(),dr=Symbol(),hr=new TextEncoder,pr=new TextDecoder;function fr(e){const t=new Uint8Array(e.length);for(let n=0;n127)throw new TypeError("non-ASCII string encountered in encode()");t[n]=r}return t}function mr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},wr=(e,t)=>e.name===t;function br(e,t){var n;if(n=e.hash,parseInt(n.name.slice(4),10)!==t)throw yr("SHA-".concat(t),"algorithm.hash")}function vr(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2){const t=r.pop();e+="one of type ".concat(r.join(", "),", or ").concat(t,".")}else 2===r.length?e+="one of type ".concat(r[0]," or ").concat(r[1],"."):e+="of type ".concat(r[0],".");if(null==t)e+=" Received ".concat(t);else if("function"==typeof t&&t.name)e+=" Received function ".concat(t.name);else if("object"==typeof t&&null!=t){var i;null!==(i=t.constructor)&&void 0!==i&&i.name&&(e+=" Received an instance of ".concat(t.constructor.name))}return e}const Er=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),vt(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),vt(this,"claim",void 0),vt(this,"reason",void 0),vt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}vt(Ar,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class kr extends Sr{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:r,payload:t}}),vt(this,"code","ERR_JWT_EXPIRED"),vt(this,"claim",void 0),vt(this,"reason",void 0),vt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}vt(kr,"code","ERR_JWT_EXPIRED");class Tr extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}vt(Tr,"code","ERR_JOSE_ALG_NOT_ALLOWED");class _r extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JOSE_NOT_SUPPORTED")}}vt(_r,"code","ERR_JOSE_NOT_SUPPORTED"),vt(class extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),vt(class extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Or extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWS_INVALID")}}vt(Or,"code","ERR_JWS_INVALID");class Rr extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWT_INVALID")}}vt(Rr,"code","ERR_JWT_INVALID"),vt(class extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Ir extends Sr{constructor(){super(...arguments),vt(this,"code","ERR_JWKS_INVALID")}}vt(Ir,"code","ERR_JWKS_INVALID");class Cr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}vt(Cr,"code","ERR_JWKS_NO_MATCHING_KEY");class Nr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),vt(this,Symbol.asyncIterator,void 0),vt(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}vt(Nr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Lr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWKS_TIMEOUT")}}vt(Lr,"code","ERR_JWKS_TIMEOUT");class xr extends Sr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),vt(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}vt(xr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const Pr=e=>{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},Ur=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Dr=e=>Pr(e)||Ur(e);function Mr(e,t,n){try{return gr(e)}catch(e){throw new n("Failed to base64url decode the ".concat(t))}}function Br(e){if("object"!=typeof(t=e)||null===t||"[object Object]"!==Object.prototype.toString.call(e))return!1;var t;if(null===Object.getPrototypeOf(e))return!0;let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}const jr=e=>Br(e)&&"string"==typeof e.kty;async function Hr(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r3&&void 0!==arguments[3]&&arguments[3];Fr||(Fr=new WeakMap);let o=Fr.get(e);if(null!=o&&o[n])return o[n];const i=await Wr(St(St({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Fr.set(e,{[n]:i}),i};const Jr=(e,t)=>{if(e.byteLength!==t.length)return!1;for(let n=0;n{const t=e.data[e.pos++];if(128&t){const n=127&t;let r=0;for(let t=0;t{if(e.data[e.pos++]!==t)throw new Error(n)},Yr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Zr=(e,t,n)=>{var r;const o=(e=>mr(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"")))(e);let i=n;return null!=t&&null!==(r=t.startsWith)&&void 0!==r&&r.call(t,"ECDH-ES")&&(i||(i={}),i.getNamedCurve=e=>{const t={data:e,pos:0};return function(e){Vr(e,48,"Invalid PKCS#8 structure"),zr(e),Vr(e,2,"Expected version field");const t=zr(e);e.pos+=t,Vr(e,48,"Expected algorithm identifier");zr(e);e.pos}(t),(e=>{const t=(e=>{Vr(e,6,"Expected algorithm OID");const t=zr(e);return Yr(e,t)})(e);if(Jr(t,[43,101,110]))return"X25519";if(!Jr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Vr(e,6,"Expected curve OID");const n=zr(e),r=Yr(e,n);for(const{name:e,oid:t}of[{name:"P-256",oid:[42,134,72,206,61,3,1,7]},{name:"P-384",oid:[43,129,4,0,34]},{name:"P-521",oid:[43,129,4,0,35]}])if(Jr(r,t))return e;throw new Error("Unsupported named curve")})(t)}),(async(e,t,n,r)=>{var o;let i,a;const s="spki"===e,c=()=>s?["verify"]:["sign"];switch(n){case"PS256":case"PS384":case"PS512":i={name:"RSA-PSS",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RS256":case"RS384":case"RS512":i={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(n.slice(-3))},a=c();break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":i={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(n.slice(-3),10)||1)},a=s?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":case"ES384":case"ES512":i={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[n]},a=c();break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":try{const e=r.getNamedCurve(t);i="X25519"===e?{name:"X25519"}:{name:"ECDH",namedCurve:e}}catch(e){throw new _r("Invalid or unsupported key format")}a=s?[]:["deriveBits"];break;case"Ed25519":case"EdDSA":i={name:"Ed25519"},a=c();break;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":i={name:n},a=c();break;default:throw new _r('Invalid or unsupported "alg" (Algorithm) value')}return crypto.subtle.importKey(e,t,i,null!==(o=null==r?void 0:r.extractable)&&void 0!==o?o:!!s,a)})("pkcs8",o,t,i)},qr=e=>null==e?void 0:e[Symbol.toStringTag],Qr=(e,t,n)=>{if(void 0!==t.use){let e;switch(n){case"sign":case"verify":e="sig";break;case"encrypt":case"decrypt":e="enc"}if(t.use!==e)throw new TypeError('Invalid key for this operation, its "use" must be "'.concat(e,'" when present'))}if(void 0!==t.alg&&t.alg!==e)throw new TypeError('Invalid key for this operation, its "alg" must be "'.concat(e,'" when present'));if(Array.isArray(t.key_ops)){var r,o;let i;switch(!0){case"sign"===n||"verify"===n:case"dir"===e:case e.includes("CBC-HS"):i=n;break;case e.startsWith("PBES2"):i="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):i=!e.includes("GCM")&&e.endsWith("KW")?"encrypt"===n?"wrapKey":"unwrapKey":n;break;case"encrypt"===n&&e.startsWith("RSA"):i="wrapKey";break;case"decrypt"===n:i=e.startsWith("RSA")?"unwrapKey":"deriveBits"}if(i&&!1===(null===(r=t.key_ops)||void 0===r||null===(o=r.includes)||void 0===o?void 0:o.call(r,i)))throw new TypeError('Invalid key for this operation, its "key_ops" must include "'.concat(i,'" when present'))}return!0};var $r,eo;let to,no;if("undefined"==typeof navigator||null===($r=navigator.userAgent)||void 0===$r||null===(eo=$r.startsWith)||void 0===eo||!eo.call($r,"Mozilla/5.0 ")){const e="v6.8.3";no="".concat("openid-client","/").concat(e),to={"user-agent":no}}const ro=e=>oo.get(e);let oo,io;function ao(e){return void 0!==e?cn(e):(io||(io=new WeakMap),(e,t,n,r)=>{let o;return(o=io.get(t))||(function(e,t){if("string"!=typeof e)throw lo("".concat(t," must be a string"),uo);if(0===e.length)throw lo("".concat(t," must not be empty"),co)}(t.client_secret,'"metadata.client_secret"'),o=cn(t.client_secret),io.set(t,o)),o(e,t,n,r)})}const so=Ut,co="ERR_INVALID_ARG_VALUE",uo="ERR_INVALID_ARG_TYPE";function lo(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class ho extends Error{constructor(e,t){var n;super(e,t),vt(this,"code",void 0),this.name=this.constructor.name,this.code=null==t?void 0:t.code,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function po(e,t,n){return new ho(e,{cause:t,code:n})}function fo(e){if(e instanceof TypeError||e instanceof ho||e instanceof fn||e instanceof mn||e instanceof gn)throw e;if(e instanceof Xt)switch(e.code){case Yn:throw po("only requests to HTTPS are allowed",e,e.code);case Zn:throw po("only requests to HTTP or HTTPS are allowed",e,e.code);case Vn:throw po("unexpected HTTP response status code",e.cause,e.code);case zn:throw po("unexpected response content-type",e.cause,e.code);case Xn:throw po("parsing error occured",e,e.code);case Jn:throw po("invalid response encountered",e,e.code);case Qn:throw po("unexpected JWT claim value encountered",e,e.code);case $n:throw po("unexpected JSON attribute value encountered",e,e.code);case qn:throw po("JWT timestamp claim value failed validation",e,e.code);default:throw po(e.message,e,e.code)}if(e instanceof Ft)throw po("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw po("runtime operation error",e,Kn);case"NotSupportedError":throw po("runtime unsupported operation",e,Kn);case"TimeoutError":throw po("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw po("operation aborted",e,"OAUTH_ABORT")}throw new ho("something went wrong",{cause:e})}async function mo(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw lo('"server" must be an instance of URL',uo);const o=!e.href.includes("/.well-known/"),i=null!==(n=null==t?void 0:t.timeout)&&void 0!==n?n:30,a=AbortSignal.timeout(1e3*i),s=await(o?async function(e,t){return async function(e,t,n,r){if(!(e instanceof URL))throw Nt('"'.concat("issuerIdentifier",'" must be an instance of URL'),Ct);dn(e,!0!==(null==r?void 0:r[Lt]));const o=n(new URL(e.href)),i=Vt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Ut])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Yt(o,null==r?void 0:r.signal)})}(e,0,e=>{switch(null==t?void 0:t.algorithm){case void 0:case"oidc":!function(e){e.pathname=Zt("".concat(e.pathname,"/").concat(".well-known/openid-configuration"))}(e);break;case"oauth2":!function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"/"===e.pathname?e.pathname=t:e.pathname=Zt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Nt('"options.algorithm" must be "oidc" (default), or "oauth2"',It)}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Ut]:null==t?void 0:t[so],[Lt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(Ao),signal:a,headers:new Headers(to)}):((null==t?void 0:t[so])||fetch)((dn(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(Ao)),e.href),{headers:Object.fromEntries(new Headers(St({accept:"application/json"},to)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==lr)throw Nt('"expectedIssuerIdentifier" must be an instance of URL',Ct);if(!Rt(t,Response))throw Nt('"response" must be an instance of Response',Ct);if(200!==t.status)throw Jt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Vn,t);nr(t);const r=await ur(t);if(Qt(r.issuer,'"response" body "issuer" property',Jn,{body:r}),n!==lr&&new URL(r.issuer).href!==n.href)throw Jt('"response" body "issuer" property does not match the expected value',$n,{expected:n.href,body:r,attribute:"issuer"});return r}(lr,e)).catch(fo);var c;return o&&new URL(s.issuer).href!==e.href&&(function(e,t,n){return!("https://login.microsoftonline.com"!==e.origin||null!=n&&n.algorithm&&"oidc"!==n.algorithm||(t[go]=!0,0))}(e,s,t)||function(e,t){return!(!e.hostname.endsWith(".b2clogin.com")||null!=t&&t.algorithm&&"oidc"!==t.algorithm)}(e,t)||(()=>{throw new ho("discovered metadata issuer does not match the expected issuer",{code:$n,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new yo(i,t,n,r);let s=ro(a);if(null!=o&&o[so]&&(s.fetch=o[so]),null!=o&&o.timeout&&(s.timeout=o.timeout),null!=o&&o.execute)for(const e of o.execute)e(a);return a}new TextDecoder;const go=Symbol();class yo{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw lo('"clientId" must be a non-empty string',uo);if("string"==typeof n&&(n={client_secret:n}),void 0!==(null===(o=n)||void 0===o?void 0:o.client_id)&&t!==n.client_id)throw lo('"clientId" and "metadata.client_id" must be the same',co);const u=St(St({},structuredClone(n)),{},{client_id:t});let l;u[xt]=null!==(i=null===(a=n)||void 0===a?void 0:a[xt])&&void 0!==i?i:0,u[Pt]=null!==(s=null===(c=n)||void 0===c?void 0:c[Pt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?ao(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);go in e&&(h[dr]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);oo||(oo=new WeakMap),oo.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(ro(this).as);return function(e){Object.defineProperties(e,function(e){return{supportsPKCE:{__proto__:null,value(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"S256";return!0===(null===(t=e.code_challenge_methods_supported)||void 0===t?void 0:t.includes(n))}}}}(e))}(e),e}clientMetadata(){return structuredClone(ro(this).c)}get timeout(){return ro(this).timeout}set timeout(e){ro(this).timeout=e}get[so](){return ro(this).fetch}set[so](e){ro(this).fetch=e}}function wo(e){Object.defineProperties(e,function(e){let t;if(void 0!==e.expires_in){const n=new Date;n.setSeconds(n.getSeconds()+e.expires_in),t=n.getTime()}return{expiresIn:{__proto__:null,value(){if(t){const e=Date.now();return t>e?Math.floor((t-e)/1e3):0}}},claims:{__proto__:null,value(){try{return Nn(this)}catch(e){return}}}}}(e))}async function bo(e,t,n){var r;let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=null===(r=e.headers.get("retry-after"))||void 0===r?void 0:r.trim();if(void 0===i)return;let a;if(/^\d+$/.test(i))a=parseInt(i,10);else{const e=new Date(i);if(Number.isFinite(e.getTime())){const t=new Date,n=e.getTime()-t.getTime();n>0&&(a=Math.ceil(n/1e3))}}if(o&&!Number.isFinite(a))throw new Xt("invalid Retry-After header value",{cause:e});a>t&&await vo(a-t,n)}function vo(e,t){return new Promise((n,r)=>{const o=e=>{try{t.throwIfAborted()}catch(e){return void r(e)}if(e<=0)return void n();const i=Math.min(e,5);setTimeout(()=>o(e-i),1e3*i)};o(e)})}async function Eo(e,t){Io(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=ro(e);return async function(e,t,n,r,o){an(e),sn(t);const i=pn(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[Lt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Vt(null==o?void 0:o.headers);return s.set("accept","application/json"),On(e,t,n,i,a,s,o)}(n,r,o,t,{[Ut]:i,[Lt]:!a,headers:new Headers(to),signal:Co(s)}).then(e=>async function(e,t,n){if(an(e),sn(t),!Rt(n,Response))throw Nt('"response" must be an instance of Response',Ct);await kn(n,200,"Backchannel Authentication Endpoint"),nr(n);const r=await ur(n);Qt(r.auth_req_id,'"response" body "auth_req_id" property',Jn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return qt(o,!0,'"response" body "expires_in" property',Jn,{body:r}),r.expires_in=o,void 0!==r.interval&&qt(r.interval,!1,'"response" body "interval" property',Jn,{body:r}),r}(n,r,e)).catch(fo)}async function So(e,t,n,r){var o,i;Io(e),n=new URLSearchParams(n);let a=null!==(o=t.interval)&&void 0!==o?o:5;const s=null!==(i=null==r?void 0:r.signal)&&void 0!==i?i:AbortSignal.timeout(1e3*t.expires_in);try{await vo(a,s)}catch(e){fo(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=ro(e),g=(o,i)=>So(e,St(St({},t),{},{interval:o}),n,St(St({},r),{},{signal:s,flag:i})),y=await async function(e,t,n,r,o){an(e),sn(t),Qt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Rn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[Ut]:d,[Lt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(to),signal:s.aborted?s:Co(f)}).catch(fo);var w;if(503===y.status&&y.headers.has("retry-after"))return await bo(y,a,s,!0),await(null===(w=y.body)||void 0===w?void 0:w.cancel()),g(a);const b=async function(e,t,n,r){return Ln(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(c,u,y,{[Mt]:m});let v;try{v=await b}catch(e){if(No(e,r))return g(a,Lo);if(e instanceof fn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await bo(e.response,a,s),g(a)}fo(e)}return v.id_token&&await(null==p?void 0:p(y)),wo(v),v}function Ao(e){ro(e).tlsOnly=!1}async function ko(e,t,n,r,o){if(Io(e),!((null==o?void 0:o.flag)===Lo||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw lo('"currentUrl" must be an instance of URL, or Request',uo);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:g,implicit:y}=ro(e);if((null==o?void 0:o.flag)===Lo)i=o.authResponse,a=o.redirectUri;else{if(!(t instanceof URL)){const e=t;switch(t=new URL(t.url),e.method){case"GET":break;case"POST":const n=new URLSearchParams(await async function(e){if("POST"!==e.method)throw Nt("form_post responses are expected to use the POST method",It,{cause:e});if("application/x-www-form-urlencoded"!==_n(e))throw Nt("form_post responses are expected to use the application/x-www-form-urlencoded content-type",It,{cause:e});return async function(e){if(e.bodyUsed)throw Nt("form_post Request instances must contain a readable body",It,{cause:e});return e.text()}(e)}(e));if(p)t.hash=n.toString();else for(const[e,r]of n.entries())t.searchParams.append(e,r);break;default:throw lo("unexpected Request HTTP method",co)}}switch(a=function(e){return(e=new URL(e)).search="",e.hash="",e.href}(t),!0){case!!h:i=await h(t,null==n?void 0:n.expectedState);break;case!!p:i=await p(t,null==n?void 0:n.expectedNonce,null==n?void 0:n.expectedState,null==n?void 0:n.maxAge);break;case!!y:throw new TypeError("authorizationCodeGrant() cannot be used by response_type=id_token clients");default:try{i=function(e,t,n,r){if(an(e),sn(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw Nt('"parameters" must be an instance of URLSearchParams, or URL',Ct);if(ar(n,"response"))throw Jt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Jn,{parameters:n});const o=ar(n,"iss"),i=ar(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Jt('response parameter "iss" (issuer) missing',Jn,{parameters:n});if(o&&o!==e.issuer)throw Jt('unexpected "iss" (issuer) response parameter value',Jn,{expected:e.issuer,parameters:n});switch(r){case void 0:case cr:if(void 0!==i)throw Jt('unexpected "state" response parameter encountered',Jn,{expected:void 0,parameters:n});break;case sr:break;default:if(Qt(r,'"expectedState" argument'),i!==r)throw Jt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Jn,{expected:r,parameters:n})}if(ar(n,"error"))throw new mn("authorization response from the server is an error",{cause:n});const a=ar(n,"id_token"),s=ar(n,"token");if(void 0!==a||void 0!==s)throw new Ft("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),Un.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){fo(e)}}}const w=await async function(e,t,n,r,o,i,a){if(an(e),sn(t),!Un.has(r))throw Nt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',It);Qt(o,'"redirectUri"');const s=ar(r,"code");if(!s)throw Jt('no authorization code in "callbackParameters"',Jn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==Dn&&(Qt(i,'"codeVerifier"'),c.set("code_verifier",i)),Rn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||Dn,{additionalParameters:r,[Ut]:l,[Lt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(to),signal:Co(m)}).catch(fo);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const b=async function(e,t,n,r){return"string"==typeof(null==r?void 0:r.expectedNonce)||"number"==typeof(null==r?void 0:r.maxAge)||null!=r&&r.requireIdToken?async function(e,t,n,r,o,i,a){const s=[];switch(r){case void 0:r=jn;break;case jn:break;default:Qt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Hn;break;case Hn:break;default:qt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Ln(e,t,n,s,i,a);Qt(c.id_token,'"response" body "id_token" property',Jn,{body:c});const u=Nn(c);if(o!==Hn){const e=on()+nn(t),n=rn(t);if(u.auth_time+o{let n;return"urn:ietf:params:oauth:grant-type:token-exchange"===t&&(n={n_a:()=>{}}),async function(e,t,n,r){return Ln(e,t,n,void 0,null==r?void 0:r[Mt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[Mt]:l,recognizedTokenTypes:n})}).catch(fo);return wo(d),d}async function Po(e,t,n){if(!Br(e))throw new Or("Flattened JWS must be an object");if(void 0===e.protected&&void 0===e.header)throw new Or('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==e.protected&&"string"!=typeof e.protected)throw new Or("JWS Protected Header incorrect type");if(void 0===e.payload)throw new Or("JWS Payload missing");if("string"!=typeof e.signature)throw new Or("JWS Signature missing or incorrect type");if(void 0!==e.header&&!Br(e.header))throw new Or("JWS Unprotected Header incorrect type");let r={};if(e.protected)try{const t=gr(e.protected);r=JSON.parse(pr.decode(t))}catch(e){throw new Or("JWS Protected Header is invalid")}if(!function(){for(var e=arguments.length,t=new Array(e),n=0;n"string"!=typeof e||0===e.length))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;i=void 0!==n?new Map([...Object.entries(n),...t.entries()]):t;for(const t of r.crit){if(!i.has(t))throw new _r('Extension Header Parameter "'.concat(t,'" is not recognized'));if(void 0===o[t])throw new e('Extension Header Parameter "'.concat(t,'" is missing'));if(i.get(t)&&void 0===r[t])throw new e('Extension Header Parameter "'.concat(t,'" MUST be integrity protected'))}return new Set(r.crit)}(Or,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o);let a=!0;if(i.has("b64")&&(a=r.b64,"boolean"!=typeof a))throw new Or('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Or('JWS "alg" (Algorithm) Header Parameter missing or invalid');const c=n&&function(e,t){if(void 0!==t&&(!Array.isArray(t)||t.some(e=>"string"!=typeof e)))throw new TypeError('"'.concat("algorithms",'" option must be an array of strings'));if(t)return new Set(t)}(0,n.algorithms);if(c&&!c.has(s))throw new Tr('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Or("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Or("JWS Payload must be a string or an Uint8Array instance");let u=!1;"function"==typeof t&&(t=await t(r,e),u=!0),function(e,t,n){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":((e,t,n)=>{if(!(t instanceof Uint8Array)){if(jr(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Qr(e,t,n))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!Dr(t))throw new TypeError(Er(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(qr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(jr(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if((e=>"oct"!==e.kty&&void 0===e.d&&void 0===e.priv)(t)&&Qr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Dr(t))throw new TypeError(Er(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(qr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(qr(t),' instances for asymmetric algorithm encryption must be of type "public"'))}})(e,t,n)}}(s,t,"verify");const l=function(){for(var e=arguments.length,t=new Array(e),n=0;n{let{length:n}=t;return e+n},0),o=new Uint8Array(r);let i=0;for(const e of t)o.set(e,i),i+=e.length;return o}(void 0!==e.protected?fr(e.protected):new Uint8Array,fr("."),"string"==typeof e.payload?a?fr(e.payload):hr.encode(e.payload):e.payload),d=Mr(e.signature,"signature",Or),h=await async function(e,t){if(e instanceof Uint8Array)return e;if(Pr(e))return e;if(Ur(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Fr||(Fr=new WeakMap);let n=Fr.get(e);if(null!=n&&n[t])return n[t];const r="public"===e.type,o=!!r;let i;if("x25519"===e.asymmetricKeyType){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(Kr)}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(Kr);i=e.toCryptoKey(e.asymmetricKeyType,o,[r?"verify":"sign"])}if("rsa"===e.asymmetricKeyType){let n;switch(t){case"RSA-OAEP":n="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":n="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":n="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":n="SHA-512";break;default:throw new TypeError(Kr)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:n},o,r?["encrypt"]:["decrypt"]);i=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n},o,[r?"verify":"sign"])}if("ec"===e.asymmetricKeyType){var a;const n=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(null===(a=e.asymmetricKeyDetails)||void 0===a?void 0:a.namedCurve);if(!n)throw new TypeError(Kr);const s={ES256:"P-256",ES384:"P-384",ES512:"P-521"};s[t]&&n===s[t]&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(i=e.toCryptoKey({name:"ECDH",namedCurve:n},o,r?[]:["deriveBits"]))}if(!i)throw new TypeError(Kr);return n?n[t]=i:Fr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Xr(e,n,t)}if(jr(e))return e.k?gr(e.k):Xr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Hr(e,t,"verify");!function(e,t){if(e.startsWith("RS")||e.startsWith("PS")){const{modulusLength:n}=t.algorithm;if("number"!=typeof n||n<2048)throw new TypeError("".concat(e," requires key modulusLength to be 2048 bits or larger"))}}(e,o);const i=function(e,t){const n="SHA-".concat(e.slice(-3));switch(e){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:t.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":return{name:e};default:throw new _r("alg ".concat(e," is not supported either by JOSE or your javascript runtime"))}}(e,o.algorithm);try{return await crypto.subtle.verify(i,o,n,r)}catch(e){return!1}}(s,h,d,l))throw new xr;let p;p=a?Mr(e.payload,"payload",Or):"string"==typeof e.payload?hr.encode(e.payload):e.payload;const f={payload:p};return void 0!==e.protected&&(f.protectedHeader=r),void 0!==e.header&&(f.unprotectedHeader=e.header),u?St(St({},f),{},{key:h}):f}const Uo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Do(e){const t=Uo.exec(e);if(!t||t[4]&&t[1])throw new TypeError("Invalid time period format");const n=parseFloat(t[2]);let r;switch(t[3].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":r=Math.round(n);break;case"minute":case"minutes":case"min":case"mins":case"m":r=Math.round(60*n);break;case"hour":case"hours":case"hr":case"hrs":case"h":r=Math.round(3600*n);break;case"day":case"days":case"d":r=Math.round(86400*n);break;case"week":case"weeks":case"w":r=Math.round(604800*n);break;default:r=Math.round(31557600*n)}return"-"===t[1]||"ago"===t[4]?-r:r}const Mo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());function Bo(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(pr.decode(t))}catch(e){}if(!Br(n))throw new Rr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||Mo(e.typ)!==Mo(o)))throw new Ar('unexpected "typ" JWT header value',n,"typ","check_failed");const{requiredClaims:i=[],issuer:a,subject:s,audience:c,maxTokenAge:u}=r,l=[...i];void 0!==u&&l.push("iat"),void 0!==c&&l.push("aud"),void 0!==s&&l.push("sub"),void 0!==a&&l.push("iss");for(const e of new Set(l.reverse()))if(!(e in n))throw new Ar('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Ar('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Ar('unexpected "sub" claim value',n,"sub","check_failed");if(c&&(h="string"==typeof c?[c]:c,!("string"==typeof(d=n.aud)?h.includes(d):Array.isArray(d)&&h.some(Set.prototype.has.bind(new Set(d))))))throw new Ar('unexpected "aud" claim value',n,"aud","check_failed");var d,h;let p;switch(typeof r.clockTolerance){case"string":p=Do(r.clockTolerance);break;case"number":p=r.clockTolerance;break;case"undefined":p=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=r,m=(g=f||new Date,Math.floor(g.getTime()/1e3));var g;if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Ar('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Ar('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>m+p)throw new Ar('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Ar('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=m-p)throw new kr('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=m-n.iat;if(e-p>("number"==typeof u?u:Do(u)))throw new kr('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-p)throw new Ar('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}function jo(e){return Br(e)}var Ho,Go,Wo=new WeakMap,Ko=new WeakMap;class Fo{constructor(e){if(wt(this,Wo,void 0),wt(this,Ko,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(jo)}(e))throw new Ir("JSON Web Key Set malformed");bt(Wo,this,structuredClone(e))}jwks(){return yt(Wo,this)}async getKey(e,t){const{alg:n,kid:r}=St(St({},e),null==t?void 0:t.header),o=function(e){switch("string"==typeof e&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";case"ML":return"AKP";default:throw new _r('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=yt(Wo,this).keys.filter(e=>{let t=o===e.kty;if(t&&"string"==typeof r&&(t=r===e.kid),!t||"string"!=typeof e.alg&&"AKP"!==o||(t=n===e.alg),t&&"string"==typeof e.use&&(t="sig"===e.use),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes("verify")),t)switch(n){case"ES256":t="P-256"===e.crv;break;case"ES384":t="P-384"===e.crv;break;case"ES512":t="P-521"===e.crv;break;case"Ed25519":case"EdDSA":t="Ed25519"===e.crv}return t}),{0:a,length:s}=i;if(0===s)throw new Cr;if(1!==s){const e=new Nr,t=yt(Ko,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new kt(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield mt(Xo(t,e,n))}catch(e){}}),e}return Xo(yt(Ko,this),a,n)}}async function Xo(e,t,n){const r=e.get(t)||e.set(t,{}).get(t);if(void 0===r[n]){const e=await async function(e,t){if(!Br(e))throw new TypeError("JWK must be an object");let n;switch(null!=t||(t=e.alg),null!=n||(n=e.ext),e.kty){case"oct":if("string"!=typeof e.k||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return gr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new _r('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Wr(St(St({},e),{},{alg:t,ext:n}));case"AKP":if("string"!=typeof e.alg||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(void 0!==t&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Wr(St(St({},e),{},{ext:n}));case"EC":case"OKP":return Wr(St(St({},e),{},{alg:t,ext:n}));default:throw new _r('Unsupported "kty" (Key Type) Parameter value')}}(St(St({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Ir("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Jo(e){const t=new Fo(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>structuredClone(t.jwks()),enumerable:!1,configurable:!1,writable:!1}}),n}let zo;if("undefined"==typeof navigator||null===(Ho=navigator.userAgent)||void 0===Ho||null===(Go=Ho.startsWith)||void 0===Go||!Go.call(Ho,"Mozilla/5.0 ")){const e="v6.2.2";zo="".concat("jose","/").concat(e)}const Vo=Symbol(),Yo=Symbol();var Zo=new WeakMap,qo=new WeakMap,Qo=new WeakMap,$o=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,ri=new WeakMap,oi=new WeakMap,ii=new WeakMap;class ai{constructor(e,t){if(wt(this,Zo,void 0),wt(this,qo,void 0),wt(this,Qo,void 0),wt(this,$o,void 0),wt(this,ei,void 0),wt(this,ti,void 0),wt(this,ni,void 0),wt(this,ri,void 0),wt(this,oi,void 0),wt(this,ii,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;bt(Zo,this,new URL(e.href)),bt(qo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),bt(Qo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),bt($o,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),bt(ni,this,new Headers(null==t?void 0:t.headers)),zo&&!yt(ni,this).has("User-Agent")&&yt(ni,this).set("User-Agent",zo),yt(ni,this).has("accept")||(yt(ni,this).set("accept","application/json"),yt(ni,this).append("accept","application/jwk-set+json")),bt(ri,this,null==t?void 0:t[Vo]),void 0!==(null==t?void 0:t[Yo])&&(bt(ii,this,null==t?void 0:t[Yo]),n=null==t?void 0:t[Yo],r=yt($o,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Br(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Br)&&(bt(ei,this,yt(ii,this).uat),bt(oi,this,Jo(yt(ii,this).jwks))))}pendingFetch(){return!!yt(ti,this)}coolingDown(){return"number"==typeof yt(ei,this)&&Date.now()3&&void 0!==arguments[3]?arguments[3]:fetch;const o=await r(e,{method:"GET",signal:n,redirect:"manual",headers:t}).catch(e=>{if("TimeoutError"===e.name)throw new Lr;throw e});if(200!==o.status)throw new Sr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Sr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(yt(Zo,this).href,yt(ni,this),AbortSignal.timeout(yt(qo,this)),yt(ri,this)).then(e=>{bt(oi,this,Jo(e)),yt(ii,this)&&(yt(ii,this).uat=Date.now(),yt(ii,this).jwks=e),bt(ei,this,Date.now()),bt(ti,this,void 0)}).catch(e=>{throw bt(ti,this,void 0),e})),await yt(ti,this)}}const si=["mfaToken"],ci=["mfaToken"];var ui,li,di,hi,pi,fi,mi,gi,yi,wi,bi,vi,Ei,Si,Ai,ki,Ti=class extends Error{constructor(e,t){super(t),vt(this,"code",void 0),this.name="NotSupportedError",this.code=e}},_i=class extends Error{constructor(e,t,n){super(t),vt(this,"cause",void 0),vt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Oi=class extends _i{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Ri=class extends _i{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Ii=class extends _i{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Ci=class extends _i{constructor(e,t){super("token_by_password_error",e,t),this.name="TokenByPasswordError"}},Ni=class extends _i{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Li=class extends _i{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},xi=class extends Error{constructor(e){super(e),vt(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Pi=class extends _i{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),vt(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Ui=class extends _i{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Di=class extends _i{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Mi=class extends _i{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Bi=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),vt(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function ji(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>St(St({},e),{},{[t[0]]:t[1]}),{})}var Hi=class extends Error{constructor(e,t,n){super(t),vt(this,"cause",void 0),vt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Gi=class extends Hi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Wi=class extends Hi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Ki=class extends Hi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Fi=class extends Hi{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Xi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Ji=(ui=new WeakMap,li=new WeakMap,di=new WeakMap,class{constructor(e){var t;wt(this,ui,void 0),wt(this,li,void 0),wt(this,di,void 0),bt(ui,this,"https://".concat(e.domain)),bt(li,this,e.clientId),bt(di,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(yt(ui,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await yt(di,this).call(this,t,{method:"GET",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!r.ok){const e=await r.json();throw new Gi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Xi)}async enrollAuthenticator(e){const t="".concat(yt(ui,this),"/mfa/associate"),{mfaToken:n}=e,r=At(e,si),o={authenticator_types:r.authenticatorTypes};"oobChannels"in r&&(o.oob_channels=r.oobChannels),"phoneNumber"in r&&r.phoneNumber&&(o.phone_number=r.phoneNumber),"email"in r&&r.email&&(o.email=r.email);const i=await yt(di,this).call(this,t,{method:"POST",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Wi(e.error_description||"Failed to enroll authenticator",e)}return function(e){if("otp"===e.authenticator_type)return{authenticatorType:"otp",secret:e.secret,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes,id:e.id};if("oob"===e.authenticator_type)return{authenticatorType:"oob",oobChannel:e.oob_channel,oobCode:e.oob_code,bindingMethod:e.binding_method,id:e.id,barcodeUri:e.barcode_uri,recoveryCodes:e.recovery_codes};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(yt(ui,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await yt(di,this).call(this,r,{method:"DELETE",headers:{Authorization:"Bearer ".concat(n),"Content-Type":"application/json"}});if(!o.ok){const e=await o.json();throw new Ki(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(yt(ui,this),"/mfa/challenge"),{mfaToken:n}=e,r=At(e,ci),o={mfa_token:n,client_id:yt(li,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await yt(di,this).call(this,t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const e=await i.json();throw new Fi(e.error_description||"Failed to challenge authenticator",e)}return function(e){const t={challengeType:e.challenge_type};return void 0!==e.oob_code&&(t.oobCode=e.oob_code),void 0!==e.binding_method&&(t.bindingMethod=e.binding_method),t}(await i.json())}}),zi=class e{constructor(e,t,n,r,o,i,a){vt(this,"accessToken",void 0),vt(this,"idToken",void 0),vt(this,"refreshToken",void 0),vt(this,"expiresAt",void 0),vt(this,"scope",void 0),vt(this,"claims",void 0),vt(this,"authorizationDetails",void 0),vt(this,"tokenType",void 0),vt(this,"issuedTokenType",void 0),this.accessToken=e,this.idToken=n,this.refreshToken=r,this.expiresAt=t,this.scope=o,this.claims=i,this.authorizationDetails=a}static fromTokenEndpointResponse(t){const n=t.id_token?t.claims():void 0,r=new e(t.access_token,Math.floor(Date.now()/1e3)+Number(t.expires_in),t.id_token,t.refresh_token,t.scope,n,t.authorization_details);return r.tokenType=t.token_type,r.issuedTokenType=t.issued_token_type,r}},Vi=(hi=new WeakMap,pi=new WeakMap,fi=new WeakMap,class{constructor(e,t){wt(this,hi,new Map),wt(this,pi,void 0),wt(this,fi,void 0),bt(fi,this,Math.max(1,Math.floor(e))),bt(pi,this,Math.max(0,Math.floor(t)))}get(e){const t=yt(hi,this).get(e);if(t){if(!(Date.now()>=t.expiresAt))return yt(hi,this).delete(e),yt(hi,this).set(e,t),t.value;yt(hi,this).delete(e)}}set(e,t){for(yt(hi,this).has(e)&&yt(hi,this).delete(e),yt(hi,this).set(e,{value:t,expiresAt:Date.now()+yt(pi,this)});yt(hi,this).size>yt(fi,this);){const e=yt(hi,this).keys().next().value;if(void 0===e)break;yt(hi,this).delete(e)}}}),Yi=new Map;function Zi(e){return{ttlMs:1e3*("number"==typeof(null==e?void 0:e.ttl)?e.ttl:600),maxEntries:"number"==typeof(null==e?void 0:e.maxEntries)&&e.maxEntries>0?e.maxEntries:100}}var qi=class{static createDiscoveryCache(e){const t=(n=e.maxEntries,r=e.ttlMs,"".concat(n,":").concat(r));var n,r;let o=(i=t,Yi.get(i));var i;return o||(o=new Vi(e.maxEntries,e.ttlMs),Yi.set(t,o)),o}static createJwksCache(){return{}}},Qi="openid profile email offline_access",$i=Object.freeze(new Set(["grant_type","client_id","client_secret","client_assertion","client_assertion_type","subject_token","subject_token_type","requested_token_type","actor_token","actor_token_type","audience","aud","resource","resources","resource_indicator","scope","connection","login_hint","organization","assertion"]));function ea(e){if(null==e)throw new Li("subject_token is required");if("string"!=typeof e)throw new Li("subject_token must be a string");if(0===e.trim().length)throw new Li("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Li("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Li("subject_token must not include the 'Bearer ' prefix")}function ta(e,t){if(t)for(const[n,r]of Object.entries(t))if(!$i.has(n))if(Array.isArray(r)){if(r.length>20)throw new Li("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var na="urn:ietf:params:oauth:token-type:access_token",ra=(mi=new WeakMap,gi=new WeakMap,yi=new WeakMap,wi=new WeakMap,bi=new WeakMap,vi=new WeakMap,Ei=new WeakMap,Si=new WeakMap,Ai=new WeakMap,ki=new WeakSet,class{constructor(e){var t,n,r,o;if(function(e,t){gt(e,t),t.add(e)}(this,ki),wt(this,mi,void 0),wt(this,gi,void 0),wt(this,yi,void 0),wt(this,wi,void 0),wt(this,bi,void 0),wt(this,vi,void 0),wt(this,Ei,void 0),wt(this,Si,void 0),wt(this,Ai,void 0),vt(this,"mfa",void 0),bt(wi,this,e),e.useMtls&&!e.customFetch)throw new Ti("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");bt(bi,this,function(e,t){if(!1===t.enabled)return e;const n={name:t.name,version:t.version},r=btoa(JSON.stringify(n));return async(t,n)=>{const o=t instanceof Request?new Headers(t.headers):new Headers;return null!=n&&n.headers&&new Headers(n.headers).forEach((e,t)=>{o.set(t,e)}),o.set("Auth0-Client",r),e(t,St(St({},n),{},{headers:o}))}}(null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)},!1===(null==(n=e.telemetry)?void 0:n.enabled)?n:{enabled:!0,name:null!==(r=null==n?void 0:n.name)&&void 0!==r?r:"@auth0/auth0-auth-js",version:null!==(o=null==n?void 0:n.version)&&void 0!==o?o:"1.6.0"}));const i=Zi(e.discoveryCache);bt(Ei,this,qi.createDiscoveryCache(i)),bt(Si,this,new Map),bt(Ai,this,qi.createJwksCache()),this.mfa=new Ji({domain:yt(wi,this).domain,clientId:yt(wi,this).clientId,customFetch:yt(bi,this)})}async getServerMetadata(){const{serverMetadata:e}=await ft(ki,this,aa).call(this);return e}async buildAuthorizationUrl(e){const{serverMetadata:t}=await ft(ki,this,aa).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Ti("par_not_supported_error","The Auth0 tenant does not have pushed authorization requests enabled. Learn how to enable it here: https://auth0.com/docs/get-started/applications/configure-par");try{return await ft(ki,this,la).call(this,e)}catch(e){throw new Ui(e)}}async buildLinkUserUrl(e){try{const t=await ft(ki,this,la).call(this,{authorizationParams:St(St({},e.authorizationParams),{},{requested_connection:e.connection,requested_connection_scope:e.connectionScope,scope:"openid link_account offline_access",id_token_hint:e.idToken})});return{linkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Di(e)}}async buildUnlinkUserUrl(e){try{const t=await ft(ki,this,la).call(this,{authorizationParams:St(St({},e.authorizationParams),{},{requested_connection:e.connection,scope:"openid unlink_account",id_token_hint:e.idToken})});return{unlinkUserUrl:t.authorizationUrl,codeVerifier:t.codeVerifier}}catch(e){throw new Mi(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ft(ki,this,aa).call(this),r=ji(St(St({},yt(wi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(St(St({scope:Qi},r),{},{client_id:yt(wi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Eo(t,o),n=await So(t,e);return zi.fromTokenEndpointResponse(n)}catch(e){throw new Pi(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ft(ki,this,aa).call(this),r=ji(St(St({},yt(wi,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(St(St({scope:Qi},r),{},{client_id:yt(wi,this).clientId,binding_message:e.bindingMessage,login_hint:JSON.stringify({format:"iss_sub",iss:n.issuer,sub:e.loginHint.sub})}));e.requestedExpiry&&o.append("requested_expiry",e.requestedExpiry.toString()),e.authorizationDetails&&o.append("authorization_details",JSON.stringify(e.authorizationDetails));try{const e=await Eo(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new Pi(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await ft(ki,this,aa).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await xo(n,"urn:openid:params:grant-type:ciba",r);return zi.fromTokenEndpointResponse(e)}catch(e){throw new Pi(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new Ni("Either a refresh or access token should be specified, but not both.");const n=null!==(t=e.accessToken)&&void 0!==t?t:e.refreshToken;if(!n)throw new Ni("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?na:"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof Li)throw new Ni(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?ft(ki,this,sa).call(this,e):ft(ki,this,ca).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await ft(ki,this,aa).call(this);try{const r=await ko(n,e,{pkceCodeVerifier:t.codeVerifier});return zi.fromTokenEndpointResponse(r)}catch(e){throw new Oi("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await ft(ki,this,aa).call(this),n=new URLSearchParams;e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope);try{const r=await To(t,e.refreshToken,n);return zi.fromTokenEndpointResponse(r)}catch(e){throw new Ii("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByPassword(e){const{configuration:t}=await ft(ki,this,aa).call(this),n=new URLSearchParams({username:e.username,password:e.password});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.realm&&n.append("realm",e.realm);let r=t;if(e.auth0ForwardedFor){const n=await ft(ki,this,ua).call(this);r=new yo(t.serverMetadata(),yt(wi,this).clientId,yt(wi,this).clientSecret,n),r[so]=(t,n)=>yt(bi,this).call(this,t,St(St({},n),{},{headers:St(St({},n.headers),{},{"auth0-forwarded-for":e.auth0ForwardedFor})}))}try{const e=await xo(r,"password",n);return zi.fromTokenEndpointResponse(e)}catch(e){throw new Ci("There was an error while trying to request a token.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await ft(ki,this,aa).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await _o(t,n);return zi.fromTokenEndpointResponse(r)}catch(e){throw new Ri("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await ft(ki,this,aa).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(yt(wi,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",yt(wi,this).clientId),t}return function(e,t){Io(e);const{as:n,c:r,tlsOnly:o}=ro(e),i=pn(n,"end_session_endpoint",!1,o);(t=new URLSearchParams(t)).has("client_id")||t.set("client_id",r.client_id);for(const[e,n]of t.entries())i.searchParams.append(e,n);return i}(t,{post_logout_redirect_uri:e.returnTo})}async verifyLogoutToken(e){const{serverMetadata:t}=await ft(ki,this,aa).call(this),n=Zi(yt(wi,this).discoveryCache),r=t.jwks_uri;yt(vi,this)||bt(vi,this,function(e,t){const n=new ai(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>n.pendingFetch(),enumerable:!0,configurable:!1},jwks:{value:()=>n.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}(new URL(r),{cacheMaxAge:n.ttlMs,[Vo]:yt(bi,this),[Yo]:yt(Ai,this)}));const{payload:o}=await async function(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=pr.decode(e)),"string"!=typeof e)throw new Or("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new Or("Invalid Compact JWS");const s=await Po({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?St(St({},c),{},{key:s.key}):c}(e,t,n);if(null!==(r=o.protectedHeader.crit)&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Rr("JWTs MUST NOT use unencoded payload");const i={payload:Bo(o.protectedHeader,o.payload,n),protectedHeader:o.protectedHeader};return"function"==typeof t?St(St({},i),{},{key:o.key}):i}(e.logoutToken,yt(vi,this),{issuer:t.issuer,audience:yt(wi,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in o)&&!("sub"in o))throw new xi('either "sid" or "sub" (or both) claims must be present');if("sid"in o&&"string"!=typeof o.sid)throw new xi('"sid" claim must be a string');if("sub"in o&&"string"!=typeof o.sub)throw new xi('"sub" claim must be a string');if("nonce"in o)throw new xi('"nonce" claim is prohibited');if(!("events"in o))throw new xi('"events" claim is missing');if("object"!=typeof o.events||null===o.events)throw new xi('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in o.events))throw new xi('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof o.events["http://schemas.openid.net/event/backchannel-logout"])throw new xi('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:o.sid,sub:o.sub}}});function oa(){const e=yt(wi,this).domain.toLowerCase();return"".concat(e,"|mtls:").concat(yt(wi,this).useMtls?"1":"0")}async function ia(e){const t=await ft(ki,this,ua).call(this),n=new yo(e,yt(wi,this).clientId,yt(wi,this).clientSecret,t);return n[so]=yt(bi,this),n}async function aa(){if(yt(mi,this)&&yt(gi,this))return{configuration:yt(mi,this),serverMetadata:yt(gi,this)};const e=ft(ki,this,oa).call(this),t=yt(Ei,this).get(e);if(t)return bt(gi,this,t.serverMetadata),bt(mi,this,await ft(ki,this,ia).call(this,t.serverMetadata)),{configuration:yt(mi,this),serverMetadata:yt(gi,this)};const n=yt(Si,this).get(e);if(n){const e=await n;return bt(gi,this,e.serverMetadata),bt(mi,this,await ft(ki,this,ia).call(this,e.serverMetadata)),{configuration:yt(mi,this),serverMetadata:yt(gi,this)}}const r=(async()=>{const t=await ft(ki,this,ua).call(this),n=await mo(new URL("https://".concat(yt(wi,this).domain)),yt(wi,this).clientId,{use_mtls_endpoint_aliases:yt(wi,this).useMtls},t,{[so]:yt(bi,this)}),r=n.serverMetadata();return yt(Ei,this).set(e,{serverMetadata:r}),{configuration:n,serverMetadata:r}})(),o=r.then(e=>{let{serverMetadata:t}=e;return{serverMetadata:t}});o.catch(()=>{}),yt(Si,this).set(e,o);try{const{configuration:e,serverMetadata:t}=await r;bt(mi,this,e),bt(gi,this,t),yt(mi,this)[so]=yt(bi,this)}finally{yt(Si,this).delete(e)}return{configuration:yt(mi,this),serverMetadata:yt(gi,this)}}async function sa(e){var t,n;const{configuration:r}=await ft(ki,this,aa).call(this);if("audience"in e||"resource"in e)throw new Li("audience and resource parameters are not supported for Token Vault exchanges");ea(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:na,requested_token_type:null!==(n=e.requestedTokenType)&&void 0!==n?n:"http://auth0.com/oauth/token-type/federated-connection-access-token"});e.loginHint&&o.append("login_hint",e.loginHint),e.scope&&o.append("scope",e.scope),ta(o,e.extra);try{const e=await xo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return zi.fromTokenEndpointResponse(e)}catch(t){throw new Li("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function ca(e){const{configuration:t}=await ft(ki,this,aa).call(this);ea(e.subjectToken);const n=new URLSearchParams({subject_token_type:e.subjectTokenType,subject_token:e.subjectToken});e.audience&&n.append("audience",e.audience),e.scope&&n.append("scope",e.scope),e.requestedTokenType&&n.append("requested_token_type",e.requestedTokenType),e.organization&&n.append("organization",e.organization),ta(n,e.extra);try{const e=await xo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return zi.fromTokenEndpointResponse(e)}catch(t){throw new Li("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ua(){return yt(yi,this)||bt(yi,this,(async()=>{if(!yt(wi,this).clientSecret&&!yt(wi,this).clientAssertionSigningKey&&!yt(wi,this).useMtls)throw new Bi;if(yt(wi,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=yt(wi,this).clientAssertionSigningKey;return!e||e instanceof CryptoKey||(e=await async function(e,t){if("string"!=typeof e||0!==e.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PKCS#8 formatted string');return Zr(e,t,void 0)}(e,yt(wi,this).clientAssertionSigningAlg||"RS256")),e?function(e){return un(e,void 0)}(e):ao(yt(wi,this).clientSecret)})().catch(e=>{throw bt(yi,this,void 0),e})),yt(yi,this)}async function la(e){const{configuration:t}=await ft(ki,this,aa).call(this),n=en(),r=await function(e){return async function(e){return Qt(e,"codeVerifier"),Kt(await crypto.subtle.digest("SHA-256",Ht(e)))}(e)}(n),o=ji(St(St({},yt(wi,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(St(St({scope:Qi},o),{},{client_id:yt(wi,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Ro(t,i):await Oo(t,i),codeVerifier:n}}class da extends A{constructor(e,t){super(e,t),Object.setPrototypeOf(this,da.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new da(t,n)}}class ha extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ha.prototype)}}class pa extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,pa.prototype)}}class fa extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,fa.prototype)}}class ma extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ma.prototype)}}class ga extends da{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ga.prototype)}}class ya{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6e5;this.contexts=new Map,this.ttlMs=e}set(e,t){this.cleanup(),this.contexts.set(e,Object.assign(Object.assign({},t),{createdAt:Date.now()}))}get(e){const t=this.contexts.get(e);if(t){if(!(Date.now()-t.createdAt>this.ttlMs))return t;this.contexts.delete(e)}}remove(e){this.contexts.delete(e)}cleanup(){const e=Date.now();for(const[t,n]of this.contexts)e-n.createdAt>this.ttlMs&&this.contexts.delete(t)}get size(){return this.contexts.size}}class wa{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new ya}setMFAAuthDetails(e,t,n,r){this.contextManager.set(e,{scope:t,audience:n,mfaRequirements:r})}async getAuthenticators(e){var t,n;const r=this.contextManager.get(e);if(!(null===(t=null==r?void 0:r.mfaRequirements)||void 0===t?void 0:t.challenge)||0===r.mfaRequirements.challenge.length)throw new ha("invalid_request","challengeType is required and must contain at least one challenge type, please check mfa_required error payload");const o=r.mfaRequirements.challenge.map(e=>e.type);try{return(await this.authJsMfaClient.listAuthenticators({mfaToken:e})).filter(e=>!!e.type&&o.includes(e.type))}catch(e){if(e instanceof Gi)throw new ha(null===(n=e.cause)||void 0===n?void 0:n.error,e.message);throw e}}async enroll(e){var t;const n=function(e){const t=ht[e.factorType];return Object.assign(Object.assign(Object.assign({mfaToken:e.mfaToken,authenticatorTypes:t.authenticatorTypes},t.oobChannels&&{oobChannels:t.oobChannels}),"phoneNumber"in e&&{phoneNumber:e.phoneNumber}),"email"in e&&{email:e.email})}(e);try{return await this.authJsMfaClient.enrollAuthenticator(n)}catch(e){if(e instanceof Wi)throw new pa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async challenge(e){var t;try{const t={challengeType:e.challengeType,mfaToken:e.mfaToken};return e.authenticatorId&&(t.authenticatorId=e.authenticatorId),await this.authJsMfaClient.challengeAuthenticator(t)}catch(e){if(e instanceof Fi)throw new fa(null===(t=e.cause)||void 0===t?void 0:t.error,e.message);throw e}}async getEnrollmentFactors(e){const t=this.contextManager.get(e);if(!t||!t.mfaRequirements)throw new ga("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");return t.mfaRequirements.enroll&&0!==t.mfaRequirements.enroll.length?t.mfaRequirements.enroll:[]}async verify(e){const t=this.contextManager.get(e.mfaToken);if(!t)throw new ma("mfa_context_not_found","MFA context not found for this MFA token. Please retry the original request to get a new MFA token.");const n=function(e){return"otp"in e&&e.otp?"http://auth0.com/oauth/grant-type/mfa-otp":"oobCode"in e&&e.oobCode?"http://auth0.com/oauth/grant-type/mfa-oob":"recoveryCode"in e&&e.recoveryCode?"http://auth0.com/oauth/grant-type/mfa-recovery-code":void 0}(e);if(!n)throw new ma("invalid_request","Unable to determine grant type. Provide one of: otp, oobCode, or recoveryCode.");const r=t.scope,o=t.audience;try{const t=await this.auth0Client._requestTokenForMfa({grant_type:n,mfaToken:e.mfaToken,scope:r,audience:o,otp:e.otp,oob_code:e.oobCode,binding_code:e.bindingCode,recovery_code:e.recoveryCode});return this.contextManager.remove(e.mfaToken),t}catch(e){if(e instanceof C)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof ma)throw new ma(e.error,e.error_description);throw e}}}class ba{constructor(e){let t,n;if(this.userCache=(new Pe).enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},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(!U())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===U().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 ")})(),this.lockManager=(se||(se=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new ie:new ae;var e}()),se),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||b,!nt(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=nt(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:w,this.cookieStorage=!1===e.legacySameSiteCookie?Xe:ze,this.orgHintCookieName=(r=this.options.clientId,"auth0.".concat(r,".organization_hint")),this.isAuthenticatedCookieName=(e=>"auth0.".concat(e,".is.authenticated"))(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:Ve;var i;this.scope=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{const o=e[n];i[n]=Re(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new De(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||E,this.cacheManager=new Ue(n,n.allKeys?void 0:new $e(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new st(this.options.clientId):void 0,this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:"https://".concat(i)),this.tokenIssuer=((e,t)=>e?e.startsWith("https://")?e:"https://".concat(e,"/"):"".concat(t,"/"))(this.options.issuer,this.domainUrl);const a="".concat(this.domainUrl,"/me/"),s=this.createFetcher(Object.assign(Object.assign({},this.options.useDpop&&{dpopNonceId:"__auth0_my_account_api__"}),{getAccessToken:()=>this.getTokenSilently({authorizationParams:{scope:"create:me:connected_accounts",audience:a},detailedResponse:!0})}));this.myAccountApi=new lt(s,a),this.authJsClient=new ra({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new wa(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&t===b&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new qe,this.worker.postMessage({type:"init",allowedBaseUrl:this.domainUrl}))}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||v,n=j(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(H(e)))}async _verifyIdToken(e,t,n){const r=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,r,o]=t;if(3!==t.length||!n||!r||!o)throw new Error("ID token could not be decoded");const i=JSON.parse(W(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Be.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(W(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 "'.concat(e.iss,'", found "').concat(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 "'.concat(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 "'.concat(e.aud,'" but was not one of "').concat(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 "'.concat(e.aud,'", found "').concat(t.claims.azp,'"'))}}else if(t.claims.aud!==e.aud)throw new Error('Audience (aud) claim mismatch in the ID token; expected "'.concat(e.aud,'" but found "').concat(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 "'.concat(e.nonce,'", found "').concat(t.claims.nonce,'"'))}if(e.max_age&&!Me(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||!Me(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Me(t.claims.iat))throw new Error("Issued At (iat) claim must be a number present in the ID token");const n=e.leeway||60,r=new Date(e.now||Date.now()),o=new Date(0);if(o.setUTCSeconds(t.claims.exp+n),r>o)throw new Error("Expiration Time (exp) claim error in the ID token; current time (".concat(r,") is after expiration time (").concat(o,")"));if(null!=t.claims.nbf&&Me(t.claims.nbf)){const e=new Date(0);if(e.setUTCSeconds(t.claims.nbf-n),ro)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 (".concat(r,") is after last auth at ").concat(o))}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 "'.concat(e,'", found "').concat(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 "'.concat(e,'", found "').concat(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:(o=this.options.authorizationParams.max_age,"string"!=typeof o?o:parseInt(o,10)||void 0),now:r});var o}_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})}_extractSessionTransferToken(e){return new URLSearchParams(window.location.search).get(e)||void 0}_clearSessionTransferTokenFromUrl(e){try{const t=new URL(window.location.href);t.searchParams.has(e)&&(t.searchParams.delete(e),window.history.replaceState({},"",t.toString()))}catch(e){}}_applySessionTransferToken(e){const t=this.options.sessionTransferTokenQueryParamName;if(!t||e.session_transfer_token)return e;const n=this._extractSessionTransferToken(t);return n?(this._clearSessionTransferTokenFromUrl(t),Object.assign(Object.assign({},e),{session_transfer_token:n})):e}async _prepareAuthorizeUrl(e,t,n){var r;const o=M(D()),i=M(D()),a=D(),s=await G(a),c=K(s),u=await(null===(r=this.dpop)||void 0===r?void 0:r.calculateThumbprint()),l=((e,t,n,r,o,i,a,s,c)=>Object.assign(Object.assign(Object.assign({client_id:e.clientId},e.authorizationParams),n),{scope:Ie(t,n.scope,n.audience),response_type:"code",response_mode:s||"query",state:r,nonce:o,redirect_uri:a||e.authorizationParams.redirect_uri,code_challenge:i,code_challenge_method:"S256",dpop_jkt:c}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||n,null==t?void 0:t.response_mode,u),d=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||S,redirect_uri:l.redirect_uri,state:o,url:d}}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=".concat(e,",top=").concat(t,",width=").concat(400,",height=").concat(600,",resizable,scrollbars=yes,status=1"))})(),!t.popup))throw new I;const r=this._applySessionTransferToken(e.authorizationParams||{}),o=await this._prepareAuthorizeUrl(r,{response_mode:"web_message"},window.location.origin);t.popup.location.href=o.url;const i=await((e,t)=>new Promise((n,r)=>{let o;const i=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(i),clearTimeout(a),window.removeEventListener("message",o,!1),r(new R(e.popup)))},1e3),a=setTimeout(()=>{clearInterval(i),r(new O(e.popup)),window.removeEventListener("message",o,!1)},1e3*(e.timeoutInSeconds||60));o=function(s){if(s.origin===t&&s.data&&"authorization_response"===s.data.type){if(clearTimeout(a),clearInterval(i),window.removeEventListener("message",o,!1),!1!==e.closePopup&&e.popup.close(),s.data.response.error)return r(A.fromPayload(s.data.response));n(s.data.response)}},window.addEventListener("message",o)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}),new URL(o.url).origin);if(o.state!==i.state)throw new A("state_mismatch","Invalid state");const a=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organization:a})}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(){var e;const t=rt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=g(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=this._applySessionTransferToken(i.authorizationParams||{}),c=await this._prepareAuthorizeUrl(s),{url:u}=c,l=g(c,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},l),{appState:o,response_type:Ye.Code}),a&&{organization:a}));const d=r?"".concat(u,"#").concat(r):u;n?await n(d):window.location.assign(d)}async handleRedirectCallback(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window.location.href).split("?").slice(1);if(0===e.length)throw new Error("There are no query params available for parsing.");const t=this.transactionManager.get();if(!t)throw new A("missing_transaction","Invalid state");this.transactionManager.remove();const n=(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,connect_code:t.get("connect_code")||void 0,error:t.get("error")||void 0,error_description:t.get("error_description")||void 0}})(e.join(""));return t.response_type===Ye.ConnectCode?this._handleConnectAccountRedirectCallback(n,t):this._handleLoginRedirectCallback(n,t)}async _handleLoginRedirectCallback(e,t){const{code:n,state:r,error:o,error_description:i}=e;if(o)throw new k(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new A("state_mismatch","Invalid state");const a=t.organization,s=t.nonce,c=t.redirect_uri;return await this._requestToken(Object.assign({audience:t.audience,scope:t.scope,code_verifier:t.code_verifier,grant_type:"authorization_code",code:n},c?{redirect_uri:c}:{}),{nonceIn:s,organization:a}),{appState:t.appState,response_type:Ye.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new T(o,i||o,t.connection,r,t.appState);if(!n)throw new A("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new A("state_mismatch","Invalid state");const a=await this.myAccountApi.completeAccount({auth_session:t.auth_session,connect_code:n,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier});return Object.assign(Object.assign({},a),{appState:t.appState,response_type:Ye.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get(et))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(et)}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ie(this.scope,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,(null===(n=e.authorizationParams)||void 0===n?void 0:n.audience)||this.options.authorizationParams.audience)})}),o=await((e,t)=>{let n=Qe[t];return n||(n=e().finally(()=>{delete Qe[t],n=null}),Qe[t]=n),n})(()=>this._getTokenSilently(r),"".concat(this.options.clientId,"::").concat(r.authorizationParams.audience,"::").concat(r.authorizationParams.scope));return e.detailedResponse?o:null==o?void 0:o.access_token}async _getTokenSilently(e){const{cacheMode:t}=e,n=g(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||S,clientId:this.options.clientId,cacheMode:t});if(e)return e}if("cache-only"===t)return;const r=(o=this.options.clientId,i=n.authorizationParams.audience||"default","".concat("auth0.lock.getTokenSilently",".").concat(o,".").concat(i));var o,i;try{return await this.lockManager.runWithLock(r,5e3,async()=>{if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||S,clientId:this.options.clientId});if(e)return e}const e=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(n):await this._getTokenFromIFrame(n),{id_token:r,token_type:o,access_token:i,oauthTokenScope:a,expires_in:s}=e;return Object.assign(Object.assign({id_token:r,token_type:o,access_token:i},a?{scope:a}:null),{expires_in:s})})}catch(e){if(this._isInteractiveError(e)&&"popup"===this.options.interactiveErrorHandler)return await this._handleInteractiveErrorWithPopup(n);throw e}}_isInteractiveError(e){return e instanceof C||e instanceof A&&this._isIframeMfaError(e)}_isIframeMfaError(e){return"login_required"===e.error&&"Multifactor authentication required"===e.error_description}async _handleInteractiveErrorWithPopup(e){try{await this.loginWithPopup({authorizationParams:e.authorizationParams});const t=await this._getEntryFromCache({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||S,clientId:this.options.clientId});if(!t)throw new A("interactive_handler_cache_miss","Token not found in cache after interactive authentication");return t}catch(e){throw e}}async getTokenWithPopup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:Ie(this.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.scope,(null===(r=e.authorizationParams)||void 0===r?void 0:r.audience)||this.options.authorizationParams.audience)})});return t=Object.assign(Object.assign({},y),t),await this.loginWithPopup(o,t),(await this.cacheManager.get(new Le({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||S,clientId:this.options.clientId}),void 0,this.options.useMrrt)).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){null!==e.clientId?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const t=e.logoutParams||{},{federated:n}=t,r=g(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(H(Object.assign({clientId:e.clientId},r))))+o}async revokeRefreshToken(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.options.useRefreshTokens)return;const t=e.audience||this.options.authorizationParams.audience||S,n=await this.cacheManager.getRefreshTokensByAudience(t,this.options.clientId);await async function(e,t){let{baseUrl:n,timeout:r,auth0Client:o,useFormData:i,refreshTokens:a,audience:s,client_id:c,onRefreshTokenRevoked:u}=e;const l=r||w,d="refresh_token",h="".concat(n,"/oauth/revoke"),p={"Content-Type":i?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(j(o||v)))};if(t){const n={client_id:c,token_type_hint:d},r=i?H(n):JSON.stringify(n);try{return await Ae({type:"revoke",timeout:l,fetchUrl:h,fetchOptions:{method:"POST",body:r,headers:p},useFormData:i,auth:{audience:null!=s?s:S}},t)}catch(e){throw new A("revoke_error",e.message)}}for(const t of a){const n={client_id:c,token_type_hint:d,token:t},r=i?H(n):JSON.stringify(n),o=await ke(h,{method:"POST",body:r,headers:p},l);if(!o.ok){let t,n;try{({error:t,error_description:n}=JSON.parse(await o.text()))}catch(e){}throw new A(t||"revoke_error",n||"HTTP error ".concat(o.status))}await(null==u?void 0:u(t))}}({baseUrl:this.domainUrl,timeout:this.httpTimeoutMs,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,client_id:this.options.clientId,refreshTokens:n,audience:t,onRefreshTokenRevoked:e=>this.cacheManager.stripRefreshToken(e)},this.worker)}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=rt(e),{openUrl:r}=n,o=g(n,["openUrl"]);if(null===e.clientId?await this.cacheManager.clear():await this.cacheManager.clear(e.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(Ne),await(null===(t=this.dpop)||void 0===t?void 0:t.clear()),this.worker)try{await Ae({type:"clear"},this.worker)}catch(e){}const i=this._buildLogoutUrl(o);r?await r(i):!1!==r&&window.location.assign(i)}async _getTokenFromIFrame(e){const t=(n=this.options.clientId,"".concat("auth0.lock.getTokenFromIFrame",".").concat(n));var n;try{return await this.lockManager.runWithLock(t,5e3,async()=>{const t=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),n=this.cookieStorage.get(this.orgHintCookieName);n&&!t.organization&&(t.organization=n);const{url:r,state:o,nonce:i,code_verifier:a,redirect_uri:s,scope:c,audience:u}=await this._prepareAuthorizeUrl(t,{response_mode:"web_message"},window.location.origin);if(window.crossOriginIsolated)throw new A("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const l=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds;let d;try{d=new URL(this.domainUrl).origin}catch(e){d=this.domainUrl}const h=await function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60;return new Promise((r,o)=>{const i=window.document.createElement("iframe");i.setAttribute("width","0"),i.setAttribute("height","0"),i.style.display="none";const a=()=>{window.document.body.contains(i)&&(window.document.body.removeChild(i),window.removeEventListener("message",s,!1))};let s;const c=setTimeout(()=>{o(new _),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?o(A.fromPayload(e.data.response)):r(e.data.response),clearTimeout(c),window.removeEventListener("message",s,!1),setTimeout(a,2e3)},window.addEventListener("message",s,!1),window.document.body.appendChild(i),i.setAttribute("src",e)})}(r,d,l);if(o!==h.state)throw new A("state_mismatch","Invalid state");const p=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:a,code:h.code,grant_type:"authorization_code",redirect_uri:s,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:i,organization:t.organization});return Object.assign(Object.assign({},p),{scope:c,oauthTokenScope:p.scope,audience:u})})}catch(e){throw"login_required"===e.error&&(e instanceof A&&this._isIframeMfaError(e)&&"popup"===this.options.interactiveErrorHandler||this.logout({openUrl:!1})),e}}async _getTokenUsingRefreshToken(e){var t,n;const r=await this.cacheManager.get(new Le({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||S,clientId:this.options.clientId}),void 0,this.options.useMrrt);if(!(r&&r.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new N(e.authorizationParams.audience||S,e.authorizationParams.scope)}const o=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,i="number"==typeof e.timeoutInSeconds?1e3*e.timeoutInSeconds:null,a=((e,t,n,r)=>{var o;if(e&&n&&r){if(t.audience!==n)return t.scope;const e=r.split(" "),i=(null===(o=t.scope)||void 0===o?void 0:o.split(" "))||[],a=i.every(t=>e.includes(t));return e.length>=i.length&&a?r:t.scope}return t.scope})(this.options.useMrrt,e.authorizationParams,null==r?void 0:r.audience,null==r?void 0:r.scope);try{const t=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:r&&r.refresh_token,redirect_uri:o}),i&&{timeout:i}),{scopesToRequest:a});if(t.refresh_token&&(null==r?void 0:r.refresh_token)&&await this.cacheManager.updateEntry(r.refresh_token,t.refresh_token),this.options.useMrrt&&!(s=null==r?void 0:r.audience,c=null==r?void 0:r.scope,u=e.authorizationParams.audience,l=e.authorizationParams.scope,s===u&&ot(l,c)||ot(a,t.scope))){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);await this.cacheManager.remove(this.options.clientId,e.authorizationParams.audience,e.authorizationParams.scope);const n=((e,t)=>{const n=(null==e?void 0:e.split(" "))||[],r=(null==t?void 0:t.split(" "))||[];return n.filter(e=>-1==r.indexOf(e)).join(",")})(a,t.scope);throw new L(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||S})}catch(r){if(r.message){if(r.message.includes("user is blocked"))throw await this.logout({openUrl:!1}),r;if((r.message.includes("Missing Refresh Token")||r.message.includes("invalid refresh token"))&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e)}throw r instanceof C&&this.mfa.setMFAAuthDetails(r.mfa_token,null===(t=e.authorizationParams)||void 0===t?void 0:t.scope,null===(n=e.authorizationParams)||void 0===n?void 0:n.audience,r.mfa_requirements),r}var s,c,u,l}async _saveEntryInCache(e){const{id_token:t,decodedToken:n}=e,r=g(e,["id_token","decodedToken"]);this.userCache.set(Ne,{id_token:t,decodedToken:n}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(r)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||S,t=this.scope[e],n=await this.cacheManager.getIdToken(new Le({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get(Ne);return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set(Ne,n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new Le({scope:t,audience:n,clientId:r}),60,this.options.useMrrt,o);if(i&&i.access_token){const{token_type:e,access_token:t,oauthTokenScope:n,expires_in:r}=i,o=await this._getIdTokenFromCache();return o&&Object.assign(Object.assign({id_token:o.id_token,token_type:e||"Bearer",access_token:t},n?{scope:n}:null),{expires_in:r})}}async _requestToken(e,t){var n,r;const{nonceIn:o,organization:i,scopesToRequest:a}=t||{},s=await Oe(Object.assign(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs,useMrrt:this.options.useMrrt,dpop:this.dpop},e),{scope:a||e.scope}),this.worker),c=await this._verifyIdToken(s.id_token,o,i);if("authorization_code"===e.grant_type){const e=await this._getIdTokenFromCache();(null===(r=null===(n=null==e?void 0:e.decodedToken)||void 0===n?void 0:n.claims)||void 0===r?void 0:r.sub)&&e.decodedToken.claims.sub!==c.claims.sub&&(await this.cacheManager.clear(this.options.clientId),this.userCache.remove(Ne))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||S}),s.scope?{oauthTokenScope:s.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgHint(i||c.claims.org_id),Object.assign(Object.assign({},s),{decodedToken:c})}async loginWithCustomTokenExchange(e){return this._requestToken(Object.assign(Object.assign({},e),{grant_type:"urn:ietf:params:oauth:grant-type:token-exchange",subject_token:e.subject_token,subject_token_type:e.subject_token_type,scope:Ie(this.scope,e.scope,e.audience||this.options.authorizationParams.audience),audience:e.audience||this.options.authorizationParams.audience,organization:e.organization||this.options.authorizationParams.organization}))}async exchangeToken(e){return this.loginWithCustomTokenExchange(e)}_assertDpop(e){if(!e)throw new Error("`useDpop` option must be enabled before using DPoP.")}getDpopNonce(e){return this._assertDpop(this.dpop),this.dpop.getNonce(e)}setDpopNonce(e,t){return this._assertDpop(this.dpop),this.dpop.setNonce(e,t)}generateDpopProof(e){return this._assertDpop(this.dpop),this.dpop.generateProof(e)}createFetcher(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new ut(e,{isDpopEnabled:()=>!!this.options.useDpop,getAccessToken:e=>{var t;return this.getTokenSilently({authorizationParams:{scope:null===(t=null==e?void 0:e.scope)||void 0===t?void 0:t.join(" "),audience:null==e?void 0:e.audience},detailedResponse:!0})},getDpopNonce:()=>this.getDpopNonce(e.dpopNonceId),setDpopNonce:t=>this.setDpopNonce(t,e.dpopNonceId),generateDpopProof:e=>this.generateDpopProof(e)})}async connectAccountWithRedirect(e){const{openUrl:t,appState:n,connection:r,scopes:o,authorization_params:i,redirectUri:a=this.options.authorizationParams.redirect_uri||window.location.origin}=e;if(!r)throw new Error("connection is required");const s=M(D()),c=D(),u=await G(c),l=K(u),{connect_uri:d,connect_params:h,auth_session:p}=await this.myAccountApi.connectAccount({connection:r,scopes:o,redirect_uri:a,state:s,code_challenge:l,code_challenge_method:"S256",authorization_params:i});this.transactionManager.create({state:s,code_verifier:c,auth_session:p,redirect_uri:a,appState:n,connection:r,response_type:Ye.ConnectCode});const f=new URL(d);f.searchParams.set("ticket",h.ticket),t?await t(f.toString()):window.location.assign(f)}async _requestTokenForMfa(e,t){const{mfaToken:n}=e,r=g(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function va(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ea}=Object.prototype,{getPrototypeOf:Sa}=Object,{iterator:Aa,toStringTag:ka}=Symbol,Ta=(_a=Object.create(null),e=>{const t=Ea.call(e);return _a[t]||(_a[t]=t.slice(8,-1).toLowerCase())});var _a;const Oa=e=>(e=e.toLowerCase(),t=>Ta(t)===e),Ra=e=>t=>typeof t===e,{isArray:Ia}=Array,Ca=Ra("undefined");function Na(e){return null!==e&&!Ca(e)&&null!==e.constructor&&!Ca(e.constructor)&&Pa(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const La=Oa("ArrayBuffer");const xa=Ra("string"),Pa=Ra("function"),Ua=Ra("number"),Da=e=>null!==e&&"object"==typeof e,Ma=e=>{if("object"!==Ta(e))return!1;const t=Sa(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||ka in e||Aa in e)},Ba=Oa("Date"),ja=Oa("File"),Ha=Oa("Blob"),Ga=Oa("FileList");const Wa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Ka=void 0!==Wa.FormData?Wa.FormData:void 0,Fa=Oa("URLSearchParams"),[Xa,Ja,za,Va]=["ReadableStream","Request","Response","Headers"].map(Oa);function Ya(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Ia(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const qa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Qa=e=>!Ca(e)&&e!==qa;const $a=(es="undefined"!=typeof Uint8Array&&Sa(Uint8Array),e=>es&&e instanceof es);var es;const ts=Oa("HTMLFormElement"),ns=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),rs=Oa("RegExp"),os=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Ya(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const is=Oa("AsyncFunction"),as=(ss="function"==typeof setImmediate,cs=Pa(qa.postMessage),ss?setImmediate:cs?(us=`axios@${Math.random()}`,ls=[],qa.addEventListener("message",({source:e,data:t})=>{e===qa&&t===us&&ls.length&&ls.shift()()},!1),e=>{ls.push(e),qa.postMessage(us,"*")}):e=>setTimeout(e));var ss,cs,us,ls;const ds="undefined"!=typeof queueMicrotask?queueMicrotask.bind(qa):"undefined"!=typeof process&&process.nextTick||as,hs={isArray:Ia,isArrayBuffer:La,isBuffer:Na,isFormData:e=>{if(!e)return!1;if(Ka&&e instanceof Ka)return!0;const t=Sa(e);if(!t||t===Object.prototype)return!1;if(!Pa(e.append))return!1;const n=Ta(e);return"formdata"===n||"object"===n&&Pa(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&La(e.buffer),t},isString:xa,isNumber:Ua,isBoolean:e=>!0===e||!1===e,isObject:Da,isPlainObject:Ma,isEmptyObject:e=>{if(!Da(e)||Na(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Xa,isRequest:Ja,isResponse:za,isHeaders:Va,isUndefined:Ca,isDate:Ba,isFile:ja,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Ha,isRegExp:rs,isFunction:Pa,isStream:e=>Da(e)&&Pa(e.pipe),isURLSearchParams:Fa,isTypedArray:$a,isFileList:Ga,forEach:Ya,merge:function e(...t){const{caseless:n,skipUndefined:r}=Qa(this)&&this||{},o={},i=(t,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=n&&Za(o,i)||i,s=ns(o,a)?o[a]:void 0;Ma(s)&&Ma(t)?o[a]=e(s,t):Ma(t)?o[a]=e({},t):Ia(t)?o[a]=t.slice():r&&Ca(t)||(o[a]=t)};for(let e=0,n=t.length;e(Ya(t,(t,r)=>{n&&Pa(t)?Object.defineProperty(e,r,{__proto__:null,value:va(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,n,r)=>{let o,i,a;const s={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),i=o.length;i-- >0;)a=o[i],r&&!r(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==n&&Sa(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Ta,kindOfTest:Oa,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(Ia(e))return e;let t=e.length;if(!Ua(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Aa]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:ts,hasOwnProperty:ns,hasOwnProp:ns,reduceDescriptors:os,freezeMethods:e=>{os(e,(t,n)=>{if(Pa(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];Pa(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))})},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach(e=>{n[e]=!0})};return Ia(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Za,global:qa,isContextDefined:Qa,isSpecCompliantForm:function(e){return!!(e&&Pa(e.append)&&"FormData"===e[ka]&&e[Aa])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Da(e)){if(t.indexOf(e)>=0)return;if(Na(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Ia(e)?[]:{};return Ya(e,(e,t)=>{const i=n(e,r+1);!Ca(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:is,isThenable:e=>e&&(Da(e)||Pa(e))&&Pa(e.then)&&Pa(e.catch),setImmediate:as,asap:ds,isIterable:e=>null!=e&&Pa(e[Aa])},ps=hs.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),fs=e=>{const t={};let n,r,o;return e&&e.split("\n").forEach(function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ps[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};(Object.getOwnPropertyDescriptor(fs,"name")||{}).writable||Object.defineProperty(fs,"name",{value:"default",configurable:!0});const ms=Symbol("internals"),gs=/[^\x09\x20-\x7E\x80-\xFF]/g;function ys(e){return e&&String(e).trim().toLowerCase()}function ws(e){return!1===e||null==e?e:hs.isArray(e)?e.map(ws):function(e){let t=0,n=e.length;for(;tt;){const t=e.charCodeAt(n-1);if(9!==t&&32!==t)break;n-=1}return 0===t&&n===e.length?e:e.slice(t,n)}(String(e).replace(gs,""))}function bs(e,t,n,r,o){return hs.isFunction(r)?r.call(this,t,n):(o&&(t=n),hs.isString(t)?hs.isString(r)?-1!==t.indexOf(r):hs.isRegExp(r)?r.test(t):void 0:void 0)}class vs{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ys(t);if(!o)throw new Error("header name must be a non-empty string");const i=hs.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=ws(e))}const i=(e,t)=>hs.forEach(e,(e,n)=>o(e,n,t));if(hs.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(hs.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(fs(e),t);else if(hs.isObject(e)&&hs.isIterable(e)){let n,r,o={};for(const t of e){if(!hs.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?hs.isArray(n)?[...n,t[1]]:[n,t[1]]:t[1]}i(o,t)}else null!=e&&o(t,e,n);return this}get(e,t){if(e=ys(e)){const n=hs.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(hs.isFunction(t))return t.call(this,e,n);if(hs.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ys(e)){const n=hs.findKey(this,e);return!(!n||void 0===this[n]||t&&!bs(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ys(e)){const o=hs.findKey(n,e);!o||t&&!bs(0,n[o],o,t)||(delete n[o],r=!0)}}return hs.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!bs(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return hs.forEach(this,(r,o)=>{const i=hs.findKey(n,o);if(i)return t[i]=ws(r),void delete t[o];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}(o):String(o).trim();a!==o&&delete t[o],t[a]=ws(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return hs.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&hs.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach(e=>n.set(e)),n}static accessor(e){const t=(this[ms]=this[ms]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ys(e);t[r]||(!function(e,t){const n=hs.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return hs.isArray(e)?e.forEach(r):r(e),this}}vs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),hs.reduceDescriptors(vs.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),hs.freezeMethods(vs);const Es=vs;function Ss(e,t){const n=new Set(t.map(e=>String(e).toLowerCase())),r=[],o=e=>{if(null===e||"object"!=typeof e)return e;if(hs.isBuffer(e))return e;if(-1!==r.indexOf(e))return;let t;if(e instanceof Es&&(e=e.toJSON()),r.push(e),hs.isArray(e))t=[],e.forEach((e,n)=>{const r=o(e);hs.isUndefined(r)||(t[n]=r)});else{if(!hs.isPlainObject(e)&&function(e){if(hs.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(hs.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return r.pop(),e;t=Object.create(null);for(const[r,i]of Object.entries(e)){const e=n.has(r.toLowerCase())?"[REDACTED ****]":o(i);hs.isUndefined(e)||(t[r]=e)}}return r.pop(),t};return o(e)}class As extends Error{static from(e,t,n,r,o,i){const a=new As(e.message,t||e.code,n,r,o);return a.cause=e,a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),i&&Object.assign(a,i),a}constructor(e,t,n,r,o){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status)}toJSON(){const e=this.config,t=e&&hs.hasOwnProp(e,"redact")?e.redact:void 0,n=hs.isArray(t)&&t.length>0?Ss(e,t):hs.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:n,code:this.code,status:this.status}}}As.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",As.ERR_BAD_OPTION="ERR_BAD_OPTION",As.ECONNABORTED="ECONNABORTED",As.ETIMEDOUT="ETIMEDOUT",As.ECONNREFUSED="ECONNREFUSED",As.ERR_NETWORK="ERR_NETWORK",As.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",As.ERR_DEPRECATED="ERR_DEPRECATED",As.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",As.ERR_BAD_REQUEST="ERR_BAD_REQUEST",As.ERR_CANCELED="ERR_CANCELED",As.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",As.ERR_INVALID_URL="ERR_INVALID_URL",As.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const ks=As;var Ts=n(8287).hp;function _s(e){return hs.isPlainObject(e)||hs.isArray(e)}function Os(e){return hs.endsWith(e,"[]")?e.slice(0,-2):e}function Rs(e,t,n){return e?e.concat(t).map(function(e,t){return e=Os(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Is=hs.toFlatObject(hs,{},null,function(e){return/^is[A-Z]/.test(e)});const Cs=function(e,t,n){if(!hs.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=hs.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!hs.isUndefined(t[e])})).metaTokens,o=n.visitor||d,i=n.dots,a=n.indexes,s=n.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===n.maxDepth?100:n.maxDepth,u=s&&hs.isSpecCompliantForm(t);if(!hs.isFunction(o))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(hs.isDate(e))return e.toISOString();if(hs.isBoolean(e))return e.toString();if(!u&&hs.isBlob(e))throw new ks("Blob is not supported. Use a Buffer instead.");return hs.isArrayBuffer(e)||hs.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Ts.from(e):e}function d(e,n,o){let s=e;if(hs.isReactNative(t)&&hs.isReactNativeBlob(e))return t.append(Rs(o,n,i),l(e)),!1;if(e&&!o&&"object"==typeof e)if(hs.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(hs.isArray(e)&&function(e){return hs.isArray(e)&&!e.some(_s)}(e)||(hs.isFileList(e)||hs.endsWith(n,"[]"))&&(s=hs.toArray(e)))return n=Os(n),s.forEach(function(e,r){!hs.isUndefined(e)&&null!==e&&t.append(!0===a?Rs([n],r,i):null===a?n:n+"[]",l(e))}),!1;return!!_s(e)||(t.append(Rs(o,n,i),l(e)),!1)}const h=[],p=Object.assign(Is,{defaultVisitor:d,convertValue:l,isVisitable:_s});if(!hs.isObject(e))throw new TypeError("data must be an object");return function e(n,r,i=0){if(!hs.isUndefined(n)){if(i>c)throw new ks("Object is too deeply nested ("+i+" levels). Max depth: "+c,ks.ERR_FORM_DATA_DEPTH_EXCEEDED);if(-1!==h.indexOf(n))throw Error("Circular reference detected in "+r.join("."));h.push(n),hs.forEach(n,function(n,a){!0===(!(hs.isUndefined(n)||null===n)&&o.call(t,n,hs.isString(a)?a.trim():a,r,p))&&e(n,r?r.concat(a):[a],i+1)}),h.pop()}}(e),t};function Ns(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(e){return t[e]})}function Ls(e,t){this._pairs=[],e&&Cs(e,this,t)}const xs=Ls.prototype;xs.append=function(e,t){this._pairs.push([e,t])},xs.toString=function(e){const t=e?function(t){return e.call(this,t,Ns)}:Ns;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ps=Ls;function Us(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ds(e,t,n){if(!t)return e;const r=n&&n.encode||Us,o=hs.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):hs.isURLSearchParams(t)?t.toString():new Ps(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Ms=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){hs.forEach(this.handlers,function(t){null!==t&&e(t)})}},Bs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},js={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ps,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Hs="undefined"!=typeof window&&"undefined"!=typeof document,Gs="object"==typeof navigator&&navigator||void 0,Ws=Hs&&(!Gs||["ReactNative","NativeScript","NS"].indexOf(Gs.product)<0),Ks="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Fs=Hs&&window.location.href||"http://localhost",Xs={...e,...js};const Js=function(e){function t(e,n,r,o){let i=e[o++];if("__proto__"===i)return!0;const a=Number.isFinite(+i),s=o>=e.length;if(i=!i&&hs.isArray(r)?r.length:i,s)return hs.hasOwnProp(r,i)?r[i]=hs.isArray(r[i])?r[i].concat(n):[r[i],n]:r[i]=n,!a;r[i]&&hs.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&hs.isArray(r[i])&&(r[i]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let i;for(r=0;r{t(function(e){return hs.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null},zs=(e,t)=>null!=e&&hs.hasOwnProp(e,t)?e[t]:void 0;const Vs={transitional:Bs,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=hs.isObject(e);o&&hs.isHTMLForm(e)&&(e=new FormData(e));if(hs.isFormData(e))return r?JSON.stringify(Js(e)):e;if(hs.isArrayBuffer(e)||hs.isBuffer(e)||hs.isStream(e)||hs.isFile(e)||hs.isBlob(e)||hs.isReadableStream(e))return e;if(hs.isArrayBufferView(e))return e.buffer;if(hs.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){const t=zs(this,"formSerializer");if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cs(e,new Xs.classes.URLSearchParams,{visitor:function(e,t,n,r){return Xs.isNode&&hs.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((i=hs.isFileList(e))||n.indexOf("multipart/form-data")>-1){const n=zs(this,"env"),r=n&&n.FormData;return Cs(i?{"files[]":e}:e,r&&new r,t)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(hs.isString(e))try{return(t||JSON.parse)(e),hs.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=zs(this,"transitional")||Vs.transitional,n=t&&t.forcedJSONParsing,r=zs(this,"responseType"),o="json"===r;if(hs.isResponse(e)||hs.isReadableStream(e))return e;if(e&&hs.isString(e)&&(n&&!r||o)){const n=!(t&&t.silentJSONParsing)&&o;try{return JSON.parse(e,zs(this,"parseReviver"))}catch(e){if(n){if("SyntaxError"===e.name)throw ks.from(e,ks.ERR_BAD_RESPONSE,this,null,zs(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Xs.classes.FormData,Blob:Xs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};hs.forEach(["delete","get","head","post","put","patch","query"],e=>{Vs.headers[e]={}});const Ys=Vs;function Zs(e,t){const n=this||Ys,r=t||n,o=Es.from(r.headers);let i=r.data;return hs.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function qs(e){return!(!e||!e.__CANCEL__)}const Qs=class extends ks{constructor(e,t,n){super(e??"canceled",ks.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function $s(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ks("Request failed with status code "+n.status,n.status>=400&&n.status<500?ks.ERR_BAD_REQUEST:ks.ERR_BAD_RESPONSE,n.config,n.request,n)):e(n)}const ec=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,i=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=r[a];o||(o=c),n[i]=s,r[i]=c;let l=a,d=0;for(;l!==i;)d+=n[l++],l%=e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),c-o{o=i,n=null,r&&(clearTimeout(r),r=null),e(...t)};return[(...e)=>{const t=Date.now(),s=t-o;s>=i?a(e,t):(n=e,r||(r=setTimeout(()=>{r=null,a(n)},i-s)))},()=>n&&a(n)]},nc=(e,t,n=3)=>{let r=0;const o=ec(50,250);return tc(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=null!=a?Math.min(i,a):i,c=Math.max(0,s-r),u=o(c);r=Math.max(r,s);e({loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:u||void 0,estimated:u&&a?(a-s)/u:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},rc=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},oc=e=>(...t)=>hs.asap(()=>e(...t)),ic=Xs.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,Xs.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(Xs.origin),Xs.navigator&&/(msie|trident)/i.test(Xs.navigator.userAgent)):()=>!0,ac=Xs.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];hs.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),hs.isString(r)&&s.push(`path=${r}`),hs.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),hs.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let n=0;nnull,remove(){}};function sc(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||!1===n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const cc=e=>e instanceof Es?{...e}:e;function uc(e,t){t=t||{};const n=Object.create(null);function r(e,t,n,r){return hs.isPlainObject(e)&&hs.isPlainObject(t)?hs.merge.call({caseless:r},e,t):hs.isPlainObject(t)?hs.merge({},t):hs.isArray(t)?t.slice():t}function o(e,t,n,o){return hs.isUndefined(t)?hs.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!hs.isUndefined(t))return r(void 0,t)}function a(e,t){return hs.isUndefined(t)?hs.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return hs.hasOwnProp(t,i)?r(n,o):hs.hasOwnProp(e,i)?r(void 0,n):void 0}Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,allowedSocketPaths:a,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(cc(e),cc(t),0,!0)};return hs.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=hs.hasOwnProp(c,r)?c[r]:o,a=i(hs.hasOwnProp(e,r)?e[r]:void 0,hs.hasOwnProp(t,r)?t[r]:void 0,r);hs.isUndefined(a)&&i!==s||(n[r]=a)}),n}const lc=["content-type","content-length"];const dc=e=>{const t=uc({},e),n=e=>hs.hasOwnProp(t,e)?t[e]:void 0,r=n("data");let o=n("withXSRFToken");const i=n("xsrfHeaderName"),a=n("xsrfCookieName");let s=n("headers");const c=n("auth"),u=n("baseURL"),l=n("allowAbsoluteUrls"),d=n("url");var h;if(t.headers=s=Es.from(s),t.url=Ds(sc(u,d,l),e.params,e.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?(h=c.password,encodeURIComponent(h).replace(/%([0-9A-F]{2})/gi,(e,t)=>String.fromCharCode(parseInt(t,16)))):""))),hs.isFormData(r)&&(Xs.hasStandardBrowserEnv||Xs.hasStandardBrowserWebWorkerEnv?s.setContentType(void 0):hs.isFunction(r.getHeaders)&&function(e,t,n){"content-only"===n?Object.entries(t).forEach(([t,n])=>{lc.includes(t.toLowerCase())&&e.set(t,n)}):e.set(t)}(s,r.getHeaders(),n("formDataHeaderPolicy"))),Xs.hasStandardBrowserEnv){hs.isFunction(o)&&(o=o(t));if(!0===o||null==o&&ic(t.url)){const e=i&&a&&ac.read(a);e&&s.set(i,e)}}return t};(Object.getOwnPropertyDescriptor(dc,"name")||{}).writable||Object.defineProperty(dc,"name",{value:"default",configurable:!0});const hc="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=dc(e);let o=r.data;const i=Es.from(r.headers).normalize();let a,s,c,u,l,{responseType:d,onUploadProgress:h,onDownloadProgress:p}=r;function f(){u&&u(),l&&l(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let m=new XMLHttpRequest;function g(){if(!m)return;const r=Es.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());$s(function(e){t(e),f()},function(e){n(e),f()},{data:d&&"text"!==d&&"json"!==d?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:r,config:e,request:m}),m=null}m.open(r.method.toUpperCase(),r.url,!0),m.timeout=r.timeout,"onloadend"in m?m.onloadend=g:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new ks("Request aborted",ks.ECONNABORTED,e,m)),f(),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ks(r,ks.ERR_NETWORK,e,m);o.event=t||null,n(o),f(),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Bs;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ks(t,o.clarifyTimeoutError?ks.ETIMEDOUT:ks.ECONNABORTED,e,m)),f(),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&hs.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),hs.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=nc(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=nc(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new Qs(null,e,m):t),m.abort(),f(),m=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const y=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(r.url);!y||Xs.protocols.includes(y)?m.send(o||null):n(new ks("Unsupported protocol "+y+":",ks.ERR_BAD_REQUEST,e))})},pc=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let n,r=new AbortController;const o=function(e){if(!n){n=!0,a();const t=e instanceof Error?e:this.reason;r.abort(t instanceof ks?t:new Qs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new ks(`timeout of ${t}ms exceeded`,ks.ETIMEDOUT))},t);const a=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(e=>{e.unsubscribe?e.unsubscribe(o):e.removeEventListener("abort",o)}),e=null)};e.forEach(e=>e.addEventListener("abort",o));const{signal:s}=r;return s.unsubscribe=()=>hs.asap(a),s}},fc=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of mc(e))yield*fc(n,t)}(e,t);let i,a=0,s=e=>{i||(i=!0,r&&r(e))};return new ReadableStream({async pull(e){try{const{done:t,value:r}=await o.next();if(t)return s(),void e.close();let i=r.byteLength;if(n){let e=a+=i;n(e)}e.enqueue(new Uint8Array(r))}catch(e){throw s(e),e}},cancel:e=>(s(e),o.return())},{highWaterMark:2})};var yc=n(8287).hp;const wc="1.16.0",{isFunction:bc}=hs,vc=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ec=e=>{const t=hs.global??globalThis,{ReadableStream:n,TextEncoder:r}=t;e=hs.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:o,Request:i,Response:a}=e,s=o?bc(o):"function"==typeof fetch,c=bc(i),u=bc(a);if(!s)return!1;const l=s&&bc(n),d=s&&("function"==typeof r?(h=new r,e=>h.encode(e)):async e=>new Uint8Array(await new i(e).arrayBuffer()));var h;const p=c&&l&&vc(()=>{let e=!1;const t=new i(Xs.origin,{body:new n,method:"POST",get duplex(){return e=!0,"half"}}),r=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!r}),f=u&&l&&vc(()=>hs.isReadableStream(new a("").body)),m={stream:f&&(e=>e.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!m[e]&&(m[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ks(`Response type '${e}' is not supported`,ks.ERR_NOT_SUPPORT,n)})});const g=async(e,t)=>{const n=hs.toFiniteNumber(e.getContentLength());return n??(async e=>{if(null==e)return 0;if(hs.isBlob(e))return e.size;if(hs.isSpecCompliantForm(e)){const t=new i(Xs.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return hs.isArrayBufferView(e)||hs.isArrayBuffer(e)?e.byteLength:(hs.isURLSearchParams(e)&&(e+=""),hs.isString(e)?(await d(e)).byteLength:void 0)})(t)};return async e=>{let{url:t,method:n,data:s,signal:u,cancelToken:l,timeout:d,onDownloadProgress:h,onUploadProgress:y,responseType:w,headers:b,withCredentials:v="same-origin",fetchOptions:E,maxContentLength:S,maxBodyLength:A}=dc(e);const k=hs.isNumber(S)&&S>-1,T=hs.isNumber(A)&&A>-1;let _=o||fetch;w=w?(w+"").toLowerCase():"text";let O=pc([u,l&&l.toAbortSignal()],d),R=null;const I=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let C;try{if(k&&"string"==typeof t&&t.startsWith("data:")){const n=function(e){if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let e=r.length;const t=r.length;for(let n=0;n=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102)&&(o>=48&&o<=57||o>=65&&o<=70||o>=97&&o<=102)&&(e-=2,n+=2)}let n=0,o=t-1;const i=e=>e>=2&&37===r.charCodeAt(e-2)&&51===r.charCodeAt(e-1)&&(68===r.charCodeAt(e)||100===r.charCodeAt(e));o>=0&&(61===r.charCodeAt(o)?(n++,o--):i(o)&&(n++,o-=3)),1===n&&o>=0&&(61===r.charCodeAt(o)||i(o))&&n++;const a=3*Math.floor(e/4)-(n||0);return a>0?a:0}if(void 0!==yc&&"function"==typeof yc.byteLength)return yc.byteLength(r,"utf8");let o=0;for(let e=0,t=r.length;e=55296&&n<=56319&&e+1=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o}(t);if(n>S)throw new ks("maxContentLength size of "+S+" exceeded",ks.ERR_BAD_RESPONSE,e,R)}if(T&&"get"!==n&&"head"!==n){const t=await g(b,s);if("number"==typeof t&&isFinite(t)&&t>A)throw new ks("Request body larger than maxBodyLength limit",ks.ERR_BAD_REQUEST,e,R)}if(y&&p&&"get"!==n&&"head"!==n&&0!==(C=await g(b,s))){let e,n=new i(t,{method:"POST",body:s,duplex:"half"});if(hs.isFormData(s)&&(e=n.headers.get("content-type"))&&b.setContentType(e),n.body){const[e,t]=rc(C,nc(oc(y)));s=gc(n.body,65536,e,t)}}hs.isString(v)||(v=v?"include":"omit");const o=c&&"credentials"in i.prototype;if(hs.isFormData(s)){const e=b.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&b.delete("content-type")}b.set("User-Agent","axios/"+wc,!1);const u={...E,signal:O,method:n.toUpperCase(),headers:b.normalize().toJSON(),body:s,duplex:"half",credentials:o?v:void 0};R=c&&new i(t,u);let l=await(c?_(R,E):_(t,u));if(k){const t=hs.toFiniteNumber(l.headers.get("content-length"));if(null!=t&&t>S)throw new ks("maxContentLength size of "+S+" exceeded",ks.ERR_BAD_RESPONSE,e,R)}const d=f&&("stream"===w||"response"===w);if(f&&l.body&&(h||k||d&&I)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=l[e]});const n=hs.toFiniteNumber(l.headers.get("content-length")),[r,o]=h&&rc(n,nc(oc(h),!0))||[];let i=0;const s=t=>{if(k&&(i=t,i>S))throw new ks("maxContentLength size of "+S+" exceeded",ks.ERR_BAD_RESPONSE,e,R);r&&r(t)};l=new a(gc(l.body,65536,s,()=>{o&&o(),I&&I()}),t)}w=w||"text";let N=await m[hs.findKey(m,w)||"text"](l,e);if(k&&!f&&!d){let t;if(null!=N&&("number"==typeof N.byteLength?t=N.byteLength:"number"==typeof N.size?t=N.size:"string"==typeof N&&(t="function"==typeof r?(new r).encode(N).byteLength:N.length)),"number"==typeof t&&t>S)throw new ks("maxContentLength size of "+S+" exceeded",ks.ERR_BAD_RESPONSE,e,R)}return!d&&I&&I(),await new Promise((t,n)=>{$s(t,n,{data:N,headers:Es.from(l.headers),status:l.status,statusText:l.statusText,config:e,request:R})})}catch(t){if(I&&I(),O&&O.aborted&&O.reason instanceof ks){const n=O.reason;throw n.config=e,R&&(n.request=R),t!==n&&(n.cause=t),n}if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ks("Network Error",ks.ERR_NETWORK,e,R,t&&t.response),{cause:t.cause||t});throw ks.from(t,t&&t.code,e,R,t&&t.response)}}},Sc=new Map,Ac=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:o}=t,i=[r,o,n];let a,s,c=i.length,u=Sc;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Ec(t)),u=s;return s},kc=(Ac(),{http:null,xhr:hc,fetch:{get:Ac}});hs.forEach(kc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const Tc=e=>`- ${e}`,_c=e=>hs.isFunction(e)||null===e||!1===e;const Oc={getAdapter:function(e,t){e=hs.isArray(e)?e:[e];const{length:n}=e;let r,o;const i={};for(let a=0;a`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build"));let t=n?e.length>1?"since :\n"+e.map(Tc).join("\n"):" "+Tc(e[0]):"as no adapter specified";throw new ks("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:kc};function Rc(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Qs(null,e)}function Ic(e){Rc(e),e.headers=Es.from(e.headers),e.data=Zs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Oc.getAdapter(e.adapter||Ys.adapter,e)(e).then(function(t){Rc(e),e.response=t;try{t.data=Zs.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Es.from(t.headers),t},function(t){if(!qs(t)&&(Rc(e),t&&t.response)){e.response=t.response;try{t.response.data=Zs.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Es.from(t.response.headers)}return Promise.reject(t)})}const Cc={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Cc[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Nc={};Cc.transitional=function(e,t,n){function r(e,t){return"[Axios v"+wc+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ks(r(o," has been removed"+(t?" in "+t:"")),ks.ERR_DEPRECATED);return t&&!Nc[o]&&(Nc[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}},Cc.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Lc={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ks("options must be an object",ks.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:void 0;if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new ks("option "+i+" must be "+n,ks.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ks("Unknown option "+i,ks.ERR_BAD_OPTION)}},validators:Cc},xc=Lc.validators;class Pc{constructor(e){this.defaults=e||{},this.interceptors={request:new Ms,response:new Ms}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const n=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),o=-1===r?"":n.slice(r+1);String(e.stack).endsWith(o)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=uc(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Lc.assertOptions(n,{silentJSONParsing:xc.transitional(xc.boolean),forcedJSONParsing:xc.transitional(xc.boolean),clarifyTimeoutError:xc.transitional(xc.boolean),legacyInterceptorReqResOrdering:xc.transitional(xc.boolean)},!1),null!=r&&(hs.isFunction(r)?t.paramsSerializer={serialize:r}:Lc.assertOptions(r,{encode:xc.function,serialize:xc.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Lc.assertOptions(t,{baseUrl:xc.spelling("baseURL"),withXsrfToken:xc.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&hs.merge(o.common,o[t.method]);o&&hs.forEach(["delete","get","head","post","put","patch","query","common"],e=>{delete o[e]}),t.headers=Es.concat(i,o);const a=[];let s=!0;this.interceptors.request.forEach(function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;s=s&&e.synchronous;const n=t.transitional||Bs;n&&n.legacyInterceptorReqResOrdering?a.unshift(e.fulfilled,e.rejected):a.push(e.fulfilled,e.rejected)});const c=[];let u;this.interceptors.response.forEach(function(e){c.push(e.fulfilled,e.rejected)});let l,d=0;if(!s){const e=[Ic.bind(this),void 0];for(e.unshift(...a),e.push(...c),l=e.length,u=Promise.resolve(t);d{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null}),this.promise.then=e=>{let t;const r=new Promise(e=>{n.subscribe(e),t=e}).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e(function(e,r,o){n.reason||(n.reason=new Qs(e,r,o),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;const t=new Dc(function(t){e=t});return{token:t,cancel:e}}}const Mc=Dc;const Bc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Bc).forEach(([e,t])=>{Bc[t]=e});const jc=Bc;const Hc=function e(t){const n=new Uc(t),r=va(Uc.prototype.request,n);return hs.extend(r,Uc.prototype,n,{allOwnKeys:!0}),hs.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(uc(t,n))},r}(Ys);Hc.Axios=Uc,Hc.CanceledError=Qs,Hc.CancelToken=Mc,Hc.isCancel=qs,Hc.VERSION=wc,Hc.toFormData=Cs,Hc.AxiosError=ks,Hc.Cancel=Hc.CanceledError,Hc.all=function(e){return Promise.all(e)},Hc.spread=function(e){return function(t){return e.apply(null,t)}},Hc.isAxiosError=function(e){return hs.isObject(e)&&!0===e.isAxiosError},Hc.mergeConfig=uc,Hc.AxiosHeaders=Es,Hc.formToJSON=e=>Js(hs.isHTMLForm(e)?new FormData(e):e),Hc.getAdapter=Oc.getAdapter,Hc.HttpStatusCode=jc,Hc.default=Hc;const Gc=Hc,Wc={AUTH0_SUB_COOKIE_KEY:"auth0_sub",ENTITLEMENT_COOKIE_KEY:"mng-entitlements",LOCAL_STORAGE_SESSION_KEY:"__MNG_Session",REGWALL_USER_IS_SUBSCRIBED:"regwallUserIsSubscribed",USER_IS_LOWA:"entitled",SLO_FLAG:"slo_flag",AB_TESTING_COOKIE:"_matheriSegs",ARTICLES_REMAINING_KEY:"articlesRemaining",USER_PROFILE_HASH:"user-profile"};function Kc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fc(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{}).timeout,r=Date.now();if(this.readyResolved&&!0===this.readyValue)return a("BlueConicUtils | blueConicReady | returning cached value:",this.readyValue),Promise.resolve(!0);if(this.readyPromise)return a("BlueConicUtils | blueConicReady | returning existing promise"),this.readyPromise;var o=null!=n?n:e.DEFAULT_TIMEOUT;return a("BlueConicUtils | blueConicReady | checking BC readiness"),this.readyPromise=new Promise(function(e){var n,i=setTimeout(function(){t.readyResolved||(a("BlueConicUtils | blueConicReady | timeout at:",(Date.now()-r)/1e3,"s"),t.resolveReady(!1,e))},o);if(null!==(n=window.blueConicClient)&&void 0!==n&&n.profile)return a("BlueConicUtils | blueConicReady | BC already ready"),void t.resolveReady(!0,e);var s=function(){var n;if(!t.readyResolved)if(null!==(n=window.blueConicClient)&&void 0!==n&&n.event){a("BlueConicUtils | blueConicReady | BC client detected");var o=window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){clearTimeout(i),a("BlueConicUtils | blueConicReady | onReady fired at:",(Date.now()-r)/1e3,"s"),null==o||o(),t.resolveReady(!0,e)})}else setTimeout(s,500)};s()}),this.readyPromise}},{key:"resolveReady",value:function(e,t){this.readyResolved||(a("BlueConicUtils | blueConicReady | resolved with:",e),this.readyResolved=!0,this.readyValue=e,t(e),!1===e&&(this.readyPromise=null,this.readyResolved=!1))}}])}();l(Jc,"DEFAULT_TIMEOUT",3e3);const zc=new Jc;var Vc,Yc;function Zc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Qc().hostname;if(e&&"string"==typeof e&&e.length>0&&(t=e,e.includes("vipdev.lndo.site")))return"".concat(e.split(".")[0],".com");var n=t.split(".");return"".concat(n[n.length-2],".").concat(n[n.length-1])},tu=function(){var e=eu();return".".concat(e)},nu=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(a("Setting cookie with options: ",n),Object.entries(n).forEach(function(e){var t=p(e,2),n=t[0],o=t[1];if("expires"===n){var i=new Date;i.setTime(i.getTime()+24*o*60*60*1e3),r+="expires=".concat(i.toUTCString(),";")}else r+="".concat(n,"=").concat(o,";")})):r+="path=/;",document.cookie=r},ru=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r="".concat(e,"= ;expires= Thu, 01 Jan 1970 00:00:00 GMT;"),o=eu(),i=[o,"www".concat(o),".www".concat(o)];n&&i.push(n),Object.entries(t).forEach(function(e){var t=p(e,2),n=t[0],o=t[1];r+="".concat(n,"=").concat(o,";")}),0===Object.keys(t).length&&(r+="path=/;"),document.cookie=r,i.forEach(function(e){document.cookie=r.concat("domain=",e,";")})},ou=function(){return Qc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},iu=function(e){return function(e,t){if("string"!=typeof e)throw new f("Invalid token specified: must be a string");t||(t={});const n=!0===t.header?0:1,r=e.split(".")[n];if("string"!=typeof r)throw new f(`Invalid token specified: missing part #${n+1}`);let o;try{o=m(r)}catch(e){throw new f(`Invalid token specified: invalid base64 for part #${n+1} (${e.message})`)}try{return JSON.parse(o)}catch(e){throw new f(`Invalid token specified: invalid json for part #${n+1} (${e.message})`)}}(e)},au=function(){var e=eu();return["mcall.com","courant.com","sun-sentinel.com","orlandosentinel.com","growthspotter.com","dailypress.com","pilotonline.com","nydailynews.com","baltimoresun.com","capitalgazette.com","chicagotribune.com","trbdevcloud.com"].includes(e)},su=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=eu().split(".")[0],e.prev=1,e.next=2,Gc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return a("Apple Sub Check: Request successful: ",r.data),e.abrupt("return","subscribed"===r.data.status);case 3:return e.abrupt("return",!1);case 4:return e.prev=4,s=e.catch(1),a("Apple Sub Check: Request Failure: ",s),e.abrupt("return",!1);case 5:case"end":return e.stop()}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),cu=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Gc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(ou())),headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:return n=e.sent,e.abrupt("return",n.data.encryptedUuid);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),uu=function(){return"complete"===document.readyState},lu=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(uu())t();else{a("UIHandler: ","Waiting for the body to load...");var i=setInterval(r(o.mark(function r(){return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e&&(n=uu()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},du=function(){return new Promise(function(e){if(uu())e();else{a("UIHandler: ","Waiting for the log-in-button class to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:document.getElementsByClassName("log-in-button").length>1&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),200)}})},hu=function(){return new Promise(function(e){if(("interactive"===document.readyState||uu())&&window.dataLayer)a("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{a("Utils digisubsDataLayerLoaded: ","Waiting for the dataLayer to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:window.dataLayer&&window.dataLayer.length>2&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),50)}})},pu=function(){return new Promise(function(e){if(uu())e();else{a("UIHandler: Employee Debugger: ","Waiting for the digisubs debugger toolbox to load...");var t=setInterval(r(o.mark(function n(){return o.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:document.getElementById("employee-debugger-content")&&(clearInterval(t),e(!0));case 1:case"end":return n.stop()}},n)})),200)}})},fu=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,hu();case 1:return a("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",a("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return a("Utils dataLayerLoop: look for this element ",e),e[t]?(a("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(a("Utils dataLayerLoop: dataLayer search ",!1),!1)},i=window.dataLayer.some(r),e.abrupt("return",i?n:"");case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),mu=function(){var e=r(o.mark(function e(){var t,n,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:"Page Type",e.next=1,fu(t);case 1:return n=e.sent,a("utils | pageType: page type is ",n),e.abrupt("return",n);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),gu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("blueConicProfileReady | Waiting for BC Profile to be ready."),!window.blueConicClient||!window.blueConicClient.getSegments&&!window.blueConicClient.profile){e.next=1;break}return a("blueConicProfileReady | BC getSegments is ready."),e.abrupt("return",!0);case 1:return e.abrupt("return",new Promise(function(e){var t=window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){a("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),null==t||t(),e(!0)});setTimeout(function(){null==t||t(),a("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)}));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yu=function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,zc.blueConicReady();case 1:if(t=e.sent,a("bcGetAuth0Id | BC loaded:",t),!t){e.next=5;break}return e.next=2,gu();case 2:if(n=e.sent,a("bcGetAuth0Id | profile ready:",n),n){e.next=3;break}return e.abrupt("return",!1);case 3:return r=blueConicClient.profile.getProfile(),e.next=4,new Promise(function(e){r.loadValues(["auth0_id"],null,function(){e()})});case 4:return i=r.getValue("auth0_id"),a("bcGetAuth0Id | auth0_id:",i),e.abrupt("return",i);case 5:return e.abrupt("return",!1);case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),wu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]&&h[0],n=!1,i=["MICH LOWA","OHIO LOWA","PENN LOWA","NY LOWA","BOSTON LOWA","NORCAL LOWA","TWIN CITIES LOWA","DENV/PMP LOWA","SCNG LOWA","BANG LOWA","AMC LOWA","HC LOWA","GS LOWA","ORL LOWA","SS LOWA","NNDP LOWA","VP LOWA","NYDN LOWA","BAL LOWA","CG LOWA","CHI LOWA"],e.next=1,zc.blueConicReady();case 1:if(s=e.sent,a("bcLowaCheck | BC load status: ",s),!s){e.next=3;break}if(c=window.blueConicClient.getSegments(),a("bcLowaCheck | BC segments for users: ",c),u=c.filter(function(e){return i.includes(e.name)}),a("bcLowaCheck | BC userSubSegments: ",u),!(u.length>0)){e.next=3;break}return e.next=2,yu();case 2:(l=e.sent)&&(n=!0,r=l);case 3:return t&&n&&bu(),d={isSub:n},r&&(d.uuid=r),e.abrupt("return",d);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),bu=function(){nu("bc_lowa_status",1,{path:"/",domain:tu(),expires:7,secure:!0})},vu=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(a("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(a("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};a("utils | Event: authentication ready: ",r),e(r)}catch(e){a(e),t(e)}},!1))})},Eu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){return i.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(a("Entitlements already present:",window.MNGAuthentication.entitlementsReady),void e(window.MNGAuthentication.entitlementsReady)):void window.addEventListener("entitlementsReady",function(n){try{var r=n.detail||{};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.entitlementsReady=r,a("Received entitlementsReady event:",r),e(r)}catch(e){s("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(a("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Su=function(){a("Clearing entitlements...");try{ru(Wc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){a("Failed to delete legacy cookie: ",e)}try{ru(Wc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:eu(),expires:365,secure:!0})}catch(e){a("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Wc.LOCAL_STORAGE_SESSION_KEY)}catch(e){a("Failed to remove local storage: ",e)}},Au=function(){ru(Wc.AUTH0_SUB_COOKIE_KEY),ru("mng-jwt-decoded"),localStorage.removeItem(Wc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),Su()},ku=function(){var e=Qc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},Tu=function(e){a("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),a("Storage Object removed : ",e))},_u=function(e){a("starting simpleEmailValidation");if(!e)return{valid:!1,message:"Please enter an email."};if(!/^(([^<>()[\]\\.,;:\s@']+(\.[^<>()[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i.test(e))return{valid:!1,message:"Please enter a valid email."};var t=e.match(/\.([^.\n\s]*)$/)[1].toUpperCase(),n=["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"].includes(t);return a("simpleEmailValidation: ","TLD search ".concat(n)),!1===n?{valid:!1,message:"Please enter a valid email domain."}:-1===["zzz.pl"].findIndex(function(t){return t===e.split("@")[1]})?{valid:!0,message:"Valid"}:{valid:!1,message:"Please enter a valid email."}};window.simpleEmailValidation=_u;var Ou;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Ru=function(){var e=r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===Ou){e.next=1;break}return e.abrupt("return",Ou);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Ou=new ba({domain:t,clientId:n,cacheLocation:"localstorage",useRefreshTokens:!0,useRefreshTokensFallback:!0,authorizationParams:{audience:"access-extension",scope:"openid email profile user_metadata app_metadata offline_access"}}),e.abrupt("return",Ou);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Iu=function(e){a("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,a("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),a("utils | Dispatched authenticationReady event"),Yc=new CustomEvent("mng-auth-check-complete",{detail:e}),Vc?(a("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(Yc)):a("Islands not ready")};var Cu=function(){var e=window.localStorage.getItem("__MNG_Session");if(e){var t=JSON.parse(e);if(t.idToken){var n=iu(t.idToken);if(n.home_paper)return a("Util.js | home paper: Home paper is ",n.home_paper),n.home_paper.replace("www.","").replace("develop.","").replace("preprod.","").replace("staging.","")}}return a("Util.js | home paper: Home paper is not set ",ou()),ou()},Nu=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Lu=function(){var e=r(o.mark(function e(t){var n,r,s,u,l,d;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,a("deleteUserCache","Setting up cache deletion for ".concat(t)),n=ou(),a("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,Gc({method:"DELETE",url:"".concat(i.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":i.A.entitlementsApiKey}});case 1:if(s=e.sent,u=s.data,l=/Succesfully deleted/i,!("object"===c(u)&&Object.prototype.hasOwnProperty.call(u,"message"))||!l.test(u.message)){e.next=2;break}return a("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return a("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(u)),e.abrupt("return",{success:!1});case 3:return e.prev=3,d=e.catch(0),a("deleteUserCache","Cache deletion error for ".concat(t,": ").concat(d)),e.abrupt("return",{success:!1});case 4:case"end":return e.stop()}},e,null,[[0,3]])}));return function(t){return e.apply(this,arguments)}}(),xu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;return new Promise(function(t,n){var i={sspw:null,sophiClient:null,engagePaywall:null,engageStatus:null},s=function(){var s=r(o.mark(function r(){var s,c,u,l,d,h,p,f,m,g,y;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,"1"!==(null===(s=window.sophi_config)||void 0===s?void 0:s.enableSophiSSPW)){r.next=1;break}if(!document.getElementById("server-paywall")){r.next=1;break}return i.sspw=!0,r.abrupt("return",t({paywall:!0,details:qc({},i)}));case 1:return r.next=2,mu();case 2:return u=r.sent,r.next=3,fu("Paywall_Level");case 3:if(l=r.sent,"article"===u&&"free"!==l){r.next=4;break}return r.abrupt("return",t({paywall:!1,details:"article"!==u?"Page type is not an article":"Free article"}));case 4:return r.next=5,Eu();case 5:if(!(d=r.sent)||!d.isEntitled){r.next=6;break}return r.abrupt("return",t({paywall:!1,details:"Entitled User"}));case 6:if("premium"!==l){r.next=7;break}return r.abrupt("return",t({paywall:!0,details:"Premium article"}));case 7:if(h=null===(c=window.ConnextUtils)||void 0===c?void 0:c.runningSophi,a("checkPaywallStatus - Sophi is running: ",h),!h){r.next=8;break}window.ConnextUtils.connextAlreadyRan&&window.sophiWallConfig&&!window.sophiWallConfig.error&&"paywall"===window.sophiWallConfig.wallType?(i.sophiClient=!0,i.engageStatus=!0,i.engagePaywall=!0):window.addEventListener("onPaywallShown",function(){return"paywall"===window.sophiWallConfig.wallType&&(i.sophiClient=!0),t({paywall:!0,details:qc({},i)})},{once:!0}),r.next=12;break;case 8:if(h){r.next=12;break}return p=window.ConnextUtils.connextReady("onPaywallShown",!1),f=new Promise(function(t,n){return setTimeout(function(){return n(new Error("No Engage paywall within 10 seconds, resolving as no paywall."))},e)}),r.prev=9,r.next=10,Promise.race([p,f]);case 10:!0===(m=r.sent)?(i.engagePaywall=!0,i.engageStatus="Engage paywall detected"):(i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(m)),r.next=12;break;case 11:r.prev=11,g=r.catch(9),i.engagePaywall=!1,i.engageStatus="Engage response: ".concat(g);case 12:return r.abrupt("return",t({paywall:Object.values(i).some(function(e){return e}),details:qc({},i)}));case 13:r.prev=13,y=r.catch(0),n(y);case 14:case"end":return r.stop()}},r,null,[[0,13],[9,11]])}));return function(){return s.apply(this,arguments)}}();s()})},Pu=function(e){return a("is7DaySub: Checking 7-day subscription status"),e?/7day/i.test(e)?(a("is7DaySub: Found 7-day subscription ",e),!0):(a("is7DaySub: Is not 7-day subscription"),!1):(a("is7DaySub: No service code provided"),!1)};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=xu);var Uu="#primary-menu",Du="#pushnav",Mu=".log-in-button",Bu=".subscribe-visibility",ju=".log-out-button",Hu="dfm-digisubs-menu",Gu="digisubs-push-container",Wu="dfm-digisubs-push-menu",Ku="mega-subscribe-button",Fu=function(){return document.querySelector(Uu)},Xu=function(){return document.querySelector(Du)},Ju=function(){return document.getElementById(Hu)},zu=function(){return document.getElementById(Gu)},Vu=function(){return document.getElementById(Wu)},Yu=function(){return Ju()?Ju().querySelector(Mu):null},Zu=function(){return Vu()?Vu().querySelector(Mu):null},qu=function(){return Zu()?Zu().querySelector("a"):null},Qu=function(){return document.getElementById(Ku)},$u=function(){return Xu()?Xu().querySelector(Mu):null},el=function(){return $u()?$u().querySelector("a"):null},tl=function(){return document.querySelectorAll(Mu)},nl=function(){return document.querySelectorAll(Bu)},rl=function(){var e=document.querySelectorAll("".concat(Bu," a"));return e.length>0?e[0]:null};function ol(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var il=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,zc.blueConicReady();case 1:return e.next=2,vu();case 2:return e.abrupt("return",new Promise(function(e){a("ANALYTICS: inside BCregwall events");var t=Qc();t.searchParams.delete("regwall");var n=blueConicClient.profile.getProfile();localStorage.setItem("regwallSuccess","yes"),localStorage.setItem("regwallEvent","yes"),n.setValue("bang_reg_wall_status","Y"),n.setValue("regwall_newspaper",t.host),n.setValue("regwall_success_date",new Date),n.setValue("regwall_success","yes"),blueConicClient.profile.updateProfile(),e(!0)}));case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),al=function(e){try{window.dataLayer.push({event:e}),a("ANALYTICS: ".concat(e," event")),a("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){a("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var sl=function(){try{var e=localStorage.getItem(Wc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){a("Unable to get session from local storage: ",e)}return"{}"},cl=function(e){try{a("Setting local storage session",e),localStorage.setItem(Wc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){a("Unable to save session from local storage: ",e)}},ul=function(e){try{nu(Wc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:tu(),expires:365,secure:!0})}catch(e){a("Unable to save session to cookie storage: ",e)}},ll=function(){var e=r(o.mark(function e(){var t,n,r,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Checking server session: ",n),e.next=1,Gc.get(n,{withCredentials:!0});case 1:if(!(r=e.sent).data){e.next=2;break}return h=r.data.entitlementTokenDecoded,p=r.data,f=p.accessToken,m=p.idToken,g=p.entitlementToken,y=null!==(s=null==h?void 0:h.entitlement_expiry)&&void 0!==s?s:null,w=null!==(c=null==h?void 0:h.entitlement_source)&&void 0!==c?c:null,b=null!==(u=null==h?void 0:h.entitlement_entitled)&&void 0!==u?u:null,v=null!==(l=null==h?void 0:h.entitlement_extras_adfree)&&void 0!==l?l:null,E=null!==(d=null==h?void 0:h.entitlement_level)&&void 0!==d?d:null,cl(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:E})),""!==g&&"string"==typeof g&&ul(g),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:E});case 2:return e.abrupt("return",{accessToken:null,idToken:null,entitlementToken:null,expiration:null,entitlementSource:null,isEntitled:null,adFree:null,entitlementLevel:null});case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),dl=function(){var e=r(o.mark(function e(t){var n,r,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=i.A.sessionServer,r="".concat(n,"/api/session"),a("Updating server session: ",r),e.next=1,Gc.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,s=e.catch(0),a("Failed to update session server: ",s);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),hl=function(){var e=r(o.mark(function e(){var t,n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=i.A.sessionServer,n="".concat(t,"/api/session"),a("Deleting server session: ",n),e.next=1,Gc.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),a("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),pl=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S,A,k,T,_,O,R,I,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Inside getSession"),e.prev=1,d=sl(),a("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,g=h.expiration,y=h.entitlementSource,w=h.isEntitled,b=h.adFree,v=h.entitlementLevel,n=p,i=g,s=y,c=w,u=b,l=v,a("Session: check both tokens: ",t=f,r=m),void 0!==f&&void 0!==m&&null!==f&&null!==m){e.next=3;break}return a("Session: missing id or entitlements, try session server"),e.next=2,ll();case 2:E=e.sent,S=E.accessToken,A=E.idToken,k=E.entitlementToken,T=E.expiration,_=E.entitlementSource,O=E.isEntitled,R=E.adFree,I=E.entitlementLevel,n=S,t=A,r=k,i=T,s=_,c=O,u=R,l=I;case 3:e.next=5;break;case 4:e.prev=4,C=e.catch(1),a("Failed to get session: ",C);case 5:return a("Returning session: ",t,n,r),e.abrupt("return",{accessToken:n,idToken:t,entitlementToken:r,expiration:i,entitlementSource:s,isEntitled:c,adFree:u,entitlementLevel:l});case 6:case"end":return e.stop()}},e,null,[[1,4]])}));return function(){return e.apply(this,arguments)}}(),fl=function(){var e=r(o.mark(function e(t){var n,r,i,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S,A,k,T,_,O,R,I,C,N,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=sl(),r=JSON.parse(n),i=r.accessToken,s=void 0===i?null:i,c=r.idToken,u=void 0===c?null:c,l=r.entitlementToken,d=void 0===l?null:l,h=r.expiration,p=void 0===h?null:h,f=r.entitlementSource,m=void 0===f?null:f,g=r.isEntitled,y=void 0===g?null:g,w=r.adFree,b=void 0===w?null:w,v=r.entitlementLevel,E=void 0===v?null:v,S=t.accessToken,A=t.idToken,k=t.entitlementToken,T=t.expiration,_=t.entitlementSource,O=t.isEntitled,R=t.adFree,I=t.entitlementLevel,C={accessToken:S??s,idToken:A??u,entitlementToken:k??d,expiration:T??p,entitlementSource:_??m,isEntitled:O??y,adFree:R??b,entitlementLevel:I??E},a("Current session data: ",r),a("New session data: ",t),a("Updated session data:",C),N=JSON.stringify(C),cl(N),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&ul(C.entitlementToken),n===N){e.next=1;break}return e.next=1,dl(C);case 1:e.next=3;break;case 2:e.prev=2,L=e.catch(0),a("Unable to save session: ",L);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),ml=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Ending session..."),Au(),e.next=1,hl();case 1:localStorage.removeItem(Wc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),gl="1"===window.authentication_config.isEmbedLoginEnabled,yl=function(){return"logout"===(Qc().searchParams.get("state")||"").toLowerCase()};gl||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[],window.MNGAuthentication.oidcLoginCallbacks=[]);var wl=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Ru();case 1:n=e.sent,a("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),bl=function(){return"undefined"==typeof CnnXt?(a("Connext was not loaded."),!1):Connext.Storage.GetUserState()},vl=function(){a("Check for SS paywall Cookie");var e=window.location.hostname,t=document.cookie.split(";").find(function(e){return e.trim().startsWith("vip-go-seg=vc-v1__has_access")});if(/^(?!:\/\/)([a-zA-Z0-9-_]{1,63}\.?)+[a-zA-Z]{2,6}$/.test(e)&&t){a("SS paywall Cookie found, removing it");var n=t.split("=")[0].trim();document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; domain=").concat(e),document.cookie="".concat(n,"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}},El=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Attempting to logout..."),vl(),a("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(Wc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?iu(n):"")){e.next=2;break}return s=i.auth0Id,e.next=1,Lu(s);case 1:e.sent.success?a("User cache cleared."):a("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,ml();case 3:e.next=5;break;case 4:Au();case 5:return e.prev=5,a("Cycling through logout callbacks..."),c=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(c);case 6:a("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,p=e.catch(5),a("Failed to cycle through logout callbacks: ",p);case 8:Object.keys(window.localStorage).filter(function(e){return e.includes("auth0")}).forEach(function(e){window.localStorage.removeItem(e),a("Removed Auth0 storage object...")}),Tu("hhsl"),Tu("userNewsLetterData"),Tu(Wc.REGWALL_USER_IS_SUBSCRIBED),Tu(Wc.USER_PROFILE_HASH),u=Qc(),l=window.location.origin;try{u.searchParams.get("returnURL")&&(d=decodeURIComponent(u.searchParams.get("returnURL")),l=d)}catch(e){a(e),l=window.location.origin}return l=new URL(l),e.next=9,window.ConnextUtils.connextReady("onInit",!1);case 9:if(!e.sent){e.next=16;break}if(a("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),a("Auth | Run connext manually if Silent Mode is on."),window.ConnextUtils.rerunConnextEntitlements(!0),h=l,l.origin!==window.location.origin&&(h=new URL(window.location.origin)).searchParams.append("returnAfterLogout",l),window.history.replaceState({additionalInformation:"Updated the URL to prevent another login cycle"},"Home",h),!ku()){e.next=10;break}a("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==bl()){e.next=14;break}if(a("Connext user state is logged in, setting timeout..."),setTimeout(r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Connext took too long to logout, calling auth0 logout..."),e.next=1,wl(l);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return a("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return a("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return a("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,wl(l);case 15:e.next=17;break;case 16:return a("Connext Logout was NOT called"),e.next=17,wl(l);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Sl=function(){var e=0;for(var t in window.localStorage){var n=2*window.localStorage[t].length/1024/1024;!Number.isNaN(n)&&window.localStorage.hasOwnProperty(t)&&(e+=n)}return e},Al=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return al(e)}),a("Cycled through preauth GTM events.")},kl=function(){var e=r(o.mark(function e(t,n,r,i,s){var c,u,l,d,h,p,f,m,g,y,w,b,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Attempting to login..."),Sl()>4.5&&window.localStorage.clear(),Al(),i&&(c=[],u=window.localStorage.getItem("callbackEvents"),l=JSON.parse(u),c=l&&l.length>0?ol(new Set([].concat(ol(i),ol(l)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),d=null,e.next=1,Ru();case 1:if(h=e.sent,p=Qc(),f=p.origin,m=new URL("".concat(f,"/callback")),g={},p.searchParams.get("regwall")&&(p.searchParams.get("returnUrl")&&(y=p.searchParams.get("returnUrl")),p.searchParams.get("auth_redirect")&&(y=p.searchParams.get("auth_redirect"))),p.pathname.startsWith("/login")||p.pathname.startsWith("/callback")?p.searchParams.get("returnUrl")?m.searchParams.set("auth_redirect",p.searchParams.get("returnUrl")):s&&m.searchParams.set("auth_redirect",s):m.searchParams.set("auth_redirect",p.toString()),y&&"regwall"!==t&&m.searchParams.set("auth_redirect",y),"true"===p.searchParams.get("close-after-finish")&&m.searchParams.set("close-after-finish","true"),"true"!==p.searchParams.get("ssl")){e.next=4;break}if(!window.authentication_config.sessionManagementEnabled){e.next=3;break}return e.next=2,ml();case 2:e.next=4;break;case 3:Au();case 4:return null!==(d=p.searchParams.get("login-with"))?g.connection=d:n&&(g.connection=n),w="none",t&&"regwall"===t&&(m.searchParams.set("regwall","true"),w="signUp",a("Logging in with regwall")),t&&(m.searchParams.set("loginsource",t),a("Logging in with ".concat(t))),r&&(g.login_hint=r),g.redirect_uri=m.toString(),g.initialScreen=w,"googleonetap"!==t&&(g.prompt="select_account"),null!==(b=p.searchParams.get("ampRegiWall"))&&(v=window.location.hostname,g.ampRegiWall=b,g.sourceDomain=v.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),g.initialScreen="signUp",g.preferenceId=p.searchParams.get("prefId")),e.next=5,h.loginWithRedirect({authorizationParams:g});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),Tl=function(){return new Promise(function(e){var t=setTimeout(function(){e()},8e3);try{var n=window.localStorage.getItem("callbackEvents"),r=JSON.parse(n);if(!r||0===r.length)return void e();a("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){a("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};a("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){a(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){a("Failed to wait for callback events",t),e()}})},_l=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S,A,k,T;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(vl(),t=Qc(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),s=t.searchParams.get("redirect_uri")||"",s.includes("applenews")?(a("This is Apple prelogin flow."),(c=new URL(s))?(c.searchParams.append("post-apple-login","true"),a("Post callback Apple redirect URL is ".concat(c)),kl(!1,!1,!1,[],c)):kl()):i.includes("post-apple-login")&&(a("This is Apple Callback flow."),n=!0,(u=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=u),a("Handling post login callback..."),!(l=t.searchParams.get("error_description"))){e.next=2;break}if("shouldAutoLogin"!==l){e.next=1;break}return e.abrupt("return",kl(!1,!1,!1,!1,i));case 1:n&&alert("There was an error in logging you in, please try again.");case 2:return e.next=3,Ru();case 3:return d=e.sent,e.next=4,d.handleRedirectCallback();case 4:return e.next=5,d.getIdTokenClaims();case 5:return h=e.sent,e.next=6,d.getUser();case 6:return p=e.sent,a("Auth0 user profile: ",p),f=h.__raw,e.next=7,d.getTokenSilently();case 7:return m=e.sent,e.prev=8,a("Cycling through login callbacks..."),e.next=9,Tl();case 9:return g=window.MNGAuthentication.oidcLoginCallbacks.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(f));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=10,Promise.all(g);case 10:a("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,A=e.catch(8),a("Failed to cycle through login callbacks: ",A);case 12:if(y={accessToken:m,userId:p.sub,email:p.email,picture:p.picture},w=!1,b="",!n){e.next=17;break}return e.prev=13,e.next=14,cu(y.userId);case 14:return b=e.sent,a("Encrypted apple uuid is: ".concat(b)),e.next=15,su(b);case 15:w=e.sent,a("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,k=e.catch(13),a("Apple sub check error: ".concat(k)),alert("There was an error in logging you in, please try again.");case 17:if(Tu(Wc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return a("Saving idToken to session server"),e.next=18,fl({idToken:f,accessToken:m});case 18:if(!t.searchParams.get("close-after-finish")){e.next=19;break}return e.abrupt("return",window.close());case 19:if(!t.search.includes("loginsource")){e.next=20;break}return v=t.searchParams.get("loginsource"),E=window.MNGAuthentication.postAuthEvents.map(function(){var e=r(o.mark(function e(t){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t(v));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=20,Promise.all(E);case 20:return e.prev=20,S=new URL(i),n&&w&&S.searchParams.append("access_token",b),a("Apple redirect URL:",S),e.abrupt("return",window.location.assign(S));case 21:return e.prev=21,T=e.catch(20),a("Failed to redirect after authentication: ",T),window.location.assign(new URL(window.location.origin)),e.abrupt("return","Finished execution, please await result...");case 22:case"end":return e.stop()}},e,null,[[8,11],[13,16],[20,21]])}));return function(){return e.apply(this,arguments)}}(),Ol=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("ANALYTICS: fireBC events"),e.next=1,il();case 1:a("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Rl=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,vu();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=iu(n),c=s.email,u=s.picture,l=s.sub,d=s.name,h=s.nickname,p=s.connection_source,f=null===(i=s.user_metadata)||void 0===i||null===(i=i.customProfile)||void 0===i?void 0:i.nickname,l.split("|").pop(),e.abrupt("return",{authenticated:r,nickname:f||h||d,email:c,picture:u,userId:l,connectionSource:p});case 3:e.prev=3,m=e.catch(2),a("Unable to parse idToken: ",n," Error: ",m);case 4:return e.abrupt("return",{authenticated:r});case 5:case"end":return e.stop()}},e,null,[[2,3]])}));return function(){return e.apply(this,arguments)}}();gl||(window.MNGAuthentication.login=kl,window.MNGAuthentication.logout=El,window.MNGAuthentication.getUserInfo=Rl);var Il=function(){var e=r(o.mark(function e(){var t,n,s,u,l,d,h,p,f,m,g,y,w;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!gl){e.next=1;break}return a("Embed login is enabled, skipping auth.js init"),e.abrupt("return");case 1:if(t=Qc(),n=!1,s="",u=!1,l={},yl()&&window.ConnextUtils.rerunConnextEntitlements(!0),t.searchParams.get("returnAfterLogout")&&(d=decodeURIComponent(t.searchParams.get("returnAfterLogout")),window.location.assign(d)),t.searchParams.has("entitlement_jwt")&&(window.authentication_config.sessionManagementEnabled=!1),h=function(){var e=r(o.mark(function e(){var t,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,Ru();case 1:return t=e.sent,e.next=2,t.getIdTokenClaims();case 2:return l=e.sent,e.next=3,t.isAuthenticated();case 3:if(n=e.sent,s="object"===c(l)?l.__raw:"",r=$c(Wc.ENTITLEMENT_COOKIE_KEY),n||!r){e.next=5;break}return e.next=4,t.getTokenSilently();case 4:u=e.sent;case 5:e.next=7;break;case 6:e.prev=6,i=e.catch(0),a("Unable to verify user has active auth0 session: ",i);case 7:case"end":return e.stop()}},e,null,[[0,6]])}));return function(){return e.apply(this,arguments)}}(),!t.pathname.startsWith("/logout")){e.next=3;break}return a("Page is logout. Routing to logout function..."),e.next=2,El();case 2:return e.abrupt("return");case 3:if(!window.authentication_config.sessionManagementEnabled){e.next=10;break}return e.next=4,h();case 4:if(""===s){e.next=6;break}if(p=null,f=JSON.parse(window.localStorage.getItem(Wc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==sl()){e.next=5;break}return f&&(p=f.jwt),e.next=5,fl({idToken:s,entitlementToken:p});case 5:e.next=9;break;case 6:return e.prev=6,e.next=7,pl();case 7:m=e.sent,s=m.idToken,(n="string"==typeof s)&&(l=iu(s)),e.next=9;break;case 8:e.prev=8,w=e.catch(6),a("Unable to initialize session: ",w);case 9:e.next=11;break;case 10:return e.next=11,h();case 11:if(a("Authentication Init | isAuthenticated:",n),a("Authentication Init | accessToken:",u),n||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=13;break}return a("BlueConic LOWA | entering bcLowaCheck"),e.next=12,wu(!0);case 12:g=e.sent,a("BlueConic LOWA | bcLowaCheck result:",g),g.isSub?(a("BlueConic LOWA | authenticated as LOWA"),n=Wc.USER_IS_LOWA,l={sub:g.uuid}):a("BlueConic LOWA | NOT a subscriber");case 13:if(Iu({isAuthenticated:n,idToken:s,accessToken:u,claims:l}),Nu("authenticationReady"),!0===n?(a("User is authenticated."),t.searchParams.get("auth_redirect")&&(a("Auth Redirect is present, sending user to auth redirect..."),(y=t.searchParams.get("auth_redirect")).endsWith("#")&&(y=y.slice(0,y.length)),window.location.assign(y)),t.pathname.startsWith("/login")&&!yl()&&(a("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):a("User is not authenticated."),t.pathname.startsWith("/login")&&!yl()?(a("Page is login. Attempting to log user in..."),kl()):a("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=15;break}return a("Page is callback with regwall param. Routing to regwall receiver..."),e.next=14,Ol();case 14:a("Now login from regwall"),kl(),e.next=16;break;case 15:if(!t.pathname.startsWith("/callback")){e.next=16;break}return a("Page is callback without regwall param. Routing to callback receiver..."),e.next=16,_l();case 16:case"end":return e.stop()}},e,null,[[6,8]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Il;var Cl,Nl,Ll="1"===window.authentication_config.isEmbedLoginEnabled;window.addEventListener("mng-all-islands-ready",function(e){Cl||(Cl=e,Nl&&(a("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",Nl),window.dispatchEvent(Nl)))});var xl=function(e){nu(Wc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:tu(),expires:365,secure:!0})},Pl=function(){var e=r(o.mark(function e(t){var n,r;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,xl(t),a("About to decode token before saving: ",t),n=iu(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,fl({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level});case 1:e.next=3;break;case 2:window.localStorage.setItem(Wc.LOCAL_STORAGE_SESSION_KEY,JSON.stringify({entitlementToken:t,expiration:n.entitlement_expiry,entitlementSource:n.entitlement_source,isEntitled:n.entitlement_entitled,adFree:n.entitlement_extras_adfree||!1,entitlementLevel:n.entitlement_level}));case 3:e.next=5;break;case 4:e.prev=4,r=e.catch(0),a("Entitlements: Failed to save token: ",r);case 5:case"end":return e.stop()}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),Ul=function(){var e=r(o.mark(function e(t){var n,r,u,l,d,h,p,f,m,g;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Entitlements: create token start..."),a("Entitlements: createToken payload with ",t),"object"===c(t)||"string"==typeof t.sub){e.next=1;break}throw new Error("No user info to create token");case 1:if(n=window.location.hostname,r=eu(n),t.sub&&(u=t.sub),t.idToken&&(l=t.idToken),l||u){e.next=2;break}throw new Error("No idToken or uuid provided.");case 2:return d={publication:r.replace("vipdev.lndo.site","com"),requestSource:"website"},l?d.idToken=l:u&&(d.uuid=u),h="".concat(i.A.entitlementsEndpoint,"session/create"),a("Entitlements: create payload",d),e.prev=3,e.next=4,$.ajax({type:"POST",url:h,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":i.A.entitlementsApiKey},data:JSON.stringify(d)});case 4:if("boolean"!=typeof(p=e.sent).success){e.next=6;break}if(p.success){e.next=5;break}return e.abrupt("return",new Error("Entitlements | API returned no JWT"));case 5:f=p.data.jwt,a("Entitlements: Token Created: ",f),e.next=7;break;case 6:f=p.jwt;case 7:return e.next=8,Pl(f);case 8:return e.abrupt("return",f);case 9:if(e.prev=9,m=e.catch(3),a("Entitlements: Create Token Failure: ",m),Su(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,fl({entitlementToken:null});case 11:e.next=13;break;case 12:e.prev=12,g=e.catch(10),s("Entitlements: Save Session Failure during error handling: ",g);case 13:throw new Error("Entitlements Refresh failure");case 14:case"end":return e.stop()}},e,null,[[3,9],[10,12]])}));return function(t){return e.apply(this,arguments)}}();Ll||(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(Wc.LOCAL_STORAGE_SESSION_KEY));return null!=t?(a("Ad Free Check: : ",t.adFree),(t.idToken||null!==(e=window.MNGAuthentication)&&void 0!==e&&null!==(e=e.authenticationReady)&&void 0!==e&&e.idToken)&&t.adFree||i.A.isAdfreeArticle):i.A.isAdfreeArticle},window.MNGAuthentication.isUserSubscriber=function(){var e=JSON.parse(window.localStorage.getItem(Wc.LOCAL_STORAGE_SESSION_KEY));return null!=e&&(a("Subscriber Check: : ",e.isEntitled),e.isEntitled)});var Dl=function(e,t){var n=e.toLowerCase(),r="";return["@medianewsgroup.com","@tribpub.com","@activeone.co"].forEach(function(e){t&&t.endsWith(e)&&(r="corporate")}),!!n.includes("employee")&&{employeeAccess:!0,accessGroup:r}},Ml=function(e){return new Promise(function(t,n){a("Entitlements: get UUID from email start...");var r=au(),o=eu(),c="".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(e,"?all=true&spoofUser=true&domain=").concat(o);$.ajax({type:"GET",url:c,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":i.A.entitlementsApiKey}}).then(function(e){a("Entitlements: Request successful: ",e);var n=e&&e.identities&&e.identities.find(function(e){return r?"Trib"===e.connection.split("-")[0]:"Trib"!==e.connection.split("-")[0]});if(!n)return a("Entitlements: No matching user identity found."),t(!1);var o=JSON.stringify(e),i=btoa(encodeURIComponent(o));localStorage.setItem("spoofed-user-profile",i);var s={uuid:n.user_id,provider:n.provider};return t(s)}).catch(function(e){s("Entitlements: UUID request Failure: ",e),n(e)})})},Bl=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,t){var n=Connext,r={},o=!1,i=setTimeout(function(){o=!0,clearInterval(s),t(new Error("Timeout: User state did not change within the specified time"))},2e4),s=setInterval(function(){var t=n.Storage.GetUserState();a("Employee tools: Checking Connext UserState, state is: ".concat(t)),void 0!==t&&"Logged Out"!==t&&(r.conversation=n.Storage.GetCurrentConversation().Name,r.userState=t,r.campaign=n.Storage.GetLocalConfiguration().Campaign.Name,r.meter=n.Storage.GetLocalConfiguration().DynamicMeter.Name,clearInterval(s),clearTimeout(i),e(r))},600);o&&(clearInterval(s),t(new Error("Timeout: User state did not change within the specified time")))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),jl=function(){function e(t,n,r){Kc(this,e),this.source=t,this.email=n,this.employeeId=r,this.spoofContent=document.createElement("p"),this.spoofBanner=document.createElement("div")}return Xc(e,[{key:"clearSpoofedUser",value:(i=r(o.mark(function t(){var n;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return document.getElementById("spoof-banner").remove(),this.userSpoofCheckbox.checked=!1,e.deleteLocalStorageSpoofUser(),t.next=1,Ul({sub:this.employeeId,email:this.email,email_verified:!0});case 1:if(n=t.sent,!window.authentication_config.sessionManagementEnabled){t.next=3;break}return t.next=2,hl();case 2:return t.next=3,fl({idToken:this.idToken,entitlementToken:n});case 3:window.sessionStorage.removeItem("dashboard-state"),window.location.reload();case 4:case"end":return t.stop()}},t,this)})),function(){return i.apply(this,arguments)})},{key:"handleUserSpoofAction",value:(n=r(o.mark(function t(n){var r,i,s,c,u,l,d;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a("employee tools: handling spoof"),t.next=1,vu();case 1:if(r=t.sent,i=r.idToken,s=localStorage.getItem(Wc.USER_PROFILE_HASH),!n.target.checked){t.next=12;break}if(c=window.prompt("Enter the email of the user you want to spoof:")){t.next=2;break}return n.target.checked=!1,t.abrupt("return");case 2:return this.userSpoofCheckbox.checked=!0,this.addSpoofBannerToPage("Fetching entitlements for ".concat(c," ..."),"greenyellow"),t.prev=3,t.next=4,Ml(c);case 4:if(u=t.sent,a("employee tools: spoof user data: ",u),u&&"string"==typeof u.uuid){t.next=5;break}return this.spoofBanner.style.backgroundColor="red",this.spoofContent.textContent="User could not be found with that address, check for typos.",this.userSpoofCheckbox.checked=!1,t.abrupt("return");case 5:return t.next=6,Ul({sub:"".concat(u.provider,"|").concat(u.uuid),email:c,email_verified:!0});case 6:if(l=t.sent,!window.authentication_config.sessionManagementEnabled){t.next=9;break}return t.next=7,hl();case 7:return t.next=8,fl({idToken:i,entitlementToken:l});case 8:e.deleteLocalStorageManualExpiration();case 9:window.localStorage.setItem("spoof-user",c),window.sessionStorage.removeItem("dashboard-state"),e.removeUserProfileHash(s),window.location.reload(),t.next=11;break;case 10:t.prev=10,d=t.catch(3),a("Error fetching user spoof entitlements",d),this.spoofBanner.style.backgroundColor="red",this.spoofContent.textContent="Error fetching user entitlements",this.userSpoofCheckbox.checked=!1;case 11:t.next=13;break;case 12:return e.deleteLocalStorageManualExpiration(),e.removeUserProfileHash(s),t.next=13,this.clearSpoofedUser();case 13:case"end":return t.stop()}},t,this,[[3,10]])})),function(e){return n.apply(this,arguments)})},{key:"addEventListeners",value:function(){document.getElementById("user-spoof-control").addEventListener("click",this.handleUserSpoofAction.bind(this)),document.getElementById("expiration-control").addEventListener("change",function(t){var n=document.getElementById("datepicker-wrapper");!0===t.currentTarget.checked?n.classList.contains("show-picker")||n.classList.add("show-picker"):(n.classList.contains("show-picker")&&n.classList.remove("show-picker"),window.localStorage.getItem("manual-expiration")&&(window.localStorage.removeItem("manual-expiration"),clearInterval(e.interval),document.getElementById("expiration-pop-up").remove()))})}},{key:"addSpoofBannerToPage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"deeppink";a("employee tools: add spoof banner");var n=document.getElementById("page").querySelector("header");this.spoofBanner.style.backgroundColor=t,this.spoofBanner.id="spoof-banner",this.spoofContent.textContent=e,this.spoofBanner.append(this.spoofContent),n.prepend(this.spoofBanner)}},{key:"init",value:(t=r(o.mark(function t(){var n,i,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S,A,k,T,_,O,R,I;return o.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(window.MNGAuthentication.logoutCallbacks.push(e.deleteLocalStorageSpoofUser),n=window.localStorage.getItem("spoof-user"),i=window.localStorage.getItem("manual-expiration"),s=Dl(this.source,this.email),a("employee tools: validate employee:",s),this.email&&this.employeeId&&(n||!this.source||s.employeeAccess&&"corporate"===s.accessGroup)&&(this.source||n)){t.next=1;break}return t.abrupt("return");case 1:(c=document.createElement("div")).id="employee-debugger",c.classList="employee-debugger-close",(u=document.createElement("div")).id="employee-debugger-button",u.innerHTML='\n\t\t\t\n\t\t',(l=document.createElement("div")).id="employee-debugger-content",l.innerHTML="\n\t\t\t

MNG Debugger

\n\t\t",(d=document.createElement("div")).id="employee-debugger-toggles",(h=document.createElement("div")).id="employee-spoof-wrapper",(p=document.createElement("label")).textContent="Spoof a user",this.userSpoofCheckbox=document.createElement("input"),this.userSpoofCheckbox.type="checkbox",this.userSpoofCheckbox.id="user-spoof-control",f="You are currently entitled as the user 🤫 ".concat(n," 🤫"),m=document.querySelectorAll(".logged-in-source"),(g=document.createElement("div")).id="employee-datepicker-wrapper",(y=document.createElement("label")).textContent="Set expiration",this.datePickerCheckbox=document.createElement("input"),this.datePickerCheckbox.type="checkbox",this.datePickerCheckbox.id="expiration-control",(w=document.createElement("div")).id="datepicker-wrapper",(b=document.createElement("input")).id="expiration-picker",b.type="datetime-local",(v=document.createElement("button")).id="apply-exp-btn",v.className="expiration-btn",(E=document.createElement("button")).id="reset-exp-btn",E.className="expiration-btn",(S=v.appendChild(document.createElement("span"))).className="tooltiptext",S.textContent="Apply date",(A=E.appendChild(document.createElement("span"))).className="tooltiptext",A.textContent="Reset to original",document.body.append(c),document.getElementById("employee-debugger").append(u,l),document.getElementById("employee-debugger-content").append(d),document.getElementById("employee-debugger-toggles").append(h,g),document.getElementById("employee-spoof-wrapper").append(p,this.userSpoofCheckbox),document.getElementById("employee-datepicker-wrapper").append(y,this.datePickerCheckbox,w),document.getElementById("datepicker-wrapper").append(b,v,E),document.getElementById("employee-debugger").append(u,l),k=JSON.parse(localStorage.getItem("__MNG_Session")),T=iu(k.entitlementToken),_=new Date(1e3*k.expiration),O=new Date(1e3*T.session_exp),b.value=_.toISOString().replace(/.\d+Z$/g,""),(R=document.createElement("div")).style.padding="5px 0px 0px 10px",R.innerHTML='\n\t\t

Entitlements JWT

\n\t\t',Object.keys(T).forEach(function(e){var t=document.createElement("div");t.className="list-content";var n=document.createElement("p");n.className="collapsible-list",n.innerHTML="\n\t\t\t".concat(e,'\n\t\t\t+\n\t\t\t\n\t\t\t');var r=n.firstChild.nextElementSibling;r.style.display="inline";var o=n.lastChild.previousElementSibling,i=document.createElement("small");i.className="obj-value",i.innerHTML='⤷ ').concat(T[e],""),t.append(n,i),R.append(t),n.addEventListener("click",function(){var e=n.nextElementSibling;"block"===e.style.display?(e.style.display="none",r.style.display="inline",o.style.display="none"):(e.style.display="block",o.style.display="inline",r.style.display="none")}),i.addEventListener("click",function(){var t=document.getElementById("".concat(e,"_value")).innerHTML;navigator.clipboard&&navigator.clipboard.writeText(t)})}),(I=document.createElement("div")).style.padding="5px 0px 0px 10px",I.innerHTML='\n\t\t\t\t

Connext answer

\n\t\t\t\t',document.addEventListener("onInit",r(o.mark(function e(){var t,n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof Connext){e.next=1;break}(t=document.createElement("p")).className="connext-error-message",t.innerHTML="Something went wrong, reload may solve the issue.",I.append(t),e.next=3;break;case 1:return e.next=2,Bl();case 2:n=e.sent,Object.keys(n).forEach(function(e){var t=document.createElement("div");t.className="list-content";var r=document.createElement("p");r.className="collapsible-list",r.innerHTML="\n\t\t\t\t".concat(e,'\n\t\t\t\t+\n\t\t\t\t\n\t\t\t\t');var o=r.firstChild.nextElementSibling;o.style.display="inline";var i=r.lastChild.previousElementSibling,a=document.createElement("small");a.className="obj-value",a.innerHTML='⤷ ').concat(n[e],""),t.append(r,a),I.append(t),r.addEventListener("click",function(){var e=r.nextElementSibling;"block"===e.style.display?(e.style.display="none",o.style.display="inline",i.style.display="none"):(e.style.display="block",i.style.display="inline",o.style.display="none")}),a.addEventListener("click",function(){var t=document.getElementById("".concat(e,"_value")).innerHTML;navigator.clipboard&&navigator.clipboard.writeText(t)})});case 3:case"end":return e.stop()}},e)}))),document.getElementById("employee-debugger-content").append(d,R,I),document.getElementById("employee-debugger-toggles").append(h),document.getElementById("employee-spoof-wrapper").append(p,this.userSpoofCheckbox),document.getElementById("employee-debugger-button").addEventListener("click",function(){console.log("clicked debugger");var e=document.getElementById("employee-debugger");e.classList.toggle("employee-debugger-close"),e.classList.contains("employee-debugger-close")?e.style.top="50%":e.style.top="20%"}),!n&&this.source&&this.source.toLowerCase().includes("employee")&&ol(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee",t.style.color="blue"}),n&&(this.addSpoofBannerToPage(f),this.userSpoofCheckbox.checked=!0,ol(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee (spoofing)",t.style.color="blue"})),document.getElementById("apply-exp-btn").addEventListener("click",function(){var t,n=null===(t=new Date(b.value))||void 0===t?void 0:t.getTime(),r=Math.floor(n/1e3);k.expiration=r,localStorage.setItem("__MNG_Session",JSON.stringify(k)),window.localStorage.setItem("manual-expiration",!0),e.interval&&clearInterval(e.interval),e.timeLeftPopUp(k.expiration)}),document.getElementById("reset-exp-btn").addEventListener("click",function(){b.value=O.toISOString().replace(/.\d+Z$/g,"")}),this.addEventListeners(),i&&(this.datePickerCheckbox.click(),e.timeLeftPopUp(k.expiration));case 2:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})}],[{key:"deleteLocalStorageSpoofUser",value:function(){window.localStorage.removeItem("spoof-user"),window.localStorage.removeItem("spoofed-user-profile"),localStorage.getItem("userNewsLetterData")&&window.localStorage.removeItem("userNewsLetterData"),a("Removed spoofed-user storage object.")}},{key:"timeLeftPopUp",value:function(e){var t=document.getElementById("expiration-pop-up");if(t)t.classList="",document.getElementById("time-left-text").textContent="Calculating time...";else{var n=document.createElement("div");n.id="expiration-pop-up";var r=n.appendChild(document.createElement("p"));r.id="time-left-text",r.textContent="Calculating time...",document.getElementById("employee-debugger").prepend(n)}var o=new Date(1e3*e).toLocaleString(),i=new Date(o).getTime();this.interval=setInterval(function(){var e=(new Date).getTime(),n=i-e,r=Math.floor(Math.abs(n/864e5))||0,o=Math.floor(Math.abs(n%864e5)/36e5)||0,a=Math.floor(Math.abs(n%36e5)/6e4)||0,s=Math.floor(Math.abs(n%6e4)/1e3);document.getElementById("time-left-text").textContent="Token expires in: ".concat(r,"d ").concat(o,"h ").concat(a,"m ").concat(s,"s 🕛"),n<0&&(document.getElementById("time-left-text").textContent="Token expired by: ".concat(r,"d ").concat(o,"h ").concat(a,"m ").concat(s,"s 🕛"),t.classList.contains("expiredToken")||(t.classList="expiredToken"))},1e3)}},{key:"deleteLocalStorageManualExpiration",value:function(){window.localStorage.getItem("manual-expiration")&&(window.localStorage.removeItem("manual-expiration"),clearInterval(this.interval),document.getElementById("expiration-pop-up").remove())}},{key:"removeUserProfileHash",value:function(e){e&&localStorage.removeItem(Wc.USER_PROFILE_HASH)}}]);var t,n,i}(),Hl=function(){var e=r(o.mark(function e(t,n){var r,i,s;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Employee Tools: employeeAds: "),r=Dl(t,n),a("employee tools: validate employee:",r),"corporate"===r.accessGroup&&r.employeeAccess){e.next=1;break}return e.abrupt("return",!1);case 1:return e.next=2,pu();case 2:return(i=document.createElement("div")).id="employee-debugger-adfree",i.innerHTML='\n\t\t\n\t\t\n\t\t

(page will reload)

\n\t',document.getElementById("employee-debugger-toggles").append(i),(void 0!==(s=localStorage.getItem("hhsl"))&&"access"===s||"undefined"!=typeof MNGAuthentication&&"function"==typeof MNGAuthentication.isUserAdFree&&MNGAuthentication.isUserAdFree())&&(document.getElementById("employee-adfree-toggle").checked=!0,window.MNGAuthentication.isUserAdFree=!0),document.getElementById("employee-adfree-toggle").addEventListener("click",function(e){a("employee tools: employee ad toggle clicked"),e.target.checked?(a("Employee tools: employee ads: turn off"),localStorage.setItem("hhsl","access"),window.MNGAuthentication.isUserAdFree=!0,setTimeout(function(){window.location.reload()},500)):(a("Employee tools: employee ads: turn on"),localStorage.removeItem("hhsl"),setTimeout(function(){window.location.reload()},500))}),e.abrupt("return",!0);case 3:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();var Gl,Wl,Kl,Fl,Xl,Jl=[],zl=ou();zl=zl.replace("local","com");var Vl="".concat(i.A.entitlementsEndpoint,"newsletters"),Yl=function(e){var t=new Date,n=Math.round(t.getTime()/1e3)-86400;return new Date(e)>=new Date(1e3*n).getTime()},Zl=function(){var e=r(o.mark(function e(t){var n,r,s,c;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=Vl,"get"===t.method&&(n="".concat(n,"?email=").concat(t.dataToSend.email,"&domain=").concat(t.dataToSend.domain,"&nocache=").concat((new Date).getTime())),e.prev=1,e.next=2,Gc({method:t.method,url:n,headers:{"X-Api-Key":i.A.entitlementsApiKey},data:t.dataToSend});case 2:r=e.sent,"get"===t.method&&((Jl=r.data.responseData).sort(function(e,t){return e.title>t.title?1:-1}),"limited"===Wl?(s=Jl.filter(function(e){return!e.subscriberOnly}),localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:new Date,newsLetterData:s}))):localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:new Date,newsLetterData:Jl})),td()),e.next=4;break;case 3:e.prev=3,c=e.catch(1),a("newsletter: ",c);case 4:case"end":return e.stop()}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),ql=function(){var e,t,n=navigator.userAgent,r=/^((?!chrome|android).)*safari/i.test(n),o=/Chrome/.test(n);return r?"calc(100vh - 8.5rem)":o?"calc(100vh - ".concat((e=window.innerHeight,(t=(window.screen.height-e)/16)>0?t:0),"rem)"):"calc(100vh - 64px)"},Ql=function(e){e.stopPropagation();var t={},n=e.target,r=e.target.classList.contains("dropDownNewsLetter")?".slideOutNewsLetter":".dropDownNewsLetter",o=parseInt(n.getAttribute("data-id"),10),i=n.checked;document.querySelector("".concat(r,'[data-id="').concat(o,'"]')).checked=i,Jl.find(function(e){return e.id===o}).isSubscribed=i,t.method=i?"post":"delete",t.dataToSend={email:Gl,domain:zl,preferenceId:o},ed(t)},$l=function(e){e.stopPropagation();var t,n,r=e.target;if(r.matches("span")||r.matches("label")){var o,i=r.closest("div"),a=i.querySelector(".newsletter-icon"),s="block"===(o=i.classList.contains("show-digisubs-push")?document.querySelector("#newsLetterItem-push"):document.querySelector("#newsLetterContent-dropdown")).style.display,c=document.querySelector(".wrapper-nav-subs.pushnav.pushnav-right"),u=/iPad|iPhone|iPod/.test(navigator.userAgent),l=/Android/i.test(navigator.userAgent);s?(a.classList.remove("icon-arrow-down"),a.classList.add("icon-arrow-right"),o.style.display="none",""!==c.style.height&&(c.style.height="")):(a.classList.remove("icon-arrow-right"),a.classList.add("icon-arrow-down"),o.style.display="block",u&&window.innerHeight=0&&n.left>=0&&n.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&n.right<=(window.innerWidth||document.documentElement.clientWidth)||""!==c.style.height||(c.style.height=ql())))}},ed=function(e){localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:Kl,newsLetterData:Jl})),Zl({method:e.method,dataToSend:e.dataToSend})},td=function(){var e=document.querySelector("#newsLetterContent-dropdown"),t=document.querySelector("#newsLetterItem-push");if(e&&t){var n=document.createElement("div"),r=document.createElement("span");r.classList.add("icon-arrow-right","newsletter-icon"),r.addEventListener("click",$l),n.append(r);var o=document.createElement("label");o.textContent="Manage Newsletters",o.id="newsletterHead",n.append(o),n.classList.add("newsletter-dropdown-title"),n.addEventListener("click",$l);var i=n.cloneNode(!0);i.classList.add("show-digisubs-push","newsletter-dropdown-title"),i.style.display="flex",i.addEventListener("click",$l),n.classList.add("dropdown-item"),e.before(n),t.before(i);var a=document.createElement("li");a.classList.add("dropdown-item-newsletter","explainer-text");var s=document.createElement("p");s.classList.add("info-icon");var c=window.btoa('\n\t\tinfo\n\t\t\n\t\t\n\t\t\n\t'),u="url(data:image/svg+xml;base64,".concat(c,")");s.style.background=u;var l=document.createElement("p"),d=document.createElement("a"),h=Cu();d.setAttribute("href","https://myaccount.".concat(h)),d.setAttribute("id","myAccountLink"),d.textContent="MyAccount",l.appendChild(document.createTextNode("Manage your newsletters here or visit ")),l.appendChild(d),l.appendChild(document.createTextNode(" for more information")),a.append(s),a.append(l);var p=a.cloneNode(!0);e.append(a),t.append(p);var f,m,g,y=(f={},Jl.forEach(function(e){var t=e.category[0].Title;e.isSubscribed&&"Media News Group"!==t&&"MediaNews Group"!==t?f["My Newsletters:"]?f["My Newsletters:"].push(e):f["My Newsletters:"]=[e]:f[t]?f[t].push(e):f[t]=[e]}),f),w=(m=y,g=Object.keys(m).sort(function(e,t){return"My Newsletters:"===e?-1:"My Newsletters:"===t?1:e.localeCompare(t)}),"My Newsletters:"===g[0]?g.splice(1,0,"".concat(Xl," Newsletters:")):g=["".concat(Xl," Newsletters:")].concat(ol(g)),g);y["".concat(Xl," Newsletters:")]=[],w.forEach(function(n){if("Media News Group"!==n&&"MediaNews Group"!==n&&"MediaNewsGroup"!==n&&"Not Active"!==n){var r=document.createElement("li");r.classList.add("titleContainer");var o=document.createElement("li");o.classList.add("titleContainer");var i=document.createElement("label");i.classList.add("newsletterCategoryTitle"),i.textContent=n,"My Newsletters:"!==n&&n!=="".concat(Xl," Newsletters:")||i.classList.add("newsLetterTitleBold");var a=i.cloneNode(!0);r.append(i),o.append(a),e.append(r),t.append(o),y[n].forEach(function(n){var r=document.createElement("li");r.classList.add("dropdown-item-newsletter");var o=document.createElement("li");o.classList.add("show-digisubs-push","newsLetter-container-push");var i=document.createElement("input");i.classList.add("newsLetterSubscriberToggle"),i.type="checkbox",i.name="newsLetter_".concat(n.title),i.setAttribute("data-id",n.id),i.checked=n.isSubscribed,i.style.cursor="pointer",i.addEventListener("click",Ql),Fl&&(i.disabled=!0);var a=document.createElement("label");a.textContent=n.title,a.setAttribute("for","newsLetter_".concat(n.title));var s=i.cloneNode(),c=a.cloneNode(!0);s.addEventListener("click",Ql),i.classList.add("dropDownNewsLetter"),s.classList.add("slideOutNewsLetter"),r.append(i,a),o.append(s,c),e.append(r),t.append(o)})}}),e.style.display="none",t.style.display="none"}};const nd=function(e,t,n,r){if(Gl=e,Wl=t,Xl=r,Fl=n){Tu("userNewsLetterData");for(var o=document.getElementById("newsLetterContent-dropdown"),i=document.getElementById("newsLetterItem-push");o.firstChild;)o.firstChild.remove();for(;i.firstChild;)i.firstChild.remove()}if(a("host for newsletter prefs",zl),localStorage.getItem("userNewsLetterData")){var s=JSON.parse(localStorage.getItem("userNewsLetterData"));Kl=s.expoDate,Yl(Kl)?(Jl=s.newsLetterData,td()):Zl({method:"get",dataToSend:{email:Gl,domain:zl}})}else Zl({method:"get",dataToSend:{email:Gl,domain:zl}})};var rd=function(){var e=Fu()?Fu().querySelector(ju):null,t=Fu();null!==e&&t.removeChild(e)},od=function(){var e=r(o.mark(function e(t){var n,r,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S,A,k,T,_,O,R,I,C,N,L,x,P,U,D,M,B,j,H,G,W,K,F,X,J,z,V,Y,Z,q,Q,$,ee,te,ne,re,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ye,we,be,ve,Ee,Se,Ae,ke,Te,_e,Oe,Re,Ie;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.authenticatedStatus,r=t.email,c=t.nickname,u=t.picture,l=t.connectionSource,d=t.entitlementSource,h=t.entitlementOrganization,p=t.entitlementLevel,f=t.serviceCode,m=t.isEedition,g=t.accountHref,y=t.userId,w="",b=" | Logged in with ",v=[],E=r,S=Pu(f),A=function(e){var t=(e||"").trim();if(!t)return" ";var n=t.split("@"),r=n.shift()||"",o=r.length,i=-1*(o>24?Math.min(8,Math.ceil(o/6)):0);return'
').concat(r.slice(0,i),'').concat(r.slice(i),'@').concat(n.shift(),"
")},void 0!==r&&"undefined"!==r&&r&&!r.endsWith("@example.com")||(E=c||"Logged In"),k=null==l?void 0:l.replace("Trib-","").toLowerCase(),a("Validate connection source: ",k),e.prev=1,Oe=k,e.next="google-oauth2"===Oe||"google"===Oe?2:"facebook"===Oe?3:"apple"===Oe?4:5;break;case 2:return b+="Google",e.abrupt("continue",6);case 3:return b+="Facebook",e.abrupt("continue",6);case 4:return b+="Apple",e.abrupt("continue",6);case 5:return b="",e.abrupt("continue",6);case 6:Re=p,e.next="limited"===Re?7:"subscriber"===Re||"freeTrial"===Re?8:"premium"===Re?9:"comp"===Re?10:"partner-access"===Re?11:12;break;case 7:return w="Limited Access",e.abrupt("continue",13);case 8:return w="Standard Digital Access",e.abrupt("continue",13);case 9:return w=S?"Standard Digital Access":"Premium Ad-Free Access",e.abrupt("continue",13);case 10:return w="Standard Digital Trial",e.abrupt("continue",13);case 11:return w="Partner Access",e.abrupt("continue",13);case 12:return w="Anonymous",e.abrupt("continue",13);case 13:if(n===Wc.USER_IS_LOWA&&(b="",w="Anonymous"),m&&f&&f.includes("P")&&(w="Limited Subscription - e-Edition access"),h&&(w="".concat("Standard Digital Access"===w?"Access":"Premium Ad-Free Access"===w?"Ad-Free Access":w," provided by ").concat(h)),rd(),zu().style.display="none",Ju().dataset.status="logged-in",(_=Yu()).removeChild(_.firstChild),(O=document.createElement("a")).id="anchorProfileDropDown",O.className="nav-link dropdown-toggle dropdown-toogle-mobile",O.setAttribute("aria-label","Account menu dropdown"),O.style.cursor="pointer",O.setAttribute("tabindex","0"),O.setAttribute("aria-expanded","false"),R=document.createElement("img"),I=document.getElementById("pushnav-icon"),R.className="rounded-circle",R.alt="Profile image",I.className="rounded-circle",R.src=u,I.src=u,u||(R.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png",I.src="https://ui-static-assets-prod.mng-digisubs-prod.com/img/no-icon.png"),(C=document.createElement("span")).className="icon-arrow-down",C.id="icon-caret",C.setAttribute("aria-hidden","true"),N=document.createElement("div"),(L=document.createElement("div")).id="account-content",L.className="dropdown-menu",N.id="account-content-container",document.body.appendChild(N),_.append(O,L),x="",window.dataLayer.forEach(function(e){Object.prototype.hasOwnProperty.call(e,"SiteName")&&(x=e.SiteName)}),P=window,U=P.location,D=new URL(U),H=null,n!==Wc.USER_IS_LOWA?((H=document.createElement("a")).className="dropdown-item dropdown-profile account-link",H.text=E):document.getElementById("push-email-link").style.display="none",n===Wc.USER_IS_LOWA&&((G=document.createElement("li")).className="dropdown-item log-in-button subscribe-special custom-button",W=document.createElement("a"),K=Qc(),W.href="/login?returnUrl=".concat(K),W.target="_blank",W.text="Complete Log In",W.style.cursor="pointer",W.style.margin="0",W.style.width="auto"),F=id('\n\t\t\t'),X=A(r),(J=document.createElement("div")).className="dropdown-item digisubs-top-info-container account-link account-settings",J.setAttribute("data-mng-click","account-settings"),J.setAttribute("data-mng-category","account-link"),J.setAttribute("data-mng-action","account-settings"),z=rl(),V=eu(),Y="https://checkout.".concat(V),z){Y=z.href,a("Original sub URL: ",Y);try{(Z=new URL(Y)).searchParams.has("newUser")||Z.searchParams.set("newUser","true"),Y=Z.toString()}catch(e){a("Error processing subscription URL: ",e)}}for(q="subscriber"===p||"premium"===p?"\n\t\t\t\t
\n\t\t\t\t\t
".concat(c||"User","
\n\t\t\t\t\t
").concat(X,"
\n\t\t\t\t
"):"\n\t\t\t\t
\n\t\t\t\t\t
".concat(c||"User","
\n\t\t\t\t\t
").concat(X,"
\n\t\t\t\t\t
\n\t\t\t\t\t\tSubscribe Now\n\t\t\t\t\t
\n\t\t\t\t
"),Q=id(q),J.appendChild(Q),($=document.createElement("a")).className="dropdown-item account-link account-settings",$.setAttribute("data-mng-click","account-settings"),$.setAttribute("data-mng-category","account-link"),$.setAttribute("data-mng-action","account-settings"),ee="\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Subscription
\n\t\t\t\t\t
".concat(w,'
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
'),te=id(ee),$.appendChild(te),i.A.enableReaderDashboardLink&&((M=document.createElement("a")).className="dropdown-item",M.id="reader-dashboard-link",M.setAttribute("data-mng-click","reader-dashboard"),M.setAttribute("data-mng-category","account-link"),M.setAttribute("data-mng-action","reader-dashboard"),i.A.enableReaderDashboardv2?M.href="".concat(D.origin,"/dashboard"):(M.target="_blank",M.href="".concat(D.origin,"/user-tools/dashboard")),ne=id('\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
Reader Dashboard
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
'),M.appendChild(ne)),i.A.enableGiftedArticlesLink&&((B=document.createElement("a")).className="dropdown-item",B.setAttribute("data-mng-click","gifted-articles"),B.setAttribute("data-mng-category","account-link"),B.setAttribute("data-mng-action","gifted-articles"),i.A.enableReaderDashboardv2?B.href="".concat(D.origin,"/dashboard/gifted-articles"):(B.href="".concat(D.origin,"/user-tools/dashboard/#shared-articles-container"),B.target="_blank"),re="subscriber"===p?'\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Gifted Articles
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
':"\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Gifted Articles
\n\t\t\t\t\t\t\x3c!-- Subscribe for access --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
'),oe=id(re),B.appendChild(oe)),i.A.enableSavedArticlesLink&&((j=document.createElement("a")).className="dropdown-item",i.A.enableReaderDashboardv2?j.href="".concat(D.origin,"/dashboard/saved-articles"):(j.href="".concat(D.origin,"/user-tools/dashboard/#saved-article-container"),j.target="_blank"),ie="subscriber"===p?"\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Saved Articles
\n\t\t\t\t\t\t\x3c!-- Subscribe for access --\x3e\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
'):"premium"===p?'\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Saved Articles
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
':'\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
Saved Articles
\n\x3c!--\t\t\t\t\t\t
Subscribe to Premium for access
--\x3e\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t
',ae=id(ie),j.appendChild(ae)),(se=document.createElement("a")).className="dropdown-item",se.href="".concat(D.origin,"/contact-us"),se.target="_blank",se.setAttribute("data-mng-click","contact-us"),se.setAttribute("data-mng-category","account-link"),se.setAttribute("data-mng-action","contact-us"),ce=id('\n\t\t
\n\t\t\t
\n\t\t\t\t
Contact Us
\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
'),se.appendChild(ce),(ue=document.createElement("a")).className="dropdown-item",ue.href="".concat(D.origin,"/logout"),se.setAttribute("data-mng-click","logout"),se.setAttribute("data-mng-category","account-link"),se.setAttribute("data-mng-action","logout"),le=id("\n\t\t
\n\t\t\t
\n\t\t\t\t
Log Out
\n\t\t\t
\n\t\t
"),ue.appendChild(le),(de=document.createElement("a")).className="dropdown-item",de.setAttribute("data-mng-click","marketing-content"),de.setAttribute("data-mng-category","marketing-content"),de.setAttribute("data-mng-action","marketing-content"),he=id("\n\t\t
\n\t\t\t
\n\t\t\t\tSAMPLE MARKETING ITEM HERE\n\t\t\t
\n\t\t
"),de.appendChild(he),_.id="profileDropDown",_.className="nav-item dropdown auth-visible show",O.append(R,C),G&&document.getElementById("account-content").append(G),pe=[F,J].concat(ol(M?[M]:[]),[$],ol(B?[B]:[]),ol(j?[j]:[]),[se,ue,de]),(T=document.getElementById("account-content")).append.apply(T,ol(pe)),document.getElementById("push-auth-source").textContent="".concat(w).concat(b),document.getElementById("push-email-link").textContent=E,document.getElementById("push-account-content").style.display="block",document.getElementById("blank-icon-user").style.display="none",i.A.enableReaderDashboardLink&&((fe=document.createElement("a")).className="show-digisubs-push dashboard-link",fe.id="push-reader-dashboard",fe.text="Reader Dashboard",i.A.enableReaderDashboardv2?fe.href="".concat(D.origin,"/dashboard"):fe.href="".concat(D.origin,"/user-tools/dashboard"),document.querySelector("#push-account-link").after(fe)),a("Employee tools: start tools here",d,r,y),!1===(me=d)&&(me="none"),(ge=new jl(me,r,y)).init(),Hl(me,r),i.A.newslettersEnabled&&p&&(ye=E,we=!1,ge.userSpoofCheckbox&&(we=ge.userSpoofCheckbox.checked),localStorage.getItem("spoof-user")&&(ye=localStorage.getItem("spoof-user")),!0===n&&nd(ye,p,we,x)),be=document.getElementById("account-content"),ve=document.querySelector(".search-icon-wrapper"),Ee=function(){var e=be.classList.contains("show");C.className=e?"icon-arrow-up":"icon-arrow-down",O.setAttribute("aria-expanded",e.toString()),e?(null==ve||ve.classList.add("search-icon-wrapper-hide"),N.style.display="block"):(null==ve||ve.classList.remove("search-icon-wrapper-hide"),N.style.display="none")},window.addEventListener("resize",Ee),O.addEventListener("click",function(){be.classList.toggle("show"),Ee()}),document.getElementById("anchorProfileDropDown").addEventListener("keydown",function(e){"Enter"===e.key&&(be.classList.toggle("show"),Ee())}),document.addEventListener("click",function(e){O.contains(e.target)||be.contains(e.target)||(be.classList.remove("show"),Ee())}),v=document.getElementsByClassName("account-link"),Se=0;Se0&&e.addedNodes.forEach(function(e){1===e.nodeType&&n.targetsToWatch.forEach(function(t,r){(e.matches(t.selector)?[e]:Array.from(e.querySelectorAll(t.selector))).forEach(function(e){n.processTargetIfConditionMet(e,t,r)&&n.targetProcessedStatus.set(r,!0)})})})}),this.checkAndDisconnectObserver(t)}},{key:"checkAndDisconnectObserver",value:function(e){var t=this,n=!0;this.targetsToWatch.forEach(function(e,r){e.condition&&!t.targetProcessedStatus.get(r)&&(n=!1)}),n&&(e.disconnect(),a("MutationObserver disconnected: All relevant elements processed or conditions not met."))}},{key:"startObserving",value:(e=r(o.mark(function e(){var t,n=this,r=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:document.body,e.next=1,hu();case 1:a("ContentObserver: Starting observation process."),this.observer.observe(t,{childList:!0,subtree:!0}),a("MutationObserver started for ".concat(t.tagName||"document.body"," elements.")),Object.entries(this.targetsToWatch).forEach(function(e){var r=p(e,2),o=r[0],i=r[1];if(i.condition){var a=t.querySelector(i.selector);a&&n.processTargetIfConditionMet(a,i,o)&&n.targetProcessedStatus.set(o,!0)}}),this.checkAndDisconnectObserver(this.observer);case 2:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})}]);var e}()),cd=function(){var e=r(o.mark(function e(){var t,n,r,a,s,c,u,l,d,h,p,f,m,g,y,w,b;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=!1,n="Naviga",r="",a="Anonymous",s=!1,c=!1,u="",!i.A.entitlementsEnabled){e.next=2;break}return e.next=1,Eu();case 1:(l=e.sent)&&l.token&&(d=l.token,h=iu(d),p=h.entitlement_entitled,f=h.entitlement_source,m=h.entitlement_organizationName,g=h.entitlement_level,y=h.entitlement_serviceCode,w=h.entitlement_isEedition,b=h.email,t=p||!1,n=f||!1,a=g||"Anonymous",s=y||!1,c=w||!1,u=b||"",r=m||""),e.next=3;break;case 2:"undefined"!=typeof Connext&&"Subscribed"===Connext.Storage.GetUserState()&&(t=!0);case 3:return e.abrupt("return",{userIsEntitled:t,entitlementSource:n,entitlementOrganization:r,entitlementLevel:a,serviceCode:s,isEedition:c,tokenEmail:u});case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ud=function(){var e=r(o.mark(function e(t){var n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=Qc(),r=t.querySelector("a"),(i=new URL(r.href)).searchParams.set("returnUrl",encodeURIComponent("".concat(n.href,"?newUser=true"))),r.setAttribute("href",i.href);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),ld=function(e){var t,n=e.siteUrl,r=["courant.com","mcall.com","baltimoresun.com","orlandosentinel.com","growthspotter.com","sun-sentinel.com","capitalgazette.com","dailypress.com","pilotonline.com","nydailynews.com","chicagotribune.com"].filter(function(e){return e===n});return void 0!==window.authentication_config&&window.authentication_config.myAccountLink&&(t=window.authentication_config.myAccountLink,/^https?:\/\/([\w.-]+)\.([a-z]{2,})(\/[\w-.]*)*$/.test(t))?(a("UIHandler: ","Account Settings link provided by wp-admin"),new URL("".concat(window.authentication_config.myAccountLink))):r.length>0?new URL("https://membership.".concat(n)):new URL("https://myaccount.".concat(n))},dd=function(){var e=r(o.mark(function e(t){var n;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.accountHref,tl().forEach(function(e){var t=e;t.querySelector("a").textContent="My Account",t.querySelector("a").setAttribute("href",n)});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),hd=function(e){try{void 0!==window.MNGAuthentication&&("keydown"===e.type&&"Enter"===e.key||"click"===e.type)&&(e.preventDefault(),window.MNGAuthentication.logout())}catch(e){a(e)}},pd=function(e){a("UIHandler: ","engage overrides showing block: ",e);var t=document.createElement("style"),n=".".concat(e,"{display:inline-block !important;}");t.textContent=".engageLogoutLink, .engageLoginLink {display:none !important;}"+n,document.getElementsByTagName("head")[0].appendChild(t)},fd=function(){a("UIHandler: ","show logout buttons"),pd("engageLogoutLink"),document.querySelectorAll(ju).forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.addEventListener("click",hd),t.addEventListener("keydown",hd)})},md=function(){a("UIHandler: ","show login buttons"),pd("engageLoginLink"),tl().forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.querySelector("a").textContent="Log in";var n=new URL(t.querySelector("a").href),r=new URLSearchParams(n);r.append("returnUrl",Qc()),t.querySelector("a").setAttribute("href","".concat(n,"?").concat(r))})},gd=function(){var e=r(o.mark(function e(){var t,n,r,s,c,u,l,d,h,p,f,m,g,y,w,b,v,E,S;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("UIHandler: ","setup"),e.next=1,Rl();case 1:return t=e.sent,n=t.authenticated,r=t.email,s=t.picture,c=t.connectionSource,u=t.userId,l=t.nickname,e.next=2,cd();case 2:if(d=e.sent,h=d.userIsEntitled,p=d.entitlementSource,f=d.entitlementOrganization,m=d.entitlementLevel,g=d.serviceCode,y=d.isEedition,w=d.tokenEmail,b=ld({siteUrl:Cu()}),!n){e.next=6;break}if(!i.A.dropdownEnabled){e.next=4;break}return n===Wc.USER_IS_LOWA||r&&!r.includes("@example.com")||(r=w),e.next=3,ad({authenticatedStatus:n,email:r,nickname:l,picture:s,connectionSource:c,entitlementSource:p,entitlementOrganization:f,entitlementLevel:m,serviceCode:g,isEedition:y,accountHref:b,userId:u});case 3:e.next=5;break;case 4:return e.next=5,dd({entitlementSource:p,siteUrl:ou(),accountHref:b});case 5:fd(),e.next=7;break;case 6:md();case 7:v=Qu(),h?(nl().forEach(function(e){e.style.display="none"}),v&&(v.style.display="none")):(nl().forEach(function(e){var t=e;t.style.display="block",ud(t)}),v&&(v.style.display="flex",E=Qc(),(S=new URL(v.getAttribute("href"))).searchParams.set("returnUrl",encodeURIComponent(E.href)),v.setAttribute("href",S.href)));case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),yd=function(){var e=Yu();e&&(e.style.display="block",e.style.visibility="visible");var t=Yu()?Yu().querySelector("a"):null;t&&(t.textContent="Loading..."),Ju().dataset.status="logged-out"},wd=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return yd(),e.next=1,gd();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();document.addEventListener("DOMContentLoaded",function(){var e=document.getElementById("digisubs-push-container");e&&(e.classList.remove("hidden"),e.classList.add("loaded"))});var bd=function(){var e=r(o.mark(function e(){var t,n,r,i;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,lu();case 1:return e.next=2,mu();case 2:if("article"===e.sent){e.next=3;break}return a("addArticleContentObservers: Non-article page detected, leaving."),e.abrupt("return");case 3:return e.next=4,fu("Paywall_Level");case 4:return t=e.sent,e.next=5,cd();case 5:n=e.sent,r=n.userIsEntitled,i=n.entitlementLevel,sd.addTargetsFromObject({"stn-player":{selector:".stn-player",condition:r&&"premium"===i,action:function(e){a("addArticleContentObservers: Send to news player found. Hiding for adfree user.");var t=e.parentNode;t&&(t.style.display="none")}},bxc:{selector:".bxc",condition:r&&"premium"===i,action:function(e){a("addArticleContentObservers: .bx element found. Removing from DOM for adfree user."),document.querySelectorAll(".bx-client-overlay").forEach(function(e){e.classList.remove("bx-client-overlay")}),e.remove()}}}),sd.addTargetsFromObject({".article-bottom-share":{selector:".article-bottom-share",condition:!0,action:function(e){a("addArticleContentObservers: Bottom article share buttons found, updating styles."),e.style.margin="0 auto"}}}),sd.addTargetsFromObject({"wp-remixd-voice-wrapper":{selector:".wp-remixd-voice-wrapper",condition:"premium"===t&&!r,action:function(e){a("addArticleContentObservers: Audio player found. Removing from DOM for LINA user."),e.remove()}}});case 6:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),vd=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,du();case 1:return r(o.mark(function e(){var t;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=1,bd();case 1:return e.next=2,sd.startObserving();case 2:e.next=4;break;case 3:e.prev=3,t=e.catch(0),a("Error: Failed to start ContentObserver:",t);case 4:case"end":return e.stop()}},e,null,[[0,3]])}))(),e.next=2,wd();case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();(function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:vd();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.uiHandler.bundle.js.map;