/*! 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 V(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:V(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 N(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(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 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 T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(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 A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(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 I(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 P(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||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){W(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){W(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){P(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){P(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||P(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||P(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||P(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||P(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||P(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);P(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);P(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||P(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||P(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||P(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||P(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||P(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){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function W(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 W(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=K(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=K(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function V(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 J(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,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}}},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:()=>Za,hasStandardBrowserEnv:()=>Qa,hasStandardBrowserWebWorkerEnv:()=>$a,navigator:()=>qa,origin:()=>es});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 y(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();class E extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,E.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new E(t,n)}}class A extends E{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,A.prototype)}}class S extends E{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 _ extends E{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,_.prototype)}}class T extends _{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,T.prototype)}}class R extends E{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,R.prototype)}}class O extends E{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,O.prototype)}}class I extends E{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,I.prototype)}}class k extends E{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(L(e,["default"]),"', scope: '").concat(L(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,k.prototype)}}class N extends E{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(L(e,["default"]),"', missing scope: '").concat(L(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,N.prototype)}}class C extends E{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,C.prototype)}}function L(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const P=()=>window.crypto,x=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(P().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%66]),t},U=e=>btoa(e),D=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],M=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=D.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},B=e=>{var{clientId:t}=e,n=y(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()},j=async e=>{const t=P().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},G=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={},F={};Object.defineProperty(F,"__esModule",{value:!0});var X=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}();F.default=function(){return X.getInstance()};var V=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())})},z=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 V(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 V(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?Z:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,Y.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),Y.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 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 _;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;r{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var r},be=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return o?(async(e,t,n,r,o,i,a,s)=>((e,t)=>new 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])}))({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=new AbortController;let o;return t.signal=r.signal,Promise.race([ge(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})})(e,r,a)};async function ve(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 be(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=y(h,["error","error_description"]),{headers:w,ok:g}=l;let b;if(c&&(b=w["dpop-nonce"],b&&await c.setNonce(b)),!g){const l=f||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===p)throw new I(p,l,m.mfa_token,m.mfa_requirements);if("missing_refresh_token"===p)throw new k(n,r);if("use_dpop_nonce"===p){if(!c||!b||u)throw new C(b);return ve(e,t,n,r,o,i,a,s,c,!0)}throw new E(p||"request_error",l)}return m}async function Ee(e,t){var{baseUrl:n,timeout:r,audience:o,scope:i,auth0Client:a,useFormData:s,useMrrt:c,dpop:u}=e,l=y(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?B(p):JSON.stringify(p),m=(w=l.grant_type,ye.includes(w));var w;return await ve("".concat(n,"/oauth/token"),r,o||"default",i,{method:"POST",body:f,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(M(a||b)))}},t,s,c,m?u:void 0)}const Ae=function(){for(var e=arguments.length,t=new Array(e),n=0;nArray.from(new Set(e)))(t.filter(Boolean).join(" ").trim().split(/\s+/)).join(" ")},Se=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e.default),Ae(r,t)};class _e{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@@auth0spajs@@",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 _e({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new _e({scope:t,audience:n,clientId:r})}}class Te{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class Re{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 Oe{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||v}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());if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),s=Math.floor(a/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 _e({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=_e.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"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=_e.fromKey(r);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){const t=await this.cache.get(r);if(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.refresh_token)return this.modifiedCachedEntry(t,e)}}}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 Ie{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 ke=e=>"number"==typeof e,Ne=["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 Ce=H&&H.__assign||function(){return Ce=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMe.get(e)||Me.get("".concat("_legacy_").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),Ue("".concat("_legacy_").concat(e),JSON.stringify(t),r),Me.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),De(e,n),Me.remove(e,t),Me.remove("".concat("_legacy_").concat(e),t)}},je={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 Ge;!function(e){e.Code="code",e.ConnectCode="connect_code"}(Ge||(Ge={}));var Ke,He=function(e){return Ke=Ke||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;o(new Re).enclosedCache,localstorage:()=>new Te},Ve=e=>Xe[e],ze=e=>{const{openUrl:t,onRedirect:n}=e,r=y(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Je=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},Ye={NONCE:"nonce",KEYPAIR:"keypair"};class Ze{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(Ye).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(Ye.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(Ye.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(Ye.NONCE,this.buildKey(e))}findKeyPair(){return this.find(Ye.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(Ye.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Ye.KEYPAIR,this.clientId)}}class qe{constructor(e){this.storage=new Ze(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 we(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 Qe;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Qe||(Qe={}));class $e{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]:Qe.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?Qe.DPoP:Qe.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===Qe.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,"dpop-nonce");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 et{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 tt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new tt(t)}}class tt 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,tt.prototype)}}const nt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function rt(e,t){this.v=e,this.k=t}function ot(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 it(e){return new rt(e,0)}function at(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function st(e,t){return e.get(ot(e,t))}function ct(e,t,n){at(e,t),t.set(e,n)}function ut(e,t,n){return e.set(ot(e,t),n),n}function lt(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 dt(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 ht(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;kt=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 bt("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",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 bt("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw bt("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw xt(e.message,r,o);throw e}}function Gt(e,t,n,r){try{if("string"!=typeof e)throw bt("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw bt("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw xt(e.message,n,r);throw e}}function Kt(e){!function(e,t){if(dn(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 xt(t,Ln,e)}(e,t)}(e,"application/json")}function Ht(){return Ct(crypto.getRandomValues(new Uint8Array(32)))}function Wt(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 Lt("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 Lt("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 Lt("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 Lt("unsupported CryptoKey algorithm name",{cause:e})}}function Ft(e){const t=null==e?void 0:e[Et];return"number"==typeof t&&Number.isFinite(t)?t:0}function Xt(e){const t=null==e?void 0:e[At];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Vt(){return Math.floor(Date.now()/1e3)}function zt(e){if("object"!=typeof e||null===e)throw bt('"as" must be an object',"ERR_INVALID_ARG_TYPE");Gt(e.issuer,'"as.issuer"')}function Jt(e){if("object"!=typeof e||null===e)throw bt('"client" must be an object',"ERR_INVALID_ARG_TYPE");Gt(e.client_id,'"client.client_id"')}function Yt(e){return Gt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Zt(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&&Gt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw bt("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw bt("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:Wt(n),kid:r},u=function(e,t){const n=Vt()+Ft(t);return{jti:Ht(),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[_t])||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 bt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(Ct(It(JSON.stringify(e))),".").concat(Ct(It(JSON.stringify(t)))),o=Ct(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Wn(e)};case"RSA-PSS":switch(Hn(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 Lt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Hn(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Lt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,It(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const qt=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Qt(e,t){if(t&&"https:"!==e.protocol)throw xt("only requests to HTTPS are allowed",xn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw xt("only HTTP and HTTPS requests are allowed",Un,e)}function $t(e,t,n,r){let o;if("string"!=typeof e||!(o=qt(e)))throw xt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?jn:Gn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Qt(o,r),o}function en(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?$t(e.mtls_endpoint_aliases[t],t,n,r):$t(e[t],t,n,r)}class tn extends Error{constructor(e,t){var n;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"error",void 0),lt(this,"status",void 0),lt(this,"error_description",void 0),lt(this,"response",void 0),this.name=this.constructor.name,this.code=On,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 nn extends Error{constructor(e,t){var n,r;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"error",void 0),lt(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 rn extends Error{constructor(e,t){var n;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"response",void 0),lt(this,"status",void 0),this.name=this.constructor.name,this.code=Rn,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 on=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),an=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),sn=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),cn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function un(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!gt(e,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(on);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(an)){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(cn)){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 rn("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){Kn(e),Kt(e);try{const t=await e.clone().json();if(Ut(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 tn("server responded with an error in the response body",{cause:t,response:e});throw xt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),Pn,e)}}function ln(e){if(!vn.has(e))throw bt('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function dn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function hn(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[St])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Mt(r,null==a?void 0:a.signal)})}async function pn(e,t,n,r,o,i){var a;const s=en(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[vt]));o.set("grant_type",r);const c=Dt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(ln(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await hn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const fn=new WeakMap,mn=new WeakMap;function wn(e){if(!e.id_token)return;const t=fn.get(e);if(!t)throw bt('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function yn(e,t,n,r,o,i){if(zt(e),Jt(t),!gt(n,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await un(n,200,"Token Endpoint"),Kn(n);const a=await Jn(n);if(Gt(a.access_token,'"response" body "access_token" property',Cn,{body:a}),Gt(a.token_type,'"response" body "token_type" property',Cn,{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;jt(e,!0,'"response" body "expires_in" property',Cn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Gt(a.refresh_token,'"response" body "refresh_token" property',Cn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw xt('"response" body "scope" property must be a string',Cn,{body:a});if(void 0!==a.id_token){Gt(a.id_token,'"response" body "id_token" property',Cn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(jt(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 Lt("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw xt("Invalid JWT",Cn,e);try{i=JSON.parse(It(Ct(s)))}catch(e){throw xt("failed to parse JWT Header body as base64url encoded JSON",Nn,e)}if(!Ut(i))throw xt("JWT Header must be a top level object",Cn,e);if(t(i),void 0!==i.crit)throw new Lt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(It(Ct(c)))}catch(e){throw xt("failed to parse JWT Payload body as base64url encoded JSON",Nn,e)}if(!Ut(a))throw xt("JWT Payload must be a top level object",Cn,e);const l=Vt()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw xt('unexpected JWT "exp" (expiration time) claim type',Cn,{claims:a});if(a.exp<=l-r)throw xt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Dn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw xt('unexpected JWT "iat" (issued at) claim type',Cn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw xt('unexpected JWT "iss" (issuer) claim type',Cn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw xt('unexpected JWT "nbf" (not before) claim type',Cn,{claims:a});if(a.nbf>l+r)throw xt('unexpected JWT "nbf" (not before) claim value',Dn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw xt('unexpected JWT "aud" (audience) claim type',Cn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Fn.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Ft(t),Xt(t),o).then(Sn.bind(void 0,i)).then(bn.bind(void 0,e)).then(gn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw xt('ID Token "aud" (audience) claim includes additional untrusted audiences',Mn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw xt('unexpected ID Token "azp" (authorized party) claim value',Mn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&jt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Cn,{claims:s}),mn.set(n,c),fn.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 Lt("unsupported `token_type` value",{cause:{body:a}});return a}function gn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw xt('unexpected JWT "aud" (audience) claim value',Mn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw xt('unexpected JWT "aud" (audience) claim value',Mn,{expected:e,claims:t.claims,claim:"aud"});return t}function bn(e,t){var n,r;const o=null!==(n=null===(r=e[Zn])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw xt('unexpected JWT "iss" (issuer) claim value',Mn,{expected:o,claims:t.claims,claim:"iss"});return t}const vn=new WeakSet,En=Symbol(),An={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 Sn(e,t){for(const n of e)if(void 0===t.claims[n])throw xt('JWT "'.concat(n,'" (').concat(An[n],") claim missing"),Cn,{claims:t.claims});return t}const _n=Symbol(),Tn=Symbol();const Rn="OAUTH_WWW_AUTHENTICATE_CHALLENGE",On="OAUTH_RESPONSE_BODY_ERROR",In="OAUTH_UNSUPPORTED_OPERATION",kn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Nn="OAUTH_PARSE_ERROR",Cn="OAUTH_INVALID_RESPONSE",Ln="OAUTH_RESPONSE_IS_NOT_JSON",Pn="OAUTH_RESPONSE_IS_NOT_CONFORM",xn="OAUTH_HTTP_REQUEST_FORBIDDEN",Un="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Dn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Mn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Bn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",jn="OAUTH_MISSING_SERVER_METADATA",Gn="OAUTH_INVALID_SERVER_METADATA";function Kn(e){if(e.bodyUsed)throw bt('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Hn(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Lt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Wn(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 Lt("unsupported ECDSA namedCurve",{cause:e})}}function Fn(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw xt('unexpected JWT "alg" header parameter',Cn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw xt('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 xt('unexpected JWT "alg" header parameter',Cn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw xt('unexpected JWT "alg" header parameter',Cn,{header:r,expected:e,reason:"client configuration"})}function Xn(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw xt('"'.concat(t,'" parameter must be provided only once'),Cn);return n}const Vn=Symbol(),zn=Symbol();async function Jn(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kt;try{t=await e.json()}catch(t){throw n(e),xt('failed to parse "response" body as JSON',Nn,t)}if(!Ut(t))throw xt('"response" body must be a top level object',Cn,{body:t});return t}const Yn=Symbol(),Zn=Symbol(),qn=new TextEncoder,Qn=new TextDecoder;function $n(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 er(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&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}}),lt(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),lt(this,"claim",void 0),lt(this,"reason",void 0),lt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}lt(rr,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class or extends nr{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}}),lt(this,"code","ERR_JWT_EXPIRED"),lt(this,"claim",void 0),lt(this,"reason",void 0),lt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}lt(or,"code","ERR_JWT_EXPIRED");class ir extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}lt(ir,"code","ERR_JOSE_ALG_NOT_ALLOWED");class ar extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JOSE_NOT_SUPPORTED")}}lt(ar,"code","ERR_JOSE_NOT_SUPPORTED"),lt(class extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),lt(class extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class sr extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWS_INVALID")}}lt(sr,"code","ERR_JWS_INVALID");class cr extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWT_INVALID")}}lt(cr,"code","ERR_JWT_INVALID"),lt(class extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class ur extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWKS_INVALID")}}lt(ur,"code","ERR_JWKS_INVALID");class lr extends nr{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),lt(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}lt(lr,"code","ERR_JWKS_NO_MATCHING_KEY");class dr extends nr{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),lt(this,Symbol.asyncIterator,void 0),lt(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}lt(dr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class hr extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWKS_TIMEOUT")}}lt(hr,"code","ERR_JWKS_TIMEOUT");class pr extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}lt(pr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const fr=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},mr=(e,t)=>e.name===t;function wr(e){return parseInt(e.name.slice(4),10)}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 gr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},vr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Er=e=>br(e)||vr(e);function Ar(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 Sr=(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)},Rr=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Or=(e,t,n)=>{var r;const o=(e=>er(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){Tr(e,48,"Invalid PKCS#8 structure"),_r(e),Tr(e,2,"Expected version field");const t=_r(e);e.pos+=t,Tr(e,48,"Expected algorithm identifier");_r(e);e.pos}(t),(e=>{const t=(e=>{Tr(e,6,"Expected algorithm OID");const t=_r(e);return Rr(e,t)})(e);if(Sr(t,[43,101,110]))return"X25519";if(!Sr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Tr(e,6,"Expected curve OID");const n=_r(e),r=Rr(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(Sr(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 ar("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 ar('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)};async function Ir(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new ar('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=ht({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const kr=e=>Ar(e)&&"string"==typeof e.kty;let Nr;const Cr=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Nr||(Nr=new WeakMap);let o=Nr.get(e);if(null!=o&&o[n])return o[n];const i=await Ir(ht(ht({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Nr.set(e,{[n]:i}),i};const Lr=e=>null==e?void 0:e[Symbol.toStringTag],Pr=(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 xr,Ur;let Dr,Mr;if("undefined"==typeof navigator||null===(xr=navigator.userAgent)||void 0===xr||null===(Ur=xr.startsWith)||void 0===Ur||!Ur.call(xr,"Mozilla/5.0 ")){const e="v6.8.1";Mr="".concat("openid-client","/").concat(e),Dr={"user-agent":Mr}}const Br=e=>jr.get(e);let jr,Gr;function Kr(e){return void 0!==e?Yt(e):(Gr||(Gr=new WeakMap),(e,t,n,r)=>{let o;return(o=Gr.get(t))||(function(e,t){if("string"!=typeof e)throw Xr("".concat(t," must be a string"),Fr);if(0===e.length)throw Xr("".concat(t," must not be empty"),Wr)}(t.client_secret,'"metadata.client_secret"'),o=Yt(t.client_secret),Gr.set(t,o)),o(e,t,n,r)})}const Hr=St,Wr="ERR_INVALID_ARG_VALUE",Fr="ERR_INVALID_ARG_TYPE";function Xr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Vr extends Error{constructor(e,t){var n;super(e,t),lt(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 zr(e,t,n){return new Vr(e,{cause:t,code:n})}function Jr(e){if(e instanceof TypeError||e instanceof Vr||e instanceof tn||e instanceof nn||e instanceof rn)throw e;if(e instanceof Pt)switch(e.code){case xn:throw zr("only requests to HTTPS are allowed",e,e.code);case Un:throw zr("only requests to HTTP or HTTPS are allowed",e,e.code);case Pn:throw zr("unexpected HTTP response status code",e.cause,e.code);case Ln:throw zr("unexpected response content-type",e.cause,e.code);case Nn:throw zr("parsing error occured",e,e.code);case Cn:throw zr("invalid response encountered",e,e.code);case Mn:throw zr("unexpected JWT claim value encountered",e,e.code);case Bn:throw zr("unexpected JSON attribute value encountered",e,e.code);case Dn:throw zr("JWT timestamp claim value failed validation",e,e.code);default:throw zr(e.message,e,e.code)}if(e instanceof Lt)throw zr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw zr("runtime operation error",e,In);case"NotSupportedError":throw zr("runtime unsupported operation",e,In);case"TimeoutError":throw zr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw zr("operation aborted",e,"OAUTH_ABORT")}throw new Vr("something went wrong",{cause:e})}async function Yr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Xr('"server" must be an instance of URL',Fr);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 bt('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Qt(e,!0!==(null==r?void 0:r[vt]));const o=n(new URL(e.href)),i=Dt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[St])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Mt(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=Bt("".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=Bt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw bt('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[St]:null==t?void 0:t[Hr],[vt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(ro),signal:a,headers:new Headers(Dr)}):((null==t?void 0:t[Hr])||fetch)((Qt(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(ro)),e.href),{headers:Object.fromEntries(new Headers(ht({accept:"application/json"},Dr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Yn)throw bt('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!gt(t,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw xt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',Pn,t);Kn(t);const r=await Jn(t);if(Gt(r.issuer,'"response" body "issuer" property',Cn,{body:r}),n!==Yn&&new URL(r.issuer).href!==n.href)throw xt('"response" body "issuer" property does not match the expected value',Bn,{expected:n.href,body:r,attribute:"issuer"});return r}(Yn,e)).catch(Jr);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[Zr]=!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 Vr("discovered metadata issuer does not match the expected issuer",{code:Bn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new qr(i,t,n,r);let s=Br(a);if(null!=o&&o[Hr]&&(s.fetch=o[Hr]),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 Zr=Symbol();class qr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Xr('"clientId" must be a non-empty string',Fr);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 Xr('"clientId" and "metadata.client_id" must be the same',Wr);const u=ht(ht({},structuredClone(n)),{},{client_id:t});let l;u[Et]=null!==(i=null===(a=n)||void 0===a?void 0:a[Et])&&void 0!==i?i:0,u[At]=null!==(s=null===(c=n)||void 0===c?void 0:c[At])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?Kr(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);Zr in e&&(h[Zn]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);jr||(jr=new WeakMap),jr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Br(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(Br(this).c)}get timeout(){return Br(this).timeout}set timeout(e){Br(this).timeout=e}get[Hr](){return Br(this).fetch}set[Hr](e){Br(this).fetch=e}}function Qr(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 wn(this)}catch(e){return}}}}}(e))}async function $r(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 Pt("invalid Retry-After header value",{cause:e});a>t&&await eo(a-t,n)}function eo(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 to(e,t){uo(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=Br(e);return async function(e,t,n,r,o){zt(e),Jt(t);const i=en(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[vt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Dt(null==o?void 0:o.headers);return s.set("accept","application/json"),hn(e,t,n,i,a,s,o)}(n,r,o,t,{[St]:i,[vt]:!a,headers:new Headers(Dr),signal:lo(s)}).then(e=>async function(e,t,n){if(zt(e),Jt(t),!gt(n,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await un(n,200,"Backchannel Authentication Endpoint"),Kn(n);const r=await Jn(n);Gt(r.auth_req_id,'"response" body "auth_req_id" property',Cn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return jt(o,!0,'"response" body "expires_in" property',Cn,{body:r}),r.expires_in=o,void 0!==r.interval&&jt(r.interval,!1,'"response" body "interval" property',Cn,{body:r}),r}(n,r,e)).catch(Jr)}async function no(e,t,n,r){var o,i;uo(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 eo(a,s)}catch(e){Jr(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=Br(e),w=(o,i)=>no(e,ht(ht({},t),{},{interval:o}),n,ht(ht({},r),{},{signal:s,flag:i})),y=await async function(e,t,n,r,o){zt(e),Jt(t),Gt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),pn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[St]:d,[vt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Dr),signal:s.aborted?s:lo(f)}).catch(Jr);var g;if(503===y.status&&y.headers.has("retry-after"))return await $r(y,a,s,!0),await(null===(g=y.body)||void 0===g?void 0:g.cancel()),w(a);const b=async function(e,t,n,r){return yn(e,t,n,void 0,null==r?void 0:r[Tt],null==r?void 0:r.recognizedTokenTypes)}(c,u,y,{[Tt]:m});let v;try{v=await b}catch(e){if(ho(e,r))return w(a,po);if(e instanceof tn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await $r(e.response,a,s),w(a)}Jr(e)}return v.id_token&&await(null==p?void 0:p(y)),Qr(v),v}function ro(e){Br(e).tlsOnly=!1}async function oo(e,t,n,r,o){if(uo(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 Xr('"currentUrl" must be an instance of URL, or Request',Fr);let i,a;const{as:s,c,auth:u,fetch:l,tlsOnly:d,jarm:h,hybrid:p,nonRepudiation:f,timeout:m,decrypt:w,implicit:y}=Br(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 bt("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==dn(e))throw bt("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw bt("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{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 Xr("unexpected Request HTTP method",Wr)}}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(zt(e),Jt(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw bt('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(Xn(n,"response"))throw xt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Cn,{parameters:n});const o=Xn(n,"iss"),i=Xn(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw xt('response parameter "iss" (issuer) missing',Cn,{parameters:n});if(o&&o!==e.issuer)throw xt('unexpected "iss" (issuer) response parameter value',Cn,{expected:e.issuer,parameters:n});switch(r){case void 0:case zn:if(void 0!==i)throw xt('unexpected "state" response parameter encountered',Cn,{expected:void 0,parameters:n});break;case Vn:break;default:if(Gt(r,'"expectedState" argument'),i!==r)throw xt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Cn,{expected:r,parameters:n})}if(Xn(n,"error"))throw new nn("authorization response from the server is an error",{cause:n});const a=Xn(n,"id_token"),s=Xn(n,"token");if(void 0!==a||void 0!==s)throw new Lt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),vn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Jr(e)}}}const g=await async function(e,t,n,r,o,i,a){if(zt(e),Jt(t),!vn.has(r))throw bt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");Gt(o,'"redirectUri"');const s=Xn(r,"code");if(!s)throw xt('no authorization code in "callbackParameters"',Cn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==En&&(Gt(i,'"codeVerifier"'),c.set("code_verifier",i)),pn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||En,{additionalParameters:r,[St]:l,[vt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Dr),signal:lo(m)}).catch(Jr);"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=_n;break;case _n:break;default:Gt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=Tn;break;case Tn:break;default:jt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await yn(e,t,n,s,i,a);Gt(c.id_token,'"response" body "id_token" property',Cn,{body:c});const u=wn(c);if(o!==Tn){const e=Vt()+Ft(t),n=Xt(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 yn(e,t,n,void 0,null==r?void 0:r[Tt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[Tt]:l,recognizedTokenTypes:n})}).catch(Jr);return Qr(d),d}async function mo(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;r"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 ar('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)}(sr,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 sr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new sr('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 ir('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new sr("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new sr("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(kr(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&Pr(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(!Er(t))throw new TypeError(gr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Lr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(kr(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&Pr(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)&&Pr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Er(t))throw new TypeError(gr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Lr(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?$n(e.protected):new Uint8Array,$n("."),"string"==typeof e.payload?a?$n(e.payload):qn.encode(e.payload):e.payload);let d;try{d=tr(e.signature)}catch(e){throw new sr("Failed to base64url decode the signature")}const h=await async function(e,t){if(e instanceof Uint8Array)return e;if(br(e))return e;if(vr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Nr||(Nr=new WeakMap);let n=Nr.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("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm")}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("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES384"===t&&"P-384"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES512"===t&&"P-521"===n&&(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("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Nr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Cr(e,n,t)}if(kr(e))return e.k?tr(e.k):Cr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await mo(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 ar("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 pr;let p;if(a)try{p=tr(e.payload)}catch(e){throw new sr("Failed to base64url decode the payload")}else p="string"==typeof e.payload?qn.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?ht(ht({},f),{},{key:h}):f}const yo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function go(e){const t=yo.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 bo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function vo(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=Qn.decode(e)),"string"!=typeof e)throw new sr("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new sr("Invalid Compact JWS");const s=await wo({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?ht(ht({},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 cr("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Qn.decode(t))}catch(e){}if(!Ar(n))throw new cr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||bo(e.typ)!==bo(o)))throw new rr('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 rr('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new rr('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new rr('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new rr('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":d=go(r.clockTolerance);break;case"number":d=r.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=r,p=(e=>Math.floor(e.getTime()/1e3))(h||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new rr('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new rr('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>p+d)throw new rr('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new rr('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=p-d)throw new or('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=p-n.iat;if(e-d>("number"==typeof u?u:go(u)))throw new or('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new rr('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?ht(ht({},a),{},{key:o.key}):a}function Eo(e){return Ar(e)}var Ao,So,_o=new WeakMap,To=new WeakMap;class Ro{constructor(e){if(ct(this,_o,void 0),ct(this,To,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Eo)}(e))throw new ur("JSON Web Key Set malformed");ut(_o,this,structuredClone(e))}jwks(){return st(_o,this)}async getKey(e,t){const{alg:n,kid:r}=ht(ht({},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 ar('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=st(_o,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 lr;if(1!==s){const e=new dr,t=st(To,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new ft(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield it(Oo(t,e,n))}catch(e){}}),e}return Oo(st(To,this),a,n)}}async function Oo(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(!Ar(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 tr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new ar('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Ir(ht(ht({},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 Ir(ht(ht({},e),{},{ext:n}));case"EC":case"OKP":return Ir(ht(ht({},e),{},{alg:t,ext:n}));default:throw new ar('Unsupported "kty" (Key Type) Parameter value')}}(ht(ht({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new ur("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Io(e){const t=new Ro(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 ko;if("undefined"==typeof navigator||null===(Ao=navigator.userAgent)||void 0===Ao||null===(So=Ao.startsWith)||void 0===So||!So.call(Ao,"Mozilla/5.0 ")){const e="v6.1.3";ko="".concat("jose","/").concat(e)}const No=Symbol(),Co=Symbol();var Lo=new WeakMap,Po=new WeakMap,xo=new WeakMap,Uo=new WeakMap,Do=new WeakMap,Mo=new WeakMap,Bo=new WeakMap,jo=new WeakMap,Go=new WeakMap,Ko=new WeakMap;class Ho{constructor(e,t){if(ct(this,Lo,void 0),ct(this,Po,void 0),ct(this,xo,void 0),ct(this,Uo,void 0),ct(this,Do,void 0),ct(this,Mo,void 0),ct(this,Bo,void 0),ct(this,jo,void 0),ct(this,Go,void 0),ct(this,Ko,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;ut(Lo,this,new URL(e.href)),ut(Po,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),ut(xo,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),ut(Uo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),ut(Bo,this,new Headers(null==t?void 0:t.headers)),ko&&!st(Bo,this).has("User-Agent")&&st(Bo,this).set("User-Agent",ko),st(Bo,this).has("accept")||(st(Bo,this).set("accept","application/json"),st(Bo,this).append("accept","application/jwk-set+json")),ut(jo,this,null==t?void 0:t[No]),void 0!==(null==t?void 0:t[Co])&&(ut(Ko,this,null==t?void 0:t[Co]),n=null==t?void 0:t[Co],r=st(Uo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Ar(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Ar)&&(ut(Do,this,st(Ko,this).uat),ut(Go,this,Io(st(Ko,this).jwks))))}pendingFetch(){return!!st(Mo,this)}coolingDown(){return"number"==typeof st(Do,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 hr;throw e});if(200!==o.status)throw new nr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new nr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(st(Lo,this).href,st(Bo,this),AbortSignal.timeout(st(Po,this)),st(jo,this)).then(e=>{ut(Go,this,Io(e)),st(Ko,this)&&(st(Ko,this).uat=Date.now(),st(Ko,this).jwks=e),ut(Do,this,Date.now()),ut(Mo,this,void 0)}).catch(e=>{throw ut(Mo,this,void 0),e})),await st(Mo,this)}}const Wo=["mfaToken"],Fo=["mfaToken"];var Xo,Vo,zo,Jo,Yo,Zo,qo,Qo,$o=class extends Error{constructor(e,t){super(t),lt(this,"code",void 0),this.name="NotSupportedError",this.code=e}},ei=class extends Error{constructor(e,t,n){super(t),lt(this,"cause",void 0),lt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ti=class extends ei{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ni=class extends ei{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},ri=class extends ei{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},oi=class extends ei{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ii=class extends ei{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ai=class extends Error{constructor(e){super(e),lt(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},si=class extends ei{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),lt(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ci=class extends ei{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ui=class extends ei{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 ei{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},di=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),lt(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function hi(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>ht(ht({},e),{},{[t[0]]:t[1]}),{})}var pi=class extends Error{constructor(e,t,n){super(t),lt(this,"cause",void 0),lt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},fi=class extends pi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},mi=class extends pi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},wi=class extends pi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},yi=class extends pi{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function gi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var bi=(Xo=new WeakMap,Vo=new WeakMap,zo=new WeakMap,class{constructor(e){var t;ct(this,Xo,void 0),ct(this,Vo,void 0),ct(this,zo,void 0),ut(Xo,this,"https://".concat(e.domain)),ut(Vo,this,e.clientId),ut(zo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(st(Xo,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await st(zo,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 fi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(gi)}async enrollAuthenticator(e){const t="".concat(st(Xo,this),"/mfa/associate"),{mfaToken:n}=e,r=pt(e,Wo),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 st(zo,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 mi(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};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(st(Xo,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await st(zo,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 wi(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(st(Xo,this),"/mfa/challenge"),{mfaToken:n}=e,r=pt(e,Fo),o={mfa_token:n,client_id:st(Vo,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await st(zo,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 yi(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){lt(this,"accessToken",void 0),lt(this,"idToken",void 0),lt(this,"refreshToken",void 0),lt(this,"expiresAt",void 0),lt(this,"scope",void 0),lt(this,"claims",void 0),lt(this,"authorizationDetails",void 0),lt(this,"tokenType",void 0),lt(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}},Ei="openid profile email offline_access",Ai=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 Si(e){if(null==e)throw new ii("subject_token is required");if("string"!=typeof e)throw new ii("subject_token must be a string");if(0===e.trim().length)throw new ii("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ii("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ii("subject_token must not include the 'Bearer ' prefix")}function _i(e,t){if(t)for(const[n,r]of Object.entries(t))if(!Ai.has(n))if(Array.isArray(r)){if(r.length>20)throw new ii("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var Ti=(Jo=new WeakMap,Yo=new WeakMap,Zo=new WeakMap,qo=new WeakMap,Qo=new WeakSet,class{constructor(e){if(function(e,t){at(e,t),t.add(e)}(this,Qo),ct(this,Jo,void 0),ct(this,Yo,void 0),ct(this,Zo,void 0),ct(this,qo,void 0),lt(this,"mfa",void 0),ut(Zo,this,e),e.useMtls&&!e.customFetch)throw new $o("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");this.mfa=new bi({domain:st(Zo,this).domain,clientId:st(Zo,this).clientId,customFetch:st(Zo,this).customFetch})}async buildAuthorizationUrl(e){const{serverMetadata:t}=await ot(Qo,this,Ri).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new $o("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 ot(Qo,this,Ni).call(this,e)}catch(e){throw new ci(e)}}async buildLinkUserUrl(e){try{const t=await ot(Qo,this,Ni).call(this,{authorizationParams:ht(ht({},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 ui(e)}}async buildUnlinkUserUrl(e){try{const t=await ot(Qo,this,Ni).call(this,{authorizationParams:ht(ht({},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 ot(Qo,this,Ri).call(this),r=hi(ht(ht({},st(Zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ht(ht({scope:Ei},r),{},{client_id:st(Zo,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 to(t,o),n=await no(t,e);return vi.fromTokenEndpointResponse(n)}catch(e){throw new si(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ot(Qo,this,Ri).call(this),r=hi(ht(ht({},st(Zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ht(ht({scope:Ei},r),{},{client_id:st(Zo,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 to(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new si(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await ot(Qo,this,Ri).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await fo(n,"urn:openid:params:grant-type:ciba",r);return vi.fromTokenEndpointResponse(e)}catch(e){throw new si(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new oi("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 oi("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?"urn:ietf:params:oauth:token-type:access_token":"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ii)throw new oi(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?ot(Qo,this,Oi).call(this,e):ot(Qo,this,Ii).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await ot(Qo,this,Ri).call(this);try{const r=await oo(n,e,{pkceCodeVerifier:t.codeVerifier});return vi.fromTokenEndpointResponse(r)}catch(e){throw new ti("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await ot(Qo,this,Ri).call(this);try{const n=await io(t,e.refreshToken);return vi.fromTokenEndpointResponse(n)}catch(e){throw new ri("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await ot(Qo,this,Ri).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await ao(t,n);return vi.fromTokenEndpointResponse(r)}catch(e){throw new ni("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await ot(Qo,this,Ri).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(st(Zo,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",st(Zo,this).clientId),t}return function(e,t){uo(e);const{as:n,c:r,tlsOnly:o}=Br(e),i=en(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 ot(Qo,this,Ri).call(this);st(qo,this)||ut(qo,this,function(e,t){const n=new Ho(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(t.jwks_uri),{[No]:st(Zo,this).customFetch}));const{payload:n}=await vo(e.logoutToken,st(qo,this),{issuer:t.issuer,audience:st(Zo,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in n)&&!("sub"in n))throw new ai('either "sid" or "sub" (or both) claims must be present');if("sid"in n&&"string"!=typeof n.sid)throw new ai('"sid" claim must be a string');if("sub"in n&&"string"!=typeof n.sub)throw new ai('"sub" claim must be a string');if("nonce"in n)throw new ai('"nonce" claim is prohibited');if(!("events"in n))throw new ai('"events" claim is missing');if("object"!=typeof n.events||null===n.events)throw new ai('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in n.events))throw new ai('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof n.events["http://schemas.openid.net/event/backchannel-logout"])throw new ai('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:n.sid,sub:n.sub}}});async function Ri(){if(st(Jo,this)&&st(Yo,this))return{configuration:st(Jo,this),serverMetadata:st(Yo,this)};const e=await ot(Qo,this,ki).call(this);return ut(Jo,this,await Yr(new URL("https://".concat(st(Zo,this).domain)),st(Zo,this).clientId,{use_mtls_endpoint_aliases:st(Zo,this).useMtls},e,{[Hr]:st(Zo,this).customFetch})),ut(Yo,this,st(Jo,this).serverMetadata()),st(Jo,this)[Hr]=st(Zo,this).customFetch||fetch,{configuration:st(Jo,this),serverMetadata:st(Yo,this)}}async function Oi(e){var t,n;const{configuration:r}=await ot(Qo,this,Ri).call(this);if("audience"in e||"resource"in e)throw new ii("audience and resource parameters are not supported for Token Vault exchanges");Si(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",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),_i(o,e.extra);try{const e=await fo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return vi.fromTokenEndpointResponse(e)}catch(t){throw new ii("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Ii(e){const{configuration:t}=await ot(Qo,this,Ri).call(this);Si(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),_i(n,e.extra);try{const e=await fo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return vi.fromTokenEndpointResponse(e)}catch(t){throw new ii("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ki(){if(!st(Zo,this).clientSecret&&!st(Zo,this).clientAssertionSigningKey&&!st(Zo,this).useMtls)throw new di;if(st(Zo,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=st(Zo,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 Or(e,t,void 0)}(e,st(Zo,this).clientAssertionSigningAlg||"RS256")),e?function(e){return Zt(e,void 0)}(e):Kr(st(Zo,this).clientSecret)}async function Ni(e){const{configuration:t}=await ot(Qo,this,Ri).call(this),n=Ht(),r=await function(e){return async function(e){return Gt(e,"codeVerifier"),Ct(await crypto.subtle.digest("SHA-256",It(e)))}(e)}(n),o=hi(ht(ht({},st(Zo,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(ht(ht({scope:Ei},o),{},{client_id:st(Zo,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await co(t,i):await so(t,i),codeVerifier:n}}class Ci extends E{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ci.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new Ci(t,n)}}class Li extends Ci{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Li.prototype)}}class Pi extends Ci{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Pi.prototype)}}class xi extends Ci{constructor(e,t){super(e,t),Object.setPrototypeOf(this,xi.prototype)}}class Ui extends Ci{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ui.prototype)}}class Di extends Ci{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Di.prototype)}}class Mi{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 Bi{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Mi}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 Li("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 fi)throw new Li(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=nt[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 mi)throw new Pi(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 yi)throw new xi(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 Di("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 Ui("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 Ui("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 I)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof Ui)throw new Ui(e.error,e.error_description);throw e}}}class ji{constructor(e){let t,n;if(this.userCache=(new Re).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||"memory",!Ve(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=Ve(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Me:Be,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:je;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]=Ae(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Ie(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||v,this.cacheManager=new Oe(n,n.allKeys?void 0:new Fe(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new qe(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 et(s,a),this.authJsClient=new Ti({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Bi(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new He)}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||b,n=M(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(B(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(G(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Ne.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(G(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&&!ke(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||!ke(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!ke(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&&ke(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})}async _prepareAuthorizeUrl(e,t,n){var r;const o=U(x()),i=U(x()),a=x(),s=await j(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:Se(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||"default",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=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise((t,n)=>{let r;const o=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new R(e.popup)))},1e3),i=setTimeout(()=>{clearInterval(o),n(new T(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(i),clearInterval(o),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return n(E.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new E("state_mismatch","Invalid state");const i=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}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=ze(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{openUrl:n,fragment:r,appState:o}=t,i=y(t,["openUrl","fragment","appState"]),a=(null===(e=i.authorizationParams)||void 0===e?void 0:e.organization)||this.options.authorizationParams.organization,s=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=s,u=y(s,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:o,response_type:Ge.Code}),a&&{organization:a}));const l=r?"".concat(c,"#").concat(r):c;n?await n(l):window.location.assign(l)}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 E("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===Ge.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 A(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new E("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:Ge.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 E("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new E("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:Ge.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){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:Se(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=We[t];return n||(n=e().finally(()=>{delete We[t],n=null}),We[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=y(e,["cacheMode"]);if("off"!==t){const e=await this._getEntryFromCache({scope:n.authorizationParams.scope,audience:n.authorizationParams.audience||"default",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||"default",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 I||e instanceof E&&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||"default",clientId:this.options.clientId});if(!t)throw new E("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:Se(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 _e({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",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=y(t,["federated"]),o=n?"&federated":"";return this._url("/v2/logout?".concat(B(Object.assign({clientId:e.clientId},r))))+o}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=ze(e),{openUrl:r}=n,o=y(n,["openUrl"]);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("@@user@@"),await(null===(t=this.dpop)||void 0===t?void 0:t.clear());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 E("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(E.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 E("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 E&&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 _e({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",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||"default",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&&Je(l,c)||Je(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 N(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||"default"})}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 I&&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=y(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{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||"default",t=this.scope[e],n=await this.cacheManager.getIdToken(new _e({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get("@@user@@");return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new _e({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 Ee(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("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),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:Se(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 $e(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=U(x()),c=x(),u=await j(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:Ge.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=y(e,["mfaToken"]);return this._requestToken(Object.assign(Object.assign({},r),{mfa_token:n}),t)}}function Gi(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ki}=Object.prototype,{getPrototypeOf:Hi}=Object,{iterator:Wi,toStringTag:Fi}=Symbol,Xi=(Vi=Object.create(null),e=>{const t=Ki.call(e);return Vi[t]||(Vi[t]=t.slice(8,-1).toLowerCase())});var Vi;const zi=e=>(e=e.toLowerCase(),t=>Xi(t)===e),Ji=e=>t=>typeof t===e,{isArray:Yi}=Array,Zi=Ji("undefined");function qi(e){return null!==e&&!Zi(e)&&null!==e.constructor&&!Zi(e.constructor)&&ea(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qi=zi("ArrayBuffer");const $i=Ji("string"),ea=Ji("function"),ta=Ji("number"),na=e=>null!==e&&"object"==typeof e,ra=e=>{if("object"!==Xi(e))return!1;const t=Hi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Fi in e||Wi in e)},oa=zi("Date"),ia=zi("File"),aa=zi("Blob"),sa=zi("FileList");const ca="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ua=void 0!==ca.FormData?ca.FormData:void 0,la=zi("URLSearchParams"),[da,ha,pa,fa]=["ReadableStream","Request","Response","Headers"].map(zi);function ma(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Yi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const ya="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,ga=e=>!Zi(e)&&e!==ya;const ba=(va="undefined"!=typeof Uint8Array&&Hi(Uint8Array),e=>va&&e instanceof va);var va;const Ea=zi("HTMLFormElement"),Aa=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Sa=zi("RegExp"),_a=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ma(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ta=zi("AsyncFunction"),Ra=(Oa="function"==typeof setImmediate,Ia=ea(ya.postMessage),Oa?setImmediate:Ia?(ka=`axios@${Math.random()}`,Na=[],ya.addEventListener("message",({source:e,data:t})=>{e===ya&&t===ka&&Na.length&&Na.shift()()},!1),e=>{Na.push(e),ya.postMessage(ka,"*")}):e=>setTimeout(e));var Oa,Ia,ka,Na;const Ca="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ya):"undefined"!=typeof process&&process.nextTick||Ra,La={isArray:Yi,isArrayBuffer:Qi,isBuffer:qi,isFormData:e=>{let t;return e&&(ua&&e instanceof ua||ea(e.append)&&("formdata"===(t=Xi(e))||"object"===t&&ea(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Qi(e.buffer),t},isString:$i,isNumber:ta,isBoolean:e=>!0===e||!1===e,isObject:na,isPlainObject:ra,isEmptyObject:e=>{if(!na(e)||qi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:da,isRequest:ha,isResponse:pa,isHeaders:fa,isUndefined:Zi,isDate:oa,isFile:ia,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:aa,isRegExp:Sa,isFunction:ea,isStream:e=>na(e)&&ea(e.pipe),isURLSearchParams:la,isTypedArray:ba,isFileList:sa,forEach:ma,merge:function e(){const{caseless:t,skipUndefined:n}=ga(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=t&&wa(r,i)||i;ra(r[a])&&ra(o)?r[a]=e(r[a],o):ra(o)?r[a]=e({},o):Yi(o)?r[a]=o.slice():n&&Zi(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(ma(t,(t,r)=>{n&&ea(t)?Object.defineProperty(e,r,{value:Gi(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{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&&Hi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Xi,kindOfTest:zi,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(Yi(e))return e;let t=e.length;if(!ta(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Wi]).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:Ea,hasOwnProperty:Aa,hasOwnProp:Aa,reduceDescriptors:_a,freezeMethods:e=>{_a(e,(t,n)=>{if(ea(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];ea(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 Yi(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:wa,global:ya,isContextDefined:ga,isSpecCompliantForm:function(e){return!!(e&&ea(e.append)&&"FormData"===e[Fi]&&e[Wi])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(na(e)){if(t.indexOf(e)>=0)return;if(qi(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Yi(e)?[]:{};return ma(e,(e,t)=>{const i=n(e,r+1);!Zi(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Ta,isThenable:e=>e&&(na(e)||ea(e))&&ea(e.then)&&ea(e.catch),setImmediate:Ra,asap:Ca,isIterable:e=>null!=e&&ea(e[Wi])};class Pa extends Error{static from(e,t,n,r,o,i){const a=new Pa(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",{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(){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:La.toJSONObject(this.config),code:this.code,status:this.status}}}Pa.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Pa.ERR_BAD_OPTION="ERR_BAD_OPTION",Pa.ECONNABORTED="ECONNABORTED",Pa.ETIMEDOUT="ETIMEDOUT",Pa.ERR_NETWORK="ERR_NETWORK",Pa.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Pa.ERR_DEPRECATED="ERR_DEPRECATED",Pa.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Pa.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Pa.ERR_CANCELED="ERR_CANCELED",Pa.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Pa.ERR_INVALID_URL="ERR_INVALID_URL";const xa=Pa;var Ua=n(8287).hp;function Da(e){return La.isPlainObject(e)||La.isArray(e)}function Ma(e){return La.endsWith(e,"[]")?e.slice(0,-2):e}function Ba(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ma(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ja=La.toFlatObject(La,{},null,function(e){return/^is[A-Z]/.test(e)});const Ga=function(e,t,n){if(!La.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=La.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!La.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&La.isSpecCompliantForm(t);if(!La.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(La.isDate(e))return e.toISOString();if(La.isBoolean(e))return e.toString();if(!s&&La.isBlob(e))throw new xa("Blob is not supported. Use a Buffer instead.");return La.isArrayBuffer(e)||La.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Ua.from(e):e}function u(e,n,o){let s=e;if(La.isReactNative(t)&&La.isReactNativeBlob(e))return t.append(Ba(o,n,i),c(e)),!1;if(e&&!o&&"object"==typeof e)if(La.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(La.isArray(e)&&function(e){return La.isArray(e)&&!e.some(Da)}(e)||(La.isFileList(e)||La.endsWith(n,"[]"))&&(s=La.toArray(e)))return n=Ma(n),s.forEach(function(e,r){!La.isUndefined(e)&&null!==e&&t.append(!0===a?Ba([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!Da(e)||(t.append(Ba(o,n,i),c(e)),!1)}const l=[],d=Object.assign(ja,{defaultVisitor:u,convertValue:c,isVisitable:Da});if(!La.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!La.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),La.forEach(n,function(n,i){!0===(!(La.isUndefined(n)||null===n)&&o.call(t,n,La.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function Ka(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ha(e,t){this._pairs=[],e&&Ga(e,this,t)}const Wa=Ha.prototype;Wa.append=function(e,t){this._pairs.push([e,t])},Wa.toString=function(e){const t=e?function(t){return e.call(this,t,Ka)}:Ka;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Fa=Ha;function Xa(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Va(e,t,n){if(!t)return e;const r=n&&n.encode||Xa,o=La.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):La.isURLSearchParams(t)?t.toString():new Fa(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const za=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){La.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ja={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ya={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Fa,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Za="undefined"!=typeof window&&"undefined"!=typeof document,qa="object"==typeof navigator&&navigator||void 0,Qa=Za&&(!qa||["ReactNative","NativeScript","NS"].indexOf(qa.product)<0),$a="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,es=Za&&window.location.href||"http://localhost",ts={...e,...Ya};const ns=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&&La.isArray(r)?r.length:i,s)return La.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&La.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&La.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 La.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const rs={transitional:Ja,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=La.isObject(e);o&&La.isHTMLForm(e)&&(e=new FormData(e));if(La.isFormData(e))return r?JSON.stringify(ns(e)):e;if(La.isArrayBuffer(e)||La.isBuffer(e)||La.isStream(e)||La.isFile(e)||La.isBlob(e)||La.isReadableStream(e))return e;if(La.isArrayBufferView(e))return e.buffer;if(La.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ga(e,new ts.classes.URLSearchParams,{visitor:function(e,t,n,r){return ts.isNode&&La.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=La.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ga(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(La.isString(e))try{return(t||JSON.parse)(e),La.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||rs.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(La.isResponse(e)||La.isReadableStream(e))return e;if(e&&La.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw xa.from(e,xa.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};La.forEach(["delete","get","head","post","put","patch"],e=>{rs.headers[e]={}});const os=rs,is=La.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"]),as=Symbol("internals");function ss(e){return e&&String(e).trim().toLowerCase()}function cs(e){return!1===e||null==e?e:La.isArray(e)?e.map(cs):String(e)}function us(e,t,n,r,o){return La.isFunction(r)?r.call(this,t,n):(o&&(t=n),La.isString(t)?La.isString(r)?-1!==t.indexOf(r):La.isRegExp(r)?r.test(t):void 0:void 0)}class ls{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ss(t);if(!o)throw new Error("header name must be a non-empty string");const i=La.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=cs(e))}const i=(e,t)=>La.forEach(e,(e,n)=>o(e,n,t));if(La.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(La.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((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]&&is[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(La.isObject(e)&&La.isIterable(e)){let n,r,o={};for(const t of e){if(!La.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?La.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=ss(e)){const n=La.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(La.isFunction(t))return t.call(this,e,n);if(La.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ss(e)){const n=La.findKey(this,e);return!(!n||void 0===this[n]||t&&!us(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ss(e)){const o=La.findKey(n,e);!o||t&&!us(0,n[o],o,t)||(delete n[o],r=!0)}}return La.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&&!us(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return La.forEach(this,(r,o)=>{const i=La.findKey(n,o);if(i)return t[i]=cs(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]=cs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return La.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&La.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[as]=this[as]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ss(e);t[r]||(!function(e,t){const n=La.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return La.isArray(e)?e.forEach(r):r(e),this}}ls.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),La.reduceDescriptors(ls.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),La.freezeMethods(ls);const ds=ls;function hs(e,t){const n=this||os,r=t||n,o=ds.from(r.headers);let i=r.data;return La.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ps(e){return!(!e||!e.__CANCEL__)}const fs=class extends xa{constructor(e,t,n){super(null==e?"canceled":e,xa.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ms(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new xa("Request failed with status code "+n.status,[xa.ERR_BAD_REQUEST,xa.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const ws=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)]},gs=(e,t,n=3)=>{let r=0;const o=ws(50,250);return ys(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},bs=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},vs=e=>(...t)=>La.asap(()=>e(...t)),Es=ts.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ts.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,As=ts.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];La.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),La.isString(r)&&s.push(`path=${r}`),La.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),La.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ss(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const _s=e=>e instanceof ds?{...e}:e;function Ts(e,t){t=t||{};const n={};function r(e,t,n,r){return La.isPlainObject(e)&&La.isPlainObject(t)?La.merge.call({caseless:r},e,t):La.isPlainObject(t)?La.merge({},t):La.isArray(t)?t.slice():t}function o(e,t,n,o){return La.isUndefined(t)?La.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!La.isUndefined(t))return r(void 0,t)}function a(e,t){return La.isUndefined(t)?La.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 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,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(_s(e),_s(t),0,!0)};return La.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=La.hasOwnProp(c,r)?c[r]:o,a=i(e[r],t[r],r);La.isUndefined(a)&&i!==s||(n[r]=a)}),n}const Rs=e=>{const t=Ts({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=ds.from(a),t.url=Va(Ss(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),La.isFormData(n))if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(La.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(ts.hasStandardBrowserEnv&&(r&&La.isFunction(r)&&(r=r(t)),r||!1!==r&&Es(t.url))){const e=o&&i&&As.read(i);e&&a.set(o,e)}return t},Os="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Rs(e);let o=r.data;const i=ds.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 w(){if(!m)return;const r=ds.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ms(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=w:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(w)},m.onabort=function(){m&&(n(new xa("Request aborted",xa.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new xa(r,xa.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ja;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new xa(t,o.clarifyTimeoutError?xa.ETIMEDOUT:xa.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&La.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),La.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=gs(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=gs(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new fs(null,e,m):t),m.abort(),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&&-1===ts.protocols.indexOf(y)?n(new xa("Unsupported protocol "+y+":",xa.ERR_BAD_REQUEST,e)):m.send(o||null)})},Is=(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 xa?t:new fs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new xa(`timeout of ${t}ms exceeded`,xa.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=()=>La.asap(a),s}},ks=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Ns(e))yield*ks(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})},{isFunction:Ls}=La,Ps=(({Request:e,Response:t})=>({Request:e,Response:t}))(La.global),{ReadableStream:xs,TextEncoder:Us}=La.global,Ds=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ms=e=>{e=La.merge.call({skipUndefined:!0},Ps,e);const{fetch:t,Request:n,Response:r}=e,o=t?Ls(t):"function"==typeof fetch,i=Ls(n),a=Ls(r);if(!o)return!1;const s=o&&Ls(xs),c=o&&("function"==typeof Us?(u=new Us,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&Ds(()=>{let e=!1;const t=new n(ts.origin,{body:new xs,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&Ds(()=>La.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new xa(`Response type '${e}' is not supported`,xa.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=La.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(La.isBlob(e))return e.size;if(La.isSpecCompliantForm(e)){const t=new n(ts.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return La.isArrayBufferView(e)||La.isArrayBuffer(e)?e.byteLength:(La.isURLSearchParams(e)&&(e+=""),La.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:w,responseType:y,headers:g,withCredentials:b="same-origin",fetchOptions:v}=Rs(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let A=Is([c,u&&u.toAbortSignal()],f),S=null;const _=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let T;try{if(w&&l&&"get"!==a&&"head"!==a&&0!==(T=await p(g,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(La.isFormData(s)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=bs(T,gs(vs(w)));s=Cs(t.body,65536,e,n)}}La.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:A,method:a.toUpperCase(),headers:g.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};S=i&&new n(o,c);let u=await(i?E(S,v):E(o,c));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&_)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=La.toFiniteNumber(u.headers.get("content-length")),[n,o]=m&&bs(t,gs(vs(m),!0))||[];u=new r(Cs(u.body,65536,n,()=>{o&&o(),_&&_()}),e)}y=y||"text";let R=await h[La.findKey(h,y)||"text"](u,e);return!f&&_&&_(),await new Promise((t,n)=>{ms(t,n,{data:R,headers:ds.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:S})})}catch(t){if(_&&_(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new xa("Network Error",xa.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw xa.from(t,t&&t.code,e,S,t&&t.response)}}},Bs=new Map,js=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=Bs;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Ms(t)),u=s;return s},Gs=(js(),{http:null,xhr:Os,fetch:{get:js}});La.forEach(Gs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ks=e=>`- ${e}`,Hs=e=>La.isFunction(e)||null===e||!1===e;const Ws={getAdapter:function(e,t){e=La.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(Ks).join("\n"):" "+Ks(e[0]):"as no adapter specified";throw new xa("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Gs};function Fs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fs(null,e)}function Xs(e){Fs(e),e.headers=ds.from(e.headers),e.data=hs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ws.getAdapter(e.adapter||os.adapter,e)(e).then(function(t){return Fs(e),t.data=hs.call(e,e.transformResponse,t),t.headers=ds.from(t.headers),t},function(t){return ps(t)||(Fs(e),t&&t.response&&(t.response.data=hs.call(e,e.transformResponse,t.response),t.response.headers=ds.from(t.response.headers))),Promise.reject(t)})}const Vs="1.13.6",zs={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zs[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Js={};zs.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Vs+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new xa(r(o," has been removed"+(t?" in "+t:"")),xa.ERR_DEPRECATED);return t&&!Js[o]&&(Js[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)}},zs.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Ys={assertOptions:function(e,t,n){if("object"!=typeof e)throw new xa("options must be an object",xa.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new xa("option "+i+" must be "+n,xa.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new xa("Unknown option "+i,xa.ERR_BAD_OPTION)}},validators:zs},Zs=Ys.validators;class qs{constructor(e){this.defaults=e||{},this.interceptors={request:new za,response:new za}}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=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ts(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ys.assertOptions(n,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean),legacyInterceptorReqResOrdering:Zs.transitional(Zs.boolean)},!1),null!=r&&(La.isFunction(r)?t.paramsSerializer={serialize:r}:Ys.assertOptions(r,{encode:Zs.function,serialize:Zs.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ys.assertOptions(t,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&La.merge(o.common,o[t.method]);o&&La.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ds.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||Ja;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=[Xs.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 fs(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 $s(function(t){e=t});return{token:t,cancel:e}}}const ec=$s;const tc={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(tc).forEach(([e,t])=>{tc[t]=e});const nc=tc;const rc=function e(t){const n=new Qs(t),r=Gi(Qs.prototype.request,n);return La.extend(r,Qs.prototype,n,{allOwnKeys:!0}),La.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Ts(t,n))},r}(os);rc.Axios=Qs,rc.CanceledError=fs,rc.CancelToken=ec,rc.isCancel=ps,rc.VERSION=Vs,rc.toFormData=Ga,rc.AxiosError=xa,rc.Cancel=rc.CanceledError,rc.all=function(e){return Promise.all(e)},rc.spread=function(e){return function(t){return e.apply(null,t)}},rc.isAxiosError=function(e){return La.isObject(e)&&!0===e.isAxiosError},rc.mergeConfig=Ts,rc.AxiosHeaders=ds,rc.formToJSON=e=>ns(La.isHTMLForm(e)?new FormData(e):e),rc.getAdapter=Ws.getAdapter,rc.HttpStatusCode=nc,rc.default=rc;const oc=rc,ic={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"};var ac,sc;function cc(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 uc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=lc().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])},pc=function(){var e=hc();return".".concat(e)},fc=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},mc=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=hc(),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,";")})},wc=function(){return lc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},yc=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=w(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)},gc=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=hc().split(".")[0],e.prev=1,e.next=2,oc({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)}}(),bc=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,oc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(wc())),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)}}(),vc=function(){return"complete"===document.readyState},Ec=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(vc())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=vc()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},Ac=function(){return new Promise(function(e){if(("interactive"===document.readyState||vc())&&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)}})},Sc=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()})},_c=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,Ac();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)}}(),Tc=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,Ac();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)}}(),Rc=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,_c(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)}}(),Oc=function(){return new Promise(function(e){a("blueConicReady | Waiting for BC to be ready."),window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){a("blueConicReady | onReady fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicReady | onReady timeout, BC onReady unknown."),e(!1)},3e3)})},Ic=function(){return new Promise(function(e){a("blueConicProfileReady | Waiting for BC Profile to be ready."),window.blueConicClient&&(window.blueConicClient.getSegments||window.blueConicClient.profile)&&(a("blueConicProfileReady | BC getSegments is ready."),e(!0)),window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){a("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)})},kc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){a("blueConicLoaded | waitTillBCReady is ".concat(e));var n=setTimeout(function(){clearTimeout(n),a("blueConicLoaded | onBlueConicLoaded timeout, resolving false for load status."),t(!1)},1e4);void 0!==window.blueConicClient&&void 0!==window.blueConicClient.event&&void 0!==window.blueConicClient.event.subscribe?(a("blueConicLoaded | BC object already loaded"),e?t(Oc()):(clearTimeout(n),t())):(a('blueConicLoaded | BC not loaded, waiting for "onBlueConicLoaded" event'),window.addEventListener("onBlueConicLoaded",r(o.mark(function r(){var i;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a("blueConicLoaded | onBlueConicLoaded event fired."),!e){r.next=2;break}return a("blueConicLoaded | waiting for blueConicReady..."),r.next=1,Oc();case 1:i=r.sent,clearTimeout(n),t(i),r.next=3;break;case 2:clearTimeout(n),t();case 3:case"end":return r.stop()}},r)})),!1))})},Nc=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,kc(!0);case 1:if(!e.sent){e.next=4;break}return e.next=2,Ic();case 2:if(e.sent){e.next=3;break}return e.abrupt("return",!1);case 3:return e.abrupt("return",blueConicClient.profile.getProfile().getValue("Auth0_ID"));case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Cc=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[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,kc(!0);case 1:if(!e.sent){e.next=3;break}if(s=window.blueConicClient.getSegments(),a("bcLowaCheck | BC segments for users: ",s),!(s.filter(function(e){return i.includes(e.name)}).length>0)){e.next=3;break}return e.next=2,Nc();case 2:(c=e.sent)&&(n=!0,r=c);case 3:return t&&n&&Lc(),u={isSub:n},r&&(u.uuid=r),e.abrupt("return",u);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Lc=function(){fc("bc_lowa_status",1,{path:"/",domain:pc(),expires:7,secure:!0})},Pc=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))})},xc=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)}}(),Uc=function(){mc(ic.AUTH0_SUB_COOKIE_KEY),mc("mng-jwt-decoded"),localStorage.removeItem(ic.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){a("Clearing entitlements...");try{mc(ic.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){a("Failed to delete legacy cookie: ",e)}try{mc(ic.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:hc(),expires:365,secure:!0})}catch(e){a("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(ic.LOCAL_STORAGE_SESSION_KEY)}catch(e){a("Failed to remove local storage: ",e)}}()},Dc=function(){var e=lc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},Mc=function(e){a("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),a("Storage Object removed : ",e))},Bc=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=Bc;var jc;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Gc=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===jc){e.next=1;break}return e.abrupt("return",jc);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,jc=new ji({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",jc);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Kc=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"),sc=new CustomEvent("mng-auth-check-complete",{detail:e}),ac?(a("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(sc)):a("Islands not ready")},Hc=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},Wc=function(e){return Number.isInteger(Number(e))};var Fc=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Xc=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=wc(),a("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,oc({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)}}(),Vc=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,w,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:uc({},i)}));case 1:return r.next=2,Rc();case 2:return u=r.sent,r.next=3,_c("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,xc();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:uc({},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,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:uc({},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()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=Vc);var zc=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,kc();case 1:return e.next=2,Pc();case 2:return e.abrupt("return",new Promise(function(e){a("ANALYTICS: inside BCregwall events");var t=lc();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)}}(),Jc=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=yc(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)}}(),Yc=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)}}(),Zc=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=yc(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)}}(),qc=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,Pc();case 1:n=e.sent,r=n.isAuthenticated,i=r,e.next=!0===i?2:!1===i?3:i===ic.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=ic.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)}}(),Qc=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)}},$c=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)}},eu=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(Wc(window.authentication_config["got".concat(t,"GroupTime")])?parseInt(window.authentication_config["got".concat(t,"GroupTime")],10):1);break;default:return n.event}return n},tu=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=Hc("GroupEnabled"),i=Hc("GroupDelayEnabled"),s=Hc("GroupTimeDelayEnabled"),c=Hc("got".concat(n,"GroupEnabled")),u=Hc("got".concat(r,"GroupDelayEnabled")),l=Hc("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"),$c(eu("placement",n))):r&&!o&&i&&u&&!s?(a("ANALYTICS: Scroll delay enabled"),$c(eu("scrolling",r))):n&&!o&&!i&&s&&l?(a("ANALYTICS: Time delay enabled"),$c(eu("delayTime",n))):(a("ANALYTICS: No custom event detected"),Qc(eu("default")))):Qc(t)}catch(e){a("ANALYTICS: Event not setup",e)}var n,r,o,i,s,c,u,l,d},nu=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,xc();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"),Jc(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)}}(),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,kc();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ou=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 a("sspwG2iMeterEvent: initializing sspwG2iMeterEvent function"),e.next=1,Rc();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,Tc(["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"))&&(a("sspwG2iMeterEvent: paywall element found: ",r.id),"server-paywall"===r.id?n="SSPW":"server-regwall"===r.id&&(n="SSRW")),i="1"===window.sophi_config.enableSophiSSPW?"sophi":"sspw",s={event:"meterStop",author:t.Byline||"",title:t["Page Title"]||"",section:t.Section||"",actionType:"sophi"===i?"Sophi_SSPW":"SSPWV1",actionName:n},a("sspwG2iMeterEvent: article data found on dataLayer: ",t),e.next=4,Sc();case 4:window.MG2DL=window.MG2DL||[],window.MG2DL.push(s),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 iu={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"),Yc(),window.MNGAuthentication.postAuthEvents=[],window.MNGAuthentication.preAuthGTMEvents=[],window.MNGAuthentication.postAuthEvents.push(tu),!((n=lc()).pathname.startsWith("/logout")||n.pathname.startsWith("/login")||n.pathname.startsWith("/callback"))){e.next=1;break}return e.abrupt("return");case 1:return ru(),e.next=2,qc();case 2:return r=e.sent,e.next=3,nu();case 3:i=e.sent,Zc(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."),ou());case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),blueConicRegwallEvents:zc,callPreparedGTMEvent:Qc,callCustomGTMEvent:$c};var au=function(){try{var e=localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){a("Unable to get session from local storage: ",e)}return"{}"},su=function(e){try{a("Setting local storage session",e),localStorage.setItem(ic.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){a("Unable to save session from local storage: ",e)}},cu=function(e){try{fc(ic.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:pc(),expires:365,secure:!0})}catch(e){a("Unable to save session to cookie storage: ",e)}},uu=function(){var e=r(o.mark(function e(){var t,n,r,s,c,u,l,d,h,p,f,m,w,y,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,oc.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,w=p.entitlementToken,y=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,su(JSON.stringify({accessToken:f,idToken:m,entitlementToken:w,expiration:y,entitlementSource:g,isEntitled:b,adFree:v,entitlementLevel:E})),""!==w&&"string"==typeof w&&cu(w),e.abrupt("return",{accessToken:f,idToken:m,entitlementToken:w,expiration:y,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)}}(),lu=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,oc.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)}}(),du=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,oc.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)}}(),hu=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l,d,h,p,f,m,w,y,g,b,v,E,A,S,_,T,R,O,I,k,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Inside getSession"),e.prev=1,d=au(),a("Session: __MNG_Session = ",d),h=JSON.parse(d),p=h.accessToken,f=h.idToken,m=h.entitlementToken,w=h.expiration,y=h.entitlementSource,g=h.isEntitled,b=h.adFree,v=h.entitlementLevel,n=p,i=w,s=y,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,uu();case 2:E=e.sent,A=E.accessToken,S=E.idToken,_=E.entitlementToken,T=E.expiration,R=E.entitlementSource,O=E.isEntitled,I=E.adFree,k=E.entitlementLevel,n=A,t=S,r=_,i=T,s=R,c=O,u=I,l=k;case 3:e.next=5;break;case 4:e.prev=4,N=e.catch(1),a("Failed to get session: ",N);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)}}(),pu=function(){var e=r(o.mark(function e(t){var n,r,i,s,c,u,l,d,h,p,f,m,w,y,g,b,v,E,A,S,_,T,R,O,I,k,N,C,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=au(),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,w=r.isEntitled,y=void 0===w?null:w,g=r.adFree,b=void 0===g?null:g,v=r.entitlementLevel,E=void 0===v?null:v,A=t.accessToken,S=t.idToken,_=t.entitlementToken,T=t.expiration,R=t.entitlementSource,O=t.isEntitled,I=t.adFree,k=t.entitlementLevel,N={accessToken:null==A?s:A,idToken:null==S?u:S,entitlementToken:null==_?d:_,expiration:null==T?p:T,entitlementSource:null==R?m:R,isEntitled:null==O?y:O,adFree:null==I?b:I,entitlementLevel:null==k?E:k},a("Current session data: ",r),a("New session data: ",t),a("Updated session data:",N),C=JSON.stringify(N),su(C),""!==N.entitlementToken&&"string"==typeof N.entitlementToken&&cu(N.entitlementToken),n===C){e.next=1;break}return e.next=1,lu(N);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)}}(),fu=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..."),Uc(),e.next=1,du();case 1:localStorage.removeItem(ic.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),mu=function(){return"logout"===(lc().searchParams.get("state")||"").toLowerCase()};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[];var wu=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();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)}}(),yu=function(){return"undefined"==typeof CnnXt?(a("Connext was not loaded."),!1):Connext.Storage.GetUserState()},gu=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=/")}},bu=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..."),gu(),a("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?yc(n):"")){e.next=2;break}return s=i.auth0Id,e.next=1,Xc(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,fu();case 3:e.next=5;break;case 4:Uc();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...")}),Mc("hhsl"),Mc("userNewsLetterData"),Mc(ic.REGWALL_USER_IS_SUBSCRIBED),Mc(ic.USER_PROFILE_HASH),u=lc(),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),!Dc()){e.next=10;break}a("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==yu()){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,wu(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,wu(l);case 15:e.next=17;break;case 16:return a("Connext Logout was NOT called"),e.next=17,wu(l);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),vu=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},Eu=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Qc(e)}),a("Cycled through preauth GTM events.")},Au=function(){var e=r(o.mark(function e(t,n,r,i,s){var c,u,l,h,p,f,m,w,y,g,b,v,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("Attempting to login..."),vu()>4.5&&window.localStorage.clear(),Eu(),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,Gc();case 1:if(p=e.sent,f=lc(),m=f.origin,w=new URL("".concat(m,"/callback")),y={},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")?w.searchParams.set("auth_redirect",f.searchParams.get("returnUrl")):s&&w.searchParams.set("auth_redirect",s):w.searchParams.set("auth_redirect",f.toString()),g&&"regwall"!==t&&w.searchParams.set("auth_redirect",g),"true"===f.searchParams.get("close-after-finish")&&w.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,fu();case 2:e.next=4;break;case 3:Uc();case 4:return null!==(h=f.searchParams.get("login-with"))?y.connection=h:n&&(y.connection=n),b="none",t&&"regwall"===t&&(w.searchParams.set("regwall","true"),b="signUp",a("Logging in with regwall")),t&&(w.searchParams.set("loginsource",t),a("Logging in with ".concat(t))),r&&(y.login_hint=r),y.redirect_uri=w.toString(),y.initialScreen=b,"googleonetap"!==t&&(y.prompt="select_account"),null!==(v=f.searchParams.get("ampRegiWall"))&&(E=window.location.hostname,y.ampRegiWall=v,y.sourceDomain=E.replace("www.","").replace("preprod.","").replace("develop.","").replace("staging.",""),y.initialScreen="signUp",y.preferenceId=f.searchParams.get("prefId")),e.next=5,p.loginWithRedirect({authorizationParams:y});case 5:case"end":return e.stop()}},e)}));return function(t,n,r,o,i){return e.apply(this,arguments)}}(),Su=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()}})};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.oidcLoginCallbacks=[];var _u=function(){var e=r(o.mark(function e(){var t,n,i,s,c,u,l,d,h,p,f,m,w,y,g,b,v,E,A,S,_,T;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(gu(),t=lc(),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)),Au(!1,!1,!1,[],c)):Au()):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",Au(!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,Gc();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,Su();case 9:return w=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(w);case 10:a("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,S=e.catch(8),a("Failed to cycle through login callbacks: ",S);case 12:if(y={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,bc(y.userId);case 14:return b=e.sent,a("Encrypted apple uuid is: ".concat(b)),e.next=15,gc(b);case 15:g=e.sent,a("Apple sub status is: ".concat(g)),e.next=17;break;case 16:e.prev=16,_=e.catch(13),a("Apple sub check error: ".concat(_)),alert("There was an error in logging you in, please try again.");case 17:if(Mc(ic.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return a("Saving idToken to session server"),e.next=18,pu({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,A=new URL(i),n&&g&&A.searchParams.append("access_token",b),a("Apple redirect URL:",A),e.abrupt("return",window.location.assign(A));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)}}(),Tu=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,zc();case 1:a("ANALYTICS: bc values should be filled");case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ru=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,Pc();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=yc(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)}}();window.MNGAuthentication.login=Au,window.MNGAuthentication.logout=bu,window.MNGAuthentication.getUserInfo=Ru;var Ou=function(){var e=r(o.mark(function e(){var t,n,s,u,l,d,h,p,f,m,w,y,g;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=lc(),n=!1,s="",u=!1,l={},mu()&&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,Gc();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=dc(ic.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=2;break}return a("Page is logout. Routing to logout function..."),e.next=1,bu();case 1:return e.abrupt("return");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=9;break}return e.next=3,h();case 3:if(""===s){e.next=5;break}if(p=null,f=JSON.parse(window.localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY)),"{}"!==au()){e.next=4;break}return f&&(p=f.jwt),e.next=4,pu({idToken:s,entitlementToken:p});case 4:e.next=8;break;case 5:return e.prev=5,e.next=6,hu();case 6:m=e.sent,s=m.idToken,(n="string"==typeof s)&&(l=yc(s)),e.next=8;break;case 7:e.prev=7,g=e.catch(5),a("Unable to initialize session: ",g);case 8:e.next=10;break;case 9:return e.next=10,h();case 10:if(n||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=12;break}return e.next=11,Cc(!0);case 11:(w=e.sent).isSub&&(n=ic.USER_IS_LOWA,l={sub:w.uuid});case 12:if(Kc({isAuthenticated:n,idToken:s,accessToken:u,claims:l}),Fc("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")&&!mu()&&(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")&&!mu()?(a("Page is login. Attempting to log user in..."),Au()):a("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=14;break}return a("Page is callback with regwall param. Routing to regwall receiver..."),e.next=13,Tu();case 13:a("Now login from regwall"),Au(),e.next=15;break;case 14:if(!t.pathname.startsWith("/callback")){e.next=15;break}return a("Page is callback without regwall param. Routing to callback receiver..."),e.next=15,_u();case 15:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Ou;const Iu={init:Ou};var ku=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 Nu=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=yc(t.credential),e.prev=1,Qc("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,ku(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)}}(),Cu=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:Nu,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"),Qc(t)});case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}();const Lu={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,Pc();case 2:if(t=e.sent,n=t.isAuthenticated,r=lc(),n!==ic.USER_IS_LOWA){e.next=5;break}return e.next=3,Nc();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,Ec();case 7:return a("onetap loading..."),c=new Date,e.next=8,Cu(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),Iu.init(),iu.onLoadAnalytics(),e.next=1,Lu.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 V(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:V(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 R(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return k(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 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 T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(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 A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(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 I(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){G(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){G(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){W(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){W(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 G(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){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function W(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 W(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 V(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 J(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,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}}},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:()=>Va,hasStandardBrowserEnv:()=>Ja,hasStandardBrowserWebWorkerEnv:()=>Ya,navigator:()=>za,origin:()=>Za});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();class w extends Error{constructor(e,t){super(t),this.error=e,this.error_description=t,Object.setPrototypeOf(this,w.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new w(t,n)}}class g extends w{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,g.prototype)}}class b extends w{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,b.prototype)}}class v extends w{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,v.prototype)}}class E extends v{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,E.prototype)}}class A extends w{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,A.prototype)}}class S extends w{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,S.prototype)}}class _ extends w{constructor(e,t,n,r){super(e,t),this.mfa_token=n,this.mfa_requirements=r,Object.setPrototypeOf(this,_.prototype)}}class T extends w{constructor(e,t){super("missing_refresh_token","Missing Refresh Token (audience: '".concat(I(e,["default"]),"', scope: '").concat(I(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,T.prototype)}}class R extends w{constructor(e,t){super("missing_scopes","Missing requested scopes after refresh (audience: '".concat(I(e,["default"]),"', missing scope: '").concat(I(t),"')")),this.audience=e,this.scope=t,Object.setPrototypeOf(this,R.prototype)}}class O extends w{constructor(e){super("use_dpop_nonce","Server rejected DPoP proof: wrong nonce"),this.newDpopNonce=e,Object.setPrototypeOf(this,O.prototype)}}function I(e){return e&&!(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).includes(e)?e:""}const k=()=>window.crypto,C=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(k().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%66]),t},N=e=>btoa(e),P=[{key:"name",type:["string"]},{key:"version",type:["string","number"]},{key:"env",type:["object"]}],L=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=P.find(e=>e.key===r);return o&&o.type.includes(typeof e[r])&&(n[r]=e[r]),n},{})},x=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()},U=async e=>{const t=k().subtle.digest({name:"SHA-256"},(new TextEncoder).encode(e));return await t},D=e=>(e=>decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join("")))(e.replace(/_/g,"/").replace(/-/g,"+")),M=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 B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},j={},K={};Object.defineProperty(K,"__esModule",{value:!0});var H=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}();K.default=function(){return H.getInstance()};var G=B&&B.__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())})},W=B&&B.__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 G(this,void 0,void 0,function(){return W(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 G(this,void 0,void 0,function(){var n,r,o,i;return W(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?V:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,X.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),X.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 v;throw e}}}class Q{constructor(){this.activeLocks=new Set,this.lock=new Z,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 v;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 $=null;const ee=new TextEncoder,te=new TextDecoder;function ne(e){return"string"==typeof e?ee.encode(e):te.decode(e)}function re(e){if("number"!=typeof e.modulusLength||e.modulusLength<2048)throw new se(`${e.name} modulusLength must be at least 2048 bits`)}let oe;if(Uint8Array.prototype.toBase64)oe=e=>(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;oe=t=>{t instanceof ArrayBuffer&&(t=new Uint8Array(t));const n=[];for(let r=0;r{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var r},me=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return o?(async(e,t,n,r,o,i,a,s)=>((e,t)=>new 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])}))({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=new AbortController;let o;return t.signal=r.signal,Promise.race([fe(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})})(e,r,a)};async function ye(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 me(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:g,ok:b}=l;let v;if(c&&(v=g["dpop-nonce"],v&&await c.setNonce(v)),!b){const l=m||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===f)throw new _(f,l,y.mfa_token,y.mfa_requirements);if("missing_refresh_token"===f)throw new T(n,r);if("use_dpop_nonce"===f){if(!c||!v||u)throw new O(v);return ye(e,t,n,r,o,i,a,s,c,!0)}throw new w(f||"request_error",l)}return y}async function we(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}),y=s?x(f):JSON.stringify(f),w=(g=l.grant_type,pe.includes(g));var g;return await ye("".concat(n,"/oauth/token"),r,o||"default",i,{method:"POST",body:y,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(L(a||m)))}},t,s,c,w?u:void 0)}const ge=function(){for(var e=arguments.length,t=new Array(e),n=0;nArray.from(new Set(e)))(t.filter(Boolean).join(" ").trim().split(/\s+/)).join(" ")},be=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e.default),ge(r,t)};class ve{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@@auth0spajs@@",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 ve({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new ve({scope:t,audience:n,clientId:r})}}class Ee{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class Ae{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 Se{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||y}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());if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),s=Math.floor(a/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 ve({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=ve.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"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=ve.fromKey(r);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){const t=await this.cache.get(r);if(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.refresh_token)return this.modifiedCachedEntry(t,e)}}}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 _e{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 Te=e=>"number"==typeof e,Re=["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 Oe=B&&B.__assign||function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;nLe.get(e)||Le.get("".concat("_legacy_").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),Ne("".concat("_legacy_").concat(e),JSON.stringify(t),r),Le.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),Pe(e,n),Le.remove(e,t),Le.remove("".concat("_legacy_").concat(e),t)}},Ue={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 De;!function(e){e.Code="code",e.ConnectCode="connect_code"}(De||(De={}));var Me,Be=function(e){return Me=Me||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;o(new Ae).enclosedCache,localstorage:()=>new Ee},Ge=e=>He[e],We=e=>{const{openUrl:t,onRedirect:n}=e,r=p(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Fe=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},Xe={NONCE:"nonce",KEYPAIR:"keypair"};class Ve{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(Xe).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(Xe.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(Xe.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(Xe.NONCE,this.buildKey(e))}findKeyPair(){return this.find(Xe.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(Xe.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Xe.KEYPAIR,this.clientId)}}class ze{constructor(e){this.storage=new Ve(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 de(t,a,r,o,i)}(Object.assign({keyPair:t},e))}async calculateThumbprint(){return function(e){return async function(e){if(!le(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 he(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 ae("unsupported JWK kty")}return ie(await crypto.subtle.digest({name:"SHA-256"},ne(JSON.stringify(n))))}(e.publicKey)}(await this.getOrGenerateKeyPair())}async clear(){await Promise.all([this.storage.clearNonces(),this.storage.clearKeyPairs()])}}var Je;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Je||(Je={}));class Ye{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]:Je.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?Je.DPoP:Je.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===Je.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,"dpop-nonce");if(n&&await this.hooks.setDpopNonce(n),!this.hasUseDpopNonceError(e))return e;if(!n||!t.onUseDpopNonceError)throw new O(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 Ze{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 qe({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new qe(t)}}class qe 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,qe.prototype)}}const Qe={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function $e(e,t){this.v=e,this.k=t}function et(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 tt(e){return new $e(e,0)}function nt(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function rt(e,t){return e.get(et(e,t))}function ot(e,t,n){nt(e,t),t.set(e,n)}function it(e,t,n){return e.set(et(e,t),n),n}function at(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 st(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 ct(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Tt=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 mt("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",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 mt("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw mt("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw Ct(e.message,r,o);throw e}}function Dt(e,t,n,r){try{if("string"!=typeof e)throw mt("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw mt("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw Ct(e.message,n,r);throw e}}function Mt(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 Ct(t,In,e)}(e,t)}(e,"application/json")}function Bt(){return Ot(crypto.getRandomValues(new Uint8Array(32)))}function jt(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 It("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 It("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 It("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 It("unsupported CryptoKey algorithm name",{cause:e})}}function Kt(e){const t=null==e?void 0:e[wt];return"number"==typeof t&&Number.isFinite(t)?t:0}function Ht(e){const t=null==e?void 0:e[gt];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Gt(){return Math.floor(Date.now()/1e3)}function Wt(e){if("object"!=typeof e||null===e)throw mt('"as" must be an object',"ERR_INVALID_ARG_TYPE");Dt(e.issuer,'"as.issuer"')}function Ft(e){if("object"!=typeof e||null===e)throw mt('"client" must be an object',"ERR_INVALID_ARG_TYPE");Dt(e.client_id,'"client.client_id"')}function Xt(e){return Dt(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Vt(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&&Dt(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw mt("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw mt("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:jt(n),kid:r},u=function(e,t){const n=Gt()+Kt(t);return{jti:Bt(),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[vt])||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 mt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(Ot(_t(JSON.stringify(e))),".").concat(Ot(_t(JSON.stringify(t)))),o=Ot(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:jn(e)};case"RSA-PSS":switch(Bn(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 It("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Bn(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new It("unsupported CryptoKey algorithm name",{cause:e})}(n),n,_t(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const zt=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Jt(e,t){if(t&&"https:"!==e.protocol)throw Ct("only requests to HTTPS are allowed",Cn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Ct("only HTTP and HTTPS requests are allowed",Nn,e)}function Yt(e,t,n,r){let o;if("string"!=typeof e||!(o=zt(e)))throw Ct("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?Un:Dn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Jt(o,r),o}function Zt(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Yt(e.mtls_endpoint_aliases[t],t,n,r):Yt(e[t],t,n,r)}class qt extends Error{constructor(e,t){var n;super(e,t),at(this,"cause",void 0),at(this,"code",void 0),at(this,"error",void 0),at(this,"status",void 0),at(this,"error_description",void 0),at(this,"response",void 0),this.name=this.constructor.name,this.code=Sn,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 Qt extends Error{constructor(e,t){var n,r;super(e,t),at(this,"cause",void 0),at(this,"code",void 0),at(this,"error",void 0),at(this,"error_description",void 0),this.name=this.constructor.name,this.code=Tn,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 $t extends Error{constructor(e,t){var n;super(e,t),at(this,"cause",void 0),at(this,"code",void 0),at(this,"response",void 0),at(this,"status",void 0),this.name=this.constructor.name,this.code=An,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 en=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),tn=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),nn=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),rn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function on(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!ft(e,Response))throw mt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(en);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(tn)){if([,n,o,r]=t,o.includes("\\"))try{o=JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!(t=r.match(nn))){if(t=r.match(rn)){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 $t("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){Mn(e),Mt(e);try{const t=await e.clone().json();if(Nt(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 qt("server responded with an error in the response body",{cause:t,response:e});throw Ct('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),kn,e)}}function an(e){if(!yn.has(e))throw mt('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function sn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function cn(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[bt])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Lt(r,null==a?void 0:a.signal)})}async function un(e,t,n,r,o,i){var a;const s=Zt(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[yt]));o.set("grant_type",r);const c=Pt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(an(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await cn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const ln=new WeakMap,dn=new WeakMap;function hn(e){if(!e.id_token)return;const t=ln.get(e);if(!t)throw mt('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function pn(e,t,n,r,o,i){if(Wt(e),Ft(t),!ft(n,Response))throw mt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await on(n,200,"Token Endpoint"),Mn(n);const a=await Fn(n);if(Dt(a.access_token,'"response" body "access_token" property',On,{body:a}),Dt(a.token_type,'"response" body "token_type" property',On,{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;Ut(e,!0,'"response" body "expires_in" property',On,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Dt(a.refresh_token,'"response" body "refresh_token" property',On,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Ct('"response" body "scope" property must be a string',On,{body:a});if(void 0!==a.id_token){Dt(a.id_token,'"response" body "id_token" property',On,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(Ut(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 It("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Ct("Invalid JWT",On,e);try{i=JSON.parse(_t(Ot(s)))}catch(e){throw Ct("failed to parse JWT Header body as base64url encoded JSON",Rn,e)}if(!Nt(i))throw Ct("JWT Header must be a top level object",On,e);if(t(i),void 0!==i.crit)throw new It('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(_t(Ot(c)))}catch(e){throw Ct("failed to parse JWT Payload body as base64url encoded JSON",Rn,e)}if(!Nt(a))throw Ct("JWT Payload must be a top level object",On,e);const l=Gt()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Ct('unexpected JWT "exp" (expiration time) claim type',On,{claims:a});if(a.exp<=l-r)throw Ct('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Pn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Ct('unexpected JWT "iat" (issued at) claim type',On,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Ct('unexpected JWT "iss" (issuer) claim type',On,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Ct('unexpected JWT "nbf" (not before) claim type',On,{claims:a});if(a.nbf>l+r)throw Ct('unexpected JWT "nbf" (not before) claim value',Pn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Ct('unexpected JWT "aud" (audience) claim type',On,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Kn.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Kt(t),Ht(t),o).then(bn.bind(void 0,i)).then(mn.bind(void 0,e)).then(fn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Ct('ID Token "aud" (audience) claim includes additional untrusted audiences',Ln,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Ct('unexpected ID Token "azp" (authorized party) claim value',Ln,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&Ut(s.auth_time,!0,'ID Token "auth_time" (authentication time)',On,{claims:s}),dn.set(n,c),ln.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 It("unsupported `token_type` value",{cause:{body:a}});return a}function fn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Ct('unexpected JWT "aud" (audience) claim value',Ln,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Ct('unexpected JWT "aud" (audience) claim value',Ln,{expected:e,claims:t.claims,claim:"aud"});return t}function mn(e,t){var n,r;const o=null!==(n=null===(r=e[Vn])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Ct('unexpected JWT "iss" (issuer) claim value',Ln,{expected:o,claims:t.claims,claim:"iss"});return t}const yn=new WeakSet,wn=Symbol(),gn={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 Ct('JWT "'.concat(n,'" (').concat(gn[n],") claim missing"),On,{claims:t.claims});return t}const vn=Symbol(),En=Symbol();const An="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Sn="OAUTH_RESPONSE_BODY_ERROR",_n="OAUTH_UNSUPPORTED_OPERATION",Tn="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Rn="OAUTH_PARSE_ERROR",On="OAUTH_INVALID_RESPONSE",In="OAUTH_RESPONSE_IS_NOT_JSON",kn="OAUTH_RESPONSE_IS_NOT_CONFORM",Cn="OAUTH_HTTP_REQUEST_FORBIDDEN",Nn="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Pn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Ln="OAUTH_JWT_CLAIM_COMPARISON_FAILED",xn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",Un="OAUTH_MISSING_SERVER_METADATA",Dn="OAUTH_INVALID_SERVER_METADATA";function Mn(e){if(e.bodyUsed)throw mt('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Bn(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new It("unsupported ".concat(t.name," modulusLength"),{cause:e})}function jn(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 It("unsupported ECDSA namedCurve",{cause:e})}}function Kn(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Ct('unexpected JWT "alg" header parameter',On,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Ct('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 Ct('unexpected JWT "alg" header parameter',On,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Ct('unexpected JWT "alg" header parameter',On,{header:r,expected:e,reason:"client configuration"})}function Hn(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Ct('"'.concat(t,'" parameter must be provided only once'),On);return n}const Gn=Symbol(),Wn=Symbol();async function Fn(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mt;try{t=await e.json()}catch(t){throw n(e),Ct('failed to parse "response" body as JSON',Rn,t)}if(!Nt(t))throw Ct('"response" body must be a top level object',On,{body:t});return t}const Xn=Symbol(),Vn=Symbol(),zn=new TextEncoder,Jn=new TextDecoder;function Yn(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 Zn(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&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}}),at(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),at(this,"claim",void 0),at(this,"reason",void 0),at(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}at($n,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class er extends Qn{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}}),at(this,"code","ERR_JWT_EXPIRED"),at(this,"claim",void 0),at(this,"reason",void 0),at(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}at(er,"code","ERR_JWT_EXPIRED");class tr extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}at(tr,"code","ERR_JOSE_ALG_NOT_ALLOWED");class nr extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JOSE_NOT_SUPPORTED")}}at(nr,"code","ERR_JOSE_NOT_SUPPORTED"),at(class extends Qn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),at(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),at(class extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class rr extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JWS_INVALID")}}at(rr,"code","ERR_JWS_INVALID");class or extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JWT_INVALID")}}at(or,"code","ERR_JWT_INVALID"),at(class extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class ir extends Qn{constructor(){super(...arguments),at(this,"code","ERR_JWKS_INVALID")}}at(ir,"code","ERR_JWKS_INVALID");class ar extends Qn{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),at(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}at(ar,"code","ERR_JWKS_NO_MATCHING_KEY");class sr extends Qn{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),at(this,Symbol.asyncIterator,void 0),at(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}at(sr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class cr extends Qn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),at(this,"code","ERR_JWKS_TIMEOUT")}}at(cr,"code","ERR_JWKS_TIMEOUT");class ur extends Qn{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),at(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}at(ur,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const lr=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},dr=(e,t)=>e.name===t;function hr(e){return parseInt(e.name.slice(4),10)}function pr(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 fr=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},yr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),wr=e=>mr(e)||yr(e);function gr(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 br=(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)},Ar=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Sr=(e,t,n)=>{var r;const o=(e=>Zn(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){Er(e,48,"Invalid PKCS#8 structure"),vr(e),Er(e,2,"Expected version field");const t=vr(e);e.pos+=t,Er(e,48,"Expected algorithm identifier");vr(e);e.pos}(t),(e=>{const t=(e=>{Er(e,6,"Expected algorithm OID");const t=vr(e);return Ar(e,t)})(e);if(br(t,[43,101,110]))return"X25519";if(!br(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");Er(e,6,"Expected curve OID");const n=vr(e),r=Ar(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(br(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 nr("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 nr('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)};async function _r(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new nr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new nr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new nr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new nr('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new nr('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=ct({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const Tr=e=>gr(e)&&"string"==typeof e.kty;let Rr;const Or=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Rr||(Rr=new WeakMap);let o=Rr.get(e);if(null!=o&&o[n])return o[n];const i=await _r(ct(ct({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Rr.set(e,{[n]:i}),i};const Ir=e=>null==e?void 0:e[Symbol.toStringTag],kr=(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 Cr,Nr;let Pr,Lr;if("undefined"==typeof navigator||null===(Cr=navigator.userAgent)||void 0===Cr||null===(Nr=Cr.startsWith)||void 0===Nr||!Nr.call(Cr,"Mozilla/5.0 ")){const e="v6.8.1";Lr="".concat("openid-client","/").concat(e),Pr={"user-agent":Lr}}const xr=e=>Ur.get(e);let Ur,Dr;function Mr(e){return void 0!==e?Xt(e):(Dr||(Dr=new WeakMap),(e,t,n,r)=>{let o;return(o=Dr.get(t))||(function(e,t){if("string"!=typeof e)throw Hr("".concat(t," must be a string"),Kr);if(0===e.length)throw Hr("".concat(t," must not be empty"),jr)}(t.client_secret,'"metadata.client_secret"'),o=Xt(t.client_secret),Dr.set(t,o)),o(e,t,n,r)})}const Br=bt,jr="ERR_INVALID_ARG_VALUE",Kr="ERR_INVALID_ARG_TYPE";function Hr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Gr extends Error{constructor(e,t){var n;super(e,t),at(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 Wr(e,t,n){return new Gr(e,{cause:t,code:n})}function Fr(e){if(e instanceof TypeError||e instanceof Gr||e instanceof qt||e instanceof Qt||e instanceof $t)throw e;if(e instanceof kt)switch(e.code){case Cn:throw Wr("only requests to HTTPS are allowed",e,e.code);case Nn:throw Wr("only requests to HTTP or HTTPS are allowed",e,e.code);case kn:throw Wr("unexpected HTTP response status code",e.cause,e.code);case In:throw Wr("unexpected response content-type",e.cause,e.code);case Rn:throw Wr("parsing error occured",e,e.code);case On:throw Wr("invalid response encountered",e,e.code);case Ln:throw Wr("unexpected JWT claim value encountered",e,e.code);case xn:throw Wr("unexpected JSON attribute value encountered",e,e.code);case Pn:throw Wr("JWT timestamp claim value failed validation",e,e.code);default:throw Wr(e.message,e,e.code)}if(e instanceof It)throw Wr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw Wr("runtime operation error",e,_n);case"NotSupportedError":throw Wr("runtime unsupported operation",e,_n);case"TimeoutError":throw Wr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw Wr("operation aborted",e,"OAUTH_ABORT")}throw new Gr("something went wrong",{cause:e})}async function Xr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Hr('"server" must be an instance of URL',Kr);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 mt('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Jt(e,!0!==(null==r?void 0:r[yt]));const o=n(new URL(e.href)),i=Pt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[bt])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Lt(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=xt("".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=xt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw mt('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[bt]:null==t?void 0:t[Br],[yt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes($r),signal:a,headers:new Headers(Pr)}):((null==t?void 0:t[Br])||fetch)((Jt(e,null==t||null===(c=t.execute)||void 0===c||!c.includes($r)),e.href),{headers:Object.fromEntries(new Headers(ct({accept:"application/json"},Pr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Xn)throw mt('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!ft(t,Response))throw mt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw Ct('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',kn,t);Mn(t);const r=await Fn(t);if(Dt(r.issuer,'"response" body "issuer" property',On,{body:r}),n!==Xn&&new URL(r.issuer).href!==n.href)throw Ct('"response" body "issuer" property does not match the expected value',xn,{expected:n.href,body:r,attribute:"issuer"});return r}(Xn,e)).catch(Fr);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[Vr]=!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 Gr("discovered metadata issuer does not match the expected issuer",{code:xn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new zr(i,t,n,r);let s=xr(a);if(null!=o&&o[Br]&&(s.fetch=o[Br]),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 Vr=Symbol();class zr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Hr('"clientId" must be a non-empty string',Kr);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 Hr('"clientId" and "metadata.client_id" must be the same',jr);const u=ct(ct({},structuredClone(n)),{},{client_id:t});let l;u[wt]=null!==(i=null===(a=n)||void 0===a?void 0:a[wt])&&void 0!==i?i:0,u[gt]=null!==(s=null===(c=n)||void 0===c?void 0:c[gt])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?Mr(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);Vr in e&&(h[Vn]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);Ur||(Ur=new WeakMap),Ur.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(xr(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(xr(this).c)}get timeout(){return xr(this).timeout}set timeout(e){xr(this).timeout=e}get[Br](){return xr(this).fetch}set[Br](e){xr(this).fetch=e}}function Jr(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 hn(this)}catch(e){return}}}}}(e))}async function Yr(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 kt("invalid Retry-After header value",{cause:e});a>t&&await Zr(a-t,n)}function Zr(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 qr(e,t){io(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=xr(e);return async function(e,t,n,r,o){Wt(e),Ft(t);const i=Zt(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[yt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Pt(null==o?void 0:o.headers);return s.set("accept","application/json"),cn(e,t,n,i,a,s,o)}(n,r,o,t,{[bt]:i,[yt]:!a,headers:new Headers(Pr),signal:ao(s)}).then(e=>async function(e,t,n){if(Wt(e),Ft(t),!ft(n,Response))throw mt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await on(n,200,"Backchannel Authentication Endpoint"),Mn(n);const r=await Fn(n);Dt(r.auth_req_id,'"response" body "auth_req_id" property',On,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return Ut(o,!0,'"response" body "expires_in" property',On,{body:r}),r.expires_in=o,void 0!==r.interval&&Ut(r.interval,!1,'"response" body "interval" property',On,{body:r}),r}(n,r,e)).catch(Fr)}async function Qr(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 Zr(a,s)}catch(e){Fr(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=xr(e),y=(o,i)=>Qr(e,ct(ct({},t),{},{interval:o}),n,ct(ct({},r),{},{signal:s,flag:i})),w=await async function(e,t,n,r,o){Wt(e),Ft(t),Dt(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),un(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[bt]:d,[yt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Pr),signal:s.aborted?s:ao(f)}).catch(Fr);var g;if(503===w.status&&w.headers.has("retry-after"))return await Yr(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[Et],null==r?void 0:r.recognizedTokenTypes)}(c,u,w,{[Et]:m});let v;try{v=await b}catch(e){if(so(e,r))return y(a,co);if(e instanceof qt)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await Yr(e.response,a,s),y(a)}Fr(e)}return v.id_token&&await(null==p?void 0:p(w)),Jr(v),v}function $r(e){xr(e).tlsOnly=!1}async function eo(e,t,n,r,o){if(io(e),!((null==o?void 0:o.flag)===co||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw Hr('"currentUrl" must be an instance of URL, or Request',Kr);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}=xr(e);if((null==o?void 0:o.flag)===co)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 mt("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==sn(e))throw mt("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw mt("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{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 Hr("unexpected Request HTTP method",jr)}}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(Wt(e),Ft(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw mt('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(Hn(n,"response"))throw Ct('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',On,{parameters:n});const o=Hn(n,"iss"),i=Hn(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Ct('response parameter "iss" (issuer) missing',On,{parameters:n});if(o&&o!==e.issuer)throw Ct('unexpected "iss" (issuer) response parameter value',On,{expected:e.issuer,parameters:n});switch(r){case void 0:case Wn:if(void 0!==i)throw Ct('unexpected "state" response parameter encountered',On,{expected:void 0,parameters:n});break;case Gn:break;default:if(Dt(r,'"expectedState" argument'),i!==r)throw Ct(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',On,{expected:r,parameters:n})}if(Hn(n,"error"))throw new Qt("authorization response from the server is an error",{cause:n});const a=Hn(n,"id_token"),s=Hn(n,"token");if(void 0!==a||void 0!==s)throw new It("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),yn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Fr(e)}}}const g=await async function(e,t,n,r,o,i,a){if(Wt(e),Ft(t),!yn.has(r))throw mt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");Dt(o,'"redirectUri"');const s=Hn(r,"code");if(!s)throw Ct('no authorization code in "callbackParameters"',On);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==wn&&(Dt(i,'"codeVerifier"'),c.set("code_verifier",i)),un(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||wn,{additionalParameters:r,[bt]:l,[yt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Pr),signal:ao(m)}).catch(Fr);"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=vn;break;case vn:break;default:Dt(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=En;break;case En:break;default:Ut(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await pn(e,t,n,s,i,a);Dt(c.id_token,'"response" body "id_token" property',On,{body:c});const u=hn(c);if(o!==En){const e=Gt()+Kt(t),n=Ht(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[Et],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[Et]:l,recognizedTokenTypes:n})}).catch(Fr);return Jr(d),d}async function lo(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;r"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 nr('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 tr('"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(Tr(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&kr(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(!wr(t))throw new TypeError(fr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Ir(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Tr(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&kr(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)&&kr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!wr(t))throw new TypeError(fr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Ir(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Ir(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Ir(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Ir(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Ir(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?Yn(e.protected):new Uint8Array,Yn("."),"string"==typeof e.payload?a?Yn(e.payload):zn.encode(e.payload):e.payload);let d;try{d=qn(e.signature)}catch(e){throw new rr("Failed to base64url decode the signature")}const h=await async function(e,t){if(e instanceof Uint8Array)return e;if(mr(e))return e;if(yr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Rr||(Rr=new WeakMap);let n=Rr.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("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm")}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("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES384"===t&&"P-384"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES512"===t&&"P-521"===n&&(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("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Rr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Or(e,n,t)}if(Tr(e))return e.k?qn(e.k):Or(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await lo(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 nr("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 ur;let p;if(a)try{p=qn(e.payload)}catch(e){throw new rr("Failed to base64url decode the payload")}else p="string"==typeof e.payload?zn.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?ct(ct({},f),{},{key:h}):f}const po=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function fo(e){const t=po.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());async function yo(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=Jn.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 ho({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?ct(ct({},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 or("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Jn.decode(t))}catch(e){}if(!gr(n))throw new or("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 $n('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 $n('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new $n('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new $n('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new $n('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":d=fo(r.clockTolerance);break;case"number":d=r.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=r,p=(e=>Math.floor(e.getTime()/1e3))(h||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new $n('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new $n('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>p+d)throw new $n('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new $n('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=p-d)throw new er('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=p-n.iat;if(e-d>("number"==typeof u?u:fo(u)))throw new er('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new $n('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?ct(ct({},a),{},{key:o.key}):a}function wo(e){return gr(e)}var go,bo,vo=new WeakMap,Eo=new WeakMap;class Ao{constructor(e){if(ot(this,vo,void 0),ot(this,Eo,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(wo)}(e))throw new ir("JSON Web Key Set malformed");it(vo,this,structuredClone(e))}jwks(){return rt(vo,this)}async getKey(e,t){const{alg:n,kid:r}=ct(ct({},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 nr('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=rt(vo,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 ar;if(1!==s){const e=new sr,t=rt(Eo,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new lt(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield tt(So(t,e,n))}catch(e){}}),e}return So(rt(Eo,this),a,n)}}async function So(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(!gr(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 qn(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new nr('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return _r(ct(ct({},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 _r(ct(ct({},e),{},{ext:n}));case"EC":case"OKP":return _r(ct(ct({},e),{},{alg:t,ext:n}));default:throw new nr('Unsupported "kty" (Key Type) Parameter value')}}(ct(ct({},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 _o(e){const t=new Ao(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 To;if("undefined"==typeof navigator||null===(go=navigator.userAgent)||void 0===go||null===(bo=go.startsWith)||void 0===bo||!bo.call(go,"Mozilla/5.0 ")){const e="v6.1.3";To="".concat("jose","/").concat(e)}const Ro=Symbol(),Oo=Symbol();var Io=new WeakMap,ko=new WeakMap,Co=new WeakMap,No=new WeakMap,Po=new WeakMap,Lo=new WeakMap,xo=new WeakMap,Uo=new WeakMap,Do=new WeakMap,Mo=new WeakMap;class Bo{constructor(e,t){if(ot(this,Io,void 0),ot(this,ko,void 0),ot(this,Co,void 0),ot(this,No,void 0),ot(this,Po,void 0),ot(this,Lo,void 0),ot(this,xo,void 0),ot(this,Uo,void 0),ot(this,Do,void 0),ot(this,Mo,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;it(Io,this,new URL(e.href)),it(ko,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),it(Co,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),it(No,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),it(xo,this,new Headers(null==t?void 0:t.headers)),To&&!rt(xo,this).has("User-Agent")&&rt(xo,this).set("User-Agent",To),rt(xo,this).has("accept")||(rt(xo,this).set("accept","application/json"),rt(xo,this).append("accept","application/jwk-set+json")),it(Uo,this,null==t?void 0:t[Ro]),void 0!==(null==t?void 0:t[Oo])&&(it(Mo,this,null==t?void 0:t[Oo]),n=null==t?void 0:t[Oo],r=rt(No,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&gr(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,gr)&&(it(Po,this,rt(Mo,this).uat),it(Do,this,_o(rt(Mo,this).jwks))))}pendingFetch(){return!!rt(Lo,this)}coolingDown(){return"number"==typeof rt(Po,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 cr;throw e});if(200!==o.status)throw new Qn("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new Qn("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(rt(Io,this).href,rt(xo,this),AbortSignal.timeout(rt(ko,this)),rt(Uo,this)).then(e=>{it(Do,this,_o(e)),rt(Mo,this)&&(rt(Mo,this).uat=Date.now(),rt(Mo,this).jwks=e),it(Po,this,Date.now()),it(Lo,this,void 0)}).catch(e=>{throw it(Lo,this,void 0),e})),await rt(Lo,this)}}const jo=["mfaToken"],Ko=["mfaToken"];var Ho,Go,Wo,Fo,Xo,Vo,zo,Jo,Yo=class extends Error{constructor(e,t){super(t),at(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Zo=class extends Error{constructor(e,t,n){super(t),at(this,"cause",void 0),at(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},qo=class extends Zo{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},Qo=class extends Zo{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},$o=class extends Zo{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},ei=class extends Zo{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ti=class extends Zo{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ni=class extends Error{constructor(e){super(e),at(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},ri=class extends Zo{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),at(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},oi=class extends Zo{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ii=class extends Zo{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},ai=class extends Zo{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},si=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),at(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function ci(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>ct(ct({},e),{},{[t[0]]:t[1]}),{})}var ui=class extends Error{constructor(e,t,n){super(t),at(this,"cause",void 0),at(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},li=class extends ui{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},di=class extends ui{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},hi=class extends ui{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},pi=class extends ui{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function fi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var mi=(Ho=new WeakMap,Go=new WeakMap,Wo=new WeakMap,class{constructor(e){var t;ot(this,Ho,void 0),ot(this,Go,void 0),ot(this,Wo,void 0),it(Ho,this,"https://".concat(e.domain)),it(Go,this,e.clientId),it(Wo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(rt(Ho,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await rt(Wo,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 li(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(fi)}async enrollAuthenticator(e){const t="".concat(rt(Ho,this),"/mfa/associate"),{mfaToken:n}=e,r=ut(e,jo),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 rt(Wo,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 di(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};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(rt(Ho,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await rt(Wo,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 hi(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(rt(Ho,this),"/mfa/challenge"),{mfaToken:n}=e,r=ut(e,Ko),o={mfa_token:n,client_id:rt(Go,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await rt(Wo,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 pi(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())}}),yi=class e{constructor(e,t,n,r,o,i,a){at(this,"accessToken",void 0),at(this,"idToken",void 0),at(this,"refreshToken",void 0),at(this,"expiresAt",void 0),at(this,"scope",void 0),at(this,"claims",void 0),at(this,"authorizationDetails",void 0),at(this,"tokenType",void 0),at(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}},wi="openid profile email offline_access",gi=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 bi(e){if(null==e)throw new ti("subject_token is required");if("string"!=typeof e)throw new ti("subject_token must be a string");if(0===e.trim().length)throw new ti("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ti("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ti("subject_token must not include the 'Bearer ' prefix")}function vi(e,t){if(t)for(const[n,r]of Object.entries(t))if(!gi.has(n))if(Array.isArray(r)){if(r.length>20)throw new ti("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var Ei=(Fo=new WeakMap,Xo=new WeakMap,Vo=new WeakMap,zo=new WeakMap,Jo=new WeakSet,class{constructor(e){if(function(e,t){nt(e,t),t.add(e)}(this,Jo),ot(this,Fo,void 0),ot(this,Xo,void 0),ot(this,Vo,void 0),ot(this,zo,void 0),at(this,"mfa",void 0),it(Vo,this,e),e.useMtls&&!e.customFetch)throw new Yo("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");this.mfa=new mi({domain:rt(Vo,this).domain,clientId:rt(Vo,this).clientId,customFetch:rt(Vo,this).customFetch})}async buildAuthorizationUrl(e){const{serverMetadata:t}=await et(Jo,this,Ai).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new Yo("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 et(Jo,this,Ri).call(this,e)}catch(e){throw new oi(e)}}async buildLinkUserUrl(e){try{const t=await et(Jo,this,Ri).call(this,{authorizationParams:ct(ct({},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 ii(e)}}async buildUnlinkUserUrl(e){try{const t=await et(Jo,this,Ri).call(this,{authorizationParams:ct(ct({},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 ai(e)}}async backchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await et(Jo,this,Ai).call(this),r=ci(ct(ct({},rt(Vo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ct(ct({scope:wi},r),{},{client_id:rt(Vo,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 qr(t,o),n=await Qr(t,e);return yi.fromTokenEndpointResponse(n)}catch(e){throw new ri(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await et(Jo,this,Ai).call(this),r=ci(ct(ct({},rt(Vo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ct(ct({scope:wi},r),{},{client_id:rt(Vo,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 qr(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new ri(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await et(Jo,this,Ai).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await uo(n,"urn:openid:params:grant-type:ciba",r);return yi.fromTokenEndpointResponse(e)}catch(e){throw new ri(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new ei("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 ei("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?"urn:ietf:params:oauth:token-type:access_token":"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ti)throw new ei(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?et(Jo,this,Si).call(this,e):et(Jo,this,_i).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await et(Jo,this,Ai).call(this);try{const r=await eo(n,e,{pkceCodeVerifier:t.codeVerifier});return yi.fromTokenEndpointResponse(r)}catch(e){throw new qo("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await et(Jo,this,Ai).call(this);try{const n=await to(t,e.refreshToken);return yi.fromTokenEndpointResponse(n)}catch(e){throw new $o("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await et(Jo,this,Ai).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await no(t,n);return yi.fromTokenEndpointResponse(r)}catch(e){throw new Qo("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await et(Jo,this,Ai).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(rt(Vo,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",rt(Vo,this).clientId),t}return function(e,t){io(e);const{as:n,c:r,tlsOnly:o}=xr(e),i=Zt(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 et(Jo,this,Ai).call(this);rt(zo,this)||it(zo,this,function(e,t){const n=new Bo(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(t.jwks_uri),{[Ro]:rt(Vo,this).customFetch}));const{payload:n}=await yo(e.logoutToken,rt(zo,this),{issuer:t.issuer,audience:rt(Vo,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in n)&&!("sub"in n))throw new ni('either "sid" or "sub" (or both) claims must be present');if("sid"in n&&"string"!=typeof n.sid)throw new ni('"sid" claim must be a string');if("sub"in n&&"string"!=typeof n.sub)throw new ni('"sub" claim must be a string');if("nonce"in n)throw new ni('"nonce" claim is prohibited');if(!("events"in n))throw new ni('"events" claim is missing');if("object"!=typeof n.events||null===n.events)throw new ni('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in n.events))throw new ni('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof n.events["http://schemas.openid.net/event/backchannel-logout"])throw new ni('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:n.sid,sub:n.sub}}});async function Ai(){if(rt(Fo,this)&&rt(Xo,this))return{configuration:rt(Fo,this),serverMetadata:rt(Xo,this)};const e=await et(Jo,this,Ti).call(this);return it(Fo,this,await Xr(new URL("https://".concat(rt(Vo,this).domain)),rt(Vo,this).clientId,{use_mtls_endpoint_aliases:rt(Vo,this).useMtls},e,{[Br]:rt(Vo,this).customFetch})),it(Xo,this,rt(Fo,this).serverMetadata()),rt(Fo,this)[Br]=rt(Vo,this).customFetch||fetch,{configuration:rt(Fo,this),serverMetadata:rt(Xo,this)}}async function Si(e){var t,n;const{configuration:r}=await et(Jo,this,Ai).call(this);if("audience"in e||"resource"in e)throw new ti("audience and resource parameters are not supported for Token Vault exchanges");bi(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",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),vi(o,e.extra);try{const e=await uo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return yi.fromTokenEndpointResponse(e)}catch(t){throw new ti("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function _i(e){const{configuration:t}=await et(Jo,this,Ai).call(this);bi(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),vi(n,e.extra);try{const e=await uo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return yi.fromTokenEndpointResponse(e)}catch(t){throw new ti("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Ti(){if(!rt(Vo,this).clientSecret&&!rt(Vo,this).clientAssertionSigningKey&&!rt(Vo,this).useMtls)throw new si;if(rt(Vo,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=rt(Vo,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 Sr(e,t,void 0)}(e,rt(Vo,this).clientAssertionSigningAlg||"RS256")),e?function(e){return Vt(e,void 0)}(e):Mr(rt(Vo,this).clientSecret)}async function Ri(e){const{configuration:t}=await et(Jo,this,Ai).call(this),n=Bt(),r=await function(e){return async function(e){return Dt(e,"codeVerifier"),Ot(await crypto.subtle.digest("SHA-256",_t(e)))}(e)}(n),o=ci(ct(ct({},rt(Vo,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(ct(ct({scope:wi},o),{},{client_id:rt(Vo,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await oo(t,i):await ro(t,i),codeVerifier:n}}class Oi extends w{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Oi.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new Oi(t,n)}}class Ii extends Oi{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ii.prototype)}}class ki extends Oi{constructor(e,t){super(e,t),Object.setPrototypeOf(this,ki.prototype)}}class Ci extends Oi{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ci.prototype)}}class Ni extends Oi{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ni.prototype)}}class Pi extends Oi{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Pi.prototype)}}class Li{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 xi{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Li}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 Ii("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 li)throw new Ii(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=Qe[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 di)throw new ki(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 pi)throw new Ci(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 Pi("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 Ni("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 Ni("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 _)this.setMFAAuthDetails(e.mfa_token,r,o,e.mfa_requirements);else if(e instanceof Ni)throw new Ni(e.error,e.error_description);throw e}}}class Ui{constructor(e){let t,n;if(this.userCache=(new Ae).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(!k())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===k().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=($||($=function(){return"undefined"!=typeof navigator&&"function"==typeof(null===(e=navigator.locks)||void 0===e?void 0:e.request)?new q:new Q;var e}()),$),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)n=e.cache;else{if(t=e.cacheLocation||"memory",!Ge(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=Ge(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Le:xe,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:Ue;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]=ge(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new _e(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||y,this.cacheManager=new Se(n,n.allKeys?void 0:new Ke(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new ze(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 Ze(s,a),this.authJsClient=new Ei({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new xi(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Be)}getConfiguration(){return Object.freeze({domain:this.options.domain,clientId:this.options.clientId})}_url(e){const t=this.options.auth0Client||m,n=L(t,!0),r=encodeURIComponent(btoa(JSON.stringify(n)));return"".concat(this.domainUrl).concat(e,"&auth0Client=").concat(r)}_authorizeUrl(e){return this._url("/authorize?".concat(x(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(D(r)),a={__raw:e},s={};return Object.keys(i).forEach(e=>{a[e]=i[e],Re.includes(e)||(s[e]=i[e])}),{encoded:{header:n,payload:r,signature:o},header:JSON.parse(D(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&&!Te(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||!Te(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Te(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&&Te(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})}async _prepareAuthorizeUrl(e,t,n){var r;const o=N(C()),i=N(C()),a=C(),s=await U(a),c=M(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:be(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||"default",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 S;const r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise((t,n)=>{let r;const o=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new A(e.popup)))},1e3),i=setTimeout(()=>{clearInterval(o),n(new E(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(i),clearInterval(o),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return n(w.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new w("state_mismatch","Invalid state");const i=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}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=We(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=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=s,u=p(s,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:o,response_type:De.Code}),a&&{organization:a}));const l=r?"".concat(c,"#").concat(r):c;n?await n(l):window.location.assign(l)}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 w("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===De.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 g(o,i||o,r,t.appState);if(!t.code_verifier||t.state&&t.state!==r)throw new w("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:De.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new b(o,i||o,t.connection,r,t.appState);if(!n)throw new w("missing_connect_code","Missing connect code");if(!(t.code_verifier&&t.state&&t.auth_session&&t.redirect_uri&&t.state===r))throw new w("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:De.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){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:be(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=je[t];return n||(n=e().finally(()=>{delete je[t],n=null}),je[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||"default",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||"default",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 _||e instanceof w&&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||"default",clientId:this.options.clientId});if(!t)throw new w("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:be(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 ve({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",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(x(Object.assign({clientId:e.clientId},r))))+o}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=We(e),{openUrl:r}=n,o=p(n,["openUrl"]);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("@@user@@"),await(null===(t=this.dpop)||void 0===t?void 0:t.clear());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 w("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 v),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(w.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 w("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 w&&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 ve({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",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 T(e.authorizationParams.audience||"default",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&&Fe(l,c)||Fe(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 R(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||"default"})}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 _&&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("@@user@@",{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||"default",t=this.scope[e],n=await this.cacheManager.getIdToken(new ve({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get("@@user@@");return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new ve({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 we(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("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),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:be(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 Ye(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=N(C()),c=C(),u=await U(c),l=M(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:De.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 Di(e,t){return function(){return e.apply(t,arguments)}}const{toString:Mi}=Object.prototype,{getPrototypeOf:Bi}=Object,{iterator:ji,toStringTag:Ki}=Symbol,Hi=(Gi=Object.create(null),e=>{const t=Mi.call(e);return Gi[t]||(Gi[t]=t.slice(8,-1).toLowerCase())});var Gi;const Wi=e=>(e=e.toLowerCase(),t=>Hi(t)===e),Fi=e=>t=>typeof t===e,{isArray:Xi}=Array,Vi=Fi("undefined");function zi(e){return null!==e&&!Vi(e)&&null!==e.constructor&&!Vi(e.constructor)&&Zi(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ji=Wi("ArrayBuffer");const Yi=Fi("string"),Zi=Fi("function"),qi=Fi("number"),Qi=e=>null!==e&&"object"==typeof e,$i=e=>{if("object"!==Hi(e))return!1;const t=Bi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ki in e||ji in e)},ea=Wi("Date"),ta=Wi("File"),na=Wi("Blob"),ra=Wi("FileList");const oa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ia=void 0!==oa.FormData?oa.FormData:void 0,aa=Wi("URLSearchParams"),[sa,ca,ua,la]=["ReadableStream","Request","Response","Headers"].map(Wi);function da(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Xi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const pa="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,fa=e=>!Vi(e)&&e!==pa;const ma=(ya="undefined"!=typeof Uint8Array&&Bi(Uint8Array),e=>ya&&e instanceof ya);var ya;const wa=Wi("HTMLFormElement"),ga=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ba=Wi("RegExp"),va=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};da(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Ea=Wi("AsyncFunction"),Aa=(Sa="function"==typeof setImmediate,_a=Zi(pa.postMessage),Sa?setImmediate:_a?(Ta=`axios@${Math.random()}`,Ra=[],pa.addEventListener("message",({source:e,data:t})=>{e===pa&&t===Ta&&Ra.length&&Ra.shift()()},!1),e=>{Ra.push(e),pa.postMessage(Ta,"*")}):e=>setTimeout(e));var Sa,_a,Ta,Ra;const Oa="undefined"!=typeof queueMicrotask?queueMicrotask.bind(pa):"undefined"!=typeof process&&process.nextTick||Aa,Ia={isArray:Xi,isArrayBuffer:Ji,isBuffer:zi,isFormData:e=>{let t;return e&&(ia&&e instanceof ia||Zi(e.append)&&("formdata"===(t=Hi(e))||"object"===t&&Zi(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ji(e.buffer),t},isString:Yi,isNumber:qi,isBoolean:e=>!0===e||!1===e,isObject:Qi,isPlainObject:$i,isEmptyObject:e=>{if(!Qi(e)||zi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:sa,isRequest:ca,isResponse:ua,isHeaders:la,isUndefined:Vi,isDate:ea,isFile:ta,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:na,isRegExp:ba,isFunction:Zi,isStream:e=>Qi(e)&&Zi(e.pipe),isURLSearchParams:aa,isTypedArray:ma,isFileList:ra,forEach:da,merge:function e(){const{caseless:t,skipUndefined:n}=fa(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=t&&ha(r,i)||i;$i(r[a])&&$i(o)?r[a]=e(r[a],o):$i(o)?r[a]=e({},o):Xi(o)?r[a]=o.slice():n&&Vi(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(da(t,(t,r)=>{n&&Zi(t)?Object.defineProperty(e,r,{value:Di(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{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&&Bi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Hi,kindOfTest:Wi,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(Xi(e))return e;let t=e.length;if(!qi(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[ji]).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:wa,hasOwnProperty:ga,hasOwnProp:ga,reduceDescriptors:va,freezeMethods:e=>{va(e,(t,n)=>{if(Zi(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Zi(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 Xi(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:ha,global:pa,isContextDefined:fa,isSpecCompliantForm:function(e){return!!(e&&Zi(e.append)&&"FormData"===e[Ki]&&e[ji])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(Qi(e)){if(t.indexOf(e)>=0)return;if(zi(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Xi(e)?[]:{};return da(e,(e,t)=>{const i=n(e,r+1);!Vi(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Ea,isThenable:e=>e&&(Qi(e)||Zi(e))&&Zi(e.then)&&Zi(e.catch),setImmediate:Aa,asap:Oa,isIterable:e=>null!=e&&Zi(e[ji])};class ka extends Error{static from(e,t,n,r,o,i){const a=new ka(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",{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(){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:Ia.toJSONObject(this.config),code:this.code,status:this.status}}}ka.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",ka.ERR_BAD_OPTION="ERR_BAD_OPTION",ka.ECONNABORTED="ECONNABORTED",ka.ETIMEDOUT="ETIMEDOUT",ka.ERR_NETWORK="ERR_NETWORK",ka.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",ka.ERR_DEPRECATED="ERR_DEPRECATED",ka.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",ka.ERR_BAD_REQUEST="ERR_BAD_REQUEST",ka.ERR_CANCELED="ERR_CANCELED",ka.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",ka.ERR_INVALID_URL="ERR_INVALID_URL";const Ca=ka;var Na=n(8287).hp;function Pa(e){return Ia.isPlainObject(e)||Ia.isArray(e)}function La(e){return Ia.endsWith(e,"[]")?e.slice(0,-2):e}function xa(e,t,n){return e?e.concat(t).map(function(e,t){return e=La(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const Ua=Ia.toFlatObject(Ia,{},null,function(e){return/^is[A-Z]/.test(e)});const Da=function(e,t,n){if(!Ia.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Ia.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Ia.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Ia.isSpecCompliantForm(t);if(!Ia.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Ia.isDate(e))return e.toISOString();if(Ia.isBoolean(e))return e.toString();if(!s&&Ia.isBlob(e))throw new Ca("Blob is not supported. Use a Buffer instead.");return Ia.isArrayBuffer(e)||Ia.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Na.from(e):e}function u(e,n,o){let s=e;if(Ia.isReactNative(t)&&Ia.isReactNativeBlob(e))return t.append(xa(o,n,i),c(e)),!1;if(e&&!o&&"object"==typeof e)if(Ia.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Ia.isArray(e)&&function(e){return Ia.isArray(e)&&!e.some(Pa)}(e)||(Ia.isFileList(e)||Ia.endsWith(n,"[]"))&&(s=Ia.toArray(e)))return n=La(n),s.forEach(function(e,r){!Ia.isUndefined(e)&&null!==e&&t.append(!0===a?xa([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!Pa(e)||(t.append(xa(o,n,i),c(e)),!1)}const l=[],d=Object.assign(Ua,{defaultVisitor:u,convertValue:c,isVisitable:Pa});if(!Ia.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Ia.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Ia.forEach(n,function(n,i){!0===(!(Ia.isUndefined(n)||null===n)&&o.call(t,n,Ia.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function Ma(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ba(e,t){this._pairs=[],e&&Da(e,this,t)}const ja=Ba.prototype;ja.append=function(e,t){this._pairs.push([e,t])},ja.toString=function(e){const t=e?function(t){return e.call(this,t,Ma)}:Ma;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Ka=Ba;function Ha(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ga(e,t,n){if(!t)return e;const r=n&&n.encode||Ha,o=Ia.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):Ia.isURLSearchParams(t)?t.toString():new Ka(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const Wa=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){Ia.forEach(this.handlers,function(t){null!==t&&e(t)})}},Fa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Xa={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ka,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Va="undefined"!=typeof window&&"undefined"!=typeof document,za="object"==typeof navigator&&navigator||void 0,Ja=Va&&(!za||["ReactNative","NativeScript","NS"].indexOf(za.product)<0),Ya="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Za=Va&&window.location.href||"http://localhost",qa={...e,...Xa};const Qa=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&&Ia.isArray(r)?r.length:i,s)return Ia.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&Ia.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Ia.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 Ia.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const $a={transitional:Fa,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Ia.isObject(e);o&&Ia.isHTMLForm(e)&&(e=new FormData(e));if(Ia.isFormData(e))return r?JSON.stringify(Qa(e)):e;if(Ia.isArrayBuffer(e)||Ia.isBuffer(e)||Ia.isStream(e)||Ia.isFile(e)||Ia.isBlob(e)||Ia.isReadableStream(e))return e;if(Ia.isArrayBufferView(e))return e.buffer;if(Ia.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Da(e,new qa.classes.URLSearchParams,{visitor:function(e,t,n,r){return qa.isNode&&Ia.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Ia.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Da(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Ia.isString(e))try{return(t||JSON.parse)(e),Ia.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$a.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Ia.isResponse(e)||Ia.isReadableStream(e))return e;if(e&&Ia.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Ca.from(e,Ca.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qa.classes.FormData,Blob:qa.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ia.forEach(["delete","get","head","post","put","patch"],e=>{$a.headers[e]={}});const es=$a,ts=Ia.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"]),ns=Symbol("internals");function rs(e){return e&&String(e).trim().toLowerCase()}function os(e){return!1===e||null==e?e:Ia.isArray(e)?e.map(os):String(e)}function is(e,t,n,r,o){return Ia.isFunction(r)?r.call(this,t,n):(o&&(t=n),Ia.isString(t)?Ia.isString(r)?-1!==t.indexOf(r):Ia.isRegExp(r)?r.test(t):void 0:void 0)}class as{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=rs(t);if(!o)throw new Error("header name must be a non-empty string");const i=Ia.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=os(e))}const i=(e,t)=>Ia.forEach(e,(e,n)=>o(e,n,t));if(Ia.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Ia.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((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]&&ts[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(Ia.isObject(e)&&Ia.isIterable(e)){let n,r,o={};for(const t of e){if(!Ia.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Ia.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=rs(e)){const n=Ia.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(Ia.isFunction(t))return t.call(this,e,n);if(Ia.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=rs(e)){const n=Ia.findKey(this,e);return!(!n||void 0===this[n]||t&&!is(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=rs(e)){const o=Ia.findKey(n,e);!o||t&&!is(0,n[o],o,t)||(delete n[o],r=!0)}}return Ia.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&&!is(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Ia.forEach(this,(r,o)=>{const i=Ia.findKey(n,o);if(i)return t[i]=os(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]=os(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ia.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Ia.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[ns]=this[ns]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=rs(e);t[r]||(!function(e,t){const n=Ia.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Ia.isArray(e)?e.forEach(r):r(e),this}}as.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Ia.reduceDescriptors(as.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Ia.freezeMethods(as);const ss=as;function cs(e,t){const n=this||es,r=t||n,o=ss.from(r.headers);let i=r.data;return Ia.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function us(e){return!(!e||!e.__CANCEL__)}const ls=class extends Ca{constructor(e,t,n){super(null==e?"canceled":e,Ca.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ds(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Ca("Request failed with status code "+n.status,[Ca.ERR_BAD_REQUEST,Ca.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const hs=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)]},fs=(e,t,n=3)=>{let r=0;const o=hs(50,250);return ps(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},ms=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},ys=e=>(...t)=>Ia.asap(()=>e(...t)),ws=qa.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,qa.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(qa.origin),qa.navigator&&/(msie|trident)/i.test(qa.navigator.userAgent)):()=>!0,gs=qa.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Ia.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Ia.isString(r)&&s.push(`path=${r}`),Ia.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),Ia.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function bs(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const vs=e=>e instanceof ss?{...e}:e;function Es(e,t){t=t||{};const n={};function r(e,t,n,r){return Ia.isPlainObject(e)&&Ia.isPlainObject(t)?Ia.merge.call({caseless:r},e,t):Ia.isPlainObject(t)?Ia.merge({},t):Ia.isArray(t)?t.slice():t}function o(e,t,n,o){return Ia.isUndefined(t)?Ia.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Ia.isUndefined(t))return r(void 0,t)}function a(e,t){return Ia.isUndefined(t)?Ia.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 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,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(vs(e),vs(t),0,!0)};return Ia.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Ia.hasOwnProp(c,r)?c[r]:o,a=i(e[r],t[r],r);Ia.isUndefined(a)&&i!==s||(n[r]=a)}),n}const As=e=>{const t=Es({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=ss.from(a),t.url=Ga(bs(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Ia.isFormData(n))if(qa.hasStandardBrowserEnv||qa.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Ia.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(qa.hasStandardBrowserEnv&&(r&&Ia.isFunction(r)&&(r=r(t)),r||!1!==r&&ws(t.url))){const e=o&&i&&gs.read(i);e&&a.set(o,e)}return t},Ss="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=As(e);let o=r.data;const i=ss.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=ss.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ds(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&&0===m.responseURL.indexOf("file:"))&&setTimeout(y)},m.onabort=function(){m&&(n(new Ca("Request aborted",Ca.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Ca(r,Ca.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Fa;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Ca(t,o.clarifyTimeoutError?Ca.ETIMEDOUT:Ca.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&Ia.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),Ia.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=fs(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=fs(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new ls(null,e,m):t),m.abort(),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&&-1===qa.protocols.indexOf(w)?n(new Ca("Unsupported protocol "+w+":",Ca.ERR_BAD_REQUEST,e)):m.send(o||null)})},_s=(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 Ca?t:new ls(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Ca(`timeout of ${t}ms exceeded`,Ca.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=()=>Ia.asap(a),s}},Ts=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Rs(e))yield*Ts(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})},{isFunction:Is}=Ia,ks=(({Request:e,Response:t})=>({Request:e,Response:t}))(Ia.global),{ReadableStream:Cs,TextEncoder:Ns}=Ia.global,Ps=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ls=e=>{e=Ia.merge.call({skipUndefined:!0},ks,e);const{fetch:t,Request:n,Response:r}=e,o=t?Is(t):"function"==typeof fetch,i=Is(n),a=Is(r);if(!o)return!1;const s=o&&Is(Cs),c=o&&("function"==typeof Ns?(u=new Ns,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&Ps(()=>{let e=!1;const t=new n(qa.origin,{body:new Cs,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&Ps(()=>Ia.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Ca(`Response type '${e}' is not supported`,Ca.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=Ia.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Ia.isBlob(e))return e.size;if(Ia.isSpecCompliantForm(e)){const t=new n(qa.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Ia.isArrayBufferView(e)||Ia.isArrayBuffer(e)?e.byteLength:(Ia.isURLSearchParams(e)&&(e+=""),Ia.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:y,responseType:w,headers:g,withCredentials:b="same-origin",fetchOptions:v}=As(e),E=t||fetch;w=w?(w+"").toLowerCase():"text";let A=_s([c,u&&u.toAbortSignal()],f),S=null;const _=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let T;try{if(y&&l&&"get"!==a&&"head"!==a&&0!==(T=await p(g,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(Ia.isFormData(s)&&(e=t.headers.get("content-type"))&&g.setContentType(e),t.body){const[e,n]=ms(T,fs(ys(y)));s=Os(t.body,65536,e,n)}}Ia.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:A,method:a.toUpperCase(),headers:g.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};S=i&&new n(o,c);let u=await(i?E(S,v):E(o,c));const f=d&&("stream"===w||"response"===w);if(d&&(m||f&&_)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=Ia.toFiniteNumber(u.headers.get("content-length")),[n,o]=m&&ms(t,fs(ys(m),!0))||[];u=new r(Os(u.body,65536,n,()=>{o&&o(),_&&_()}),e)}w=w||"text";let R=await h[Ia.findKey(h,w)||"text"](u,e);return!f&&_&&_(),await new Promise((t,n)=>{ds(t,n,{data:R,headers:ss.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:S})})}catch(t){if(_&&_(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Ca("Network Error",Ca.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw Ca.from(t,t&&t.code,e,S,t&&t.response)}}},xs=new Map,Us=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=xs;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Ls(t)),u=s;return s},Ds=(Us(),{http:null,xhr:Ss,fetch:{get:Us}});Ia.forEach(Ds,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ms=e=>`- ${e}`,Bs=e=>Ia.isFunction(e)||null===e||!1===e;const js={getAdapter:function(e,t){e=Ia.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(Ms).join("\n"):" "+Ms(e[0]):"as no adapter specified";throw new Ca("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Ds};function Ks(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ls(null,e)}function Hs(e){Ks(e),e.headers=ss.from(e.headers),e.data=cs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return js.getAdapter(e.adapter||es.adapter,e)(e).then(function(t){return Ks(e),t.data=cs.call(e,e.transformResponse,t),t.headers=ss.from(t.headers),t},function(t){return us(t)||(Ks(e),t&&t.response&&(t.response.data=cs.call(e,e.transformResponse,t.response),t.response.headers=ss.from(t.response.headers))),Promise.reject(t)})}const Gs="1.13.6",Ws={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ws[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Fs={};Ws.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Gs+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Ca(r(o," has been removed"+(t?" in "+t:"")),Ca.ERR_DEPRECATED);return t&&!Fs[o]&&(Fs[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)}},Ws.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Xs={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Ca("options must be an object",Ca.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Ca("option "+i+" must be "+n,Ca.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Ca("Unknown option "+i,Ca.ERR_BAD_OPTION)}},validators:Ws},Vs=Xs.validators;class zs{constructor(e){this.defaults=e||{},this.interceptors={request:new Wa,response:new Wa}}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=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Es(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Xs.assertOptions(n,{silentJSONParsing:Vs.transitional(Vs.boolean),forcedJSONParsing:Vs.transitional(Vs.boolean),clarifyTimeoutError:Vs.transitional(Vs.boolean),legacyInterceptorReqResOrdering:Vs.transitional(Vs.boolean)},!1),null!=r&&(Ia.isFunction(r)?t.paramsSerializer={serialize:r}:Xs.assertOptions(r,{encode:Vs.function,serialize:Vs.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Xs.assertOptions(t,{baseUrl:Vs.spelling("baseURL"),withXsrfToken:Vs.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Ia.merge(o.common,o[t.method]);o&&Ia.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ss.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||Fa;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=[Hs.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 ls(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 Ys(function(t){e=t});return{token:t,cancel:e}}}const Zs=Ys;const qs={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(qs).forEach(([e,t])=>{qs[t]=e});const Qs=qs;const $s=function e(t){const n=new Js(t),r=Di(Js.prototype.request,n);return Ia.extend(r,Js.prototype,n,{allOwnKeys:!0}),Ia.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Es(t,n))},r}(es);$s.Axios=Js,$s.CanceledError=ls,$s.CancelToken=Zs,$s.isCancel=us,$s.VERSION=Gs,$s.toFormData=Da,$s.AxiosError=Ca,$s.Cancel=$s.CanceledError,$s.all=function(e){return Promise.all(e)},$s.spread=function(e){return function(t){return e.apply(null,t)}},$s.isAxiosError=function(e){return Ia.isObject(e)&&!0===e.isAxiosError},$s.mergeConfig=Es,$s.AxiosHeaders=ss,$s.formToJSON=e=>Qa(Ia.isHTMLForm(e)?new FormData(e):e),$s.getAdapter=js.getAdapter,$s.HttpStatusCode=Qs,$s.default=$s;const ec=$s;var tc=n(3612);const nc=function(){if(tc.A.debug){for(var e,t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=uc().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])},hc=function(){var e=dc();return".".concat(e)},pc=function(e,t,n){var r="".concat(e,"=").concat(t,";");void 0!==n?(nc("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},fc=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=dc(),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,";")})},mc=function(){return uc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},yc=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)},wc=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=dc().split(".")[0],e.prev=1,e.next=2,ec({method:"get",url:"".concat(tc.A.entitlementsEndpoint,"apple/subscription-check/").concat(n),params:{access_token:t}});case 2:if(!(r=e.sent).data){e.next=3;break}return nc("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),nc("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)}}(),gc=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,ec({method:"get",url:"".concat(tc.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(mc())),headers:{"X-Api-Key":tc.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)}}(),bc=function(){return"complete"===document.readyState},vc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(bc())t();else{nc("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=bc()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},Ec=function(){return new Promise(function(e){if(("interactive"===document.readyState||bc())&&window.dataLayer)nc("Utils digisubsDataLayerLoaded: ","Document is in interactive state, resolving."),e();else{nc("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)}})},Ac=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,Ec();case 1:return nc("Utils getDataLayerObject: looking for this dataLayer object ",t),window.dataLayer=window.dataLayer||[],n="",nc("Utils getDataLayerObject: here is dataLayer length ",window.dataLayer.length),r=function(e){return nc("Utils dataLayerLoop: look for this element ",e),e[t]?(nc("Utils dataLayerLoop: found ",e[t]),n=e[t],e[t]):(nc("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)}}(),Sc=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,Ac(t);case 1:return n=e.sent,nc("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)}}(),_c=function(){return new Promise(function(e){nc("blueConicReady | Waiting for BC to be ready."),window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){nc("blueConicReady | onReady fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),nc("blueConicReady | onReady timeout, BC onReady unknown."),e(!1)},3e3)})},Tc=function(){return new Promise(function(e){nc("blueConicProfileReady | Waiting for BC Profile to be ready."),window.blueConicClient&&(window.blueConicClient.getSegments||window.blueConicClient.profile)&&(nc("blueConicProfileReady | BC getSegments is ready."),e(!0)),window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){nc("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),nc("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)})},Rc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){nc("blueConicLoaded | waitTillBCReady is ".concat(e));var n=setTimeout(function(){clearTimeout(n),nc("blueConicLoaded | onBlueConicLoaded timeout, resolving false for load status."),t(!1)},1e4);void 0!==window.blueConicClient&&void 0!==window.blueConicClient.event&&void 0!==window.blueConicClient.event.subscribe?(nc("blueConicLoaded | BC object already loaded"),e?t(_c()):(clearTimeout(n),t())):(nc('blueConicLoaded | BC not loaded, waiting for "onBlueConicLoaded" event'),window.addEventListener("onBlueConicLoaded",r(o.mark(function r(){var i;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(nc("blueConicLoaded | onBlueConicLoaded event fired."),!e){r.next=2;break}return nc("blueConicLoaded | waiting for blueConicReady..."),r.next=1,_c();case 1:i=r.sent,clearTimeout(n),t(i),r.next=3;break;case 2:clearTimeout(n),t();case 3:case"end":return r.stop()}},r)})),!1))})},Oc=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,Rc(!0);case 1:if(!e.sent){e.next=4;break}return e.next=2,Tc();case 2:if(e.sent){e.next=3;break}return e.abrupt("return",!1);case 3:return e.abrupt("return",blueConicClient.profile.getProfile().getValue("Auth0_ID"));case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ic=function(){var e=r(o.mark(function e(){var t,n,r,i,a,s,c,u=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=u.length>0&&void 0!==u[0]&&u[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,Rc(!0);case 1:if(!e.sent){e.next=3;break}if(a=window.blueConicClient.getSegments(),nc("bcLowaCheck | BC segments for users: ",a),!(a.filter(function(e){return i.includes(e.name)}).length>0)){e.next=3;break}return e.next=2,Oc();case 2:(s=e.sent)&&(n=!0,r=s);case 3:return t&&n&&kc(),c={isSub:n},r&&(c.uuid=r),e.abrupt("return",c);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),kc=function(){pc("bc_lowa_status",1,{path:"/",domain:hc(),expires:7,secure:!0})},Cc=function(){return new Promise(function(e,t){void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.authenticationReady?(nc("utils | Authentication already ready: ",window.MNGAuthentication.authenticationReady),e(window.MNGAuthentication.authenticationReady)):(nc("utils | Adding authenticationReady listener..."),window.addEventListener("authenticationReady",function(n){try{var r=n.detail||{};nc("utils | Event: authentication ready: ",r),e(r)}catch(e){nc(e),t(e)}},!1))})},Nc=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 tc.A.entitlementsEnabled?void 0!==window.MNGAuthentication&&void 0!==window.MNGAuthentication.entitlementsReady?(nc("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,nc("Received entitlementsReady event:",r),e(r)}catch(e){rc("Error handling entitlementsReady event:",e),t(e)}},{once:!0}):(nc("Entitlements disabled in settings."),void e(!1))}));case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Pc=function(){fc(oc.AUTH0_SUB_COOKIE_KEY),fc("mng-jwt-decoded"),localStorage.removeItem(oc.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),function(){nc("Clearing entitlements...");try{fc(oc.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){nc("Failed to delete legacy cookie: ",e)}try{fc(oc.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:dc(),expires:365,secure:!0})}catch(e){nc("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(oc.LOCAL_STORAGE_SESSION_KEY)}catch(e){nc("Failed to remove local storage: ",e)}}()},Lc=function(){var e=uc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},xc=function(e){nc("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),nc("Storage Object removed : ",e))},Uc=function(e){nc("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 nc("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=Uc;var Dc;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Mc=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===Dc){e.next=1;break}return e.abrupt("return",Dc);case 1:return t=tc.A.auth0Domain,n=tc.A.auth0ClientId,Dc=new Ui({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",Dc);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Bc=function(e){nc("utils | auth event dispathed");var t=new CustomEvent("authenticationReady",{detail:e});window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.authenticationReady=e,nc("utils | Dispatching authenticationReady Event: ",t),window.dispatchEvent(t),nc("utils | Dispatched authenticationReady event"),ac=new CustomEvent("mng-auth-check-complete",{detail:e}),ic?(nc("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(ac)):nc("Islands not ready")};var jc=function(e){tc.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Kc=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,nc("deleteUserCache","Setting up cache deletion for ".concat(t)),n=mc(),nc("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,ec({method:"DELETE",url:"".concat(tc.A.entitlementsEndpoint,"session/create"),data:r,headers:{"X-Api-Key":tc.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 nc("deleteUserCache","Cache deletion successful for ".concat(t)),e.abrupt("return",{success:!0});case 2:return nc("deleteUserCache","Cache deletion failed for ".concat(t,": ").concat(s)),e.abrupt("return",{success:!1});case 3:return e.prev=3,u=e.catch(0),nc("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)}}(),Hc=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:cc({},i)}));case 1:return r.next=2,Sc();case 2:return c=r.sent,r.next=3,Ac("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,Nc();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,nc("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:cc({},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:cc({},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=Hc);function Gc(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 Wc=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,Rc();case 1:return e.next=2,Cc();case 2:return e.abrupt("return",new Promise(function(e){nc("ANALYTICS: inside BCregwall events");var t=uc();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)}}(),Fc=function(e){try{window.dataLayer.push({event:e}),nc("ANALYTICS: ".concat(e," event")),nc("ANALYTICS: GA/ datalayer ",window.dataLayer)}catch(t){nc("ANALYTICS: Failed to send ".concat(e," event: "),t)}};var Xc=function(){try{var e=localStorage.getItem(oc.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){nc("Unable to get session from local storage: ",e)}return"{}"},Vc=function(e){try{nc("Setting local storage session",e),localStorage.setItem(oc.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){nc("Unable to save session from local storage: ",e)}},zc=function(e){try{pc(oc.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:hc(),expires:365,secure:!0})}catch(e){nc("Unable to save session to cookie storage: ",e)}},Jc=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=tc.A.sessionServer,n="".concat(t,"/api/session"),nc("Checking server session: ",n),e.next=1,ec.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,Vc(JSON.stringify({accessToken:h,idToken:p,entitlementToken:f,expiration:m,entitlementSource:y,isEntitled:w,adFree:g,entitlementLevel:b})),""!==f&&"string"==typeof f&&zc(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)}}(),Yc=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=tc.A.sessionServer,r="".concat(n,"/api/session"),nc("Updating server session: ",r),e.next=1,ec.post(r,t,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,i=e.catch(0),nc("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)}}(),Zc=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=tc.A.sessionServer,n="".concat(t,"/api/session"),nc("Deleting server session: ",n),e.next=1,ec.delete(n,{withCredentials:!0});case 1:e.next=3;break;case 2:e.prev=2,r=e.catch(0),nc("Failed to delete server session: ",r);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(){return e.apply(this,arguments)}}(),qc=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,A,S,_,T,R,O,I,k;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(nc("Inside getSession"),e.prev=1,l=Xc(),nc("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,nc("Session: check both tokens: ",t=p,r=f),void 0!==p&&void 0!==f&&null!==p&&null!==f){e.next=3;break}return nc("Session: missing id or entitlements, try session server"),e.next=2,Jc();case 2:v=e.sent,E=v.accessToken,A=v.idToken,S=v.entitlementToken,_=v.expiration,T=v.entitlementSource,R=v.isEntitled,O=v.adFree,I=v.entitlementLevel,n=E,t=A,r=S,i=_,a=T,s=R,c=O,u=I;case 3:e.next=5;break;case 4:e.prev=4,k=e.catch(1),nc("Failed to get session: ",k);case 5:return nc("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)}}(),Qc=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,A,S,_,T,R,O,I,k,C,N;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Xc(),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,A=t.idToken,S=t.entitlementToken,_=t.expiration,T=t.entitlementSource,R=t.isEntitled,O=t.adFree,I=t.entitlementLevel,k={accessToken:null==E?a:E,idToken:null==A?c:A,entitlementToken:null==S?l:S,expiration:null==_?h:_,entitlementSource:null==T?f:T,isEntitled:null==R?y:R,adFree:null==O?g:O,entitlementLevel:null==I?v:I},nc("Current session data: ",r),nc("New session data: ",t),nc("Updated session data:",k),C=JSON.stringify(k),Vc(C),""!==k.entitlementToken&&"string"==typeof k.entitlementToken&&zc(k.entitlementToken),n===C){e.next=1;break}return e.next=1,Yc(k);case 1:e.next=3;break;case 2:e.prev=2,N=e.catch(0),nc("Unable to save session: ",N);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}(),$c=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return nc("Ending session..."),Pc(),e.next=1,Zc();case 1:localStorage.removeItem(oc.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),eu=function(){return"logout"===(uc().searchParams.get("state")||"").toLowerCase()};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[];var tu=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();case 1:n=e.sent,nc("Calling Auth0 logout..."),n.logout({returnTo:t});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),nu=function(){return"undefined"==typeof CnnXt?(nc("Connext was not loaded."),!1):Connext.Storage.GetUserState()},ru=function(){nc("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){nc("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=/")}},ou=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(nc("Attempting to logout..."),ru(),nc("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(oc.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?yc(n):"")){e.next=2;break}return a=i.auth0Id,e.next=1,Kc(a);case 1:e.sent.success?nc("User cache cleared."):nc("User cache deletion failed.");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=4;break}return e.next=3,$c();case 3:e.next=5;break;case 4:Pc();case 5:return e.prev=5,nc("Cycling through logout callbacks..."),s=window.MNGAuthentication.logoutCallbacks.map(function(e){return e()}),e.next=6,Promise.all(s);case 6:nc("Finished cycling through logout callbacks."),e.next=8;break;case 7:e.prev=7,h=e.catch(5),nc("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),nc("Removed Auth0 storage object...")}),xc("hhsl"),xc("userNewsLetterData"),xc(oc.REGWALL_USER_IS_SUBSCRIBED),xc(oc.USER_PROFILE_HASH),c=uc(),u=window.location.origin;try{c.searchParams.get("returnURL")&&(l=decodeURIComponent(c.searchParams.get("returnURL")),u=l)}catch(e){nc(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(nc("Auth | Silent mode enabled ",Connext.GetOptions().Silentmode),nc("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),!Lc()){e.next=10;break}nc("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==nu()){e.next=14;break}if(nc("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 nc("Connext took too long to logout, calling auth0 logout..."),e.next=1,tu(u);case 1:case"end":return e.stop()}},e)})),8e3),"function"!=typeof Connext._logout){e.next=12;break}return nc("About to call Connext _logout..."),e.next=11,Connext._logout();case 11:e.next=13;break;case 12:return nc("About to call Connext Logout..."),e.next=13,Connext.Logout();case 13:e.next=15;break;case 14:return nc("Connext user state is logged out, not calling it, going to auth0 logout."),e.next=15,tu(u);case 15:e.next=17;break;case 16:return nc("Connext Logout was NOT called"),e.next=17,tu(u);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),iu=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},au=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return Fc(e)}),nc("Cycled through preauth GTM events.")},su=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 nc("Attempting to login..."),iu()>4.5&&window.localStorage.clear(),au(),i&&(s=[],c=window.localStorage.getItem("callbackEvents"),u=JSON.parse(c),s=u&&u.length>0?Gc(new Set([].concat(Gc(i),Gc(u)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(s))),l=null,e.next=1,Mc();case 1:if(d=e.sent,h=uc(),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,$c();case 2:e.next=4;break;case 3:Pc();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",nc("Logging in with regwall")),t&&(f.searchParams.set("loginsource",t),nc("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)}}(),cu=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();nc("Adding listeners to events we need to wait for...");var o=r.map(function(e){return t=e,new Promise(function(e){nc("Adding event to wait for: ",t),window.addEventListener(t,function(n){try{var r=n.detail||{};nc("Event: ".concat(t,"} ready: "),r),e(r)}catch(t){nc(t),e()}},!1)});var t});Promise.all(o).then(function(){clearTimeout(t),e()})}catch(t){nc("Failed to wait for callback events",t),e()}})};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.oidcLoginCallbacks=[];var uu=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,A,S,_;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ru(),t=uc(),n=!1,i=t.searchParams.get("auth_redirect")||"https://".concat(window.location.host),a=t.searchParams.get("redirect_uri")||"",a.includes("applenews")?(nc("This is Apple prelogin flow."),(s=new URL(a))?(s.searchParams.append("post-apple-login","true"),nc("Post callback Apple redirect URL is ".concat(s)),su(!1,!1,!1,[],s)):su()):i.includes("post-apple-login")&&(nc("This is Apple Callback flow."),n=!0,(c=new URL(decodeURIComponent(i))).searchParams.delete("post-apple-login"),i=c),nc("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",su(!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,Mc();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,nc("Auth0 user profile: ",h),p=d.__raw,e.next=7,l.getTokenSilently();case 7:return f=e.sent,e.prev=8,nc("Cycling through login callbacks..."),e.next=9,cu();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:nc("Finished cycling through login callbacks."),e.next=12;break;case 11:e.prev=11,A=e.catch(8),nc("Failed to cycle through login callbacks: ",A);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,gc(y.userId);case 14:return g=e.sent,nc("Encrypted apple uuid is: ".concat(g)),e.next=15,wc(g);case 15:w=e.sent,nc("Apple sub status is: ".concat(w)),e.next=17;break;case 16:e.prev=16,S=e.catch(13),nc("Apple sub check error: ".concat(S)),alert("There was an error in logging you in, please try again.");case 17:if(xc(oc.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return nc("Saving idToken to session server"),e.next=18,Qc({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),nc("Apple redirect URL:",E),e.abrupt("return",window.location.assign(E));case 21:return e.prev=21,_=e.catch(20),nc("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)}}(),lu=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return nc("ANALYTICS: fireBC events"),e.next=1,Wc();case 1:nc("ANALYTICS: bc values should be filled");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,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,Cc();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,a=yc(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),nc("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)}}();window.MNGAuthentication.login=su,window.MNGAuthentication.logout=ou,window.MNGAuthentication.getUserInfo=du;var hu=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(t=uc(),n=!1,a="",s=!1,c={},eu()&&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,Mc();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=lc(oc.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),nc("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=2;break}return nc("Page is logout. Routing to logout function..."),e.next=1,ou();case 1:return e.abrupt("return");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=9;break}return e.next=3,l();case 3:if(""===a){e.next=5;break}if(d=null,h=JSON.parse(window.localStorage.getItem(oc.LOCAL_STORAGE_SESSION_KEY)),"{}"!==Xc()){e.next=4;break}return h&&(d=h.jwt),e.next=4,Qc({idToken:a,entitlementToken:d});case 4:e.next=8;break;case 5:return e.prev=5,e.next=6,qc();case 6:p=e.sent,a=p.idToken,(n="string"==typeof a)&&(c=yc(a)),e.next=8;break;case 7:e.prev=7,y=e.catch(5),nc("Unable to initialize session: ",y);case 8:e.next=10;break;case 9:return e.next=10,l();case 10:if(n||s||!tc.A.blueconicEnabled||!tc.A.bcLowaSegements){e.next=12;break}return e.next=11,Ic(!0);case 11:(f=e.sent).isSub&&(n=oc.USER_IS_LOWA,c={sub:f.uuid});case 12:if(Bc({isAuthenticated:n,idToken:a,accessToken:s,claims:c}),jc("authenticationReady"),!0===n?(nc("User is authenticated."),t.searchParams.get("auth_redirect")&&(nc("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")&&!eu()&&(nc("Page is login. The user is already logged in and Connext Logout param is not present... Redirecting..."),window.location.assign(t.origin))):nc("User is not authenticated."),t.pathname.startsWith("/login")&&!eu()?(nc("Page is login. Attempting to log user in..."),su()):nc("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=14;break}return nc("Page is callback with regwall param. Routing to regwall receiver..."),e.next=13,lu();case 13:nc("Now login from regwall"),su(),e.next=15;break;case 14:if(!t.pathname.startsWith("/callback")){e.next=15;break}return nc("Page is callback without regwall param. Routing to callback receiver..."),e.next=15,uu();case 15:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=hu;var pu=function(e,t){return new Promise(function(n){try{"undefined"==typeof CnnXt&&(nc("Connext was not loaded."),n(!1)),nc("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(){nc("Signed user up to newsletter: ",t),n(!0)},onError:function(e){nc("subscribeToNewsletter error: ",e),n(!1)}})}catch(e){nc("subscribeToNewsletter Error:",e),n(!1)}})},fu=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)}})},mu=function(){Lc()||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])}})},yu=function(e){try{"string"==typeof e&&pc(oc.AUTH0_SUB_COOKIE_KEY,e,{domain:hc(),path:"/",expires:365,secure:!0})}catch(e){nc("Failed to set auth0_sub cookie: ",e)}},wu=function(e){if(!lc(oc.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;yu(n)}catch(e){nc("Failed to set auth0_sub: ",e)}},gu=function(e){try{if("string"==typeof e){var t=yc(e).sub;yu(t)}else nc("Could not set auth0_sub on login, idToken was not available.")}catch(e){nc("Failed to set auth0_sub on login: ",e)}},bu=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,du();case 2:return n=e.sent,r=n.email,nc("CONNEXT: about to sign up ".concat(r," to ").concat(t)),e.next=3,pu(r,t);case 3:window.localStorage.removeItem("newsletter_to_subscribe"),nc("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 vu={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 fu(),mu(),bu(),MNGAuthentication.oidcLoginCallbacks.push(gu),window.ConnextUtils.runConnextIfSilent(),e.next=1,Cc();case 1:t=e.sent,wu(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 vu.init(),e.next=1,vc(!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 T(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 E(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:g(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):g(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function g(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 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 S(this,e,t,n);case"base64":return v(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(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 P(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 U(e,t,n,r,o){K(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 x(e,t,n,r,o){K(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 B(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 M(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=Z(function(e){j(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||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=Z(function(e){j(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||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){P(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){P(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||P(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||P(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||P(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||P(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||P(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 U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Z(function(e,t=0){return x(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);P(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);P(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||P(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||P(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||P(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||P(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||P(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 U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Z(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return M(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 K(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){j(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,o,i)}function j(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 j(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,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}}},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:()=>wi,hasStandardBrowserEnv:()=>Ei,hasStandardBrowserWebWorkerEnv:()=>gi,navigator:()=>mi,origin:()=>Ai});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 E=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 E.getInstance()};var g=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 g(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 g(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?v:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,S.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),S.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;N=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;ie=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 Y("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",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 Y("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw Y("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw le(e.message,r,o);throw e}}function we(e,t,n,r){try{if("string"!=typeof e)throw Y("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw Y("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw le(e.message,n,r);throw e}}function me(e){!function(e,t){if(Ge(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 le(t,st,e)}(e,t)}(e,"application/json")}function Ee(){return se(crypto.getRandomValues(new Uint8Array(32)))}function ge(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 ce("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 ce("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 ce("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 ce("unsupported CryptoKey algorithm name",{cause:e})}}function Ae(e){const t=null==e?void 0:e[z];return"number"==typeof t&&Number.isFinite(t)?t:0}function be(e){const t=null==e?void 0:e[Z];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Se(){return Math.floor(Date.now()/1e3)}function ve(e){if("object"!=typeof e||null===e)throw Y('"as" must be an object',"ERR_INVALID_ARG_TYPE");we(e.issuer,'"as.issuer"')}function Re(e){if("object"!=typeof e||null===e)throw Y('"client" must be an object',"ERR_INVALID_ARG_TYPE");we(e.client_id,'"client.client_id"')}function Te(e){return we(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function Oe(e,t){const{key:n,kid:r}=e instanceof CryptoKey?{key:o}:(null==o?void 0:o.key)instanceof CryptoKey?(void 0!==o.kid&&we(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw Y("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw Y("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:ge(n),kid:r},u=function(e,t){const n=Se()+Ae(t);return{jti:Ee(),aud:e.issuer,exp:n+60,iat:n,nbf:n,iss:t.client_id,sub:t.client_id}}(e,o);null==t||null===t[ee]||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 Y('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(se(oe(JSON.stringify(e))),".").concat(se(oe(JSON.stringify(t)))),o=se(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Et(e)};case"RSA-PSS":switch(mt(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 ce("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return mt(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new ce("unsupported CryptoKey algorithm name",{cause:e})}(n),n,oe(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const Ne=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function _e(e,t){if(t&&"https:"!==e.protocol)throw le("only requests to HTTPS are allowed",ut,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw le("only HTTP and HTTPS requests are allowed",lt,e)}function Ie(e,t,n,r){let o;if("string"!=typeof e||!Ne(e))throw le("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?pt:yt,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return _e(o,r),o}function Ce(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?Ie(e.mtls_endpoint_aliases[t],t,n,r):Ie(e[t],t,n,r)}class ke extends Error{constructor(e,t){var n;super(e,t),H(this,"cause",void 0),H(this,"code",void 0),H(this,"error",void 0),H(this,"status",void 0),H(this,"error_description",void 0),H(this,"response",void 0),this.name=this.constructor.name,this.code=nt,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 Le extends Error{constructor(e,t){var n,r;super(e,t),H(this,"cause",void 0),H(this,"code",void 0),H(this,"error",void 0),H(this,"error_description",void 0),this.name=this.constructor.name,this.code=ot,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 Pe extends Error{constructor(e,t){var n;super(e,t),H(this,"cause",void 0),H(this,"code",void 0),H(this,"response",void 0),H(this,"status",void 0),this.name=this.constructor.name,this.code=tt,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 Ue=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),xe=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),De=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),Be=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function Me(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(function(e){if(!V(e,Response))throw Y('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(Ue);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(xe)){if([,n,o,r]=t,o.includes("\\"))try{JSON.parse('"'.concat(o,'"'))}catch(e){}u[n.toLowerCase()]=o}else{if(!r.match(De)){if(r.match(Be)){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 Pe("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){wt(e),me(e);try{const t=await e.clone().json();if(de(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 ke("server responded with an error in the response body",{cause:t,response:e});throw le('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),ct,e)}}function He(e){if(!qe.has(e))throw Y('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function Ge(e){var t;return null===e.headers.get("content-type")||void 0===t?void 0:t.split(";")[0]}async function Fe(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[Q])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:he(r,null==a?void 0:a.signal)})}async function Ke(e,t,n,r,o,i){var a;const s=Ce(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[q]));o.set("grant_type",r);const c=fe(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(He(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await Fe(e,t,n,s,o,c,i);return null==i||null===i.DPoP||void 0===a||a.cacheNonce(u,s),u}const je=new WeakMap,We=new WeakMap;function Xe(e){if(!e.id_token)return;const t=je.get(e);if(!t)throw Y('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function Je(e,t,n,r,o,i){if(ve(e),Re(t),!V(n,Response))throw Y('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await Me(n,200,"Token Endpoint"),wt(n);const a=await vt(n);if(we(a.access_token,'"response" body "access_token" property',at,{body:a}),we(a.token_type,'"response" body "token_type" property',at,{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;ye(e,!0,'"response" body "expires_in" property',at,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&we(a.refresh_token,'"response" body "refresh_token" property',at,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw le('"response" body "scope" property must be a string',at,{body:a});if(void 0!==a.id_token){we(a.id_token,'"response" body "id_token" property',at,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(ye(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 ce("JWE decryption is not configured",{cause:e});await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw le("Invalid JWT",at,e);try{JSON.parse(oe(se(s)))}catch(e){throw le("failed to parse JWT Header body as base64url encoded JSON",it,e)}if(!de(i))throw le("JWT Header must be a top level object",at,e);if(t(i),void 0!==i.crit)throw new ce('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{JSON.parse(oe(se(c)))}catch(e){throw le("failed to parse JWT Payload body as base64url encoded JSON",it,e)}if(!de(a))throw le("JWT Payload must be a top level object",at,e);const l=Se()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw le('unexpected JWT "exp" (expiration time) claim type',at,{claims:a});if(a.exp<=l-r)throw le('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',dt,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw le('unexpected JWT "iat" (issued at) claim type',at,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw le('unexpected JWT "iss" (issuer) claim type',at,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw le('unexpected JWT "nbf" (not before) claim type',at,{claims:a});if(a.nbf>l+r)throw le('unexpected JWT "nbf" (not before) claim value',dt,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw le('unexpected JWT "aud" (audience) claim type',at,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,gt.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Ae(t),be(t),o).then(Ze.bind(void 0,i)).then(Ye.bind(void 0,e)).then(Ve.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw le('ID Token "aud" (audience) claim includes additional untrusted audiences',ft,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw le('unexpected ID Token "azp" (authorized party) claim value',ft,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&ye(s.auth_time,!0,'ID Token "auth_time" (authentication time)',at,{claims:s}),We.set(n,c),je.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 ce("unsupported `token_type` value",{cause:{body:a}});return a}function Ve(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw le('unexpected JWT "aud" (audience) claim value',ft,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw le('unexpected JWT "aud" (audience) claim value',ft,{expected:e,claims:t.claims,claim:"aud"});return t}function Ye(e,t){var n,r;const o=null!==(null===e[Tt]||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw le('unexpected JWT "iss" (issuer) claim value',ft,{expected:o,claims:t.claims,claim:"iss"});return t}const qe=new WeakSet,ze=Symbol(),$e={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 Ze(e,t){for(const n of e)if(void 0===t.claims[n])throw le('JWT "'.concat(n,'" (').concat($e[n],") claim missing"),at,{claims:t.claims});return t}const Qe=Symbol(),et=Symbol();const tt="OAUTH_WWW_AUTHENTICATE_CHALLENGE",nt="OAUTH_RESPONSE_BODY_ERROR",rt="OAUTH_UNSUPPORTED_OPERATION",ot="OAUTH_AUTHORIZATION_RESPONSE_ERROR",it="OAUTH_PARSE_ERROR",at="OAUTH_INVALID_RESPONSE",st="OAUTH_RESPONSE_IS_NOT_JSON",ct="OAUTH_RESPONSE_IS_NOT_CONFORM",ut="OAUTH_HTTP_REQUEST_FORBIDDEN",lt="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",dt="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",ft="OAUTH_JWT_CLAIM_COMPARISON_FAILED",ht="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",pt="OAUTH_MISSING_SERVER_METADATA",yt="OAUTH_INVALID_SERVER_METADATA";function wt(e){if(e.bodyUsed)throw Y('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function mt(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new ce("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Et(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 ce("unsupported ECDSA namedCurve",{cause:e})}}function gt(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw le('unexpected JWT "alg" header parameter',at,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw le('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 le('unexpected JWT "alg" header parameter',at,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw le('unexpected JWT "alg" header parameter',at,{header:r,expected:e,reason:"client configuration"})}function At(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw le('"'.concat(t,'" parameter must be provided only once'),at);return n}const bt=Symbol(),St=Symbol();async function vt(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:me;try{await e.json()}catch(t){throw n(e),le('failed to parse "response" body as JSON',it,t)}if(!de(t))throw le('"response" body must be a top level object',at,{body:t});return t}const Rt=Symbol(),Tt=Symbol(),Ot=new TextEncoder,Nt=new TextDecoder;function _t(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 It(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&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}}),H(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),H(this,"claim",void 0),H(this,"reason",void 0),H(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}H(Lt,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class Pt extends kt{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}}),H(this,"code","ERR_JWT_EXPIRED"),H(this,"claim",void 0),H(this,"reason",void 0),H(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}H(Pt,"code","ERR_JWT_EXPIRED");class Ut extends kt{constructor(){super(...arguments),H(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}H(Ut,"code","ERR_JOSE_ALG_NOT_ALLOWED");class xt extends kt{constructor(){super(...arguments),H(this,"code","ERR_JOSE_NOT_SUPPORTED")}}H(xt,"code","ERR_JOSE_NOT_SUPPORTED"),H(class extends kt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),H(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),H(class extends kt{constructor(){super(...arguments),H(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class Dt extends kt{constructor(){super(...arguments),H(this,"code","ERR_JWS_INVALID")}}H(Dt,"code","ERR_JWS_INVALID");class Bt extends kt{constructor(){super(...arguments),H(this,"code","ERR_JWT_INVALID")}}H(Bt,"code","ERR_JWT_INVALID"),H(class extends kt{constructor(){super(...arguments),H(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class Mt extends kt{constructor(){super(...arguments),H(this,"code","ERR_JWKS_INVALID")}}H(Mt,"code","ERR_JWKS_INVALID");class Ht extends kt{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),H(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}H(Ht,"code","ERR_JWKS_NO_MATCHING_KEY");class Gt extends kt{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),H(this,Symbol.asyncIterator,void 0),H(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}H(Gt,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class Ft extends kt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),H(this,"code","ERR_JWKS_TIMEOUT")}}H(Ft,"code","ERR_JWKS_TIMEOUT");class Kt extends kt{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),H(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}H(Kt,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const jt=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},Wt=(e,t)=>e.name===t;function Xt(e){return parseInt(e.name.slice(4),10)}function Jt(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 Vt=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},qt=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),zt=e=>Yt(e)||qt(e);function $t(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 Zt=(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)},tn=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},nn=(e,t,n)=>{var r;const o=(e=>It(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){en(e,48,"Invalid PKCS#8 structure"),Qt(e),en(e,2,"Expected version field");const t=Qt(e);e.pos+=t,en(e,48,"Expected algorithm identifier");Qt(e);e.pos}(t),(e=>{const t=(e=>{en(e,6,"Expected algorithm OID");const t=Qt(e);return tn(e,t)})(e);if(Zt(t,[43,101,110]))return"X25519";if(!Zt(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");en(e,6,"Expected curve OID");const n=Qt(e),r=tn(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(Zt(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 xt("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 xt('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)};async function rn(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new xt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new xt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new xt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new xt('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new xt('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=F({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const on=e=>$t(e)&&"string"==typeof e.kty;let an;const sn=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];an||(an=new WeakMap);let o=an.get(e);if(null!=o&&o[n])return o[n];const i=await rn(F(F({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:an.set(e,{[n]:i}),i};const cn=e=>null==e?void 0:e[Symbol.toStringTag],un=(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 ln,dn;let fn,hn;if("undefined"==typeof navigator||null===(ln=navigator.userAgent)||void 0===ln||null===(dn=ln.startsWith)||void 0===dn||!dn.call(ln,"Mozilla/5.0 ")){const e="v6.8.1";hn="".concat("openid-client","/").concat(e),fn={"user-agent":hn}}const pn=e=>yn.get(e);let yn,wn;function mn(e){return void 0!==e?Te(e):(wn||(wn=new WeakMap),(e,t,n,r)=>{let o;return(o=wn.get(t))||(function(e,t){if("string"!=typeof e)throw bn("".concat(t," must be a string"),An);if(0===e.length)throw bn("".concat(t," must not be empty"),gn)}(t.client_secret,'"metadata.client_secret"'),o=Te(t.client_secret),wn.set(t,o)),o(e,t,n,r)})}const En=Q,gn="ERR_INVALID_ARG_VALUE",An="ERR_INVALID_ARG_TYPE";function bn(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Sn extends Error{constructor(e,t){var n;super(e,t),H(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 vn(e,t,n){return new Sn(e,{cause:t,code:n})}function Rn(e){if(e instanceof TypeError||e instanceof Sn||e instanceof ke||e instanceof Le||e instanceof Pe)throw e;if(e instanceof ue)switch(e.code){case ut:throw vn("only requests to HTTPS are allowed",e,e.code);case lt:throw vn("only requests to HTTP or HTTPS are allowed",e,e.code);case ct:throw vn("unexpected HTTP response status code",e.cause,e.code);case st:throw vn("unexpected response content-type",e.cause,e.code);case it:throw vn("parsing error occured",e,e.code);case at:throw vn("invalid response encountered",e,e.code);case ft:throw vn("unexpected JWT claim value encountered",e,e.code);case ht:throw vn("unexpected JSON attribute value encountered",e,e.code);case dt:throw vn("JWT timestamp claim value failed validation",e,e.code);default:throw vn(e.message,e,e.code)}if(e instanceof ce)throw vn("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw vn("runtime operation error",e,rt);case"NotSupportedError":throw vn("runtime unsupported operation",e,rt);case"TimeoutError":throw vn("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw vn("operation aborted",e,"OAUTH_ABORT")}throw new Sn("something went wrong",{cause:e})}async function Tn(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw bn('"server" must be an instance of URL',An);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 Y('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");_e(e,!0!==(null==r?void 0:r[q]));const o=n(new URL(e.href)),i=fe(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[Q])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:he(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=pe("".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=pe("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw Y('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[Q]:null==t?void 0:t[En],[q]:null==t||null===t.execute||void 0===r?void 0:r.includes(Pn),signal:a,headers:new Headers(fn)}):((null==t?void 0:t[En])||fetch)((_e(e,null==t||null===t.execute||void 0===c||!c.includes(Pn)),e.href),{headers:Object.fromEntries(new Headers(F({accept:"application/json"},fn)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Rt)throw Y('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!V(t,Response))throw Y('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw le('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',ct,t);wt(t);const r=await vt(t);if(we(r.issuer,'"response" body "issuer" property',at,{body:r}),n!==Rt&&new URL(r.issuer).href!==n.href)throw le('"response" body "issuer" property does not match the expected value',ht,{expected:n.href,body:r,attribute:"issuer"});return r}(Rt,e)).catch(Rn);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[On]=!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 Sn("discovered metadata issuer does not match the expected issuer",{code:ht,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Nn(i,t,n,r);let s=pn(a);if(null!=o&&o[En]&&(s.fetch=o[En]),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 On=Symbol();class Nn{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw bn('"clientId" must be a non-empty string',An);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 bn('"clientId" and "metadata.client_id" must be the same',gn);const u=F(F({},structuredClone(n)),{},{client_id:t});let l;u[z]=null!==(i=null===(a=n)||void 0===a?void 0:a[z])&&void 0!==i?i:0,u[Z]=null!==(s=null===(c=n)||void 0===c?void 0:c[Z])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?mn(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const f=structuredClone(e);On in e&&(f[Tt]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let h=Object.freeze(f);yn||(yn=new WeakMap),yn.set(this,{__proto__:null,as:h,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(pn(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(pn(this).c)}get timeout(){return pn(this).timeout}set timeout(e){pn(this).timeout=e}get[En](){return pn(this).fetch}set[En](e){pn(this).fetch=e}}function _n(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 Xe(this)}catch(e){return}}}}}(e))}async function In(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 ue("invalid Retry-After header value",{cause:e});a>t&&await Cn(a-t,n)}function Cn(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 kn(e,t){Hn(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=pn(e);return async function(e,t,n,r,o){ve(e),Re(t);const i=Ce(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=fe(null==o?void 0:o.headers);return s.set("accept","application/json"),Fe(e,t,n,i,a,s,o)}(n,r,o,t,{[Q]:i,[q]:!a,headers:new Headers(fn),signal:Gn(s)}).then(e=>async function(e,t,n){if(ve(e),Re(t),!V(n,Response))throw Y('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await Me(n,200,"Backchannel Authentication Endpoint"),wt(n);const r=await vt(n);we(r.auth_req_id,'"response" body "auth_req_id" property',at,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return ye(o,!0,'"response" body "expires_in" property',at,{body:r}),r.expires_in=o,void 0!==r.interval&&ye(r.interval,!1,'"response" body "interval" property',at,{body:r}),r}(n,r,e)).catch(Rn)}async function Ln(e,t,n,r){var o,i;Hn(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 Cn(a,s)}catch(e){Rn(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:f,nonRepudiation:h,timeout:p,decrypt:y}=pn(e),w=(o,i)=>Ln(e,F(F({},t),{},{interval:o}),n,F(F({},r),{},{signal:s,flag:i})),m=await async function(e,t,n,r,o){ve(e),Re(t),we(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),Ke(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[Q]:d,[q]:!f,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(fn),signal:s.aborted?s:Gn(p)}).catch(Rn);var E;if(503===m.status&&m.headers.has("retry-after"))return await In(m,a,s,!0),await(null===m.body||void 0===E?void 0:E.cancel()),w(a);const g=async function(e,t,n,r){return Je(e,t,n,void 0,null==r?void 0:r[te],null==r?void 0:r.recognizedTokenTypes)}(c,u,m,{[te]:y});let A;try{await g}catch(e){if(Fn(e,r))return w(a,Kn);if(e instanceof ke)switch(e.error){case"slow_down":0;case"authorization_pending":return await In(e.response,a,s),w(a)}Rn(e)}return A.id_token&&await(null==h?void 0:h(m)),_n(A),A}function Pn(e){pn(e).tlsOnly=!1}async function Un(e,t,n,r,o){if(Hn(e),!((null==o?void 0:o.flag)===Kn||t instanceof URL||function(e){try{return"Request"===Object.getPrototypeOf(e)[Symbol.toStringTag]}catch(e){return!1}}(t)))throw bn('"currentUrl" must be an instance of URL, or Request',An);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}=pn(e);if((null==o?void 0:o.flag)===Kn)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 Y("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==Ge(e))throw Y("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw Y("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{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 bn("unexpected Request HTTP method",gn)}}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(ve(e),Re(t),n instanceof URL&&n.searchParams,!(n instanceof URLSearchParams))throw Y('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(At(n,"response"))throw le('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',at,{parameters:n});const o=At(n,"iss"),i=At(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw le('response parameter "iss" (issuer) missing',at,{parameters:n});if(o&&o!==e.issuer)throw le('unexpected "iss" (issuer) response parameter value',at,{expected:e.issuer,parameters:n});switch(r){case void 0:case St:if(void 0!==i)throw le('unexpected "state" response parameter encountered',at,{expected:void 0,parameters:n});break;case bt:break;default:if(we(r,'"expectedState" argument'),i!==r)throw le(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',at,{expected:r,parameters:n})}if(At(n,"error"))throw new Le("authorization response from the server is an error",{cause:n});const a=At(n,"id_token"),s=At(n,"token");if(void 0!==a||void 0!==s)throw new ce("implicit and hybrid flows are not supported");return new URLSearchParams(n),qe.add(c),c;var c})(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Rn(e)}}}const E=await async function(e,t,n,r,o,i,a){if(ve(e),Re(t),!qe.has(r))throw Y('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");we(o,'"redirectUri"');const s=At(r,"code");if(!s)throw le('no authorization code in "callbackParameters"',at);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==ze&&(we(i,'"codeVerifier"'),c.set("code_verifier",i)),Ke(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||ze,{additionalParameters:r,[Q]:l,[q]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(fn),signal:Gn(y)}).catch(Rn);"string"!=typeof(null==n?void 0:n.expectedNonce)&&"number"!=typeof(null==n?void 0:n.maxAge)||(n.idTokenExpected=!0);const g=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 Qe:break;default:we(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||t.default_max_age,o){case void 0:0;break;case et:break;default:ye(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await Je(e,t,n,s,i,a);we(c.id_token,'"response" body "id_token" property',at,{body:c});const u=Xe(c);if(o!==et){const e=Se()+Ae(t),n=be(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 Je(e,t,n,void 0,null==r?void 0:r[te],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[te]:l,recognizedTokenTypes:n})}).catch(Rn);return _n(d),d}async function Wn(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;r"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 xt('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)}(Dt,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 Dt('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new Dt('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 Ut('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new Dt("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new Dt("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(on(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&un(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(!zt(t))throw new TypeError(Vt(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(cn(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(on(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&un(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)&&un(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!zt(t))throw new TypeError(Vt(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(cn(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(cn(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(cn(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(cn(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(cn(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?_t(e.protected):new Uint8Array,_t("."),"string"==typeof e.payload?a?_t(e.payload):Ot.encode(e.payload):e.payload);let d;try{Ct(e.signature)}catch(e){throw new Dt("Failed to base64url decode the signature")}const f=await async function(e,t){if(e instanceof Uint8Array)return e;if(Yt(e))return e;if(qt(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{an||(an=new WeakMap);let n=an.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("given KeyObject instance cannot be used for this algorithm")}e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm")}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("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),"ES384"===t&&"P-384"===n&&e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"]),"ES512"===t&&"P-521"===n&&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("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:an.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return sn(e,n,t)}if(on(e))return e.k?Ct(e.k):sn(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await Wn(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 xt("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 Kt;let h;if(a)try{Ct(e.payload)}catch(e){throw new Dt("Failed to base64url decode the payload")}else"string"==typeof e.payload?Ot.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?F(F({},p),{},{key:f}):p}const Jn=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function Vn(e){const t=Jn.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 Yn=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function qn(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&Nt.decode(e),"string"!=typeof e)throw new Dt("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new Dt("Invalid Compact JWS");const s=await Xn({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?F(F({},c),{},{key:s.key}):c}(e,t,n);if(null!==o.protectedHeader.crit&&void 0!==r&&r.includes("b64")&&!1===o.protectedHeader.b64)throw new Bt("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{JSON.parse(Nt.decode(t))}catch(e){}if(!$t(n))throw new Bt("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||Yn(e.typ)!==Yn(o)))throw new Lt('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 Lt('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new Lt('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new Lt('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new Lt('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":Vn(r.clockTolerance);break;case"number":r.clockTolerance;break;case"undefined":0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:f}=r,h=(e=>Math.floor(e.getTime()/1e3))(f||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new Lt('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new Lt('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>h+d)throw new Lt('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new Lt('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=h-d)throw new Pt('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=h-n.iat;if(e-d>("number"==typeof u?u:Vn(u)))throw new Pt('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new Lt('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?F(F({},a),{},{key:o.key}):a}function zn(e){return $t(e)}var $n,Zn,Qn=new WeakMap,er=new WeakMap;class tr{constructor(e){if(B(this,Qn,void 0),B(this,er,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(zn)}(e))throw new Mt("JSON Web Key Set malformed");M(Qn,this,structuredClone(e))}jwks(){return D(Qn,this)}async getKey(e,t){const{alg:n,kid:r}=F(F({},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 xt('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=D(Qn,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 Ht;if(1!==s){const e=new Gt,t=D(er,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new j(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield U(nr(t,e,n))}catch(e){}}),e}return nr(D(er,this),a,n)}}async function nr(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(!$t(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 Ct(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new xt('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return rn(F(F({},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 rn(F(F({},e),{},{ext:n}));case"EC":case"OKP":return rn(F(F({},e),{},{alg:t,ext:n}));default:throw new xt('Unsupported "kty" (Key Type) Parameter value')}}(F(F({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new Mt("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function rr(e){const t=new tr(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 or;if("undefined"==typeof navigator||null===($n=navigator.userAgent)||void 0===$n||null===(Zn=$n.startsWith)||void 0===Zn||!Zn.call($n,"Mozilla/5.0 ")){const e="v6.1.3";or="".concat("jose","/").concat(e)}const ir=Symbol(),ar=Symbol();var sr=new WeakMap,cr=new WeakMap,ur=new WeakMap,lr=new WeakMap,dr=new WeakMap,fr=new WeakMap,hr=new WeakMap,pr=new WeakMap,yr=new WeakMap,wr=new WeakMap;class mr{constructor(e,t){if(B(this,sr,void 0),B(this,cr,void 0),B(this,ur,void 0),B(this,lr,void 0),B(this,dr,void 0),B(this,fr,void 0),B(this,hr,void 0),B(this,pr,void 0),B(this,yr,void 0),B(this,wr,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;M(sr,this,new URL(e.href)),M(cr,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),M(ur,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),M(lr,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),M(hr,this,new Headers(null==t?void 0:t.headers)),or&&!D(hr,this).has("User-Agent")&&D(hr,this).set("User-Agent",or),D(hr,this).has("accept")||(D(hr,this).set("accept","application/json"),D(hr,this).append("accept","application/jwk-set+json")),M(pr,this,null==t?void 0:t[ir]),void 0!==(null==t?void 0:t[ar])&&(M(wr,this,null==t?void 0:t[ar]),null==t?void 0:t[ar],D(lr,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&$t(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,$t)&&(M(dr,this,D(wr,this).uat),M(yr,this,rr(D(wr,this).jwks))))}pendingFetch(){return!!D(fr,this)}coolingDown(){return"number"==typeof D(dr,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 Ft;throw e});if(200!==o.status)throw new kt("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new kt("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(D(sr,this).href,D(hr,this),AbortSignal.timeout(D(cr,this)),D(pr,this)).then(e=>{M(yr,this,rr(e)),D(wr,this)&&(D(wr,this).uat=Date.now(),D(wr,this).jwks=e),M(dr,this,Date.now()),M(fr,this,void 0)}).catch(e=>{throw M(fr,this,void 0),e})),await D(fr,this)}}const Er=["mfaToken"],gr=["mfaToken"];var Ar,br,Sr,vr,Rr,Tr,Or,Nr,_r=class extends Error{constructor(e,t){super(t),H(this,"code",void 0),this.name="NotSupportedError",this.code=e}},Ir=class extends Error{constructor(e,t,n){super(t),H(this,"cause",void 0),H(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},Cr=class extends Ir{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},kr=class extends Ir{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},Lr=class extends Ir{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},Pr=class extends Ir{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},Ur=class extends Ir{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},xr=class extends Error{constructor(e){super(e),H(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},Dr=class extends Ir{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),H(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},Br=class extends Ir{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},Mr=class extends Ir{constructor(e){super("build_link_user_url_error","There was an error when trying to build the Link User URL.",e),this.name="BuildLinkUserUrlError"}},Hr=class extends Ir{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},Gr=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),H(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function Fr(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>F(F({},e),{},{[t[0]]:t[1]}),{})}var Kr=class extends Error{constructor(e,t,n){super(t),H(this,"cause",void 0),H(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},jr=class extends Kr{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},Wr=class extends Kr{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},Xr=class extends Kr{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},Jr=class extends Kr{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function Vr(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var Yr=(Ar=new WeakMap,br=new WeakMap,Sr=new WeakMap,class{constructor(e){var t;B(this,Ar,void 0),B(this,br,void 0),B(this,Sr,void 0),M(Ar,this,"https://".concat(e.domain)),M(br,this,e.clientId),M(Sr,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(D(Ar,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await D(Sr,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 jr(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(Vr)}async enrollAuthenticator(e){const t="".concat(D(Ar,this),"/mfa/associate"),{mfaToken:n}=e,r=K(e,Er),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 D(Sr,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 Wr(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};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(D(Ar,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await D(Sr,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 Xr(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(D(Ar,this),"/mfa/challenge"),{mfaToken:n}=e,r=K(e,gr),o={mfa_token:n,client_id:D(br,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await D(Sr,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 Jr(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())}}),qr=class e{constructor(e,t,n,r,o,i,a){H(this,"accessToken",void 0),H(this,"idToken",void 0),H(this,"refreshToken",void 0),H(this,"expiresAt",void 0),H(this,"scope",void 0),H(this,"claims",void 0),H(this,"authorizationDetails",void 0),H(this,"tokenType",void 0),H(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}},zr="openid profile email offline_access",$r=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 Zr(e){if(null==e)throw new Ur("subject_token is required");if("string"!=typeof e)throw new Ur("subject_token must be a string");if(0===e.trim().length)throw new Ur("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new Ur("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new Ur("subject_token must not include the 'Bearer ' prefix")}function Qr(e,t){if(t)for(const[n,r]of Object.entries(t))if(!$r.has(n))if(Array.isArray(r)){if(r.length>20)throw new Ur("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}vr=new WeakMap,Rr=new WeakMap,Tr=new WeakMap,Or=new WeakMap,Nr=new WeakSet;async function eo(){if(D(vr,this)&&D(Rr,this))return{configuration:D(vr,this),serverMetadata:D(Rr,this)};const e=await P(Nr,this,ro).call(this);return M(vr,this,await Tn(new URL("https://".concat(D(Tr,this).domain)),D(Tr,this).clientId,{use_mtls_endpoint_aliases:D(Tr,this).useMtls},e,{[En]:D(Tr,this).customFetch})),M(Rr,this,D(vr,this).serverMetadata()),D(vr,this)[En]=D(Tr,this).customFetch||fetch,{configuration:D(vr,this),serverMetadata:D(Rr,this)}}async function to(e){var t,n;const{configuration:r}=await P(Nr,this,eo).call(this);if("audience"in e||"resource"in e)throw new Ur("audience and resource parameters are not supported for Token Vault exchanges");Zr(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==e.subjectTokenType&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",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),Qr(o,e.extra);try{const e=await jn(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return qr.fromTokenEndpointResponse(e)}catch(t){throw new Ur("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function no(e){const{configuration:t}=await P(Nr,this,eo).call(this);Zr(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),Qr(n,e.extra);try{const e=await jn(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return qr.fromTokenEndpointResponse(e)}catch(t){throw new Ur("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function ro(){if(!D(Tr,this).clientSecret&&!D(Tr,this).clientAssertionSigningKey&&!D(Tr,this).useMtls)throw new Gr;if(D(Tr,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=D(Tr,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 nn(e,t,void 0)}(e,D(Tr,this).clientAssertionSigningAlg||"RS256"),e?function(e){return Oe(e,void 0)}(e):mn(D(Tr,this).clientSecret)}async function oo(e){const{configuration:t}=await P(Nr,this,eo).call(this),n=Ee(),r=await function(e){return async function(e){return we(e,"codeVerifier"),se(await crypto.subtle.digest("SHA-256",oe(e)))}(e)}(n),o=Fr(F(F({},D(Tr,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(F(F({scope:zr},o),{},{client_id:D(Tr,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await Mn(t,i):await Bn(t,i),codeVerifier:n}}function io(e,t){return function(){return e.apply(t,arguments)}}const{toString:ao}=Object.prototype,{getPrototypeOf:so}=Object,{iterator:co,toStringTag:uo}=Symbol,lo=(fo=Object.create(null),e=>{const t=ao.call(e);return fo[t]||(fo[t]=t.slice(8,-1).toLowerCase())});var fo;const ho=e=>(e=e.toLowerCase(),t=>lo(t)===e),po=e=>t=>typeof t===e,{isArray:yo}=Array,wo=po("undefined");function mo(e){return null!==e&&!wo(e)&&null!==e.constructor&&!wo(e.constructor)&&Ao(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Eo=ho("ArrayBuffer");const go=po("string"),Ao=po("function"),bo=po("number"),So=e=>null!==e&&"object"==typeof e,vo=e=>{if("object"!==lo(e))return!1;const t=so(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||uo in e||co in e)},Ro=ho("Date"),To=ho("File"),Oo=ho("Blob"),No=ho("FileList");const _o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},Io=void 0!==_o.FormData?_o.FormData:void 0,Co=ho("URLSearchParams"),[ko,Lo,Po,Uo]=["ReadableStream","Request","Response","Headers"].map(ho);function xo(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),yo(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const Bo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,Mo=e=>!wo(e)&&e!==Bo;const Ho=(Go="undefined"!=typeof Uint8Array&&so(Uint8Array),e=>Go&&e instanceof Go);var Go;const Fo=ho("HTMLFormElement"),Ko=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),jo=ho("RegExp"),Wo=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};xo(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const Xo=ho("AsyncFunction"),Jo=(Vo="function"==typeof setImmediate,Yo=Ao(Bo.postMessage),Vo?setImmediate:Yo?(qo=`axios@${Math.random()}`,zo=[],Bo.addEventListener("message",({source:e,data:t})=>{e===Bo&&t===qo&&zo.length&&zo.shift()()},!1),e=>{zo.push(e),Bo.postMessage(qo,"*")}):e=>setTimeout(e));var Vo,Yo,qo,zo;const $o="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Bo):"undefined"!=typeof process&&process.nextTick||Jo,Zo={isArray:yo,isArrayBuffer:Eo,isBuffer:mo,isFormData:e=>{let t;return e&&(Io&&e instanceof Io||Ao(e.append)&&("formdata"===(t=lo(e))||"object"===t&&Ao(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Eo(e.buffer),t},isString:go,isNumber:bo,isBoolean:e=>!0===e||!1===e,isObject:So,isPlainObject:vo,isEmptyObject:e=>{if(!So(e)||mo(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:ko,isRequest:Lo,isResponse:Po,isHeaders:Uo,isUndefined:wo,isDate:Ro,isFile:To,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:Oo,isRegExp:jo,isFunction:Ao,isStream:e=>So(e)&&Ao(e.pipe),isURLSearchParams:Co,isTypedArray:Ho,isFileList:No,forEach:xo,merge:function e(){const{caseless:t,skipUndefined:n}=Mo(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=t&&Do(r,i)||i;vo(r[a])&&vo(o)?r[a]=e(r[a],o):vo(o)?r[a]=e({},o):yo(o)?r[a]=o.slice():n&&wo(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(xo(t,(t,r)=>{n&&Ao(t)?Object.defineProperty(e,r,{value:io(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{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&&so(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:lo,kindOfTest:ho,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(yo(e))return e;let t=e.length;if(!bo(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[co]).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:Fo,hasOwnProperty:Ko,hasOwnProp:Ko,reduceDescriptors:Wo,freezeMethods:e=>{Wo(e,(t,n)=>{if(Ao(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];Ao(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 yo(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:Do,global:Bo,isContextDefined:Mo,isSpecCompliantForm:function(e){return!!(e&&Ao(e.append)&&"FormData"===e[uo]&&e[co])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(So(e)){if(t.indexOf(e)>=0)return;if(mo(e))return e;if(!("toJSON"in e)){t[r]=e;const o=yo(e)?[]:{};return xo(e,(e,t)=>{const i=n(e,r+1);!wo(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:Xo,isThenable:e=>e&&(So(e)||Ao(e))&&Ao(e.then)&&Ao(e.catch),setImmediate:Jo,asap:$o,isIterable:e=>null!=e&&Ao(e[co])};class Qo extends Error{static from(e,t,n,r,o,i){const a=new Qo(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",{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(){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:Zo.toJSONObject(this.config),code:this.code,status:this.status}}}Qo.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",Qo.ERR_BAD_OPTION="ERR_BAD_OPTION",Qo.ECONNABORTED="ECONNABORTED",Qo.ETIMEDOUT="ETIMEDOUT",Qo.ERR_NETWORK="ERR_NETWORK",Qo.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",Qo.ERR_DEPRECATED="ERR_DEPRECATED",Qo.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",Qo.ERR_BAD_REQUEST="ERR_BAD_REQUEST",Qo.ERR_CANCELED="ERR_CANCELED",Qo.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",Qo.ERR_INVALID_URL="ERR_INVALID_URL";const ei=Qo;var ti=n(8287).hp;function ni(e){return Zo.isPlainObject(e)||Zo.isArray(e)}function ri(e){return Zo.endsWith(e,"[]")?e.slice(0,-2):e}function oi(e,t,n){return e?e.concat(t).map(function(e,t){return e=ri(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ii=Zo.toFlatObject(Zo,{},null,function(e){return/^is[A-Z]/.test(e)});const ai=function(e,t,n){if(!Zo.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=Zo.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!Zo.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&Zo.isSpecCompliantForm(t);if(!Zo.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Zo.isDate(e))return e.toISOString();if(Zo.isBoolean(e))return e.toString();if(!s&&Zo.isBlob(e))throw new ei("Blob is not supported. Use a Buffer instead.");return Zo.isArrayBuffer(e)||Zo.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):ti.from(e):e}function u(e,n,o){let s=e;if(Zo.isReactNative(t)&&Zo.isReactNativeBlob(e))return t.append(oi(o,n,i),c(e)),!1;if(e&&!o&&"object"==typeof e)if(Zo.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(Zo.isArray(e)&&function(e){return Zo.isArray(e)&&!e.some(ni)}(e)||(Zo.isFileList(e)||Zo.endsWith(n,"[]"))&&(s=Zo.toArray(e)))return n=ri(n),s.forEach(function(e,r){!Zo.isUndefined(e)&&null!==e&&t.append(!0===a?oi([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!ni(e)||(t.append(oi(o,n,i),c(e)),!1)}const l=[],d=Object.assign(ii,{defaultVisitor:u,convertValue:c,isVisitable:ni});if(!Zo.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!Zo.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),Zo.forEach(n,function(n,i){!0===(!(Zo.isUndefined(n)||null===n)&&o.call(t,n,Zo.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function si(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function ci(e,t){this._pairs=[],e&&ai(e,this,t)}const ui=ci.prototype;ui.append=function(e,t){this._pairs.push([e,t])},ui.toString=function(e){const t=e?function(t){return e.call(this,t,si)}:si;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const li=ci;function di(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function fi(e,t,n){if(!t)return e;const r=n&&n.encode||di,o=Zo.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):Zo.isURLSearchParams(t)?t.toString():new li(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const hi=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){Zo.forEach(this.handlers,function(t){null!==t&&e(t)})}},pi={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},yi={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:li,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},wi="undefined"!=typeof window&&"undefined"!=typeof document,mi="object"==typeof navigator&&navigator||void 0,Ei=wi&&(!mi||["ReactNative","NativeScript","NS"].indexOf(mi.product)<0),gi="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ai=wi&&window.location.href||"http://localhost",bi={...e,...yi};const Si=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&&Zo.isArray(r)?r.length:i,s)return Zo.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&Zo.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&Zo.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 Zo.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const vi={transitional:pi,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=Zo.isObject(e);o&&Zo.isHTMLForm(e)&&(e=new FormData(e));if(Zo.isFormData(e))return r?JSON.stringify(Si(e)):e;if(Zo.isArrayBuffer(e)||Zo.isBuffer(e)||Zo.isStream(e)||Zo.isFile(e)||Zo.isBlob(e)||Zo.isReadableStream(e))return e;if(Zo.isArrayBufferView(e))return e.buffer;if(Zo.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ai(e,new bi.classes.URLSearchParams,{visitor:function(e,t,n,r){return bi.isNode&&Zo.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=Zo.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ai(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(Zo.isString(e))try{return(t||JSON.parse)(e),Zo.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||vi.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(Zo.isResponse(e)||Zo.isReadableStream(e))return e;if(e&&Zo.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw ei.from(e,ei.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bi.classes.FormData,Blob:bi.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Zo.forEach(["delete","get","head","post","put","patch"],e=>{vi.headers[e]={}});const Ri=vi,Ti=Zo.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"]),Oi=Symbol("internals");function Ni(e){return e&&String(e).trim().toLowerCase()}function _i(e){return!1===e||null==e?e:Zo.isArray(e)?e.map(_i):String(e)}function Ii(e,t,n,r,o){return Zo.isFunction(r)?r.call(this,t,n):(o&&(t=n),Zo.isString(t)?Zo.isString(r)?-1!==t.indexOf(r):Zo.isRegExp(r)?r.test(t):void 0:void 0)}class Ci{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=Ni(t);if(!o)throw new Error("header name must be a non-empty string");const i=Zo.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=_i(e))}const i=(e,t)=>Zo.forEach(e,(e,n)=>o(e,n,t));if(Zo.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(Zo.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((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})(e),t);else if(Zo.isObject(e)&&Zo.isIterable(e)){let n,r,o={};for(const t of e){if(!Zo.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?Zo.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=Ni(e)){const n=Zo.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(Zo.isFunction(t))return t.call(this,e,n);if(Zo.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ni(e)){const n=Zo.findKey(this,e);return!(!n||void 0===this[n]||t&&!Ii(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=Ni(e)){const o=Zo.findKey(n,e);!o||t&&!Ii(0,n[o],o,t)||(delete n[o],r=!0)}}return Zo.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&&!Ii(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return Zo.forEach(this,(r,o)=>{const i=Zo.findKey(n,o);if(i)return t[i]=_i(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]=_i(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Zo.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&Zo.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=Ni(e);t[r]||(!function(e,t){const n=Zo.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return Zo.isArray(e)?e.forEach(r):r(e),this}}Ci.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Zo.reduceDescriptors(Ci.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),Zo.freezeMethods(Ci);const ki=Ci;function Li(e,t){const n=this||Ri,r=t||n,o=ki.from(r.headers);let i=r.data;return Zo.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function Pi(e){return!(!e||!e.__CANCEL__)}const Ui=class extends ei{constructor(e,t,n){super(null==e?"canceled":e,ei.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function xi(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new ei("Request failed with status code "+n.status,[ei.ERR_BAD_REQUEST,ei.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const Di=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)]},Mi=(e,t,n=3)=>{let r=0;const o=Di(50,250);return Bi(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},Hi=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Gi=e=>(...t)=>Zo.asap(()=>e(...t)),Fi=bi.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,bi.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(bi.origin),bi.navigator&&/(msie|trident)/i.test(bi.navigator.userAgent)):()=>!0,Ki=bi.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];Zo.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),Zo.isString(r)&&s.push(`path=${r}`),Zo.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),Zo.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function ji(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Wi=e=>e instanceof ki?{...e}:e;function Xi(e,t){t=t||{};const n={};function r(e,t,n,r){return Zo.isPlainObject(e)&&Zo.isPlainObject(t)?Zo.merge.call({caseless:r},e,t):Zo.isPlainObject(t)?Zo.merge({},t):Zo.isArray(t)?t.slice():t}function o(e,t,n,o){return Zo.isUndefined(t)?Zo.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!Zo.isUndefined(t))return r(void 0,t)}function a(e,t){return Zo.isUndefined(t)?Zo.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 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,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(Wi(e),Wi(t),0,!0)};return Zo.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=Zo.hasOwnProp(c,r)?c[r]:o,a=i(e[r],t[r],r);Zo.isUndefined(a)&&i!==s||(n[r]=a)}),n}const Ji=e=>{const t=Xi({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=ki.from(a),t.url=fi(ji(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),Zo.isFormData(n))if(bi.hasStandardBrowserEnv||bi.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Zo.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(bi.hasStandardBrowserEnv&&(r&&Zo.isFunction(r)&&(r=r(t)),r||!1!==r&&Fi(t.url))){const e=o&&i&&Ki.read(i);e&&a.set(o,e)}return t},Vi="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=Ji(e);let o=r.data;const i=ki.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=ki.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());xi(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&&0===y.responseURL.indexOf("file:"))&&setTimeout(w)},y.onabort=function(){y&&(n(new ei("Request aborted",ei.ECONNABORTED,e,y)),y=null)},y.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new ei(r,ei.ERR_NETWORK,e,y);o.event=t||null,n(o),y=null},y.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||pi;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new ei(t,o.clarifyTimeoutError?ei.ETIMEDOUT:ei.ECONNABORTED,e,y)),y=null},void 0===o&&i.setContentType(null),"setRequestHeader"in y&&Zo.forEach(i.toJSON(),function(e,t){y.setRequestHeader(t,e)}),Zo.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),d&&"json"!==d&&(y.responseType=r.responseType),h&&([c,l]=Mi(h,!0),y.addEventListener("progress",c)),f&&y.upload&&([s,u]=Mi(f),y.upload.addEventListener("progress",s),y.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{y&&(n(!t||t.type?new Ui(null,e,y):t),y.abort(),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&&-1===bi.protocols.indexOf(m)?n(new ei("Unsupported protocol "+m+":",ei.ERR_BAD_REQUEST,e)):y.send(o||null)})},Yi=(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 ei?t:new Ui(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new ei(`timeout of ${t}ms exceeded`,ei.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=()=>Zo.asap(a),s}},qi=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of zi(e))yield*qi(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})},{isFunction:Zi}=Zo,Qi=(({Request:e,Response:t})=>({Request:e,Response:t}))(Zo.global),{ReadableStream:ea,TextEncoder:ta}=Zo.global,na=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ra=e=>{e=Zo.merge.call({skipUndefined:!0},Qi,e);const{fetch:t,Request:n,Response:r}=e,o=t?Zi(t):"function"==typeof fetch,i=Zi(n),a=Zi(r);if(!o)return!1;const s=o&&Zi(ea),c=o&&("function"==typeof ta?(u=new ta,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&na(()=>{let e=!1;const t=new n(bi.origin,{body:new ea,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&na(()=>Zo.isReadableStream(new r("").body)),f={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!f[e]&&(f[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new ei(`Response type '${e}' is not supported`,ei.ERR_NOT_SUPPORT,n)})});const h=async(e,t)=>{const r=Zo.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(Zo.isBlob(e))return e.size;if(Zo.isSpecCompliantForm(e)){const t=new n(bi.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return Zo.isArrayBufferView(e)||Zo.isArrayBuffer(e)?e.byteLength:(Zo.isURLSearchParams(e)&&(e+=""),Zo.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:p,onDownloadProgress:y,onUploadProgress:w,responseType:m,headers:E,withCredentials:g="same-origin",fetchOptions:A}=Ji(e),b=t||fetch;m=m?(m+"").toLowerCase():"text";let S=Yi([c,u&&u.toAbortSignal()],p),v=null;const R=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let T;try{if(w&&l&&"get"!==a&&"head"!==a&&0!==(T=await h(E,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(Zo.isFormData(s)&&(e=t.headers.get("content-type"))&&E.setContentType(e),t.body){const[e,n]=Hi(T,Mi(Gi(w)));s=$i(t.body,65536,e,n)}}Zo.isString(g)||(g=g?"include":"omit");const t=i&&"credentials"in n.prototype,c={...A,signal:S,method:a.toUpperCase(),headers:E.normalize().toJSON(),body:s,duplex:"half",credentials:t?g:void 0};v=i&&new n(o,c);let u=await(i?b(v,A):b(o,c));const p=d&&("stream"===m||"response"===m);if(d&&(y||p&&R)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=Zo.toFiniteNumber(u.headers.get("content-length")),[n,o]=y&&Hi(t,Mi(Gi(y),!0))||[];u=new r($i(u.body,65536,n,()=>{o&&o(),R&&R()}),e)}m=m||"text";let O=await f[Zo.findKey(f,m)||"text"](u,e);return!p&&R&&R(),await new Promise((t,n)=>{xi(t,n,{data:O,headers:ki.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:v})})}catch(t){if(R&&R(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new ei("Network Error",ei.ERR_NETWORK,e,v,t&&t.response),{cause:t.cause||t});throw ei.from(t,t&&t.code,e,v,t&&t.response)}}},oa=new Map,ia=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=oa;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:ra(t)),u=s;return s},aa=(ia(),{http:null,xhr:Vi,fetch:{get:ia}});Zo.forEach(aa,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const sa=e=>`- ${e}`,ca=e=>Zo.isFunction(e)||null===e||!1===e;const ua={getAdapter:function(e,t){e=Zo.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(sa).join("\n"):" "+sa(e[0]):"as no adapter specified";throw new ei("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:aa};function la(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ui(null,e)}function da(e){la(e),e.headers=ki.from(e.headers),e.data=Li.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ua.getAdapter(e.adapter||Ri.adapter,e)(e).then(function(t){return la(e),t.data=Li.call(e,e.transformResponse,t),t.headers=ki.from(t.headers),t},function(t){return Pi(t)||(la(e),t&&t.response&&(t.response.data=Li.call(e,e.transformResponse,t.response),t.response.headers=ki.from(t.response.headers))),Promise.reject(t)})}const fa="1.13.6",ha={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{ha[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const pa={};ha.transitional=function(e,t,n){function r(e,t){return"[Axios v"+fa+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new ei(r(o," has been removed"+(t?" in "+t:"")),ei.ERR_DEPRECATED);return t&&!pa[o]&&(pa[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)}},ha.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const ya={assertOptions:function(e,t,n){if("object"!=typeof e)throw new ei("options must be an object",ei.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new ei("option "+i+" must be "+n,ei.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new ei("Unknown option "+i,ei.ERR_BAD_OPTION)}},validators:ha},wa=ya.validators;class ma{constructor(e){this.defaults=e||{},this.interceptors={request:new hi,response:new hi}}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=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Xi(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&ya.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&&(Zo.isFunction(r)?t.paramsSerializer={serialize:r}:ya.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),ya.assertOptions(t,{baseUrl:wa.spelling("baseURL"),withXsrfToken:wa.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&Zo.merge(o.common,o[t.method]);o&&Zo.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ki.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||pi;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=[da.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 Ui(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 ga(function(t){e=t});return{token:t,cancel:e}}}const Aa=ga;const ba={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(ba).forEach(([e,t])=>{ba[t]=e});const Sa=ba;const va=function e(t){const n=new Ea(t),r=io(Ea.prototype.request,n);return Zo.extend(r,Ea.prototype,n,{allOwnKeys:!0}),Zo.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(Xi(t,n))},r}(Ri);va.Axios=Ea,va.CanceledError=Ui,va.CancelToken=Aa,va.isCancel=Pi,va.VERSION=fa,va.toFormData=ai,va.AxiosError=ei,va.Cancel=va.CanceledError,va.all=function(e){return Promise.all(e)},va.spread=function(e){return function(t){return e.apply(null,t)}},va.isAxiosError=function(e){return Zo.isObject(e)&&!0===e.isAxiosError},va.mergeConfig=Xi,va.AxiosHeaders=ki,va.formToJSON=e=>Si(Zo.isHTMLForm(e)?new FormData(e):e),va.getAdapter=ua.getAdapter,va.HttpStatusCode=Sa,va.default=va;const Ra=va,Ta="auth0_sub",Oa="mng-entitlements",Na="__MNG_Session",_a="regwallUserIsSubscribed";var Ia,Ca;function ka(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 La(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=Pa().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])},Da=function(){var e=xa();return".".concat(e)},Ba=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},Ma=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=xa(),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,";")})},Ha=function(){return Pa().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},Ga=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)},Fa=function(){return"complete"===document.readyState},Ka=function(){return new Promise(function(e){if(("interactive"===document.readyState||Fa())&&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)}})},ja=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,Ka();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)}}(),Wa=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,ja(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)}}(),Xa=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))})},Ja=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)}}(),Va=function(){s("Clearing entitlements...");try{Ma(Oa,{path:"/"})}catch(e){s("Failed to delete legacy cookie: ",e)}try{Ma(Oa,{path:"/",domain:xa(),expires:365,secure:!0})}catch(e){s("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(Na)}catch(e){s("Failed to remove local storage: ",e)}},Ya=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=Ya;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var qa=function(e){a.A.datadogEnabled&&window.DD_RUM.addTiming(e)},za=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:La({},i)}));case 1:return r.next=2,Wa();case 2:return u=r.sent,r.next=3,ja("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,Ja();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:La({},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:La({},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=za);var $a,Za,Qa=function(){try{var e=localStorage.getItem(Na);return"string"==typeof e?e:"{}"}catch(e){s("Unable to get session from local storage: ",e)}return"{}"},es=function(e){try{s("Setting local storage session",e),localStorage.setItem(Na,e)}catch(e){s("Unable to save session from local storage: ",e)}},ts=function(e){try{Ba(Oa,e,{path:"/",domain:Da(),expires:365,secure:!0})}catch(e){s("Unable to save session to cookie storage: ",e)}},ns=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E,g,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,Ra.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,E=null!==(c=null==f?void 0:f.entitlement_source)&&void 0!==c?c:null,g=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,es(JSON.stringify({accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:E,isEntitled:g,adFree:A,entitlementLevel:b})),""!==w&&"string"==typeof w&&ts(w),e.abrupt("return",{accessToken:p,idToken:y,entitlementToken:w,expiration:m,entitlementSource:E,isEntitled:g,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)}}(),rs=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,Ra.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)}}(),os=function(){var e=r(o.mark(function e(){var t,n,r,i,a,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v,R,T,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=Qa(),s("Session: __MNG_Session = ",d),f=JSON.parse(d),h=f.accessToken,p=f.idToken,y=f.entitlementToken,w=f.expiration,m=f.entitlementSource,E=f.isEntitled,g=f.adFree,A=f.entitlementLevel,n=h,i=w,a=m,c=E,u=g,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,ns();case 2:b=e.sent,S=b.accessToken,v=b.idToken,R=b.entitlementToken,T=b.expiration,O=b.entitlementSource,N=b.isEntitled,_=b.adFree,I=b.entitlementLevel,n=S,t=v,r=R,i=T,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)}}(),is=function(){var e=r(o.mark(function e(t){var n,r,i,a,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v,R,T,O,N,_,I,C,k,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=Qa(),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,E=r.adFree,g=void 0===E?null:E,A=r.entitlementLevel,b=void 0===A?null:A,S=t.accessToken,v=t.idToken,R=t.entitlementToken,T=t.expiration,O=t.entitlementSource,N=t.isEntitled,_=t.adFree,I=t.entitlementLevel,C={accessToken:null==S?a:S,idToken:null==v?u:v,entitlementToken:null==R?d:R,expiration:null==T?h:T,entitlementSource:null==O?y:O,isEntitled:null==N?m:N,adFree:null==_?g:_,entitlementLevel:null==I?b:I},s("Current session data: ",r),s("New session data: ",t),s("Updated session data:",C),k=JSON.stringify(C),es(k),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&ts(C.entitlementToken),n===k){e.next=1;break}return e.next=1,rs(C);case 1:e.next=3;break;case 2:e.prev=2,L=e.catch(0),s("Unable to save session: ",L);case 3:case"end":return e.stop()}},e,null,[[0,2]])}));return function(t){return e.apply(this,arguments)}}();window.addEventListener("mng-all-islands-ready",function(e){$a||($a=e,Za&&(s("utils | Dispatching mng-entitlement-check-complete event (islands were not ready): ",Za),window.dispatchEvent(Za)))});var as=function(){var e=window.localStorage.getItem(Na);return JSON.parse(e)},ss=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,os();case 1:return t=e.sent,e.abrupt("return",t);case 2:return n=as(),e.abrupt("return",n);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),cs=function(e){Ba(Oa,e,{path:"/",domain:Da(),expires:365,secure:!0})},us=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,cs(t),s("About to decode token before saving: ",t),n=Ga(t),!window.authentication_config.sessionManagementEnabled){e.next=2;break}return e.next=1,is({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(Na,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)}}(),ls=function(){var e=r(o.mark(function e(t){var n,r,i,u,l,d,f,h,p,y,w,m,E,g;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,os();case 1:"string"==typeof(r=e.sent).idToken&&""!==r.idToken&&(i=Ga(r.idToken),n=void 0!==i&&i.email_verified),e.next=4;break;case 2:return e.next=3,Xa();case 3:u=e.sent,(l=u.idToken)&&""!==l&&(n=Ga(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,us(p);case 12:return e.abrupt("return",p);case 13:if(e.prev=13,E=e.catch(6),c("Entitlements: Create Token Failure: ",E),Va(),!window.authentication_config.sessionManagementEnabled){e.next=17;break}return e.prev=14,e.next=15,is({entitlementToken:null});case 15:e.next=17;break;case 16:e.prev=16,g=e.catch(14),c("Entitlements: Save Session Failure during error handling: ",g);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)}}(),ds=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=xa(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,us(p);case 8:return e.abrupt("return",p);case 9:if(e.prev=9,y=e.catch(3),s("Entitlements: Create Token Failure: ",y),Va(),!window.authentication_config.sessionManagementEnabled){e.next=13;break}return e.prev=10,e.next=11,is({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)}}(),fs=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,ss();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",ls(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)}}(),hs=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=Ua(Oa)){e.next=1;break}return e.abrupt("return",!1);case 1:return s("checkCookiesForToken, Refreshing token, ".concat(t)),e.next=2,ls(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)}}(),ps=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=Ga(e);!function(e){var t=Ua("mng-jwt-decoded");t&&t===e||Ba("mng-jwt-decoded",JSON.stringify(e),{path:"/",domain:Da(),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"),qa("entitlementsReady"),Za=new CustomEvent("mng-entitlement-check-complete",{detail:t}),$a?(s("utils | Dispatching mng-entitlement-check-complete event (islands were ready): ",r),window.dispatchEvent(Za)):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)}},ys=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,ds({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)}}(),ws=function(){void 0!==window.MNGAuthentication&&Array.isArray(window.MNGAuthentication.oidcLoginCallbacks)&&window.MNGAuthentication.oidcLoginCallbacks.push(ys)},ms=function(e){var t=e.searchParams.get("entitlement_jwt");s("Webview JWT param provided: ",t),cs(t);var n=Ga(t);window.localStorage.setItem(Na,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}))},Es=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,t=window.localStorage.getItem(_a),n=Ua(Ta),r=Pa(),i=Ha(),!(c=Ua("clearEntCache"))&&!r.searchParams.has("newUser")){e.next=6;break}return u="".concat(a.A.entitlementsEndpoint,"session/create"),e.next=1,Xa();case 1:return l=e.sent,d={uuid:l.claims.auth0Id,publication:i},e.prev=2,e.next=3,$.ajax({type:"DELETE",url:u,headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Api-Key":a.A.entitlementsApiKey},data:JSON.stringify(d)});case 3:e.sent&&(s("loggedOutNewSubscriberActions","Entitlements: Cache cleared"),Ma("clearEntCache")),e.next=5;break;case 4:e.prev=4,m=e.catch(2),s("loggedOutNewSubscriberActions","Entitlements: Cache clear Failure - ".concat(m.message));case 5:e.next=7;break;case 6:s("loggedOutNewSubscriberActions","There is no clearEntCache cookie");case 7:if(s("loggedOutNewSubscriberActions","Checking if this is a new regwall subscriber"),!(c||"false"===t&&r.searchParams.has("newUser")&&n)){e.next=10;break}return f=!1,h={sub:n,email_verified:!0},e.next=8,ds(h);case 8:if((p=e.sent)&&""!==p&&(y=Ga(p),w=y.entitlement_entitled,f=w),s("loggedOutNewSubscriberActions","New regwall user is entitled: ".concat(f)),!f){e.next=9;break}return window.localStorage.setItem(_a,"true"),window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",!0);case 9:case 10:return e.abrupt("return",!1);case 11:return e.prev=11,E=e.catch(0),s("loggedOutNewSubscriberActions error",E),e.abrupt("return",!1);case 12:case"end":return e.stop()}},e,null,[[0,11],[2,4]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.isUserAdFree=function(){var e,t=JSON.parse(window.localStorage.getItem(Na));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(Na));return null!=e&&(s("Subscriber Check: : ",e.isEntitled),e.isEntitled)};var gs=function(){var e=r(o.mark(function e(){var t,n,r,i,c,u,l,d,f,h,p,y,w,m,E,g,A,b,S,v;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!a.A.entitlementsEnabled){e.next=39;break}return e.next=1,Es();case 1:if(!e.sent){e.next=2;break}return e.abrupt("return",ps(!1));case 2:return t=window.location,n=new URL(t.href),e.next=3,Xa();case 3:if(r=e.sent,i=r.idToken,c=r.accessToken,u=r.isAuthenticated,l=r.claims,ws(),e.prev=4,!n.searchParams.has("newUser")){e.next=8;break}if("string"!=typeof i||""===i){e.next=7;break}return e.next=5,ds({idToken:i});case 5:if(!(d=e.sent)){e.next=6;break}return s("Entitlements Init: Created new token for new subscriber"),e.abrupt("return",ps(d));case 6:e.next=8;break;case 7:s("New subscription, no idToken.");case 8:e.next=10;break;case 9:e.prev=9,e.catch(4),s("Not a new subscriber.");case 10:try{n.searchParams.has("entitlement_jwt")&&ms(n)}catch(e){s("Error during webview JWT retrieval: ",e)}return e.prev=11,e.next=12,fs();case 12:if(!((f=e.sent)instanceof Error)){e.next=13;break}throw f;case 13:f&&(d=f,s("Entitlements Init: Local Storage Token exists")),e.next=15;break;case 14:e.prev=14,g=e.catch(11),s("Error during Local Storage Token check: ",g);case 15:if(e.prev=15,d){e.next=18;break}return e.next=16,hs();case 16:if(!((h=e.sent)instanceof Error)){e.next=17;break}throw h;case 17:h&&(d=h,s("Entitlements Init: Cookie Token exists"));case 18:e.next=20;break;case 19:e.prev=19,A=e.catch(15),s("Error during Cookie Token check: ",A);case 20:if(!u&&d&&(s("Entitled-only flow: User is not authenticated but entitlement token exists."),Ga(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=21;break}return s("User is not logged in, skipping entitlement flow."),e.abrupt("return",ps(!1));case 21:if(!a.A.bcLowaSegements||u!==a.A.USER_IS_LOWA||d){e.next=25;break}return e.prev=22,s("About to check entitlements based on BC"),p={sub:l.sub},e.next=23,ds(p);case 23: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=25;break;case 24:e.prev=24,b=e.catch(22),s("BC sub segment check failed: ",b);case 25:if(e.prev=25,!d){e.next=31;break}if(!a.A.linaCheckOnArticles){e.next=30;break}if(y=Ga(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=30;break}if(s("Checking entitlements again for LINA user."),""===i){e.next=29;break}return e.next=26,ds({idToken:i});case 26:if(!(E=e.sent)){e.next=28;break}return s("Entitlements Init: Created new token for LINA user"),e.next=27,Wa();case 27:return"article"===e.sent&&window.ConnextUtils.rerunConnextEntitlements(),e.abrupt("return",ps(E));case 28:e.next=30;break;case 29:s("LINA check, no idToken.");case 30:return e.abrupt("return",ps(d));case 31:e.next=33;break;case 32:e.prev=32,S=e.catch(25),s("LINA check error: ",S);case 33:if(e.prev=33,"string"!=typeof i||""===i){e.next=36;break}return e.next=34,ds({idToken:i});case 34:if(!(d=e.sent)){e.next=35;break}return s("Entitlements Init: Created new token"),e.abrupt("return",ps(d));case 35:e.next=37;break;case 36:s("No OIDC ID Token. Not creating a new entitlements token.");case 37:e.next=39;break;case 38:e.prev=38,v=e.catch(33),s("Unable to create token during initialize: ",v);case 39:return e.abrupt("return",ps(!1));case 40:case"end":return e.stop()}},e,null,[[4,9],[11,14],[15,19],[22,24],[25,32],[33,38]])}));return function(){return e.apply(this,arguments)}}();const As={init:gs};(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,As.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||q(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 V(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:V(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 I(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return k(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),q(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 k(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<=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 A(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 R=4096;function I(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){G(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){G(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){W(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){W(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 G(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){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||F(t,e.length-(n+1))}(r,o,i)}function W(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 W(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=K(String(n)):"bigint"==typeof n&&(o=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(o=K(o)),o+="n"),r+=` It must be ${t}. Received ${o}`,r},RangeError);const X=/[^+/0-9A-Za-z-_]/g;function V(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 J(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 q(e){return e!=e}const Z=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,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}}},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:()=>qa,hasStandardBrowserEnv:()=>Qa,hasStandardBrowserWebWorkerEnv:()=>$a,navigator:()=>Za,origin:()=>es});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();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 A 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,A.prototype)}}class S extends v{constructor(){super("timeout","Timeout"),Object.setPrototypeOf(this,S.prototype)}}class T extends S{constructor(e){super(),this.popup=e,Object.setPrototypeOf(this,T.prototype)}}class k extends v{constructor(e){super("cancelled","Popup closed"),this.popup=e,Object.setPrototypeOf(this,k.prototype)}}class _ extends v{constructor(){super("popup_open","Unable to open a popup for loginWithPopup - window.open returned `null`"),Object.setPrototypeOf(this,_.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 I 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,I.prototype)}}class O 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,O.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 L=()=>window.crypto,x=()=>{const e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_~.";let t="";return Array.from(L().getRandomValues(new Uint8Array(43))).forEach(n=>t+=e[n%66]),t},P=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=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()},B=async e=>{const t=L().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,"+")),H=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 K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},G={},W={};Object.defineProperty(W,"__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}();W.default=function(){return F.getInstance()};var X=K&&K.__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())})},V=K&&K.__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 V(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 V(this,function(a){switch(a.label){case 0:return n=void 0===this.storageHandler?Y:this.storageHandler,r="browser-tabs-lock-key-"+t,null===(o=n.getItemSync(r))?[2]:(i=JSON.parse(o)).id!==this.id?[3,2]:[4,J.default().lock(i.iat)];case 1:a.sent(),this.acquiredIatSet.delete(i.iat),n.removeItemSync(r),J.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 S;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 S;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;r{const n=await fetch(e,t);return{ok:n.ok,json:await n.json(),headers:(r=n.headers,[...r].reduce((e,t)=>{let[n,r]=t;return e[n]=r,e},{}))};var r},be=async function(e,t,n,r,o,i){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1e4;return o?(async(e,t,n,r,o,i,a,s)=>((e,t)=>new 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])}))({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=new AbortController;let o;return t.signal=r.signal,Promise.race([we(e,t),new Promise((e,t)=>{o=setTimeout(()=>{r.abort(),t(new Error("Timeout when executing 'fetch'"))},n)})]).finally(()=>{clearTimeout(o)})})(e,r,a)};async function ve(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 be(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["dpop-nonce"],b&&await c.setNonce(b)),!w){const l=f||"HTTP error. Unable to fetch ".concat(e);if("mfa_required"===p)throw new R(p,l,m.mfa_token,m.mfa_requirements);if("missing_refresh_token"===p)throw new I(n,r);if("use_dpop_nonce"===p){if(!c||!b||u)throw new C(b);return ve(e,t,n,r,o,i,a,s,c,!0)}throw new v(p||"request_error",l)}return m}async function Ee(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?M(p):JSON.stringify(p),m=(y=l.grant_type,ye.includes(y));var y;return await ve("".concat(n,"/oauth/token"),r,o||"default",i,{method:"POST",body:f,headers:{"Content-Type":s?"application/x-www-form-urlencoded":"application/json","Auth0-Client":btoa(JSON.stringify(D(a||w)))}},t,s,c,m?u:void 0)}const Ae=function(){for(var e=arguments.length,t=new Array(e),n=0;nArray.from(new Set(e)))(t.filter(Boolean).join(" ").trim().split(/\s+/)).join(" ")},Se=(e,t,n)=>{let r;return n&&(r=e[n]),r||(r=e.default),Ae(r,t)};class Te{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"@@auth0spajs@@",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 Te({clientId:n,scope:o,audience:r},t)}static fromCacheEntry(e){const{scope:t,audience:n,client_id:r}=e;return new Te({scope:t,audience:n,clientId:r})}}class ke{set(e,t){localStorage.setItem(e,JSON.stringify(t))}get(e){const t=window.localStorage.getItem(e);if(t)try{return JSON.parse(t)}catch(e){return}}remove(e){localStorage.removeItem(e)}allKeys(){return Object.keys(window.localStorage).filter(e=>e.startsWith("@@auth0spajs@@"))}}class _e{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 Re{constructor(e,t,n){this.cache=e,this.keyManifest=t,this.nowProvider=n||b}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());if(!i){const t=await this.getCacheKeys();if(!t)return;const o=this.matchExistingCacheKey(e,t);if(o&&(i=await this.cache.get(o)),!i&&n&&"cache-only"!==r)return this.getEntryWithRefreshToken(e,t)}if(!i)return;const a=await this.nowProvider(),s=Math.floor(a/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 Te({clientId:e},"@@auth0spajs@@","@@user@@").toKey()}matchExistingCacheKey(e,t){return t.filter(t=>{var n;const r=Te.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"@@auth0spajs@@"===r.prefix&&r.clientId===e.clientId&&r.audience===e.audience&&a})[0]}async getEntryWithRefreshToken(e,t){var n;for(const r of t){const t=Te.fromKey(r);if("@@auth0spajs@@"===t.prefix&&t.clientId===e.clientId){const t=await this.cache.get(r);if(null===(n=null==t?void 0:t.body)||void 0===n?void 0:n.refresh_token)return this.modifiedCachedEntry(t,e)}}}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 Ie{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 Oe=e=>"number"==typeof e,Ce=["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 Ne=K&&K.__assign||function(){return Ne=Object.assign||function(e){for(var t,n=1,r=arguments.length;nMe.get(e)||Me.get("".concat("_legacy_").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),Ue("".concat("_legacy_").concat(e),JSON.stringify(t),r),Me.save(e,t,n)},remove(e,t){let n={};(null==t?void 0:t.cookieDomain)&&(n.domain=t.cookieDomain),De(e,n),Me.remove(e,t),Me.remove("".concat("_legacy_").concat(e),t)}},je={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 He;!function(e){e.Code="code",e.ConnectCode="connect_code"}(He||(He={}));var Ke,Ge=function(e){return Ke=Ke||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;o(new _e).enclosedCache,localstorage:()=>new ke},Ve=e=>Xe[e],ze=e=>{const{openUrl:t,onRedirect:n}=e,r=g(e,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:!1===t||t?t:n})},Je=(e,t)=>{const n=(null==t?void 0:t.split(" "))||[];return((null==e?void 0:e.split(" "))||[]).every(e=>n.includes(e))},Ye={NONCE:"nonce",KEYPAIR:"keypair"};class qe{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(Ye).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(Ye.NONCE,this.buildKey(t),e)}setKeyPair(e){return this.save(Ye.KEYPAIR,this.buildKey(),e)}async save(e,t,n){await this.executeDbRequest(e,"readwrite",e=>e.put(n,t))}findNonce(e){return this.find(Ye.NONCE,this.buildKey(e))}findKeyPair(){return this.find(Ye.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(Ye.NONCE,this.clientId)}clearKeyPairs(){return this.deleteByClientId(Ye.KEYPAIR,this.clientId)}}class Ze{constructor(e){this.storage=new qe(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 ge(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 Qe;!function(e){e.Bearer="Bearer",e.DPoP="DPoP"}(Qe||(Qe={}));class $e{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]:Qe.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?Qe.DPoP:Qe.Bearer,o=n):(r=n.token_type,o=n.access_token),this.setAuthorizationHeader(e,o,r),r===Qe.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,"dpop-nonce");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 et{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 tt({type:"invalid_json",status:e.status,title:"Invalid JSON response",detail:t||String(n)})}if(e.ok)return t;throw new tt(t)}}class tt 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,tt.prototype)}}const nt={otp:{authenticatorTypes:["otp"]},sms:{authenticatorTypes:["oob"],oobChannels:["sms"]},email:{authenticatorTypes:["oob"],oobChannels:["email"]},push:{authenticatorTypes:["oob"],oobChannels:["auth0"]},voice:{authenticatorTypes:["oob"],oobChannels:["voice"]}};function rt(e,t){this.v=e,this.k=t}function ot(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 it(e){return new rt(e,0)}function at(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function st(e,t){return e.get(ot(e,t))}function ct(e,t,n){at(e,t),t.set(e,n)}function ut(e,t,n){return e.set(ot(e,t),n),n}function lt(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 dt(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 ht(e){for(var t=1;t(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e.toBase64({alphabet:"base64url",omitPadding:!0}));else{const e=32768;Ot=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 bt("The input to be decoded is not correctly encoded.","ERR_INVALID_ARG_VALUE",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 bt("".concat(n," must be a non-negative number"),"ERR_INVALID_ARG_VALUE",o);return}throw bt("".concat(n," must be a positive number"),"ERR_INVALID_ARG_VALUE",o)}catch(e){if(r)throw Pt(e.message,r,o);throw e}}function Ht(e,t,n,r){try{if("string"!=typeof e)throw bt("".concat(t," must be a string"),"ERR_INVALID_ARG_TYPE",r);if(0===e.length)throw bt("".concat(t," must not be empty"),"ERR_INVALID_ARG_VALUE",r)}catch(e){if(n)throw Pt(e.message,n,r);throw e}}function Kt(e){!function(e,t){if(dn(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 Pt(t,Ln,e)}(e,t)}(e,"application/json")}function Gt(){return Nt(crypto.getRandomValues(new Uint8Array(32)))}function Wt(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 Lt("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 Lt("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 Lt("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 Lt("unsupported CryptoKey algorithm name",{cause:e})}}function Ft(e){const t=null==e?void 0:e[Et];return"number"==typeof t&&Number.isFinite(t)?t:0}function Xt(e){const t=null==e?void 0:e[At];return"number"==typeof t&&Number.isFinite(t)&&-1!==Math.sign(t)?t:30}function Vt(){return Math.floor(Date.now()/1e3)}function zt(e){if("object"!=typeof e||null===e)throw bt('"as" must be an object',"ERR_INVALID_ARG_TYPE");Ht(e.issuer,'"as.issuer"')}function Jt(e){if("object"!=typeof e||null===e)throw bt('"client" must be an object',"ERR_INVALID_ARG_TYPE");Ht(e.client_id,'"client.client_id"')}function Yt(e){return Ht(e,'"clientSecret"'),(t,n,r,o)=>{r.set("client_id",n.client_id),r.set("client_secret",e)}}function qt(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&&Ht(o.kid,'"kid"'),{key:o.key,kid:o.kid}):{};var o;return function(e,t){if(function(e,t){if(!(e instanceof CryptoKey))throw bt("".concat(t," must be a CryptoKey"),"ERR_INVALID_ARG_TYPE")}(e,t),"private"!==e.type)throw bt("".concat(t," must be a private CryptoKey"),"ERR_INVALID_ARG_VALUE")}(n,'"clientPrivateKey.key"'),async(e,o,i,a)=>{var s;const c={alg:Wt(n),kid:r},u=function(e,t){const n=Vt()+Ft(t);return{jti:Gt(),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[Tt])||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 bt('CryptoKey instances used for signing assertions must include "sign" in their "usages"',"ERR_INVALID_ARG_VALUE");const r="".concat(Nt(It(JSON.stringify(e))),".").concat(Nt(It(JSON.stringify(t)))),o=Nt(await crypto.subtle.sign(function(e){switch(e.algorithm.name){case"ECDSA":return{name:e.algorithm.name,hash:Wn(e)};case"RSA-PSS":switch(Gn(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 Lt("unsupported RSA-PSS hash name",{cause:e})}case"RSASSA-PKCS1-v1_5":return Gn(e),e.algorithm.name;case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":case"Ed25519":return e.algorithm.name}throw new Lt("unsupported CryptoKey algorithm name",{cause:e})}(n),n,It(r)));return"".concat(r,".").concat(o)}(c,u,n))}}const Zt=URL.parse?(e,t)=>URL.parse(e,t):(e,t)=>{try{return new URL(e,t)}catch(e){return null}};function Qt(e,t){if(t&&"https:"!==e.protocol)throw Pt("only requests to HTTPS are allowed",Pn,e);if("https:"!==e.protocol&&"http:"!==e.protocol)throw Pt("only HTTP and HTTPS requests are allowed",Un,e)}function $t(e,t,n,r){let o;if("string"!=typeof e||!(o=Zt(e)))throw Pt("authorization server metadata does not contain a valid ".concat(n?'"as.mtls_endpoint_aliases.'.concat(t,'"'):'"as.'.concat(t,'"')),void 0===e?jn:Hn,{attribute:n?"mtls_endpoint_aliases.".concat(t):t});return Qt(o,r),o}function en(e,t,n,r){return n&&e.mtls_endpoint_aliases&&t in e.mtls_endpoint_aliases?$t(e.mtls_endpoint_aliases[t],t,n,r):$t(e[t],t,n,r)}class tn extends Error{constructor(e,t){var n;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"error",void 0),lt(this,"status",void 0),lt(this,"error_description",void 0),lt(this,"response",void 0),this.name=this.constructor.name,this.code=Rn,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 nn extends Error{constructor(e,t){var n,r;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"error",void 0),lt(this,"error_description",void 0),this.name=this.constructor.name,this.code=On,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 rn extends Error{constructor(e,t){var n;super(e,t),lt(this,"cause",void 0),lt(this,"code",void 0),lt(this,"response",void 0),lt(this,"status",void 0),this.name=this.constructor.name,this.code=_n,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 on=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)"),an=new RegExp('^[,\\s]*([a-zA-Z0-9!#$%&\\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*"((?:[^"\\\\]|\\\\[\\s\\S])*)"[,\\s]*(.*)'),sn=new RegExp("^[,\\s]*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)\\s*=\\s*([a-zA-Z0-9!#$%&\\'\\*\\+\\-\\.\\^_`\\|~]+)[,\\s]*(.*)"),cn=new RegExp("^([a-zA-Z0-9\\-\\._\\~\\+\\/]+={0,2})(?:$|[,\\s])(.*)");async function un(e,t,n){if(e.status!==t){let t;var r;if(function(e){let t;if(t=function(e){if(!wt(e,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");const t=e.headers.get("www-authenticate");if(null===t)return;const n=[];let r=t;for(;r;){var o;let t=r.match(on);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(an)){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(cn)){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 rn("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){Kn(e),Kt(e);try{const t=await e.clone().json();if(Ut(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 tn("server responded with an error in the response body",{cause:t,response:e});throw Pt('"response" is not a conform '.concat(n," response (unexpected HTTP status code)"),xn,e)}}function ln(e){if(!vn.has(e))throw bt('"options.DPoP" is not a valid DPoPHandle',"ERR_INVALID_ARG_VALUE")}function dn(e){var t;return null===(t=e.headers.get("content-type"))||void 0===t?void 0:t.split(";")[0]}async function hn(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[St])||fetch)(r.href,{body:o,headers:Object.fromEntries(i.entries()),method:"POST",redirect:"manual",signal:Mt(r,null==a?void 0:a.signal)})}async function pn(e,t,n,r,o,i){var a;const s=en(e,"token_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==i?void 0:i[vt]));o.set("grant_type",r);const c=Dt(null==i?void 0:i.headers);c.set("accept","application/json"),void 0!==(null==i?void 0:i.DPoP)&&(ln(i.DPoP),await i.DPoP.addProof(s,c,"POST"));const u=await hn(e,t,n,s,o,c,i);return null==i||null===(a=i.DPoP)||void 0===a||a.cacheNonce(u,s),u}const fn=new WeakMap,mn=new WeakMap;function gn(e){if(!e.id_token)return;const t=fn.get(e);if(!t)throw bt('"ref" was already garbage collected or did not resolve from the proper sources',"ERR_INVALID_ARG_VALUE");return t}async function yn(e,t,n,r,o,i){if(zt(e),Jt(t),!wt(n,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await un(n,200,"Token Endpoint"),Kn(n);const a=await Jn(n);if(Ht(a.access_token,'"response" body "access_token" property',Nn,{body:a}),Ht(a.token_type,'"response" body "token_type" property',Nn,{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;jt(e,!0,'"response" body "expires_in" property',Nn,{body:a}),a.expires_in=e}if(void 0!==a.refresh_token&&Ht(a.refresh_token,'"response" body "refresh_token" property',Nn,{body:a}),void 0!==a.scope&&"string"!=typeof a.scope)throw Pt('"response" body "scope" property must be a string',Nn,{body:a});if(void 0!==a.id_token){Ht(a.id_token,'"response" body "id_token" property',Nn,{body:a});const i=["aud","exp","iat","iss","sub"];!0===t.require_auth_time&&i.push("auth_time"),void 0!==t.default_max_age&&(jt(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 Lt("JWE decryption is not configured",{cause:e});e=await o(e),({0:s,1:c,length:u}=e.split("."))}if(3!==u)throw Pt("Invalid JWT",Nn,e);try{i=JSON.parse(It(Nt(s)))}catch(e){throw Pt("failed to parse JWT Header body as base64url encoded JSON",Cn,e)}if(!Ut(i))throw Pt("JWT Header must be a top level object",Nn,e);if(t(i),void 0!==i.crit)throw new Lt('no JWT "crit" header parameter extensions are supported',{cause:{header:i}});try{a=JSON.parse(It(Nt(c)))}catch(e){throw Pt("failed to parse JWT Payload body as base64url encoded JSON",Cn,e)}if(!Ut(a))throw Pt("JWT Payload must be a top level object",Nn,e);const l=Vt()+n;if(void 0!==a.exp){if("number"!=typeof a.exp)throw Pt('unexpected JWT "exp" (expiration time) claim type',Nn,{claims:a});if(a.exp<=l-r)throw Pt('unexpected JWT "exp" (expiration time) claim value, expiration is past current timestamp',Dn,{claims:a,now:l,tolerance:r,claim:"exp"})}if(void 0!==a.iat&&"number"!=typeof a.iat)throw Pt('unexpected JWT "iat" (issued at) claim type',Nn,{claims:a});if(void 0!==a.iss&&"string"!=typeof a.iss)throw Pt('unexpected JWT "iss" (issuer) claim type',Nn,{claims:a});if(void 0!==a.nbf){if("number"!=typeof a.nbf)throw Pt('unexpected JWT "nbf" (not before) claim type',Nn,{claims:a});if(a.nbf>l+r)throw Pt('unexpected JWT "nbf" (not before) claim value',Dn,{claims:a,now:l,tolerance:r,claim:"nbf"})}if(void 0!==a.aud&&"string"!=typeof a.aud&&!Array.isArray(a.aud))throw Pt('unexpected JWT "aud" (audience) claim type',Nn,{claims:a});return{header:i,claims:a,jwt:e}}(a.id_token,Fn.bind(void 0,t.id_token_signed_response_alg,e.id_token_signing_alg_values_supported,"RS256"),Ft(t),Xt(t),o).then(Sn.bind(void 0,i)).then(bn.bind(void 0,e)).then(wn.bind(void 0,t.client_id));if(Array.isArray(s.aud)&&1!==s.aud.length){if(void 0===s.azp)throw Pt('ID Token "aud" (audience) claim includes additional untrusted audiences',Mn,{claims:s,claim:"aud"});if(s.azp!==t.client_id)throw Pt('unexpected ID Token "azp" (authorized party) claim value',Mn,{expected:t.client_id,claims:s,claim:"azp"})}void 0!==s.auth_time&&jt(s.auth_time,!0,'ID Token "auth_time" (authentication time)',Nn,{claims:s}),mn.set(n,c),fn.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 Lt("unsupported `token_type` value",{cause:{body:a}});return a}function wn(e,t){if(Array.isArray(t.claims.aud)){if(!t.claims.aud.includes(e))throw Pt('unexpected JWT "aud" (audience) claim value',Mn,{expected:e,claims:t.claims,claim:"aud"})}else if(t.claims.aud!==e)throw Pt('unexpected JWT "aud" (audience) claim value',Mn,{expected:e,claims:t.claims,claim:"aud"});return t}function bn(e,t){var n,r;const o=null!==(n=null===(r=e[qn])||void 0===r?void 0:r.call(e,t))&&void 0!==n?n:e.issuer;if(t.claims.iss!==o)throw Pt('unexpected JWT "iss" (issuer) claim value',Mn,{expected:o,claims:t.claims,claim:"iss"});return t}const vn=new WeakSet,En=Symbol(),An={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 Sn(e,t){for(const n of e)if(void 0===t.claims[n])throw Pt('JWT "'.concat(n,'" (').concat(An[n],") claim missing"),Nn,{claims:t.claims});return t}const Tn=Symbol(),kn=Symbol();const _n="OAUTH_WWW_AUTHENTICATE_CHALLENGE",Rn="OAUTH_RESPONSE_BODY_ERROR",In="OAUTH_UNSUPPORTED_OPERATION",On="OAUTH_AUTHORIZATION_RESPONSE_ERROR",Cn="OAUTH_PARSE_ERROR",Nn="OAUTH_INVALID_RESPONSE",Ln="OAUTH_RESPONSE_IS_NOT_JSON",xn="OAUTH_RESPONSE_IS_NOT_CONFORM",Pn="OAUTH_HTTP_REQUEST_FORBIDDEN",Un="OAUTH_REQUEST_PROTOCOL_FORBIDDEN",Dn="OAUTH_JWT_TIMESTAMP_CHECK_FAILED",Mn="OAUTH_JWT_CLAIM_COMPARISON_FAILED",Bn="OAUTH_JSON_ATTRIBUTE_COMPARISON_FAILED",jn="OAUTH_MISSING_SERVER_METADATA",Hn="OAUTH_INVALID_SERVER_METADATA";function Kn(e){if(e.bodyUsed)throw bt('"response" body has been used already',"ERR_INVALID_ARG_VALUE")}function Gn(e){const{algorithm:t}=e;if("number"!=typeof t.modulusLength||t.modulusLength<2048)throw new Lt("unsupported ".concat(t.name," modulusLength"),{cause:e})}function Wn(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 Lt("unsupported ECDSA namedCurve",{cause:e})}}function Fn(e,t,n,r){if(void 0===e)if(Array.isArray(t)){if(!t.includes(r.alg))throw Pt('unexpected JWT "alg" header parameter',Nn,{header:r,expected:t,reason:"authorization server metadata"})}else{if(void 0===n)throw Pt('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 Pt('unexpected JWT "alg" header parameter',Nn,{header:r,expected:n,reason:"default value"})}else if("string"==typeof e?r.alg!==e:!e.includes(r.alg))throw Pt('unexpected JWT "alg" header parameter',Nn,{header:r,expected:e,reason:"client configuration"})}function Xn(e,t){const{0:n,length:r}=e.getAll(t);if(r>1)throw Pt('"'.concat(t,'" parameter must be provided only once'),Nn);return n}const Vn=Symbol(),zn=Symbol();async function Jn(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kt;try{t=await e.json()}catch(t){throw n(e),Pt('failed to parse "response" body as JSON',Cn,t)}if(!Ut(t))throw Pt('"response" body must be a top level object',Nn,{body:t});return t}const Yn=Symbol(),qn=Symbol(),Zn=new TextEncoder,Qn=new TextDecoder;function $n(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 er(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let e=0;e2&&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}}),lt(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),lt(this,"claim",void 0),lt(this,"reason",void 0),lt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}lt(rr,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class or extends nr{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}}),lt(this,"code","ERR_JWT_EXPIRED"),lt(this,"claim",void 0),lt(this,"reason",void 0),lt(this,"payload",void 0),this.claim=n,this.reason=r,this.payload=t}}lt(or,"code","ERR_JWT_EXPIRED");class ir extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}lt(ir,"code","ERR_JOSE_ALG_NOT_ALLOWED");class ar extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JOSE_NOT_SUPPORTED")}}lt(ar,"code","ERR_JOSE_NOT_SUPPORTED"),lt(class extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),lt(class extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID");class sr extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWS_INVALID")}}lt(sr,"code","ERR_JWS_INVALID");class cr extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWT_INVALID")}}lt(cr,"code","ERR_JWT_INVALID"),lt(class extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID");class ur extends nr{constructor(){super(...arguments),lt(this,"code","ERR_JWKS_INVALID")}}lt(ur,"code","ERR_JWKS_INVALID");class lr extends nr{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),lt(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}lt(lr,"code","ERR_JWKS_NO_MATCHING_KEY");class dr extends nr{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),lt(this,Symbol.asyncIterator,void 0),lt(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}lt(dr,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class hr extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWKS_TIMEOUT")}}lt(hr,"code","ERR_JWKS_TIMEOUT");class pr extends nr{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),lt(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}lt(pr,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const fr=function(e){return new TypeError("CryptoKey does not support this operation, its ".concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"algorithm.name"," must be ").concat(e))},mr=(e,t)=>e.name===t;function gr(e){return parseInt(e.name.slice(4),10)}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;o{if("CryptoKey"===(null==e?void 0:e[Symbol.toStringTag]))return!0;try{return e instanceof CryptoKey}catch(e){return!1}},vr=e=>"KeyObject"===(null==e?void 0:e[Symbol.toStringTag]),Er=e=>br(e)||vr(e);function Ar(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 Sr=(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)},_r=(e,t)=>{const n=e.data.subarray(e.pos,e.pos+t);return e.pos+=t,n},Rr=(e,t,n)=>{var r;const o=(e=>er(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){kr(e,48,"Invalid PKCS#8 structure"),Tr(e),kr(e,2,"Expected version field");const t=Tr(e);e.pos+=t,kr(e,48,"Expected algorithm identifier");Tr(e);e.pos}(t),(e=>{const t=(e=>{kr(e,6,"Expected algorithm OID");const t=Tr(e);return _r(e,t)})(e);if(Sr(t,[43,101,110]))return"X25519";if(!Sr(t,[42,134,72,206,61,2,1]))throw new Error("Unsupported key algorithm");kr(e,6,"Expected curve OID");const n=Tr(e),r=_r(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(Sr(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 ar("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 ar('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)};async function Ir(e){var t,n;if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:r,keyUsages:o}=function(e){let t,n;switch(e.kty){case"AKP":switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},n=e.priv?["sign"]:["verify"];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:"SHA-".concat(e.alg.slice(-3))},n=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:"SHA-".concat(parseInt(e.alg.slice(-3),10)||1)},n=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(e.alg){case"ES256":t={name:"ECDSA",namedCurve:"P-256"},n=e.d?["sign"]:["verify"];break;case"ES384":t={name:"ECDSA",namedCurve:"P-384"},n=e.d?["sign"]:["verify"];break;case"ES512":t={name:"ECDSA",namedCurve:"P-521"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"OKP":switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},n=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},n=e.d?["deriveBits"]:[];break;default:throw new ar('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;default:throw new ar('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:n}}(e),i=ht({},e);return"AKP"!==i.kty&&delete i.alg,delete i.use,crypto.subtle.importKey("jwk",i,r,null!==(t=e.ext)&&void 0!==t?t:!e.d&&!e.priv,null!==(n=e.key_ops)&&void 0!==n?n:o)}const Or=e=>Ar(e)&&"string"==typeof e.kty;let Cr;const Nr=async function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Cr||(Cr=new WeakMap);let o=Cr.get(e);if(null!=o&&o[n])return o[n];const i=await Ir(ht(ht({},t),{},{alg:n}));return r&&Object.freeze(e),o?o[n]=i:Cr.set(e,{[n]:i}),i};const Lr=e=>null==e?void 0:e[Symbol.toStringTag],xr=(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 Pr,Ur;let Dr,Mr;if("undefined"==typeof navigator||null===(Pr=navigator.userAgent)||void 0===Pr||null===(Ur=Pr.startsWith)||void 0===Ur||!Ur.call(Pr,"Mozilla/5.0 ")){const e="v6.8.1";Mr="".concat("openid-client","/").concat(e),Dr={"user-agent":Mr}}const Br=e=>jr.get(e);let jr,Hr;function Kr(e){return void 0!==e?Yt(e):(Hr||(Hr=new WeakMap),(e,t,n,r)=>{let o;return(o=Hr.get(t))||(function(e,t){if("string"!=typeof e)throw Xr("".concat(t," must be a string"),Fr);if(0===e.length)throw Xr("".concat(t," must not be empty"),Wr)}(t.client_secret,'"metadata.client_secret"'),o=Yt(t.client_secret),Hr.set(t,o)),o(e,t,n,r)})}const Gr=St,Wr="ERR_INVALID_ARG_VALUE",Fr="ERR_INVALID_ARG_TYPE";function Xr(e,t,n){const r=new TypeError(e,{cause:n});return Object.assign(r,{code:t}),r}class Vr extends Error{constructor(e,t){var n;super(e,t),lt(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 zr(e,t,n){return new Vr(e,{cause:t,code:n})}function Jr(e){if(e instanceof TypeError||e instanceof Vr||e instanceof tn||e instanceof nn||e instanceof rn)throw e;if(e instanceof xt)switch(e.code){case Pn:throw zr("only requests to HTTPS are allowed",e,e.code);case Un:throw zr("only requests to HTTP or HTTPS are allowed",e,e.code);case xn:throw zr("unexpected HTTP response status code",e.cause,e.code);case Ln:throw zr("unexpected response content-type",e.cause,e.code);case Cn:throw zr("parsing error occured",e,e.code);case Nn:throw zr("invalid response encountered",e,e.code);case Mn:throw zr("unexpected JWT claim value encountered",e,e.code);case Bn:throw zr("unexpected JSON attribute value encountered",e,e.code);case Dn:throw zr("JWT timestamp claim value failed validation",e,e.code);default:throw zr(e.message,e,e.code)}if(e instanceof Lt)throw zr("unsupported operation",e,e.code);if(e instanceof DOMException)switch(e.name){case"OperationError":throw zr("runtime operation error",e,In);case"NotSupportedError":throw zr("runtime unsupported operation",e,In);case"TimeoutError":throw zr("operation timed out",e,"OAUTH_TIMEOUT");case"AbortError":throw zr("operation aborted",e,"OAUTH_ABORT")}throw new Vr("something went wrong",{cause:e})}async function Yr(e,t,n,r,o){const i=await async function(e,t){var n,r;if(!(e instanceof URL))throw Xr('"server" must be an instance of URL',Fr);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 bt('"'.concat("issuerIdentifier",'" must be an instance of URL'),"ERR_INVALID_ARG_TYPE");Qt(e,!0!==(null==r?void 0:r[vt]));const o=n(new URL(e.href)),i=Dt(null==r?void 0:r.headers);return i.set("accept","application/json"),((null==r?void 0:r[St])||fetch)(o.href,{body:void 0,headers:Object.fromEntries(i.entries()),method:"GET",redirect:"manual",signal:Mt(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=Bt("".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=Bt("".concat(t,"/").concat(n?e.pathname:e.pathname.replace(/(\/)$/,"")))}(e,".well-known/oauth-authorization-server");break;default:throw bt('"options.algorithm" must be "oidc" (default), or "oauth2"',"ERR_INVALID_ARG_VALUE")}return e},t)}(e,{algorithm:null==t?void 0:t.algorithm,[St]:null==t?void 0:t[Gr],[vt]:null==t||null===(r=t.execute)||void 0===r?void 0:r.includes(ro),signal:a,headers:new Headers(Dr)}):((null==t?void 0:t[Gr])||fetch)((Qt(e,null==t||null===(c=t.execute)||void 0===c||!c.includes(ro)),e.href),{headers:Object.fromEntries(new Headers(ht({accept:"application/json"},Dr)).entries()),body:void 0,method:"GET",redirect:"manual",signal:a})).then(e=>async function(e,t){const n=e;if(!(n instanceof URL)&&n!==Yn)throw bt('"expectedIssuerIdentifier" must be an instance of URL',"ERR_INVALID_ARG_TYPE");if(!wt(t,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");if(200!==t.status)throw Pt('"response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)',xn,t);Kn(t);const r=await Jn(t);if(Ht(r.issuer,'"response" body "issuer" property',Nn,{body:r}),n!==Yn&&new URL(r.issuer).href!==n.href)throw Pt('"response" body "issuer" property does not match the expected value',Bn,{expected:n.href,body:r,attribute:"issuer"});return r}(Yn,e)).catch(Jr);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[qr]=!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 Vr("discovered metadata issuer does not match the expected issuer",{code:Bn,cause:{expected:e.href,body:s,attribute:"issuer"}})})()),s}(e,o),a=new Zr(i,t,n,r);let s=Br(a);if(null!=o&&o[Gr]&&(s.fetch=o[Gr]),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 qr=Symbol();class Zr{constructor(e,t,n,r){var o,i,a,s,c;if("string"!=typeof t||!t.length)throw Xr('"clientId" must be a non-empty string',Fr);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 Xr('"clientId" and "metadata.client_id" must be the same',Wr);const u=ht(ht({},structuredClone(n)),{},{client_id:t});let l;u[Et]=null!==(i=null===(a=n)||void 0===a?void 0:a[Et])&&void 0!==i?i:0,u[At]=null!==(s=null===(c=n)||void 0===c?void 0:c[At])&&void 0!==s?s:30,l=r||("string"==typeof u.client_secret&&u.client_secret.length?Kr(u.client_secret):(e,t,n,r)=>{n.set("client_id",t.client_id)});let d=Object.freeze(u);const h=structuredClone(e);qr in e&&(h[qn]=t=>{let{claims:{tid:n}}=t;return e.issuer.replace("{tenantid}",n)});let p=Object.freeze(h);jr||(jr=new WeakMap),jr.set(this,{__proto__:null,as:p,c:d,auth:l,tlsOnly:!0,jwksCache:{}})}serverMetadata(){const e=structuredClone(Br(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(Br(this).c)}get timeout(){return Br(this).timeout}set timeout(e){Br(this).timeout=e}get[Gr](){return Br(this).fetch}set[Gr](e){Br(this).fetch=e}}function Qr(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 gn(this)}catch(e){return}}}}}(e))}async function $r(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 eo(a-t,n)}function eo(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 to(e,t){uo(e);const{as:n,c:r,auth:o,fetch:i,tlsOnly:a,timeout:s}=Br(e);return async function(e,t,n,r,o){zt(e),Jt(t);const i=en(e,"backchannel_authentication_endpoint",t.use_mtls_endpoint_aliases,!0!==(null==o?void 0:o[vt])),a=new URLSearchParams(r);a.set("client_id",t.client_id);const s=Dt(null==o?void 0:o.headers);return s.set("accept","application/json"),hn(e,t,n,i,a,s,o)}(n,r,o,t,{[St]:i,[vt]:!a,headers:new Headers(Dr),signal:lo(s)}).then(e=>async function(e,t,n){if(zt(e),Jt(t),!wt(n,Response))throw bt('"response" must be an instance of Response',"ERR_INVALID_ARG_TYPE");await un(n,200,"Backchannel Authentication Endpoint"),Kn(n);const r=await Jn(n);Ht(r.auth_req_id,'"response" body "auth_req_id" property',Nn,{body:r});let o="number"!=typeof r.expires_in?parseFloat(r.expires_in):r.expires_in;return jt(o,!0,'"response" body "expires_in" property',Nn,{body:r}),r.expires_in=o,void 0!==r.interval&&jt(r.interval,!1,'"response" body "interval" property',Nn,{body:r}),r}(n,r,e)).catch(Jr)}async function no(e,t,n,r){var o,i;uo(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 eo(a,s)}catch(e){Jr(e)}const{as:c,c:u,auth:l,fetch:d,tlsOnly:h,nonRepudiation:p,timeout:f,decrypt:m}=Br(e),g=(o,i)=>no(e,ht(ht({},t),{},{interval:o}),n,ht(ht({},r),{},{signal:s,flag:i})),y=await async function(e,t,n,r,o){zt(e),Jt(t),Ht(r,'"authReqId"');const i=new URLSearchParams(null==o?void 0:o.additionalParameters);return i.set("auth_req_id",r),pn(e,t,n,"urn:openid:params:grant-type:ciba",i,o)}(c,u,l,t.auth_req_id,{[St]:d,[vt]:!h,additionalParameters:n,DPoP:null==r?void 0:r.DPoP,headers:new Headers(Dr),signal:s.aborted?s:lo(f)}).catch(Jr);var w;if(503===y.status&&y.headers.has("retry-after"))return await $r(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 yn(e,t,n,void 0,null==r?void 0:r[kt],null==r?void 0:r.recognizedTokenTypes)}(c,u,y,{[kt]:m});let v;try{v=await b}catch(e){if(ho(e,r))return g(a,po);if(e instanceof tn)switch(e.error){case"slow_down":a+=5;case"authorization_pending":return await $r(e.response,a,s),g(a)}Jr(e)}return v.id_token&&await(null==p?void 0:p(y)),Qr(v),v}function ro(e){Br(e).tlsOnly=!1}async function oo(e,t,n,r,o){if(uo(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 Xr('"currentUrl" must be an instance of URL, or Request',Fr);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}=Br(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 bt("form_post responses are expected to use the POST method","ERR_INVALID_ARG_VALUE",{cause:e});if("application/x-www-form-urlencoded"!==dn(e))throw bt("form_post responses are expected to use the application/x-www-form-urlencoded content-type","ERR_INVALID_ARG_VALUE",{cause:e});return async function(e){if(e.bodyUsed)throw bt("form_post Request instances must contain a readable body","ERR_INVALID_ARG_VALUE",{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 Xr("unexpected Request HTTP method",Wr)}}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(zt(e),Jt(t),n instanceof URL&&(n=n.searchParams),!(n instanceof URLSearchParams))throw bt('"parameters" must be an instance of URLSearchParams, or URL',"ERR_INVALID_ARG_TYPE");if(Xn(n,"response"))throw Pt('"parameters" contains a JARM response, use validateJwtAuthResponse() instead of validateAuthResponse()',Nn,{parameters:n});const o=Xn(n,"iss"),i=Xn(n,"state");if(!o&&e.authorization_response_iss_parameter_supported)throw Pt('response parameter "iss" (issuer) missing',Nn,{parameters:n});if(o&&o!==e.issuer)throw Pt('unexpected "iss" (issuer) response parameter value',Nn,{expected:e.issuer,parameters:n});switch(r){case void 0:case zn:if(void 0!==i)throw Pt('unexpected "state" response parameter encountered',Nn,{expected:void 0,parameters:n});break;case Vn:break;default:if(Ht(r,'"expectedState" argument'),i!==r)throw Pt(void 0===i?'response parameter "state" missing':'unexpected "state" response parameter value',Nn,{expected:r,parameters:n})}if(Xn(n,"error"))throw new nn("authorization response from the server is an error",{cause:n});const a=Xn(n,"id_token"),s=Xn(n,"token");if(void 0!==a||void 0!==s)throw new Lt("implicit and hybrid flows are not supported");return c=new URLSearchParams(n),vn.add(c),c;var c}(s,c,t.searchParams,null==n?void 0:n.expectedState)}catch(e){Jr(e)}}}const w=await async function(e,t,n,r,o,i,a){if(zt(e),Jt(t),!vn.has(r))throw bt('"callbackParameters" must be an instance of URLSearchParams obtained from "validateAuthResponse()", or "validateJwtAuthResponse()',"ERR_INVALID_ARG_VALUE");Ht(o,'"redirectUri"');const s=Xn(r,"code");if(!s)throw Pt('no authorization code in "callbackParameters"',Nn);const c=new URLSearchParams(null==a?void 0:a.additionalParameters);return c.set("redirect_uri",o),c.set("code",s),i!==En&&(Ht(i,'"codeVerifier"'),c.set("code_verifier",i)),pn(e,t,n,"authorization_code",c,a)}(s,c,u,i,a,(null==n?void 0:n.pkceCodeVerifier)||En,{additionalParameters:r,[St]:l,[vt]:!d,DPoP:null==o?void 0:o.DPoP,headers:new Headers(Dr),signal:lo(m)}).catch(Jr);"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=Tn;break;case Tn:break;default:Ht(r,'"expectedNonce" argument'),s.push("nonce")}switch(null!=o||(o=t.default_max_age),o){case void 0:o=kn;break;case kn:break;default:jt(o,!0,'"maxAge" argument'),s.push("auth_time")}const c=await yn(e,t,n,s,i,a);Ht(c.id_token,'"response" body "id_token" property',Nn,{body:c});const u=gn(c);if(o!==kn){const e=Vt()+Ft(t),n=Xt(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 yn(e,t,n,void 0,null==r?void 0:r[kt],null==r?void 0:r.recognizedTokenTypes)}(o,i,e,{[kt]:l,recognizedTokenTypes:n})}).catch(Jr);return Qr(d),d}async function mo(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;r"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 ar('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)}(sr,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 sr('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:s}=o;if("string"!=typeof s||!s)throw new sr('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 ir('"alg" (Algorithm) Header Parameter value not allowed');if(a){if("string"!=typeof e.payload)throw new sr("JWS Payload must be a string")}else if("string"!=typeof e.payload&&!(e.payload instanceof Uint8Array))throw new sr("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(Or(t)){if((e=>"oct"===e.kty&&"string"==typeof e.k)(t)&&xr(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(!Er(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if("secret"!==t.type)throw new TypeError("".concat(Lr(t),' instances for symmetric algorithms must be of type "secret"'))}})(e,t,n);break;default:((e,t,n)=>{if(Or(t))switch(n){case"decrypt":case"sign":if((e=>"oct"!==e.kty&&("AKP"===e.kty&&"string"==typeof e.priv||"string"==typeof e.d))(t)&&xr(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)&&xr(e,t,n))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!Er(t))throw new TypeError(wr(e,t,"CryptoKey","KeyObject","JSON Web Key"));if("secret"===t.type)throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithms must not be of type "secret"'));if("public"===t.type)switch(n){case"sign":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm signing must be of type "private"'));case"decrypt":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm decryption must be of type "private"'))}if("private"===t.type)switch(n){case"verify":throw new TypeError("".concat(Lr(t),' instances for asymmetric algorithm verifying must be of type "public"'));case"encrypt":throw new TypeError("".concat(Lr(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?$n(e.protected):new Uint8Array,$n("."),"string"==typeof e.payload?a?$n(e.payload):Zn.encode(e.payload):e.payload);let d;try{d=tr(e.signature)}catch(e){throw new sr("Failed to base64url decode the signature")}const h=await async function(e,t){if(e instanceof Uint8Array)return e;if(br(e))return e;if(vr(e)){if("secret"===e.type)return e.export();if("toCryptoKey"in e&&"function"==typeof e.toCryptoKey)try{return((e,t)=>{Cr||(Cr=new WeakMap);let n=Cr.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("given KeyObject instance cannot be used for this algorithm")}i=e.toCryptoKey(e.asymmetricKeyType,o,r?[]:["deriveBits"])}if("ed25519"===e.asymmetricKeyType){if("EdDSA"!==t&&"Ed25519"!==t)throw new TypeError("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm");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("given KeyObject instance cannot be used for this algorithm")}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("given KeyObject instance cannot be used for this algorithm");"ES256"===t&&"P-256"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES384"===t&&"P-384"===n&&(i=e.toCryptoKey({name:"ECDSA",namedCurve:n},o,[r?"verify":"sign"])),"ES512"===t&&"P-521"===n&&(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("given KeyObject instance cannot be used for this algorithm");return n?n[t]=i:Cr.set(e,{[t]:i}),i})(e,t)}catch(e){if(e instanceof TypeError)throw e}let n=e.export({format:"jwk"});return Nr(e,n,t)}if(Or(e))return e.k?tr(e.k):Nr(e,e,t,!0);throw new Error("unreachable")}(t,s);if(!await async function(e,t,n,r){const o=await mo(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 ar("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 pr;let p;if(a)try{p=tr(e.payload)}catch(e){throw new sr("Failed to base64url decode the payload")}else p="string"==typeof e.payload?Zn.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?ht(ht({},f),{},{key:h}):f}const yo=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;function wo(e){const t=yo.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 bo=e=>e.includes("/")?e.toLowerCase():"application/".concat(e.toLowerCase());async function vo(e,t,n){var r;const o=await async function(e,t,n){if(e instanceof Uint8Array&&(e=Qn.decode(e)),"string"!=typeof e)throw new sr("Compact JWS must be a string or Uint8Array");const{0:r,1:o,2:i,length:a}=e.split(".");if(3!==a)throw new sr("Invalid Compact JWS");const s=await go({payload:o,protected:r,signature:i},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return"function"==typeof t?ht(ht({},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 cr("JWTs MUST NOT use unencoded payload");const i=function(e,t){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{n=JSON.parse(Qn.decode(t))}catch(e){}if(!Ar(n))throw new cr("JWT Claims Set must be a top-level JSON object");const{typ:o}=r;if(o&&("string"!=typeof e.typ||bo(e.typ)!==bo(o)))throw new rr('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 rr('missing required "'.concat(e,'" claim'),n,e,"missing");if(a&&!(Array.isArray(a)?a:[a]).includes(n.iss))throw new rr('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new rr('unexpected "sub" claim value',n,"sub","check_failed");if(c&&!((e,t)=>"string"==typeof e?t.includes(e):!!Array.isArray(e)&&t.some(Set.prototype.has.bind(new Set(e))))(n.aud,"string"==typeof c?[c]:c))throw new rr('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof r.clockTolerance){case"string":d=wo(r.clockTolerance);break;case"number":d=r.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:h}=r,p=(e=>Math.floor(e.getTime()/1e3))(h||new Date);if((void 0!==n.iat||u)&&"number"!=typeof n.iat)throw new rr('"iat" claim must be a number',n,"iat","invalid");if(void 0!==n.nbf){if("number"!=typeof n.nbf)throw new rr('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>p+d)throw new rr('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(void 0!==n.exp){if("number"!=typeof n.exp)throw new rr('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=p-d)throw new or('"exp" claim timestamp check failed',n,"exp","check_failed")}if(u){const e=p-n.iat;if(e-d>("number"==typeof u?u:wo(u)))throw new or('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(e<0-d)throw new rr('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n}(o.protectedHeader,o.payload,n),a={payload:i,protectedHeader:o.protectedHeader};return"function"==typeof t?ht(ht({},a),{},{key:o.key}):a}function Eo(e){return Ar(e)}var Ao,So,To=new WeakMap,ko=new WeakMap;class _o{constructor(e){if(ct(this,To,void 0),ct(this,ko,new WeakMap),!function(e){return e&&"object"==typeof e&&Array.isArray(e.keys)&&e.keys.every(Eo)}(e))throw new ur("JSON Web Key Set malformed");ut(To,this,structuredClone(e))}jwks(){return st(To,this)}async getKey(e,t){const{alg:n,kid:r}=ht(ht({},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 ar('Unsupported "alg" value for a JSON Web Key Set')}}(n),i=st(To,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 lr;if(1!==s){const e=new dr,t=st(ko,this);throw e[Symbol.asyncIterator]=function(e){return function(){return new ft(e.apply(this,arguments))}}(function*(){for(const e of i)try{yield yield it(Ro(t,e,n))}catch(e){}}),e}return Ro(st(ko,this),a,n)}}async function Ro(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(!Ar(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 tr(e.k);case"RSA":if("oth"in e&&void 0!==e.oth)throw new ar('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Ir(ht(ht({},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 Ir(ht(ht({},e),{},{ext:n}));case"EC":case"OKP":return Ir(ht(ht({},e),{},{alg:t,ext:n}));default:throw new ar('Unsupported "kty" (Key Type) Parameter value')}}(ht(ht({},t),{},{ext:!0}),n);if(e instanceof Uint8Array||"public"!==e.type)throw new ur("JSON Web Key Set members must be public keys");r[n]=e}return r[n]}function Io(e){const t=new _o(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 Oo;if("undefined"==typeof navigator||null===(Ao=navigator.userAgent)||void 0===Ao||null===(So=Ao.startsWith)||void 0===So||!So.call(Ao,"Mozilla/5.0 ")){const e="v6.1.3";Oo="".concat("jose","/").concat(e)}const Co=Symbol(),No=Symbol();var Lo=new WeakMap,xo=new WeakMap,Po=new WeakMap,Uo=new WeakMap,Do=new WeakMap,Mo=new WeakMap,Bo=new WeakMap,jo=new WeakMap,Ho=new WeakMap,Ko=new WeakMap;class Go{constructor(e,t){if(ct(this,Lo,void 0),ct(this,xo,void 0),ct(this,Po,void 0),ct(this,Uo,void 0),ct(this,Do,void 0),ct(this,Mo,void 0),ct(this,Bo,void 0),ct(this,jo,void 0),ct(this,Ho,void 0),ct(this,Ko,void 0),!(e instanceof URL))throw new TypeError("url must be an instance of URL");var n,r;ut(Lo,this,new URL(e.href)),ut(xo,this,"number"==typeof(null==t?void 0:t.timeoutDuration)?null==t?void 0:t.timeoutDuration:5e3),ut(Po,this,"number"==typeof(null==t?void 0:t.cooldownDuration)?null==t?void 0:t.cooldownDuration:3e4),ut(Uo,this,"number"==typeof(null==t?void 0:t.cacheMaxAge)?null==t?void 0:t.cacheMaxAge:6e5),ut(Bo,this,new Headers(null==t?void 0:t.headers)),Oo&&!st(Bo,this).has("User-Agent")&&st(Bo,this).set("User-Agent",Oo),st(Bo,this).has("accept")||(st(Bo,this).set("accept","application/json"),st(Bo,this).append("accept","application/jwk-set+json")),ut(jo,this,null==t?void 0:t[Co]),void 0!==(null==t?void 0:t[No])&&(ut(Ko,this,null==t?void 0:t[No]),n=null==t?void 0:t[No],r=st(Uo,this),"object"==typeof n&&null!==n&&"uat"in n&&"number"==typeof n.uat&&!(Date.now()-n.uat>=r)&&"jwks"in n&&Ar(n.jwks)&&Array.isArray(n.jwks.keys)&&Array.prototype.every.call(n.jwks.keys,Ar)&&(ut(Do,this,st(Ko,this).uat),ut(Ho,this,Io(st(Ko,this).jwks))))}pendingFetch(){return!!st(Mo,this)}coolingDown(){return"number"==typeof st(Do,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 hr;throw e});if(200!==o.status)throw new nr("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch(e){throw new nr("Failed to parse the JSON Web Key Set HTTP response as JSON")}}(st(Lo,this).href,st(Bo,this),AbortSignal.timeout(st(xo,this)),st(jo,this)).then(e=>{ut(Ho,this,Io(e)),st(Ko,this)&&(st(Ko,this).uat=Date.now(),st(Ko,this).jwks=e),ut(Do,this,Date.now()),ut(Mo,this,void 0)}).catch(e=>{throw ut(Mo,this,void 0),e})),await st(Mo,this)}}const Wo=["mfaToken"],Fo=["mfaToken"];var Xo,Vo,zo,Jo,Yo,qo,Zo,Qo,$o=class extends Error{constructor(e,t){super(t),lt(this,"code",void 0),this.name="NotSupportedError",this.code=e}},ei=class extends Error{constructor(e,t,n){super(t),lt(this,"cause",void 0),lt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},ti=class extends ei{constructor(e,t){super("token_by_code_error",e,t),this.name="TokenByCodeError"}},ni=class extends ei{constructor(e,t){super("token_by_client_credentials_error",e,t),this.name="TokenByClientCredentialsError"}},ri=class extends ei{constructor(e,t){super("token_by_refresh_token_error",e,t),this.name="TokenByRefreshTokenError"}},oi=class extends ei{constructor(e,t){super("token_for_connection_error",e,t),this.name="TokenForConnectionErrorCode"}},ii=class extends ei{constructor(e,t){super("token_exchange_error",e,t),this.name="TokenExchangeError"}},ai=class extends Error{constructor(e){super(e),lt(this,"code","verify_logout_token_error"),this.name="VerifyLogoutTokenError"}},si=class extends ei{constructor(e){super("backchannel_authentication_error","There was an error when trying to use Client-Initiated Backchannel Authentication.",e),lt(this,"code","backchannel_authentication_error"),this.name="BackchannelAuthenticationError"}},ci=class extends ei{constructor(e){super("build_authorization_url_error","There was an error when trying to build the authorization URL.",e),this.name="BuildAuthorizationUrlError"}},ui=class extends ei{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 ei{constructor(e){super("build_unlink_user_url_error","There was an error when trying to build the Unlink User URL.",e),this.name="BuildUnlinkUserUrlError"}},di=class extends Error{constructor(){super("The client secret or client assertion signing key must be provided."),lt(this,"code","missing_client_auth_error"),this.name="MissingClientAuthError"}};function hi(e){return Object.entries(e).filter(e=>{let[,t]=e;return void 0!==t}).reduce((e,t)=>ht(ht({},e),{},{[t[0]]:t[1]}),{})}var pi=class extends Error{constructor(e,t,n){super(t),lt(this,"cause",void 0),lt(this,"code",void 0),this.code=e,this.cause=n&&{error:n.error,error_description:n.error_description,message:n.message}}},fi=class extends pi{constructor(e,t){super("mfa_list_authenticators_error",e,t),this.name="MfaListAuthenticatorsError"}},mi=class extends pi{constructor(e,t){super("mfa_enrollment_error",e,t),this.name="MfaEnrollmentError"}},gi=class extends pi{constructor(e,t){super("mfa_delete_authenticator_error",e,t),this.name="MfaDeleteAuthenticatorError"}},yi=class extends pi{constructor(e,t){super("mfa_challenge_error",e,t),this.name="MfaChallengeError"}};function wi(e){return{id:e.id,authenticatorType:e.authenticator_type,active:e.active,name:e.name,oobChannels:e.oob_channels,type:e.type}}var bi=(Xo=new WeakMap,Vo=new WeakMap,zo=new WeakMap,class{constructor(e){var t;ct(this,Xo,void 0),ct(this,Vo,void 0),ct(this,zo,void 0),ut(Xo,this,"https://".concat(e.domain)),ut(Vo,this,e.clientId),ut(zo,this,null!==(t=e.customFetch)&&void 0!==t?t:function(){return fetch(...arguments)})}async listAuthenticators(e){const t="".concat(st(Xo,this),"/mfa/authenticators"),{mfaToken:n}=e,r=await st(zo,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 fi(e.error_description||"Failed to list authenticators",e)}return(await r.json()).map(wi)}async enrollAuthenticator(e){const t="".concat(st(Xo,this),"/mfa/associate"),{mfaToken:n}=e,r=pt(e,Wo),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 st(zo,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 mi(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};throw new Error("Unexpected authenticator type: ".concat(e.authenticator_type))}(await i.json())}async deleteAuthenticator(e){const{authenticatorId:t,mfaToken:n}=e,r="".concat(st(Xo,this),"/mfa/authenticators/").concat(encodeURIComponent(t)),o=await st(zo,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 gi(e.error_description||"Failed to delete authenticator",e)}}async challengeAuthenticator(e){const t="".concat(st(Xo,this),"/mfa/challenge"),{mfaToken:n}=e,r=pt(e,Fo),o={mfa_token:n,client_id:st(Vo,this),challenge_type:r.challengeType};r.authenticatorId&&(o.authenticator_id=r.authenticatorId);const i=await st(zo,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 yi(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){lt(this,"accessToken",void 0),lt(this,"idToken",void 0),lt(this,"refreshToken",void 0),lt(this,"expiresAt",void 0),lt(this,"scope",void 0),lt(this,"claims",void 0),lt(this,"authorizationDetails",void 0),lt(this,"tokenType",void 0),lt(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}},Ei="openid profile email offline_access",Ai=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 Si(e){if(null==e)throw new ii("subject_token is required");if("string"!=typeof e)throw new ii("subject_token must be a string");if(0===e.trim().length)throw new ii("subject_token cannot be blank or whitespace");if(e!==e.trim())throw new ii("subject_token must not include leading or trailing whitespace");if(/^bearer\s+/i.test(e))throw new ii("subject_token must not include the 'Bearer ' prefix")}function Ti(e,t){if(t)for(const[n,r]of Object.entries(t))if(!Ai.has(n))if(Array.isArray(r)){if(r.length>20)throw new ii("Parameter '".concat(n,"' exceeds maximum array size of ").concat(20));r.forEach(t=>{e.append(n,t)})}else e.append(n,r)}var ki=(Jo=new WeakMap,Yo=new WeakMap,qo=new WeakMap,Zo=new WeakMap,Qo=new WeakSet,class{constructor(e){if(function(e,t){at(e,t),t.add(e)}(this,Qo),ct(this,Jo,void 0),ct(this,Yo,void 0),ct(this,qo,void 0),ct(this,Zo,void 0),lt(this,"mfa",void 0),ut(qo,this,e),e.useMtls&&!e.customFetch)throw new $o("mtls_without_custom_fetch_not_supported","Using mTLS without a custom fetch implementation is not supported");this.mfa=new bi({domain:st(qo,this).domain,clientId:st(qo,this).clientId,customFetch:st(qo,this).customFetch})}async buildAuthorizationUrl(e){const{serverMetadata:t}=await ot(Qo,this,_i).call(this);if(null!=e&&e.pushedAuthorizationRequests&&!t.pushed_authorization_request_endpoint)throw new $o("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 ot(Qo,this,Ci).call(this,e)}catch(e){throw new ci(e)}}async buildLinkUserUrl(e){try{const t=await ot(Qo,this,Ci).call(this,{authorizationParams:ht(ht({},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 ui(e)}}async buildUnlinkUserUrl(e){try{const t=await ot(Qo,this,Ci).call(this,{authorizationParams:ht(ht({},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 ot(Qo,this,_i).call(this),r=hi(ht(ht({},st(qo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ht(ht({scope:Ei},r),{},{client_id:st(qo,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 to(t,o),n=await no(t,e);return vi.fromTokenEndpointResponse(n)}catch(e){throw new si(e)}}async initiateBackchannelAuthentication(e){const{configuration:t,serverMetadata:n}=await ot(Qo,this,_i).call(this),r=hi(ht(ht({},st(qo,this).authorizationParams),null==e?void 0:e.authorizationParams)),o=new URLSearchParams(ht(ht({scope:Ei},r),{},{client_id:st(qo,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 to(t,o);return{authReqId:e.auth_req_id,expiresIn:e.expires_in,interval:e.interval}}catch(e){throw new si(e)}}async backchannelAuthenticationGrant(e){let{authReqId:t}=e;const{configuration:n}=await ot(Qo,this,_i).call(this),r=new URLSearchParams({auth_req_id:t});try{const e=await fo(n,"urn:openid:params:grant-type:ciba",r);return vi.fromTokenEndpointResponse(e)}catch(e){throw new si(e)}}async getTokenForConnection(e){var t;if(e.refreshToken&&e.accessToken)throw new oi("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 oi("Either a refresh or access token must be specified.");try{return await this.exchangeToken({connection:e.connection,subjectToken:n,subjectTokenType:e.accessToken?"urn:ietf:params:oauth:token-type:access_token":"urn:ietf:params:oauth:token-type:refresh_token",loginHint:e.loginHint})}catch(e){if(e instanceof ii)throw new oi(e.message,e.cause);throw e}}async exchangeToken(e){return"connection"in e?ot(Qo,this,Ri).call(this,e):ot(Qo,this,Ii).call(this,e)}async getTokenByCode(e,t){const{configuration:n}=await ot(Qo,this,_i).call(this);try{const r=await oo(n,e,{pkceCodeVerifier:t.codeVerifier});return vi.fromTokenEndpointResponse(r)}catch(e){throw new ti("There was an error while trying to request a token.",e)}}async getTokenByRefreshToken(e){const{configuration:t}=await ot(Qo,this,_i).call(this);try{const n=await io(t,e.refreshToken);return vi.fromTokenEndpointResponse(n)}catch(e){throw new ri("The access token has expired and there was an error while trying to refresh it.",e)}}async getTokenByClientCredentials(e){const{configuration:t}=await ot(Qo,this,_i).call(this);try{const n=new URLSearchParams({audience:e.audience});e.organization&&n.append("organization",e.organization);const r=await ao(t,n);return vi.fromTokenEndpointResponse(r)}catch(e){throw new ni("There was an error while trying to request a token.",e)}}async buildLogoutUrl(e){const{configuration:t,serverMetadata:n}=await ot(Qo,this,_i).call(this);if(!n.end_session_endpoint){const t=new URL("https://".concat(st(qo,this).domain,"/v2/logout"));return t.searchParams.set("returnTo",e.returnTo),t.searchParams.set("client_id",st(qo,this).clientId),t}return function(e,t){uo(e);const{as:n,c:r,tlsOnly:o}=Br(e),i=en(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 ot(Qo,this,_i).call(this);st(Zo,this)||ut(Zo,this,function(e,t){const n=new Go(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(t.jwks_uri),{[Co]:st(qo,this).customFetch}));const{payload:n}=await vo(e.logoutToken,st(Zo,this),{issuer:t.issuer,audience:st(qo,this).clientId,algorithms:["RS256"],requiredClaims:["iat"]});if(!("sid"in n)&&!("sub"in n))throw new ai('either "sid" or "sub" (or both) claims must be present');if("sid"in n&&"string"!=typeof n.sid)throw new ai('"sid" claim must be a string');if("sub"in n&&"string"!=typeof n.sub)throw new ai('"sub" claim must be a string');if("nonce"in n)throw new ai('"nonce" claim is prohibited');if(!("events"in n))throw new ai('"events" claim is missing');if("object"!=typeof n.events||null===n.events)throw new ai('"events" claim must be an object');if(!("http://schemas.openid.net/event/backchannel-logout"in n.events))throw new ai('"http://schemas.openid.net/event/backchannel-logout" member is missing in the "events" claim');if("object"!=typeof n.events["http://schemas.openid.net/event/backchannel-logout"])throw new ai('"http://schemas.openid.net/event/backchannel-logout" member in the "events" claim must be an object');return{sid:n.sid,sub:n.sub}}});async function _i(){if(st(Jo,this)&&st(Yo,this))return{configuration:st(Jo,this),serverMetadata:st(Yo,this)};const e=await ot(Qo,this,Oi).call(this);return ut(Jo,this,await Yr(new URL("https://".concat(st(qo,this).domain)),st(qo,this).clientId,{use_mtls_endpoint_aliases:st(qo,this).useMtls},e,{[Gr]:st(qo,this).customFetch})),ut(Yo,this,st(Jo,this).serverMetadata()),st(Jo,this)[Gr]=st(qo,this).customFetch||fetch,{configuration:st(Jo,this),serverMetadata:st(Yo,this)}}async function Ri(e){var t,n;const{configuration:r}=await ot(Qo,this,_i).call(this);if("audience"in e||"resource"in e)throw new ii("audience and resource parameters are not supported for Token Vault exchanges");Si(e.subjectToken);const o=new URLSearchParams({connection:e.connection,subject_token:e.subjectToken,subject_token_type:null!==(t=e.subjectTokenType)&&void 0!==t?t:"urn:ietf:params:oauth:token-type:access_token",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),Ti(o,e.extra);try{const e=await fo(r,"urn:auth0:params:oauth:grant-type:token-exchange:federated-connection-access-token",o);return vi.fromTokenEndpointResponse(e)}catch(t){throw new ii("Failed to exchange token for connection '".concat(e.connection,"'."),t)}}async function Ii(e){const{configuration:t}=await ot(Qo,this,_i).call(this);Si(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),Ti(n,e.extra);try{const e=await fo(t,"urn:ietf:params:oauth:grant-type:token-exchange",n);return vi.fromTokenEndpointResponse(e)}catch(t){throw new ii("Failed to exchange token of type '".concat(e.subjectTokenType,"'").concat(e.audience?" for audience '".concat(e.audience,"'"):"","."),t)}}async function Oi(){if(!st(qo,this).clientSecret&&!st(qo,this).clientAssertionSigningKey&&!st(qo,this).useMtls)throw new di;if(st(qo,this).useMtls)return(e,t,n,r)=>{n.set("client_id",t.client_id)};let e=st(qo,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 Rr(e,t,void 0)}(e,st(qo,this).clientAssertionSigningAlg||"RS256")),e?function(e){return qt(e,void 0)}(e):Kr(st(qo,this).clientSecret)}async function Ci(e){const{configuration:t}=await ot(Qo,this,_i).call(this),n=Gt(),r=await function(e){return async function(e){return Ht(e,"codeVerifier"),Nt(await crypto.subtle.digest("SHA-256",It(e)))}(e)}(n),o=hi(ht(ht({},st(qo,this).authorizationParams),null==e?void 0:e.authorizationParams)),i=new URLSearchParams(ht(ht({scope:Ei},o),{},{client_id:st(qo,this).clientId,code_challenge:r,code_challenge_method:"S256"}));return{authorizationUrl:null!=e&&e.pushedAuthorizationRequests?await co(t,i):await so(t,i),codeVerifier:n}}class Ni extends v{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ni.prototype)}static fromPayload(e){let{error:t,error_description:n}=e;return new Ni(t,n)}}class Li extends Ni{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Li.prototype)}}class xi extends Ni{constructor(e,t){super(e,t),Object.setPrototypeOf(this,xi.prototype)}}class Pi extends Ni{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Pi.prototype)}}class Ui extends Ni{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Ui.prototype)}}class Di extends Ni{constructor(e,t){super(e,t),Object.setPrototypeOf(this,Di.prototype)}}class Mi{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 Bi{constructor(e,t){this.authJsMfaClient=e,this.auth0Client=t,this.contextManager=new Mi}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 Li("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 fi)throw new Li(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=nt[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 mi)throw new xi(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 yi)throw new Pi(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 Di("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 Ui("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 Ui("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 Ui)throw new Ui(e.error,e.error_description);throw e}}}class ji{constructor(e){let t,n;if(this.userCache=(new _e).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(!L())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(void 0===L().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||"memory",!Ve(t))throw new Error('Invalid cache location "'.concat(t,'"'));n=Ve(t)()}var r;this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=!1===e.legacySameSiteCookie?Me:Be,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:je;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]=Ae(t,o,...r)}),i}(this.options.authorizationParams.scope,"openid",this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Ie(o,this.options.clientId,this.options.cookieDomain),this.nowProvider=this.options.nowProvider||b,this.cacheManager=new Re(n,n.allKeys?void 0:new Fe(n,this.options.clientId),this.nowProvider),this.dpop=this.options.useDpop?new Ze(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 et(s,a),this.authJsClient=new ki({domain:this.options.domain,clientId:this.options.clientId}),this.mfa=new Bi(this.authJsClient.mfa,this),"undefined"!=typeof window&&window.Worker&&this.options.useRefreshTokens&&"memory"===t&&(this.options.workerUrl?this.worker=new Worker(this.options.workerUrl):this.worker=new Ge)}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],Ce.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&&!Oe(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||!Oe(t.claims.exp))throw new Error("Expiration Time (exp) claim must be a number present in the ID token");if(!Oe(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&&Oe(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})}async _prepareAuthorizeUrl(e,t,n){var r;const o=P(x()),i=P(x()),a=x(),s=await B(a),c=H(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:Se(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||"default",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 _;const r=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);t.popup.location.href=r.url;const o=await(e=>new Promise((t,n)=>{let r;const o=setInterval(()=>{e.popup&&e.popup.closed&&(clearInterval(o),clearTimeout(i),window.removeEventListener("message",r,!1),n(new k(e.popup)))},1e3),i=setTimeout(()=>{clearInterval(o),n(new T(e.popup)),window.removeEventListener("message",r,!1)},1e3*(e.timeoutInSeconds||60));r=function(a){if(a.data&&"authorization_response"===a.data.type){if(clearTimeout(i),clearInterval(o),window.removeEventListener("message",r,!1),!1!==e.closePopup&&e.popup.close(),a.data.response.error)return n(v.fromPayload(a.data.response));t(a.data.response)}},window.addEventListener("message",r)}))(Object.assign(Object.assign({},t),{timeoutInSeconds:t.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(r.state!==o.state)throw new v("state_mismatch","Invalid state");const i=(null===(n=e.authorizationParams)||void 0===n?void 0:n.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:r.audience,scope:r.scope,code_verifier:r.code_verifier,grant_type:"authorization_code",code:o.code,redirect_uri:r.redirect_uri},{nonceIn:r.nonce,organization:i})}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=ze(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=await this._prepareAuthorizeUrl(i.authorizationParams||{}),{url:c}=s,u=g(s,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},u),{appState:o,response_type:He.Code}),a&&{organization:a}));const l=r?"".concat(c,"#").concat(r):c;n?await n(l):window.location.assign(l)}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===He.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:He.Code}}async _handleConnectAccountRedirectCallback(e,t){const{connect_code:n,state:r,error:o,error_description:i}=e;if(o)throw new A(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:He.ConnectCode})}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch(e){}}async getTokenSilently(){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:Se(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=We[t];return n||(n=e().finally(()=>{delete We[t],n=null}),We[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||"default",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||"default",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||"default",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:Se(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 Te({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",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(M(Object.assign({clientId:e.clientId},r))))+o}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t;const n=ze(e),{openUrl:r}=n,o=g(n,["openUrl"]);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("@@user@@"),await(null===(t=this.dpop)||void 0===t?void 0:t.clear());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 S),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 Te({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",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 I(e.authorizationParams.audience||"default",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&&Je(l,c)||Je(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 O(e.authorizationParams.audience||"default",n)}return Object.assign(Object.assign({},t),{scope:e.authorizationParams.scope,oauthTokenScope:t.scope,audience:e.authorizationParams.audience||"default"})}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=g(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{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||"default",t=this.scope[e],n=await this.cacheManager.getIdToken(new Te({clientId:this.options.clientId,audience:e,scope:t})),r=this.userCache.get("@@user@@");return n&&n.id_token===(null==r?void 0:r.id_token)?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache(e){let{scope:t,audience:n,clientId:r,cacheMode:o}=e;const i=await this.cacheManager.get(new Te({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 Ee(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("@@user@@"))}return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},s),{decodedToken:c,scope:e.scope,audience:e.audience||"default"}),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:Se(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 $e(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=P(x()),c=x(),u=await B(c),l=H(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:He.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 Hi(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ki}=Object.prototype,{getPrototypeOf:Gi}=Object,{iterator:Wi,toStringTag:Fi}=Symbol,Xi=(Vi=Object.create(null),e=>{const t=Ki.call(e);return Vi[t]||(Vi[t]=t.slice(8,-1).toLowerCase())});var Vi;const zi=e=>(e=e.toLowerCase(),t=>Xi(t)===e),Ji=e=>t=>typeof t===e,{isArray:Yi}=Array,qi=Ji("undefined");function Zi(e){return null!==e&&!qi(e)&&null!==e.constructor&&!qi(e.constructor)&&ea(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qi=zi("ArrayBuffer");const $i=Ji("string"),ea=Ji("function"),ta=Ji("number"),na=e=>null!==e&&"object"==typeof e,ra=e=>{if("object"!==Xi(e))return!1;const t=Gi(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Fi in e||Wi in e)},oa=zi("Date"),ia=zi("File"),aa=zi("Blob"),sa=zi("FileList");const ca="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==n.g?n.g:{},ua=void 0!==ca.FormData?ca.FormData:void 0,la=zi("URLSearchParams"),[da,ha,pa,fa]=["ReadableStream","Request","Response","Headers"].map(zi);function ma(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),Yi(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const ya="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:n.g,wa=e=>!qi(e)&&e!==ya;const ba=(va="undefined"!=typeof Uint8Array&&Gi(Uint8Array),e=>va&&e instanceof va);var va;const Ea=zi("HTMLFormElement"),Aa=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Sa=zi("RegExp"),Ta=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ma(n,(n,o)=>{let i;!1!==(i=t(n,o,e))&&(r[o]=i||n)}),Object.defineProperties(e,r)};const ka=zi("AsyncFunction"),_a=(Ra="function"==typeof setImmediate,Ia=ea(ya.postMessage),Ra?setImmediate:Ia?(Oa=`axios@${Math.random()}`,Ca=[],ya.addEventListener("message",({source:e,data:t})=>{e===ya&&t===Oa&&Ca.length&&Ca.shift()()},!1),e=>{Ca.push(e),ya.postMessage(Oa,"*")}):e=>setTimeout(e));var Ra,Ia,Oa,Ca;const Na="undefined"!=typeof queueMicrotask?queueMicrotask.bind(ya):"undefined"!=typeof process&&process.nextTick||_a,La={isArray:Yi,isArrayBuffer:Qi,isBuffer:Zi,isFormData:e=>{let t;return e&&(ua&&e instanceof ua||ea(e.append)&&("formdata"===(t=Xi(e))||"object"===t&&ea(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Qi(e.buffer),t},isString:$i,isNumber:ta,isBoolean:e=>!0===e||!1===e,isObject:na,isPlainObject:ra,isEmptyObject:e=>{if(!na(e)||Zi(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:da,isRequest:ha,isResponse:pa,isHeaders:fa,isUndefined:qi,isDate:oa,isFile:ia,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:aa,isRegExp:Sa,isFunction:ea,isStream:e=>na(e)&&ea(e.pipe),isURLSearchParams:la,isTypedArray:ba,isFileList:sa,forEach:ma,merge:function e(){const{caseless:t,skipUndefined:n}=wa(this)&&this||{},r={},o=(o,i)=>{if("__proto__"===i||"constructor"===i||"prototype"===i)return;const a=t&&ga(r,i)||i;ra(r[a])&&ra(o)?r[a]=e(r[a],o):ra(o)?r[a]=e({},o):Yi(o)?r[a]=o.slice():n&&qi(o)||(r[a]=o)};for(let e=0,t=arguments.length;e(ma(t,(t,r)=>{n&&ea(t)?Object.defineProperty(e,r,{value:Hi(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{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",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{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&&Gi(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:Xi,kindOfTest:zi,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(Yi(e))return e;let t=e.length;if(!ta(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Wi]).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:Ea,hasOwnProperty:Aa,hasOwnProp:Aa,reduceDescriptors:Ta,freezeMethods:e=>{Ta(e,(t,n)=>{if(ea(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];ea(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 Yi(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:ga,global:ya,isContextDefined:wa,isSpecCompliantForm:function(e){return!!(e&&ea(e.append)&&"FormData"===e[Fi]&&e[Wi])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(na(e)){if(t.indexOf(e)>=0)return;if(Zi(e))return e;if(!("toJSON"in e)){t[r]=e;const o=Yi(e)?[]:{};return ma(e,(e,t)=>{const i=n(e,r+1);!qi(i)&&(o[t]=i)}),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:ka,isThenable:e=>e&&(na(e)||ea(e))&&ea(e.then)&&ea(e.catch),setImmediate:_a,asap:Na,isIterable:e=>null!=e&&ea(e[Wi])};class xa extends Error{static from(e,t,n,r,o,i){const a=new xa(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",{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(){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:La.toJSONObject(this.config),code:this.code,status:this.status}}}xa.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",xa.ERR_BAD_OPTION="ERR_BAD_OPTION",xa.ECONNABORTED="ECONNABORTED",xa.ETIMEDOUT="ETIMEDOUT",xa.ERR_NETWORK="ERR_NETWORK",xa.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",xa.ERR_DEPRECATED="ERR_DEPRECATED",xa.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",xa.ERR_BAD_REQUEST="ERR_BAD_REQUEST",xa.ERR_CANCELED="ERR_CANCELED",xa.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",xa.ERR_INVALID_URL="ERR_INVALID_URL";const Pa=xa;var Ua=n(8287).hp;function Da(e){return La.isPlainObject(e)||La.isArray(e)}function Ma(e){return La.endsWith(e,"[]")?e.slice(0,-2):e}function Ba(e,t,n){return e?e.concat(t).map(function(e,t){return e=Ma(e),!n&&t?"["+e+"]":e}).join(n?".":""):t}const ja=La.toFlatObject(La,{},null,function(e){return/^is[A-Z]/.test(e)});const Ha=function(e,t,n){if(!La.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=La.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!La.isUndefined(t[e])})).metaTokens,o=n.visitor||u,i=n.dots,a=n.indexes,s=(n.Blob||"undefined"!=typeof Blob&&Blob)&&La.isSpecCompliantForm(t);if(!La.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(La.isDate(e))return e.toISOString();if(La.isBoolean(e))return e.toString();if(!s&&La.isBlob(e))throw new Pa("Blob is not supported. Use a Buffer instead.");return La.isArrayBuffer(e)||La.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Ua.from(e):e}function u(e,n,o){let s=e;if(La.isReactNative(t)&&La.isReactNativeBlob(e))return t.append(Ba(o,n,i),c(e)),!1;if(e&&!o&&"object"==typeof e)if(La.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(La.isArray(e)&&function(e){return La.isArray(e)&&!e.some(Da)}(e)||(La.isFileList(e)||La.endsWith(n,"[]"))&&(s=La.toArray(e)))return n=Ma(n),s.forEach(function(e,r){!La.isUndefined(e)&&null!==e&&t.append(!0===a?Ba([n],r,i):null===a?n:n+"[]",c(e))}),!1;return!!Da(e)||(t.append(Ba(o,n,i),c(e)),!1)}const l=[],d=Object.assign(ja,{defaultVisitor:u,convertValue:c,isVisitable:Da});if(!La.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!La.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),La.forEach(n,function(n,i){!0===(!(La.isUndefined(n)||null===n)&&o.call(t,n,La.isString(i)?i.trim():i,r,d))&&e(n,r?r.concat(i):[i])}),l.pop()}}(e),t};function Ka(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function Ga(e,t){this._pairs=[],e&&Ha(e,this,t)}const Wa=Ga.prototype;Wa.append=function(e,t){this._pairs.push([e,t])},Wa.toString=function(e){const t=e?function(t){return e.call(this,t,Ka)}:Ka;return this._pairs.map(function(e){return t(e[0])+"="+t(e[1])},"").join("&")};const Fa=Ga;function Xa(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Va(e,t,n){if(!t)return e;const r=n&&n.encode||Xa,o=La.isFunction(n)?{serialize:n}:n,i=o&&o.serialize;let a;if(a=i?i(t,o):La.isURLSearchParams(t)?t.toString():new Fa(t,o).toString(r),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}const za=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){La.forEach(this.handlers,function(t){null!==t&&e(t)})}},Ja={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Ya={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Fa,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},qa="undefined"!=typeof window&&"undefined"!=typeof document,Za="object"==typeof navigator&&navigator||void 0,Qa=qa&&(!Za||["ReactNative","NativeScript","NS"].indexOf(Za.product)<0),$a="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,es=qa&&window.location.href||"http://localhost",ts={...e,...Ya};const ns=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&&La.isArray(r)?r.length:i,s)return La.hasOwnProp(r,i)?r[i]=[r[i],n]:r[i]=n,!a;r[i]&&La.isObject(r[i])||(r[i]=[]);return t(e,n,r[i],o)&&La.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 La.matchAll(/\w+|\[(\w*)]/g,e).map(e=>"[]"===e[0]?"":e[1]||e[0])}(e),r,n,0)}),n}return null};const rs={transitional:Ja,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=La.isObject(e);o&&La.isHTMLForm(e)&&(e=new FormData(e));if(La.isFormData(e))return r?JSON.stringify(ns(e)):e;if(La.isArrayBuffer(e)||La.isBuffer(e)||La.isStream(e)||La.isFile(e)||La.isBlob(e)||La.isReadableStream(e))return e;if(La.isArrayBufferView(e))return e.buffer;if(La.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ha(e,new ts.classes.URLSearchParams,{visitor:function(e,t,n,r){return ts.isNode&&La.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((i=La.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Ha(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(La.isString(e))try{return(t||JSON.parse)(e),La.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||rs.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(La.isResponse(e)||La.isReadableStream(e))return e;if(e&&La.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n){if("SyntaxError"===e.name)throw Pa.from(e,Pa.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ts.classes.FormData,Blob:ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};La.forEach(["delete","get","head","post","put","patch"],e=>{rs.headers[e]={}});const os=rs,is=La.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"]),as=Symbol("internals");function ss(e){return e&&String(e).trim().toLowerCase()}function cs(e){return!1===e||null==e?e:La.isArray(e)?e.map(cs):String(e)}function us(e,t,n,r,o){return La.isFunction(r)?r.call(this,t,n):(o&&(t=n),La.isString(t)?La.isString(r)?-1!==t.indexOf(r):La.isRegExp(r)?r.test(t):void 0:void 0)}class ls{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=ss(t);if(!o)throw new Error("header name must be a non-empty string");const i=La.findKey(r,o);(!i||void 0===r[i]||!0===n||void 0===n&&!1!==r[i])&&(r[i||t]=cs(e))}const i=(e,t)=>La.forEach(e,(e,n)=>o(e,n,t));if(La.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(La.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i((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]&&is[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t})(e),t);else if(La.isObject(e)&&La.isIterable(e)){let n,r,o={};for(const t of e){if(!La.isArray(t))throw TypeError("Object iterator must return a key-value pair");o[r=t[0]]=(n=o[r])?La.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=ss(e)){const n=La.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(La.isFunction(t))return t.call(this,e,n);if(La.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ss(e)){const n=La.findKey(this,e);return!(!n||void 0===this[n]||t&&!us(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=ss(e)){const o=La.findKey(n,e);!o||t&&!us(0,n[o],o,t)||(delete n[o],r=!0)}}return La.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&&!us(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return La.forEach(this,(r,o)=>{const i=La.findKey(n,o);if(i)return t[i]=cs(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]=cs(r),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return La.forEach(this,(n,r)=>{null!=n&&!1!==n&&(t[r]=e&&La.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[as]=this[as]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=ss(e);t[r]||(!function(e,t){const n=La.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})})}(n,e),t[r]=!0)}return La.isArray(e)?e.forEach(r):r(e),this}}ls.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),La.reduceDescriptors(ls.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}}),La.freezeMethods(ls);const ds=ls;function hs(e,t){const n=this||os,r=t||n,o=ds.from(r.headers);let i=r.data;return La.forEach(e,function(e){i=e.call(n,i,o.normalize(),t?t.status:void 0)}),o.normalize(),i}function ps(e){return!(!e||!e.__CANCEL__)}const fs=class extends Pa{constructor(e,t,n){super(null==e?"canceled":e,Pa.ERR_CANCELED,t,n),this.name="CanceledError",this.__CANCEL__=!0}};function ms(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new Pa("Request failed with status code "+n.status,[Pa.ERR_BAD_REQUEST,Pa.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}const gs=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)]},ws=(e,t,n=3)=>{let r=0;const o=gs(50,250);return ys(n=>{const i=n.loaded,a=n.lengthComputable?n.total:void 0,s=i-r,c=o(s);r=i;e({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&i<=a?(a-i)/c:void 0,event:n,lengthComputable:null!=a,[t?"download":"upload"]:!0})},n)},bs=(e,t)=>{const n=null!=e;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},vs=e=>(...t)=>La.asap(()=>e(...t)),Es=ts.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,ts.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(ts.origin),ts.navigator&&/(msie|trident)/i.test(ts.navigator.userAgent)):()=>!0,As=ts.hasStandardBrowserEnv?{write(e,t,n,r,o,i,a){if("undefined"==typeof document)return;const s=[`${e}=${encodeURIComponent(t)}`];La.isNumber(n)&&s.push(`expires=${new Date(n).toUTCString()}`),La.isString(r)&&s.push(`path=${r}`),La.isString(o)&&s.push(`domain=${o}`),!0===i&&s.push("secure"),La.isString(a)&&s.push(`SameSite=${a}`),document.cookie=s.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Ss(e,t,n){let r=!("string"==typeof(o=t)&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(o));var o;return e&&(r||0==n)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ts=e=>e instanceof ds?{...e}:e;function ks(e,t){t=t||{};const n={};function r(e,t,n,r){return La.isPlainObject(e)&&La.isPlainObject(t)?La.merge.call({caseless:r},e,t):La.isPlainObject(t)?La.merge({},t):La.isArray(t)?t.slice():t}function o(e,t,n,o){return La.isUndefined(t)?La.isUndefined(e)?void 0:r(void 0,e,0,o):r(e,t,0,o)}function i(e,t){if(!La.isUndefined(t))return r(void 0,t)}function a(e,t){return La.isUndefined(t)?La.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function s(n,o,i){return i in t?r(n,o):i in e?r(void 0,n):void 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,responseEncoding:a,validateStatus:s,headers:(e,t,n)=>o(Ts(e),Ts(t),0,!0)};return La.forEach(Object.keys({...e,...t}),function(r){if("__proto__"===r||"constructor"===r||"prototype"===r)return;const i=La.hasOwnProp(c,r)?c[r]:o,a=i(e[r],t[r],r);La.isUndefined(a)&&i!==s||(n[r]=a)}),n}const _s=e=>{const t=ks({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:i,headers:a,auth:s}=t;if(t.headers=a=ds.from(a),t.url=Va(Ss(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),s&&a.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):""))),La.isFormData(n))if(ts.hasStandardBrowserEnv||ts.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(La.isFunction(n.getHeaders)){const e=n.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach(([e,n])=>{t.includes(e.toLowerCase())&&a.set(e,n)})}if(ts.hasStandardBrowserEnv&&(r&&La.isFunction(r)&&(r=r(t)),r||!1!==r&&Es(t.url))){const e=o&&i&&As.read(i);e&&a.set(o,e)}return t},Rs="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise(function(t,n){const r=_s(e);let o=r.data;const i=ds.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=ds.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ms(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&&0===m.responseURL.indexOf("file:"))&&setTimeout(g)},m.onabort=function(){m&&(n(new Pa("Request aborted",Pa.ECONNABORTED,e,m)),m=null)},m.onerror=function(t){const r=t&&t.message?t.message:"Network Error",o=new Pa(r,Pa.ERR_NETWORK,e,m);o.event=t||null,n(o),m=null},m.ontimeout=function(){let t=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const o=r.transitional||Ja;r.timeoutErrorMessage&&(t=r.timeoutErrorMessage),n(new Pa(t,o.clarifyTimeoutError?Pa.ETIMEDOUT:Pa.ECONNABORTED,e,m)),m=null},void 0===o&&i.setContentType(null),"setRequestHeader"in m&&La.forEach(i.toJSON(),function(e,t){m.setRequestHeader(t,e)}),La.isUndefined(r.withCredentials)||(m.withCredentials=!!r.withCredentials),d&&"json"!==d&&(m.responseType=r.responseType),p&&([c,l]=ws(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([s,u]=ws(h),m.upload.addEventListener("progress",s),m.upload.addEventListener("loadend",u)),(r.cancelToken||r.signal)&&(a=t=>{m&&(n(!t||t.type?new fs(null,e,m):t),m.abort(),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&&-1===ts.protocols.indexOf(y)?n(new Pa("Unsupported protocol "+y+":",Pa.ERR_BAD_REQUEST,e)):m.send(o||null)})},Is=(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 Pa?t:new fs(t instanceof Error?t.message:t))}};let i=t&&setTimeout(()=>{i=null,o(new Pa(`timeout of ${t}ms exceeded`,Pa.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=()=>La.asap(a),s}},Os=function*(e,t){let n=e.byteLength;if(!t||n{const o=async function*(e,t){for await(const n of Cs(e))yield*Os(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})},{isFunction:Ls}=La,xs=(({Request:e,Response:t})=>({Request:e,Response:t}))(La.global),{ReadableStream:Ps,TextEncoder:Us}=La.global,Ds=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Ms=e=>{e=La.merge.call({skipUndefined:!0},xs,e);const{fetch:t,Request:n,Response:r}=e,o=t?Ls(t):"function"==typeof fetch,i=Ls(n),a=Ls(r);if(!o)return!1;const s=o&&Ls(Ps),c=o&&("function"==typeof Us?(u=new Us,e=>u.encode(e)):async e=>new Uint8Array(await new n(e).arrayBuffer()));var u;const l=i&&s&&Ds(()=>{let e=!1;const t=new n(ts.origin,{body:new Ps,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),d=a&&s&&Ds(()=>La.isReadableStream(new r("").body)),h={stream:d&&(e=>e.body)};o&&["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!h[e]&&(h[e]=(t,n)=>{let r=t&&t[e];if(r)return r.call(t);throw new Pa(`Response type '${e}' is not supported`,Pa.ERR_NOT_SUPPORT,n)})});const p=async(e,t)=>{const r=La.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(La.isBlob(e))return e.size;if(La.isSpecCompliantForm(e)){const t=new n(ts.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return La.isArrayBufferView(e)||La.isArrayBuffer(e)?e.byteLength:(La.isURLSearchParams(e)&&(e+=""),La.isString(e)?(await c(e)).byteLength:void 0)})(t):r};return async e=>{let{url:o,method:a,data:s,signal:c,cancelToken:u,timeout:f,onDownloadProgress:m,onUploadProgress:g,responseType:y,headers:w,withCredentials:b="same-origin",fetchOptions:v}=_s(e),E=t||fetch;y=y?(y+"").toLowerCase():"text";let A=Is([c,u&&u.toAbortSignal()],f),S=null;const T=A&&A.unsubscribe&&(()=>{A.unsubscribe()});let k;try{if(g&&l&&"get"!==a&&"head"!==a&&0!==(k=await p(w,s))){let e,t=new n(o,{method:"POST",body:s,duplex:"half"});if(La.isFormData(s)&&(e=t.headers.get("content-type"))&&w.setContentType(e),t.body){const[e,n]=bs(k,ws(vs(g)));s=Ns(t.body,65536,e,n)}}La.isString(b)||(b=b?"include":"omit");const t=i&&"credentials"in n.prototype,c={...v,signal:A,method:a.toUpperCase(),headers:w.normalize().toJSON(),body:s,duplex:"half",credentials:t?b:void 0};S=i&&new n(o,c);let u=await(i?E(S,v):E(o,c));const f=d&&("stream"===y||"response"===y);if(d&&(m||f&&T)){const e={};["status","statusText","headers"].forEach(t=>{e[t]=u[t]});const t=La.toFiniteNumber(u.headers.get("content-length")),[n,o]=m&&bs(t,ws(vs(m),!0))||[];u=new r(Ns(u.body,65536,n,()=>{o&&o(),T&&T()}),e)}y=y||"text";let _=await h[La.findKey(h,y)||"text"](u,e);return!f&&T&&T(),await new Promise((t,n)=>{ms(t,n,{data:_,headers:ds.from(u.headers),status:u.status,statusText:u.statusText,config:e,request:S})})}catch(t){if(T&&T(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new Pa("Network Error",Pa.ERR_NETWORK,e,S,t&&t.response),{cause:t.cause||t});throw Pa.from(t,t&&t.code,e,S,t&&t.response)}}},Bs=new Map,js=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=Bs;for(;c--;)a=i[c],s=u.get(a),void 0===s&&u.set(a,s=c?new Map:Ms(t)),u=s;return s},Hs=(js(),{http:null,xhr:Rs,fetch:{get:js}});La.forEach(Hs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}});const Ks=e=>`- ${e}`,Gs=e=>La.isFunction(e)||null===e||!1===e;const Ws={getAdapter:function(e,t){e=La.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(Ks).join("\n"):" "+Ks(e[0]):"as no adapter specified";throw new Pa("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return o},adapters:Hs};function Fs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fs(null,e)}function Xs(e){Fs(e),e.headers=ds.from(e.headers),e.data=hs.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Ws.getAdapter(e.adapter||os.adapter,e)(e).then(function(t){return Fs(e),t.data=hs.call(e,e.transformResponse,t),t.headers=ds.from(t.headers),t},function(t){return ps(t)||(Fs(e),t&&t.response&&(t.response.data=hs.call(e,e.transformResponse,t.response),t.response.headers=ds.from(t.response.headers))),Promise.reject(t)})}const Vs="1.13.6",zs={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{zs[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}});const Js={};zs.transitional=function(e,t,n){function r(e,t){return"[Axios v"+Vs+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,i)=>{if(!1===e)throw new Pa(r(o," has been removed"+(t?" in "+t:"")),Pa.ERR_DEPRECATED);return t&&!Js[o]&&(Js[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)}},zs.spelling=function(e){return(t,n)=>(console.warn(`${n} is likely a misspelling of ${e}`),!0)};const Ys={assertOptions:function(e,t,n){if("object"!=typeof e)throw new Pa("options must be an object",Pa.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const i=r[o],a=t[i];if(a){const t=e[i],n=void 0===t||a(t,i,e);if(!0!==n)throw new Pa("option "+i+" must be "+n,Pa.ERR_BAD_OPTION_VALUE);continue}if(!0!==n)throw new Pa("Unknown option "+i,Pa.ERR_BAD_OPTION)}},validators:zs},qs=Ys.validators;class Zs{constructor(e){this.defaults=e||{},this.interceptors={request:new za,response:new za}}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=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ks(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ys.assertOptions(n,{silentJSONParsing:qs.transitional(qs.boolean),forcedJSONParsing:qs.transitional(qs.boolean),clarifyTimeoutError:qs.transitional(qs.boolean),legacyInterceptorReqResOrdering:qs.transitional(qs.boolean)},!1),null!=r&&(La.isFunction(r)?t.paramsSerializer={serialize:r}:Ys.assertOptions(r,{encode:qs.function,serialize:qs.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ys.assertOptions(t,{baseUrl:qs.spelling("baseURL"),withXsrfToken:qs.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=o&&La.merge(o.common,o[t.method]);o&&La.forEach(["delete","get","head","post","put","patch","common"],e=>{delete o[e]}),t.headers=ds.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||Ja;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=[Xs.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 fs(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 $s(function(t){e=t});return{token:t,cancel:e}}}const ec=$s;const tc={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(tc).forEach(([e,t])=>{tc[t]=e});const nc=tc;const rc=function e(t){const n=new Qs(t),r=Hi(Qs.prototype.request,n);return La.extend(r,Qs.prototype,n,{allOwnKeys:!0}),La.extend(r,n,null,{allOwnKeys:!0}),r.create=function(n){return e(ks(t,n))},r}(os);rc.Axios=Qs,rc.CanceledError=fs,rc.CancelToken=ec,rc.isCancel=ps,rc.VERSION=Vs,rc.toFormData=Ha,rc.AxiosError=Pa,rc.Cancel=rc.CanceledError,rc.all=function(e){return Promise.all(e)},rc.spread=function(e){return function(t){return e.apply(null,t)}},rc.isAxiosError=function(e){return La.isObject(e)&&!0===e.isAxiosError},rc.mergeConfig=ks,rc.AxiosHeaders=ds,rc.formToJSON=e=>ns(La.isHTMLForm(e)?new FormData(e):e),rc.getAdapter=Ws.getAdapter,rc.HttpStatusCode=nc,rc.default=rc;const oc=rc,ic={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"};var ac,sc;function cc(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 uc(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"",t=lc().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])},pc=function(){var e=hc();return".".concat(e)},fc=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},mc=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=hc(),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,";")})},gc=function(){return lc().host.replace(/^(?:www\.|develop\.|staging\.|preprod\.)/,"").replace("vipdev.lndo.site","com")},yc=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)},wc=function(){var e=hc();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)},bc=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=hc().split(".")[0],e.prev=1,e.next=2,oc({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)}}(),vc=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,oc({method:"get",url:"".concat(i.A.entitlementsEndpoint,"auth0/users/").concat(encodeURIComponent(t),"?domain=").concat(encodeURIComponent(gc())),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)}}(),Ec=function(){return"complete"===document.readyState},Ac=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){var n=!0;if(Ec())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=Ec()),document.querySelector("body")&&n&&(clearInterval(i),t(!0));case 1:case"end":return r.stop()}},r)})),200)}})},Sc=function(){return new Promise(function(e){if(Ec())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)}})},Tc=function(){return new Promise(function(e){if(("interactive"===document.readyState||Ec())&&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)}})},kc=function(){return new Promise(function(e){if(Ec())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)}})},_c=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,Tc();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)}}(),Rc=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,_c(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)}}(),Ic=function(){return new Promise(function(e){a("blueConicReady | Waiting for BC to be ready."),window.blueConicClient.event.subscribe(window.blueConicClient.event.onReady,{},function(){a("blueConicReady | onReady fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicReady | onReady timeout, BC onReady unknown."),e(!1)},3e3)})},Oc=function(){return new Promise(function(e){a("blueConicProfileReady | Waiting for BC Profile to be ready."),window.blueConicClient&&(window.blueConicClient.getSegments||window.blueConicClient.profile)&&(a("blueConicProfileReady | BC getSegments is ready."),e(!0)),window.blueConicClient.event.subscribe(window.blueConicClient.event.onBeforeInteractions,{},function(){a("blueConicProfileReady | onBeforeInteractions fired, BC profile is ready."),e(!0)});var t=setTimeout(function(){clearTimeout(t),a("blueConicProfileReady | onBeforeInteractions timeout, BC profile readiness unknown"),e(!1)},3e3)})},Cc=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(function(t){a("blueConicLoaded | waitTillBCReady is ".concat(e));var n=setTimeout(function(){clearTimeout(n),a("blueConicLoaded | onBlueConicLoaded timeout, resolving false for load status."),t(!1)},1e4);void 0!==window.blueConicClient&&void 0!==window.blueConicClient.event&&void 0!==window.blueConicClient.event.subscribe?(a("blueConicLoaded | BC object already loaded"),e?t(Ic()):(clearTimeout(n),t())):(a('blueConicLoaded | BC not loaded, waiting for "onBlueConicLoaded" event'),window.addEventListener("onBlueConicLoaded",r(o.mark(function r(){var i;return o.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a("blueConicLoaded | onBlueConicLoaded event fired."),!e){r.next=2;break}return a("blueConicLoaded | waiting for blueConicReady..."),r.next=1,Ic();case 1:i=r.sent,clearTimeout(n),t(i),r.next=3;break;case 2:clearTimeout(n),t();case 3:case"end":return r.stop()}},r)})),!1))})},Nc=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,Cc(!0);case 1:if(!e.sent){e.next=4;break}return e.next=2,Oc();case 2:if(e.sent){e.next=3;break}return e.abrupt("return",!1);case 3:return e.abrupt("return",blueConicClient.profile.getProfile().getValue("Auth0_ID"));case 4:return e.abrupt("return",!1);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Lc=function(){var e=r(o.mark(function e(){var t,n,r,i,s,c,u,l=arguments;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=l.length>0&&void 0!==l[0]&&l[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,Cc(!0);case 1:if(!e.sent){e.next=3;break}if(s=window.blueConicClient.getSegments(),a("bcLowaCheck | BC segments for users: ",s),!(s.filter(function(e){return i.includes(e.name)}).length>0)){e.next=3;break}return e.next=2,Nc();case 2:(c=e.sent)&&(n=!0,r=c);case 3:return t&&n&&xc(),u={isSub:n},r&&(u.uuid=r),e.abrupt("return",u);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),xc=function(){fc("bc_lowa_status",1,{path:"/",domain:pc(),expires:7,secure:!0})},Pc=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))})},Uc=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)}}(),Dc=function(){a("Clearing entitlements...");try{mc(ic.ENTITLEMENT_COOKIE_KEY,{path:"/"})}catch(e){a("Failed to delete legacy cookie: ",e)}try{mc(ic.ENTITLEMENT_COOKIE_KEY,{path:"/",domain:hc(),expires:365,secure:!0})}catch(e){a("Failed to delete entitlements cookie: ",e)}try{window.localStorage.removeItem(ic.LOCAL_STORAGE_SESSION_KEY)}catch(e){a("Failed to remove local storage: ",e)}},Mc=function(){mc(ic.AUTH0_SUB_COOKIE_KEY),mc("mng-jwt-decoded"),localStorage.removeItem(ic.USER_STORAGE_HASH),sessionStorage.removeItem("dashboard-state"),Dc()},Bc=function(){var e=lc();return!["local","develop","preprod","trbdev"].some(function(t){return e.origin.includes(t)})},jc=function(e){a("Removing storageObject : ",e),void 0!==window.localStorage.getItem(e)&&(window.localStorage.removeItem(e),a("Storage Object removed : ",e))},Hc=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=Hc;var Kc;window.validatePhoneNumber=function(e){return/^[0-9]([0-9 -])*[0-9]$/.test(e)};var Gc=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===Kc){e.next=1;break}return e.abrupt("return",Kc);case 1:return t=i.A.auth0Domain,n=i.A.auth0ClientId,Kc=new ji({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",Kc);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Wc=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"),sc=new CustomEvent("mng-auth-check-complete",{detail:e}),ac?(a("utils | Dispatching mng-auth-complete event (islands were ready): ",t),window.dispatchEvent(sc)):a("Islands not ready")};var Fc=function(){var e=window.localStorage.getItem("__MNG_Session");if(e){var t=JSON.parse(e);if(t.idToken){var n=yc(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 ",gc()),gc()},Xc=function(e){i.A.datadogEnabled&&window.DD_RUM.addTiming(e)},Vc=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=gc(),a("deleteUSerCache","Domain is: ".concat(n)),r={publication:n,uuid:t},e.next=1,oc({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)}}(),zc=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:uc({},i)}));case 1:return r.next=2,Rc();case 2:return u=r.sent,r.next=3,_c("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,Uc();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:uc({},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:uc({},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()})};"undefined"!=typeof window&&(window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.checkPaywallStatus=zc);var Jc="#primary-menu",Yc="#pushnav",qc=".log-in-button",Zc=".subscribe-visibility",Qc=".log-out-button",$c="dfm-digisubs-menu",eu="digisubs-push-container",tu="dfm-digisubs-push-menu",nu="mega-subscribe-button",ru=function(){return document.querySelector(Jc)},ou=function(){return document.querySelector(Yc)},iu=function(){return document.getElementById($c)},au=function(){return document.getElementById(eu)},su=function(){return document.getElementById(tu)},cu=function(){return iu()?iu().querySelector(qc):null},uu=function(){return su()?su().querySelector(qc):null},lu=function(){return uu()?uu().querySelector("a"):null},du=function(){return document.getElementById(nu)},hu=function(){return ou()?ou().querySelector(qc):null},pu=function(){return hu()?hu().querySelector("a"):null},fu=function(){return document.querySelectorAll(qc)},mu=function(){return document.querySelectorAll(Zc)},gu=function(){var e=document.querySelectorAll("".concat(Zc," a"));return e.length>0?e[0]:null};function yu(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 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,Cc();case 1:return e.next=2,Pc();case 2:return e.abrupt("return",new Promise(function(e){a("ANALYTICS: inside BCregwall events");var t=lc();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)}}(),bu=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 vu=function(){try{var e=localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY);return"string"==typeof e?e:"{}"}catch(e){a("Unable to get session from local storage: ",e)}return"{}"},Eu=function(e){try{a("Setting local storage session",e),localStorage.setItem(ic.LOCAL_STORAGE_SESSION_KEY,e)}catch(e){a("Unable to save session from local storage: ",e)}},Au=function(e){try{fc(ic.ENTITLEMENT_COOKIE_KEY,e,{path:"/",domain:pc(),expires:365,secure:!0})}catch(e){a("Unable to save session to cookie storage: ",e)}},Su=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,oc.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,Eu(JSON.stringify({accessToken:f,idToken:m,entitlementToken:g,expiration:y,entitlementSource:w,isEntitled:b,adFree:v,entitlementLevel:E})),""!==g&&"string"==typeof g&&Au(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)}}(),Tu=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,oc.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)}}(),ku=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,oc.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)}}(),_u=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,A,S,T,k,_,R,I,O,C;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a("Inside getSession"),e.prev=1,d=vu(),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,Su();case 2:E=e.sent,A=E.accessToken,S=E.idToken,T=E.entitlementToken,k=E.expiration,_=E.entitlementSource,R=E.isEntitled,I=E.adFree,O=E.entitlementLevel,n=A,t=S,r=T,i=k,s=_,c=R,u=I,l=O;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)}}(),Ru=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,A,S,T,k,_,R,I,O,C,N,L;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,n=vu(),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,A=t.accessToken,S=t.idToken,T=t.entitlementToken,k=t.expiration,_=t.entitlementSource,R=t.isEntitled,I=t.adFree,O=t.entitlementLevel,C={accessToken:null==A?s:A,idToken:null==S?u:S,entitlementToken:null==T?d:T,expiration:null==k?p:k,entitlementSource:null==_?m:_,isEntitled:null==R?y:R,adFree:null==I?b:I,entitlementLevel:null==O?E:O},a("Current session data: ",r),a("New session data: ",t),a("Updated session data:",C),N=JSON.stringify(C),Eu(N),""!==C.entitlementToken&&"string"==typeof C.entitlementToken&&Au(C.entitlementToken),n===N){e.next=1;break}return e.next=1,Tu(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)}}(),Iu=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..."),Mc(),e.next=1,ku();case 1:localStorage.removeItem(ic.LOCAL_STORAGE_SESSION_KEY);case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ou=function(){return"logout"===(lc().searchParams.get("state")||"").toLowerCase()};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.logoutCallbacks=[];var 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();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)}}(),Nu=function(){return"undefined"==typeof CnnXt?(a("Connext was not loaded."),!1):Connext.Storage.GetUserState()},Lu=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=/")}},xu=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..."),Lu(),a("About to perform user cache deletion..."),t=JSON.parse(localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY)),n=null==t?void 0:t.idToken,!(i=n?yc(n):"")){e.next=2;break}return s=i.auth0Id,e.next=1,Vc(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,Iu();case 3:e.next=5;break;case 4:Mc();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...")}),jc("hhsl"),jc("userNewsLetterData"),jc(ic.REGWALL_USER_IS_SUBSCRIBED),jc(ic.USER_PROFILE_HASH),u=lc(),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),!Bc()){e.next=10;break}a("About to call Connext Logout..."),setTimeout(function(){Connext.Logout()},500),e.next=15;break;case 10:if("Logged In"!==Nu()){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,Cu(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,Cu(l);case 15:e.next=17;break;case 16:return a("Connext Logout was NOT called"),e.next=17,Cu(l);case 17:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}(),Pu=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},Uu=function(){window.MNGAuthentication.preAuthGTMEvents.forEach(function(e){return bu(e)}),a("Cycled through preauth GTM events.")},Du=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..."),Pu()>4.5&&window.localStorage.clear(),Uu(),i&&(c=[],u=window.localStorage.getItem("callbackEvents"),l=JSON.parse(u),c=l&&l.length>0?yu(new Set([].concat(yu(i),yu(l)))):i,window.localStorage.setItem("callbackEvents",JSON.stringify(c))),d=null,e.next=1,Gc();case 1:if(h=e.sent,p=lc(),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,Iu();case 2:e.next=4;break;case 3:Mc();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)}}(),Mu=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()}})};window.MNGAuthentication=window.MNGAuthentication||{},window.MNGAuthentication.oidcLoginCallbacks=[];var Bu=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,A,S,T,k;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Lu(),t=lc(),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)),Du(!1,!1,!1,[],c)):Du()):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",Du(!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,Gc();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,Mu();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,S=e.catch(8),a("Failed to cycle through login callbacks: ",S);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,vc(y.userId);case 14:return b=e.sent,a("Encrypted apple uuid is: ".concat(b)),e.next=15,bc(b);case 15:w=e.sent,a("Apple sub status is: ".concat(w)),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(jc(ic.REGWALL_USER_IS_SUBSCRIBED),!window.authentication_config.sessionManagementEnabled){e.next=18;break}return a("Saving idToken to session server"),e.next=18,Ru({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,A=new URL(i),n&&w&&A.searchParams.append("access_token",b),a("Apple redirect URL:",A),e.abrupt("return",window.location.assign(A));case 21:return e.prev=21,k=e.catch(20),a("Failed to redirect after authentication: ",k),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)}}(),ju=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,wu();case 1:a("ANALYTICS: bc values should be filled");case 2: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,u,l,d,h,p,f,m;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,Pc();case 1:if(t=e.sent,n=t.idToken,r=t.isAuthenticated,""===n){e.next=4;break}return e.prev=2,s=yc(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)}}();window.MNGAuthentication.login=Du,window.MNGAuthentication.logout=xu,window.MNGAuthentication.getUserInfo=Hu;var Ku=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(t=lc(),n=!1,s="",u=!1,l={},Ou()&&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,Gc();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=dc(ic.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=2;break}return a("Page is logout. Routing to logout function..."),e.next=1,xu();case 1:return e.abrupt("return");case 2:if(!window.authentication_config.sessionManagementEnabled){e.next=9;break}return e.next=3,h();case 3:if(""===s){e.next=5;break}if(p=null,f=JSON.parse(window.localStorage.getItem(ic.LOCAL_STORAGE_SESSION_KEY)),"{}"!==vu()){e.next=4;break}return f&&(p=f.jwt),e.next=4,Ru({idToken:s,entitlementToken:p});case 4:e.next=8;break;case 5:return e.prev=5,e.next=6,_u();case 6:m=e.sent,s=m.idToken,(n="string"==typeof s)&&(l=yc(s)),e.next=8;break;case 7:e.prev=7,w=e.catch(5),a("Unable to initialize session: ",w);case 8:e.next=10;break;case 9:return e.next=10,h();case 10:if(n||u||!i.A.blueconicEnabled||!i.A.bcLowaSegements){e.next=12;break}return e.next=11,Lc(!0);case 11:(g=e.sent).isSub&&(n=ic.USER_IS_LOWA,l={sub:g.uuid});case 12:if(Wc({isAuthenticated:n,idToken:s,accessToken:u,claims:l}),Xc("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")&&!Ou()&&(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")&&!Ou()?(a("Page is login. Attempting to log user in..."),Du()):a("Page is not login or Connext state is present"),!t.pathname.startsWith("/callback")||!t.searchParams.get("regwall")){e.next=14;break}return a("Page is callback with regwall param. Routing to regwall receiver..."),e.next=13,ju();case 13:a("Now login from regwall"),Du(),e.next=15;break;case 14:if(!t.pathname.startsWith("/callback")){e.next=15;break}return a("Page is callback without regwall param. Routing to callback receiver..."),e.next=15,Bu();case 15:case"end":return e.stop()}},e,null,[[5,7]])}));return function(){return e.apply(this,arguments)}}();window.MNGAuthentication.init=Ku;function Gu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wu(e,t){for(var n=0;n1&&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,A,S,T,k,_,R,I,O;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=qu(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",(A=v.appendChild(document.createElement("span"))).className="tooltiptext",A.textContent="Apply date",(S=E.appendChild(document.createElement("span"))).className="tooltiptext",S.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),T=JSON.parse(localStorage.getItem("__MNG_Session")),k=yc(T.entitlementToken),_=new Date(1e3*T.expiration),R=new Date(1e3*k.session_exp),b.value=_.toISOString().replace(/.\d+Z$/g,""),(I=document.createElement("div")).style.padding="5px 0px 0px 10px",I.innerHTML='\n\t\t

Entitlements JWT

\n\t\t',Object.keys(k).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(k[e],""),t.append(n,i),I.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)})}),(O=document.createElement("div")).style.padding="5px 0px 0px 10px",O.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.",O.append(t),e.next=3;break;case 1:return e.next=2,Qu();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),O.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,I,O),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")&&yu(m).forEach(function(e){var t=e;t.textContent="Subscriber - Employee",t.style.color="blue"}),n&&(this.addSpoofBannerToPage(f),this.userSpoofCheckbox.checked=!0,yu(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);T.expiration=r,localStorage.setItem("__MNG_Session",JSON.stringify(T)),window.localStorage.setItem("manual-expiration",!0),e.interval&&clearInterval(e.interval),e.timeLeftPopUp(T.expiration)}),document.getElementById("reset-exp-btn").addEventListener("click",function(){b.value=R.toISOString().replace(/.\d+Z$/g,"")}),this.addEventListeners(),i&&(this.datePickerCheckbox.click(),e.timeLeftPopUp(T.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(ic.USER_PROFILE_HASH)}}]);var t,n,i}(),el=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=qu(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,kc();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 tl,nl,rl,ol,il,al=[],sl=gc();sl=sl.replace("local","com");var cl="".concat(i.A.entitlementsEndpoint,"newsletters"),ul=function(e){var t=new Date,n=Math.round(t.getTime()/1e3)-86400;return new Date(e)>=new Date(1e3*n).getTime()},ll=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=cl,"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,oc({method:t.method,url:n,headers:{"X-Api-Key":i.A.entitlementsApiKey},data:t.dataToSend});case 2:r=e.sent,"get"===t.method&&((al=r.data.responseData).sort(function(e,t){return e.title>t.title?1:-1}),"limited"===nl?(s=al.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:al})),ml()),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)}}(),dl=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)"},hl=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,al.find(function(e){return e.id===o}).isSubscribed=i,t.method=i?"post":"delete",t.dataToSend={email:tl,domain:sl,preferenceId:o},fl(t)},pl=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=dl())))}},fl=function(e){localStorage.setItem("userNewsLetterData",JSON.stringify({expoDate:rl,newsLetterData:al})),ll({method:e.method,dataToSend:e.dataToSend})},ml=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",pl),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",pl);var i=n.cloneNode(!0);i.classList.add("show-digisubs-push","newsletter-dropdown-title"),i.style.display="flex",i.addEventListener("click",pl),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=Fc();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={},al.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(il," Newsletters:")):g=["".concat(il," Newsletters:")].concat(yu(g)),g);y["".concat(il," 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(il," 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",hl),ol&&(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",hl),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 gl=function(e,t,n,r){if(tl=e,nl=t,il=r,ol=n){jc("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",sl),localStorage.getItem("userNewsLetterData")){var s=JSON.parse(localStorage.getItem("userNewsLetterData"));rl=s.expoDate,ul(rl)?(al=s.newsLetterData,ml()):ll({method:"get",dataToSend:{email:tl,domain:sl}})}else ll({method:"get",dataToSend:{email:tl,domain:sl}})};var yl=function(){var e=ru()?ru().querySelector(Qc):null,t=ru();null!==e&&t.removeChild(e)},wl=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,A,S,T,k,_,R,I,O,C,N,L,x,P,U,D,M,B,j,H,K,G,W,F,X,V,z,J,Y,q,Z,Q,$,ee,te,ne,re,oe,ie,ae,se,ce,ue,le,de,he,pe,fe,me,ge,ye,we,be,ve,Ee,Ae,Se,Te,ke,_e,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,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"),S=null==l?void 0:l.replace("Trib-","").toLowerCase(),a("Validate connection source: ",S),e.prev=1,_e=S,e.next="google-oauth2"===_e||"google"===_e?2:"facebook"===_e?3:"apple"===_e?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="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===ic.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)),yl(),au().style.display="none",iu().dataset.status="logged-in",(k=cu()).removeChild(k.firstChild),(_=document.createElement("a")).id="anchorProfileDropDown",_.className="nav-link dropdown-toggle dropdown-toogle-mobile",_.setAttribute("aria-label","Account menu dropdown"),_.style.cursor="pointer",_.setAttribute("tabindex","0"),_.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"),(O=document.createElement("span")).className="icon-arrow-down",O.id="icon-caret",O.setAttribute("aria-hidden","true"),C=document.createElement("div"),(N=document.createElement("div")).id="account-content",N.className="dropdown-menu",C.id="account-content-container",document.body.appendChild(C),k.append(_,N),L="",window.dataLayer.forEach(function(e){Object.prototype.hasOwnProperty.call(e,"SiteName")&&(L=e.SiteName)}),x=window,P=x.location,U=new URL(P),j=null,n!==ic.USER_IS_LOWA?((j=document.createElement("a")).className="dropdown-item dropdown-profile account-link",j.text=E):document.getElementById("push-email-link").style.display="none",n===ic.USER_IS_LOWA&&((H=document.createElement("li")).className="dropdown-item log-in-button subscribe-special custom-button",K=document.createElement("a"),G=lc(),K.href="/login?returnUrl=".concat(G),K.target="_blank",K.text="Complete Log In",K.style.cursor="pointer",K.style.margin="0",K.style.width="auto"),W=bl('\n\t\t\t'),F=A(r),(X=document.createElement("div")).className="dropdown-item digisubs-top-info-container account-link account-settings",X.setAttribute("data-mng-click","account-settings"),X.setAttribute("data-mng-category","account-link"),X.setAttribute("data-mng-action","account-settings"),V=gu(),z=hc(),J="https://checkout.".concat(z),V){J=V.href,a("Original sub URL: ",J);try{(Y=new URL(J)).searchParams.has("newUser")||Y.searchParams.set("newUser","true"),J=Y.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(F,"
\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(F,"
\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
"),Z=bl(q),X.appendChild(Z),(Q=document.createElement("a")).className="dropdown-item account-link account-settings",Q.setAttribute("data-mng-click","account-settings"),Q.setAttribute("data-mng-category","account-link"),Q.setAttribute("data-mng-action","account-settings"),$="\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
'),ee=bl($),Q.appendChild(ee),i.A.enableReaderDashboardLink&&((D=document.createElement("a")).className="dropdown-item",D.id="reader-dashboard-link",D.setAttribute("data-mng-click","reader-dashboard"),D.setAttribute("data-mng-category","account-link"),D.setAttribute("data-mng-action","reader-dashboard"),D.href="".concat(U.origin,"/user-tools/dashboard"),D.target="_blank",te=bl('\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
'),D.appendChild(te)),i.A.enableGiftedArticlesLink&&((M=document.createElement("a")).className="dropdown-item",M.setAttribute("data-mng-click","gifted-articles"),M.setAttribute("data-mng-category","account-link"),M.setAttribute("data-mng-action","gifted-articles"),M.href="".concat(U.origin,"/user-tools/dashboard/#shared-articles-container"),M.target="_blank",ne="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
'),re=bl(ne),M.appendChild(re)),i.A.enableSavedArticlesLink&&((B=document.createElement("a")).className="dropdown-item",B.href="".concat(U.origin,"/user-tools/dashboard/#saved-article-container"),B.target="_blank",oe="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
',ie=bl(oe),B.appendChild(ie)),(ae=document.createElement("a")).className="dropdown-item",ae.href="".concat(U.origin,"/contact-us"),ae.target="_blank",ae.setAttribute("data-mng-click","contact-us"),ae.setAttribute("data-mng-category","account-link"),ae.setAttribute("data-mng-action","contact-us"),se=bl('\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
'),ae.appendChild(se),(ce=document.createElement("a")).className="dropdown-item",ce.href="".concat(U.origin,"/logout"),ae.setAttribute("data-mng-click","logout"),ae.setAttribute("data-mng-category","account-link"),ae.setAttribute("data-mng-action","logout"),ue=bl("\n\t\t
\n\t\t\t
\n\t\t\t\t
Log Out
\n\t\t\t
\n\t\t
"),ce.appendChild(ue),(le=document.createElement("a")).className="dropdown-item",le.setAttribute("data-mng-click","marketing-content"),le.setAttribute("data-mng-category","marketing-content"),le.setAttribute("data-mng-action","marketing-content"),de=bl("\n\t\t
\n\t\t\t
\n\t\t\t\tSAMPLE MARKETING ITEM HERE\n\t\t\t
\n\t\t
"),le.appendChild(de),k.id="profileDropDown",k.className="nav-item dropdown auth-visible show",_.append(R,O),H&&document.getElementById("account-content").append(H),he=[W,X].concat(yu(D?[D]:[]),[Q],yu(M?[M]:[]),yu(B?[B]:[]),[ae,ce,le]),(T=document.getElementById("account-content")).append.apply(T,yu(he)),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&&((pe=document.createElement("a")).className="show-digisubs-push dashboard-link",pe.id="push-reader-dashboard",pe.text="Reader Dashboard",pe.href="".concat(U.origin,"/user-tools/dashboard"),document.querySelector("#push-account-link").after(pe)),a("Employee tools: start tools here",d,r,y),!1===(fe=d)&&(fe="none"),(me=new $u(fe,r,y)).init(),el(fe,r),i.A.newslettersEnabled&&p&&(ge=E,ye=!1,me.userSpoofCheckbox&&(ye=me.userSpoofCheckbox.checked),localStorage.getItem("spoof-user")&&(ge=localStorage.getItem("spoof-user")),!0===n&&gl(ge,p,ye,L)),we=document.getElementById("account-content"),be=document.querySelector(".search-icon-wrapper"),ve=function(){var e=we.classList.contains("show");O.className=e?"icon-arrow-up":"icon-arrow-down",_.setAttribute("aria-expanded",e.toString()),e?(null==be||be.classList.add("search-icon-wrapper-hide"),C.style.display="block"):(null==be||be.classList.remove("search-icon-wrapper-hide"),C.style.display="none")},window.addEventListener("resize",ve),_.addEventListener("click",function(){we.classList.toggle("show"),ve()}),document.getElementById("anchorProfileDropDown").addEventListener("keydown",function(e){"Enter"===e.key&&(we.classList.toggle("show"),ve())}),document.addEventListener("click",function(e){_.contains(e.target)||we.contains(e.target)||(we.classList.remove("show"),ve())}),v=document.getElementsByClassName("account-link"),Ee=0;Ee0&&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,Tc();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}()),Al=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,Uc();case 1:(l=e.sent)&&l.token&&(d=l.token,h=yc(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)}}(),Sl=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=lc(),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)}}(),Tl=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))},kl=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,fu().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)}}(),_l=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)}},Rl=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)},Il=function(){a("UIHandler: ","show logout buttons"),Rl("engageLogoutLink"),document.querySelectorAll(Qc).forEach(function(e){var t=e;t.style.visibility="visible",t.style.display="block",t.addEventListener("click",_l),t.addEventListener("keydown",_l)})},Ol=function(){a("UIHandler: ","show login buttons"),Rl("engageLoginLink"),fu().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",lc()),t.querySelector("a").setAttribute("href","".concat(n,"?").concat(r))})},Cl=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,A;return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a("UIHandler: ","setup"),e.next=1,Hu();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,Al();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=Tl({siteUrl:Fc()}),!n){e.next=6;break}if(!i.A.dropdownEnabled){e.next=4;break}return n===ic.USER_IS_LOWA||r&&!r.includes("@example.com")||(r=w),e.next=3,vl({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,kl({entitlementSource:p,siteUrl:gc(),accountHref:b});case 5:Il(),e.next=7;break;case 6:Ol();case 7:v=du(),h?(mu().forEach(function(e){e.style.display="none"}),v&&(v.style.display="none")):(mu().forEach(function(e){var t=e;t.style.display="block",Sl(t)}),v&&(v.style.display="flex",E=lc(),(A=new URL(v.getAttribute("href"))).searchParams.set("returnUrl",encodeURIComponent(E.href)),v.setAttribute("href",A.href)));case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Nl=function(){var e=cu();e&&(e.style.display="block",e.style.visibility="visible");var t=cu()?cu().querySelector("a"):null;t&&(t.textContent="Loading..."),iu().dataset.status="logged-out"},Ll=function(){var e=r(o.mark(function e(){return o.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return Nl(),e.next=1,Cl();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 xl=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,Ac();case 1:return e.next=2,Rc();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,_c("Paywall_Level");case 4:return t=e.sent,e.next=5,Al();case 5:n=e.sent,r=n.userIsEntitled,i=n.entitlementLevel,El.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()}}}),El.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"}}}),El.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)}}(),Pl=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,Sc();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,xl();case 1:return e.next=2,El.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,Ll();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:Pl();case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}})()()})()})(); //# sourceMappingURL=mng-digisubs.uiHandler.bundle.js.map;